Corrected bmpbutton size
added wxNO_BORDER style to button classes added WMclass and WMname strings to dialogs and frames added flag to scroll sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2a4f27f209
commit
de1c750f7e
@ -77,12 +77,12 @@ END_EVENT_TABLE()
|
||||
|
||||
MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos, const wxSize &size )
|
||||
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER )
|
||||
: wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER | wxTAB_TRAVERSAL )
|
||||
{
|
||||
|
||||
// (void) new wxButton( this, -1, "wxButton", wxPoint(10,10) );
|
||||
(void) new wxButton( this, -1, "wxButton", wxPoint(10,10) );
|
||||
|
||||
// (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,50) );
|
||||
(void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,50) );
|
||||
|
||||
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,90) );
|
||||
|
||||
@ -95,9 +95,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
"examples."
|
||||
};
|
||||
|
||||
// (void) new wxComboBox( this, -1, "This", wxPoint(10,130), wxDefaultSize, 5, choices );
|
||||
(void) new wxComboBox( this, -1, "This", wxPoint(10,130), wxDefaultSize, 5, choices );
|
||||
|
||||
// (void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices );
|
||||
(void) new wxRadioBox( this, -1, "This", wxPoint(10,200), wxDefaultSize, 5, choices );
|
||||
}
|
||||
|
||||
MyCanvas::~MyCanvas()
|
||||
|
@ -131,6 +131,11 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
|
||||
m_widget = gtk_button_new();
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (style & wxNO_BORDER)
|
||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||
#endif
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
@ -141,8 +146,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
|
||||
}
|
||||
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
|
||||
int border = 10;
|
||||
if (style & wxNO_BORDER) border = 4;
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth()+border;
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight()+border;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
@ -202,25 +209,25 @@ void wxBitmapButton::SetBitmap()
|
||||
|
||||
wxBitmap the_one;
|
||||
|
||||
if ( ! m_isEnabled )
|
||||
if (!m_isEnabled)
|
||||
the_one = m_disabled;
|
||||
else
|
||||
{
|
||||
if ( m_isSelected )
|
||||
if (m_isSelected)
|
||||
{
|
||||
the_one = m_selected;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_hasFocus )
|
||||
if (m_hasFocus)
|
||||
the_one = m_focus;
|
||||
else
|
||||
the_one = m_bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! the_one.Ok() ) the_one = m_bitmap;
|
||||
if ( ! the_one.Ok() ) return;
|
||||
if (!the_one.Ok()) the_one = m_bitmap;
|
||||
if (!the_one.Ok()) return;
|
||||
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child );
|
||||
|
@ -80,7 +80,13 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_button_new_with_label( m_label.mbc_str() );
|
||||
m_widget = gtk_button_new_with_label( "" );
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (style & wxNO_BORDER)
|
||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||
#endif
|
||||
|
||||
SetLabel(label);
|
||||
|
||||
if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
||||
|
@ -212,9 +212,11 @@ bool wxDialog::Create( wxWindow *parent,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||
|
||||
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
|
||||
if (!name.IsEmpty())
|
||||
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
|
||||
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
|
||||
|
@ -370,6 +370,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
|
||||
m_widget = gtk_window_new( win_type );
|
||||
|
||||
if (!name.IsEmpty())
|
||||
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
debug_focus_in( m_widget, _T("wxFrame::m_widget"), name );
|
||||
#endif
|
||||
|
@ -131,6 +131,11 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
|
||||
m_widget = gtk_button_new();
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (style & wxNO_BORDER)
|
||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||
#endif
|
||||
|
||||
if (m_bitmap.Ok())
|
||||
{
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
@ -141,8 +146,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
||||
gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
|
||||
}
|
||||
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
|
||||
int border = 10;
|
||||
if (style & wxNO_BORDER) border = 4;
|
||||
if (newSize.x == -1) newSize.x = m_bitmap.GetWidth()+border;
|
||||
if (newSize.y == -1) newSize.y = m_bitmap.GetHeight()+border;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||
@ -202,25 +209,25 @@ void wxBitmapButton::SetBitmap()
|
||||
|
||||
wxBitmap the_one;
|
||||
|
||||
if ( ! m_isEnabled )
|
||||
if (!m_isEnabled)
|
||||
the_one = m_disabled;
|
||||
else
|
||||
{
|
||||
if ( m_isSelected )
|
||||
if (m_isSelected)
|
||||
{
|
||||
the_one = m_selected;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_hasFocus )
|
||||
if (m_hasFocus)
|
||||
the_one = m_focus;
|
||||
else
|
||||
the_one = m_bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! the_one.Ok() ) the_one = m_bitmap;
|
||||
if ( ! the_one.Ok() ) return;
|
||||
if (!the_one.Ok()) the_one = m_bitmap;
|
||||
if (!the_one.Ok()) return;
|
||||
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child );
|
||||
|
@ -80,7 +80,13 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
||||
|
||||
SetValidator( validator );
|
||||
|
||||
m_widget = gtk_button_new_with_label( m_label.mbc_str() );
|
||||
m_widget = gtk_button_new_with_label( "" );
|
||||
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
if (style & wxNO_BORDER)
|
||||
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
|
||||
#endif
|
||||
|
||||
SetLabel(label);
|
||||
|
||||
if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() );
|
||||
|
@ -212,9 +212,11 @@ bool wxDialog::Create( wxWindow *parent,
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
|
||||
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||
|
||||
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
|
||||
if (!name.IsEmpty())
|
||||
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
|
||||
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
|
||||
|
@ -370,6 +370,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
|
||||
m_widget = gtk_window_new( win_type );
|
||||
|
||||
if (!name.IsEmpty())
|
||||
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
debug_focus_in( m_widget, _T("wxFrame::m_widget"), name );
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user