removed wxFunction

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-01 12:19:10 +00:00
parent b28b097d59
commit 70dc287a39
16 changed files with 9 additions and 184 deletions

View File

@@ -365,18 +365,6 @@ typedef int wxWindowID;
#define WXDLLEXPORT_CTORFN #define WXDLLEXPORT_CTORFN
#endif #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 // symbolic constant used by all Find()-like functions returning positive
// integer on success as failure indicator // integer on success as failure indicator
#define wxNOT_FOUND (-1) #define wxNOT_FOUND (-1)
@@ -487,11 +475,6 @@ class WXDLLEXPORT wxEvent;
# endif # endif
#endif #endif
// Callback function type definition
#ifdef __cplusplus
typedef void (*wxFunction) (wxObject&, wxEvent&);
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// OS mnemonics -- Identify the running OS (useful for Windows) // OS mnemonics -- Identify the running OS (useful for Windows)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -80,17 +80,6 @@ public:
// TODO: virtual void SetTitle(const wxString& title); // 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 // implementation
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;

View File

@@ -80,17 +80,6 @@ public:
// TODO: virtual void SetTitle(const wxString& title); // 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 // implementation
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;

View File

@@ -92,14 +92,6 @@ public:
inline virtual void SetButtonFont(const wxFont& font); inline virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const; inline wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() 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 #endif // WXWIN_COMPATIBILITY
protected: protected:
@@ -119,7 +111,6 @@ private:
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return GetFont(); } inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
inline wxFont& wxControl::GetButtonFont() const { return GetFont(); } inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }

View File

@@ -46,14 +46,6 @@ public:
// MSW-specific // MSW-specific
bool ProcessCommand(wxCommandEvent& event); 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 // implementation only from now on
// ------------------------------- // -------------------------------

View File

@@ -38,21 +38,6 @@ class WXDLLEXPORT wxMenuItem;
WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList); WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList); 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 // wxMenu
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -353,14 +338,6 @@ public:
wxList& GetItems() const { return (wxList &)m_items; } wxList& GetItems() const { return (wxList &)m_items; }
#endif // WXWIN_COMPATIBILITY #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: protected:
// virtuals to override in derived classes // virtuals to override in derived classes
// --------------------------------------- // ---------------------------------------

View File

@@ -54,12 +54,6 @@ public:
virtual void SetLabel(const wxString& label); virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ; 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; } bool InSetValue() const { return m_inSetValue; }
protected: protected:
@@ -73,15 +67,11 @@ protected:
const wxValidator& validator, const wxValidator& validator,
const wxString& name); const wxString& name);
#if WXWIN_COMPATIBILITY // Motif: prevent callbacks being called while in SetValue
wxFunction m_callback; // Callback associated with the window bool m_inSetValue;
#endif // WXWIN_COMPATIBILITY
bool m_inSetValue; // Motif: prevent callbacks being called while
// in SetValue
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif #endif // _WX_CONTROL_H_
// _WX_CONTROL_H_

View File

@@ -47,14 +47,6 @@ public:
bool ProcessCommand(wxCommandEvent& event); bool ProcessCommand(wxCommandEvent& event);
wxMenu(const wxString& title, const wxFunction func)
: wxMenuBase(title)
{
Init();
Callback(func);
}
//// Motif-specific //// Motif-specific
WXWidget GetButtonWidget() const { return m_buttonWidget; } WXWidget GetButtonWidget() const { return m_buttonWidget; }
void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; } void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; }

View File

@@ -71,18 +71,10 @@ public:
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { } virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
wxColour* GetButtonColour() const { return NULL; } wxColour* GetButtonColour() const { return NULL; }
inline virtual void SetLabelFont(const wxFont& font); virtual void SetLabelFont(const wxFont& font);
inline virtual void SetButtonFont(const wxFont& font); virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const; wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() const; 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 #endif // WXWIN_COMPATIBILITY
protected: protected:
@@ -131,7 +123,6 @@ private:
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return (wxFont &)GetFont(); } inline wxFont& wxControl::GetLabelFont() const { return (wxFont &)GetFont(); }
inline wxFont& wxControl::GetButtonFont() const { return (wxFont &)GetFont(); } inline wxFont& wxControl::GetButtonFont() const { return (wxFont &)GetFont(); }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); } inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }

View File

@@ -49,17 +49,6 @@ public:
virtual void SetTitle(const wxString& title); 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 // implementation only from now on
// ------------------------------- // -------------------------------

View File

@@ -100,14 +100,6 @@ public:
int GetNumVer() const; int GetNumVer() const;
int GetNumHor() 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: protected:
// subclass one radio button // subclass one radio button
void SubclassRadioButton(WXHWND hWndBtn); void SubclassRadioButton(WXHWND hWndBtn);

View File

@@ -89,15 +89,6 @@ public:
inline virtual void SetButtonFont(const wxFont& rFont); inline virtual void SetButtonFont(const wxFont& rFont);
inline wxFont& GetLabelFont(void) const; inline wxFont& GetLabelFont(void) const;
inline wxFont& GetButtonFont(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 #endif // WXWIN_COMPATIBILITY
public: public:
@@ -148,7 +139,6 @@ private:
}; // end of wxControl }; // end of wxControl
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); } inline wxFont& wxControl::GetLabelFont(void) const { return GetFont(); }
inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); } inline wxFont& wxControl::GetButtonFont(void) const { return GetFont(); }
inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); } inline void wxControl::SetLabelFont(const wxFont& rFont) { SetFont(rFont); }

View File

@@ -63,17 +63,6 @@ public:
virtual void Break(void); virtual void Break(void);
virtual void SetTitle(const wxString& rTitle); 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 // Implementation only from now on
// ------------------------------- // -------------------------------

View File

@@ -285,10 +285,6 @@ void wxMenuBase::Init(long style)
m_style = style; m_style = style;
m_clientData = (void *)NULL; m_clientData = (void *)NULL;
m_eventHandler = this; m_eventHandler = this;
#if wxUSE_MENU_CALLBACK
m_callback = (wxFunction) NULL;
#endif // wxUSE_MENU_CALLBACK
} }
wxMenuBase::~wxMenuBase() wxMenuBase::~wxMenuBase()
@@ -584,15 +580,6 @@ bool wxMenuBase::SendEvent(int id, int checked)
bool processed = FALSE; 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 // Try the menu's event handler
if ( !processed ) if ( !processed )
{ {

View File

@@ -14,7 +14,7 @@ WXDIR = ..\..
include ..\makesc.env include ..\makesc.env
DEBUG=0 DEBUG=1
LIBTARGET = $(LIBDIR)\wx$(SC_SUFFIX).lib LIBTARGET = $(LIBDIR)\wx$(SC_SUFFIX).lib

View File

@@ -183,22 +183,6 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
return FALSE; 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 // Radio box item
wxRadioBox::wxRadioBox() wxRadioBox::wxRadioBox()
{ {