1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/choice.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
7 // Copyright: (c) William Osborne
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
28 #include "wx/choice.h"
34 #include "wx/settings.h"
37 #include "wx/palmos/private.h"
39 #if wxUSE_EXTENDED_RTTI
40 WX_DEFINE_FLAGS( wxChoiceStyle
)
42 wxBEGIN_FLAGS( wxChoiceStyle
)
43 // new style border flags, we put them first to
44 // use them for streaming out
45 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
46 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
47 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
48 wxFLAGS_MEMBER(wxBORDER_RAISED
)
49 wxFLAGS_MEMBER(wxBORDER_STATIC
)
50 wxFLAGS_MEMBER(wxBORDER_NONE
)
52 // old style border flags
53 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
54 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
55 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
56 wxFLAGS_MEMBER(wxRAISED_BORDER
)
57 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
58 wxFLAGS_MEMBER(wxBORDER
)
60 // standard window styles
61 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
62 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
63 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
64 wxFLAGS_MEMBER(wxWANTS_CHARS
)
65 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
66 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
67 wxFLAGS_MEMBER(wxVSCROLL
)
68 wxFLAGS_MEMBER(wxHSCROLL
)
70 wxEND_FLAGS( wxChoiceStyle
)
72 IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice
, wxControl
,"wx/choice.h")
74 wxBEGIN_PROPERTIES_TABLE(wxChoice
)
75 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_CHOICE_SELECTED
, wxCommandEvent
)
77 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
78 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
79 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
80 wxPROPERTY_FLAGS( WindowStyle
, wxChoiceStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
81 wxEND_PROPERTIES_TABLE()
83 wxBEGIN_HANDLERS_TABLE(wxChoice
)
84 wxEND_HANDLERS_TABLE()
86 wxCONSTRUCTOR_4( wxChoice
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
)
88 IMPLEMENT_DYNAMIC_CLASS(wxChoice
, wxControl
)
91 // ============================================================================
93 // ============================================================================
95 // ----------------------------------------------------------------------------
97 // ----------------------------------------------------------------------------
99 bool wxChoice::Create(wxWindow
*parent
,
103 int n
, const wxString choices
[],
105 const wxValidator
& validator
,
106 const wxString
& name
)
111 bool wxChoice::CreateAndInit(wxWindow
*parent
,
115 int n
, const wxString choices
[],
117 const wxValidator
& validator
,
118 const wxString
& name
)
123 bool wxChoice::Create(wxWindow
*parent
,
127 const wxArrayString
& choices
,
129 const wxValidator
& validator
,
130 const wxString
& name
)
135 bool wxChoice::MSWShouldPreProcessMessage(WXMSG
*pMsg
)
140 WXDWORD
wxChoice::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
145 wxChoice::~wxChoice()
149 // ----------------------------------------------------------------------------
150 // adding/deleting items to/from the list
151 // ----------------------------------------------------------------------------
153 int wxChoice::DoAppend(const wxString
& item
)
158 int wxChoice::DoInsert(const wxString
& item
, unsigned int pos
)
163 void wxChoice::Delete(unsigned int n
)
167 void wxChoice::Clear()
171 void wxChoice::Free()
175 // ----------------------------------------------------------------------------
177 // ----------------------------------------------------------------------------
179 int wxChoice::GetSelection() const
184 void wxChoice::SetSelection(int n
)
188 // ----------------------------------------------------------------------------
189 // string list functions
190 // ----------------------------------------------------------------------------
192 unsigned int wxChoice::GetCount() const
197 void wxChoice::SetString(unsigned int n
, const wxString
& s
)
201 wxString
wxChoice::GetString(unsigned int n
) const
203 return wxEmptyString
;
206 // ----------------------------------------------------------------------------
208 // ----------------------------------------------------------------------------
210 void wxChoice::DoSetItemClientData(unsigned int n
, void* clientData
)
214 void* wxChoice::DoGetItemClientData(unsigned int n
) const
219 void wxChoice::DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
)
223 wxClientData
* wxChoice::DoGetItemClientObject(unsigned int n
) const
225 return (wxClientData
*)DoGetItemClientData(n
);
228 // ----------------------------------------------------------------------------
229 // wxMSW specific helpers
230 // ----------------------------------------------------------------------------
232 void wxChoice::UpdateVisibleHeight()
236 void wxChoice::DoMoveWindow(int x
, int y
, int width
, int height
)
240 void wxChoice::DoGetSize(int *w
, int *h
) const
244 void wxChoice::DoSetSize(int x
, int y
,
245 int width
, int height
,
250 wxSize
wxChoice::DoGetBestSize() const
255 WXLRESULT
wxChoice::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
260 bool wxChoice::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
265 #endif // wxUSE_CHOICE