drawing of a text or bitmap label can be passed in \arg{params}.
+\membersection{wxRendererNative::DrawItemSelectionRect}\label{wxrenderernativedrawitemselectionrect}
+
+\func{void}{DrawItemSelectionRect}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
+
+Draw a selection rectangle underneath the text as used e.g.
+in a \helpref{wxListCtrl}{wxlistctrl}. The supported \arg{flags}
+are \texttt{wxCONTROL\_SELECTED} for items which are selected
+(e.g. often a blue rectangle) and \texttt{wxCONTROL\_CURRENT}
+for the item that has the focus (often a dotted line around
+the item's text). \texttt{wxCONTROL\_CURRENT} may be used
+to indicate if the control has the focus (othewise the
+the selection rectangle is e.g. often grey and not blue).
+This may be ignored by the renderer or deduced by the
+code directly from the \arg{win}.
+
\membersection{wxRendererNative::DrawPushButton}\label{wxrenderernativedrawpushbutton}
\func{void}{DrawPushButton}{\param{wxWindow *}{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags}}
#include "wx/mac/private.h"
#endif
-#ifdef __WXGTK20__
- #include "wx/gtk/private.h"
- #include "wx/gtk/win_gtk.h"
-#endif
-
-
// NOTE: If using the wxListBox visual attributes works everywhere then this can
// be removed, as well as the #else case below.
{
if (highlighted)
{
- wxRect rect2( m_gi->m_rectHighlight );
- m_owner->CalcScrolledPosition( rect2.x, rect2.y, &rect2.x, &rect2.y );
-
- gtk_paint_flat_box( m_owner->m_widget->style,
- GTK_PIZZA(m_owner->m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- GTK_SHADOW_NONE,
- NULL,
- m_owner->m_wxwindow,
- "cell_even",
- rect2.x, rect2.y, rect2.width, rect2.height );
+ int flags = wxCONTROL_SELECTED;
+ if (m_owner->HasFocus())
+ flags |= wxCONTROL_FOCUSED;
+ wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, m_gi->m_rectHighlight, flags );
+
}
else
{
{
if (highlighted)
{
- wxRect rect2( rectHL );
- m_owner->CalcScrolledPosition( rect2.x, rect2.y, &rect2.x, &rect2.y );
-
- gtk_paint_flat_box( m_owner->m_widget->style,
- GTK_PIZZA(m_owner->m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- GTK_SHADOW_NONE,
- NULL,
- m_owner->m_wxwindow,
- "cell_even",
- rect2.x, rect2.y, rect2.width, rect2.height );
+ int flags = wxCONTROL_SELECTED;
+ if (m_owner->HasFocus())
+ flags |= wxCONTROL_FOCUSED;
+ wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
}
else
{
dc.SetBrush( *wxTRANSPARENT_BRUSH );
dc.DrawRectangle( rect );
#else
- CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
-
- gtk_paint_focus( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- NULL,
- m_wxwindow,
- "treeview",
- rect.x, rect.y, rect.width, rect.height );
+ wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, wxCONTROL_CURRENT|wxCONTROL_FOCUSED );
#endif
}
#include "wx/mac/private.h"
#endif
-#ifdef __WXGTK20__
- #include "wx/gtk/private.h"
- #include "wx/gtk/win_gtk.h"
-#endif
-
// -----------------------------------------------------------------------------
// array types
// -----------------------------------------------------------------------------
}
else
{
- CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
-
- gtk_paint_flat_box( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- GTK_SHADOW_NONE,
- NULL,
- m_wxwindow,
- "cell_even",
- rect.x, rect.y, rect.width, rect.height );
-
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ flags |= wxCONTROL_FOCUSED;
if ((item == m_current) && (m_hasFocus))
- gtk_paint_focus( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- NULL,
- m_wxwindow,
- "treeview",
- rect.x, rect.y, rect.width, rect.height );
+ flags |= wxCONTROL_CURRENT;
+ wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags );
}
#endif
}
#ifndef __WXGTK20__
dc.DrawRectangle( rect );
#else
- CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
rect.x -= 1;
rect.width += 2;
- gtk_paint_flat_box( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- GTK_SHADOW_NONE,
- NULL,
- m_wxwindow,
- "cell_even",
- rect.x, rect.y, rect.width, rect.height );
-
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ flags |= wxCONTROL_FOCUSED;
if ((item == m_current) && (m_hasFocus))
- gtk_paint_focus( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- NULL,
- m_wxwindow,
- "treeview",
- rect.x, rect.y, rect.width, rect.height );
-
+ flags |= wxCONTROL_CURRENT;
+ wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags );
#endif
}
// On GTK+ 2, drawing a 'normal' background is wrong for themes that
}
else
{
- CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
rect.x -= 1;
rect.width += 2;
-
- gtk_paint_flat_box( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- GTK_SHADOW_NONE,
- NULL,
- m_wxwindow,
- "cell_even",
- rect.x, rect.y, rect.width, rect.height );
-
+
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ flags |= wxCONTROL_FOCUSED;
if ((item == m_current) && (m_hasFocus))
- gtk_paint_focus( m_widget->style,
- GTK_PIZZA(m_wxwindow)->bin_window,
- GTK_STATE_SELECTED,
- NULL,
- m_wxwindow,
- "treeview",
- rect.x, rect.y, rect.width, rect.height );
+ flags |= wxCONTROL_CURRENT;
+ wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, flags );
}
#endif
}
GtkStateType state;
if (flags & wxCONTROL_SELECTED)
{
- if (flags & wxCONTROL_FOCUSED)
- state = GTK_STATE_SELECTED;
- else
- state = GTK_STATE_INSENSITIVE;
+ // the wxCONTROL_FOCUSED state is deduced
+ // directly from the m_wxwindow by GTK+
+ state = GTK_STATE_SELECTED;
- gtk_paint_flat_box( win->m_wxwindow->style,
+ gtk_paint_flat_box( win->m_widget->style,
gdk_window,
state,
GTK_SHADOW_NONE,
NULL,
win->m_wxwindow,
- "treeview",
+ "cell_even",
dc.LogicalToDeviceX(rect.x),
dc.LogicalToDeviceY(rect.y),
rect.width,
if (flags & wxCONTROL_CURRENT)
{
- dc.SetPen( *wxBLACK_PEN );
- dc.SetBrush( *wxTRANSPARENT_BRUSH );
- dc.DrawRectangle( rect );
+ gtk_paint_focus( win->m_widget->style,
+ gdk_window,
+ GTK_STATE_SELECTED,
+ NULL,
+ win->m_wxwindow,
+ "treeview",
+ dc.LogicalToDeviceX(rect.x),
+ dc.LogicalToDeviceY(rect.y),
+ rect.width,
+ rect.height );
}
}