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 int wxChoice::GetCount() const
196 int wxChoice::FindString(const wxString
& s
) const
201 void wxChoice::SetString(int n
, const wxString
& s
)
205 wxString
wxChoice::GetString(int n
) const
212 // ----------------------------------------------------------------------------
214 // ----------------------------------------------------------------------------
216 void wxChoice::DoSetItemClientData( int n
, void* clientData
)
220 void* wxChoice::DoGetItemClientData( int n
) const
225 void wxChoice::DoSetItemClientObject( int n
, wxClientData
* clientData
)
229 wxClientData
* wxChoice::DoGetItemClientObject( int n
) const
231 return (wxClientData
*)DoGetItemClientData(n
);
234 // ----------------------------------------------------------------------------
235 // wxMSW specific helpers
236 // ----------------------------------------------------------------------------
238 void wxChoice::UpdateVisibleHeight()
242 void wxChoice::DoMoveWindow(int x
, int y
, int width
, int height
)
246 void wxChoice::DoGetSize(int *w
, int *h
) const
250 void wxChoice::DoSetSize(int x
, int y
,
251 int width
, int height
,
256 wxSize
wxChoice::DoGetBestSize() const
261 WXLRESULT
wxChoice::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
266 bool wxChoice::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
271 #endif // wxUSE_CHOICE