New colour, font, theme and size code..
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
bf9b671186
commit
db434467a1
@ -64,6 +64,9 @@ public:
|
|||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||||
};
|
};
|
||||||
|
@ -133,27 +133,29 @@ public:
|
|||||||
// overridden from wxWindow to make tabbing work
|
// overridden from wxWindow to make tabbing work
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
// --------------
|
||||||
|
|
||||||
void SetConstraintSizes(bool recurse);
|
void SetConstraintSizes(bool recurse);
|
||||||
bool DoPhase(int phase);
|
bool DoPhase(int phase);
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
// report if window belongs to notebook
|
// report if window belongs to notebook
|
||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// helper function
|
// helper function
|
||||||
wxNotebookPage* GetNotebookPage(int page) const;
|
wxNotebookPage* GetNotebookPage(int page) const;
|
||||||
|
|
||||||
wxImageList* m_imageList;
|
wxImageList* m_imageList;
|
||||||
wxList m_pages;
|
wxList m_pages;
|
||||||
int m_lastSelection; /* hack */
|
int m_lastSelection; /* hack */
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,6 +70,9 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void OnInternalIdle();
|
void OnInternalIdle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||||
};
|
};
|
||||||
|
@ -64,6 +64,9 @@ public:
|
|||||||
|
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||||
};
|
};
|
||||||
|
@ -133,27 +133,29 @@ public:
|
|||||||
// overridden from wxWindow to make tabbing work
|
// overridden from wxWindow to make tabbing work
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
// --------------
|
||||||
|
|
||||||
void SetConstraintSizes(bool recurse);
|
void SetConstraintSizes(bool recurse);
|
||||||
bool DoPhase(int phase);
|
bool DoPhase(int phase);
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
|
||||||
// report if window belongs to notebook
|
// report if window belongs to notebook
|
||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// helper function
|
// helper function
|
||||||
wxNotebookPage* GetNotebookPage(int page) const;
|
wxNotebookPage* GetNotebookPage(int page) const;
|
||||||
|
|
||||||
wxImageList* m_imageList;
|
wxImageList* m_imageList;
|
||||||
wxList m_pages;
|
wxList m_pages;
|
||||||
int m_lastSelection; /* hack */
|
int m_lastSelection; /* hack */
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,6 +70,9 @@ public:
|
|||||||
bool IsOwnGtkWindow( GdkWindow *window );
|
bool IsOwnGtkWindow( GdkWindow *window );
|
||||||
void OnInternalIdle();
|
void OnInternalIdle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||||
};
|
};
|
||||||
|
@ -119,7 +119,7 @@ void wxWindowBase::InitBase()
|
|||||||
|
|
||||||
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE);
|
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_BTNFACE);
|
||||||
m_foregroundColour = *wxBLACK; // TODO take this from sys settings too?
|
m_foregroundColour = *wxBLACK; // TODO take this from sys settings too?
|
||||||
#ifndef __WXMAC__
|
#if !defined(__WXMAC__) && !defined(__WXGTK__)
|
||||||
m_font = *wxSWISS_FONT; // and this?
|
m_font = *wxSWISS_FONT; // and this?
|
||||||
#else
|
#else
|
||||||
m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
@ -111,24 +111,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int x = 0; int y = 0;
|
|
||||||
wxFont new_font( parent->GetFont() );
|
|
||||||
GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
|
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1)
|
|
||||||
{
|
|
||||||
newSize.x = 12+x;
|
|
||||||
if (newSize.x < 80) newSize.x = 80;
|
|
||||||
}
|
|
||||||
if (newSize.y == -1)
|
|
||||||
{
|
|
||||||
newSize.y = 11+y;
|
|
||||||
if (newSize.y < 26) newSize.y = 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
@ -136,9 +118,23 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize best_size( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = best_size.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = best_size.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
|
SetSize( new_size );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -184,3 +180,11 @@ void wxButton::ApplyWidgetStyle()
|
|||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxButton::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
if (ret.x < 80) ret.x = 80;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -106,8 +106,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
m_widget = m_widgetCheckbox;
|
m_widget = m_widgetCheckbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||||
"clicked",
|
"clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||||
@ -117,9 +115,21 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -203,8 +213,7 @@ void wxCheckBox::OnInternalIdle()
|
|||||||
|
|
||||||
wxSize wxCheckBox::DoGetBestSize() const
|
wxSize wxCheckBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
return wxControl::DoGetBestSize();
|
||||||
m_label.mbc_str() ), 26 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,8 +90,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_option_menu_new();
|
m_widget = gtk_option_menu_new();
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
if ( style & wxCB_SORT )
|
if ( style & wxCB_SORT )
|
||||||
{
|
{
|
||||||
// if our m_strings != NULL, DoAppend() will check for it and insert
|
// if our m_strings != NULL, DoAppend() will check for it and insert
|
||||||
@ -112,9 +110,21 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -396,7 +406,10 @@ size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
|
|
||||||
wxSize wxChoice::DoGetBestSize() const
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize(80, 26);
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
if (ret.x < 80) ret.x = 80;
|
||||||
|
ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,17 +101,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = TRUE;
|
||||||
|
|
||||||
wxSize newSize = size,
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
bestSize = DoGetBestSize();
|
|
||||||
|
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = bestSize.x;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = bestSize.y;
|
|
||||||
if (newSize.y > 22)
|
|
||||||
newSize.y = 22;
|
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, newSize ) ||
|
|
||||||
!CreateBase( parent, id, pos, size, style, validator, name ))
|
!CreateBase( parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxComboBox creation failed") );
|
wxFAIL_MSG( wxT("wxComboBox creation failed") );
|
||||||
@ -148,6 +138,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
ConnectWidget( GTK_COMBO(m_widget)->button );
|
ConnectWidget( GTK_COMBO(m_widget)->button );
|
||||||
|
|
||||||
if (!value.IsNull()) SetValue( value );
|
if (!value.IsNull()) SetValue( value );
|
||||||
@ -158,9 +150,19 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
|
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
|
||||||
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
|
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if (new_size.y > size_best.y)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
|
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -665,8 +667,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
|
|
||||||
wxSize wxComboBox::DoGetBestSize() const
|
wxSize wxComboBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
// totally bogus - should measure the strings in the combo!
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
return wxSize(100, 22);
|
if (ret.x < 100) ret.x = 100;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,6 +78,8 @@ wxMenuBar::wxMenuBar( long style )
|
|||||||
}
|
}
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuBar::wxMenuBar()
|
wxMenuBar::wxMenuBar()
|
||||||
@ -108,6 +110,8 @@ wxMenuBar::wxMenuBar()
|
|||||||
m_widget = GTK_WIDGET(m_menubar);
|
m_widget = GTK_WIDGET(m_menubar);
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
|
@ -213,7 +213,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
|
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,15 +230,17 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
if(m_windowStyle & wxNB_RIGHT)
|
if (m_windowStyle & wxNB_RIGHT)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
|
||||||
if(m_windowStyle & wxNB_LEFT)
|
if (m_windowStyle & wxNB_LEFT)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
|
||||||
if(m_windowStyle & wxNB_BOTTOM)
|
if (m_windowStyle & wxNB_BOTTOM)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
@ -625,6 +627,8 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
|||||||
|
|
||||||
void wxNotebook::ApplyWidgetStyle()
|
void wxNotebook::ApplyWidgetStyle()
|
||||||
{
|
{
|
||||||
|
// TODO, font for labels etc
|
||||||
|
|
||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,16 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
m_x+10, m_y+10+(i*24), 10, 10 );
|
m_x+10, m_y+10+(i*24), 10, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetLabel( title );
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
wxSize ls = LayoutItems();
|
wxSize ls = LayoutItems();
|
||||||
|
|
||||||
wxSize newSize = size;
|
wxSize newSize = size;
|
||||||
@ -187,15 +197,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
if (newSize.y == -1) newSize.y = ls.y;
|
if (newSize.y == -1) newSize.y = ls.y;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
|
||||||
|
|
||||||
PostCreation();
|
|
||||||
|
|
||||||
SetLabel( title );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
|
@ -84,36 +84,31 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
wxRadioButton *chief = (wxRadioButton*) NULL;
|
wxRadioButton *chief = (wxRadioButton*) NULL;
|
||||||
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
|
||||||
wxWindow *child = node->GetData();
|
|
||||||
if (child->m_isRadioButton)
|
|
||||||
{
|
{
|
||||||
chief = (wxRadioButton*) child;
|
wxWindow *child = node->GetData();
|
||||||
if (child->HasFlag(wxRB_GROUP)) break;
|
if (child->m_isRadioButton)
|
||||||
}
|
{
|
||||||
node = node->GetPrevious();
|
chief = (wxRadioButton*) child;
|
||||||
|
if (child->HasFlag(wxRB_GROUP)) break;
|
||||||
|
}
|
||||||
|
node = node->GetPrevious();
|
||||||
}
|
}
|
||||||
if (chief)
|
if (chief)
|
||||||
{
|
{
|
||||||
/* we are part of the group started by chief */
|
/* we are part of the group started by chief */
|
||||||
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* start a new group */
|
/* start a new group */
|
||||||
m_radioButtonGroup = (GSList*) NULL;
|
m_radioButtonGroup = (GSList*) NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
@ -121,9 +116,21 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -204,10 +211,15 @@ void wxRadioButton::OnInternalIdle()
|
|||||||
windows above so that checking for the current cursor is
|
windows above so that checking for the current cursor is
|
||||||
not possible. */
|
not possible. */
|
||||||
|
|
||||||
gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
|
gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxRadioButton::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxControl::DoGetBestSize();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,65 +76,78 @@ void wxSystemSettings::Done()
|
|||||||
|
|
||||||
wxColour wxSystemSettings::GetSystemColour( int index )
|
wxColour wxSystemSettings::GetSystemColour( int index )
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
|
||||||
case wxSYS_COLOUR_SCROLLBAR:
|
|
||||||
case wxSYS_COLOUR_BACKGROUND:
|
|
||||||
case wxSYS_COLOUR_ACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_INACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_MENU:
|
|
||||||
case wxSYS_COLOUR_WINDOWFRAME:
|
|
||||||
case wxSYS_COLOUR_ACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_INACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_BTNFACE:
|
|
||||||
{
|
{
|
||||||
if (!g_systemBtnFaceColour)
|
case wxSYS_COLOUR_SCROLLBAR:
|
||||||
{
|
case wxSYS_COLOUR_BACKGROUND:
|
||||||
g_systemBtnFaceColour =
|
case wxSYS_COLOUR_ACTIVECAPTION:
|
||||||
new wxColour( 0xd6d6 >> SHIFT,
|
case wxSYS_COLOUR_INACTIVECAPTION:
|
||||||
0xd6d6 >> SHIFT,
|
case wxSYS_COLOUR_MENU:
|
||||||
0xd6d6 >> SHIFT );
|
case wxSYS_COLOUR_WINDOWFRAME:
|
||||||
}
|
case wxSYS_COLOUR_ACTIVEBORDER:
|
||||||
return *g_systemBtnFaceColour;
|
case wxSYS_COLOUR_INACTIVEBORDER:
|
||||||
}
|
case wxSYS_COLOUR_BTNFACE:
|
||||||
case wxSYS_COLOUR_WINDOW:
|
{
|
||||||
{
|
if (!g_systemBtnFaceColour)
|
||||||
return *wxWHITE;
|
{
|
||||||
}
|
g_systemBtnFaceColour =
|
||||||
case wxSYS_COLOUR_GRAYTEXT:
|
new wxColour( 0xd6d6 >> SHIFT,
|
||||||
case wxSYS_COLOUR_BTNSHADOW:
|
0xd6d6 >> SHIFT,
|
||||||
{
|
0xd6d6 >> SHIFT );
|
||||||
if (!g_systemBtnShadowColour)
|
}
|
||||||
{
|
return *g_systemBtnFaceColour;
|
||||||
g_systemBtnShadowColour =
|
}
|
||||||
new wxColour( 0x7530 >> SHIFT,
|
case wxSYS_COLOUR_WINDOW:
|
||||||
0x7530 >> SHIFT,
|
{
|
||||||
0x7530 >> SHIFT );
|
return *wxWHITE;
|
||||||
}
|
}
|
||||||
return *g_systemBtnShadowColour;
|
case wxSYS_COLOUR_GRAYTEXT:
|
||||||
}
|
case wxSYS_COLOUR_BTNSHADOW:
|
||||||
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
{
|
||||||
{
|
if (!g_systemBtnShadowColour)
|
||||||
if (!g_systemBtnHighlightColour)
|
{
|
||||||
{
|
g_systemBtnShadowColour =
|
||||||
g_systemBtnHighlightColour =
|
new wxColour( 0x7530 >> SHIFT,
|
||||||
new wxColour( 0xea60 >> SHIFT,
|
0x7530 >> SHIFT,
|
||||||
0xea60 >> SHIFT,
|
0x7530 >> SHIFT );
|
||||||
0xea60 >> SHIFT );
|
}
|
||||||
}
|
return *g_systemBtnShadowColour;
|
||||||
return *g_systemBtnHighlightColour;
|
}
|
||||||
}
|
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
||||||
case wxSYS_COLOUR_HIGHLIGHT:
|
{
|
||||||
{
|
if (!g_systemBtnHighlightColour)
|
||||||
if (!g_systemHighlightColour)
|
{
|
||||||
{
|
g_systemBtnHighlightColour =
|
||||||
g_systemHighlightColour =
|
new wxColour( 0xea60 >> SHIFT,
|
||||||
new wxColour( 0 >> SHIFT,
|
0xea60 >> SHIFT,
|
||||||
0 >> SHIFT,
|
0xea60 >> SHIFT );
|
||||||
0x9c40 >> SHIFT );
|
}
|
||||||
}
|
return *g_systemBtnHighlightColour;
|
||||||
return *g_systemHighlightColour;
|
}
|
||||||
}
|
case wxSYS_COLOUR_HIGHLIGHT:
|
||||||
|
{
|
||||||
|
if (!g_systemHighlightColour)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
g_systemHighlightColour =
|
||||||
|
new wxColour( 0 >> SHIFT,
|
||||||
|
0 >> SHIFT,
|
||||||
|
0x9c40 >> SHIFT );
|
||||||
|
*/
|
||||||
|
GtkWidget *widget = gtk_button_new();
|
||||||
|
GtkStyle *def = gtk_rc_get_style( widget );
|
||||||
|
int red = def->bg[GTK_STATE_SELECTED].red;
|
||||||
|
int green = def->bg[GTK_STATE_SELECTED].green;
|
||||||
|
int blue = def->bg[GTK_STATE_SELECTED].blue;
|
||||||
|
gtk_widget_destroy( widget );
|
||||||
|
|
||||||
|
g_systemHighlightColour =
|
||||||
|
new wxColour( red >> SHIFT,
|
||||||
|
green >> SHIFT,
|
||||||
|
blue >> SHIFT );
|
||||||
|
}
|
||||||
|
return *g_systemHighlightColour;
|
||||||
|
}
|
||||||
case wxSYS_COLOUR_MENUTEXT:
|
case wxSYS_COLOUR_MENUTEXT:
|
||||||
case wxSYS_COLOUR_WINDOWTEXT:
|
case wxSYS_COLOUR_WINDOWTEXT:
|
||||||
case wxSYS_COLOUR_CAPTIONTEXT:
|
case wxSYS_COLOUR_CAPTIONTEXT:
|
||||||
@ -173,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
|
|||||||
case wxSYS_DEFAULT_GUI_FONT:
|
case wxSYS_DEFAULT_GUI_FONT:
|
||||||
{
|
{
|
||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
return *g_systemFont;
|
return *g_systemFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,24 +88,28 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
||||||
|
|
||||||
wxSize new_size = size,
|
|
||||||
sizeBest = DoGetBestSize();
|
|
||||||
if (new_size.x == -1)
|
|
||||||
new_size.x = sizeBest.x;
|
|
||||||
if (new_size.y == -1)
|
|
||||||
new_size.y = sizeBest.y;
|
|
||||||
|
|
||||||
if ((new_size.x != size.x) || (new_size.y != size.y))
|
|
||||||
SetSize( new_size.x, new_size.y );
|
|
||||||
|
|
||||||
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
|
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
|
||||||
(int)(m_windowStyle & wxSP_WRAP) );
|
(int)(m_windowStyle & wxSP_WRAP) );
|
||||||
|
|
||||||
GtkEnableEvents();
|
GtkEnableEvents();
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
|
|
||||||
SetValue( value );
|
SetValue( value );
|
||||||
|
@ -45,7 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
|
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isStaticBox = TRUE;
|
m_isStaticBox = TRUE;
|
||||||
@ -61,9 +61,13 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
|
@ -62,8 +62,6 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( m_label.mbc_str() );
|
m_widget = gtk_label_new( m_label.mbc_str() );
|
||||||
|
|
||||||
wxControl::SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
justify = GTK_JUSTIFY_CENTER;
|
justify = GTK_JUSTIFY_CENTER;
|
||||||
@ -80,12 +78,23 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
// do not move this call elsewhere
|
// do not move this call elsewhere
|
||||||
gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
|
gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
wxControl::SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
@ -192,20 +192,21 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
m_text = gtk_entry_new();
|
m_text = gtk_entry_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize new_size = size,
|
|
||||||
sizeBest = DoGetBestSize();
|
|
||||||
if (new_size.x == -1)
|
|
||||||
new_size.x = sizeBest.x;
|
|
||||||
if (new_size.y == -1)
|
|
||||||
new_size.y = sizeBest.y;
|
|
||||||
|
|
||||||
if ((new_size.x != size.x) || (new_size.y != size.y))
|
|
||||||
SetSize( new_size.x, new_size.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
if (multi_line)
|
if (multi_line)
|
||||||
gtk_widget_show(m_text);
|
gtk_widget_show(m_text);
|
||||||
|
|
||||||
|
@ -1634,9 +1634,6 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->m_delayedFont)
|
|
||||||
win->SetFont( win->GetFont() );
|
|
||||||
|
|
||||||
if (win->m_delayedBackgroundColour)
|
if (win->m_delayedBackgroundColour)
|
||||||
win->SetBackgroundColour( win->GetBackgroundColour() );
|
win->SetBackgroundColour( win->GetBackgroundColour() );
|
||||||
|
|
||||||
@ -2025,6 +2022,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2963,7 +2962,7 @@ GtkStyle *wxWindow::GetWidgetStyle()
|
|||||||
{
|
{
|
||||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||||
|
|
||||||
m_widgetStyle = gtk_style_copy( gtk_widget_get_style( m_widget ) );
|
m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
|
||||||
|
|
||||||
return m_widgetStyle;
|
return m_widgetStyle;
|
||||||
}
|
}
|
||||||
@ -2972,28 +2971,37 @@ void wxWindow::SetWidgetStyle()
|
|||||||
{
|
{
|
||||||
GtkStyle *style = GetWidgetStyle();
|
GtkStyle *style = GetWidgetStyle();
|
||||||
|
|
||||||
gdk_font_unref( style->font );
|
if (m_font != wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ))
|
||||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
{
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
if (m_foregroundColour.Ok())
|
||||||
{
|
{
|
||||||
m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
||||||
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
if (m_foregroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT))
|
||||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
{
|
||||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
||||||
|
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||||
|
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
||||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
if (m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE))
|
||||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
{
|
||||||
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||||
|
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||||
|
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,24 +111,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int x = 0; int y = 0;
|
|
||||||
wxFont new_font( parent->GetFont() );
|
|
||||||
GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
|
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1)
|
|
||||||
{
|
|
||||||
newSize.x = 12+x;
|
|
||||||
if (newSize.x < 80) newSize.x = 80;
|
|
||||||
}
|
|
||||||
if (newSize.y == -1)
|
|
||||||
{
|
|
||||||
newSize.y = 11+y;
|
|
||||||
if (newSize.y < 26) newSize.y = 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
@ -136,9 +118,23 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize best_size( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = best_size.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = best_size.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
|
SetSize( new_size );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -184,3 +180,11 @@ void wxButton::ApplyWidgetStyle()
|
|||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxButton::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
if (ret.x < 80) ret.x = 80;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -106,8 +106,6 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
m_widget = m_widgetCheckbox;
|
m_widget = m_widgetCheckbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
|
||||||
"clicked",
|
"clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||||
@ -117,9 +115,21 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -203,8 +213,7 @@ void wxCheckBox::OnInternalIdle()
|
|||||||
|
|
||||||
wxSize wxCheckBox::DoGetBestSize() const
|
wxSize wxCheckBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize( 25 + gdk_string_measure( m_widgetCheckbox->style->font,
|
return wxControl::DoGetBestSize();
|
||||||
m_label.mbc_str() ), 26 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,8 +90,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_option_menu_new();
|
m_widget = gtk_option_menu_new();
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
if ( style & wxCB_SORT )
|
if ( style & wxCB_SORT )
|
||||||
{
|
{
|
||||||
// if our m_strings != NULL, DoAppend() will check for it and insert
|
// if our m_strings != NULL, DoAppend() will check for it and insert
|
||||||
@ -112,9 +110,21 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -396,7 +406,10 @@ size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
|
|
||||||
wxSize wxChoice::DoGetBestSize() const
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
return wxSize(80, 26);
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
if (ret.x < 80) ret.x = 80;
|
||||||
|
ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' );
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,17 +101,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_acceptsFocus = TRUE;
|
m_acceptsFocus = TRUE;
|
||||||
|
|
||||||
wxSize newSize = size,
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
bestSize = DoGetBestSize();
|
|
||||||
|
|
||||||
if (newSize.x == -1)
|
|
||||||
newSize.x = bestSize.x;
|
|
||||||
if (newSize.y == -1)
|
|
||||||
newSize.y = bestSize.y;
|
|
||||||
if (newSize.y > 22)
|
|
||||||
newSize.y = 22;
|
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, newSize ) ||
|
|
||||||
!CreateBase( parent, id, pos, size, style, validator, name ))
|
!CreateBase( parent, id, pos, size, style, validator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxComboBox creation failed") );
|
wxFAIL_MSG( wxT("wxComboBox creation failed") );
|
||||||
@ -148,6 +138,8 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
ConnectWidget( GTK_COMBO(m_widget)->button );
|
ConnectWidget( GTK_COMBO(m_widget)->button );
|
||||||
|
|
||||||
if (!value.IsNull()) SetValue( value );
|
if (!value.IsNull()) SetValue( value );
|
||||||
@ -158,9 +150,19 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
|
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
|
||||||
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
|
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if (new_size.y > size_best.y)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
|
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -665,8 +667,9 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
|
|
||||||
wxSize wxComboBox::DoGetBestSize() const
|
wxSize wxComboBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
// totally bogus - should measure the strings in the combo!
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
return wxSize(100, 22);
|
if (ret.x < 100) ret.x = 100;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,6 +78,8 @@ wxMenuBar::wxMenuBar( long style )
|
|||||||
}
|
}
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuBar::wxMenuBar()
|
wxMenuBar::wxMenuBar()
|
||||||
@ -108,6 +110,8 @@ wxMenuBar::wxMenuBar()
|
|||||||
m_widget = GTK_WIDGET(m_menubar);
|
m_widget = GTK_WIDGET(m_menubar);
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
|
@ -213,7 +213,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
|
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,15 +230,17 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
if(m_windowStyle & wxNB_RIGHT)
|
if (m_windowStyle & wxNB_RIGHT)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
|
||||||
if(m_windowStyle & wxNB_LEFT)
|
if (m_windowStyle & wxNB_LEFT)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
|
||||||
if(m_windowStyle & wxNB_BOTTOM)
|
if (m_windowStyle & wxNB_BOTTOM)
|
||||||
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
|
gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
@ -625,6 +627,8 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
|
|||||||
|
|
||||||
void wxNotebook::ApplyWidgetStyle()
|
void wxNotebook::ApplyWidgetStyle()
|
||||||
{
|
{
|
||||||
|
// TODO, font for labels etc
|
||||||
|
|
||||||
SetWidgetStyle();
|
SetWidgetStyle();
|
||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,16 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
m_x+10, m_y+10+(i*24), 10, 10 );
|
m_x+10, m_y+10+(i*24), 10, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetLabel( title );
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
wxSize ls = LayoutItems();
|
wxSize ls = LayoutItems();
|
||||||
|
|
||||||
wxSize newSize = size;
|
wxSize newSize = size;
|
||||||
@ -187,15 +197,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
if (newSize.y == -1) newSize.y = ls.y;
|
if (newSize.y == -1) newSize.y = ls.y;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
|
||||||
|
|
||||||
PostCreation();
|
|
||||||
|
|
||||||
SetLabel( title );
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
|
@ -84,36 +84,31 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
wxRadioButton *chief = (wxRadioButton*) NULL;
|
wxRadioButton *chief = (wxRadioButton*) NULL;
|
||||||
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
wxWindowList::Node *node = parent->GetChildren().GetLast();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
|
||||||
wxWindow *child = node->GetData();
|
|
||||||
if (child->m_isRadioButton)
|
|
||||||
{
|
{
|
||||||
chief = (wxRadioButton*) child;
|
wxWindow *child = node->GetData();
|
||||||
if (child->HasFlag(wxRB_GROUP)) break;
|
if (child->m_isRadioButton)
|
||||||
}
|
{
|
||||||
node = node->GetPrevious();
|
chief = (wxRadioButton*) child;
|
||||||
|
if (child->HasFlag(wxRB_GROUP)) break;
|
||||||
|
}
|
||||||
|
node = node->GetPrevious();
|
||||||
}
|
}
|
||||||
if (chief)
|
if (chief)
|
||||||
{
|
{
|
||||||
/* we are part of the group started by chief */
|
/* we are part of the group started by chief */
|
||||||
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* start a new group */
|
/* start a new group */
|
||||||
m_radioButtonGroup = (GSList*) NULL;
|
m_radioButtonGroup = (GSList*) NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() );
|
||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
wxSize newSize = size;
|
|
||||||
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
|
||||||
if (newSize.y == -1) newSize.y = 26;
|
|
||||||
SetSize( newSize.x, newSize.y );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
@ -121,9 +116,21 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
@ -204,10 +211,15 @@ void wxRadioButton::OnInternalIdle()
|
|||||||
windows above so that checking for the current cursor is
|
windows above so that checking for the current cursor is
|
||||||
not possible. */
|
not possible. */
|
||||||
|
|
||||||
gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
|
gdk_window_set_cursor( GTK_TOGGLE_BUTTON(m_widget)->event_window, cursor.GetCursor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxRadioButton::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
return wxControl::DoGetBestSize();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,65 +76,78 @@ void wxSystemSettings::Done()
|
|||||||
|
|
||||||
wxColour wxSystemSettings::GetSystemColour( int index )
|
wxColour wxSystemSettings::GetSystemColour( int index )
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
|
||||||
case wxSYS_COLOUR_SCROLLBAR:
|
|
||||||
case wxSYS_COLOUR_BACKGROUND:
|
|
||||||
case wxSYS_COLOUR_ACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_INACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_MENU:
|
|
||||||
case wxSYS_COLOUR_WINDOWFRAME:
|
|
||||||
case wxSYS_COLOUR_ACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_INACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_BTNFACE:
|
|
||||||
{
|
{
|
||||||
if (!g_systemBtnFaceColour)
|
case wxSYS_COLOUR_SCROLLBAR:
|
||||||
{
|
case wxSYS_COLOUR_BACKGROUND:
|
||||||
g_systemBtnFaceColour =
|
case wxSYS_COLOUR_ACTIVECAPTION:
|
||||||
new wxColour( 0xd6d6 >> SHIFT,
|
case wxSYS_COLOUR_INACTIVECAPTION:
|
||||||
0xd6d6 >> SHIFT,
|
case wxSYS_COLOUR_MENU:
|
||||||
0xd6d6 >> SHIFT );
|
case wxSYS_COLOUR_WINDOWFRAME:
|
||||||
}
|
case wxSYS_COLOUR_ACTIVEBORDER:
|
||||||
return *g_systemBtnFaceColour;
|
case wxSYS_COLOUR_INACTIVEBORDER:
|
||||||
}
|
case wxSYS_COLOUR_BTNFACE:
|
||||||
case wxSYS_COLOUR_WINDOW:
|
{
|
||||||
{
|
if (!g_systemBtnFaceColour)
|
||||||
return *wxWHITE;
|
{
|
||||||
}
|
g_systemBtnFaceColour =
|
||||||
case wxSYS_COLOUR_GRAYTEXT:
|
new wxColour( 0xd6d6 >> SHIFT,
|
||||||
case wxSYS_COLOUR_BTNSHADOW:
|
0xd6d6 >> SHIFT,
|
||||||
{
|
0xd6d6 >> SHIFT );
|
||||||
if (!g_systemBtnShadowColour)
|
}
|
||||||
{
|
return *g_systemBtnFaceColour;
|
||||||
g_systemBtnShadowColour =
|
}
|
||||||
new wxColour( 0x7530 >> SHIFT,
|
case wxSYS_COLOUR_WINDOW:
|
||||||
0x7530 >> SHIFT,
|
{
|
||||||
0x7530 >> SHIFT );
|
return *wxWHITE;
|
||||||
}
|
}
|
||||||
return *g_systemBtnShadowColour;
|
case wxSYS_COLOUR_GRAYTEXT:
|
||||||
}
|
case wxSYS_COLOUR_BTNSHADOW:
|
||||||
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
{
|
||||||
{
|
if (!g_systemBtnShadowColour)
|
||||||
if (!g_systemBtnHighlightColour)
|
{
|
||||||
{
|
g_systemBtnShadowColour =
|
||||||
g_systemBtnHighlightColour =
|
new wxColour( 0x7530 >> SHIFT,
|
||||||
new wxColour( 0xea60 >> SHIFT,
|
0x7530 >> SHIFT,
|
||||||
0xea60 >> SHIFT,
|
0x7530 >> SHIFT );
|
||||||
0xea60 >> SHIFT );
|
}
|
||||||
}
|
return *g_systemBtnShadowColour;
|
||||||
return *g_systemBtnHighlightColour;
|
}
|
||||||
}
|
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
||||||
case wxSYS_COLOUR_HIGHLIGHT:
|
{
|
||||||
{
|
if (!g_systemBtnHighlightColour)
|
||||||
if (!g_systemHighlightColour)
|
{
|
||||||
{
|
g_systemBtnHighlightColour =
|
||||||
g_systemHighlightColour =
|
new wxColour( 0xea60 >> SHIFT,
|
||||||
new wxColour( 0 >> SHIFT,
|
0xea60 >> SHIFT,
|
||||||
0 >> SHIFT,
|
0xea60 >> SHIFT );
|
||||||
0x9c40 >> SHIFT );
|
}
|
||||||
}
|
return *g_systemBtnHighlightColour;
|
||||||
return *g_systemHighlightColour;
|
}
|
||||||
}
|
case wxSYS_COLOUR_HIGHLIGHT:
|
||||||
|
{
|
||||||
|
if (!g_systemHighlightColour)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
g_systemHighlightColour =
|
||||||
|
new wxColour( 0 >> SHIFT,
|
||||||
|
0 >> SHIFT,
|
||||||
|
0x9c40 >> SHIFT );
|
||||||
|
*/
|
||||||
|
GtkWidget *widget = gtk_button_new();
|
||||||
|
GtkStyle *def = gtk_rc_get_style( widget );
|
||||||
|
int red = def->bg[GTK_STATE_SELECTED].red;
|
||||||
|
int green = def->bg[GTK_STATE_SELECTED].green;
|
||||||
|
int blue = def->bg[GTK_STATE_SELECTED].blue;
|
||||||
|
gtk_widget_destroy( widget );
|
||||||
|
|
||||||
|
g_systemHighlightColour =
|
||||||
|
new wxColour( red >> SHIFT,
|
||||||
|
green >> SHIFT,
|
||||||
|
blue >> SHIFT );
|
||||||
|
}
|
||||||
|
return *g_systemHighlightColour;
|
||||||
|
}
|
||||||
case wxSYS_COLOUR_MENUTEXT:
|
case wxSYS_COLOUR_MENUTEXT:
|
||||||
case wxSYS_COLOUR_WINDOWTEXT:
|
case wxSYS_COLOUR_WINDOWTEXT:
|
||||||
case wxSYS_COLOUR_CAPTIONTEXT:
|
case wxSYS_COLOUR_CAPTIONTEXT:
|
||||||
@ -173,7 +186,7 @@ wxFont wxSystemSettings::GetSystemFont( int index )
|
|||||||
case wxSYS_DEFAULT_GUI_FONT:
|
case wxSYS_DEFAULT_GUI_FONT:
|
||||||
{
|
{
|
||||||
if (!g_systemFont)
|
if (!g_systemFont)
|
||||||
g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
|
g_systemFont = new wxFont( 16, wxSWISS, wxNORMAL, wxNORMAL );
|
||||||
return *g_systemFont;
|
return *g_systemFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,24 +88,28 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
m_widget = gtk_spin_button_new( m_adjust, 1, 0 );
|
||||||
|
|
||||||
wxSize new_size = size,
|
|
||||||
sizeBest = DoGetBestSize();
|
|
||||||
if (new_size.x == -1)
|
|
||||||
new_size.x = sizeBest.x;
|
|
||||||
if (new_size.y == -1)
|
|
||||||
new_size.y = sizeBest.y;
|
|
||||||
|
|
||||||
if ((new_size.x != size.x) || (new_size.y != size.y))
|
|
||||||
SetSize( new_size.x, new_size.y );
|
|
||||||
|
|
||||||
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
|
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
|
||||||
(int)(m_windowStyle & wxSP_WRAP) );
|
(int)(m_windowStyle & wxSP_WRAP) );
|
||||||
|
|
||||||
GtkEnableEvents();
|
GtkEnableEvents();
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
|
|
||||||
SetValue( value );
|
SetValue( value );
|
||||||
|
@ -45,7 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
|
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isStaticBox = TRUE;
|
m_isStaticBox = TRUE;
|
||||||
@ -61,9 +61,13 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
|
@ -62,8 +62,6 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( m_label.mbc_str() );
|
m_widget = gtk_label_new( m_label.mbc_str() );
|
||||||
|
|
||||||
wxControl::SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
justify = GTK_JUSTIFY_CENTER;
|
justify = GTK_JUSTIFY_CENTER;
|
||||||
@ -80,12 +78,23 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
// do not move this call elsewhere
|
// do not move this call elsewhere
|
||||||
gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
|
gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
|
||||||
|
|
||||||
SetSizeOrDefault( size );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
|
wxControl::SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
@ -192,20 +192,21 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
m_text = gtk_entry_new();
|
m_text = gtk_entry_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize new_size = size,
|
|
||||||
sizeBest = DoGetBestSize();
|
|
||||||
if (new_size.x == -1)
|
|
||||||
new_size.x = sizeBest.x;
|
|
||||||
if (new_size.y == -1)
|
|
||||||
new_size.y = sizeBest.y;
|
|
||||||
|
|
||||||
if ((new_size.x != size.x) || (new_size.y != size.y))
|
|
||||||
SetSize( new_size.x, new_size.y );
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
|
wxSize size_best( DoGetBestSize() );
|
||||||
|
wxSize new_size( size );
|
||||||
|
if (new_size.x == -1)
|
||||||
|
new_size.x = size_best.x;
|
||||||
|
if (new_size.y == -1)
|
||||||
|
new_size.y = size_best.y;
|
||||||
|
if ((new_size.x != size.x) || (new_size.y != size.y))
|
||||||
|
SetSize( new_size.x, new_size.y );
|
||||||
|
|
||||||
if (multi_line)
|
if (multi_line)
|
||||||
gtk_widget_show(m_text);
|
gtk_widget_show(m_text);
|
||||||
|
|
||||||
|
@ -1634,9 +1634,6 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
|
|||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->m_delayedFont)
|
|
||||||
win->SetFont( win->GetFont() );
|
|
||||||
|
|
||||||
if (win->m_delayedBackgroundColour)
|
if (win->m_delayedBackgroundColour)
|
||||||
win->SetBackgroundColour( win->GetBackgroundColour() );
|
win->SetBackgroundColour( win->GetBackgroundColour() );
|
||||||
|
|
||||||
@ -2025,6 +2022,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2963,7 +2962,7 @@ GtkStyle *wxWindow::GetWidgetStyle()
|
|||||||
{
|
{
|
||||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||||
|
|
||||||
m_widgetStyle = gtk_style_copy( gtk_widget_get_style( m_widget ) );
|
m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
|
||||||
|
|
||||||
return m_widgetStyle;
|
return m_widgetStyle;
|
||||||
}
|
}
|
||||||
@ -2972,28 +2971,37 @@ void wxWindow::SetWidgetStyle()
|
|||||||
{
|
{
|
||||||
GtkStyle *style = GetWidgetStyle();
|
GtkStyle *style = GetWidgetStyle();
|
||||||
|
|
||||||
gdk_font_unref( style->font );
|
if (m_font != wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ))
|
||||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
{
|
||||||
|
gdk_font_unref( style->font );
|
||||||
|
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
if (m_foregroundColour.Ok())
|
||||||
{
|
{
|
||||||
m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
||||||
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
if (m_foregroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT))
|
||||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
{
|
||||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
|
||||||
|
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||||
|
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
|
||||||
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
if (m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE))
|
||||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
{
|
||||||
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
|
||||||
|
style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||||
|
style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user