rect->Inflate(-1);
}
+// ----------------------------------------------------------------------------
+// translate various flags into corresponding renderer constants
+// ----------------------------------------------------------------------------
+
+/* static */
+void wxStdRenderer::GetIndicatorsFromFlags(int flags,
+ IndicatorState& state,
+ IndicatorStatus& status)
+{
+ if ( flags & wxCONTROL_SELECTED )
+ state = flags & wxCONTROL_DISABLED ? IndicatorState_SelectedDisabled
+ : IndicatorState_Selected;
+ else if ( flags & wxCONTROL_DISABLED )
+ state = IndicatorState_Disabled;
+ else if ( flags & wxCONTROL_PRESSED )
+ state = IndicatorState_Pressed;
+ else
+ state = IndicatorState_Normal;
+
+ status = flags & wxCONTROL_CHECKED ? IndicatorStatus_Checked
+ : flags & wxCONTROL_UNDETERMINED
+ ? IndicatorStatus_Undetermined
+ : IndicatorStatus_Unchecked;
+}
+
+/* static */
+wxStdRenderer::ArrowDirection wxStdRenderer::GetArrowDirection(wxDirection dir)
+{
+ switch ( dir )
+ {
+ case wxLEFT:
+ return Arrow_Left;
+
+ case wxRIGHT:
+ return Arrow_Right;
+
+ case wxUP:
+ return Arrow_Up;
+
+ case wxDOWN:
+ return Arrow_Down;
+
+ default:
+ wxFAIL_MSG(_T("unknown arrow direction"));
+ }
+
+ return Arrow_Max;
+}
+
// ----------------------------------------------------------------------------
// background
// ----------------------------------------------------------------------------
// check and radio bitmaps
// ----------------------------------------------------------------------------
-/* static */
-void wxStdRenderer::GetIndicatorsFromFlags(int flags,
- IndicatorState& state,
- IndicatorStatus& status)
-{
- if ( flags & wxCONTROL_SELECTED )
- state = flags & wxCONTROL_DISABLED ? IndicatorState_SelectedDisabled
- : IndicatorState_Selected;
- else if ( flags & wxCONTROL_DISABLED )
- state = IndicatorState_Disabled;
- else if ( flags & wxCONTROL_PRESSED )
- state = IndicatorState_Pressed;
- else
- state = IndicatorState_Normal;
-
- status = flags & wxCONTROL_CHECKED ? IndicatorStatus_Checked
- : flags & wxCONTROL_UNDETERMINED
- ? IndicatorStatus_Undetermined
- : IndicatorStatus_Unchecked;
-}
-
void wxStdRenderer::DrawCheckButton(wxDC& dc,
const wxString& label,
const wxBitmap& bitmap,
#endif // wxUSE_TEXTCTRL
+// ----------------------------------------------------------------------------
+// scrollbars drawing
+// ----------------------------------------------------------------------------
+
+void wxStdRenderer::DrawScrollbarArrow(wxDC& dc,
+ wxDirection dir,
+ const wxRect& rect,
+ int flags)
+{
+ DrawArrow(dc, dir, rect, flags);
+}
+
+void wxStdRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
+{
+ DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
+}
+
// ----------------------------------------------------------------------------
// scrollbars geometry
// ----------------------------------------------------------------------------
class wxWin32Renderer : public wxStdRenderer
{
public:
- // constants
- enum wxArrowDirection
- {
- Arrow_Left,
- Arrow_Right,
- Arrow_Up,
- Arrow_Down,
- Arrow_Max
- };
-
- enum wxArrowStyle
- {
- Arrow_Normal,
- Arrow_Disabled,
- Arrow_Pressed,
- Arrow_Inverted,
- Arrow_InvertedDisabled,
- Arrow_StateMax
- };
-
enum wxFrameButtonType
{
FrameButton_Close,
const wxRect& rect,
int flags = 0,
wxRect *rectIn = NULL);
+
virtual void DrawArrow(wxDC& dc,
wxDirection dir,
const wxRect& rect,
int flags = 0);
- virtual void DrawScrollbarArrow(wxDC& dc,
- wxDirection dir,
- const wxRect& rect,
- int flags = 0)
- { DrawArrow(dc, dir, rect, flags); }
virtual void DrawScrollbarThumb(wxDC& dc,
wxOrientation orient,
const wxRect& rect,
wxOrientation orient,
const wxRect& rect,
int flags = 0);
- virtual void DrawScrollCorner(wxDC& dc,
- const wxRect& rect);
#if wxUSE_TOOLBAR
virtual void DrawToolBarButton(wxDC& dc,
// public DrawArrow()s helper
void DrawArrow(wxDC& dc, const wxRect& rect,
- wxArrowDirection arrowDir, wxArrowStyle arrowStyle);
+ ArrowDirection arrowDir, ArrowStyle arrowStyle);
// DrawArrowButton is used by DrawScrollbar and DrawComboButton
void DrawArrowButton(wxDC& dc, const wxRect& rect,
- wxArrowDirection arrowDir,
- wxArrowStyle arrowStyle);
+ ArrowDirection arrowDir,
+ ArrowStyle arrowStyle);
// draw a normal or transposed line (useful for using the same code fo both
// horizontal and vertical widgets)
IndicatorStatus indStatus;
GetIndicatorsFromFlags(flags, indState, indStatus);
- wxBitmap bmp = m_bmpIndicators[indType][indState][indStatus];
+ wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
if ( !bmp.Ok() )
{
const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
{
// create and cache it
bmp = wxBitmap(xpm);
- m_bmpIndicators[indType][indState][indStatus] = bmp;
}
}
rect.x = geometryInfo.GetSize().x - MENU_RIGHT_MARGIN;
rect.width = MENU_RIGHT_MARGIN;
- wxArrowStyle arrowStyle;
+ ArrowStyle arrowStyle;
if ( flags & wxCONTROL_DISABLED )
arrowStyle = flags & wxCONTROL_SELECTED ? Arrow_InvertedDisabled
: Arrow_Disabled;
const wxRect& rect,
int flags)
{
- // get the bitmap for this arrow
- wxArrowDirection arrowDir;
- switch ( dir )
- {
- case wxLEFT: arrowDir = Arrow_Left; break;
- case wxRIGHT: arrowDir = Arrow_Right; break;
- case wxUP: arrowDir = Arrow_Up; break;
- case wxDOWN: arrowDir = Arrow_Down; break;
-
- default:
- wxFAIL_MSG(_T("unknown arrow direction"));
- return;
- }
-
- wxArrowStyle arrowStyle;
+ ArrowStyle arrowStyle;
if ( flags & wxCONTROL_PRESSED )
{
// can't be pressed and disabled
arrowStyle = flags & wxCONTROL_DISABLED ? Arrow_Disabled : Arrow_Normal;
}
- DrawArrowButton(dc, rect, arrowDir, arrowStyle);
+ DrawArrowButton(dc, rect, GetArrowDirection(dir), arrowStyle);
}
void wxWin32Renderer::DrawArrow(wxDC& dc,
const wxRect& rect,
- wxArrowDirection arrowDir,
- wxArrowStyle arrowStyle)
+ ArrowDirection arrowDir,
+ ArrowStyle arrowStyle)
{
const wxBitmap& bmp = m_bmpArrows[arrowStyle][arrowDir];
void wxWin32Renderer::DrawArrowButton(wxDC& dc,
const wxRect& rectAll,
- wxArrowDirection arrowDir,
- wxArrowStyle arrowStyle)
+ ArrowDirection arrowDir,
+ ArrowStyle arrowStyle)
{
wxRect rect = rectAll;
DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
DrawBackground(dc, m_scheme->Get(col), rectBar);
}
-void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
-{
- DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
-}
-
// ----------------------------------------------------------------------------
// top level windows
// ----------------------------------------------------------------------------