git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40158
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
A reference to the depressed state bitmap.
A reference to the depressed state bitmap.
+\membersection{wxComboCtrl::GetButtonSize}\label{wxcomboctrlgetbuttonsize}
+
+\func{wxSize}{GetButtonSize}{\void}
+
+Returns current size of the dropdown button.
+
+
\membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth}
\constfunc{int}{GetCustomPaintWidth}{\void}
\membersection{wxComboCtrl::GetCustomPaintWidth}\label{wxcomboctrlgetcustompaintwidth}
\constfunc{int}{GetCustomPaintWidth}{\void}
\membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition}
\membersection{wxComboCtrl::SetButtonPosition}\label{wxcomboctrlsetbuttonposition}
-\func{void}{SetButtonPosition}{\param{int }{width = 0}, \param{int }{height = 0}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}}
+\func{void}{SetButtonPosition}{\param{int }{width = -1}, \param{int }{height = -1}, \param{int }{side = wxRIGHT}, \param{int }{spacingX = 0}}
Sets size and position of dropdown button.
\wxheading{Parameters}
Sets size and position of dropdown button.
\wxheading{Parameters}
-\docparam{width}{If > $0$, defines specific button width. $0$ means platform default,
-while negative numbers allow adjusting smaller than default.}
-\docparam{height}{Same as width.}
+\docparam{width}{Button width. Value <= $0$ specifies default.}
+\docparam{height}{Button height. Value <= $0$ specifies default.}
\docparam{side}{Indicates which side the button will be placed.
Value can be {\tt wxLEFT} or {\tt wxRIGHT}.}
\docparam{spacingX}{Horizontal spacing around the button. Default is $0$.}
\docparam{side}{Indicates which side the button will be placed.
Value can be {\tt wxLEFT} or {\tt wxRIGHT}.}
\docparam{spacingX}{Horizontal spacing around the button. Default is $0$.}
}
// Set position of dropdown button.
}
// Set position of dropdown button.
- // width: 0 > for specific custom width, negative to adjust to smaller than default
- // height: 0 > for specific custom height, negative to adjust to smaller than default
+ // width: button width. <= 0 for default.
+ // height: button height. <= 0 for default.
// side: wxLEFT or wxRIGHT, indicates on which side the button will be placed.
// spacingX: empty space on sides of the button. Default is 0.
// Remarks:
// There is no spacingY - the button will be centered vertically.
// side: wxLEFT or wxRIGHT, indicates on which side the button will be placed.
// spacingX: empty space on sides of the button. Default is 0.
// Remarks:
// There is no spacingY - the button will be centered vertically.
- void SetButtonPosition( int width = 0,
- int height = 0,
+ void SetButtonPosition( int width = -1,
+ int height = -1,
int side = wxRIGHT,
int spacingX = 0 );
int side = wxRIGHT,
int spacingX = 0 );
+ // Returns current size of the dropdown button.
+ wxSize GetButtonSize();
//
// Sets dropbutton to be drawn with custom bitmaps.
//
// Sets dropbutton to be drawn with custom bitmaps.
- odc->SetButtonPosition(-2, // width adjustment
- -6, // height adjustment
+
+ // Use button size that is slightly smaller than the default.
+ wxSize butSize = odc->GetButtonSize();
+ odc->SetButtonPosition(butSize.x - 2, // button width
+ butSize.y - 6, // button height
wxLEFT, // side
2 // horizontal spacing
);
wxLEFT, // side
2 // horizontal spacing
);
gcc->SetValue(wxT("Subitem 05"));
// Move button to left - it makes more sense for a tree ctrl
gcc->SetValue(wxT("Subitem 05"));
// Move button to left - it makes more sense for a tree ctrl
- gcc->SetButtonPosition(0, // width adjustment
- 0, // height adjustment
+ gcc->SetButtonPosition(-1, // button width
+ -1, // button height
wxLEFT, // side
0 // horizontal spacing
);
wxLEFT, // side
0 // horizontal spacing
);
m_btnState = 0;
m_btnWidDefault = 0;
m_blankButtonBg = false;
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;
m_btnSide = wxRIGHT;
m_btnSpacingX = 0;
if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ||
(m_bmpNormal.Ok() && m_blankButtonBg) ) &&
m_btnSpacingX == 0 &&
if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) ||
(m_bmpNormal.Ok() && m_blankButtonBg) ) &&
m_btnSpacingX == 0 &&
{
m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE;
btnBorder = 0;
{
m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE;
btnBorder = 0;
int butHeight = sz.y - btnBorder*2;
// Adjust button width
int butHeight = sz.y - btnBorder*2;
// Adjust button width
- if ( m_btnWid < 0 )
- butWidth += m_btnWid;
- else if ( m_btnWid > 0 )
butWidth = m_btnWid;
else
{
butWidth = m_btnWid;
else
{
}
// Adjust button height
}
// Adjust button height
- if ( m_btnHei < 0 )
- butHeight += m_btnHei;
- else if ( m_btnHei > 0 )
butHeight = m_btnHei;
// Use size of normal bitmap if...
butHeight = m_btnHei;
// Use size of normal bitmap if...
// ----------------------------------------------------------------------------
void wxComboCtrlBase::SetButtonPosition( int width, int height,
// ----------------------------------------------------------------------------
void wxComboCtrlBase::SetButtonPosition( int width, int height,
- int side, int spacingX )
+ int side, int spacingX )
{
m_btnWid = width;
m_btnHei = height;
{
m_btnWid = width;
m_btnHei = height;
+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,
void wxComboCtrlBase::SetButtonBitmaps( const wxBitmap& bmpNormal,
bool blankButtonBg,
const wxBitmap& bmpPressed,