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 BEGIN_EVENT_TABLE(wxChoice
, wxComboBox
)
35 EVT_COMBOBOX(wxID_ANY
, wxChoice::OnComboBox
)
38 wxChoice::wxChoice(wxWindow
*parent
, wxWindowID id
,
41 const wxArrayString
& choices
,
43 const wxValidator
& validator
,
46 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
49 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
52 const wxArrayString
& choices
,
54 const wxValidator
& validator
,
57 wxCArrayString
chs(choices
);
59 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
60 style
, validator
, name
);
63 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
66 int n
, const wxString choices
[],
68 const wxValidator
& validator
,
74 return wxComboBox::Create(parent
, id
, value
,
75 pos
, size
, n
, choices
,
76 wxCB_READONLY
, validator
, name
);
80 void wxChoice::OnComboBox(wxCommandEvent
& event
)
82 if ( event
.GetId() == GetId() )
84 event
.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED
);
86 GetEventHandler()->ProcessEvent(event
);
92 #endif // wxUSE_CHOICE