1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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"
29 #include "wx/choice.h"
30 #include "wx/arrstr.h"
33 IMPLEMENT_DYNAMIC_CLASS(wxChoice
, wxControl
)
35 BEGIN_EVENT_TABLE(wxChoice
, wxComboBox
)
36 EVT_COMBOBOX(wxID_ANY
, wxChoice::OnComboBox
)
39 wxChoice::wxChoice(wxWindow
*parent
, wxWindowID id
,
42 const wxArrayString
& choices
,
44 const wxValidator
& validator
,
47 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
50 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
53 const wxArrayString
& choices
,
55 const wxValidator
& validator
,
58 wxCArrayString
chs(choices
);
60 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
61 style
, validator
, name
);
64 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
67 int n
, const wxString choices
[],
69 const wxValidator
& validator
,
75 return wxComboBox::Create(parent
, id
, value
,
76 pos
, size
, n
, choices
,
77 wxCB_READONLY
, validator
, name
);
81 void wxChoice::OnComboBox(wxCommandEvent
& event
)
83 if ( event
.GetId() == GetId() )
85 event
.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED
);
87 GetEventHandler()->ProcessEvent(event
);
93 #endif // wxUSE_CHOICE