X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ecf902bc836f2808444b34eff48cdb12f289460..a9a2485d6464928fcf1012e573f4b3b734238300:/include/wx/ownerdrw.h diff --git a/include/wx/ownerdrw.h b/include/wx/ownerdrw.h index 46ddedab28..50e85b4a64 100644 --- a/include/wx/ownerdrw.h +++ b/include/wx/ownerdrw.h @@ -16,10 +16,6 @@ #if wxUSE_OWNER_DRAWN -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "ownerdrw.h" -#endif - #include "wx/bitmap.h" #include "wx/colour.h" #include "wx/font.h" @@ -33,14 +29,14 @@ // element or one unchangeable bitmap otherwise. // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxOwnerDrawn +class WXDLLIMPEXP_CORE wxOwnerDrawn { public: // ctor & dtor wxOwnerDrawn(const wxString& str = wxEmptyString, bool bCheckable = false, bool bMenuItem = false); // FIXME kludge for colors - virtual ~wxOwnerDrawn() { } + virtual ~wxOwnerDrawn(); // fix appearance void SetFont(const wxFont& font) @@ -65,9 +61,14 @@ public: m_bmpUnchecked = bmpUnchecked; m_bOwnerDrawn = true; } - void SetBitmap(const wxBitmap& bmpChecked) - { m_bmpChecked = bmpChecked; - m_bOwnerDrawn = true; } + void SetBitmap(const wxBitmap& bmp, bool bChecked = true) + { + if ( bChecked ) + m_bmpChecked = bmp; + else + m_bmpUnchecked = bmp; + m_bOwnerDrawn = true; + } void SetDisabledBitmap( const wxBitmap& bmpDisabled ) { m_bmpDisabled = bmpDisabled; @@ -142,6 +143,13 @@ public: virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); protected: + // return true if this is a menu item + bool IsMenuItem() const; + + // get the font to use, whether m_font is set or not + wxFont GetFontToUse() const; + + wxString m_strName, // label for a manu item m_strAccel; // the accel string ("Ctrl-F17") if any @@ -150,7 +158,8 @@ private: static size_t ms_nLastMarginWidth; // handy for aligning all items bool m_bCheckable, // used only for menu or check listbox items - m_bOwnerDrawn; // true if something is non standard + m_bOwnerDrawn, // true if something is non standard + m_isMenuItem; // true if this is a menu item wxFont m_font; // font to use for drawing wxColour m_colText, // color ----"---"---"---- @@ -160,7 +169,6 @@ private: m_bmpDisabled; size_t m_nHeight, // font height - m_nMinHeight, // minimum height, as determined by user's system settings m_nMarginWidth; // space occupied by bitmap to the left of the item };