Add some comments to wxGtkImage
Document which pointers can, and can't, be null and when exactly is the stored bitmap valid, as this is far from being immediately obvious. No real changes.
This commit is contained in:
@@ -23,9 +23,13 @@ public:
|
||||
static GtkWidget* New(wxWindow* win = NULL);
|
||||
void Set(const wxBitmap& bitmap);
|
||||
|
||||
// This pointer is never null and is owned by this class.
|
||||
BitmapProvider* m_provider;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxGtkImage);
|
||||
|
||||
// This class is constructed by New() and destroyed by its GObject
|
||||
// finalizer, so neither its ctor nor dtor can ever be used.
|
||||
wxGtkImage() wxMEMBER_DELETE;
|
||||
~wxGtkImage() wxMEMBER_DELETE;
|
||||
};
|
||||
|
@@ -24,8 +24,17 @@ struct BitmapProviderDefault: wxGtkImage::BitmapProvider
|
||||
BitmapProviderDefault(wxWindow* win) : m_win(win) { }
|
||||
virtual wxBitmap Get() const wxOVERRIDE;
|
||||
virtual void Set(const wxBitmap& bitmap) wxOVERRIDE;
|
||||
|
||||
// This pointer can be null if there is no associated window.
|
||||
wxWindow* const m_win;
|
||||
|
||||
// The bitmap stored here is only valid if it uses scale factor > 1,
|
||||
// otherwise we leave it invalid to indicate the drawing the bitmap should
|
||||
// be left to GtkImage itself.
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
// This bitmap is only valid if m_bitmap is and if we have the associated
|
||||
// window (as otherwise it would never be used at all).
|
||||
wxBitmap m_bitmapDisabled;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user