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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "combobox.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
34 #include "wx/settings.h"
36 // for wxEVT_COMMAND_TEXT_ENTER
37 #include "wx/textctrl.h"
40 #include "wx/combobox.h"
42 #include "wx/clipbrd.h"
43 #include "wx/palmos/private.h"
46 #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
49 #include "wx/tooltip.h"
50 #endif // wxUSE_TOOLTIPS
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
56 #if wxUSE_EXTENDED_RTTI
57 WX_DEFINE_FLAGS( wxComboBoxStyle
)
59 wxBEGIN_FLAGS( wxComboBoxStyle
)
60 // new style border flags, we put them first to
61 // use them for streaming out
62 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
63 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
64 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
65 wxFLAGS_MEMBER(wxBORDER_RAISED
)
66 wxFLAGS_MEMBER(wxBORDER_STATIC
)
67 wxFLAGS_MEMBER(wxBORDER_NONE
)
69 // old style border flags
70 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
71 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
72 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
73 wxFLAGS_MEMBER(wxRAISED_BORDER
)
74 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
75 wxFLAGS_MEMBER(wxBORDER
)
77 // standard window styles
78 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
79 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
80 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
81 wxFLAGS_MEMBER(wxWANTS_CHARS
)
82 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
83 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
84 wxFLAGS_MEMBER(wxVSCROLL
)
85 wxFLAGS_MEMBER(wxHSCROLL
)
87 wxFLAGS_MEMBER(wxCB_SIMPLE
)
88 wxFLAGS_MEMBER(wxCB_SORT
)
89 wxFLAGS_MEMBER(wxCB_READONLY
)
90 wxFLAGS_MEMBER(wxCB_DROPDOWN
)
92 wxEND_FLAGS( wxComboBoxStyle
)
94 IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox
, wxControl
,"wx/combobox.h")
96 wxBEGIN_PROPERTIES_TABLE(wxComboBox
)
97 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_COMBOBOX_SELECTED
, wxCommandEvent
)
98 wxEVENT_PROPERTY( TextEnter
, wxEVT_COMMAND_TEXT_ENTER
, wxCommandEvent
)
101 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
102 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
103 wxPROPERTY( Value
,wxString
, SetValue
, GetValue
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
104 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
105 wxPROPERTY_FLAGS( WindowStyle
, wxComboBoxStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
106 wxEND_PROPERTIES_TABLE()
108 wxBEGIN_HANDLERS_TABLE(wxComboBox
)
109 wxEND_HANDLERS_TABLE()
111 wxCONSTRUCTOR_5( wxComboBox
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Value
, wxPoint
, Position
, wxSize
, Size
)
113 IMPLEMENT_DYNAMIC_CLASS(wxComboBox
, wxControl
)
116 // ----------------------------------------------------------------------------
117 // function prototypes
118 // ----------------------------------------------------------------------------
120 // ---------------------------------------------------------------------------
122 // ---------------------------------------------------------------------------
124 // the pointer to standard radio button wnd proc
125 static WNDPROC gs_wndprocEdit
= (WNDPROC
)NULL
;
127 // ============================================================================
129 // ============================================================================
131 // ----------------------------------------------------------------------------
132 // wxComboBox callbacks
133 // ----------------------------------------------------------------------------
135 WXLRESULT
wxComboBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
140 bool wxComboBox::MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
)
145 bool wxComboBox::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
150 WXHWND
wxComboBox::GetEditHWND() const
155 // ----------------------------------------------------------------------------
156 // wxComboBox creation
157 // ----------------------------------------------------------------------------
159 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
160 const wxString
& value
,
163 int n
, const wxString choices
[],
165 const wxValidator
& validator
,
166 const wxString
& name
)
171 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
172 const wxString
& value
,
175 const wxArrayString
& choices
,
177 const wxValidator
& validator
,
178 const wxString
& name
)
183 WXDWORD
wxComboBox::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
188 // ----------------------------------------------------------------------------
189 // wxComboBox text control-like methods
190 // ----------------------------------------------------------------------------
192 void wxComboBox::SetValue(const wxString
& value
)
196 // Clipboard operations
197 void wxComboBox::Copy()
201 void wxComboBox::Cut()
205 void wxComboBox::Paste()
209 void wxComboBox::SetEditable(bool WXUNUSED(editable
))
213 void wxComboBox::SetInsertionPoint(long pos
)
217 void wxComboBox::SetInsertionPointEnd()
221 long wxComboBox::GetInsertionPoint() const
226 wxTextPos
wxComboBox::GetLastPosition() const
231 void wxComboBox::Replace(long from
, long to
, const wxString
& value
)
235 void wxComboBox::Remove(long from
, long to
)
239 void wxComboBox::SetSelection(long from
, long to
)
243 bool wxComboBox::IsEditable() const
248 void wxComboBox::Undo()
252 void wxComboBox::Redo()
256 void wxComboBox::SelectAll()
260 bool wxComboBox::CanCopy() const
265 bool wxComboBox::CanCut() const
270 bool wxComboBox::CanPaste() const
275 bool wxComboBox::CanUndo() const
280 bool wxComboBox::CanRedo() const
286 #endif // wxUSE_COMBOBOX