X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d95cab89dcb9914247d803a70bef9e443bad4c5..25b34b267ec6878c04add03e874986673fa0f19f:/src/common/combocmn.cpp diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index c06b0bfaa4..b9792d8df8 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -461,7 +461,7 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) { int keycode = event.GetKeyCode(); - if ( keycode == WXK_TAB ) + if ( keycode == WXK_TAB && !m_combo->IsPopupShown() ) { wxNavigationKeyEvent evt; evt.SetFlags(wxNavigationKeyEvent::FromTab| @@ -492,19 +492,7 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) ( keycode != WXK_RIGHT && keycode != WXK_LEFT ) ) { - // Alternate keys: UP and DOWN show the popup instead of cycling - if ( (comboStyle & wxCC_ALT_KEYS) ) - { - if ( keycode == WXK_UP || keycode == WXK_DOWN ) - { - m_combo->OnButtonClick(); - return; - } - else - event.Skip(); - } - else - popupInterface->OnComboKeyEvent(event); + popupInterface->OnComboKeyEvent(event); } else event.Skip(); @@ -681,7 +669,7 @@ void wxComboCtrlBase::Init() m_btnState = 0; m_btnWidDefault = 0; m_blankButtonBg = false; - m_btnWid = m_btnHei = 0; + m_btnWid = m_btnHei = -1; m_btnSide = wxRIGHT; m_btnSpacingX = 0; @@ -813,7 +801,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || (m_bmpNormal.Ok() && m_blankButtonBg) ) && m_btnSpacingX == 0 && - m_btnHei == 0 ) + m_btnHei <= 0 ) { m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE; btnBorder = 0; @@ -841,9 +829,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) int butHeight = sz.y - btnBorder*2; // Adjust button width - if ( m_btnWid < 0 ) - butWidth += m_btnWid; - else if ( m_btnWid > 0 ) + if ( m_btnWid > 0 ) butWidth = m_btnWid; else { @@ -865,9 +851,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) } // Adjust button height - if ( m_btnHei < 0 ) - butHeight += m_btnHei; - else if ( m_btnHei > 0 ) + if ( m_btnHei > 0 ) butHeight = m_btnHei; // Use size of normal bitmap if... @@ -1290,8 +1274,11 @@ wxBitmap& wxComboCtrlBase::GetBufferBitmap( const wxSize& sz ) const void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event) { - // Change event id and relay it forward + // Change event id, object and string before relaying it forward event.SetId(GetId()); + wxString s = event.GetString(); + event.SetEventObject(this); + event.SetString(s); event.Skip(); } @@ -1559,6 +1546,7 @@ void wxComboCtrlBase::DestroyPopup() if ( m_winPopup ) m_winPopup->Destroy(); + m_popupExtraHandler = (wxEvtHandler*) NULL; m_popupInterface = (wxComboPopup*) NULL; m_winPopup = (wxWindow*) NULL; m_popup = (wxWindow*) NULL; @@ -1853,7 +1841,7 @@ void wxComboCtrlBase::HidePopup() // ---------------------------------------------------------------------------- void wxComboCtrlBase::SetButtonPosition( int width, int height, - int side, int spacingX ) + int side, int spacingX ) { m_btnWid = width; m_btnHei = height; @@ -1863,6 +1851,25 @@ void wxComboCtrlBase::SetButtonPosition( int width, int height, RecalcAndRefresh(); } +wxSize wxComboCtrlBase::GetButtonSize() +{ + if ( m_btnSize.x > 0 ) + return m_btnSize; + + wxSize retSize(m_btnWid,m_btnHei); + + // Need to call CalculateAreas now if button size is + // is not explicitly specified. + if ( retSize.x <= 0 || retSize.y <= 0) + { + OnResize(); + + retSize = m_btnSize; + } + + return retSize; +} + void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal, bool blankButtonBg, const wxBitmap& bmpPressed,