case wxWidgets provides a default, generic, implementation of them written in
wxWidgets itself.
-These controls don't have the native appearance if only the standard
+These controls don't have the native appearance if only the tandard
line drawing and other graphics primitives are used, because the native
appearance is different under different platforms while the lines are always
drawn in the same way.
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE // (check) undetermined state
- wxCONTROL_UPICON = 0x00000100, // header button has an up arrow icon
- wxCONTROL_DOWNICON = 0x00000200, // header button has a down arrow icon
-
};
\end{verbatim}
\membersection{wxRendererNative::DrawHeaderButton}\label{wxrenderernativedrawheaderbutton}
-\func{void}{DrawHeaderButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}, \param{wxHeaderButtonParams* }{params = NULL}}
+\func{void}{DrawHeaderButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}, \param{wxHeaderSortIconType }{sortArrow = wxHDR\_SORT\_ICON\_NONE}, \param{wxHeaderButtonParams* }{params = NULL}}
-Draw the header control button (used by \helpref{wxListCtrl}{wxlistctrl}).
+Draw the header control button (used, for example, by
+\helpref{wxListCtrl}{wxlistctrl}). Depending on platforms the
+\arg{flags} parameter may support the \texttt{wxCONTROL\_SELECTED}
+\texttt{wxCONTROL\_DISABLED} and \texttt{wxCONTROL\_CURRENT} bits.
+The \arg{sortArrow} parameter can be one of
+\texttt{wxHDR\_SORT\_ICON\_NONE}, \texttt{wxHDR\_SORT\_ICON\_UP}, or
+\texttt{wxHDR\_SORT\_ICON\_DOWN}. Additional values controlling the
+drawing of a text or bitmap label can be passed in \arg{params}.
\membersection{wxRendererNative::DrawPushButton}\label{wxrenderernativedrawpushbutton}
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state
- wxCONTROL_UPICON = 0x00000100, // header button has an up arrow icon
- wxCONTROL_DOWNICON = 0x00000200, // header button has a down arrow icon
- wxCONTROL_FLAGS_MASK = 0x000002ff,
+ wxCONTROL_FLAGS_MASK = 0x000000ff,
// this is a pseudo flag not used directly by wxRenderer but rather by some
// controls internally
int m_labelAlignment;
};
+enum wxHeaderSortIconType {
+ wxHDR_SORT_ICON_NONE, // Header button has no sort arrow
+ wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon
+ wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon
+};
+
// wxRendererNative interface version
struct WXDLLEXPORT wxRendererVersion
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL) = 0;
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL) = 0;
// Returns the default height of a header button, either a fixed platform
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL)
- { m_rendererNative.DrawHeaderButton(win, dc, rect, flags, params); }
-
+ { m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); }
virtual void DrawHeaderButtonContents(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL)
- { m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, params); }
-
+ { m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); }
virtual int GetHeaderButtonHeight(wxWindow *win)
{ return m_rendererNative.GetHeaderButtonHeight(win); }
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL)
- { m_renderer->DrawHeaderButton(win, dc, rect, flags, params); }
+ { m_renderer->DrawHeaderButton(win, dc, rect, flags, sortArrow, params); }
virtual void DrawTreeItemButton(wxWindow *win,
wxDC& dc,
const wxRect& rect,
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHBSortIconType sortArrow = wxHB_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL);
virtual void DrawHeaderButtonContents(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHBSortIconType sortArrow = wxHB_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL);
virtual int GetHeaderButtonHeight(wxWindow *win);
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params)
{
const int CORNER = 1;
dc.DrawLine( x, y+h-1, x+1, y+h-1 );
dc.DrawLine( x+w-1, y, x+w-1, y+1 );
- DrawHeaderButtonContents(win, dc, rect, flags, params);
+ DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
}
+
void
wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params)
{
// Mark this item as selected. For the generic version we'll just draw an
// Draw an up or down arrow
int arrowSpace = 0;
- if (flags & (wxCONTROL_UPICON | wxCONTROL_DOWNICON) )
+ if (sortArrow != wxHDR_SORT_ICON_NONE )
{
wxRect ar = rect;
arrowSpace = 3*ar.width/2; // space to preserve when drawing the label
wxPoint triPt[3];
- if ( flags & wxCONTROL_UPICON )
+ if ( sortArrow & wxHDR_SORT_ICON_UP )
{
triPt[0].x = ar.width / 2;
triPt[0].y = 0;
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL);
// draw the expanded/collapsed icon for a tree control item
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params)
{
dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height
);
- DrawHeaderButtonContents(win, dc, rect, flags, params);
+ DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
}
// draw a ">" or "v" button
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL );
virtual int GetHeaderButtonHeight(wxWindow *win);
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params )
{
const wxCoord x = dc.XLOG2DEV(rect.x /*- 1*/);
drawInfo.adornment = kThemeAdornmentNone;
// The down arrow is drawn automatically, change it to an up arrow if needed.
- if ( flags & wxCONTROL_UPICON )
+ if ( sortArrow == wxHDR_SORT_ICON_UP )
drawInfo.adornment = kThemeAdornmentHeaderButtonSortUp;
HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
// If we don't want any arrows we need to draw over the one already there
- if ( (flags & wxCONTROL_SELECTED) && !(flags & (wxCONTROL_UPICON|wxCONTROL_DOWNICON)) )
+ if ( (flags & wxCONTROL_SELECTED) && (sortArrow == wxHDR_SORT_ICON_NONE) )
{
// clip to the header rectangle
CGContextSaveGState( cgContext );
// Reserve room for the arrows before writing the label, and turn off the
// flags we've already handled
wxRect newRect(rect);
- if ( (flags & wxCONTROL_SELECTED) && (flags & (wxCONTROL_UPICON|wxCONTROL_DOWNICON)) )
+ if ( (flags & wxCONTROL_SELECTED) && (sortArrow != wxHDR_SORT_ICON_NONE) )
{
newRect.width -= 12;
+ sortArrow = wxHDR_SORT_ICON_NONE;
}
- flags &= ~(wxCONTROL_SELECTED | wxCONTROL_UPICON | wxCONTROL_DOWNICON);
+ flags &= ~wxCONTROL_SELECTED;
- DrawHeaderButtonContents(win, dc, newRect, flags, params);
+ DrawHeaderButtonContents(win, dc, newRect, flags, sortArrow, params);
}
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params = NULL);
virtual int GetHeaderButtonHeight(wxWindow *win);
wxDC& dc,
const wxRect& rect,
int flags,
+ wxHeaderSortIconType sortArrow,
wxHeaderButtonParams* params)
{
wxUxThemeHandle hTheme(win, L"HEADER");
if ( !hTheme )
{
- m_rendererNative.DrawHeaderButton(win, dc, rect, flags, params);
+ m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params);
return;
}
// and then clear those flags before calling DrawHeaderButtonContents.
// Add any extras that are specified in flags and params
- DrawHeaderButtonContents(win, dc, rect, flags, params);
+ DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
}
if ((image != -1) && imageList)
params.m_labelBitmap = imageList->GetBitmap(image);
- wxRendererNative::Get().DrawHeaderButton(this, dc, rect, flags, ¶ms);
+ wxRendererNative::Get().DrawHeaderButton(this, dc, rect, flags,
+ wxHDR_SORT_ICON_NONE, ¶ms);
}
if (x < w) {
wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked
wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state
- wxCONTROL_UPICON = 0x00000100, // header button has an up arrow icon
- wxCONTROL_DOWNICON = 0x00000200, // header button has a down arrow icon
- wxCONTROL_FLAGS_MASK = 0x000002ff,
+ wxCONTROL_FLAGS_MASK = 0x000000ff,
// this is a pseudo flag not used directly by wxRenderer but rather by some
// controls internally
int m_labelAlignment;
};
+enum wxHeaderSortIconType {
+ wxHDR_SORT_ICON_NONE, // Header button has no sort arrow
+ wxHDR_SORT_ICON_UP, // Header button an an up sort arrow icon
+ wxHDR_SORT_ICON_DOWN // Header button an a down sort arrow icon
+};
DocStr(wxRendererVersion,
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL),
"Draw the header control button (such as what is used by `wx.ListCtrl`
in report mode.)", "");
wxDC& dc,
const wxRect& rect,
int flags = 0,
+ wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
wxHeaderButtonParams* params=NULL),
"Draw the contents of a header control button, (label, sort
arrows, etc.) Normally this is only called by `DrawHeaderButton`.", "");