From a61c9122413cef45bad87da7e3dc65617bb2adb7 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 9 Feb 2007 14:05:11 +0000 Subject: [PATCH] Reverted renderer changes and just use window variant within renderer functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44430 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/renderer.tex | 4 ---- include/wx/renderer.h | 7 +------ src/common/combocmn.cpp | 12 +----------- src/mac/carbon/renderer.cpp | 37 ++++++++++++++++++++----------------- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/docs/latex/wx/renderer.tex b/docs/latex/wx/renderer.tex index 3013dcb734..d0fa0b0ec9 100644 --- a/docs/latex/wx/renderer.tex +++ b/docs/latex/wx/renderer.tex @@ -74,10 +74,6 @@ enum 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_SIZE_NORMAL = 0x00000100, - wxCONTROL_SIZE_LARGE = 0x00000200, - wxCONTROL_SIZE_SMALL = 0x00000400, - wxCONTROL_SIZE_MINI = 0x00000800, wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE // (check) undetermined state }; \end{verbatim} diff --git a/include/wx/renderer.h b/include/wx/renderer.h index 448539d79c..a270f0848e 100644 --- a/include/wx/renderer.h +++ b/include/wx/renderer.h @@ -62,12 +62,7 @@ enum wxCONTROL_CHECKABLE = 0x00000080, // (menu) item can be checked wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE, // (check) undetermined state - wxCONTROL_SIZE_NORMAL = 0x00000100, - wxCONTROL_SIZE_LARGE = 0x00000200, - wxCONTROL_SIZE_SMALL = 0x00000400, - wxCONTROL_SIZE_MINI = 0x00000800, - - wxCONTROL_FLAGS_MASK = 0x00000fff, + wxCONTROL_FLAGS_MASK = 0x000000ff, // this is a pseudo flag not used directly by wxRenderer but rather by some // controls internally diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 82345122b8..2595b6ad92 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1347,11 +1347,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int paintBg ) } // Draw standard button - if (GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL) - drawState |= wxCONTROL_SIZE_SMALL; - else if (GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI) - drawState |= wxCONTROL_SIZE_MINI; - wxRendererNative::Get().DrawComboBoxDropButton(this, dc, drawRect, @@ -1385,11 +1380,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int paintBg ) dc.DrawRectangle(rect); } - if (GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL) - drawState |= wxCONTROL_SIZE_SMALL; - else if (GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI) - drawState |= wxCONTROL_SIZE_MINI; - wxRendererNative::Get().DrawPushButton(this, dc, drawRect, @@ -1865,7 +1855,7 @@ void wxComboCtrlBase::ShowPopup() } winPopup->Enable(); - + wxASSERT( !m_popup || m_popup == popup ); // Consistency check. wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup, diff --git a/src/mac/carbon/renderer.cpp b/src/mac/carbon/renderer.cpp index 2c390637b2..849f287b02 100644 --- a/src/mac/carbon/renderer.cpp +++ b/src/mac/carbon/renderer.cpp @@ -42,7 +42,7 @@ public: wxHeaderButtonParams* params = NULL ); virtual int GetHeaderButtonHeight(wxWindow *win); - + // draw the expanded/collapsed icon for a tree control item virtual void DrawTreeItemButton( wxWindow *win, wxDC& dc, @@ -61,12 +61,12 @@ public: wxDC& dc, const wxRect& rect, int flags = 0); - + virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0); - + virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, @@ -79,7 +79,7 @@ private: int flags, int kind, int adornment); - + // the tree buttons wxBitmap m_bmpTreeExpanded; wxBitmap m_bmpTreeCollapsed; @@ -168,7 +168,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win, // The down arrow is drawn automatically, change it to an up arrow if needed. 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 @@ -181,7 +181,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win, headerRect.size.width += 25; HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect ); CGContextRestoreGState( cgContext ); - } + } } #if wxMAC_USE_CORE_GRAPHICS @@ -233,7 +233,7 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win, const wxCoord y = rect.y; const wxCoord w = rect.width; const wxCoord h = rect.height; -#endif +#endif dc.SetBrush( *wxTRANSPARENT_BRUSH ); @@ -283,10 +283,10 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win, // Apple mailing list posts say to use the arrow adornment constants, but those don't work. // We need to set the value using the 'old' DrawThemeButton constants instead. drawInfo.value = (flags & wxCONTROL_EXPANDED) ? kThemeDisclosureDown : kThemeDisclosureRight; - drawInfo.adornment = kThemeAdornmentNone; + drawInfo.adornment = kThemeAdornmentNone; HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect ); - + } #if wxMAC_USE_CORE_GRAPHICS @@ -370,7 +370,7 @@ wxRendererMac::DrawItemSelectionRect(wxWindow *win, const wxRect& rect, int flags ) { - RGBColor selColor; + RGBColor selColor; if (flags & wxCONTROL_SELECTED) { if (flags & wxCONTROL_FOCUSED) @@ -378,7 +378,7 @@ wxRendererMac::DrawItemSelectionRect(wxWindow *win, else GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, 32, true, &selColor); } - + wxBrush selBrush = wxBrush( wxColour( selColor.red, selColor.green, selColor.blue ), wxSOLID ); dc.SetPen( *wxTRANSPARENT_PEN ); @@ -474,17 +474,17 @@ wxRendererMac::DrawComboBoxDropButton(wxWindow *win, int flags) { int kind; - if (flags & wxCONTROL_SIZE_SMALL) + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) kind = kThemeArrowButtonSmall; - else if (flags & wxCONTROL_SIZE_MINI) + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) kind = kThemeArrowButtonMini; else kind = kThemeArrowButton; - + DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentArrowDownArrow); } - + void wxRendererMac::DrawPushButton(wxWindow *win, wxDC& dc, @@ -492,7 +492,10 @@ wxRendererMac::DrawPushButton(wxWindow *win, int flags) { int kind; - if (flags & wxCONTROL_SIZE_SMALL) + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) + kind = kThemeBevelButtonSmall; + // There is no kThemeBevelButtonMini, but in this case, use Small + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) kind = kThemeBevelButtonSmall; else kind = kThemeBevelButton; @@ -500,4 +503,4 @@ wxRendererMac::DrawPushButton(wxWindow *win, DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone); } - + -- 2.45.2