Code::Blocks  SVN r11506
genericsinglechoicelist.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  *
5  * $Revision: 10270 $
6  * $Id: genericsinglechoicelist.cpp 10270 2015-05-15 10:57:08Z jenslody $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/scriptedwizard/genericsinglechoicelist.cpp $
8  */
9 
10 #include <sdk.h>
11 #ifndef CB_PRECOMP
12  #include <wx/arrstr.h>
13  //(*InternalHeadersPCH(GenericSingleChoiceList)
14  #include <wx/string.h>
15  #include <wx/intl.h>
16  //*)
17 #endif // CB_PRECOMP
18 
20 
21 
22 //(*IdInit(GenericSingleChoiceList)
25 //*)
26 
27 BEGIN_EVENT_TABLE(GenericSingleChoiceList,wxPanel)
28  //(*EventTable(GenericSingleChoiceList)
29  //*)
30 END_EVENT_TABLE()
31 
33 {
34  //(*Initialize(GenericSingleChoiceList)
35  wxBoxSizer* BoxSizer1;
36  wxStaticBoxSizer* StaticBoxSizer1;
37 
38  Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
39  BoxSizer1 = new wxBoxSizer(wxVERTICAL);
40  lblDescr = new wxStaticText(this, ID_STATICTEXT1, _("Description"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
41  BoxSizer1->Add(lblDescr, 0, wxALL|wxEXPAND, 8);
42  StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Please make a selection"));
43  GenericChoiceList = new wxListBox(this, ID_LISTBOX1, wxDefaultPosition, wxSize(232,131), 0, 0, wxLB_SINGLE|wxLB_HSCROLL, wxDefaultValidator, _T("ID_LISTBOX1"));
44  StaticBoxSizer1->Add(GenericChoiceList, 1, wxALL|wxEXPAND, 4);
45  BoxSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND|wxFIXED_MINSIZE, 8);
46  SetSizer(BoxSizer1);
47  BoxSizer1->Fit(this);
48  BoxSizer1->SetSizeHints(this);
49  //*)
50 
51  GenericChoiceList->SetName(_T("GenericChoiceList"));
52 }
53 
55 {
56 }
57 
58 void GenericSingleChoiceList::SetChoices(const wxArrayString& choices, int defChoice)
59 {
60  GenericChoiceList->Clear();
61  for (size_t i = 0; i < choices.GetCount(); ++i)
62  {
63  GenericChoiceList->Append(choices[i]);
64  }
65 
66  if (static_cast<size_t>(defChoice) < choices.GetCount())
67  GenericChoiceList->SetSelection(defChoice);
68  else if (choices.GetCount() > 0)
69  GenericChoiceList->SetSelection(0);
70 }
wxSize Fit(wxWindow *window)
int wxNewId()
const wxValidator wxDefaultValidator
#define _T(string)
#define wxTAB_TRAVERSAL
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
#define wxLB_SINGLE
const wxString & _(const wxString &string)
void SetChoices(const wxArrayString &choices, int defChoice)
void SetSizeHints(wxWindow *window)
#define wxLB_HSCROLL
size_t GetCount() const
int wxWindowID