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

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmith/wxwidgets/defitems/wxschecklistbox.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: wxschecklistbox.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/wxschecklistbox.cpp $
 
21
*/
 
22
 
 
23
#include <wx/defs.h> // to have wxUSE_CHECKLISTBOX defined in the checklst.h header
 
24
#include <wx/checklst.h>
 
25
#include "wxschecklistbox.h"
 
26
 
 
27
namespace
 
28
{
 
29
    wxsRegisterItem<wxsCheckListBox> Reg(_T("CheckListBox"),wxsTWidget,_T("Standard"),50);
 
30
 
 
31
    WXS_ST_BEGIN(wxsCheckListBoxStyles,_T(""))
 
32
        WXS_ST_CATEGORY("wxCheckListBox")
 
33
        WXS_ST(wxLB_SINGLE)
 
34
        WXS_ST(wxLB_MULTIPLE)
 
35
        WXS_ST(wxLB_EXTENDED)
 
36
        WXS_ST(wxLB_HSCROLL)
 
37
        WXS_ST(wxLB_ALWAYS_SB)
 
38
        WXS_ST(wxLB_NEEDED_SB)
 
39
        WXS_ST(wxLB_SORT)
 
40
        WXS_ST_DEFAULTS()
 
41
    WXS_ST_END()
 
42
 
 
43
 
 
44
    WXS_EV_BEGIN(wxsCheckListBoxEvents)
 
45
        WXS_EVI(EVT_CHECKLISTBOX,wxEVT_COMMAND_CHECKLISTBOX_TOGGLED,wxCommandEvent,Toggled)
 
46
    WXS_EV_END()
 
47
}
 
48
 
 
49
wxsCheckListBox::wxsCheckListBox(wxsItemResData* Data):
 
50
    wxsWidget(
 
51
        Data,
 
52
        &Reg.Info,
 
53
        wxsCheckListBoxEvents,
 
54
        wxsCheckListBoxStyles)
 
55
{}
 
56
 
 
57
 
 
58
void wxsCheckListBox::OnBuildCreatingCode()
 
59
{
 
60
    switch ( GetLanguage() )
 
61
    {
 
62
        case wxsCPP:
 
63
        {
 
64
            AddHeader(_T("<wx/checklst.h>"),GetInfo().ClassName,hfInPCH);
 
65
            Codef(_T("%C(%W, %I, %P, %S, 0, 0, %T, %V, %N);\n"));
 
66
 
 
67
            for ( size_t i = 0; i <  ArrayChoices.GetCount(); ++i )
 
68
            {
 
69
                if ( ArrayChecks[i] )
 
70
                {
 
71
                    Codef( _T("%ACheck("));
 
72
                }
 
73
                Codef( _T("%AAppend(%t)"), ArrayChoices[i].c_str());
 
74
                if ( ArrayChecks[i] )
 
75
                {
 
76
                    Codef(_T(")"));
 
77
                }
 
78
                Codef(_T(";\n"));
 
79
            }
 
80
            BuildSetupWindowCode();
 
81
            return;
 
82
        }
 
83
 
 
84
        default:
 
85
        {
 
86
            wxsCodeMarks::Unknown(_T("wxsCheckListBox::OnBuildCreatingCode"),GetLanguage());
 
87
        }
 
88
    }
 
89
}
 
90
 
 
91
 
 
92
wxObject* wxsCheckListBox::OnBuildPreview(wxWindow* Parent,long Flags)
 
93
{
 
94
    wxCheckListBox* Preview = new wxCheckListBox(Parent,GetId(),Pos(Parent),Size(Parent),0,0,Style());
 
95
    for ( size_t i = 0; i < ArrayChoices.GetCount(); ++i )
 
96
    {
 
97
        int Val = Preview->Append(ArrayChoices[i]);
 
98
        if ( ArrayChecks[i] )
 
99
        {
 
100
            Preview->Check(Val);
 
101
        }
 
102
    }
 
103
    return SetupWindow(Preview,Flags);
 
104
}
 
105
 
 
106
void wxsCheckListBox::OnEnumWidgetProperties(long Flags)
 
107
{
 
108
    WXS_ARRAYSTRINGCHECK(wxsCheckListBox,ArrayChoices,ArrayChecks,_("Choices"),_T("content"),_T("item"));
 
109
}