1. wxRenderer now has DrawCheckButton
2. wxCheckBox seems to work under MSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
3
TODO
3
TODO
@@ -1,7 +1,6 @@
|
|||||||
All
|
All
|
||||||
|
|
||||||
1. extended listbox interface?
|
* problem with horz scrolling: the focus rect isn't drawn entirely...
|
||||||
2. problem with horz scrolling: the focus rect isn't drawn entirely...
|
|
||||||
|
|
||||||
MSW
|
MSW
|
||||||
|
|
||||||
|
@@ -81,18 +81,6 @@ public:
|
|||||||
virtual void SetValue(bool value);
|
virtual void SetValue(bool value);
|
||||||
virtual bool GetValue() const;
|
virtual bool GetValue() const;
|
||||||
|
|
||||||
// set/get the margins between the checkbox bitmap and the border and
|
|
||||||
// between the bitmap and the label and above it
|
|
||||||
void SetMargins(wxCoord marginLeft, wxCoord marginRight, wxCoord marginTop)
|
|
||||||
{
|
|
||||||
m_checkMarginLeft = marginLeft;
|
|
||||||
m_checkMarginRight = marginRight;
|
|
||||||
m_checkMarginTop = marginTop;
|
|
||||||
}
|
|
||||||
wxCoord GetLeftMargin() const { return m_checkMarginLeft; }
|
|
||||||
wxCoord GetRightMargin() const { return m_checkMarginRight; }
|
|
||||||
wxCoord GetTopMargin() const { return m_checkMarginTop; }
|
|
||||||
|
|
||||||
// set/get the bitmaps to use for the checkbox indicator
|
// set/get the bitmaps to use for the checkbox indicator
|
||||||
void SetBitmap(const wxBitmap& bmp, State state, Status status);
|
void SetBitmap(const wxBitmap& bmp, State state, Status status);
|
||||||
wxBitmap GetBitmap(State state, Status status) const;
|
wxBitmap GetBitmap(State state, Status status) const;
|
||||||
@@ -120,9 +108,6 @@ protected:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// set the margins to the default values if they were not set yet
|
|
||||||
void SetMargins();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the current check status
|
// the current check status
|
||||||
Status m_status;
|
Status m_status;
|
||||||
@@ -130,11 +115,6 @@ private:
|
|||||||
// the bitmaps to use for the different states
|
// the bitmaps to use for the different states
|
||||||
wxBitmap m_bitmaps[State_Max][Status_Max];
|
wxBitmap m_bitmaps[State_Max][Status_Max];
|
||||||
|
|
||||||
// the distance between the checkbox and the label/border (-1 means default)
|
|
||||||
wxCoord m_checkMarginLeft,
|
|
||||||
m_checkMarginRight,
|
|
||||||
m_checkMarginTop;
|
|
||||||
|
|
||||||
// is the checkbox currently pressed?
|
// is the checkbox currently pressed?
|
||||||
bool m_isPressed;
|
bool m_isPressed;
|
||||||
|
|
||||||
|
@@ -104,9 +104,6 @@ public:
|
|||||||
int flags = 0,
|
int flags = 0,
|
||||||
wxRect *rectIn = (wxRect *)NULL) = 0;
|
wxRect *rectIn = (wxRect *)NULL) = 0;
|
||||||
|
|
||||||
// draw a check/radio focus border
|
|
||||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect) = 0;
|
|
||||||
|
|
||||||
// draw push button border and return the rectangle left for the label
|
// draw push button border and return the rectangle left for the label
|
||||||
virtual void DrawButtonBorder(wxDC& dc,
|
virtual void DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
@@ -157,6 +154,15 @@ public:
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0) = 0;
|
int flags = 0) = 0;
|
||||||
|
|
||||||
|
// draw a checkbutton
|
||||||
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0,
|
||||||
|
wxAlignment align = wxALIGN_LEFT,
|
||||||
|
int indexAccel = -1) = 0;
|
||||||
|
|
||||||
// geometry functions
|
// geometry functions
|
||||||
// ------------------
|
// ------------------
|
||||||
|
|
||||||
@@ -197,16 +203,6 @@ public:
|
|||||||
// get the height of a listbox item from the base font height
|
// get the height of a listbox item from the base font height
|
||||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
|
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
|
||||||
|
|
||||||
// get the standard size of the checkbox bitmap and the margins around it
|
|
||||||
virtual wxSize GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const = 0;
|
|
||||||
|
|
||||||
// get the standard size of the radio btn bitmap and the margins around it
|
|
||||||
virtual wxSize GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const = 0;
|
|
||||||
|
|
||||||
// virtual dtor for any base class
|
// virtual dtor for any base class
|
||||||
virtual ~wxRenderer();
|
virtual ~wxRenderer();
|
||||||
|
|
||||||
@@ -292,8 +288,6 @@ public:
|
|||||||
virtual void DrawVerticalLine(wxDC& dc,
|
virtual void DrawVerticalLine(wxDC& dc,
|
||||||
wxCoord x, wxCoord y1, wxCoord y2)
|
wxCoord x, wxCoord y1, wxCoord y2)
|
||||||
{ m_renderer->DrawVerticalLine(dc, x, y1, y2); }
|
{ m_renderer->DrawVerticalLine(dc, x, y1, y2); }
|
||||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect)
|
|
||||||
{ m_renderer->DrawCheckBoxFocusBorder(dc, rect); }
|
|
||||||
virtual void DrawButtonBorder(wxDC& dc,
|
virtual void DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0,
|
int flags = 0,
|
||||||
@@ -322,6 +316,15 @@ public:
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0)
|
int flags = 0)
|
||||||
{ m_renderer->DrawItem(dc, label, rect, flags); }
|
{ m_renderer->DrawItem(dc, label, rect, flags); }
|
||||||
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0,
|
||||||
|
wxAlignment align = wxALIGN_LEFT,
|
||||||
|
int indexAccel = -1)
|
||||||
|
{ m_renderer->DrawCheckButton(dc, label, bitmap, rect,
|
||||||
|
flags, align, indexAccel); }
|
||||||
|
|
||||||
virtual void AdjustSize(wxSize *size, const wxWindow *window)
|
virtual void AdjustSize(wxSize *size, const wxWindow *window)
|
||||||
{ m_renderer->AdjustSize(size, window); }
|
{ m_renderer->AdjustSize(size, window); }
|
||||||
@@ -347,18 +350,6 @@ public:
|
|||||||
{ return m_renderer->PixelToScrollbar(scrollbar, coord); }
|
{ return m_renderer->PixelToScrollbar(scrollbar, coord); }
|
||||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||||
{ return m_renderer->GetListboxItemHeight(fontHeight); }
|
{ return m_renderer->GetListboxItemHeight(fontHeight); }
|
||||||
virtual wxSize GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{ return m_renderer->GetCheckBitmapSize(marginLeft,
|
|
||||||
marginRight,
|
|
||||||
marginTop); }
|
|
||||||
virtual wxSize GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{ return m_renderer->GetRadioBitmapSize(marginLeft,
|
|
||||||
marginRight,
|
|
||||||
marginTop); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRenderer *m_renderer;
|
wxRenderer *m_renderer;
|
||||||
@@ -392,10 +383,6 @@ public:
|
|||||||
wxStretch stretch = wxSTRETCH_NOT);
|
wxStretch stretch = wxSTRETCH_NOT);
|
||||||
void DrawBackgroundBitmap();
|
void DrawBackgroundBitmap();
|
||||||
void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
|
void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
|
||||||
void DrawLabelBox(const wxBitmap& bitmap,
|
|
||||||
wxCoord marginLeft,
|
|
||||||
wxCoord marginRight,
|
|
||||||
wxCoord marginTop);
|
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
wxWindow *GetWindow() const { return m_window; }
|
wxWindow *GetWindow() const { return m_window; }
|
||||||
|
@@ -128,7 +128,7 @@
|
|||||||
#define wxUSE_CLIPBOARD 0
|
#define wxUSE_CLIPBOARD 0
|
||||||
#define wxUSE_SPLINES 0
|
#define wxUSE_SPLINES 0
|
||||||
#define wxUSE_DRAG_AND_DROP 0
|
#define wxUSE_DRAG_AND_DROP 0
|
||||||
#define wxUSE_XPM_IN_MSW 0
|
#define wxUSE_XPM_IN_MSW 1
|
||||||
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
||||||
#define wxUSE_RESOURCE_LOADING_IN_MSW 0
|
#define wxUSE_RESOURCE_LOADING_IN_MSW 0
|
||||||
#define wxUSE_WX_RESOURCES 0
|
#define wxUSE_WX_RESOURCES 0
|
||||||
|
@@ -54,9 +54,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
|
|||||||
|
|
||||||
void wxCheckBox::Init()
|
void wxCheckBox::Init()
|
||||||
{
|
{
|
||||||
m_checkMarginLeft =
|
|
||||||
m_checkMarginRight =
|
|
||||||
m_checkMarginTop = -1;
|
|
||||||
m_isPressed = FALSE;
|
m_isPressed = FALSE;
|
||||||
m_status = Status_Unchecked;
|
m_status = Status_Unchecked;
|
||||||
}
|
}
|
||||||
@@ -131,47 +128,38 @@ void wxCheckBox::DoDraw(wxControlRenderer *renderer)
|
|||||||
else
|
else
|
||||||
state = State_Normal;
|
state = State_Normal;
|
||||||
|
|
||||||
SetMargins();
|
wxDC& dc = renderer->GetDC();
|
||||||
|
dc.SetFont(GetFont());
|
||||||
|
dc.SetTextForeground(GetForegroundColour());
|
||||||
|
|
||||||
renderer->DrawLabelBox(GetBitmap(state, m_status),
|
renderer->GetRenderer()->
|
||||||
m_checkMarginLeft,
|
DrawCheckButton(dc,
|
||||||
m_checkMarginRight,
|
GetLabel(),
|
||||||
m_checkMarginTop);
|
GetBitmap(state, m_status),
|
||||||
|
renderer->GetRect(),
|
||||||
|
flags,
|
||||||
|
GetWindowStyle() & wxALIGN_RIGHT ? wxALIGN_RIGHT
|
||||||
|
: wxALIGN_LEFT,
|
||||||
|
GetAccelIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// geometry calculations
|
// geometry calculations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxCheckBox::SetMargins()
|
|
||||||
{
|
|
||||||
wxCoord *left = m_checkMarginLeft == -1 ? &m_checkMarginLeft : NULL,
|
|
||||||
*right = m_checkMarginRight == -1 ? &m_checkMarginRight : NULL,
|
|
||||||
*top = m_checkMarginTop == -1 ? &m_checkMarginTop : NULL;
|
|
||||||
if ( left || right || top )
|
|
||||||
{
|
|
||||||
GetRenderer()->GetCheckBitmapSize(left, right, top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxCheckBox::DoGetBestClientSize() const
|
wxSize wxCheckBox::DoGetBestClientSize() const
|
||||||
{
|
{
|
||||||
wxCheckBox *self = wxConstCast(this, wxCheckBox);
|
wxClientDC dc(wxConstCast(this, wxCheckBox));
|
||||||
|
dc.SetFont(GetFont());
|
||||||
self->SetMargins();
|
|
||||||
|
|
||||||
wxClientDC dc(self);
|
|
||||||
wxCoord width, height;
|
wxCoord width, height;
|
||||||
dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
|
dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
|
||||||
|
|
||||||
wxBitmap bmp = GetBitmap(State_Normal, Status_Checked);
|
wxBitmap bmp = GetBitmap(State_Normal, Status_Checked);
|
||||||
if ( height < bmp.GetHeight() )
|
if ( height < bmp.GetHeight() )
|
||||||
height = bmp.GetHeight();
|
height = bmp.GetHeight();
|
||||||
height += GetCharHeight();
|
height += GetCharHeight()/2;
|
||||||
|
|
||||||
width += bmp.GetWidth()
|
width += bmp.GetWidth() + 2*GetCharWidth();
|
||||||
+ m_checkMarginLeft + m_checkMarginRight
|
|
||||||
+ GetCharWidth();
|
|
||||||
|
|
||||||
return wxSize(width, height);
|
return wxSize(width, height);
|
||||||
}
|
}
|
||||||
|
@@ -634,54 +634,3 @@ void wxControlRenderer::DrawItems(const wxListBox *lbox,
|
|||||||
rect.y += lineHeight;
|
rect.y += lineHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControlRenderer::DrawLabelBox(const wxBitmap& bitmap,
|
|
||||||
wxCoord marginLeft,
|
|
||||||
wxCoord marginRight,
|
|
||||||
wxCoord marginTop)
|
|
||||||
{
|
|
||||||
m_dc.SetFont(m_window->GetFont());
|
|
||||||
m_dc.SetTextForeground(m_window->GetForegroundColour());
|
|
||||||
|
|
||||||
// draw the focus border around everything
|
|
||||||
int flags = m_window->GetStateFlags();
|
|
||||||
if ( flags & wxCONTROL_FOCUSED )
|
|
||||||
{
|
|
||||||
m_renderer->DrawCheckBoxFocusBorder(m_dc, &m_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate the position of the bitmap and of the label
|
|
||||||
wxCoord xBmp,
|
|
||||||
yBmp = m_rect.y
|
|
||||||
+ (m_rect.height - bitmap.GetHeight() + 1) / 2
|
|
||||||
+ marginTop;
|
|
||||||
|
|
||||||
wxRect rectLabel;
|
|
||||||
wxString label = m_window->GetLabel();
|
|
||||||
m_dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
|
|
||||||
rectLabel.y = m_rect.y + (m_rect.height - rectLabel.height) / 2;
|
|
||||||
|
|
||||||
if ( m_window->GetWindowStyle() & wxALIGN_RIGHT )
|
|
||||||
{
|
|
||||||
xBmp = m_rect.GetRight() - bitmap.GetWidth() - marginLeft;
|
|
||||||
rectLabel.SetLeft(m_rect.GetLeft());
|
|
||||||
rectLabel.SetRight(xBmp - marginRight);
|
|
||||||
}
|
|
||||||
else // normal (checkbox to the left of the text) case
|
|
||||||
{
|
|
||||||
xBmp = m_rect.GetLeft() + marginLeft;
|
|
||||||
rectLabel.SetLeft(xBmp + bitmap.GetWidth() + marginRight);
|
|
||||||
rectLabel.SetRight(m_rect.GetRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
|
|
||||||
|
|
||||||
wxControl *ctrl = wxStaticCast(m_window, wxControl);
|
|
||||||
|
|
||||||
m_renderer->DrawLabel(m_dc,
|
|
||||||
label,
|
|
||||||
rectLabel,
|
|
||||||
flags,
|
|
||||||
wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL,
|
|
||||||
ctrl->GetAccelIndex());
|
|
||||||
}
|
|
||||||
|
@@ -87,7 +87,6 @@ public:
|
|||||||
int flags = 0,
|
int flags = 0,
|
||||||
int alignment = wxALIGN_LEFT,
|
int alignment = wxALIGN_LEFT,
|
||||||
int indexAccel = -1);
|
int indexAccel = -1);
|
||||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect);
|
|
||||||
virtual void DrawButtonBorder(wxDC& dc,
|
virtual void DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0,
|
int flags = 0,
|
||||||
@@ -110,6 +109,13 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0,
|
||||||
|
wxAlignment align = wxALIGN_LEFT,
|
||||||
|
int indexAccel = -1);
|
||||||
|
|
||||||
virtual void AdjustSize(wxSize *size, const wxWindow *window);
|
virtual void AdjustSize(wxSize *size, const wxWindow *window);
|
||||||
virtual wxRect GetBorderDimensions(wxBorder border) const;
|
virtual wxRect GetBorderDimensions(wxBorder border) const;
|
||||||
@@ -128,13 +134,6 @@ public:
|
|||||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||||
{ return fontHeight + 2; }
|
{ return fontHeight + 2; }
|
||||||
|
|
||||||
virtual wxSize GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const;
|
|
||||||
virtual wxSize GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const;
|
|
||||||
|
|
||||||
// helpers for "wxBitmap wxColourScheme::Get()"
|
// helpers for "wxBitmap wxColourScheme::Get()"
|
||||||
void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
|
void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
|
||||||
void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
|
void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
|
||||||
@@ -758,11 +757,6 @@ bool wxGTKRenderer::AreScrollbarsInsideBorder() const
|
|||||||
// borders
|
// borders
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxGTKRenderer::DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect)
|
|
||||||
{
|
|
||||||
DrawRect(dc, rect, m_penBlack);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
|
void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rectTotal,
|
const wxRect& rectTotal,
|
||||||
int flags,
|
int flags,
|
||||||
@@ -958,6 +952,53 @@ void wxGTKRenderer::DrawItem(wxDC& dc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// check/radion buttons
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxGTKRenderer::DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rectTotal,
|
||||||
|
int flags,
|
||||||
|
wxAlignment align,
|
||||||
|
int indexAccel)
|
||||||
|
{
|
||||||
|
wxRect rect = rectTotal;
|
||||||
|
|
||||||
|
if ( flags & wxCONTROL_FOCUSED )
|
||||||
|
{
|
||||||
|
// draw the focus border around everything
|
||||||
|
DrawRect(dc, &rect, m_penBlack);
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate the position of the bitmap and of the label
|
||||||
|
wxCoord xBmp,
|
||||||
|
yBmp = rect.y + (rect.height - bitmap.GetHeight()) / 2;
|
||||||
|
|
||||||
|
wxRect rectLabel;
|
||||||
|
dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
|
||||||
|
rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;
|
||||||
|
|
||||||
|
if ( align == wxALIGN_RIGHT )
|
||||||
|
{
|
||||||
|
xBmp = rect.GetRight() - bitmap.GetWidth();
|
||||||
|
rectLabel.x = rect.x + 2;
|
||||||
|
rectLabel.SetRight(xBmp);
|
||||||
|
}
|
||||||
|
else // normal (checkbox to the left of the text) case
|
||||||
|
{
|
||||||
|
xBmp = rect.x + 2;
|
||||||
|
rectLabel.x = xBmp + bitmap.GetWidth() + 4;
|
||||||
|
rectLabel.SetRight(rect.GetRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
|
||||||
|
|
||||||
|
DrawLabel(dc, label, rectLabel, flags,
|
||||||
|
wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// background
|
// background
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1348,38 +1389,6 @@ int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar,
|
|||||||
GetScrollbarArrowSize(scrollbar));
|
GetScrollbarArrowSize(scrollbar));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// check/radio bitmaps geometry
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxSize wxGTKRenderer::GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{
|
|
||||||
if ( marginLeft )
|
|
||||||
*marginLeft = 2;
|
|
||||||
if ( marginRight )
|
|
||||||
*marginRight = 5;
|
|
||||||
if ( marginTop )
|
|
||||||
*marginTop = 1;
|
|
||||||
|
|
||||||
return wxSize(10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxGTKRenderer::GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{
|
|
||||||
if ( marginLeft )
|
|
||||||
*marginLeft = 1;
|
|
||||||
if ( marginRight )
|
|
||||||
*marginRight = 4;
|
|
||||||
if ( marginTop )
|
|
||||||
*marginTop = 1;
|
|
||||||
|
|
||||||
return wxSize(11, 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// size adjustments
|
// size adjustments
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -104,7 +104,6 @@ public:
|
|||||||
int flags = 0,
|
int flags = 0,
|
||||||
int alignment = wxALIGN_LEFT,
|
int alignment = wxALIGN_LEFT,
|
||||||
int indexAccel = -1);
|
int indexAccel = -1);
|
||||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect);
|
|
||||||
virtual void DrawButtonBorder(wxDC& dc,
|
virtual void DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0,
|
int flags = 0,
|
||||||
@@ -127,6 +126,13 @@ public:
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
virtual void DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0,
|
||||||
|
wxAlignment align = wxALIGN_LEFT,
|
||||||
|
int indexAccel = -1);
|
||||||
|
|
||||||
virtual void AdjustSize(wxSize *size, const wxWindow *window);
|
virtual void AdjustSize(wxSize *size, const wxWindow *window);
|
||||||
virtual wxRect GetBorderDimensions(wxBorder border) const;
|
virtual wxRect GetBorderDimensions(wxBorder border) const;
|
||||||
@@ -144,13 +150,6 @@ public:
|
|||||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||||
{ return fontHeight; }
|
{ return fontHeight; }
|
||||||
|
|
||||||
virtual wxSize GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const;
|
|
||||||
virtual wxSize GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of DrawLabel() and DrawItem()
|
// common part of DrawLabel() and DrawItem()
|
||||||
void DrawFocusRect(wxDC& dc, const wxRect& rect);
|
void DrawFocusRect(wxDC& dc, const wxRect& rect);
|
||||||
@@ -472,12 +471,118 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
|
|||||||
|
|
||||||
#if wxUSE_CHECKBOX
|
#if wxUSE_CHECKBOX
|
||||||
|
|
||||||
|
static char *checked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 5 1",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwbwgh",
|
||||||
|
"dbwwwwwwbbwgh",
|
||||||
|
"dbwbwwwbbbwgh",
|
||||||
|
"dbwbbwbbbwwgh",
|
||||||
|
"dbwbbbbbwwwgh",
|
||||||
|
"dbwwbbbwwwwgh",
|
||||||
|
"dbwwwbwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_checked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 4 1",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbgggggggbggh",
|
||||||
|
"dbggggggbbggh",
|
||||||
|
"dbgbgggbbbggh",
|
||||||
|
"dbgbbgbbbgggh",
|
||||||
|
"dbgbbbbbggggh",
|
||||||
|
"dbggbbbgggggh",
|
||||||
|
"dbgggbggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *unchecked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 5 1",
|
||||||
|
"w c white",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dbwwwwwwwwwgh",
|
||||||
|
"dgggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *pressed_unchecked_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"13 13 4 1",
|
||||||
|
"b c black",
|
||||||
|
"d c #7f7f7f",
|
||||||
|
"g c #c0c0c0",
|
||||||
|
"h c #e0e0e0",
|
||||||
|
/* pixels */
|
||||||
|
"ddddddddddddh",
|
||||||
|
"dbbbbbbbbbbgh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"dbggggggggggh",
|
||||||
|
"hhhhhhhhhhhhh"
|
||||||
|
};
|
||||||
|
|
||||||
wxBitmap wxWin32ColourScheme::Get(wxCheckBox::State state,
|
wxBitmap wxWin32ColourScheme::Get(wxCheckBox::State state,
|
||||||
wxCheckBox::Status status)
|
wxCheckBox::Status status)
|
||||||
{
|
{
|
||||||
return wxBitmap(status == wxCheckBox::Status_Checked ? _T("check.bmp")
|
char **xpm;
|
||||||
: _T("uncheck.bmp"),
|
if ( status == wxCheckBox::Status_Checked )
|
||||||
wxBITMAP_TYPE_BMP);
|
{
|
||||||
|
xpm = state == wxCheckBox::State_Pressed ? pressed_checked_xpm
|
||||||
|
: checked_xpm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xpm = state == wxCheckBox::State_Pressed ? pressed_unchecked_xpm
|
||||||
|
: unchecked_xpm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxBitmap(xpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CHECKBOX
|
#endif // wxUSE_CHECKBOX
|
||||||
@@ -883,11 +988,6 @@ bool wxWin32Renderer::AreScrollbarsInsideBorder() const
|
|||||||
// borders
|
// borders
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxWin32Renderer::DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect)
|
|
||||||
{
|
|
||||||
// we don't have it
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWin32Renderer::DrawButtonBorder(wxDC& dc,
|
void wxWin32Renderer::DrawButtonBorder(wxDC& dc,
|
||||||
const wxRect& rectTotal,
|
const wxRect& rectTotal,
|
||||||
int flags,
|
int flags,
|
||||||
@@ -1073,6 +1173,7 @@ void wxWin32Renderer::DrawLabel(wxDC& dc,
|
|||||||
|
|
||||||
if ( flags & wxCONTROL_FOCUSED )
|
if ( flags & wxCONTROL_FOCUSED )
|
||||||
{
|
{
|
||||||
|
rectLabel.Inflate(1);
|
||||||
DrawFocusRect(dc, rectLabel);
|
DrawFocusRect(dc, rectLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1160,6 +1261,45 @@ void wxWin32Renderer::DrawItem(wxDC& dc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// check/radio buttons
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxWin32Renderer::DrawCheckButton(wxDC& dc,
|
||||||
|
const wxString& label,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags,
|
||||||
|
wxAlignment align,
|
||||||
|
int indexAccel)
|
||||||
|
{
|
||||||
|
// calculate the position of the bitmap and of the label
|
||||||
|
wxCoord xBmp,
|
||||||
|
yBmp = rect.y + (rect.height - bitmap.GetHeight()) / 2;
|
||||||
|
|
||||||
|
wxRect rectLabel;
|
||||||
|
dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
|
||||||
|
rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2 - 1;
|
||||||
|
|
||||||
|
if ( align == wxALIGN_RIGHT )
|
||||||
|
{
|
||||||
|
xBmp = rect.GetRight() - bitmap.GetWidth();
|
||||||
|
rectLabel.x = rect.x + 3;
|
||||||
|
rectLabel.SetRight(xBmp);
|
||||||
|
}
|
||||||
|
else // normal (checkbox to the left of the text) case
|
||||||
|
{
|
||||||
|
xBmp = rect.x;
|
||||||
|
rectLabel.x = xBmp + bitmap.GetWidth() + 5;
|
||||||
|
rectLabel.SetRight(rect.GetRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
|
||||||
|
|
||||||
|
DrawLabel(dc, label, rectLabel, flags,
|
||||||
|
wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// background
|
// background
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1310,34 +1450,6 @@ int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar,
|
|||||||
return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
|
return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// check/radio bitmaps geometry
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxSize wxWin32Renderer::GetCheckBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{
|
|
||||||
if ( marginLeft )
|
|
||||||
*marginLeft = 2;
|
|
||||||
if ( marginRight )
|
|
||||||
*marginRight = 5;
|
|
||||||
|
|
||||||
return wxSize(10, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxWin32Renderer::GetRadioBitmapSize(wxCoord *marginLeft,
|
|
||||||
wxCoord *marginRight,
|
|
||||||
wxCoord *marginTop) const
|
|
||||||
{
|
|
||||||
if ( marginLeft )
|
|
||||||
*marginLeft = 1;
|
|
||||||
if ( marginRight )
|
|
||||||
*marginRight = 4;
|
|
||||||
|
|
||||||
return wxSize(11, 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// size adjustments
|
// size adjustments
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user