1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/combocmn.cpp
3 // Purpose: wxComboCtrlBase
4 // Author: Jaakko Salli
6 // Created: Apr-30-2006
8 // Copyright: (c) 2005 Jaakko Salli
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
28 #include "wx/combobox.h"
33 #include "wx/dcclient.h"
34 #include "wx/settings.h"
36 #include "wx/textctrl.h"
39 #include "wx/tooltip.h"
46 // ----------------------------------------------------------------------------
48 #define DEFAULT_DROPBUTTON_WIDTH 19
50 #define BMP_BUTTON_MARGIN 4
52 #define DEFAULT_POPUP_HEIGHT 400
54 #define DEFAULT_TEXT_INDENT 3
56 #define COMBO_MARGIN 2 // spacing right of wxTextCtrl
59 #if defined(__WXMSW__)
61 // Let's use wxFrame as a fall-back solution until wxMSW gets wxNonOwnedWindow
63 #define wxCC_GENERIC_TLW_IS_FRAME
64 #define wxComboCtrlGenericTLW wxFrame
66 #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
67 #define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
68 // native controls work on it like normal.
69 #define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window.
70 #define TEXTCTRL_TEXT_CENTERED 0 // 1 if text in textctrl is vertically centered
71 #define FOCUS_RING 0 // No focus ring on wxMSW
73 //#undef wxUSE_POPUPWIN
74 //#define wxUSE_POPUPWIN 0
76 #elif defined(__WXGTK__)
78 // NB: It is not recommended to use wxDialog as popup on wxGTK, because of
79 // this bug: If wxDialog is hidden, its position becomes corrupt
80 // between hide and next show, but without internal coordinates being
81 // reflected (or something like that - atleast commenting out ->Hide()
82 // seemed to eliminate the position change).
84 #include "wx/dialog.h"
85 #define wxCC_GENERIC_TLW_IS_DIALOG
86 #define wxComboCtrlGenericTLW wxDialog
88 #include "wx/gtk/private.h"
90 // NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a
91 // 'perfect' popup, as it can succesfully host child controls even in
92 // popups that are shown in modal dialogs.
94 #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
95 #define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common
96 // native controls work on it like normal.
97 #define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window.
98 #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered
99 #define FOCUS_RING 0 // No focus ring on wxGTK
101 #elif defined(__WXMAC__)
103 #include "wx/nonownedwnd.h"
104 #define wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW
105 #define wxComboCtrlGenericTLW wxNonOwnedWindow
107 #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
108 #define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common
109 // native controls work on it like normal.
110 #define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window.
111 #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered
112 #define FOCUS_RING 3 // Reserve room for the textctrl's focus ring to display
114 #undef DEFAULT_DROPBUTTON_WIDTH
115 #define DEFAULT_DROPBUTTON_WIDTH 22
117 #define COMBO_MARGIN FOCUS_RING
121 #include "wx/dialog.h"
122 #define wxCC_GENERIC_TLW_IS_DIALOG
123 #define wxComboCtrlGenericTLW wxDialog
125 #define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
126 #define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
127 // native controls work on it like normal.
128 #define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window.
129 #define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered
135 // Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless
136 // what the wxUSE_POPUPWIN says.
137 // FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2)
138 #if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) || defined(__WXWINCE__)
139 #undef wxUSE_POPUPWIN
140 #define wxUSE_POPUPWIN 0
145 #include "wx/popupwin.h"
147 #undef USE_TRANSIENT_POPUP
148 #define USE_TRANSIENT_POPUP 0
152 // Define different types of popup windows
156 POPUPWIN_WXPOPUPTRANSIENTWINDOW
= 1,
157 POPUPWIN_WXPOPUPWINDOW
= 2,
158 POPUPWIN_GENERICTLW
= 3
162 #if USE_TRANSIENT_POPUP
163 // wxPopupTransientWindow is implemented
165 #define wxComboPopupWindowBase wxPopupTransientWindow
166 #define PRIMARY_POPUP_TYPE POPUPWIN_WXPOPUPTRANSIENTWINDOW
167 #define USES_WXPOPUPTRANSIENTWINDOW 1
169 #if TRANSIENT_POPUPWIN_IS_PERFECT
171 #elif POPUPWIN_IS_PERFECT
172 #define wxComboPopupWindowBase2 wxPopupWindow
173 #define SECONDARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW
174 #define USES_WXPOPUPWINDOW 1
176 #define wxComboPopupWindowBase2 wxComboCtrlGenericTLW
177 #define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW
178 #define USES_GENERICTLW 1
182 // wxPopupWindow (but not wxPopupTransientWindow) is properly implemented
184 #define wxComboPopupWindowBase wxPopupWindow
185 #define PRIMARY_POPUP_TYPE POPUPWIN_WXPOPUPWINDOW
186 #define USES_WXPOPUPWINDOW 1
188 #if !POPUPWIN_IS_PERFECT
189 #define wxComboPopupWindowBase2 wxComboCtrlGenericTLW
190 #define SECONDARY_POPUP_TYPE POPUPWIN_GENERICTLW
191 #define USES_GENERICTLW 1
195 // wxPopupWindow is not implemented
197 #define wxComboPopupWindowBase wxComboCtrlGenericTLW
198 #define PRIMARY_POPUP_TYPE POPUPWIN_GENERICTLW
199 #define USES_GENERICTLW 1
204 #ifndef USES_WXPOPUPTRANSIENTWINDOW
205 #define USES_WXPOPUPTRANSIENTWINDOW 0
208 #ifndef USES_WXPOPUPWINDOW
209 #define USES_WXPOPUPWINDOW 0
212 #ifndef USES_GENERICTLW
213 #define USES_GENERICTLW 0
217 #if USES_WXPOPUPWINDOW
218 #define INSTALL_TOPLEV_HANDLER 1
220 #define INSTALL_TOPLEV_HANDLER 0
226 // * wxComboPopupWindow for external use (ie. replace old wxUniv wxPopupComboWindow)
230 // ----------------------------------------------------------------------------
231 // wxComboFrameEventHandler takes care of hiding the popup when events happen
232 // in its top level parent.
233 // ----------------------------------------------------------------------------
235 #if INSTALL_TOPLEV_HANDLER
238 // This will no longer be necessary after wxTransientPopupWindow
239 // works well on all platforms.
242 class wxComboFrameEventHandler
: public wxEvtHandler
245 wxComboFrameEventHandler( wxComboCtrlBase
* pCb
);
246 virtual ~wxComboFrameEventHandler();
250 void OnIdle( wxIdleEvent
& event
);
251 void OnMouseEvent( wxMouseEvent
& event
);
252 void OnActivate( wxActivateEvent
& event
);
253 void OnResize( wxSizeEvent
& event
);
254 void OnMove( wxMoveEvent
& event
);
255 void OnMenuEvent( wxMenuEvent
& event
);
256 void OnClose( wxCloseEvent
& event
);
259 wxWindow
* m_focusStart
;
260 wxComboCtrlBase
* m_combo
;
263 DECLARE_EVENT_TABLE()
266 BEGIN_EVENT_TABLE(wxComboFrameEventHandler
, wxEvtHandler
)
267 EVT_IDLE(wxComboFrameEventHandler::OnIdle
)
268 EVT_LEFT_DOWN(wxComboFrameEventHandler::OnMouseEvent
)
269 EVT_RIGHT_DOWN(wxComboFrameEventHandler::OnMouseEvent
)
270 EVT_SIZE(wxComboFrameEventHandler::OnResize
)
271 EVT_MOVE(wxComboFrameEventHandler::OnMove
)
272 EVT_MENU_HIGHLIGHT(wxID_ANY
,wxComboFrameEventHandler::OnMenuEvent
)
273 EVT_MENU_OPEN(wxComboFrameEventHandler::OnMenuEvent
)
274 EVT_ACTIVATE(wxComboFrameEventHandler::OnActivate
)
275 EVT_CLOSE(wxComboFrameEventHandler::OnClose
)
278 wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboCtrlBase
* combo
)
284 wxComboFrameEventHandler::~wxComboFrameEventHandler()
288 void wxComboFrameEventHandler::OnPopup()
290 m_focusStart
= ::wxWindow::FindFocus();
293 void wxComboFrameEventHandler::OnIdle( wxIdleEvent
& event
)
295 wxWindow
* winFocused
= ::wxWindow::FindFocus();
297 wxWindow
* popup
= m_combo
->GetPopupControl()->GetControl();
298 wxWindow
* winpopup
= m_combo
->GetPopupWindow();
301 winFocused
!= m_focusStart
&&
302 winFocused
!= popup
&&
303 winFocused
->GetParent() != popup
&&
304 winFocused
!= winpopup
&&
305 winFocused
->GetParent() != winpopup
&&
306 winFocused
!= m_combo
&&
307 winFocused
!= m_combo
->GetButton() // GTK (atleast) requires this
310 m_combo
->HidePopup(true);
316 void wxComboFrameEventHandler::OnMenuEvent( wxMenuEvent
& event
)
318 m_combo
->HidePopup(true);
322 void wxComboFrameEventHandler::OnMouseEvent( wxMouseEvent
& event
)
324 m_combo
->HidePopup(true);
328 void wxComboFrameEventHandler::OnClose( wxCloseEvent
& event
)
330 m_combo
->HidePopup(true);
334 void wxComboFrameEventHandler::OnActivate( wxActivateEvent
& event
)
336 m_combo
->HidePopup(true);
340 void wxComboFrameEventHandler::OnResize( wxSizeEvent
& event
)
342 m_combo
->HidePopup(true);
346 void wxComboFrameEventHandler::OnMove( wxMoveEvent
& event
)
348 m_combo
->HidePopup(true);
352 #endif // INSTALL_TOPLEV_HANDLER
354 // ----------------------------------------------------------------------------
355 // wxComboPopupWindow is, in essence, wxPopupWindow customized for
357 // ----------------------------------------------------------------------------
359 class wxComboPopupWindow
: public wxComboPopupWindowBase
363 wxComboPopupWindow( wxComboCtrlBase
*parent
,
365 #if USES_WXPOPUPWINDOW || USES_WXPOPUPTRANSIENTWINDOW
366 : wxComboPopupWindowBase(parent
,style
)
368 : wxComboPopupWindowBase(parent
,
379 #if USES_WXPOPUPTRANSIENTWINDOW
380 virtual bool Show( bool show
);
381 virtual bool ProcessLeftDown(wxMouseEvent
& event
);
383 virtual void OnDismiss();
391 #if USES_WXPOPUPTRANSIENTWINDOW
392 bool wxComboPopupWindow::Show( bool show
)
394 // Guard against recursion
396 return wxComboPopupWindowBase::Show(show
);
400 wxASSERT( IsKindOf(CLASSINFO(wxPopupTransientWindow
)) );
402 wxPopupTransientWindow
* ptw
= (wxPopupTransientWindow
*) this;
404 if ( show
!= ptw
->IsShown() )
407 // We used to do wxPopupTransientWindow::Popup here,
408 // but this would hide normal Show, which we are
409 // also going to need.
420 bool wxComboPopupWindow::ProcessLeftDown(wxMouseEvent
& event
)
422 return wxPopupTransientWindow::ProcessLeftDown(event
);
425 // First thing that happens when a transient popup closes is that this method gets called.
426 void wxComboPopupWindow::OnDismiss()
428 wxComboCtrlBase
* combo
= (wxComboCtrlBase
*) GetParent();
429 wxASSERT_MSG( combo
->IsKindOf(CLASSINFO(wxComboCtrlBase
)),
430 wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") );
432 combo
->OnPopupDismiss(true);
434 #endif // USES_WXPOPUPTRANSIENTWINDOW
437 // ----------------------------------------------------------------------------
438 // wxComboPopupWindowEvtHandler does bulk of the custom event handling
439 // of a popup window. It is separate so we can have different types
441 // ----------------------------------------------------------------------------
443 class wxComboPopupWindowEvtHandler
: public wxEvtHandler
447 wxComboPopupWindowEvtHandler( wxComboCtrlBase
*parent
)
452 void OnSizeEvent( wxSizeEvent
& event
);
453 void OnKeyEvent(wxKeyEvent
& event
);
455 void OnActivate( wxActivateEvent
& event
);
459 wxComboCtrlBase
* m_combo
;
461 DECLARE_EVENT_TABLE()
465 BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler
, wxEvtHandler
)
466 EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent
)
467 EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent
)
468 EVT_CHAR(wxComboPopupWindowEvtHandler::OnKeyEvent
)
470 EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate
)
472 EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent
)
476 void wxComboPopupWindowEvtHandler::OnSizeEvent( wxSizeEvent
& WXUNUSED(event
) )
478 // Block the event so that the popup control does not get auto-resized.
481 void wxComboPopupWindowEvtHandler::OnKeyEvent( wxKeyEvent
& event
)
483 // Relay keyboard event to the main child controls
484 wxWindowList children
= m_combo
->GetPopupWindow()->GetChildren();
485 wxWindowList::iterator node
= children
.begin();
486 wxWindow
* child
= (wxWindow
*)*node
;
487 child
->GetEventHandler()->ProcessEvent(event
);
491 void wxComboPopupWindowEvtHandler::OnActivate( wxActivateEvent
& event
)
493 if ( !event
.GetActive() )
495 // Tell combo control that we are dismissed.
496 m_combo
->HidePopup(true);
504 // ----------------------------------------------------------------------------
507 // ----------------------------------------------------------------------------
509 wxComboPopup::~wxComboPopup()
513 void wxComboPopup::OnPopup()
517 void wxComboPopup::OnDismiss()
521 wxComboCtrl
* wxComboPopup::GetComboCtrl() const
523 return wxStaticCast(m_combo
, wxComboCtrl
);
526 wxSize
wxComboPopup::GetAdjustedSize( int minWidth
,
528 int WXUNUSED(maxHeight
) )
530 return wxSize(minWidth
,prefHeight
);
533 void wxComboPopup::DefaultPaintComboControl( wxComboCtrlBase
* combo
,
534 wxDC
& dc
, const wxRect
& rect
)
536 if ( combo
->GetWindowStyle() & wxCB_READONLY
) // ie. no textctrl
538 combo
->PrepareBackground(dc
,rect
,0);
540 dc
.DrawText( combo
->GetValue(),
541 rect
.x
+ combo
->m_marginLeft
,
542 (rect
.height
-dc
.GetCharHeight())/2 + rect
.y
);
546 void wxComboPopup::PaintComboControl( wxDC
& dc
, const wxRect
& rect
)
548 DefaultPaintComboControl(m_combo
,dc
,rect
);
551 void wxComboPopup::OnComboKeyEvent( wxKeyEvent
& event
)
556 void wxComboPopup::OnComboCharEvent( wxKeyEvent
& event
)
561 void wxComboPopup::OnComboDoubleClick()
565 void wxComboPopup::SetStringValue( const wxString
& WXUNUSED(value
) )
569 bool wxComboPopup::LazyCreate()
574 void wxComboPopup::Dismiss()
576 m_combo
->HidePopup(true);
579 // ----------------------------------------------------------------------------
581 // ----------------------------------------------------------------------------
584 // This is pushed to the event handler queue of the child textctrl.
586 class wxComboBoxExtraInputHandler
: public wxEvtHandler
590 wxComboBoxExtraInputHandler( wxComboCtrlBase
* combo
)
595 virtual ~wxComboBoxExtraInputHandler() { }
596 void OnKey(wxKeyEvent
& event
);
597 void OnFocus(wxFocusEvent
& event
);
600 wxComboCtrlBase
* m_combo
;
603 DECLARE_EVENT_TABLE()
607 BEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler
, wxEvtHandler
)
608 EVT_KEY_DOWN(wxComboBoxExtraInputHandler::OnKey
)
609 EVT_KEY_UP(wxComboBoxExtraInputHandler::OnKey
)
610 EVT_CHAR(wxComboBoxExtraInputHandler::OnKey
)
611 EVT_SET_FOCUS(wxComboBoxExtraInputHandler::OnFocus
)
612 EVT_KILL_FOCUS(wxComboBoxExtraInputHandler::OnFocus
)
616 void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent
& event
)
618 // Let the wxComboCtrl event handler have a go first.
619 wxComboCtrlBase
* combo
= m_combo
;
621 wxKeyEvent
redirectedEvent(event
);
622 redirectedEvent
.SetId(combo
->GetId());
623 redirectedEvent
.SetEventObject(combo
);
625 if ( !combo
->GetEventHandler()->ProcessEvent(redirectedEvent
) )
627 // Don't let TAB through to the text ctrl - looks ugly
628 if ( event
.GetKeyCode() != WXK_TAB
)
633 void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent
& event
)
635 // FIXME: This code does run when control is clicked,
636 // yet on Windows it doesn't select all the text.
637 if ( event
.GetEventType() == wxEVT_SET_FOCUS
&&
638 !(m_combo
->GetInternalFlags() & wxCC_NO_TEXT_AUTO_SELECT
) )
640 if ( m_combo
->GetTextCtrl() )
641 m_combo
->GetTextCtrl()->SelectAll();
643 m_combo
->SetSelection(-1,-1);
646 // Send focus indication to parent.
647 // NB: This is needed for cases where the textctrl gets focus
648 // instead of its parent. While this may trigger multiple
649 // wxEVT_SET_FOCUSes (since m_text->SetFocus is called
650 // from combo's focus event handler), they should be quite
652 wxFocusEvent
evt2(event
.GetEventType(),m_combo
->GetId());
653 evt2
.SetEventObject(m_combo
);
654 m_combo
->GetEventHandler()->ProcessEvent(evt2
);
661 // This is pushed to the event handler queue of the control in popup.
664 class wxComboPopupEvtHandler
: public wxEvtHandler
668 wxComboPopupEvtHandler( wxComboCtrlBase
* combo
)
672 m_beenInside
= false;
674 // Let's make it so that the popup control will not receive mouse
675 // events until mouse left button has been up.
676 m_blockEventsToPopup
= true;
678 virtual ~wxComboPopupEvtHandler() { }
680 void OnMouseEvent( wxMouseEvent
& event
);
682 // Called from wxComboCtrlBase::OnPopupDismiss
683 void OnPopupDismiss()
685 m_beenInside
= false;
686 m_blockEventsToPopup
= true;
690 wxComboCtrlBase
* m_combo
;
693 bool m_blockEventsToPopup
;
696 DECLARE_EVENT_TABLE()
700 BEGIN_EVENT_TABLE(wxComboPopupEvtHandler
, wxEvtHandler
)
701 EVT_MOUSE_EVENTS(wxComboPopupEvtHandler::OnMouseEvent
)
705 void wxComboPopupEvtHandler::OnMouseEvent( wxMouseEvent
& event
)
707 wxPoint pt
= event
.GetPosition();
708 wxSize sz
= m_combo
->GetPopupControl()->GetControl()->GetClientSize();
709 int evtType
= event
.GetEventType();
710 bool isInside
= pt
.x
>= 0 && pt
.y
>= 0 && pt
.x
< sz
.x
&& pt
.y
< sz
.y
;
711 bool relayToButton
= false;
715 if ( !isInside
|| !m_combo
->IsPopupShown() )
717 // Mouse is outside the popup or popup is not actually shown (yet)
719 if ( evtType
== wxEVT_MOTION
||
720 evtType
== wxEVT_LEFT_DOWN
||
721 evtType
== wxEVT_LEFT_UP
||
722 evtType
== wxEVT_RIGHT_DOWN
)
724 // Block motion and click events outside the popup
730 // Mouse is inside the popup, which is fully shown
734 // Do not let the popup control respond to mouse events until
735 // mouse press used to display the popup has been lifted. This
736 // is important for users with slower mouse fingers or mouse
737 // drivers. Note that we have some redundancy here, just in
738 // case the popup is some native control that does not emit all
739 // mouse event types.
740 if ( evtType
== wxEVT_MOTION
)
742 if ( m_blockEventsToPopup
)
744 if ( event
.LeftIsDown() )
747 m_blockEventsToPopup
= false;
750 else if ( evtType
== wxEVT_LEFT_DOWN
)
752 if ( m_blockEventsToPopup
)
753 m_blockEventsToPopup
= false;
755 else if ( evtType
== wxEVT_LEFT_UP
)
757 if ( m_blockEventsToPopup
)
759 // On first left up, stop blocking mouse events (but still
761 m_blockEventsToPopup
= false;
764 // Also, this button press was (probably) used to display
765 // the popup, so relay it back to the drop-down button
766 // (which supposedly originated it). This is necessary to
767 // refresh it properly.
768 relayToButton
= true;
771 else if ( m_blockEventsToPopup
)
778 // Some mouse events to popup that happen outside it, before cursor
779 // has been inside the popup, need to be ignored by it but relayed to
782 if ( evtType
== wxEVT_LEFT_UP
)
784 if ( !m_combo
->IsPopupShown() )
787 relayToButton
= true;
789 else if ( !isInside
&& !m_beenInside
)
791 // Popup is shown but the cursor is not inside, nor it has been
792 relayToButton
= true;
798 wxWindow
* btn
= m_combo
->GetButton();
800 btn
->GetEventHandler()->ProcessEvent(event
);
802 // Bypass the event handling mechanism. Using it would be
803 // confusing for the platform-specific wxComboCtrl
805 m_combo
->HandleButtonMouseEvent(event
, 0);
809 // ----------------------------------------------------------------------------
810 // wxComboCtrlTextCtrl
811 // ----------------------------------------------------------------------------
813 class wxComboCtrlTextCtrl
: public wxTextCtrl
816 wxComboCtrlTextCtrl() : wxTextCtrl() { }
817 virtual ~wxComboCtrlTextCtrl() { }
819 virtual wxWindow
*GetMainWindowOfCompositeControl()
821 wxComboCtrl
* combo
= (wxComboCtrl
*) GetParent();
823 // Returning this instead of just 'parent' lets FindFocus work
824 // correctly even when parent control is a child of a composite
825 // generic control (as is case with wxGenericDatePickerCtrl).
826 return combo
->GetMainWindowOfCompositeControl();
830 // ----------------------------------------------------------------------------
832 // ----------------------------------------------------------------------------
835 BEGIN_EVENT_TABLE(wxComboCtrlBase
, wxControl
)
836 EVT_TEXT(wxID_ANY
,wxComboCtrlBase::OnTextCtrlEvent
)
837 EVT_SIZE(wxComboCtrlBase::OnSizeEvent
)
838 EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent
)
839 EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent
)
840 EVT_IDLE(wxComboCtrlBase::OnIdleEvent
)
841 //EVT_BUTTON(wxID_ANY,wxComboCtrlBase::OnButtonClickEvent)
842 EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent
)
843 EVT_CHAR(wxComboCtrlBase::OnCharEvent
)
844 EVT_TEXT_ENTER(wxID_ANY
,wxComboCtrlBase::OnTextCtrlEvent
)
845 EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged
)
849 IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase
, wxControl
)
851 void wxComboCtrlBase::Init()
855 m_popupWinState
= Hidden
;
858 m_popupInterface
= NULL
;
860 m_popupEvtHandler
= NULL
;
861 m_textEvtHandler
= NULL
;
863 #if INSTALL_TOPLEV_HANDLER
864 m_toplevEvtHandler
= NULL
;
867 m_mainCtrlWnd
= this;
870 m_widthMinPopup
= -1;
872 m_widthCustomPaint
= 0;
873 m_widthCustomBorder
= 0;
877 m_blankButtonBg
= false;
879 m_popupWinType
= POPUPWIN_NONE
;
880 m_btnWid
= m_btnHei
= -1;
888 m_timeCanAcceptClick
= 0;
890 m_resetFocus
= false;
893 bool wxComboCtrlBase::Create(wxWindow
*parent
,
895 const wxString
& value
,
899 const wxValidator
& validator
,
900 const wxString
& name
)
902 if ( !wxControl::Create(parent
,
906 style
| wxWANTS_CHARS
,
911 m_valueString
= value
;
915 m_marginLeft
= GetNativeTextIndent();
917 m_iFlags
|= wxCC_IFLAG_CREATED
;
919 // If x and y indicate valid size, wxSizeEvent won't be
920 // emitted automatically, so we need to add artifical one.
921 if ( size
.x
> 0 && size
.y
> 0 )
923 wxSizeEvent
evt(size
,GetId());
924 GetEventHandler()->AddPendingEvent(evt
);
930 void wxComboCtrlBase::InstallInputHandlers()
934 m_textEvtHandler
= new wxComboBoxExtraInputHandler(this);
935 m_text
->PushEventHandler(m_textEvtHandler
);
940 wxComboCtrlBase::CreateTextCtrl(int style
, const wxValidator
& validator
)
942 if ( !(m_windowStyle
& wxCB_READONLY
) )
947 // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
948 // not used by the wxPropertyGrid and therefore the tab is processed by
949 // looking at ancestors to see if they have wxTAB_TRAVERSAL. The
950 // navigation event is then sent to the wrong window.
951 style
|= wxTE_PROCESS_TAB
;
953 if ( HasFlag(wxTE_PROCESS_ENTER
) )
954 style
|= wxTE_PROCESS_ENTER
;
956 // Ignore EVT_TEXT generated by the constructor (but only
957 // if the event redirector already exists)
958 // NB: This must be " = 1" instead of "++";
959 if ( m_textEvtHandler
)
964 m_text
= new wxComboCtrlTextCtrl();
965 m_text
->Create(this, wxID_ANY
, m_valueString
,
966 wxDefaultPosition
, wxSize(10,-1),
968 m_text
->SetHint(m_hintText
);
972 void wxComboCtrlBase::OnThemeChange()
974 // Leave the default bg on the Mac so the area used by the focus ring will
975 // be the correct colour and themed brush. Instead we'll use
976 // wxSYS_COLOUR_WINDOW in the EVT_PAINT handler as needed.
978 #if defined(__WXMSW__) || defined(__WXGTK__)
979 wxVisualAttributes vattrs
= wxComboBox::GetClassDefaultAttributes();
981 wxVisualAttributes vattrs
;
982 vattrs
.colFg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
983 vattrs
.colBg
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
);
986 // Only change the colours if application has not specified
990 SetOwnForegroundColour(vattrs
.colFg
);
995 SetOwnBackgroundColour(vattrs
.colBg
);
1001 wxComboCtrlBase::~wxComboCtrlBase()
1006 #if INSTALL_TOPLEV_HANDLER
1007 delete ((wxComboFrameEventHandler
*)m_toplevEvtHandler
);
1008 m_toplevEvtHandler
= NULL
;
1014 m_text
->RemoveEventHandler(m_textEvtHandler
);
1016 delete m_textEvtHandler
;
1020 // ----------------------------------------------------------------------------
1022 // ----------------------------------------------------------------------------
1024 // Recalculates button and textctrl areas
1025 void wxComboCtrlBase::CalculateAreas( int btnWidth
)
1027 wxSize sz
= GetClientSize();
1028 int customBorder
= m_widthCustomBorder
;
1029 int btnBorder
; // border for button only
1031 // check if button should really be outside the border: we'll do it it if
1032 // its platform default or bitmap+pushbutton background is used, but not if
1033 // there is vertical size adjustment or horizontal spacing.
1034 if ( ( (m_iFlags
& wxCC_BUTTON_OUTSIDE_BORDER
) ||
1035 (m_bmpNormal
.Ok() && m_blankButtonBg
) ) &&
1036 m_btnSpacingX
== 0 &&
1039 m_iFlags
|= wxCC_IFLAG_BUTTON_OUTSIDE
;
1042 else if ( (m_iFlags
& wxCC_BUTTON_COVERS_BORDER
) &&
1043 m_btnSpacingX
== 0 && !m_bmpNormal
.Ok() )
1045 m_iFlags
&= ~(wxCC_IFLAG_BUTTON_OUTSIDE
);
1050 m_iFlags
&= ~(wxCC_IFLAG_BUTTON_OUTSIDE
);
1051 btnBorder
= customBorder
;
1054 // Defaul indentation
1055 if ( m_marginLeft
< 0 )
1056 m_marginLeft
= GetNativeTextIndent();
1058 int butWidth
= btnWidth
;
1060 if ( butWidth
<= 0 )
1061 butWidth
= m_btnWidDefault
;
1063 m_btnWidDefault
= butWidth
;
1065 if ( butWidth
<= 0 )
1068 int butHeight
= sz
.y
- btnBorder
*2;
1070 // Adjust button width
1072 butWidth
= m_btnWid
;
1075 // Adjust button width to match aspect ratio
1076 // (but only if control is smaller than best size).
1077 int bestHeight
= GetBestSize().y
;
1078 int height
= GetSize().y
;
1080 if ( height
< bestHeight
)
1082 // Make very small buttons square, as it makes
1083 // them accommodate arrow image better and still
1086 butWidth
= (height
*butWidth
)/bestHeight
;
1088 butWidth
= butHeight
;
1092 // Adjust button height
1094 butHeight
= m_btnHei
;
1096 // Use size of normal bitmap if...
1099 // button width is set to default and blank button bg is not drawn
1100 if ( m_bmpNormal
.Ok() )
1102 int bmpReqWidth
= m_bmpNormal
.GetWidth();
1103 int bmpReqHeight
= m_bmpNormal
.GetHeight();
1105 // If drawing blank button background, we need to add some margin.
1106 if ( m_blankButtonBg
)
1108 bmpReqWidth
+= BMP_BUTTON_MARGIN
*2;
1109 bmpReqHeight
+= BMP_BUTTON_MARGIN
*2;
1112 if ( butWidth
< bmpReqWidth
|| ( m_btnWid
== 0 && !m_blankButtonBg
) )
1113 butWidth
= bmpReqWidth
;
1114 if ( butHeight
< bmpReqHeight
|| ( m_btnHei
== 0 && !m_blankButtonBg
) )
1115 butHeight
= bmpReqHeight
;
1117 // Need to fix height?
1118 if ( (sz
.y
-(customBorder
*2)) < butHeight
&& btnWidth
== 0 )
1120 int newY
= butHeight
+(customBorder
*2);
1121 SetClientSize(wxDefaultCoord
,newY
);
1122 if ( m_bmpNormal
.Ok() || m_btnArea
.width
!= butWidth
|| m_btnArea
.height
!= butHeight
)
1123 m_iFlags
|= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON
;
1125 m_iFlags
&= ~wxCC_IFLAG_HAS_NONSTANDARD_BUTTON
;
1131 int butAreaWid
= butWidth
+ (m_btnSpacingX
*2);
1133 m_btnSize
.x
= butWidth
;
1134 m_btnSize
.y
= butHeight
;
1136 m_btnArea
.x
= ( m_btnSide
==wxRIGHT
? sz
.x
- butAreaWid
- btnBorder
: btnBorder
);
1137 m_btnArea
.y
= btnBorder
+ FOCUS_RING
;
1138 m_btnArea
.width
= butAreaWid
;
1139 m_btnArea
.height
= sz
.y
- ((btnBorder
+FOCUS_RING
)*2);
1141 m_tcArea
.x
= ( m_btnSide
==wxRIGHT
? 0 : butAreaWid
) + customBorder
+ FOCUS_RING
;
1142 m_tcArea
.y
= customBorder
+ FOCUS_RING
;
1143 m_tcArea
.width
= sz
.x
- butAreaWid
- (customBorder
*2) - (FOCUS_RING
*2);
1144 m_tcArea
.height
= sz
.y
- ((customBorder
+FOCUS_RING
)*2);
1149 ::wxMessageBox(wxString::Format(wxT("ButtonArea (%i,%i,%i,%i)\n"),m_btnArea.x,m_btnArea.y,m_btnArea.width,m_btnArea.height) +
1150 wxString::Format(wxT("TextCtrlArea (%i,%i,%i,%i)"),m_tcArea.x,m_tcArea.y,m_tcArea.width,m_tcArea.height));
1155 void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust
, int textCtrlYAdjust
)
1160 wxSize sz
= GetClientSize();
1162 int customBorder
= m_widthCustomBorder
;
1163 if ( (m_text
->GetWindowStyleFlag() & wxBORDER_MASK
) == wxNO_BORDER
)
1167 if ( !m_widthCustomPaint
)
1169 // No special custom paint area - we can use 0 left margin
1171 if ( m_text
->SetMargins(0) )
1172 textCtrlXAdjust
= 0;
1173 x
= m_tcArea
.x
+ m_marginLeft
+ textCtrlXAdjust
;
1177 // There is special custom paint area - it is better to
1178 // use some margin with the wxTextCtrl.
1179 m_text
->SetMargins(m_marginLeft
);
1180 x
= m_tcArea
.x
+ m_widthCustomPaint
+
1181 m_marginLeft
+ textCtrlXAdjust
;
1184 // Centre textctrl vertically, if needed
1185 #if !TEXTCTRL_TEXT_CENTERED
1186 int tcSizeY
= m_text
->GetBestSize().y
;
1187 int diff0
= sz
.y
- tcSizeY
;
1188 int y
= textCtrlYAdjust
+ (diff0
/2);
1190 wxUnusedVar(textCtrlYAdjust
);
1194 if ( y
< customBorder
)
1199 m_tcArea
.width
- m_tcArea
.x
- x
,
1202 // Make sure textctrl doesn't exceed the bottom custom border
1203 wxSize tsz
= m_text
->GetSize();
1204 int diff1
= (y
+ tsz
.y
) - (sz
.y
- customBorder
);
1207 tsz
.y
= tsz
.y
- diff1
- 1;
1208 m_text
->SetSize(tsz
);
1213 // If it has border, have textctrl fill the entire text field.
1214 m_text
->SetSize( m_tcArea
.x
+ m_widthCustomPaint
,
1216 m_tcArea
.width
- m_widthCustomPaint
,
1221 wxSize
wxComboCtrlBase::DoGetBestSize() const
1223 wxSize
sizeText(150,0);
1226 sizeText
= m_text
->GetBestSize();
1228 // TODO: Better method to calculate close-to-native control height.
1232 fhei
= (m_font
.GetPointSize()*2) + 5;
1233 else if ( wxNORMAL_FONT
->Ok() )
1234 fhei
= (wxNORMAL_FONT
->GetPointSize()*2) + 5;
1236 fhei
= sizeText
.y
+ 4;
1238 // Need to force height to accomodate bitmap?
1239 int btnSizeY
= m_btnSize
.y
;
1240 if ( m_bmpNormal
.Ok() && fhei
< btnSizeY
)
1243 // Control height doesn't depend on border
1246 int border = m_windowStyle & wxBORDER_MASK;
1247 if ( border == wxSIMPLE_BORDER )
1249 else if ( border == wxNO_BORDER )
1250 fhei += (m_widthCustomBorder*2);
1256 // Final adjustments
1262 // these are the numbers from the HIG:
1263 switch ( m_windowVariant
)
1265 case wxWINDOW_VARIANT_NORMAL
:
1269 case wxWINDOW_VARIANT_SMALL
:
1272 case wxWINDOW_VARIANT_MINI
:
1278 fhei
+= 2 * FOCUS_RING
;
1279 int width
= sizeText
.x
+ FOCUS_RING
+ COMBO_MARGIN
+ DEFAULT_DROPBUTTON_WIDTH
;
1281 wxSize
ret(width
, fhei
);
1286 void wxComboCtrlBase::OnSizeEvent( wxSizeEvent
& event
)
1291 // defined by actual wxComboCtrls
1297 // ----------------------------------------------------------------------------
1298 // standard operations
1299 // ----------------------------------------------------------------------------
1301 bool wxComboCtrlBase::Enable(bool enable
)
1303 if ( !wxControl::Enable(enable
) )
1307 m_btn
->Enable(enable
);
1309 m_text
->Enable(enable
);
1316 bool wxComboCtrlBase::Show(bool show
)
1318 if ( !wxControl::Show(show
) )
1330 bool wxComboCtrlBase::SetFont ( const wxFont
& font
)
1332 if ( !wxControl::SetFont(font
) )
1337 // Without hiding the wxTextCtrl there would be some
1338 // visible 'flicker' (at least on Windows XP).
1340 m_text
->SetFont(font
);
1349 void wxComboCtrlBase::DoSetToolTip(wxToolTip
*tooltip
)
1351 wxControl::DoSetToolTip(tooltip
);
1353 // Set tool tip for button and text box
1356 const wxString
&tip
= tooltip
->GetTip();
1357 if ( m_text
) m_text
->SetToolTip(tip
);
1358 if ( m_btn
) m_btn
->SetToolTip(tip
);
1362 if ( m_text
) m_text
->SetToolTip( NULL
);
1363 if ( m_btn
) m_btn
->SetToolTip( NULL
);
1366 #endif // wxUSE_TOOLTIPS
1368 #if wxUSE_VALIDATORS
1369 void wxComboCtrlBase::SetValidator(const wxValidator
& validator
)
1371 wxTextCtrl
* textCtrl
= GetTextCtrl();
1374 textCtrl
->SetValidator( validator
);
1376 wxControl::SetValidator( validator
);
1379 wxValidator
* wxComboCtrlBase::GetValidator()
1381 wxTextCtrl
* textCtrl
= GetTextCtrl();
1383 return textCtrl
? textCtrl
->GetValidator() : wxControl::GetValidator();
1385 #endif // wxUSE_VALIDATORS
1387 bool wxComboCtrlBase::SetForegroundColour(const wxColour
& colour
)
1389 if ( wxControl::SetForegroundColour(colour
) )
1392 m_text
->SetForegroundColour(colour
);
1398 bool wxComboCtrlBase::SetBackgroundColour(const wxColour
& colour
)
1400 if ( wxControl::SetBackgroundColour(colour
) )
1403 m_text
->SetBackgroundColour(colour
);
1408 // ----------------------------------------------------------------------------
1410 // ----------------------------------------------------------------------------
1412 #if (!defined(__WXMSW__)) || defined(__WXUNIVERSAL__)
1413 // prepare combo box background on area in a way typical on platform
1414 void wxComboCtrlBase::PrepareBackground( wxDC
& dc
, const wxRect
& rect
, int flags
) const
1416 wxSize sz
= GetClientSize();
1418 bool doDrawFocusRect
; // also selected
1420 // For smaller size control (and for disabled background) use less spacing
1424 if ( !(flags
& wxCONTROL_ISSUBMENU
) )
1427 isEnabled
= IsEnabled();
1428 doDrawFocusRect
= ShouldDrawFocus() && !(m_iFlags
& wxCC_FULL_BUTTON
);
1430 // Windows-style: for smaller size control (and for disabled background) use less spacing
1431 focusSpacingX
= isEnabled
? 2 : 1;
1432 focusSpacingY
= sz
.y
> (GetCharHeight()+2) && isEnabled
? 2 : 1;
1436 // Drawing a list item
1437 isEnabled
= true; // they are never disabled
1438 doDrawFocusRect
= (flags
& wxCONTROL_SELECTED
) != 0;
1444 // Set the background sub-rectangle for selection, disabled etc
1445 wxRect
selRect(rect
);
1446 selRect
.y
+= focusSpacingY
;
1447 selRect
.height
-= (focusSpacingY
*2);
1451 if ( !(flags
& wxCONTROL_ISSUBMENU
) )
1452 wcp
+= m_widthCustomPaint
;
1454 selRect
.x
+= wcp
+ focusSpacingX
;
1455 selRect
.width
-= wcp
+ (focusSpacingX
*2);
1460 bool doDrawSelRect
= true;
1462 // Determine foreground colour
1465 if ( doDrawFocusRect
)
1467 fgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT
);
1469 else if ( m_hasFgCol
)
1471 // Honour the custom foreground colour
1472 fgCol
= GetForegroundColour();
1476 fgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT
);
1481 fgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT
);
1484 // Determine background colour
1487 if ( doDrawFocusRect
)
1489 bgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT
);
1491 else if ( m_hasBgCol
)
1493 // Honour the custom background colour
1494 bgCol
= GetBackgroundColour();
1498 #ifndef __WXMAC__ // see note in OnThemeChange
1499 doDrawSelRect
= false;
1500 bgCol
= GetBackgroundColour();
1502 bgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
);
1508 #ifndef __WXMAC__ // see note in OnThemeChange
1509 bgCol
= GetBackgroundColour();
1511 bgCol
= wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
);
1515 dc
.SetTextForeground( fgCol
);
1516 dc
.SetBrush( bgCol
);
1517 if ( doDrawSelRect
)
1520 dc
.DrawRectangle( selRect
);
1523 // Don't clip exactly to the selection rectangle so we can draw
1524 // to the non-selected area in front of it.
1525 wxRect
clipRect(rect
.x
,rect
.y
,
1526 (selRect
.x
+selRect
.width
)-rect
.x
,rect
.height
);
1527 dc
.SetClippingRegion(clipRect
);
1530 // Save the library size a bit for platforms that re-implement this.
1531 void wxComboCtrlBase::PrepareBackground( wxDC
&, const wxRect
&, int ) const
1536 void wxComboCtrlBase::DrawButton( wxDC
& dc
, const wxRect
& rect
, int flags
)
1538 int drawState
= m_btnState
;
1540 if ( (m_iFlags
& wxCC_BUTTON_STAYS_DOWN
) &&
1541 GetPopupWindowState() >= Animating
)
1542 drawState
|= wxCONTROL_PRESSED
;
1544 wxRect
drawRect(rect
.x
+m_btnSpacingX
,
1545 rect
.y
+((rect
.height
-m_btnSize
.y
)/2),
1549 // Make sure area is not larger than the control
1550 if ( drawRect
.y
< rect
.y
)
1551 drawRect
.y
= rect
.y
;
1552 if ( drawRect
.height
> rect
.height
)
1553 drawRect
.height
= rect
.height
;
1555 bool enabled
= IsEnabled();
1558 drawState
|= wxCONTROL_DISABLED
;
1560 if ( !m_bmpNormal
.Ok() )
1562 if ( flags
& Button_BitmapOnly
)
1565 // Need to clear button background even if m_btn is present
1566 if ( flags
& Button_PaintBackground
)
1570 if ( m_iFlags
& wxCC_IFLAG_BUTTON_OUTSIDE
)
1571 bgCol
= GetParent()->GetBackgroundColour();
1573 bgCol
= GetBackgroundColour();
1577 dc
.DrawRectangle(rect
);
1580 // Draw standard button
1581 wxRendererNative::Get().DrawComboBoxDropButton(this,
1593 pBmp
= &m_bmpDisabled
;
1594 else if ( m_btnState
& wxCONTROL_PRESSED
)
1595 pBmp
= &m_bmpPressed
;
1596 else if ( m_btnState
& wxCONTROL_CURRENT
)
1599 pBmp
= &m_bmpNormal
;
1601 if ( m_blankButtonBg
)
1603 // If using blank button background, we need to clear its background
1604 // with button face colour instead of colour for rest of the control.
1605 if ( flags
& Button_PaintBackground
)
1607 wxColour bgCol
= GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
1608 //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
1611 dc
.DrawRectangle(rect
);
1614 if ( !(flags
& Button_BitmapOnly
) )
1616 wxRendererNative::Get().DrawPushButton(this,
1625 // Need to clear button background even if m_btn is present
1626 // (assume non-button background was cleared just before this call so brushes are good)
1627 if ( flags
& Button_PaintBackground
)
1628 dc
.DrawRectangle(rect
);
1631 // Draw bitmap centered in drawRect
1632 dc
.DrawBitmap(*pBmp
,
1633 drawRect
.x
+ (drawRect
.width
-pBmp
->GetWidth())/2,
1634 drawRect
.y
+ (drawRect
.height
-pBmp
->GetHeight())/2,
1639 void wxComboCtrlBase::RecalcAndRefresh()
1643 wxSizeEvent
evt(GetSize(),GetId());
1644 GetEventHandler()->ProcessEvent(evt
);
1649 // ----------------------------------------------------------------------------
1650 // miscellaneous event handlers
1651 // ----------------------------------------------------------------------------
1653 void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent
& event
)
1655 if ( event
.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED
)
1657 if ( m_ignoreEvtText
> 0 )
1664 // Change event id, object and string before relaying it forward
1665 event
.SetId(GetId());
1666 wxString s
= event
.GetString();
1667 event
.SetEventObject(this);
1672 // call if cursor is on button area or mouse is captured for the button
1673 bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent
& event
,
1676 int type
= event
.GetEventType();
1678 if ( type
== wxEVT_MOTION
)
1680 if ( (flags
& wxCC_MF_ON_BUTTON
) &&
1681 IsPopupWindowState(Hidden
) )
1683 if ( !(m_btnState
& wxCONTROL_CURRENT
) )
1685 // Mouse hover begins
1686 m_btnState
|= wxCONTROL_CURRENT
;
1687 if ( HasCapture() ) // Retain pressed state.
1688 m_btnState
|= wxCONTROL_PRESSED
;
1692 else if ( (m_btnState
& wxCONTROL_CURRENT
) )
1695 m_btnState
&= ~(wxCONTROL_CURRENT
|wxCONTROL_PRESSED
);
1699 else if ( type
== wxEVT_LEFT_DOWN
|| type
== wxEVT_LEFT_DCLICK
)
1701 if ( flags
& (wxCC_MF_ON_CLICK_AREA
|wxCC_MF_ON_BUTTON
) )
1703 m_btnState
|= wxCONTROL_PRESSED
;
1706 if ( !(m_iFlags
& wxCC_POPUP_ON_MOUSE_UP
) )
1709 // If showing popup now, do not capture mouse or there will be interference
1713 else if ( type
== wxEVT_LEFT_UP
)
1716 // Only accept event if mouse was left-press was previously accepted
1720 if ( m_btnState
& wxCONTROL_PRESSED
)
1722 // If mouse was inside, fire the click event.
1723 if ( m_iFlags
& wxCC_POPUP_ON_MOUSE_UP
)
1725 if ( flags
& (wxCC_MF_ON_CLICK_AREA
|wxCC_MF_ON_BUTTON
) )
1729 m_btnState
&= ~(wxCONTROL_PRESSED
);
1733 else if ( type
== wxEVT_LEAVE_WINDOW
)
1735 if ( m_btnState
& (wxCONTROL_CURRENT
|wxCONTROL_PRESSED
) )
1737 m_btnState
&= ~(wxCONTROL_CURRENT
);
1740 if ( IsPopupWindowState(Hidden
) )
1742 m_btnState
&= ~(wxCONTROL_PRESSED
);
1750 // Never have 'hot' state when popup is being shown
1751 // (this is mostly needed because of the animation).
1752 if ( !IsPopupWindowState(Hidden
) )
1753 m_btnState
&= ~wxCONTROL_CURRENT
;
1758 // returns true if event was consumed or filtered
1759 bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent
& event
,
1760 int WXUNUSED(flags
) )
1762 wxLongLong t
= ::wxGetLocalTimeMillis();
1763 int evtType
= event
.GetEventType();
1765 #if USES_WXPOPUPWINDOW || USES_GENERICTLW
1766 if ( m_popupWinType
!= POPUPWIN_WXPOPUPTRANSIENTWINDOW
)
1768 if ( IsPopupWindowState(Visible
) &&
1769 ( evtType
== wxEVT_LEFT_DOWN
|| evtType
== wxEVT_RIGHT_DOWN
) )
1777 // Filter out clicks on button immediately after popup dismiss
1778 if ( evtType
== wxEVT_LEFT_DOWN
&& t
< m_timeCanAcceptClick
)
1780 event
.SetEventType(0);
1787 void wxComboCtrlBase::HandleNormalMouseEvent( wxMouseEvent
& event
)
1789 int evtType
= event
.GetEventType();
1791 if ( (evtType
== wxEVT_LEFT_DOWN
|| evtType
== wxEVT_LEFT_DCLICK
) &&
1792 (m_windowStyle
& wxCB_READONLY
) )
1794 if ( GetPopupWindowState() >= Animating
)
1796 #if USES_WXPOPUPWINDOW
1797 // Click here always hides the popup.
1798 if ( m_popupWinType
== POPUPWIN_WXPOPUPWINDOW
)
1804 if ( !(m_windowStyle
& wxCC_SPECIAL_DCLICK
) )
1806 // In read-only mode, clicking the text is the
1807 // same as clicking the button.
1810 else if ( /*evtType == wxEVT_LEFT_UP || */evtType
== wxEVT_LEFT_DCLICK
)
1812 //if ( m_popupInterface->CycleValue() )
1814 if ( m_popupInterface
)
1815 m_popupInterface
->OnComboDoubleClick();
1819 else if ( evtType
== wxEVT_MOUSEWHEEL
)
1821 if ( IsPopupShown() )
1823 // relay (some) mouse events to the popup
1824 m_popup
->GetEventHandler()->ProcessEvent(event
);
1826 else if ( event
.GetWheelAxis() == 0 &&
1827 event
.GetWheelRotation() != 0 &&
1828 event
.GetModifiers() == 0 )
1830 // Translate mousewheel actions into key up/down. This is
1831 // the simplest way of getting native behaviour: scrolling the
1832 // wheel moves selection up/down by one item.
1833 wxKeyEvent
kevent(wxEVT_KEY_DOWN
);
1834 kevent
.m_keyCode
= event
.GetWheelRotation() > 0
1837 GetEventHandler()->ProcessEvent(kevent
);
1850 void wxComboCtrlBase::OnKeyEvent(wxKeyEvent
& event
)
1852 if ( IsPopupShown() )
1854 // pass it to the popped up control
1855 GetPopupControl()->GetControl()->GetEventHandler()->ProcessEvent(event
);
1859 wxWindow
* mainCtrl
= GetMainWindowOfCompositeControl();
1861 if ( mainCtrl
->GetParent()->HasFlag(wxTAB_TRAVERSAL
) )
1863 if ( mainCtrl
->HandleAsNavigationKey(event
) )
1867 if ( IsKeyPopupToggle(event
) )
1873 int comboStyle
= GetWindowStyle();
1874 wxComboPopup
* popupInterface
= GetPopupControl();
1876 if ( !popupInterface
)
1882 int keycode
= event
.GetKeyCode();
1884 if ( (comboStyle
& wxCB_READONLY
) ||
1885 (keycode
!= WXK_RIGHT
&& keycode
!= WXK_LEFT
) )
1887 popupInterface
->OnComboKeyEvent(event
);
1894 void wxComboCtrlBase::OnCharEvent(wxKeyEvent
& event
)
1896 if ( IsPopupShown() )
1898 // pass it to the popped up control
1899 GetPopupControl()->GetControl()->GetEventHandler()->ProcessEvent(event
);
1903 wxComboPopup
* popupInterface
= GetPopupControl();
1904 if ( popupInterface
)
1906 popupInterface
->OnComboCharEvent(event
);
1915 void wxComboCtrlBase::OnFocusEvent( wxFocusEvent
& event
)
1917 if ( event
.GetEventType() == wxEVT_SET_FOCUS
)
1919 wxWindow
* tc
= GetTextCtrl();
1920 if ( tc
&& tc
!= DoFindFocus() )
1929 void wxComboCtrlBase::OnIdleEvent( wxIdleEvent
& WXUNUSED(event
) )
1933 m_resetFocus
= false;
1934 wxWindow
* tc
= GetTextCtrl();
1940 void wxComboCtrlBase::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(event
))
1943 // left margin may also have changed
1944 if ( !(m_iFlags
& wxCC_IFLAG_LEFT_MARGIN_SET
) )
1945 m_marginLeft
= GetNativeTextIndent();
1949 // ----------------------------------------------------------------------------
1951 // ----------------------------------------------------------------------------
1953 // Create popup window and the child control
1954 void wxComboCtrlBase::CreatePopup()
1956 wxComboPopup
* popupInterface
= m_popupInterface
;
1961 #ifdef wxComboPopupWindowBase2
1962 if ( m_iFlags
& wxCC_IFLAG_USE_ALT_POPUP
)
1964 #if !USES_GENERICTLW
1965 m_winPopup
= new wxComboPopupWindowBase2( this, wxNO_BORDER
);
1967 int tlwFlags
= wxNO_BORDER
;
1968 #ifdef wxCC_GENERIC_TLW_IS_FRAME
1969 tlwFlags
|= wxFRAME_NO_TASKBAR
;
1972 #ifdef wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW
1973 m_winPopup
= new wxComboPopupWindowBase2( this, wxID_ANY
,
1974 wxPoint(-21,-21), wxSize(20, 20),
1977 m_winPopup
= new wxComboPopupWindowBase2( this, wxID_ANY
, wxEmptyString
,
1978 wxPoint(-21,-21), wxSize(20, 20),
1982 m_popupWinType
= SECONDARY_POPUP_TYPE
;
1985 #endif // wxComboPopupWindowBase2
1987 m_winPopup
= new wxComboPopupWindow( this, wxNO_BORDER
);
1988 m_popupWinType
= PRIMARY_POPUP_TYPE
;
1990 m_popupWinEvtHandler
= new wxComboPopupWindowEvtHandler(this);
1991 m_winPopup
->PushEventHandler(m_popupWinEvtHandler
);
1994 popupInterface
->Create(m_winPopup
);
1995 m_popup
= popup
= popupInterface
->GetControl();
1997 m_popupEvtHandler
= new wxComboPopupEvtHandler(this);
1998 popup
->PushEventHandler( m_popupEvtHandler
);
2000 // This may be helpful on some platforms
2001 // (eg. it bypasses a wxGTK popupwindow bug where
2002 // window is not initially hidden when it should be)
2005 popupInterface
->m_iFlags
|= wxCP_IFLAG_CREATED
;
2008 // Destroy popup window and the child control
2009 void wxComboCtrlBase::DestroyPopup()
2014 m_popup
->RemoveEventHandler(m_popupEvtHandler
);
2016 delete m_popupEvtHandler
;
2018 delete m_popupInterface
;
2022 m_winPopup
->RemoveEventHandler(m_popupWinEvtHandler
);
2023 delete m_popupWinEvtHandler
;
2024 m_popupWinEvtHandler
= NULL
;
2025 m_winPopup
->Destroy();
2028 m_popupEvtHandler
= NULL
;
2029 m_popupInterface
= NULL
;
2034 void wxComboCtrlBase::DoSetPopupControl(wxComboPopup
* iface
)
2036 wxCHECK_RET( iface
, wxT("no popup interface set for wxComboCtrl") );
2040 iface
->InitBase(this);
2043 m_popupInterface
= iface
;
2045 if ( !iface
->LazyCreate() )
2054 // This must be done after creation
2055 if ( m_valueString
.length() )
2057 iface
->SetStringValue(m_valueString
);
2062 // Ensures there is atleast the default popup
2063 void wxComboCtrlBase::EnsurePopupControl()
2065 if ( !m_popupInterface
)
2066 SetPopupControl(NULL
);
2069 void wxComboCtrlBase::OnButtonClick()
2071 // Derived classes can override this method for totally custom
2073 if ( !IsPopupWindowState(Visible
) )
2075 wxCommandEvent
event(wxEVT_COMMAND_COMBOBOX_DROPDOWN
, GetId());
2076 event
.SetEventObject(this);
2077 HandleWindowEvent(event
);
2087 void wxComboCtrlBase::ShowPopup()
2089 EnsurePopupControl();
2090 wxCHECK_RET( !IsPopupWindowState(Visible
), wxT("popup window already shown") );
2092 if ( IsPopupWindowState(Animating
) )
2097 // Space above and below
2103 wxSize ctrlSz
= GetSize();
2105 screenHeight
= wxSystemSettings::GetMetric( wxSYS_SCREEN_Y
);
2106 scrPos
= GetParent()->ClientToScreen(GetPosition());
2108 spaceAbove
= scrPos
.y
;
2109 spaceBelow
= screenHeight
- spaceAbove
- ctrlSz
.y
;
2111 maxHeightPopup
= spaceBelow
;
2112 if ( spaceAbove
> spaceBelow
)
2113 maxHeightPopup
= spaceAbove
;
2116 int widthPopup
= ctrlSz
.x
+ m_extLeft
+ m_extRight
;
2118 if ( widthPopup
< m_widthMinPopup
)
2119 widthPopup
= m_widthMinPopup
;
2121 wxWindow
* winPopup
= m_winPopup
;
2124 // Need to disable tab traversal of parent
2126 // NB: This is to fix a bug in wxMSW. In theory it could also be fixed
2127 // by, for instance, adding check to window.cpp:wxWindowMSW::MSWProcessMessage
2128 // that if transient popup is open, then tab traversal is to be ignored.
2129 // However, I think this code would still be needed for cases where
2130 // transient popup doesn't work yet (wxWinCE?).
2131 wxWindow
* mainCtrl
= GetMainWindowOfCompositeControl();
2132 wxWindow
* parent
= mainCtrl
->GetParent();
2133 int parentFlags
= parent
->GetWindowStyle();
2134 if ( parentFlags
& wxTAB_TRAVERSAL
)
2136 parent
->SetWindowStyle( parentFlags
& ~(wxTAB_TRAVERSAL
) );
2137 m_iFlags
|= wxCC_IFLAG_PARENT_TAB_TRAVERSAL
;
2143 winPopup
= m_winPopup
;
2153 wxASSERT( !m_popup
|| m_popup
== popup
); // Consistency check.
2155 wxSize adjustedSize
= m_popupInterface
->GetAdjustedSize(widthPopup
,
2156 m_heightPopup
<=0?DEFAULT_POPUP_HEIGHT
:m_heightPopup
,
2159 popup
->SetSize(adjustedSize
);
2161 m_popupInterface
->OnPopup();
2164 // Reposition and resize popup window
2167 wxSize szp
= popup
->GetSize();
2170 int popupY
= scrPos
.y
+ ctrlSz
.y
;
2172 // Default anchor is wxLEFT
2173 int anchorSide
= m_anchorSide
;
2175 anchorSide
= wxLEFT
;
2177 int rightX
= scrPos
.x
+ ctrlSz
.x
+ m_extRight
- szp
.x
;
2178 int leftX
= scrPos
.x
- m_extLeft
;
2180 if ( wxTheApp
->GetLayoutDirection() == wxLayout_RightToLeft
)
2183 int screenWidth
= wxSystemSettings::GetMetric( wxSYS_SCREEN_X
);
2185 // If there is not enough horizontal space, anchor on the other side.
2186 // If there is no space even then, place the popup at x 0.
2187 if ( anchorSide
== wxRIGHT
)
2191 if ( (leftX
+szp
.x
) < screenWidth
)
2192 anchorSide
= wxLEFT
;
2199 if ( (leftX
+szp
.x
) >= screenWidth
)
2202 anchorSide
= wxRIGHT
;
2208 // Select x coordinate according to the anchor side
2209 if ( anchorSide
== wxRIGHT
)
2211 else if ( anchorSide
== wxLEFT
)
2216 int showFlags
= CanDeferShow
;
2218 if ( spaceBelow
< szp
.y
)
2220 popupY
= scrPos
.y
- szp
.y
;
2221 showFlags
|= ShowAbove
;
2224 #if INSTALL_TOPLEV_HANDLER
2225 // Put top level window event handler into place
2226 if ( m_popupWinType
== POPUPWIN_WXPOPUPWINDOW
)
2228 if ( !m_toplevEvtHandler
)
2229 m_toplevEvtHandler
= new wxComboFrameEventHandler(this);
2231 wxWindow
* toplev
= ::wxGetTopLevelParent( this );
2233 ((wxComboFrameEventHandler
*)m_toplevEvtHandler
)->OnPopup();
2234 toplev
->PushEventHandler( m_toplevEvtHandler
);
2238 // Set string selection (must be this way instead of SetStringSelection)
2241 if ( !(m_iFlags
& wxCC_NO_TEXT_AUTO_SELECT
) )
2242 m_text
->SelectAll();
2244 m_popupInterface
->SetStringValue( m_text
->GetValue() );
2248 // This is neede since focus/selection indication may change when popup is shown
2252 // This must be after SetStringValue
2253 m_popupWinState
= Animating
;
2255 wxRect
popupWinRect( popupX
, popupY
, szp
.x
, szp
.y
);
2258 if ( (m_iFlags
& wxCC_IFLAG_DISABLE_POPUP_ANIM
) ||
2259 AnimateShow( popupWinRect
, showFlags
) )
2261 DoShowPopup( popupWinRect
, showFlags
);
2265 bool wxComboCtrlBase::AnimateShow( const wxRect
& WXUNUSED(rect
), int WXUNUSED(flags
) )
2270 void wxComboCtrlBase::DoShowPopup( const wxRect
& rect
, int WXUNUSED(flags
) )
2272 wxWindow
* winPopup
= m_winPopup
;
2274 if ( IsPopupWindowState(Animating
) )
2276 // Make sure the popup window is shown in the right position.
2277 // Should not matter even if animation already did this.
2279 // Some platforms (GTK) may like SetSize and Move to be separate
2280 // (though the bug was probably fixed).
2281 winPopup
->SetSize( rect
);
2283 #if USES_WXPOPUPTRANSIENTWINDOW
2284 if ( m_popupWinType
== POPUPWIN_WXPOPUPTRANSIENTWINDOW
)
2285 ((wxPopupTransientWindow
*)winPopup
)->Popup(m_popup
);
2290 m_popupWinState
= Visible
;
2292 else if ( IsPopupWindowState(Hidden
) )
2294 // Animation was aborted
2296 wxASSERT( !winPopup
->IsShown() );
2298 m_popupWinState
= Hidden
;
2304 void wxComboCtrlBase::OnPopupDismiss(bool generateEvent
)
2306 // Just in case, avoid double dismiss
2307 if ( IsPopupWindowState(Hidden
) )
2310 // This must be set before focus - otherwise there will be recursive
2311 // OnPopupDismisses.
2312 m_popupWinState
= Hidden
;
2315 m_winPopup
->Disable();
2317 // Inform popup control itself
2318 m_popupInterface
->OnDismiss();
2320 if ( m_popupEvtHandler
)
2321 ((wxComboPopupEvtHandler
*)m_popupEvtHandler
)->OnPopupDismiss();
2323 #if INSTALL_TOPLEV_HANDLER
2324 // Remove top level window event handler
2325 if ( m_toplevEvtHandler
)
2327 wxWindow
* toplev
= ::wxGetTopLevelParent( this );
2329 toplev
->RemoveEventHandler( m_toplevEvtHandler
);
2333 m_timeCanAcceptClick
= ::wxGetLocalTimeMillis();
2335 if ( m_popupWinType
== POPUPWIN_WXPOPUPTRANSIENTWINDOW
)
2336 m_timeCanAcceptClick
+= 150;
2338 // If cursor not on dropdown button, then clear its state
2339 // (technically not required by all ports, but do it for all just in case)
2340 if ( !m_btnArea
.Contains(ScreenToClient(::wxGetMousePosition())) )
2343 // Return parent's tab traversal flag.
2344 // See ShowPopup for notes.
2345 if ( m_iFlags
& wxCC_IFLAG_PARENT_TAB_TRAVERSAL
)
2347 wxWindow
* parent
= GetParent();
2348 parent
->SetWindowStyle( parent
->GetWindowStyle() | wxTAB_TRAVERSAL
);
2349 m_iFlags
&= ~(wxCC_IFLAG_PARENT_TAB_TRAVERSAL
);
2352 // refresh control (necessary even if m_text)
2357 if ( generateEvent
)
2359 wxCommandEvent
event(wxEVT_COMMAND_COMBOBOX_CLOSEUP
, GetId());
2360 event
.SetEventObject(this);
2361 HandleWindowEvent(event
);
2365 void wxComboCtrlBase::HidePopup(bool generateEvent
)
2367 // Should be able to call this without popup interface
2368 if ( IsPopupWindowState(Hidden
) )
2371 // transfer value and show it in textctrl, if any
2372 if ( !IsPopupWindowState(Animating
) )
2373 SetValue( m_popupInterface
->GetStringValue() );
2377 OnPopupDismiss(generateEvent
);
2380 // ----------------------------------------------------------------------------
2381 // customization methods
2382 // ----------------------------------------------------------------------------
2384 void wxComboCtrlBase::SetButtonPosition( int width
, int height
,
2385 int side
, int spacingX
)
2390 m_btnSpacingX
= spacingX
;
2392 if ( width
> 0 || height
> 0 || spacingX
)
2393 m_iFlags
|= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON
;
2398 wxSize
wxComboCtrlBase::GetButtonSize()
2400 if ( m_btnSize
.x
> 0 )
2403 wxSize
retSize(m_btnWid
,m_btnHei
);
2405 // Need to call CalculateAreas now if button size is
2406 // is not explicitly specified.
2407 if ( retSize
.x
<= 0 || retSize
.y
<= 0)
2411 retSize
= m_btnSize
;
2417 void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap
& bmpNormal
,
2419 const wxBitmap
& bmpPressed
,
2420 const wxBitmap
& bmpHover
,
2421 const wxBitmap
& bmpDisabled
)
2423 m_bmpNormal
= bmpNormal
;
2424 m_blankButtonBg
= blankButtonBg
;
2426 if ( bmpPressed
.Ok() )
2427 m_bmpPressed
= bmpPressed
;
2429 m_bmpPressed
= bmpNormal
;
2431 if ( bmpHover
.Ok() )
2432 m_bmpHover
= bmpHover
;
2434 m_bmpHover
= bmpNormal
;
2436 if ( bmpDisabled
.Ok() )
2437 m_bmpDisabled
= bmpDisabled
;
2439 m_bmpDisabled
= bmpNormal
;
2444 void wxComboCtrlBase::SetCustomPaintWidth( int width
)
2448 // move textctrl accordingly
2449 wxRect r
= m_text
->GetRect();
2450 int inc
= width
- m_widthCustomPaint
;
2453 m_text
->SetSize( r
);
2456 m_widthCustomPaint
= width
;
2461 bool wxComboCtrlBase::DoSetMargins(const wxPoint
& margins
)
2463 // For general sanity's sake, we ignore top margin. Instead
2464 // we will always try to center the text vertically.
2467 if ( margins
.x
!= -1 )
2469 m_marginLeft
= margins
.x
;
2470 m_iFlags
|= wxCC_IFLAG_LEFT_MARGIN_SET
;
2474 m_marginLeft
= GetNativeTextIndent();
2475 m_iFlags
&= ~(wxCC_IFLAG_LEFT_MARGIN_SET
);
2478 if ( margins
.y
!= -1 )
2488 wxPoint
wxComboCtrlBase::DoGetMargins() const
2490 return wxPoint(m_marginLeft
, -1);
2493 #if WXWIN_COMPATIBILITY_2_8
2494 void wxComboCtrlBase::SetTextIndent( int indent
)
2498 m_marginLeft
= GetNativeTextIndent();
2499 m_iFlags
&= ~(wxCC_IFLAG_LEFT_MARGIN_SET
);
2503 m_marginLeft
= indent
;
2504 m_iFlags
|= wxCC_IFLAG_LEFT_MARGIN_SET
;
2510 wxCoord
wxComboCtrlBase::GetTextIndent() const
2512 return m_marginLeft
;
2516 wxCoord
wxComboCtrlBase::GetNativeTextIndent() const
2518 return DEFAULT_TEXT_INDENT
;
2521 // ----------------------------------------------------------------------------
2522 // methods forwarded to wxTextCtrl
2523 // ----------------------------------------------------------------------------
2525 wxString
wxComboCtrlBase::GetValue() const
2528 return m_text
->GetValue();
2529 return m_valueString
;
2532 void wxComboCtrlBase::SetValueWithEvent(const wxString
& value
, bool withEvent
)
2539 m_text
->SetValue(value
);
2541 if ( !(m_iFlags
& wxCC_NO_TEXT_AUTO_SELECT
) )
2542 m_text
->SelectAll();
2545 // Since wxComboPopup may want to paint the combo as well, we need
2546 // to set the string value here (as well as sometimes in ShowPopup).
2547 if ( m_valueString
!= value
)
2549 m_valueString
= value
;
2551 EnsurePopupControl();
2553 if (m_popupInterface
)
2554 m_popupInterface
->SetStringValue(value
);
2560 void wxComboCtrlBase::SetValue(const wxString
& value
)
2562 SetValueWithEvent(value
, false);
2565 // In this SetValue variant wxComboPopup::SetStringValue is not called
2566 void wxComboCtrlBase::SetText(const wxString
& value
)
2568 // Unlike in SetValue(), this must be called here or
2569 // the behaviour will no be consistent in readonlys.
2570 EnsurePopupControl();
2572 m_valueString
= value
;
2577 m_text
->SetValue( value
);
2583 void wxComboCtrlBase::Copy()
2589 void wxComboCtrlBase::Cut()
2595 void wxComboCtrlBase::Paste()
2601 void wxComboCtrlBase::SetInsertionPoint(long pos
)
2604 m_text
->SetInsertionPoint(pos
);
2607 void wxComboCtrlBase::SetInsertionPointEnd()
2610 m_text
->SetInsertionPointEnd();
2613 long wxComboCtrlBase::GetInsertionPoint() const
2616 return m_text
->GetInsertionPoint();
2621 long wxComboCtrlBase::GetLastPosition() const
2624 return m_text
->GetLastPosition();
2629 void wxComboCtrlBase::Replace(long from
, long to
, const wxString
& value
)
2632 m_text
->Replace(from
, to
, value
);
2635 void wxComboCtrlBase::Remove(long from
, long to
)
2638 m_text
->Remove(from
, to
);
2641 void wxComboCtrlBase::SetSelection(long from
, long to
)
2644 m_text
->SetSelection(from
, to
);
2647 void wxComboCtrlBase::Undo()
2653 bool wxComboCtrlBase::SetHint(const wxString
& hint
)
2658 res
= m_text
->SetHint(hint
);
2663 wxString
wxComboCtrlBase::GetHint() const
2668 #endif // wxUSE_COMBOCTRL