From 70dc287a3997b65d954bfbd5861f72696bd3dd27 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Tue, 1 Jul 2003 12:19:10 +0000 Subject: [PATCH] removed wxFunction git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 17 ----------------- include/wx/gtk/menu.h | 11 ----------- include/wx/gtk1/menu.h | 11 ----------- include/wx/mac/control.h | 9 --------- include/wx/mac/menu.h | 8 -------- include/wx/menu.h | 23 ----------------------- include/wx/motif/control.h | 18 ++++-------------- include/wx/motif/menu.h | 8 -------- include/wx/msw/control.h | 17 ++++------------- include/wx/msw/menu.h | 11 ----------- include/wx/msw/radiobox.h | 8 -------- include/wx/os2/control.h | 10 ---------- include/wx/os2/menu.h | 11 ----------- src/common/menucmn.cpp | 13 ------------- src/msw/makefile.sc | 2 +- src/msw/radiobox.cpp | 16 ---------------- 16 files changed, 9 insertions(+), 184 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 1eab4c5e11..108d1e2d50 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -365,18 +365,6 @@ typedef int wxWindowID; #define WXDLLEXPORT_CTORFN #endif -// For ostream, istream ofstream -#if defined(__BORLANDC__) && defined( _RTLDLL ) -# define WXDLLIMPORT __import -#else -# define WXDLLIMPORT -#endif - -#ifdef __cplusplus -class WXDLLEXPORT wxObject; -class WXDLLEXPORT wxEvent; -#endif - // symbolic constant used by all Find()-like functions returning positive // integer on success as failure indicator #define wxNOT_FOUND (-1) @@ -487,11 +475,6 @@ class WXDLLEXPORT wxEvent; # endif #endif -// Callback function type definition -#ifdef __cplusplus -typedef void (*wxFunction) (wxObject&, wxEvent&); -#endif - // ---------------------------------------------------------------------------- // OS mnemonics -- Identify the running OS (useful for Windows) // ---------------------------------------------------------------------------- diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index afc85c0a0c..d2d836ed7e 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -80,17 +80,6 @@ public: // TODO: virtual void SetTitle(const wxString& title); - // compatibility only -#if wxUSE_MENU_CALLBACK - wxMenu(const wxString& title, const wxFunction func) - : wxMenuBase(title) - { - Init(); - - Callback(func); - } -#endif // WXWIN_COMPATIBILITY_2 - // implementation int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index afc85c0a0c..d2d836ed7e 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -80,17 +80,6 @@ public: // TODO: virtual void SetTitle(const wxString& title); - // compatibility only -#if wxUSE_MENU_CALLBACK - wxMenu(const wxString& title, const wxFunction func) - : wxMenuBase(title) - { - Init(); - - Callback(func); - } -#endif // WXWIN_COMPATIBILITY_2 - // implementation int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; diff --git a/include/wx/mac/control.h b/include/wx/mac/control.h index d39c5c624a..ddad4ae07d 100644 --- a/include/wx/mac/control.h +++ b/include/wx/mac/control.h @@ -92,14 +92,6 @@ public: inline virtual void SetButtonFont(const wxFont& font); inline wxFont& GetLabelFont() const; inline wxFont& GetButtonFont() const; - - // Adds callback - inline void Callback(const wxFunction function); - - wxFunction GetCallback() { return m_callback; } - -protected: - wxFunction m_callback; // Callback associated with the window #endif // WXWIN_COMPATIBILITY protected: @@ -119,7 +111,6 @@ private: #if WXWIN_COMPATIBILITY - inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; inline wxFont& wxControl::GetLabelFont() const { return GetFont(); } inline wxFont& wxControl::GetButtonFont() const { return GetFont(); } inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } diff --git a/include/wx/mac/menu.h b/include/wx/mac/menu.h index cc149e26ac..c401f7f140 100644 --- a/include/wx/mac/menu.h +++ b/include/wx/mac/menu.h @@ -46,14 +46,6 @@ public: // MSW-specific bool ProcessCommand(wxCommandEvent& event); -#if WXWIN_COMPATIBILITY - wxMenu(const wxString& title, const wxFunction func) - : wxMenuBase(title) - { - Callback(func); - } -#endif // WXWIN_COMPATIBILITY - // implementation only from now on // ------------------------------- diff --git a/include/wx/menu.h b/include/wx/menu.h index 77633a7814..2323551859 100644 --- a/include/wx/menu.h +++ b/include/wx/menu.h @@ -38,21 +38,6 @@ class WXDLLEXPORT wxMenuItem; WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); -// ---------------------------------------------------------------------------- -// conditional compilation -// ---------------------------------------------------------------------------- - -// having callbacks in menus is a wxWin 1.6x feature which should be replaced -// with event tables in wxWin 2.xx code - however provide it because many -// people like it a lot by default -#ifndef wxUSE_MENU_CALLBACK - #if WXWIN_COMPATIBILITY_2 - #define wxUSE_MENU_CALLBACK 1 - #else - #define wxUSE_MENU_CALLBACK 0 - #endif // WXWIN_COMPATIBILITY_2 -#endif // !defined(wxUSE_MENU_CALLBACK) - // ---------------------------------------------------------------------------- // wxMenu // ---------------------------------------------------------------------------- @@ -353,14 +338,6 @@ public: wxList& GetItems() const { return (wxList &)m_items; } #endif // WXWIN_COMPATIBILITY -#if wxUSE_MENU_CALLBACK || defined(__WXMOTIF__) - // wxWin 1.6x compatible menu event handling - wxFunction GetCallback() const { return m_callback; } - void Callback(const wxFunction func) { m_callback = func; } - - wxFunction m_callback; -#endif // wxUSE_MENU_CALLBACK - protected: // virtuals to override in derived classes // --------------------------------------- diff --git a/include/wx/motif/control.h b/include/wx/motif/control.h index 08c2738af1..84afdf5eae 100644 --- a/include/wx/motif/control.h +++ b/include/wx/motif/control.h @@ -54,12 +54,6 @@ public: virtual void SetLabel(const wxString& label); virtual wxString GetLabel() const ; -#if WXWIN_COMPATIBILITY - void Callback(const wxFunction function) { m_callback = function; }; // Adds callback - - wxFunction GetCallback() { return m_callback; } -#endif // WXWIN_COMPATIBILITY - bool InSetValue() const { return m_inSetValue; } protected: @@ -73,15 +67,11 @@ protected: const wxValidator& validator, const wxString& name); -#if WXWIN_COMPATIBILITY - wxFunction m_callback; // Callback associated with the window -#endif // WXWIN_COMPATIBILITY - - bool m_inSetValue; // Motif: prevent callbacks being called while - // in SetValue + // Motif: prevent callbacks being called while in SetValue + bool m_inSetValue; DECLARE_EVENT_TABLE() }; -#endif -// _WX_CONTROL_H_ +#endif // _WX_CONTROL_H_ + diff --git a/include/wx/motif/menu.h b/include/wx/motif/menu.h index 8e4a45a853..9db851bab5 100644 --- a/include/wx/motif/menu.h +++ b/include/wx/motif/menu.h @@ -47,14 +47,6 @@ public: bool ProcessCommand(wxCommandEvent& event); - wxMenu(const wxString& title, const wxFunction func) - : wxMenuBase(title) - { - Init(); - - Callback(func); - } - //// Motif-specific WXWidget GetButtonWidget() const { return m_buttonWidget; } void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; } diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index c95d25f1b6..cba93a1609 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -71,18 +71,10 @@ public: virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } wxColour* GetButtonColour() const { return NULL; } - inline virtual void SetLabelFont(const wxFont& font); - inline virtual void SetButtonFont(const wxFont& font); - inline wxFont& GetLabelFont() const; - inline wxFont& GetButtonFont() const; - - // Adds callback - inline void Callback(const wxFunction function); - - wxFunction GetCallback() { return m_callback; } - -protected: - wxFunction m_callback; // Callback associated with the window + virtual void SetLabelFont(const wxFont& font); + virtual void SetButtonFont(const wxFont& font); + wxFont& GetLabelFont() const; + wxFont& GetButtonFont() const; #endif // WXWIN_COMPATIBILITY protected: @@ -131,7 +123,6 @@ private: #if WXWIN_COMPATIBILITY - inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; inline wxFont& wxControl::GetLabelFont() const { return (wxFont &)GetFont(); } inline wxFont& wxControl::GetButtonFont() const { return (wxFont &)GetFont(); } inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } diff --git a/include/wx/msw/menu.h b/include/wx/msw/menu.h index fc86424e37..04273f78bc 100644 --- a/include/wx/msw/menu.h +++ b/include/wx/msw/menu.h @@ -49,17 +49,6 @@ public: virtual void SetTitle(const wxString& title); - // deprecated functions -#if wxUSE_MENU_CALLBACK - wxMenu(const wxString& title, const wxFunction func) - : wxMenuBase(title) - { - Init(); - - Callback(func); - } -#endif // wxUSE_MENU_CALLBACK - // implementation only from now on // ------------------------------- diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 58bd4bbe01..34a460902f 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -100,14 +100,6 @@ public: int GetNumVer() const; int GetNumHor() const; - // compatibility ctor -#if WXWIN_COMPATIBILITY - wxRadioBox(wxWindow *parent, wxFunction func, const char *title, - int x = -1, int y = -1, int width = -1, int height = -1, - int n = 0, char **choices = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); -#endif // WXWIN_COMPATIBILITY - protected: // subclass one radio button void SubclassRadioButton(WXHWND hWndBtn); diff --git a/include/wx/os2/control.h b/include/wx/os2/control.h index 1627d70c75..8da501c1d2 100644 --- a/include/wx/os2/control.h +++ b/include/wx/os2/control.h @@ -89,15 +89,6 @@ public: inline virtual void SetButtonFont(const wxFont& rFont); inline wxFont& GetLabelFont(void) const; inline wxFont& GetButtonFont(void) const; - - // - // Adds callback - // - inline void Callback(const wxFunction function); - wxFunction GetCallback(void) { return m_callback; } - -protected: - wxFunction m_callback; // Callback associated with the window #endif // WXWIN_COMPATIBILITY public: @@ -148,7 +139,6 @@ private: }; // end of wxControl #if WXWIN_COMPATIBILITY - inline void wxControl::Callback(const wxFunction f) { m_callback = f; }; inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); } inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); } inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); } diff --git a/include/wx/os2/menu.h b/include/wx/os2/menu.h index 14205d6759..af32bd3d30 100644 --- a/include/wx/os2/menu.h +++ b/include/wx/os2/menu.h @@ -63,17 +63,6 @@ public: virtual void Break(void); virtual void SetTitle(const wxString& rTitle); -#if wxUSE_MENU_CALLBACK - wxMenu( const wxString& rTitle - ,const wxFunction fnFunc - ) - : wxMenuBase(rTitle) - { - Init(); - Callback(fnFunc); - } -#endif // wxUSE_MENU_CALLBACK - // // Implementation only from now on // ------------------------------- diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 5e9ea0f289..865d668be2 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -285,10 +285,6 @@ void wxMenuBase::Init(long style) m_style = style; m_clientData = (void *)NULL; m_eventHandler = this; - -#if wxUSE_MENU_CALLBACK - m_callback = (wxFunction) NULL; -#endif // wxUSE_MENU_CALLBACK } wxMenuBase::~wxMenuBase() @@ -584,15 +580,6 @@ bool wxMenuBase::SendEvent(int id, int checked) bool processed = FALSE; -#if wxUSE_MENU_CALLBACK - // Try a callback - if (m_callback) - { - (void)(*(m_callback))(*this, event); - processed = TRUE; - } -#endif // wxUSE_MENU_CALLBACK - // Try the menu's event handler if ( !processed ) { diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index bb32241e8b..5eecfbe1aa 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -14,7 +14,7 @@ WXDIR = ..\.. include ..\makesc.env -DEBUG=0 +DEBUG=1 LIBTARGET = $(LIBDIR)\wx$(SC_SUFFIX).lib diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 521caa3e09..36d514174e 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -183,22 +183,6 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) return FALSE; } -#if WXWIN_COMPATIBILITY -wxRadioBox::wxRadioBox(wxWindow *parent, wxFunction func, const char *title, - int x, int y, int width, int height, - int n, char **choices, - int majorDim, long style, const char *name) -{ - wxString *choices2 = new wxString[n]; - for ( int i = 0; i < n; i ++) choices2[i] = choices[i]; - Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, choices2, majorDim, style, - wxDefaultValidator, name); - Callback(func); - delete choices2; -} - -#endif // WXWIN_COMPATIBILITY - // Radio box item wxRadioBox::wxRadioBox() { -- 2.47.2