wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
- wxCONTROL_CHECKABLE = 0x00000080 // (menu) item can be checked
+ wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
+ wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE // (check) undetermined state
};
\end{verbatim}
Virtual destructor as for any base class.
+\membersection{wxRendererNative::DrawCheckButton}\label{wxrenderernativedrawcheckbutton}
+
+\func{void}{DrawCheckButton}{\param{wxWindow *}{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags}}
+
+Draw a check box (used by wxDataViewCtrl).
+
+\arg{flags} may have the \texttt{wxCONTROL\_CHECKED}, \texttt{wxCONTROL\_CURRENT} or
+\texttt{wxCONTROL\_UNDETERMINED} bit set.
+
+
\membersection{wxRendererNative::DrawComboBoxDropButton}\label{wxrenderernativedrawcomboboxdropbutton}
\func{void}{DrawComboBoxDropButton}{\param{wxWindow *}{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags}}
Draw the header control button (used by \helpref{wxListCtrl}{wxlistctrl}).
+\membersection{wxRendererNative::DrawPushButton}\label{wxrenderernativedrawpushbutton}
+
+\func{void}{DrawPushButton}{\param{wxWindow *}{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags}}
+
+Draw a blank push button that looks very similar to \helpref{wxButton}{wxbutton}.
+
+\arg{flags} may have the \texttt{wxCONTROL\_PRESSED}, \texttt{wxCONTROL\_CURRENT} or
+\texttt{wxCONTROL\_ISDEFAULT} bit set.
+
+
\membersection{wxRendererNative::DrawSplitterBorder}\label{wxrenderernativedrawsplitterborder}
\func{void}{DrawSplitterBorder}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
const wxRect& rect,
int flags = 0) = 0;
-
// draw check button
//
// flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT
wxDC& dc,
const wxRect& rect,
int flags = 0) = 0;
-
+
+ // draw blank button
+ //
+ // flags may use wxCONTROL_PRESSED, wxCONTROL_CURRENT and wxCONTROL_ISDEFAULT
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0) = 0;
+
// geometry functions
// ------------------
const wxRect& rect,
int flags = 0 )
{ m_rendererNative.DrawCheckButton( win, dc, rect, flags ); }
-
+
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0 )
+ { m_rendererNative.DrawPushButton( win, dc, rect, flags ); }
+
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
{ return m_rendererNative.GetSplitterParams(win); }
wxDC& dc,
const wxRect& rect,
int flags = 0);
-
+
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0);
+
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
virtual wxRendererVersion GetVersion() const
wxRendererGeneric::DrawComboBoxDropButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
- int WXUNUSED(flags))
+ int flags)
{
- // Creating a generic button background that would actually be
- // useful is rather difficult to accomplish. Best compromise
- // is to use window's background colour to achieve transparent'
- // ish appearance that should look decent in combo box style
- // controls.
- wxColour col = win->GetBackgroundColour();
- dc.SetBrush(wxBrush(col));
- dc.SetPen(wxPen(col));
- dc.DrawRectangle(rect);
- DrawDropArrow(win,dc,rect);
+ DrawPushButton(win,dc,rect,flags);
+ DrawDropArrow(win,dc,rect,flags);
}
-
void
wxRendererGeneric::DrawDropArrow(wxWindow *win,
wxDC& dc,
}
}
+void
+wxRendererGeneric::DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ // Don't try anything too fancy. It'll just turn out looking
+ // out-of-place on most platforms.
+ wxColour bgCol = flags & wxCONTROL_DISABLED ?
+ wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) :
+ win->GetBackgroundColour();
+ dc.SetBrush(wxBrush(bgCol));
+ dc.SetPen(wxPen(bgCol));
+ dc.DrawRectangle(rect);
+}
+
// ----------------------------------------------------------------------------
// A module to allow cleanup of generic renderer.
// ----------------------------------------------------------------------------
wxDC& dc,
const wxRect& rect,
int flags = 0);
-
+
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0);
+
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
private:
// FIXME: shouldn't we destroy these windows somewhere?
- // used by DrawHeaderButton and DrawComboBoxDropButton
+ // used by DrawHeaderButton and DrawPushButton
static GtkWidget *GetButtonWidget();
// used by DrawTreeItemButton()
(
button->style,
// FIXME: I suppose GTK_PIZZA(win->m_wxwindow)->bin_window doesn't work with wxMemoryDC.
- // Maybe use code similar as in DrawComboBoxDropButton below?
+ // Maybe use code similar as in DrawPushButton below?
GTK_PIZZA(win->m_wxwindow)->bin_window,
flags & wxCONTROL_DISABLED ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
const wxRect& rect,
int flags)
{
- GtkWidget *button = GetButtonWidget();
+ DrawPushButton(win,dc,rect,flags);
+ DrawDropArrow(win,dc,rect);
+}
+
+void
+wxRendererGTK::DrawCheckButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags )
+{
+ GtkWidget *button = GetCheckButtonWidget();
// for reason why we do this, see DrawDropArrow
wxWindowDC& wdc = (wxWindowDC&)dc;
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
-
- // draw button
+
GtkStateType state;
if ( flags & wxCONTROL_PRESSED )
state = GTK_STATE_PRELIGHT;
else
state = GTK_STATE_NORMAL;
-
- gtk_paint_box
+
+ gtk_paint_check
(
button->style,
wdc.m_window,
state,
- flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+ flags & wxCONTROL_CHECKED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
NULL,
button,
- "button",
- rect.x, rect.y, rect.width, rect.height
+ "cellcheck",
+ rect.x, rect.y, 13, 13
);
-
- // draw arrow on button
- DrawDropArrow(win,dc,rect,flags);
-
}
-void
-wxRendererGTK::DrawCheckButton(wxWindow *win,
- wxDC& dc,
- const wxRect& rect,
- int flags )
+void
+wxRendererGTK::DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
{
- GtkWidget *button = GetCheckButtonWidget();
+ GtkWidget *button = GetButtonWidget();
// for reason why we do this, see DrawDropArrow
wxWindowDC& wdc = (wxWindowDC&)dc;
wxASSERT ( wdc.IsKindOf(CLASSINFO(wxWindowDC)) );
-
+
+ // draw button
GtkStateType state;
if ( flags & wxCONTROL_PRESSED )
state = GTK_STATE_PRELIGHT;
else
state = GTK_STATE_NORMAL;
-
- gtk_paint_check
+
+ gtk_paint_box
(
button->style,
wdc.m_window,
state,
- flags & wxCONTROL_CHECKED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+ flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
NULL,
button,
- "cellcheck",
- rect.x, rect.y, 13, 13
+ "button",
+ rect.x, rect.y, rect.width, rect.height
);
}
// tmschema.h is in Win32 Platform SDK and might not be available with earlier
// compilers
#ifndef CP_DROPDOWNBUTTON
+ #define BP_PUSHBUTTON 1
#define BP_CHECKBOX 3
#define CBS_UNCHECKEDNORMAL 1
#define CBS_CHECKEDNORMAL (CBS_UNCHECKEDNORMAL + 4)
#define CBS_MIXEDNORMAL (CBS_CHECKEDNORMAL + 4)
+ #define PBS_NORMAL 1
+ #define PBS_HOT 2
+ #define PBS_PRESSED 3
+ #define PBS_DISABLED 4
+ #define PBS_DEFAULTED 5
+
#define CP_DROPDOWNBUTTON 1
#define CBXS_NORMAL 1
const wxRect& rect,
int flags = 0);
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0);
+
private:
DECLARE_NO_COPY_CLASS(wxRendererMSW)
};
const wxRect& rect,
int flags = 0);
+ virtual void DrawPushButton(wxWindow *win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags = 0);
+
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
private:
DECLARE_NO_COPY_CLASS(wxRendererXP)
::DrawFrameControl(GetHdcOf(dc), &r, DFC_SCROLL, style);
}
+void
+wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ RECT r;
+ r.left = rect.GetLeft();
+ r.top = rect.GetTop();
+ r.bottom = rect.y + rect.height;
+ r.right = rect.x + rect.width;
+
+ int style = DFCS_BUTTONPUSH;
+ if ( flags & wxCONTROL_DISABLED )
+ style |= DFCS_INACTIVE;
+ if ( flags & wxCONTROL_PRESSED )
+ style |= DFCS_PUSHED | DFCS_FLAT;
+
+ ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style);
+}
+
// ============================================================================
// wxRendererXP implementation
// ============================================================================
);
}
+void
+wxRendererXP::DrawPushButton(wxWindow * win,
+ wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ wxUxThemeHandle hTheme(win, L"BUTTON");
+ if ( !hTheme )
+ {
+ m_rendererNative.DrawPushButton(win, dc, rect, flags);
+ return;
+ }
+
+ RECT r;
+ wxCopyRectToRECT(rect, r);
+
+ int state;
+ if ( flags & wxCONTROL_PRESSED )
+ state = PBS_PRESSED;
+ else if ( flags & wxCONTROL_CURRENT )
+ state = PBS_HOT;
+ else if ( flags & wxCONTROL_DISABLED )
+ state = PBS_DISABLED;
+ else if ( flags & wxCONTROL_ISDEFAULT )
+ state = PBS_DEFAULTED;
+ else
+ state = PBS_NORMAL;
+
+ wxUxThemeEngine::Get()->DrawThemeBackground
+ (
+ hTheme,
+ GetHdcOf(dc),
+ BP_PUSHBUTTON,
+ state,
+ &r,
+ NULL
+ );
+
+}
+
// ----------------------------------------------------------------------------
// splitter drawing
// ----------------------------------------------------------------------------