X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a340b80d8a692f5308d26c1c1b95fd689a1d7eb3..aba610e77a19ce35ca45bb235bbe3ea68cff9916:/src/generic/combog.cpp diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index 3b62ca9bc5..d99937a3fe 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: combog.cpp -// Purpose: Generic wxComboControl +// Name: src/generic/combog.cpp +// Purpose: Generic wxComboCtrl // Author: Jaakko Salli // Modified by: // Created: Apr-30-2006 @@ -23,7 +23,9 @@ #pragma hdrstop #endif -#if wxUSE_COMBOCONTROL +#if wxUSE_COMBOCTRL + +#include "wx/combo.h" #ifndef WX_PRECOMP #include "wx/log.h" @@ -34,9 +36,6 @@ #include "wx/dcbuffer.h" -#include "wx/combo.h" - - // ---------------------------------------------------------------------------- // Some constant adjustments to make the generic more bearable @@ -90,13 +89,13 @@ // wxGenericComboControl // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericComboControl, wxComboControlBase) +BEGIN_EVENT_TABLE(wxGenericComboControl, wxComboCtrlBase) EVT_PAINT(wxGenericComboControl::OnPaintEvent) EVT_MOUSE_EVENTS(wxGenericComboControl::OnMouseEvent) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxGenericComboControl, wxComboControlBase) +IMPLEMENT_DYNAMIC_CLASS(wxGenericComboControl, wxComboCtrlBase) void wxGenericComboControl::Init() { @@ -148,7 +147,7 @@ bool wxGenericComboControl::Create(wxWindow *parent, m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; // create main window - if ( !wxComboControlBase::Create(parent, + if ( !wxComboCtrlBase::Create(parent, id, value, wxDefaultPosition, @@ -260,7 +259,7 @@ void wxGenericComboControl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) DrawButton(dc,rectb,true); // paint required portion on the control - if ( !m_text || m_widthCustomPaint ) + if ( (!m_text || m_widthCustomPaint) ) { wxASSERT( m_widthCustomPaint >= 0 ); @@ -272,7 +271,10 @@ void wxGenericComboControl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) dc.SetFont( GetFont() ); dc.SetClippingRegion(rect); - m_popupInterface->PaintComboControl(dc,rect); + if ( m_popupInterface ) + m_popupInterface->PaintComboControl(dc,rect); + else + wxComboPopup::DefaultPaintComboControl(this,dc,rect); } } @@ -286,7 +288,14 @@ void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event ) if ( PreprocessMouseEvent(event,handlerFlags) ) return; - if ( (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) +#ifdef __WXMSW__ + const bool ctrlIsButton = true; +#else + const bool ctrlIsButton = false; +#endif + + if ( ctrlIsButton && + (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) { // if no textctrl and no special double-click, then the entire control acts // as a button @@ -353,12 +362,12 @@ bool wxGenericComboControl::PerformAction(const wxControlAction& action, #endif // __WXUNIVERSAL__ -// If native wxComboControl was not defined, then prepare a simple +// If native wxComboCtrl was not defined, then prepare a simple // front-end so that wxRTTI works as expected. #ifndef _WX_COMBOCONTROL_H_ -IMPLEMENT_DYNAMIC_CLASS(wxComboControl, wxGenericComboControl) +IMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxGenericComboControl) #endif #endif // !wxCOMBOCONTROL_FULLY_FEATURED -#endif // wxUSE_COMBOCONTROL +#endif // wxUSE_COMBOCTRL