void wxGenericComboCtrl::SetCustomPaintWidth( int width ) { #ifdef UNRELIABLE_TEXTCTRL_BORDER // // If starting/stopping to show an image in front // of a writable text-field, then re-create textctrl // with different kind of border (because we can't // assume that textctrl fully supports wxNO_BORDER). // wxTextCtrl* tc = GetTextCtrl(); if ( tc && (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ) { int borderType = tc->GetWindowStyle() & wxBORDER_MASK; int tcCreateStyle = -1; if ( width > 0 ) { // Re-create textctrl with no border if ( borderType != wxNO_BORDER ) { m_widthCustomBorder = 1; tcCreateStyle = wxNO_BORDER; } } else if ( width == 0 ) { // Re-create textctrl with normal border if ( borderType == wxNO_BORDER ) { m_widthCustomBorder = 0; tcCreateStyle = 0; } } // Common textctrl re-creation code if ( tcCreateStyle != -1 ) { tc->RemoveEventHandler(m_textEvtHandler); delete m_textEvtHandler; CreateTextCtrl( tcCreateStyle ); InstallInputHandlers(); } } #endif // UNRELIABLE_TEXTCTRL_BORDER wxComboCtrlBase::SetCustomPaintWidth( width ); }
bool wxGenericComboCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { // // Note that technically we only support 'default' border and wxNO_BORDER. long border = style & wxBORDER_MASK; int tcBorder = wxNO_BORDER; #if defined(__WXUNIVERSAL__) if ( !border ) border = wxBORDER_SIMPLE; #elif defined(__WXMSW__) if ( !border ) // For XP, have 1-width custom border, for older version use sunken /*if ( wxUxThemeEngine::GetIfActive() ) { border = wxBORDER_NONE; m_widthCustomBorder = 1; } else*/ border = wxBORDER_SUNKEN; #else // // Generic version is optimized for wxGTK // #define UNRELIABLE_TEXTCTRL_BORDER if ( !border ) { if ( style & wxCB_READONLY ) { m_widthCustomBorder = 1; } else { m_widthCustomBorder = 0; tcBorder = 0; } } else { // Have textctrl instead use the border given. tcBorder = border; } // Because we are going to have button outside the border, // let's use wxBORDER_NONE for the whole control. border = wxBORDER_NONE; Customize( wxCC_BUTTON_OUTSIDE_BORDER | wxCC_NO_TEXT_AUTO_SELECT | wxCC_BUTTON_STAYS_DOWN ); #endif style = (style & ~(wxBORDER_MASK)) | border; if ( style & wxCC_STD_BUTTON ) m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; // create main window if ( !wxComboCtrlBase::Create(parent, id, value, pos, size, style | wxFULL_REPAINT_ON_RESIZE, validator, name) ) return false; // Create textctrl, if necessary CreateTextCtrl( tcBorder ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers(); // Set background style for double-buffering, when needed // (cannot use when system draws background automatically) if ( !HasTransparentBackground() ) SetBackgroundStyle( wxBG_STYLE_PAINT ); // SetInitialSize should be called last SetInitialSize(size); return true; }
bool wxComboCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { // Set border long border = style & wxBORDER_MASK; #if wxUSE_UXTHEME wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); #endif if ( !border ) { #if wxUSE_UXTHEME if ( theme ) { // For XP, have 1-width custom border, for older version use sunken border = wxBORDER_NONE; m_widthCustomBorder = 1; } else #endif border = wxBORDER_SUNKEN; style = (style & ~(wxBORDER_MASK)) | border; } // create main window if ( !wxComboCtrlBase::Create(parent, id, value, pos, size, style | wxFULL_REPAINT_ON_RESIZE, wxDefaultValidator, name) ) return false; #if wxUSE_UXTHEME if ( theme ) { if ( ::wxGetWinVersion() >= wxWinVersion_Vista ) m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER; } #endif if ( style & wxCC_STD_BUTTON ) m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; // Create textctrl, if necessary CreateTextCtrl( wxNO_BORDER, validator ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers(); // Prepare background for double-buffering SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // SetInitialSize should be called last SetInitialSize(size); return true; }
bool wxComboCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { // Set border long border = style & wxBORDER_MASK; if ( !border ) { if ( wxUxThemeIsActive() ) { // For XP, have 1-width custom border, for older version use sunken border = wxBORDER_NONE; m_widthCustomBorder = 1; } else border = wxBORDER_SUNKEN; style = (style & ~(wxBORDER_MASK)) | border; } // create main window if ( !wxComboCtrlBase::Create(parent, id, value, pos, size, style | wxFULL_REPAINT_ON_RESIZE, validator, name) ) return false; if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista ) m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER; if ( style & wxCC_STD_BUTTON ) m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; // Prepare background for double-buffering or better background theme // support, whichever is possible. SetDoubleBuffered(true); if ( !IsDoubleBuffered() ) SetBackgroundStyle( wxBG_STYLE_PAINT ); // Create textctrl, if necessary CreateTextCtrl( wxNO_BORDER ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers(); // SetInitialSize should be called last SetInitialSize(size); return true; }
bool wxGenericComboControl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { // Set border long border = style & wxBORDER_MASK; if ( !border ) { #if defined(__WXUNIVERSAL__) border = wxBORDER_SIMPLE; #elif defined(__WXMSW__) // For XP, have 1-width custom border, for older version use sunken if ( wxUxThemeEngine::GetIfActive() ) { border = wxBORDER_NONE; m_widthCustomBorder = 1; } else border = wxBORDER_SUNKEN; #elif defined(__WXGTK__) border = wxBORDER_NONE; //m_widthCustomBorder = 2; m_widthCustomBorder = 1; #else border = wxBORDER_SIMPLE; #endif style = (style & ~(wxBORDER_MASK)) | border; } #if defined(__WXGTK__) Customize( wxCC_BUTTON_OUTSIDE_BORDER | wxCC_NO_TEXT_AUTO_SELECT ); #endif if ( style & wxCC_STD_BUTTON ) m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; // create main window if ( !wxComboCtrlBase::Create(parent, id, value, pos, size, style | wxFULL_REPAINT_ON_RESIZE, wxDefaultValidator, name) ) return false; // Create textctrl, if necessary CreateTextCtrl( wxNO_BORDER, validator ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers( true ); // Set background SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering // SetBestSize should be called last SetBestSize(size); return true; }