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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "univchoice.h"
24 #include "wx/wxprec.h"
33 #include "wx/choice.h"
34 #include "wx/arrstr.h"
37 IMPLEMENT_DYNAMIC_CLASS(wxChoice
, wxControl
)
39 BEGIN_EVENT_TABLE(wxChoice
, wxComboBox
)
40 EVT_COMBOBOX(-1, wxChoice::OnComboBox
)
43 wxChoice::wxChoice(wxWindow
*parent
, wxWindowID id
,
46 const wxArrayString
& choices
,
48 const wxValidator
& validator
,
51 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
54 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
57 const wxArrayString
& choices
,
59 const wxValidator
& validator
,
62 wxCArrayString
chs(choices
);
64 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
65 style
, validator
, name
);
68 bool wxChoice::Create(wxWindow
*parent
, wxWindowID id
,
71 int n
, const wxString choices
[],
73 const wxValidator
& validator
,
79 return wxComboBox::Create(parent
, id
, value
,
80 pos
, size
, n
, choices
,
81 wxCB_READONLY
, validator
, name
);
85 void wxChoice::OnComboBox(wxCommandEvent
& event
)
87 if ( event
.GetId() == GetId() )
89 event
.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED
);
91 GetEventHandler()->ProcessEvent(event
);
97 #endif // wxUSE_CHOICE