// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
}
//-----------------------------------------------------------------------------
// "enter"
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
// "enter"
//-----------------------------------------------------------------------------
static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
}
//-----------------------------------------------------------------------------
// "leave"
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
// "leave"
//-----------------------------------------------------------------------------
static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
}
//-----------------------------------------------------------------------------
// "pressed"
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
// "pressed"
//-----------------------------------------------------------------------------
static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
//-----------------------------------------------------------------------------
// "released"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// "released"
//-----------------------------------------------------------------------------
static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
if (!button->m_hasVMT) return;
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxBitmapButton creation failed") );
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxBitmapButton creation failed") );
m_widget = gtk_button_new();
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
m_widget = gtk_button_new();
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
- wxSize newSize = size;
- int border = (style & wxNO_BORDER) ? 4 : 10;
- if (newSize.x == -1)
- newSize.x = m_bmpNormal.GetWidth()+border;
- if (newSize.y == -1)
- newSize.y = m_bmpNormal.GetHeight()+border;
- SetSize( newSize.x, newSize.y );
GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "enter",
GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "enter",
- return TRUE;
-}
-
-void wxBitmapButton::SetDefault()
-{
- GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
- gtk_widget_grab_default( m_widget );
-
- SetSize( m_x, m_y, m_width, m_height );
-wxString wxBitmapButton::GetLabel() const
-{
- wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid button") );
-
- return wxControl::GetLabel();
-}
-
-void wxBitmapButton::ApplyWidgetStyle()
+void wxBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
}
void wxBitmapButton::OnSetBitmap()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
}
void wxBitmapButton::OnSetBitmap()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
- if (!the_one.Ok()) the_one = m_bmpNormal;
- if (!the_one.Ok()) return;
-
- GdkBitmap *mask = (GdkBitmap *) NULL;
+ wxBitmap the_one;
+ if (!IsThisEnabled())
+ the_one = GetBitmapDisabled();
+ else if (m_isSelected)
+ the_one = GetBitmapPressed();
+ else if (HasFocus())
+ the_one = GetBitmapFocus();
+
+ if (!the_one.IsOk())
+ {
+ the_one = GetBitmapLabel();
+ if (!the_one.IsOk())
+ return;
+ }
+
+ GdkBitmap *mask = NULL;
if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap();
GtkWidget *child = BUTTON_CHILD(m_widget);
if (child == NULL)
{
// initial bitmap
if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap();
GtkWidget *child = BUTTON_CHILD(m_widget);
if (child == NULL)
{
// initial bitmap
- GtkPixmap *g_pixmap = GTK_PIXMAP(child);
- gtk_pixmap_set(g_pixmap, the_one.GetPixmap(), mask);
+ GtkPixmap *pixmap = GTK_PIXMAP(child);
+ gtk_pixmap_set(pixmap, the_one.GetPixmap(), mask);