[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-dev] wxOwnerDrawnComboBox: wxComboCtrlBase::CalculateAreas prevents drawing button outside control
- From: Alex Bligh <alex@xxxxxxxxxxx>
- Date: Thu, 06 Jul 2006 20:55:10 +0100
- Subject: [XaraXtreme-dev] wxOwnerDrawnComboBox: wxComboCtrlBase::CalculateAreas prevents drawing button outside control
Jaakko et al,
When wxOwnerDrawnComboBox is loaded from XRC, it is possible to
set the button height (and button width). We do this to get
However, this sets the button height to -1 (default). The
lines below then cause problems because m_btnHei is non-zero.
This causes the button to be painted inside the control rather
than outside it. This is incorrect behaviour I think.
Further more, we have been experimenting with very short
(i.e. low height) combos. In this environment you definitely
want the button painted outside the combo control area or
it will be invisible! But the code as written prevents this
(though to be fair it works if the button is the default height).
I think relying on m_btnHei is wrong here. The user should set
the flag correctly (if there isn't an XRC field for it I will
put one in), and the button should appear where the user
selects. Failing that, I suggest at least that a height of -1
should be allowable; that would mean the test becomes
m_btnHei <= 0. This fixes the immediate problem.
void wxComboCtrlBase::CalculateAreas( int btnWidth )
wxSize sz = GetClientSize();
int customBorder = m_widthCustomBorder;
int btnBorder; // border for button only
// check if button should really be outside the border: we'll do it
// its platform default or bitmap+pushbutton background is used,
but not if
// there is vertical size adjustment or horizontal spacing.
if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ||
(m_bmpNormal.Ok() && m_blankButtonBg) ) &&
m_btnSpacingX == 0 &&
m_btnHei == 0 )
m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE;
btnBorder = 0;
m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE);
btnBorder = customBorder;