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 #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
46 #include "wx/tooltip.h"
47 #endif // wxUSE_TOOLTIPS
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 #if wxUSE_EXTENDED_RTTI
54 WX_DEFINE_FLAGS( wxComboBoxStyle
)
56 wxBEGIN_FLAGS( wxComboBoxStyle
)
57 // new style border flags, we put them first to
58 // use them for streaming out
59 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
60 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
61 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
62 wxFLAGS_MEMBER(wxBORDER_RAISED
)
63 wxFLAGS_MEMBER(wxBORDER_STATIC
)
64 wxFLAGS_MEMBER(wxBORDER_NONE
)
66 // old style border flags
67 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
68 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
69 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
70 wxFLAGS_MEMBER(wxRAISED_BORDER
)
71 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
72 wxFLAGS_MEMBER(wxBORDER
)
74 // standard window styles
75 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
76 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
77 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
78 wxFLAGS_MEMBER(wxWANTS_CHARS
)
79 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
80 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
81 wxFLAGS_MEMBER(wxVSCROLL
)
82 wxFLAGS_MEMBER(wxHSCROLL
)
84 wxFLAGS_MEMBER(wxCB_SIMPLE
)
85 wxFLAGS_MEMBER(wxCB_SORT
)
86 wxFLAGS_MEMBER(wxCB_READONLY
)
87 wxFLAGS_MEMBER(wxCB_DROPDOWN
)
89 wxEND_FLAGS( wxComboBoxStyle
)
91 IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox
, wxControl
,"wx/combobox.h")
93 wxBEGIN_PROPERTIES_TABLE(wxComboBox
)
94 wxEVENT_PROPERTY( Select
, wxEVT_COMMAND_COMBOBOX_SELECTED
, wxCommandEvent
)
95 wxEVENT_PROPERTY( TextEnter
, wxEVT_COMMAND_TEXT_ENTER
, wxCommandEvent
)
98 wxPROPERTY( Font
, wxFont
, SetFont
, GetFont
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
99 wxPROPERTY_COLLECTION( Choices
, wxArrayString
, wxString
, AppendString
, GetStrings
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
100 wxPROPERTY( Value
,wxString
, SetValue
, GetValue
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
101 wxPROPERTY( Selection
,int, SetSelection
, GetSelection
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
102 wxPROPERTY_FLAGS( WindowStyle
, wxComboBoxStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
103 wxEND_PROPERTIES_TABLE()
105 wxBEGIN_HANDLERS_TABLE(wxComboBox
)
106 wxEND_HANDLERS_TABLE()
108 wxCONSTRUCTOR_5( wxComboBox
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Value
, wxPoint
, Position
, wxSize
, Size
)
110 IMPLEMENT_DYNAMIC_CLASS(wxComboBox
, wxControl
)
113 // ----------------------------------------------------------------------------
114 // function prototypes
115 // ----------------------------------------------------------------------------
117 // ---------------------------------------------------------------------------
119 // ---------------------------------------------------------------------------
121 // the pointer to standard radio button wnd proc
122 static WNDPROC gs_wndprocEdit
= (WNDPROC
)NULL
;
124 // ============================================================================
126 // ============================================================================
128 // ----------------------------------------------------------------------------
129 // wxComboBox callbacks
130 // ----------------------------------------------------------------------------
132 WXLRESULT
wxComboBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
137 bool wxComboBox::MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
)
142 bool wxComboBox::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
147 WXHWND
wxComboBox::GetEditHWND() const
152 // ----------------------------------------------------------------------------
153 // wxComboBox creation
154 // ----------------------------------------------------------------------------
156 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
157 const wxString
& value
,
160 int n
, const wxString choices
[],
162 const wxValidator
& validator
,
163 const wxString
& name
)
168 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
169 const wxString
& value
,
172 const wxArrayString
& choices
,
174 const wxValidator
& validator
,
175 const wxString
& name
)
180 WXDWORD
wxComboBox::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
185 // ----------------------------------------------------------------------------
186 // wxComboBox text control-like methods
187 // ----------------------------------------------------------------------------
189 void wxComboBox::SetValue(const wxString
& value
)
193 // Clipboard operations
194 void wxComboBox::Copy()
198 void wxComboBox::Cut()
202 void wxComboBox::Paste()
206 void wxComboBox::SetEditable(bool WXUNUSED(editable
))
210 void wxComboBox::SetInsertionPoint(long pos
)
214 void wxComboBox::SetInsertionPointEnd()
218 long wxComboBox::GetInsertionPoint() const
223 wxTextPos
wxComboBox::GetLastPosition() const
228 void wxComboBox::Replace(long from
, long to
, const wxString
& value
)
232 void wxComboBox::Remove(long from
, long to
)
236 void wxComboBox::SetSelection(long from
, long to
)
240 bool wxComboBox::IsEditable() const
245 void wxComboBox::Undo()
249 void wxComboBox::Redo()
253 void wxComboBox::SelectAll()
257 bool wxComboBox::CanCopy() const
262 bool wxComboBox::CanCut() const
267 bool wxComboBox::CanPaste() const
272 bool wxComboBox::CanUndo() const
277 bool wxComboBox::CanRedo() const
283 #endif // wxUSE_COMBOBOX