]> git.saurik.com Git - wxWidgets.git/blob - src/univ/choice.cpp
Separated wxImage::FloodFill from image.cpp
[wxWidgets.git] / src / univ / choice.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: univ/choice.cpp
3 // Purpose: wxChoice implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 15.12.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "univchoice.h"
22 #endif
23
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #if wxUSE_CHOICE
31
32 #ifndef WX_PRECOMP
33 #include "wx/choice.h"
34 #endif
35
36 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
37
38 BEGIN_EVENT_TABLE(wxChoice, wxComboBox)
39 EVT_COMBOBOX(-1, wxChoice::OnComboBox)
40 END_EVENT_TABLE()
41
42 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
43 const wxPoint& pos,
44 const wxSize& size,
45 int n, const wxString choices[],
46 long style,
47 const wxValidator& validator,
48 const wxString& name)
49 {
50 wxString value;
51 if ( n )
52 value = choices[0];
53 return wxComboBox::Create(parent, id, value,
54 pos, size, n, choices,
55 wxCB_READONLY, validator, name);
56 }
57
58
59 void wxChoice::OnComboBox(wxCommandEvent& event)
60 {
61 if ( event.GetId() == GetId() )
62 {
63 event.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED);
64 event.Skip();
65 GetEventHandler()->ProcessEvent(event);
66 }
67 else
68 event.Skip();
69 }
70
71 #endif // wxUSE_CHOICE