don't set min width for the buttons

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-10 14:00:26 +00:00
parent 7ef8bfc4c7
commit 1b488c0eeb

View File

@@ -52,7 +52,7 @@
// constants (to be removed, for testing only) // constants (to be removed, for testing only)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static const size_t BORDER_THICKNESS = 1; static const size_t BORDER_THICKNESS = 10;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGTKRenderer: draw the GUI elements in GTK style // wxGTKRenderer: draw the GUI elements in GTK style
@@ -205,6 +205,7 @@ public:
const wxMenuGeometryInfo& geomInfo); const wxMenuGeometryInfo& geomInfo);
#endif #endif
virtual void GetComboBitmaps(wxBitmap *bmpNormal, virtual void GetComboBitmaps(wxBitmap *bmpNormal,
wxBitmap *bmpFocus,
wxBitmap *bmpPressed, wxBitmap *bmpPressed,
wxBitmap *bmpDisabled); wxBitmap *bmpDisabled);
@@ -370,6 +371,9 @@ protected:
wxAlignment align, wxAlignment align,
int indexAccel); int indexAccel);
// initialize the combo bitmaps
void InitComboBitmaps();
private: private:
const wxColourScheme *m_scheme; const wxColourScheme *m_scheme;
@@ -390,6 +394,18 @@ private:
// the line wrap bitmap (drawn at the end of wrapped lines) // the line wrap bitmap (drawn at the end of wrapped lines)
wxBitmap m_bmpLineWrap; wxBitmap m_bmpLineWrap;
// the combobox bitmaps
enum
{
ComboState_Normal,
ComboState_Focus,
ComboState_Pressed,
ComboState_Disabled,
ComboState_Max
};
wxBitmap m_bitmapsCombo[ComboState_Max];
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1792,16 +1808,64 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
return NULL; return NULL;
} }
#endif #endif // wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// combobox // combobox
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxGTKRenderer::InitComboBitmaps()
{
wxSize sizeArrow = m_sizeScrollbarArrow;
sizeArrow.x -= 2;
sizeArrow.y -= 2;
size_t n;
for ( n = ComboState_Normal; n < ComboState_Max; n++ )
{
m_bitmapsCombo[n].Create(sizeArrow.x, sizeArrow.y);
}
static const int comboButtonFlags[ComboState_Max] =
{
0,
wxCONTROL_CURRENT,
wxCONTROL_PRESSED,
wxCONTROL_DISABLED,
};
wxRect rect(wxPoint(0, 0), sizeArrow);
wxMemoryDC dc;
for ( n = ComboState_Normal; n < ComboState_Max; n++ )
{
int flags = comboButtonFlags[n];
dc.SelectObject(m_bitmapsCombo[n]);
DoDrawBackground(dc, GetBackgroundColour(flags), rect);
DrawArrow(dc, wxDOWN, rect, flags);
}
}
void wxGTKRenderer::GetComboBitmaps(wxBitmap *bmpNormal, void wxGTKRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
wxBitmap *bmpFocus,
wxBitmap *bmpPressed, wxBitmap *bmpPressed,
wxBitmap *bmpDisabled) wxBitmap *bmpDisabled)
{ {
// TODO if ( !m_bitmapsCombo[ComboState_Normal].Ok() )
{
InitComboBitmaps();
}
if ( bmpNormal )
*bmpNormal = m_bitmapsCombo[ComboState_Normal];
if ( bmpFocus )
*bmpFocus = m_bitmapsCombo[ComboState_Focus];
if ( bmpPressed )
*bmpPressed = m_bitmapsCombo[ComboState_Pressed];
if ( bmpDisabled )
*bmpDisabled = m_bitmapsCombo[ComboState_Disabled];
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2220,9 +2284,7 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
{ {
// TODO: this is ad hoc... // TODO: this is ad hoc...
size->x += 3*window->GetCharWidth(); size->x += 3*window->GetCharWidth();
if ( size->x < 80 ) wxCoord minBtnHeight = 18;
size->x = 80;
wxCoord minBtnHeight = 22;
if ( size->y < minBtnHeight ) if ( size->y < minBtnHeight )
size->y = minBtnHeight; size->y = minBtnHeight;