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"
30 #include "wx/settings.h"
32 // for wxEVT_COMMAND_TEXT_ENTER
33 #include "wx/textctrl.h"
36 #include "wx/combobox.h"
38 #include "wx/clipbrd.h"
39 #include "wx/palmos/private.h"
42 #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
45 #include "wx/tooltip.h"
46 #endif // wxUSE_TOOLTIPS
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
52 #if wxUSE_EXTENDED_RTTI
53 WX_DEFINE_FLAGS( wxComboBoxStyle
)
55 wxBEGIN_FLAGS( wxComboBoxStyle
)
56 // new style border flags, we put them first to
57 // use them for streaming out
58 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
59 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
60 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
61 wxFLAGS_MEMBER(wxBORDER_RAISED
)
62 wxFLAGS_MEMBER(wxBORDER_STATIC
)
63 wxFLAGS_MEMBER(wxBORDER_NONE
)
65 // old style border flags
66 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
67 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
68 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
69 wxFLAGS_MEMBER(wxRAISED_BORDER
)
70 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
71 wxFLAGS_MEMBER(wxBORDER
)
73 // standard window styles
74 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
75 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
76 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
77 wxFLAGS_MEMBER(wxWANTS_CHARS
)
78 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
79 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
80 wxFLAGS_MEMBER(wxVSCROLL
)
81 wxFLAGS_MEMBER(wxHSCROLL
)
83 wxFLAGS_MEMBER(wxCB_SIMPLE
)
84 wxFLAGS_MEMBER(wxCB_SORT
)
85 wxFLAGS_MEMBER(wxCB_READONLY
)
86 wxFLAGS_MEMBER(wxCB_DROPDOWN
)
88 wxEND_FLAGS( wxComboBoxStyle
)
90 IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox
, wxControl
,"wx/combobox.h")
92 wxBEGIN_PROPERTIES_TABLE(wxComboBox
)
93 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_COMBOBOX_SELECTED
, wxCommandEvent
)
94 wxEVENT_PROPERTY( TextEnter
, wxEVT_COMMAND_TEXT_ENTER
, wxCommandEvent
)
97 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
98 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
99 wxPROPERTY( Value
,wxString
, SetValue
, GetValue
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
100 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
101 wxPROPERTY_FLAGS( WindowStyle
, wxComboBoxStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
102 wxEND_PROPERTIES_TABLE()
104 wxBEGIN_HANDLERS_TABLE(wxComboBox
)
105 wxEND_HANDLERS_TABLE()
107 wxCONSTRUCTOR_5( wxComboBox
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Value
, wxPoint
, Position
, wxSize
, Size
)
109 IMPLEMENT_DYNAMIC_CLASS(wxComboBox
, wxControl
)
112 // ----------------------------------------------------------------------------
113 // function prototypes
114 // ----------------------------------------------------------------------------
116 // ---------------------------------------------------------------------------
118 // ---------------------------------------------------------------------------
120 // the pointer to standard radio button wnd proc
121 static WNDPROC gs_wndprocEdit
= (WNDPROC
)NULL
;
123 // ============================================================================
125 // ============================================================================
127 // ----------------------------------------------------------------------------
128 // wxComboBox callbacks
129 // ----------------------------------------------------------------------------
131 WXLRESULT
wxComboBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
136 bool wxComboBox::MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
)
141 bool wxComboBox::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
146 WXHWND
wxComboBox::GetEditHWND() const
151 // ----------------------------------------------------------------------------
152 // wxComboBox creation
153 // ----------------------------------------------------------------------------
155 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
156 const wxString
& value
,
159 int n
, const wxString choices
[],
161 const wxValidator
& validator
,
162 const wxString
& name
)
167 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
168 const wxString
& value
,
171 const wxArrayString
& choices
,
173 const wxValidator
& validator
,
174 const wxString
& name
)
179 WXDWORD
wxComboBox::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
184 // ----------------------------------------------------------------------------
185 // wxComboBox text control-like methods
186 // ----------------------------------------------------------------------------
188 void wxComboBox::SetValue(const wxString
& value
)
192 // Clipboard operations
193 void wxComboBox::Copy()
197 void wxComboBox::Cut()
201 void wxComboBox::Paste()
205 void wxComboBox::SetEditable(bool WXUNUSED(editable
))
209 void wxComboBox::SetInsertionPoint(long pos
)
213 void wxComboBox::SetInsertionPointEnd()
217 long wxComboBox::GetInsertionPoint() const
222 wxTextPos
wxComboBox::GetLastPosition() const
227 void wxComboBox::Replace(long from
, long to
, const wxString
& value
)
231 void wxComboBox::Remove(long from
, long to
)
235 void wxComboBox::SetSelection(long from
, long to
)
239 bool wxComboBox::IsEditable() const
244 void wxComboBox::Undo()
248 void wxComboBox::Redo()
252 void wxComboBox::SelectAll()
256 bool wxComboBox::CanCopy() const
261 bool wxComboBox::CanCut() const
266 bool wxComboBox::CanPaste() const
271 bool wxComboBox::CanUndo() const
276 bool wxComboBox::CanRedo() const
282 #endif // wxUSE_COMBOBOX