X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aae91497f6ac36a76d3313cf405cae0f098ea1d1..deb0c40261cfc5e4ac3f84782da48eaad40cc5d2:/src/motif/bmpbuttn.cpp diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp index d252d26a56..9ebada34b8 100644 --- a/src/motif/bmpbuttn.cpp +++ b/src/motif/bmpbuttn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.cpp +// Name: src/motif/bmpbuttn.cpp // Purpose: wxBitmapButton // Author: Julian Smart // Modified by: @@ -9,15 +9,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "bmpbuttn.h" -#endif - -#ifdef __VMS -#define XtScreen XTSCREEN -#endif - -#include "wx/defs.h" +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/bmpbuttn.h" @@ -54,17 +47,11 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, { if( !CreateControl( parent, id, pos, size, style, validator, name ) ) return false; + PreCreation(); m_bmpNormal = m_bmpNormalOriginal = bitmap; m_bmpSelected = m_bmpSelectedOriginal = bitmap; - /* - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - */ - Widget parentWidget = (Widget) parent->GetClientWidget(); /* @@ -85,32 +72,27 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, xmPushButtonWidgetClass, parentWidget, #endif // See comment for wxButton::SetDefault - // XmNdefaultButtonShadowThickness, 1, + // XmNdefaultButtonShadowThickness, 1, XmNrecomputeSize, False, NULL); m_mainWidget = (WXWidget) buttonWidget; - ChangeFont(FALSE); - - ChangeBackgroundColour (); - - DoSetBitmap(); - XtAddCallback (buttonWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback, (XtPointer) this); - SetCanAddEventHandler(TRUE); - wxSize best = m_bmpNormal.Ok() ? GetBestSize() : wxSize(30, 30); if( size.x != -1 ) best.x = size.x; if( size.y != -1 ) best.y = size.y; + PostCreation(); + DoSetBitmap(); + AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, best.x, best.y); - return TRUE; + return true; } wxBitmapButton::~wxBitmapButton() @@ -136,13 +118,13 @@ void wxBitmapButton::SetBitmapSelected(const wxBitmap& sel) m_bmpSelectedOriginal = sel; DoSetBitmap(); -}; +} void wxBitmapButton::SetBitmapFocus(const wxBitmap& focus) { m_bmpFocus = focus; // Not used in Motif -}; +} void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled) { @@ -150,7 +132,7 @@ void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled) m_bmpDisabledOriginal = disabled; DoSetBitmap(); -}; +} void wxBitmapButton::DoSetBitmap() { @@ -164,7 +146,7 @@ void wxBitmapButton::DoSetBitmap() // in the current widget background colour. if (m_bmpNormalOriginal.GetMask()) { - int backgroundPixel; + WXPixel backgroundPixel; XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel, NULL); @@ -177,7 +159,7 @@ void wxBitmapButton::DoSetBitmap() m_bmpNormal = newBitmap; m_bitmapCache.SetBitmap( m_bmpNormal ); - pixmap = (Pixmap) m_bmpNormal.GetPixmap(); + pixmap = (Pixmap) m_bmpNormal.GetDrawable(); } else { @@ -189,7 +171,7 @@ void wxBitmapButton::DoSetBitmap() { if (m_bmpDisabledOriginal.GetMask()) { - int backgroundPixel; + WXPixel backgroundPixel; XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel, NULL); @@ -201,7 +183,7 @@ void wxBitmapButton::DoSetBitmap() wxCreateMaskedBitmap(m_bmpDisabledOriginal, col); m_bmpDisabled = newBitmap; - insensPixmap = (Pixmap) m_bmpDisabled.GetPixmap(); + insensPixmap = (Pixmap) m_bmpDisabled.GetDrawable(); } else insensPixmap = (Pixmap) m_bitmapCache.GetInsensPixmap(m_mainWidget); @@ -214,7 +196,7 @@ void wxBitmapButton::DoSetBitmap() { if (m_bmpSelectedOriginal.GetMask()) { - int backgroundPixel; + WXPixel backgroundPixel; XtVaGetValues((Widget) m_mainWidget, XmNarmColor, &backgroundPixel, NULL); @@ -226,7 +208,7 @@ void wxBitmapButton::DoSetBitmap() wxCreateMaskedBitmap(m_bmpSelectedOriginal, col); m_bmpSelected = newBitmap; - armPixmap = (Pixmap) m_bmpSelected.GetPixmap(); + armPixmap = (Pixmap) m_bmpSelected.GetDrawable(); } else armPixmap = (Pixmap) m_bitmapCache.GetArmPixmap(m_mainWidget); @@ -234,16 +216,6 @@ void wxBitmapButton::DoSetBitmap() else armPixmap = (Pixmap) m_bitmapCache.GetArmPixmap(m_mainWidget); -#if 0 - // <- the Get...Pixmap()-functions return the same pixmap! - if (insensPixmap == pixmap) - { - insensPixmap = - XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), pixmap); - m_insensPixmap = (WXPixmap) insensPixmap; - } -#endif - XtVaSetValues ((Widget) m_mainWidget, XmNlabelPixmap, pixmap, XmNlabelInsensitivePixmap, insensPixmap, @@ -266,7 +238,7 @@ void wxBitmapButton::DoSetBitmap() void wxBitmapButton::ChangeBackgroundColour() { - DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE); + wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, true); // Must reset the bitmaps since the colours have changed. DoSetBitmap(); @@ -285,4 +257,3 @@ wxSize wxBitmapButton::DoGetBestSize() const return ret; } -