1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/combobox.cpp
3 // Purpose: wxComboBox class
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
29 #include "wx/combobox.h"
32 #include "wx/settings.h"
34 // for wxEVT_COMMAND_TEXT_ENTER
35 #include "wx/textctrl.h"
39 #include "wx/clipbrd.h"
40 #include "wx/palmos/private.h"
43 #include "wx/tooltip.h"
44 #endif // wxUSE_TOOLTIPS
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 #if wxUSE_EXTENDED_RTTI
51 WX_DEFINE_FLAGS( wxComboBoxStyle
)
53 wxBEGIN_FLAGS( wxComboBoxStyle
)
54 // new style border flags, we put them first to
55 // use them for streaming out
56 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
57 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
58 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
59 wxFLAGS_MEMBER(wxBORDER_RAISED
)
60 wxFLAGS_MEMBER(wxBORDER_STATIC
)
61 wxFLAGS_MEMBER(wxBORDER_NONE
)
63 // old style border flags
64 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
65 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
66 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
67 wxFLAGS_MEMBER(wxRAISED_BORDER
)
68 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
69 wxFLAGS_MEMBER(wxBORDER
)
71 // standard window styles
72 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
73 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
74 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
75 wxFLAGS_MEMBER(wxWANTS_CHARS
)
76 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
77 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
78 wxFLAGS_MEMBER(wxVSCROLL
)
79 wxFLAGS_MEMBER(wxHSCROLL
)
81 wxFLAGS_MEMBER(wxCB_SIMPLE
)
82 wxFLAGS_MEMBER(wxCB_SORT
)
83 wxFLAGS_MEMBER(wxCB_READONLY
)
84 wxFLAGS_MEMBER(wxCB_DROPDOWN
)
86 wxEND_FLAGS( wxComboBoxStyle
)
88 IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox
, wxControl
,"wx/combobox.h")
90 wxBEGIN_PROPERTIES_TABLE(wxComboBox
)
91 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_COMBOBOX_SELECTED
, wxCommandEvent
)
92 wxEVENT_PROPERTY( TextEnter
, wxEVT_COMMAND_TEXT_ENTER
, wxCommandEvent
)
95 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
96 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
97 wxPROPERTY( Value
,wxString
, SetValue
, GetValue
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
98 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
99 wxPROPERTY_FLAGS( WindowStyle
, wxComboBoxStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
100 wxEND_PROPERTIES_TABLE()
102 wxBEGIN_HANDLERS_TABLE(wxComboBox
)
103 wxEND_HANDLERS_TABLE()
105 wxCONSTRUCTOR_5( wxComboBox
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Value
, wxPoint
, Position
, wxSize
, Size
)
107 IMPLEMENT_DYNAMIC_CLASS(wxComboBox
, wxControl
)
110 // ----------------------------------------------------------------------------
111 // function prototypes
112 // ----------------------------------------------------------------------------
114 // ---------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
118 // the pointer to standard radio button wnd proc
119 static WNDPROC gs_wndprocEdit
= (WNDPROC
)NULL
;
121 // ============================================================================
123 // ============================================================================
125 // ----------------------------------------------------------------------------
126 // wxComboBox callbacks
127 // ----------------------------------------------------------------------------
129 WXLRESULT
wxComboBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
134 bool wxComboBox::MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
)
139 bool wxComboBox::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
144 WXHWND
wxComboBox::GetEditHWND() const
149 // ----------------------------------------------------------------------------
150 // wxComboBox creation
151 // ----------------------------------------------------------------------------
153 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
154 const wxString
& value
,
157 int n
, const wxString choices
[],
159 const wxValidator
& validator
,
160 const wxString
& name
)
165 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
166 const wxString
& value
,
169 const wxArrayString
& choices
,
171 const wxValidator
& validator
,
172 const wxString
& name
)
177 WXDWORD
wxComboBox::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
182 // ----------------------------------------------------------------------------
183 // wxComboBox text control-like methods
184 // ----------------------------------------------------------------------------
186 void wxComboBox::SetValue(const wxString
& value
)
190 // Clipboard operations
191 void wxComboBox::Copy()
195 void wxComboBox::Cut()
199 void wxComboBox::Paste()
203 void wxComboBox::SetEditable(bool WXUNUSED(editable
))
207 void wxComboBox::SetInsertionPoint(long pos
)
211 void wxComboBox::SetInsertionPointEnd()
215 long wxComboBox::GetInsertionPoint() const
220 wxTextPos
wxComboBox::GetLastPosition() const
225 void wxComboBox::Replace(long from
, long to
, const wxString
& value
)
229 void wxComboBox::Remove(long from
, long to
)
233 void wxComboBox::SetSelection(long from
, long to
)
237 bool wxComboBox::IsEditable() const
242 void wxComboBox::Undo()
246 void wxComboBox::Redo()
250 void wxComboBox::SelectAll()
254 bool wxComboBox::CanCopy() const
259 bool wxComboBox::CanCut() const
264 bool wxComboBox::CanPaste() const
269 bool wxComboBox::CanUndo() const
274 bool wxComboBox::CanRedo() const
280 #endif // wxUSE_COMBOBOX