Added Set/GetThemeEnabled and used this for determining whether to paint a theme
background. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
117247fd2c
commit
a2d93e735a
@ -333,6 +333,9 @@ public:
|
||||
// make the window modal (all other windows unresponsive)
|
||||
virtual void MakeModal(bool modal = TRUE);
|
||||
|
||||
virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; }
|
||||
virtual bool GetThemeEnabled() const { return m_themeEnabled; }
|
||||
|
||||
// focus handling
|
||||
// --------------
|
||||
|
||||
@ -773,6 +776,7 @@ protected:
|
||||
long m_windowStyle,
|
||||
m_exStyle;
|
||||
wxString m_windowName;
|
||||
bool m_themeEnabled;
|
||||
|
||||
protected:
|
||||
// common part of all ctors: it is not virtual because it is called from
|
||||
|
@ -162,6 +162,9 @@ void wxWindowBase::InitBase()
|
||||
#if wxUSE_CARET
|
||||
m_caret = (wxCaret *)NULL;
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// Whether we're using the current theme for this window (wxGTK only for now)
|
||||
m_themeEnabled = FALSE;
|
||||
}
|
||||
|
||||
// common part of window creation process
|
||||
|
@ -80,6 +80,7 @@ bool wxStatusBarGeneric::Create(wxWindow *parent,
|
||||
m_nFields = 0;
|
||||
m_borderX = wxTHICK_LINE_BORDER;
|
||||
m_borderY = wxTHICK_LINE_BORDER;
|
||||
m_themeEnabled = TRUE;
|
||||
|
||||
bool success = wxWindow::Create(parent, id,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
|
@ -231,6 +231,7 @@ void wxDialog::Init()
|
||||
m_returnCode = 0;
|
||||
m_sizeSet = FALSE;
|
||||
m_modalShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxDialog::wxDialog( wxWindow *parent,
|
||||
|
@ -449,6 +449,7 @@ void wxFrame::Init()
|
||||
m_insertInClientArea = TRUE;
|
||||
m_isIconized = FALSE;
|
||||
m_fsIsShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
bool wxFrame::Create( wxWindow *parent,
|
||||
@ -1177,8 +1178,9 @@ void wxFrame::Maximize(bool WXUNUSED(maximize))
|
||||
|
||||
bool wxFrame::IsMaximized() const
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
// wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
// This is an approximation
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,7 @@ void wxNotebook::Init()
|
||||
m_imageList = (wxImageList *) NULL;
|
||||
m_pages.DeleteContents( TRUE );
|
||||
m_lastSelection = -1;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxNotebook::wxNotebook()
|
||||
@ -561,6 +562,9 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
|
||||
|
||||
if (m_themeEnabled)
|
||||
win->SetThemeEnabled(TRUE);
|
||||
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
|
||||
|
||||
wxGtkNotebookPage *page = new wxGtkNotebookPage();
|
||||
|
@ -220,10 +220,9 @@ void wxToolBar::Init()
|
||||
{
|
||||
m_fg =
|
||||
m_bg = (GdkColor *)NULL;
|
||||
|
||||
m_toolbar = (GtkToolbar *)NULL;
|
||||
|
||||
m_blockNextEvent = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxToolBar::~wxToolBar()
|
||||
|
@ -680,7 +680,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
|
||||
*/
|
||||
|
||||
GtkPizza *pizza = GTK_PIZZA (widget);
|
||||
|
||||
|
||||
/*
|
||||
if (win->IsTopLevel())
|
||||
{
|
||||
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
@ -695,6 +696,18 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
|
||||
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
|
||||
}
|
||||
*/
|
||||
if (win->GetThemeEnabled())
|
||||
{
|
||||
wxWindow *parent = win->GetParent();
|
||||
while (parent && !parent->IsTopLevel())
|
||||
parent = parent->GetParent();
|
||||
if (!parent)
|
||||
parent = win;
|
||||
|
||||
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
|
||||
}
|
||||
|
||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
|
@ -231,6 +231,7 @@ void wxDialog::Init()
|
||||
m_returnCode = 0;
|
||||
m_sizeSet = FALSE;
|
||||
m_modalShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxDialog::wxDialog( wxWindow *parent,
|
||||
|
@ -449,6 +449,7 @@ void wxFrame::Init()
|
||||
m_insertInClientArea = TRUE;
|
||||
m_isIconized = FALSE;
|
||||
m_fsIsShowing = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
bool wxFrame::Create( wxWindow *parent,
|
||||
@ -1177,8 +1178,9 @@ void wxFrame::Maximize(bool WXUNUSED(maximize))
|
||||
|
||||
bool wxFrame::IsMaximized() const
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
// wxFAIL_MSG( _T("not implemented") );
|
||||
|
||||
// This is an approximation
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,7 @@ void wxNotebook::Init()
|
||||
m_imageList = (wxImageList *) NULL;
|
||||
m_pages.DeleteContents( TRUE );
|
||||
m_lastSelection = -1;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxNotebook::wxNotebook()
|
||||
@ -561,6 +562,9 @@ bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString&
|
||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );
|
||||
|
||||
if (m_themeEnabled)
|
||||
win->SetThemeEnabled(TRUE);
|
||||
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);
|
||||
|
||||
wxGtkNotebookPage *page = new wxGtkNotebookPage();
|
||||
|
@ -220,10 +220,9 @@ void wxToolBar::Init()
|
||||
{
|
||||
m_fg =
|
||||
m_bg = (GdkColor *)NULL;
|
||||
|
||||
m_toolbar = (GtkToolbar *)NULL;
|
||||
|
||||
m_blockNextEvent = FALSE;
|
||||
m_themeEnabled = TRUE;
|
||||
}
|
||||
|
||||
wxToolBar::~wxToolBar()
|
||||
|
@ -680,7 +680,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
|
||||
*/
|
||||
|
||||
GtkPizza *pizza = GTK_PIZZA (widget);
|
||||
|
||||
|
||||
/*
|
||||
if (win->IsTopLevel())
|
||||
{
|
||||
gtk_paint_flat_box (win->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
@ -695,6 +696,18 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev
|
||||
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
|
||||
}
|
||||
*/
|
||||
if (win->GetThemeEnabled())
|
||||
{
|
||||
wxWindow *parent = win->GetParent();
|
||||
while (parent && !parent->IsTopLevel())
|
||||
parent = parent->GetParent();
|
||||
if (!parent)
|
||||
parent = win;
|
||||
|
||||
gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
|
||||
}
|
||||
|
||||
win->GetUpdateRegion().Union( gdk_event->area.x,
|
||||
gdk_event->area.y,
|
||||
|
Loading…
Reference in New Issue
Block a user