void wxBitmapButton::ChangeBackgroundColour() { wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, true); // Must reset the bitmaps since the colours have changed. OnSetBitmap(); }
bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name) { if (!PreCreation(parent, pos, size) || !CreateBase(parent, id, pos, size, style, validator, name )) { wxFAIL_MSG(wxT("wxBitmapToggleButton creation failed")); return false; } // Create the gtk widget. m_widget = gtk_toggle_button_new(); g_object_ref(m_widget); if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); m_bitmap = label; OnSetBitmap(); g_signal_connect (m_widget, "clicked", G_CALLBACK (gtk_togglebutton_clicked_callback), this); m_parent->DoAddChild(this); PostCreation(size); return true; }
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; PreCreation(); m_bitmaps[State_Normal] = m_bitmapsOriginal[State_Normal] = bitmap; m_bitmaps[State_Pressed] = m_bitmapsOriginal[State_Pressed] = bitmap; Widget parentWidget = (Widget) parent->GetClientWidget(); /* * Patch Note (important) * There is no major reason to put a defaultButtonThickness here. * Not requesting it give the ability to put wxButton with a spacing * as small as requested. However, if some button become a DefaultButton, * other buttons are no more aligned -- This is why we set * defaultButtonThickness of ALL buttons belonging to the same wxPanel, * in the ::SetDefaultButton method. */ Widget buttonWidget = XtVaCreateManagedWidget ("button", // Gadget causes problems for default button operation. #if wxUSE_GADGETS xmPushButtonGadgetClass, parentWidget, #else xmPushButtonWidgetClass, parentWidget, #endif // See comment for wxButton::SetDefault // XmNdefaultButtonShadowThickness, 1, XmNrecomputeSize, False, NULL); m_mainWidget = (WXWidget) buttonWidget; XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback, (XtPointer) this); wxSize best = GetBitmapLabel().IsOk() ? GetBestSize() : wxSize(30, 30); if( size.x != -1 ) best.x = size.x; if( size.y != -1 ) best.y = size.y; PostCreation(); OnSetBitmap(); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, best.x, best.y); return true; }
void wxToggleBitmapButton::SetLabel(const wxBitmap& label) { wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); m_bitmap = label; InvalidateBestSize(); OnSetBitmap(); }
bool wxBitmapButton::Enable( bool enable ) { if ( !wxWindow::Enable(enable) ) return false; OnSetBitmap(); return true; }
void wxSkinWindow::setImageNormal(const wxImage &imageNormal, bool deriveDisabled) { m_imageNormal = imageNormal; if(deriveDisabled) m_imageDisabled = imageNormal.ConvertToGreyscale(); else m_imageDisabled = imageNormal; OnSetBitmap(); }
bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString &name ) { m_needParent = true; m_acceptsFocus = true; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxBitmapButton creation failed") ); return false; } m_bitmaps[State_Normal] = bitmap; m_widget = gtk_button_new(); if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); if (bitmap.IsOk()) { OnSetBitmap(); } gtk_signal_connect_after( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "enter", GTK_SIGNAL_FUNC(gtk_bmpbutton_enter_callback), (gpointer*)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "leave", GTK_SIGNAL_FUNC(gtk_bmpbutton_leave_callback), (gpointer*)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "pressed", GTK_SIGNAL_FUNC(gtk_bmpbutton_press_callback), (gpointer*)this ); gtk_signal_connect( GTK_OBJECT(m_widget), "released", GTK_SIGNAL_FUNC(gtk_bmpbutton_release_callback), (gpointer*)this ); m_parent->DoAddChild( this ); PostCreation(size); return true; }
bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name) { m_needParent = true; m_acceptsFocus = true; m_blockEvent = false; if (!PreCreation(parent, pos, size) || !CreateBase(parent, id, pos, size, style, validator, name )) { wxFAIL_MSG(wxT("wxToggleBitmapButton creation failed")); return false; } m_bitmap = label; // Create the gtk widget. m_widget = gtk_toggle_button_new(); if (style & wxNO_BORDER) gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); if (m_bitmap.IsOk()) { OnSetBitmap(); } gtk_signal_connect(GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_togglebutton_clicked_callback), (gpointer *)this); m_parent->DoAddChild(this); PostCreation(size); return true; }
void wxBitmapButton::EndSelect() { m_isSelected = false; OnSetBitmap(); }
void wxBitmapButton::StartSelect() { m_isSelected = true; OnSetBitmap(); }
void wxBitmapButton::GTKSetNotFocus() { m_hasFocus = false; OnSetBitmap(); }
void wxBitmapButton::GTKSetHasFocus() { m_hasFocus = true; OnSetBitmap(); }
void wxSkinWindow::setImageDisabled(const wxImage &imageDisabled) { m_imageDisabled = imageDisabled; OnSetBitmap(); }
void wxSkinWindow::setImageOver(const wxImage &imageOver) { m_imageOver = imageOver; OnSetBitmap(); }
void wxSkinWindow::setImageFocus(const wxImage &imageFocus) { m_imageFocus = imageFocus; OnSetBitmap(); }