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"
29 #include "wx/choice.h"
33 #include "wx/settings.h"
36 #include "wx/palmos/private.h"
38 #if wxUSE_EXTENDED_RTTI
39 WX_DEFINE_FLAGS( wxChoiceStyle
)
41 wxBEGIN_FLAGS( wxChoiceStyle
)
42 // new style border flags, we put them first to
43 // use them for streaming out
44 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
45 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
46 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
47 wxFLAGS_MEMBER(wxBORDER_RAISED
)
48 wxFLAGS_MEMBER(wxBORDER_STATIC
)
49 wxFLAGS_MEMBER(wxBORDER_NONE
)
51 // old style border flags
52 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
53 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
54 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
55 wxFLAGS_MEMBER(wxRAISED_BORDER
)
56 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
57 wxFLAGS_MEMBER(wxBORDER
)
59 // standard window styles
60 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
61 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
62 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
63 wxFLAGS_MEMBER(wxWANTS_CHARS
)
64 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
65 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
66 wxFLAGS_MEMBER(wxVSCROLL
)
67 wxFLAGS_MEMBER(wxHSCROLL
)
69 wxEND_FLAGS( wxChoiceStyle
)
71 IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice
, wxControl
,"wx/choice.h")
73 wxBEGIN_PROPERTIES_TABLE(wxChoice
)
74 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_CHOICE_SELECTED
, wxCommandEvent
)
76 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
77 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
78 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
79 wxPROPERTY_FLAGS( WindowStyle
, wxChoiceStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
80 wxEND_PROPERTIES_TABLE()
82 wxBEGIN_HANDLERS_TABLE(wxChoice
)
83 wxEND_HANDLERS_TABLE()
85 wxCONSTRUCTOR_4( wxChoice
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
)
87 IMPLEMENT_DYNAMIC_CLASS(wxChoice
, wxControl
)
90 // ============================================================================
92 // ============================================================================
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 bool wxChoice::Create(wxWindow
*parent
,
102 int n
, const wxString choices
[],
104 const wxValidator
& validator
,
105 const wxString
& name
)
110 bool wxChoice::CreateAndInit(wxWindow
*parent
,
114 int n
, const wxString choices
[],
116 const wxValidator
& validator
,
117 const wxString
& name
)
122 bool wxChoice::Create(wxWindow
*parent
,
126 const wxArrayString
& choices
,
128 const wxValidator
& validator
,
129 const wxString
& name
)
134 bool wxChoice::MSWShouldPreProcessMessage(WXMSG
*pMsg
)
139 WXDWORD
wxChoice::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
144 wxChoice::~wxChoice()
148 // ----------------------------------------------------------------------------
149 // adding/deleting items to/from the list
150 // ----------------------------------------------------------------------------
152 int wxChoice::DoAppend(const wxString
& item
)
157 int wxChoice::DoInsert(const wxString
& item
, int pos
)
162 void wxChoice::Delete(int n
)
166 void wxChoice::Clear()
170 void wxChoice::Free()
174 // ----------------------------------------------------------------------------
176 // ----------------------------------------------------------------------------
178 int wxChoice::GetSelection() const
183 void wxChoice::SetSelection(int n
)
187 // ----------------------------------------------------------------------------
188 // string list functions
189 // ----------------------------------------------------------------------------
191 size_t wxChoice::GetCount() const
196 void wxChoice::SetString(int n
, const wxString
& s
)
200 wxString
wxChoice::GetString(int n
) const
207 // ----------------------------------------------------------------------------
209 // ----------------------------------------------------------------------------
211 void wxChoice::DoSetItemClientData( int n
, void* clientData
)
215 void* wxChoice::DoGetItemClientData( int n
) const
220 void wxChoice::DoSetItemClientObject( int n
, wxClientData
* clientData
)
224 wxClientData
* wxChoice::DoGetItemClientObject( int n
) const
226 return (wxClientData
*)DoGetItemClientData(n
);
229 // ----------------------------------------------------------------------------
230 // wxMSW specific helpers
231 // ----------------------------------------------------------------------------
233 void wxChoice::UpdateVisibleHeight()
237 void wxChoice::DoMoveWindow(int x
, int y
, int width
, int height
)
241 void wxChoice::DoGetSize(int *w
, int *h
) const
245 void wxChoice::DoSetSize(int x
, int y
,
246 int width
, int height
,
251 wxSize
wxChoice::DoGetBestSize() const
256 WXLRESULT
wxChoice::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
261 bool wxChoice::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
266 #endif // wxUSE_CHOICE