+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;
+
+ wxValidator* pValidator = tc->GetValidator();
+ if ( pValidator )
+ {
+ pValidator = (wxValidator*) pValidator->Clone();
+ CreateTextCtrl( tcCreateStyle, *pValidator );
+ delete pValidator;
+ }
+ else
+ {
+ CreateTextCtrl( tcCreateStyle, wxDefaultValidator );
+ }
+
+ InstallInputHandlers();
+ }
+ }
+#endif // UNRELIABLE_TEXTCTRL_BORDER
+
+ wxComboCtrlBase::SetCustomPaintWidth( width );
+}
+
+bool wxGenericComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const
+{
+ int keycode = event.GetKeyCode();
+ bool isPopupShown = IsPopupShown();
+
+ // This code is AFAIK appropriate for wxGTK.
+
+ if ( isPopupShown )
+ {
+ if ( keycode == WXK_ESCAPE ||
+ ( keycode == WXK_UP && event.AltDown() ) )
+ return true;
+ }
+ else
+ {
+ if ( keycode == WXK_DOWN && event.AltDown() )
+ return true;
+ }
+
+ return false;
+}
+