Correct the wxButton::Setlabel nonsense
Added wxFrame::SetClientSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -63,6 +63,7 @@ public:
|
||||
virtual void Enable( bool enable );
|
||||
|
||||
virtual void GetClientSize( int *width, int *height ) const;
|
||||
virtual void SetClientSize( int const width, int const height );
|
||||
|
||||
// set minimal/maxmimal size for the frame
|
||||
virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
virtual void Enable( bool enable );
|
||||
|
||||
virtual void GetClientSize( int *width, int *height ) const;
|
||||
virtual void SetClientSize( int const width, int const height );
|
||||
|
||||
// set minimal/maxmimal size for the frame
|
||||
virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
|
||||
|
@@ -65,8 +65,8 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
|
||||
PreCreation( parent, id, pos, newSize, style, name );
|
||||
|
||||
SetLabel(label);
|
||||
m_widget = gtk_button_new_with_label( m_label );
|
||||
SetLabel(label);
|
||||
|
||||
if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
@@ -89,7 +89,7 @@ void wxButton::SetDefault(void)
|
||||
void wxButton::SetLabel( const wxString &label )
|
||||
{
|
||||
wxControl::SetLabel( label );
|
||||
GtkBin *bin = GTK_BIN( m_widget );
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkLabel *g_label = GTK_LABEL( bin->child );
|
||||
gtk_label_set( g_label, GetLabel() );
|
||||
};
|
||||
|
@@ -38,6 +38,7 @@ void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
|
||||
|
||||
void wxControl::SetLabel( const wxString &label )
|
||||
{
|
||||
m_label = "";
|
||||
for ( const char *pc = label; *pc != '\0'; pc++ ) {
|
||||
if ( *pc == '&' ) {
|
||||
pc++; // skip it
|
||||
@@ -47,7 +48,6 @@ void wxControl::SetLabel( const wxString &label )
|
||||
#endif
|
||||
}
|
||||
|
||||
m_label = "";
|
||||
m_label << *pc;
|
||||
}
|
||||
};
|
||||
|
@@ -226,6 +226,20 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
};
|
||||
};
|
||||
|
||||
void wxFrame::SetClientSize( int const width, int const height )
|
||||
{
|
||||
int h = height;
|
||||
if (m_frameMenuBar) h += wxMENU_HEIGHT;
|
||||
if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
int y = 0;
|
||||
m_frameToolBar->GetSize( NULL, &y );
|
||||
h += y;
|
||||
}
|
||||
wxWindow::SetClientSize( width, h );
|
||||
};
|
||||
|
||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||
{
|
||||
// due to a bug in gtk, x,y are always 0
|
||||
|
@@ -65,8 +65,8 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
|
||||
PreCreation( parent, id, pos, newSize, style, name );
|
||||
|
||||
SetLabel(label);
|
||||
m_widget = gtk_button_new_with_label( m_label );
|
||||
SetLabel(label);
|
||||
|
||||
if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label );
|
||||
if (newSize.y == -1) newSize.y = 26;
|
||||
@@ -89,7 +89,7 @@ void wxButton::SetDefault(void)
|
||||
void wxButton::SetLabel( const wxString &label )
|
||||
{
|
||||
wxControl::SetLabel( label );
|
||||
GtkBin *bin = GTK_BIN( m_widget );
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkLabel *g_label = GTK_LABEL( bin->child );
|
||||
gtk_label_set( g_label, GetLabel() );
|
||||
};
|
||||
|
@@ -38,6 +38,7 @@ void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
|
||||
|
||||
void wxControl::SetLabel( const wxString &label )
|
||||
{
|
||||
m_label = "";
|
||||
for ( const char *pc = label; *pc != '\0'; pc++ ) {
|
||||
if ( *pc == '&' ) {
|
||||
pc++; // skip it
|
||||
@@ -47,7 +48,6 @@ void wxControl::SetLabel( const wxString &label )
|
||||
#endif
|
||||
}
|
||||
|
||||
m_label = "";
|
||||
m_label << *pc;
|
||||
}
|
||||
};
|
||||
|
@@ -226,6 +226,20 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
};
|
||||
};
|
||||
|
||||
void wxFrame::SetClientSize( int const width, int const height )
|
||||
{
|
||||
int h = height;
|
||||
if (m_frameMenuBar) h += wxMENU_HEIGHT;
|
||||
if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
int y = 0;
|
||||
m_frameToolBar->GetSize( NULL, &y );
|
||||
h += y;
|
||||
}
|
||||
wxWindow::SetClientSize( width, h );
|
||||
};
|
||||
|
||||
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
|
||||
{
|
||||
// due to a bug in gtk, x,y are always 0
|
||||
|
Reference in New Issue
Block a user