diff --git a/include/wx/mac/frame.h b/include/wx/mac/frame.h index 4a691898ab..c71cf5fee5 100644 --- a/include/wx/mac/frame.h +++ b/include/wx/mac/frame.h @@ -64,7 +64,6 @@ public: virtual void Iconize(bool iconize = TRUE); virtual bool IsIconized() const; virtual void Restore(); - virtual void SetMenuBar(wxMenuBar *menubar); virtual void SetIcon(const wxIcon& icon); // implementation only from now on diff --git a/include/wx/mac/icon.h b/include/wx/mac/icon.h index 4583767689..512e95e88f 100644 --- a/include/wx/mac/icon.h +++ b/include/wx/mac/icon.h @@ -29,9 +29,9 @@ public: // Copy constructors inline wxIcon(const wxIcon& icon) { Ref(icon); } - wxIcon( const char **data ); - wxIcon( char **data ); - wxIcon(const char bits[], int width, int height); + wxIcon(const char **data); + wxIcon(char **data); + wxIcon(const char bits[], int width=-1, int height=-1); wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); ~wxIcon(); @@ -44,6 +44,11 @@ public: inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); }; /* diff --git a/include/wx/mac/menuitem.h b/include/wx/mac/menuitem.h index 0a85aa3725..cf7a2c57f2 100644 --- a/include/wx/mac/menuitem.h +++ b/include/wx/mac/menuitem.h @@ -56,6 +56,9 @@ public: virtual void Check(bool bDoCheck = TRUE); virtual bool IsChecked() const; + virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } + virtual const wxBitmap& GetBitmap() const { return m_bitmap; } + #if wxUSE_ACCEL virtual wxAcceleratorEntry *GetAccel() const; #endif // wxUSE_ACCEL @@ -69,9 +72,11 @@ public: // menu handle depending on what we're int GetRealId() const; - static int MacBuildMenuString(StringPtr outMacItemText, SInt16 *outMacShortcutChar , UInt8 *outMacModifiers , const char *inItemName , bool useShortcuts ) ; + static int MacBuildMenuString(StringPtr outMacItemText, SInt16 *outMacShortcutChar , UInt8 *outMacModifiers , const char *inItemName , bool useShortcuts ) ; private: + wxBitmap m_bitmap; // Bitmap for menuitem, if any + DECLARE_DYNAMIC_CLASS(wxMenuItem) }; diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index fb3d2fee9f..8a589cbf54 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -225,19 +225,6 @@ void wxFrameMac::PositionStatusBar() } } -void wxFrameMac::SetMenuBar(wxMenuBar *menuBar) -{ - if (!menuBar) - { - return; - } - - m_frameMenuBar = menuBar; -// m_frameMenuBar->MacInstallMenuBar() ; - m_frameMenuBar->Attach((wxFrame *)this); -} - - // Responds to colour changes, and passes event on to children. void wxFrameMac::OnSysColourChanged(wxSysColourChangedEvent& event) { diff --git a/src/mac/carbon/icon.cpp b/src/mac/carbon/icon.cpp index 26cb83e93c..0133e45534 100644 --- a/src/mac/carbon/icon.cpp +++ b/src/mac/carbon/icon.cpp @@ -69,6 +69,12 @@ bool wxIcon::LoadFile(const wxString& filename, long type, return FALSE; } +void wxIcon::CopyFromBitmap(const wxBitmap& bmp) +{ + wxIcon *icon = (wxIcon*)(&bmp); + *this = *icon; +} + IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler) bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp index fb3d2fee9f..8a589cbf54 100644 --- a/src/mac/frame.cpp +++ b/src/mac/frame.cpp @@ -225,19 +225,6 @@ void wxFrameMac::PositionStatusBar() } } -void wxFrameMac::SetMenuBar(wxMenuBar *menuBar) -{ - if (!menuBar) - { - return; - } - - m_frameMenuBar = menuBar; -// m_frameMenuBar->MacInstallMenuBar() ; - m_frameMenuBar->Attach((wxFrame *)this); -} - - // Responds to colour changes, and passes event on to children. void wxFrameMac::OnSysColourChanged(wxSysColourChangedEvent& event) { diff --git a/src/mac/icon.cpp b/src/mac/icon.cpp index 26cb83e93c..0133e45534 100644 --- a/src/mac/icon.cpp +++ b/src/mac/icon.cpp @@ -69,6 +69,12 @@ bool wxIcon::LoadFile(const wxString& filename, long type, return FALSE; } +void wxIcon::CopyFromBitmap(const wxBitmap& bmp) +{ + wxIcon *icon = (wxIcon*)(&bmp); + *this = *icon; +} + IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler) bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,