~ubuntu-branches/ubuntu/hardy/codeblocks/hardy-backports

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsbutton.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of wxSmith plugin for Code::Blocks Studio
 
3
* Copyright (C) 2006-2007  Bartlomiej Swiecki
 
4
*
 
5
* wxSmith is free software; you can redistribute it and/or modify
 
6
* it under the terms of the GNU General Public License as published by
 
7
* the Free Software Foundation; either version 3 of the License, or
 
8
* (at your option) any later version.
 
9
*
 
10
* wxSmith is distributed in the hope that it will be useful,
 
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
* GNU General Public License for more details.
 
14
*
 
15
* You should have received a copy of the GNU General Public License
 
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
 
17
*
 
18
* $Revision: 4850 $
 
19
* $Id: wxsbutton.cpp 4850 2008-01-29 21:45:49Z byo $
 
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsbutton.cpp $
 
21
*/
 
22
 
 
23
#include "wxsbutton.h"
 
24
 
 
25
namespace
 
26
{
 
27
    wxsRegisterItem<wxsButton> Reg(_T("Button"),wxsTWidget,_T("Standard"),90);
 
28
 
 
29
    WXS_ST_BEGIN(wxsButtonStyles,_T(""))
 
30
        WXS_ST_CATEGORY("wxButton")
 
31
        WXS_ST(wxBU_LEFT)
 
32
        WXS_ST(wxBU_TOP)
 
33
        WXS_ST(wxBU_RIGHT)
 
34
        WXS_ST(wxBU_BOTTOM)
 
35
        WXS_ST(wxBU_EXACTFIT)
 
36
        WXS_ST_DEFAULTS()
 
37
    WXS_ST_END()
 
38
 
 
39
    WXS_EV_BEGIN(wxsButtonEvents)
 
40
        WXS_EVI(EVT_BUTTON,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEvent,Click)
 
41
    WXS_EV_END()
 
42
}
 
43
 
 
44
wxsButton::wxsButton(wxsItemResData* Data):
 
45
    wxsWidget(
 
46
        Data,
 
47
        &Reg.Info,
 
48
        wxsButtonEvents,
 
49
        wxsButtonStyles),
 
50
    Label(_("Label")),
 
51
    IsDefault(false)
 
52
{}
 
53
 
 
54
void wxsButton::OnBuildCreatingCode()
 
55
{
 
56
    switch ( GetLanguage() )
 
57
    {
 
58
        case wxsCPP:
 
59
        {
 
60
            AddHeader(_T("<wx/button.h>"),GetInfo().ClassName,hfInPCH);
 
61
            Codef(_T("%C(%W, %I, %t, %P, %S, %T, %V, %N);\n"),Label.c_str());
 
62
            if ( IsDefault ) Codef( _T("%ASetDefault();\n"));
 
63
            BuildSetupWindowCode();
 
64
            return;
 
65
        }
 
66
 
 
67
        default:
 
68
        {
 
69
            wxsCodeMarks::Unknown(_T("wxsButton::OnBuildCreatingCode"),GetLanguage());
 
70
        }
 
71
    }
 
72
}
 
73
 
 
74
wxObject* wxsButton::OnBuildPreview(wxWindow* Parent,long Flags)
 
75
{
 
76
    wxButton* Preview = new wxButton(Parent,GetId(),Label,Pos(Parent),Size(Parent),Style());
 
77
    if ( IsDefault ) Preview->SetDefault();
 
78
    return SetupWindow(Preview,Flags);
 
79
}
 
80
 
 
81
void wxsButton::OnEnumWidgetProperties(long Flags)
 
82
{
 
83
    WXS_STRING(wxsButton,Label,_("Label"),_T("label"),_T(""),false)
 
84
    WXS_BOOL(wxsButton,IsDefault,_("Is default"),_T("default"),false)
 
85
}