Remove obsolete VisualAge-related files.
[wxWidgets.git] / src / univ / choice.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/choice.cpp
3 // Purpose: wxChoice implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 15.12.00
7 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/wxprec.h"
20
21 #ifdef __BORLANDC__
22 #pragma hdrstop
23 #endif
24
25 #if wxUSE_CHOICE
26
27 #include "wx/choice.h"
28
29 #ifndef WX_PRECOMP
30 #include "wx/arrstr.h"
31 #endif
32
33 BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
34 EVT_COMBOBOX(wxID_ANY, wxChoice::OnComboBox)
35 END_EVENT_TABLE()
36
37 wxChoice::wxChoice(wxWindow *parent, wxWindowID id,
38 const wxPoint& pos,
39 const wxSize& size,
40 const wxArrayString& choices,
41 long style,
42 const wxValidator& validator,
43 const wxString& name)
44 {
45 Create(parent, id, pos, size, choices, style, validator, name);
46 }
47
48 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
49 const wxPoint& pos,
50 const wxSize& size,
51 const wxArrayString& choices,
52 long style,
53 const wxValidator& validator,
54 const wxString& name)
55 {
56 wxCArrayString chs(choices);
57
58 return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
59 style, validator, name);
60 }
61
62 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
63 const wxPoint& pos,
64 const wxSize& size,
65 int n, const wxString choices[],
66 long WXUNUSED(style),
67 const wxValidator& validator,
68 const wxString& name)
69 {
70 wxString value;
71 if ( n )
72 value = choices[0];
73 return wxComboBox::Create(parent, id, value,
74 pos, size, n, choices,
75 wxCB_READONLY, validator, name);
76 }
77
78
79 void wxChoice::OnComboBox(wxCommandEvent& event)
80 {
81 if ( event.GetId() == GetId() )
82 {
83 event.SetEventType(wxEVT_CHOICE);
84 event.Skip();
85 GetEventHandler()->ProcessEvent(event);
86 }
87 else
88 event.Skip();
89 }
90
91 #endif // wxUSE_CHOICE