1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/combobox.cpp
3 // Purpose: wxComboBox class
4 // Author: William Osborne
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 WXHBRUSH
wxComboBox::OnCtlColor(WXHDC pDC
,
132 WXHWND
WXUNUSED(pWnd
),
133 WXUINT
WXUNUSED(nCtlColor
),
134 WXUINT
WXUNUSED(message
),
135 WXWPARAM
WXUNUSED(wParam
),
136 WXLPARAM
WXUNUSED(lParam
))
139 wxColour colBack
= GetBackgroundColour();
142 colBack
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
144 ::SetBkColor(hdc
, wxColourToRGB(colBack
));
145 ::SetTextColor(hdc
, wxColourToRGB(GetForegroundColour()));
147 wxBrush
*brush
= wxTheBrushList
->FindOrCreateBrush(colBack
, wxSOLID
);
149 return (WXHBRUSH
)brush
->GetResourceHandle();
152 // ----------------------------------------------------------------------------
153 // wxComboBox callbacks
154 // ----------------------------------------------------------------------------
156 WXLRESULT
wxComboBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
161 bool wxComboBox::MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
)
166 bool wxComboBox::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
171 WXHWND
wxComboBox::GetEditHWND() const
176 // ----------------------------------------------------------------------------
177 // wxComboBox creation
178 // ----------------------------------------------------------------------------
180 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
181 const wxString
& value
,
184 int n
, const wxString choices
[],
186 const wxValidator
& validator
,
187 const wxString
& name
)
192 bool wxComboBox::Create(wxWindow
*parent
, wxWindowID id
,
193 const wxString
& value
,
196 const wxArrayString
& choices
,
198 const wxValidator
& validator
,
199 const wxString
& name
)
204 WXDWORD
wxComboBox::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
209 // ----------------------------------------------------------------------------
210 // wxComboBox text control-like methods
211 // ----------------------------------------------------------------------------
213 void wxComboBox::SetValue(const wxString
& value
)
217 // Clipboard operations
218 void wxComboBox::Copy()
222 void wxComboBox::Cut()
226 void wxComboBox::Paste()
230 void wxComboBox::SetEditable(bool WXUNUSED(editable
))
234 void wxComboBox::SetInsertionPoint(long pos
)
238 void wxComboBox::SetInsertionPointEnd()
242 long wxComboBox::GetInsertionPoint() const
247 long wxComboBox::GetLastPosition() const
252 void wxComboBox::Replace(long from
, long to
, const wxString
& value
)
256 void wxComboBox::Remove(long from
, long to
)
260 void wxComboBox::SetSelection(long from
, long to
)
264 #endif // wxUSE_COMBOBOX