]>
Commit | Line | Data |
---|---|---|
2d61b48d | 1 | ///////////////////////////////////////////////////////////////////////////// |
b36e08d0 | 2 | // Name: src/common/choiccmn.cpp |
2d61b48d VZ |
3 | // Purpose: common (to all ports) wxChoice functions |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 26.07.99 | |
7 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) wxWidgets team |
65571936 | 9 | // Licence: wxWindows licence |
2d61b48d VZ |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
2d61b48d VZ |
20 | // For compilers that support precompilation, includes "wx.h". |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
1e6feb95 VZ |
27 | #if wxUSE_CHOICE |
28 | ||
b36e08d0 WS |
29 | #include "wx/choice.h" |
30 | ||
2d61b48d | 31 | #ifndef WX_PRECOMP |
2d61b48d VZ |
32 | #endif |
33 | ||
f36e602b | 34 | const char wxChoiceNameStr[] = "choice"; |
e7445ff8 | 35 | |
28953245 SC |
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 | ||
37788684 | 68 | wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h") |
28953245 SC |
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 | ||
2d61b48d VZ |
97 | // ============================================================================ |
98 | // implementation | |
99 | // ============================================================================ | |
100 | ||
05689a13 WS |
101 | wxChoiceBase::~wxChoiceBase() |
102 | { | |
103 | // this destructor is required for Darwin | |
104 | } | |
105 | ||
2d61b48d | 106 | // ---------------------------------------------------------------------------- |
6c8a980f | 107 | // misc |
2d61b48d VZ |
108 | // ---------------------------------------------------------------------------- |
109 | ||
6c8a980f | 110 | void wxChoiceBase::Command(wxCommandEvent& event) |
2d61b48d | 111 | { |
687706f5 | 112 | SetSelection(event.GetInt()); |
004867db | 113 | (void)GetEventHandler()->ProcessEvent(event); |
2d61b48d | 114 | } |
1e6feb95 VZ |
115 | |
116 | #endif // wxUSE_CHOICE |