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
|
||||
|
||||
1. extended listbox interface?
|
||||
2. problem with horz scrolling: the focus rect isn't drawn entirely...
|
||||
* problem with horz scrolling: the focus rect isn't drawn entirely...
|
||||
|
||||
MSW
|
||||
|
||||
|
@@ -81,18 +81,6 @@ public:
|
||||
virtual void SetValue(bool value);
|
||||
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
|
||||
void SetBitmap(const wxBitmap& bmp, State state, Status status);
|
||||
wxBitmap GetBitmap(State state, Status status) const;
|
||||
@@ -120,9 +108,6 @@ protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// set the margins to the default values if they were not set yet
|
||||
void SetMargins();
|
||||
|
||||
private:
|
||||
// the current check status
|
||||
Status m_status;
|
||||
@@ -130,11 +115,6 @@ private:
|
||||
// the bitmaps to use for the different states
|
||||
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?
|
||||
bool m_isPressed;
|
||||
|
||||
|
@@ -104,9 +104,6 @@ public:
|
||||
int flags = 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
|
||||
virtual void DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
@@ -157,6 +154,15 @@ public:
|
||||
const wxRect& rect,
|
||||
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
|
||||
// ------------------
|
||||
|
||||
@@ -197,16 +203,6 @@ public:
|
||||
// get the height of a listbox item from the base font height
|
||||
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 ~wxRenderer();
|
||||
|
||||
@@ -292,8 +288,6 @@ public:
|
||||
virtual void DrawVerticalLine(wxDC& dc,
|
||||
wxCoord x, wxCoord y1, wxCoord 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,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
@@ -322,6 +316,15 @@ public:
|
||||
const wxRect& rect,
|
||||
int flags = 0)
|
||||
{ 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)
|
||||
{ m_renderer->AdjustSize(size, window); }
|
||||
@@ -347,18 +350,6 @@ public:
|
||||
{ return m_renderer->PixelToScrollbar(scrollbar, coord); }
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord 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:
|
||||
wxRenderer *m_renderer;
|
||||
@@ -392,10 +383,6 @@ public:
|
||||
wxStretch stretch = wxSTRETCH_NOT);
|
||||
void DrawBackgroundBitmap();
|
||||
void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
|
||||
void DrawLabelBox(const wxBitmap& bitmap,
|
||||
wxCoord marginLeft,
|
||||
wxCoord marginRight,
|
||||
wxCoord marginTop);
|
||||
|
||||
// accessors
|
||||
wxWindow *GetWindow() const { return m_window; }
|
||||
|
@@ -128,7 +128,7 @@
|
||||
#define wxUSE_CLIPBOARD 0
|
||||
#define wxUSE_SPLINES 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_RESOURCE_LOADING_IN_MSW 0
|
||||
#define wxUSE_WX_RESOURCES 0
|
||||
|
@@ -54,9 +54,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
|
||||
|
||||
void wxCheckBox::Init()
|
||||
{
|
||||
m_checkMarginLeft =
|
||||
m_checkMarginRight =
|
||||
m_checkMarginTop = -1;
|
||||
m_isPressed = FALSE;
|
||||
m_status = Status_Unchecked;
|
||||
}
|
||||
@@ -131,47 +128,38 @@ void wxCheckBox::DoDraw(wxControlRenderer *renderer)
|
||||
else
|
||||
state = State_Normal;
|
||||
|
||||
SetMargins();
|
||||
wxDC& dc = renderer->GetDC();
|
||||
dc.SetFont(GetFont());
|
||||
dc.SetTextForeground(GetForegroundColour());
|
||||
|
||||
renderer->DrawLabelBox(GetBitmap(state, m_status),
|
||||
m_checkMarginLeft,
|
||||
m_checkMarginRight,
|
||||
m_checkMarginTop);
|
||||
renderer->GetRenderer()->
|
||||
DrawCheckButton(dc,
|
||||
GetLabel(),
|
||||
GetBitmap(state, m_status),
|
||||
renderer->GetRect(),
|
||||
flags,
|
||||
GetWindowStyle() & wxALIGN_RIGHT ? wxALIGN_RIGHT
|
||||
: wxALIGN_LEFT,
|
||||
GetAccelIndex());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
wxCheckBox *self = wxConstCast(this, wxCheckBox);
|
||||
|
||||
self->SetMargins();
|
||||
|
||||
wxClientDC dc(self);
|
||||
wxClientDC dc(wxConstCast(this, wxCheckBox));
|
||||
dc.SetFont(GetFont());
|
||||
wxCoord width, height;
|
||||
dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
|
||||
|
||||
wxBitmap bmp = GetBitmap(State_Normal, Status_Checked);
|
||||
if ( height < bmp.GetHeight() )
|
||||
height = bmp.GetHeight();
|
||||
height += GetCharHeight();
|
||||
height += GetCharHeight()/2;
|
||||
|
||||
width += bmp.GetWidth()
|
||||
+ m_checkMarginLeft + m_checkMarginRight
|
||||
+ GetCharWidth();
|
||||
width += bmp.GetWidth() + 2*GetCharWidth();
|
||||
|
||||
return wxSize(width, height);
|
||||
}
|
||||
|
@@ -634,54 +634,3 @@ void wxControlRenderer::DrawItems(const wxListBox *lbox,
|
||||
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 alignment = wxALIGN_LEFT,
|
||||
int indexAccel = -1);
|
||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
@@ -110,6 +109,13 @@ public:
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
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 wxRect GetBorderDimensions(wxBorder border) const;
|
||||
@@ -128,13 +134,6 @@ public:
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||
{ 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()"
|
||||
void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
|
||||
void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
|
||||
@@ -758,11 +757,6 @@ bool wxGTKRenderer::AreScrollbarsInsideBorder() const
|
||||
// borders
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxGTKRenderer::DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect)
|
||||
{
|
||||
DrawRect(dc, rect, m_penBlack);
|
||||
}
|
||||
|
||||
void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rectTotal,
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1348,38 +1389,6 @@ int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -104,7 +104,6 @@ public:
|
||||
int flags = 0,
|
||||
int alignment = wxALIGN_LEFT,
|
||||
int indexAccel = -1);
|
||||
virtual void DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect);
|
||||
virtual void DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int flags = 0,
|
||||
@@ -127,6 +126,13 @@ public:
|
||||
const wxString& label,
|
||||
const wxRect& rect,
|
||||
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 wxRect GetBorderDimensions(wxBorder border) const;
|
||||
@@ -144,13 +150,6 @@ public:
|
||||
virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
|
||||
{ return fontHeight; }
|
||||
|
||||
virtual wxSize GetCheckBitmapSize(wxCoord *marginLeft,
|
||||
wxCoord *marginRight,
|
||||
wxCoord *marginTop) const;
|
||||
virtual wxSize GetRadioBitmapSize(wxCoord *marginLeft,
|
||||
wxCoord *marginRight,
|
||||
wxCoord *marginTop) const;
|
||||
|
||||
protected:
|
||||
// common part of DrawLabel() and DrawItem()
|
||||
void DrawFocusRect(wxDC& dc, const wxRect& rect);
|
||||
@@ -472,12 +471,118 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
|
||||
|
||||
#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,
|
||||
wxCheckBox::Status status)
|
||||
{
|
||||
return wxBitmap(status == wxCheckBox::Status_Checked ? _T("check.bmp")
|
||||
: _T("uncheck.bmp"),
|
||||
wxBITMAP_TYPE_BMP);
|
||||
char **xpm;
|
||||
if ( status == wxCheckBox::Status_Checked )
|
||||
{
|
||||
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
|
||||
@@ -883,11 +988,6 @@ bool wxWin32Renderer::AreScrollbarsInsideBorder() const
|
||||
// borders
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxWin32Renderer::DrawCheckBoxFocusBorder(wxDC& dc, wxRect *rect)
|
||||
{
|
||||
// we don't have it
|
||||
}
|
||||
|
||||
void wxWin32Renderer::DrawButtonBorder(wxDC& dc,
|
||||
const wxRect& rectTotal,
|
||||
int flags,
|
||||
@@ -1073,6 +1173,7 @@ void wxWin32Renderer::DrawLabel(wxDC& dc,
|
||||
|
||||
if ( flags & wxCONTROL_FOCUSED )
|
||||
{
|
||||
rectLabel.Inflate(1);
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1310,34 +1450,6 @@ int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar,
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user