コード例 #1
0
void wxBitmapButton::ChangeBackgroundColour()
{
    wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, true);

    // Must reset the bitmaps since the colours have changed.
    OnSetBitmap();
}
コード例 #2
0
ファイル: tglbtn.cpp プロジェクト: BloodRedd/gamekit
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;
}
コード例 #3
0
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;
}
コード例 #4
0
ファイル: tglbtn.cpp プロジェクト: vdm113/wxWidgets-ICC-patch
void wxToggleBitmapButton::SetLabel(const wxBitmap& label)
{
    wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));

    m_bitmap = label;
    InvalidateBestSize();

    OnSetBitmap();
}
コード例 #5
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
bool wxBitmapButton::Enable( bool enable )
{
    if ( !wxWindow::Enable(enable) )
        return false;

    OnSetBitmap();

    return true;
}
コード例 #6
0
void wxSkinWindow::setImageNormal(const wxImage &imageNormal, bool deriveDisabled)
{
	m_imageNormal = imageNormal;
	if(deriveDisabled)
		m_imageDisabled = imageNormal.ConvertToGreyscale();		
	else
		m_imageDisabled = imageNormal;
	
	OnSetBitmap();
}
コード例 #7
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
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;
}
コード例 #8
0
ファイル: tglbtn.cpp プロジェクト: vdm113/wxWidgets-ICC-patch
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;
}
コード例 #9
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
void wxBitmapButton::EndSelect()
{
    m_isSelected = false;
    OnSetBitmap();
}
コード例 #10
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
void wxBitmapButton::StartSelect()
{
    m_isSelected = true;
    OnSetBitmap();
}
コード例 #11
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
void wxBitmapButton::GTKSetNotFocus()
{
    m_hasFocus = false;
    OnSetBitmap();
}
コード例 #12
0
ファイル: bmpbuttn.cpp プロジェクト: chromylei/third_party
void wxBitmapButton::GTKSetHasFocus()
{
    m_hasFocus = true;
    OnSetBitmap();
}
コード例 #13
0
void wxSkinWindow::setImageDisabled(const wxImage &imageDisabled)
{
	m_imageDisabled = imageDisabled;
	OnSetBitmap();
}
コード例 #14
0
void wxSkinWindow::setImageOver(const wxImage &imageOver)
{
	m_imageOver = imageOver;
	OnSetBitmap();
}
コード例 #15
0
void wxSkinWindow::setImageFocus(const wxImage &imageFocus)
{
	m_imageFocus = imageFocus;
	OnSetBitmap();
}