X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1169a91932273bc84c23ed9dbd0a2da064d59d66..9d8fe14a97d1092989eecbe43c4e1f730fba17ad:/src/motif/bmpbuttn.cpp diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp index 6816a08456..5e94188ba4 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,16 +9,13 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "bmpbuttn.h" -#endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #ifdef __VMS #define XtScreen XTSCREEN #endif -#include "wx/defs.h" - #include "wx/bmpbuttn.h" #ifdef __VMS__ @@ -39,16 +36,6 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr); IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) -wxBitmapButtonBase::wxBitmapButtonBase() - : m_bmpNormal(), - m_bmpSelected(), - m_bmpFocus(), - m_bmpDisabled(), - m_marginX(0), - m_marginY(0) -{ -} - wxBitmapButton::wxBitmapButton() { m_marginX = m_marginY = wxDEFAULT_BUTTON_MARGIN; @@ -64,6 +51,7 @@ 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; @@ -88,18 +76,12 @@ 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); @@ -108,10 +90,13 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, 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() @@ -137,13 +122,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) { @@ -151,7 +136,7 @@ void wxBitmapButton::SetBitmapDisabled(const wxBitmap& disabled) m_bmpDisabledOriginal = disabled; DoSetBitmap(); -}; +} void wxBitmapButton::DoSetBitmap() { @@ -165,7 +150,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); @@ -190,7 +175,7 @@ void wxBitmapButton::DoSetBitmap() { if (m_bmpDisabledOriginal.GetMask()) { - int backgroundPixel; + WXPixel backgroundPixel; XtVaGetValues((Widget) m_mainWidget, XmNbackground, &backgroundPixel, NULL); @@ -215,7 +200,7 @@ void wxBitmapButton::DoSetBitmap() { if (m_bmpSelectedOriginal.GetMask()) { - int backgroundPixel; + WXPixel backgroundPixel; XtVaGetValues((Widget) m_mainWidget, XmNarmColor, &backgroundPixel, NULL); @@ -257,7 +242,7 @@ void wxBitmapButton::DoSetBitmap() void wxBitmapButton::ChangeBackgroundColour() { - wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE); + wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, true); // Must reset the bitmaps since the colours have changed. DoSetBitmap(); @@ -276,4 +261,3 @@ wxSize wxBitmapButton::DoGetBestSize() const return ret; } -