2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
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.
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.
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/>.
19
* $Id: wxslistbox.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/wxslistbox.cpp $
23
#include "wxslistbox.h"
27
wxsRegisterItem<wxsListBox> Reg(_T("ListBox"),wxsTWidget,_T("Standard"),70);
29
WXS_ST_BEGIN(wxsListBoxStyles,_T(""))
30
WXS_ST_CATEGORY("wxListBox")
35
WXS_ST(wxLB_ALWAYS_SB)
36
WXS_ST(wxLB_NEEDED_SB)
41
WXS_EV_BEGIN(wxsListBoxEvents)
42
WXS_EVI(EVT_LISTBOX,wxEVT_COMMAND_LISTBOX_SELECTED,wxCommandEvent,Select)
43
WXS_EVI(EVT_LISTBOX_DCLICK,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,wxCommandEvent,DClick)
47
wxsListBox::wxsListBox(wxsItemResData* Data):
56
void wxsListBox::OnBuildCreatingCode()
58
switch ( GetLanguage() )
62
AddHeader(_T("<wx/listbox.h>"),GetInfo().ClassName,hfInPCH);
63
Codef(_T("%C(%W, %I, %P, %S, 0, 0, %T, %V, %N);\n"));
64
for ( size_t i = 0; i < ArrayChoices.GetCount(); ++i )
66
if ( DefaultSelection == (int)i )
68
Codef(_T("%ASetSelection( "));
70
Codef( _T("%AAppend(%t)"), ArrayChoices[i].c_str());
71
if ( DefaultSelection == (int)i )
78
BuildSetupWindowCode();
84
wxsCodeMarks::Unknown(_T("wxsListBox::OnBuildCreatingCode"),GetLanguage());
90
wxObject* wxsListBox::OnBuildPreview(wxWindow* Parent,long Flags)
92
wxListBox* Preview = new wxListBox(Parent,GetId(),Pos(Parent),Size(Parent),0,0, Style());
93
for ( size_t i = 0; i < ArrayChoices.GetCount(); ++i )
95
int Val = Preview->Append(ArrayChoices[i]);
96
if ( (int)i == DefaultSelection )
98
Preview->SetSelection(Val);
102
return SetupWindow(Preview,Flags);
105
void wxsListBox::OnEnumWidgetProperties(long Flags)
107
WXS_ARRAYSTRING(wxsListBox,ArrayChoices,_("Choices"),_T("content"),_T("item"))
108
WXS_LONG(wxsListBox,DefaultSelection,_("Default"),_T("default"),0)