X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea9868e8d269fa4a72b6af725b048a7eb4fb8728..a83ea9c15a7ac7bbdc6686164cfcbbc21ae5031a:/src/motif/bmpbuttn.cpp diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp index 3bb0990002..d684d7b77b 100644 --- a/src/motif/bmpbuttn.cpp +++ b/src/motif/bmpbuttn.cpp @@ -9,10 +9,13 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#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 @@ -35,7 +38,7 @@ // Implemented in button.cpp void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr); -Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); +// Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) @@ -58,13 +61,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, 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(); /* @@ -101,8 +97,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, 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; @@ -175,11 +169,15 @@ void wxBitmapButton::DoSetBitmap() wxBitmap newBitmap = wxCreateMaskedBitmap(m_bmpNormalOriginal, col); m_bmpNormal = newBitmap; + m_bitmapCache.SetBitmap( m_bmpNormal ); - pixmap = (Pixmap) m_bmpNormal.GetPixmap(); + pixmap = (Pixmap) m_bmpNormal.GetDrawable(); } else - pixmap = (Pixmap) m_bmpNormal.GetLabelPixmap(m_mainWidget); + { + m_bitmapCache.SetBitmap( m_bmpNormal ); + pixmap = (Pixmap) m_bitmapCache.GetLabelPixmap(m_mainWidget); + } if (m_bmpDisabledOriginal.Ok()) { @@ -197,13 +195,13 @@ void wxBitmapButton::DoSetBitmap() wxCreateMaskedBitmap(m_bmpDisabledOriginal, col); m_bmpDisabled = newBitmap; - insensPixmap = (Pixmap) m_bmpDisabled.GetPixmap(); + insensPixmap = (Pixmap) m_bmpDisabled.GetDrawable(); } else - insensPixmap = (Pixmap) m_bmpNormal.GetInsensPixmap(m_mainWidget); + insensPixmap = (Pixmap) m_bitmapCache.GetInsensPixmap(m_mainWidget); } else - insensPixmap = (Pixmap) m_bmpNormal.GetInsensPixmap(m_mainWidget); + insensPixmap = (Pixmap) m_bitmapCache.GetInsensPixmap(m_mainWidget); // Now make the bitmap representing the armed state if (m_bmpSelectedOriginal.Ok()) @@ -222,21 +220,13 @@ void wxBitmapButton::DoSetBitmap() wxCreateMaskedBitmap(m_bmpSelectedOriginal, col); m_bmpSelected = newBitmap; - armPixmap = (Pixmap) m_bmpSelected.GetPixmap(); + armPixmap = (Pixmap) m_bmpSelected.GetDrawable(); } else - armPixmap = (Pixmap) m_bmpNormal.GetArmPixmap(m_mainWidget); + armPixmap = (Pixmap) m_bitmapCache.GetArmPixmap(m_mainWidget); } else - armPixmap = (Pixmap) m_bmpNormal.GetArmPixmap(m_mainWidget); - - // <- the Get...Pixmap()-functions return the same pixmap! - if (insensPixmap == pixmap) - { - insensPixmap = - XCreateInsensitivePixmap(DisplayOfScreen(XtScreen((Widget) m_mainWidget)), pixmap); - m_insensPixmap = (WXPixmap) insensPixmap; - } + armPixmap = (Pixmap) m_bitmapCache.GetArmPixmap(m_mainWidget); XtVaSetValues ((Widget) m_mainWidget, XmNlabelPixmap, pixmap, @@ -260,7 +250,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();