]> git.saurik.com Git - wxWidgets.git/blob - src/common/choiccmn.cpp
Update version to 2.9.4 in version.bkl too and rebake everything.
[wxWidgets.git] / src / common / choiccmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/choiccmn.cpp
3 // Purpose: common (to all ports) wxChoice functions
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 26.07.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_CHOICE
28
29 #include "wx/choice.h"
30
31 #ifndef WX_PRECOMP
32 #endif
33
34 const char wxChoiceNameStr[] = "choice";
35
36
37 wxDEFINE_FLAGS( wxChoiceStyle )
38 wxBEGIN_FLAGS( wxChoiceStyle )
39 // new style border flags, we put them first to
40 // use them for streaming out
41 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
42 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
43 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
44 wxFLAGS_MEMBER(wxBORDER_RAISED)
45 wxFLAGS_MEMBER(wxBORDER_STATIC)
46 wxFLAGS_MEMBER(wxBORDER_NONE)
47
48 // old style border flags
49 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
50 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
51 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
52 wxFLAGS_MEMBER(wxRAISED_BORDER)
53 wxFLAGS_MEMBER(wxSTATIC_BORDER)
54 wxFLAGS_MEMBER(wxBORDER)
55
56 // standard window styles
57 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
58 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
59 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
60 wxFLAGS_MEMBER(wxWANTS_CHARS)
61 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
62 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
63 wxFLAGS_MEMBER(wxVSCROLL)
64 wxFLAGS_MEMBER(wxHSCROLL)
65
66 wxEND_FLAGS( wxChoiceStyle )
67
68 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h")
69
70 wxBEGIN_PROPERTIES_TABLE(wxChoice)
71 wxEVENT_PROPERTY( Select, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent )
72
73 wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, \
74 0 /*flags*/, wxT("Helpstring"), wxT("group"))
75 wxPROPERTY_COLLECTION( Choices, wxArrayString, wxString, AppendString, \
76 GetStrings, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
77 wxPROPERTY( Selection,int, SetSelection, GetSelection, wxEMPTY_PARAMETER_VALUE, \
78 0 /*flags*/, wxT("Helpstring"), wxT("group"))
79
80 /*
81 TODO PROPERTIES
82 selection (long)
83 content (list)
84 item
85 */
86
87 wxPROPERTY_FLAGS( WindowStyle, wxChoiceStyle, long, SetWindowStyleFlag, \
88 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
89 wxT("Helpstring"), wxT("group")) // style
90 wxEND_PROPERTIES_TABLE()
91
92 wxEMPTY_HANDLERS_TABLE(wxChoice)
93
94 wxCONSTRUCTOR_4( wxChoice, wxWindow*, Parent, wxWindowID, Id, \
95 wxPoint, Position, wxSize, Size )
96
97 // ============================================================================
98 // implementation
99 // ============================================================================
100
101 wxChoiceBase::~wxChoiceBase()
102 {
103 // this destructor is required for Darwin
104 }
105
106 // ----------------------------------------------------------------------------
107 // misc
108 // ----------------------------------------------------------------------------
109
110 void wxChoiceBase::Command(wxCommandEvent& event)
111 {
112 SetSelection(event.GetInt());
113 (void)GetEventHandler()->ProcessEvent(event);
114 }
115
116 #endif // wxUSE_CHOICE