#include "wx/settings.h"
#include "wx/dialog.h"
#include "wx/timer.h"
+ #include "wx/textctrl.h"
#endif
#include "wx/tooltip.h"
#elif defined(__WXMAC__)
-#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
-#define TRANSIENT_POPUPWIN_IS_PERFECT 0 // wxPopupTransientWindow works, its child can have focus, and common
+#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform)
+#define TRANSIENT_POPUPWIN_IS_PERFECT 1 // wxPopupTransientWindow works, its child can have focus, and common
// native controls work on it like normal.
-#define POPUPWIN_IS_PERFECT 0 // Same, but for non-transient popup window.
+#define POPUPWIN_IS_PERFECT 1 // Same, but for non-transient popup window.
#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered
#define FOCUS_RING 3 // Reserve room for the textctrl's focus ring to display
// Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless
// what the wxUSE_POPUPWIN says.
// FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2)
-#if (!defined(__WXMSW__) && !defined(__WXGTK__)) || defined(__WXWINCE__)
+#if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) || defined(__WXWINCE__)
#undef wxUSE_POPUPWIN
#define wxUSE_POPUPWIN 0
#endif
{
int newY = butHeight+(customBorder*2);
SetClientSize(wxDefaultCoord,newY);
- if ( m_bmpNormal.Ok() || m_btnArea.width != butWidth || m_btnArea.height != butHeight )
- m_iFlags |= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON;
- else
- m_iFlags &= ~wxCC_IFLAG_HAS_NONSTANDARD_BUTTON;
+ if ( m_bmpNormal.Ok() || m_btnArea.width != butWidth || m_btnArea.height != butHeight )
+ m_iFlags |= wxCC_IFLAG_HAS_NONSTANDARD_BUTTON;
+ else
+ m_iFlags &= ~wxCC_IFLAG_HAS_NONSTANDARD_BUTTON;
sz.y = newY;
}
m_btn->Enable(enable);
if ( m_text )
m_text->Enable(enable);
+
+ Refresh();
return true;
}
if ( textCtrl )
textCtrl->SetValidator( validator );
+ else
+ wxControl::SetValidator( validator );
}
wxValidator* wxComboCtrlBase::GetValidator()
{
wxTextCtrl* textCtrl = GetTextCtrl();
- if ( textCtrl )
- return textCtrl->GetValidator();
-
- return wxControl::GetValidator();
+ return textCtrl ? textCtrl->GetValidator() : wxControl::GetValidator();
}
#endif // wxUSE_VALIDATORS
{
// Drawing control
isEnabled = IsEnabled();
- doDrawFocusRect = ShouldDrawFocus() & !(m_iFlags & wxCC_FULL_BUTTON);
+ doDrawFocusRect = ShouldDrawFocus() && !(m_iFlags & wxCC_FULL_BUTTON);
// Windows-style: for smaller size control (and for disabled background) use less spacing
focusSpacingX = isEnabled ? 2 : 1;
{
// Drawing a list item
isEnabled = true; // they are never disabled
- doDrawFocusRect = flags & wxCONTROL_SELECTED ? true : false;
+ doDrawFocusRect = (flags & wxCONTROL_SELECTED) != 0;
focusSpacingX = 0;
focusSpacingY = 0;
}
else // no popup
{
- int keycode = event.GetKeyCode();
-
- if ( keycode == WXK_TAB )
- {
- wxNavigationKeyEvent evt;
-
- wxWindow* mainCtrl = GetMainWindowOfCompositeControl();
-
- evt.SetFlags(wxNavigationKeyEvent::FromTab|
- (!event.ShiftDown() ? wxNavigationKeyEvent::IsForward
- : wxNavigationKeyEvent::IsBackward));
- evt.SetEventObject(mainCtrl);
- evt.SetCurrentFocus(mainCtrl);
- mainCtrl->GetParent()->GetEventHandler()->AddPendingEvent(evt);
+ if ( HandleAsNavigationKey(event) )
return;
- }
if ( IsKeyPopupToggle(event) )
{
return;
}
+ int keycode = event.GetKeyCode();
+
if ( (comboStyle & wxCB_READONLY) ||
(keycode != WXK_RIGHT && keycode != WXK_LEFT) )
{
m_ignoreEvtText++;
m_text->SetValue(value);
+
if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) )
m_text->SelectAll();
}
EnsurePopupControl();
- m_popupInterface->SetStringValue(value);
+ if (m_popupInterface)
+ m_popupInterface->SetStringValue(value);
}
Refresh();