centralized the handling of border styles; added borders support for wxListBox and support of other kinds of borders (patch 1448088)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-04-16 23:38:26 +00:00
parent 3786c8b587
commit 6493aacaeb
6 changed files with 33 additions and 3 deletions

View File

@@ -203,6 +203,7 @@ wxGTK:
- Fixed problems with CJK input method.
- Implemented ScrollLines/Pages() for all windows (Paul Cornett).
- Support underlined fonts in wxTextCtrl.
- Support all border styles; wxListBox honours the borders now
wxMac:

View File

@@ -277,6 +277,9 @@ protected:
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
// sets the border of a given GtkScrolledWindow from a wx style
static void GtkScrolledWindowSetBorder(GtkWidget* w, int style);
protected:
// GtkAdjustment to be used by Scroll{Lines,Pages}
void SetVScrollAdjustment(GtkAdjustment* adj);

View File

@@ -1407,7 +1407,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
}
m_widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_widget), GTK_SHADOW_IN);
GtkScrolledWindowSetBorder(m_widget, style);
m_treeview = gtk_tree_view_new();
gtk_container_add (GTK_CONTAINER (m_widget), m_treeview);

View File

@@ -467,6 +467,9 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
}
GtkScrolledWindowSetBorder(m_widget, style);
m_treeview = GTK_TREE_VIEW( gtk_tree_view_new( ) );
//wxListBox doesn't have a header :)

View File

@@ -600,8 +600,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GtkScrolledWindowSetBorder(m_widget, style);
gtk_widget_add_events( GTK_WIDGET(m_text), GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );

View File

@@ -4334,6 +4334,29 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
m_clipPaintRegion = false;
}
void wxWindowGTK::GtkScrolledWindowSetBorder(GtkWidget* w, int wxstyle)
{
//RN: Note that static controls usually have no border on gtk, so maybe
//it makes sense to treat that as simply no border at the wx level
//as well...
if (!(wxstyle & wxNO_BORDER) && !(wxstyle & wxBORDER_STATIC))
{
GtkShadowType gtkstyle;
if(wxstyle & wxBORDER_RAISED)
gtkstyle = GTK_SHADOW_OUT;
else if (wxstyle & wxBORDER_SUNKEN)
gtkstyle = GTK_SHADOW_IN;
else if (wxstyle & wxBORDER_DOUBLE)
gtkstyle = GTK_SHADOW_ETCHED_IN;
else //default
gtkstyle = GTK_SHADOW_IN;
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(w),
gtkstyle );
}
}
void wxWindowGTK::SetWindowStyleFlag( long style )
{
// Updates the internal variable. NB: Now m_windowStyle bits carry the _new_ style values already