From d062e17fca1a1fc0b82b269da4a7ad271075ba2b Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Sun, 12 Aug 2001 15:43:02 +0000 Subject: [PATCH] added missing methods/removed duplicated base methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/frame.h | 1 - include/wx/mac/icon.h | 11 ++++++++--- include/wx/mac/menuitem.h | 7 ++++++- src/mac/carbon/frame.cpp | 13 ------------- src/mac/carbon/icon.cpp | 6 ++++++ src/mac/frame.cpp | 13 ------------- src/mac/icon.cpp | 6 ++++++ 7 files changed, 26 insertions(+), 31 deletions(-) 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, -- 2.45.2