git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40980
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// key handler).
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0;
// key handler).
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const = 0;
- // Draws focus background (on combo control) in a way typical on platform.
+ // Prepare background of combo control or an item in a dropdown list
+ // in a way typical on platform. This includes painting the focus/disabled
+ // background and setting the clipping region.
// Unless you plan to paint your own focus indicator, you should always call this
// in your wxComboPopup::PaintComboControl implementation.
// In addition, it sets pen and text colour to what looks good and proper
// Unless you plan to paint your own focus indicator, you should always call this
// in your wxComboPopup::PaintComboControl implementation.
// In addition, it sets pen and text colour to what looks good and proper
// flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control
// wxCONTROL_SELECTED: list item is selected
// wxCONTROL_DISABLED: control/item is disabled
// flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control
// wxCONTROL_SELECTED: list item is selected
// wxCONTROL_DISABLED: control/item is disabled
- virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const;
+ virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const;
// Returns true if focus indicator should be drawn in the control.
bool ShouldDrawFocus() const
// Returns true if focus indicator should be drawn in the control.
bool ShouldDrawFocus() const
- virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const;
+ virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const;
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
static int GetFeatures() { return wxComboCtrlFeatures::All; }
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
static int GetFeatures() { return wxComboCtrlFeatures::All; }
{
if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl
{
{
if ( combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl
{
- combo->DrawFocusBackground(dc,rect,0);
+ combo->PrepareBackground(dc,rect,0);
dc.DrawText( combo->GetValue(),
rect.x + combo->GetTextIndent(),
dc.DrawText( combo->GetValue(),
rect.x + combo->GetTextIndent(),
// painting
// ----------------------------------------------------------------------------
// painting
// ----------------------------------------------------------------------------
-// draw focus background on area in a way typical on platform
-void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const
+#if (!defined(__WXMSW__)) || defined(__WXUNIVERSAL__)
+// prepare combo box background on area in a way typical on platform
+void wxComboCtrlBase::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const
{
wxSize sz = GetClientSize();
bool isEnabled;
{
wxSize sz = GetClientSize();
bool isEnabled;
dc.SetBrush( bgCol );
dc.SetPen( bgCol );
dc.DrawRectangle( selRect );
dc.SetBrush( bgCol );
dc.SetPen( bgCol );
dc.DrawRectangle( selRect );
+
+ // Don't clip exactly to the selection rectangle so we can draw
+ // to the non-selected area in front of it.
+ wxRect clipRect(rect.x,rect.y,
+ (selRect.x+selRect.width)-rect.x,rect.height);
+ dc.SetClippingRegion(clipRect);
+#else
+// Save the library size a bit for platforms that re-implement this.
+void wxComboCtrlBase::PrepareBackground( wxDC&, const wxRect&, int ) const
+{
+}
+#endif
void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg )
{
void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg )
{
if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) ||
(flags & wxODCB_PAINTING_CONTROL) )
{
if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) ||
(flags & wxODCB_PAINTING_CONTROL) )
{
- int focusFlag = wxCONTROL_SELECTED;
+ int bgFlags = wxCONTROL_SELECTED;
if ( (flags & wxODCB_PAINTING_CONTROL) != wxODCB_PAINTING_CONTROL )
if ( (flags & wxODCB_PAINTING_CONTROL) != wxODCB_PAINTING_CONTROL )
- focusFlag |= wxCONTROL_ISSUBMENU;
-
- DrawFocusBackground(dc, rect, focusFlag );
+ {
+ bgFlags |= wxCONTROL_ISSUBMENU;
+ PrepareBackground(dc, rect, bgFlags);
+ }
+ else if ( HasFlag(wxCB_READONLY) )
+ PrepareBackground(dc, rect, bgFlags);
}
//else: do nothing for the normal items
}
}
//else: do nothing for the normal items
}
}
// draw focus background on area in a way typical on platform
}
// draw focus background on area in a way typical on platform
-void wxComboCtrl::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const
+void wxComboCtrl::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const
{
wxUxThemeEngine* theme = (wxUxThemeEngine*) NULL;
{
wxUxThemeEngine* theme = (wxUxThemeEngine*) NULL;
if ( drawDottedEdge )
wxMSWDrawFocusRect(dc,selRect);
if ( drawDottedEdge )
wxMSWDrawFocusRect(dc,selRect);
+ // Don't clip exactly to the selection rectangle so we can draw
+ // to the non-selected area in front of it.
+ wxRect clipRect(rect.x,rect.y,
+ (selRect.x+selRect.width)-rect.x-1,rect.height);
+ dc.SetClippingRegion(clipRect);
}
void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
}
void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )