1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/choice.cpp
3 // Purpose: wxChoice implementation
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
28 #include "wx/choice.h"
31 #include "wx/arrstr.h"
34 IMPLEMENT_DYNAMIC_CLASS(wxChoice
, wxControl
)
36 BEGIN_EVENT_TABLE(wxChoice
, wxComboBox
)
37 EVT_COMBOBOX(wxID_ANY
, wxChoice::OnComboBox
)
40 wxChoice::wxChoice(wxWindow
*parent
, wxWindowID id
,
43 const wxArrayString
& choices
,
45 const wxValidator
& validator
,
48 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
51 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
54 const wxArrayString
& choices
,
56 const wxValidator
& validator
,
59 wxCArrayString
chs(choices
);
61 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
62 style
, validator
, name
);
65 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
68 int n
, const wxString choices
[],
70 const wxValidator
& validator
,
76 return wxComboBox::Create(parent
, id
, value
,
77 pos
, size
, n
, choices
,
78 wxCB_READONLY
, validator
, name
);
82 void wxChoice::OnComboBox(wxCommandEvent
& event
)
84 if ( event
.GetId() == GetId() )
86 event
.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED
);
88 GetEventHandler()->ProcessEvent(event
);
94 #endif // wxUSE_CHOICE