wxWindow::OnClose() removed completely from wxGTK, wxCloseEvent is now

processed properly. Also, fixes for compilation without WXWIN_COMPATIBILITY
on.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-05 14:26:48 +00:00
parent f992adf9bc
commit 2b854a3261
15 changed files with 1132 additions and 1083 deletions

View File

@@ -187,8 +187,11 @@ class WXDLLEXPORT wxView: public wxEvtHandler
// Override to do cleanup/veto close // Override to do cleanup/veto close
virtual bool OnClose(bool deleteWindow); virtual bool OnClose(bool deleteWindow);
#ifdef WXWIN_COMPATIBILITY
// Defeat compiler warning // Defeat compiler warning
inline bool OnClose(void) { return wxEvtHandler::OnClose(); } bool OnClose(void) { return wxEvtHandler::OnClose(); }
#endif
// Extend event processing to search the document's event table // Extend event processing to search the document's event table
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
@@ -197,7 +200,8 @@ class WXDLLEXPORT wxView: public wxEvtHandler
// The function then notifies the document manager. // The function then notifies the document manager.
virtual void Activate(bool activate); virtual void Activate(bool activate);
inline wxDocManager *GetDocumentManager(void) const { return m_viewDocument->GetDocumentManager(); } wxDocManager *GetDocumentManager(void) const
{ return m_viewDocument->GetDocumentManager(); }
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
virtual wxPrintout *OnCreatePrintout(void); virtual wxPrintout *OnCreatePrintout(void);

View File

@@ -13,7 +13,7 @@
#define _WX_EVENTH__ #define _WX_EVENTH__
#ifdef __GNUG__ #ifdef __GNUG__
#pragma interface "event.h" #pragma interface "event.h"
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
@@ -245,7 +245,7 @@ const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
#define wxEVENT_TYPE_SCROLL_PAGEDOWN wxEVT_SCROLL_PAGEDOWN #define wxEVENT_TYPE_SCROLL_PAGEDOWN wxEVT_SCROLL_PAGEDOWN
#define wxEVENT_TYPE_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK #define wxEVENT_TYPE_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK
#endif #endif // WXWIN_COMPATIBILITY
/* /*
* wxWindows events, covering all interesting things that might happen * wxWindows events, covering all interesting things that might happen
@@ -259,27 +259,29 @@ const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
* *
*/ */
class WXDLLEXPORT wxEvent: public wxObject class WXDLLEXPORT wxEvent : public wxObject
{ {
DECLARE_ABSTRACT_CLASS(wxEvent) DECLARE_ABSTRACT_CLASS(wxEvent)
public: public:
wxEvent(int id = 0); wxEvent(int id = 0);
inline ~wxEvent(void) {} ~wxEvent() {}
inline void SetEventType(wxEventType typ) { m_eventType = typ; } void SetEventType(wxEventType typ) { m_eventType = typ; }
inline wxEventType GetEventType(void) const { return m_eventType; } wxEventType GetEventType() const { return m_eventType; }
inline wxObject *GetEventObject(void) const { return m_eventObject; } wxObject *GetEventObject() const { return m_eventObject; }
inline void SetEventObject(wxObject *obj) { m_eventObject = obj; } void SetEventObject(wxObject *obj) { m_eventObject = obj; }
inline long GetTimestamp(void) const { return m_timeStamp; } long GetTimestamp() const { return m_timeStamp; }
inline void SetTimestamp(long ts = 0) { m_timeStamp = ts; } void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
inline int GetId() const { return m_id; } int GetId() const { return m_id; }
inline void SetId(int Id) { m_id = Id; } void SetId(int Id) { m_id = Id; }
// Can instruct event processor that we wish to ignore this event // Can instruct event processor that we wish to ignore this event
// (treat as if the event table entry had not been found) // (treat as if the event table entry had not been found): this must be done
inline void Skip(bool skip = TRUE) { m_skipped = skip; } // to allow the event processing by the base classes (calling event.Skip()
inline bool GetSkipped(void) const { return m_skipped; }; // is the analog of calling the base class verstion of a virtual function)
void Skip(bool skip = TRUE) { m_skipped = skip; }
bool GetSkipped() const { return m_skipped; };
public: public:
bool m_skipped; bool m_skipped;
@@ -289,7 +291,6 @@ public:
long m_timeStamp; long m_timeStamp;
int m_id; int m_id;
wxObject* m_callbackUserData; wxObject* m_callbackUserData;
}; };
// Item or menu event class // Item or menu event class
@@ -312,12 +313,13 @@ public:
class WXDLLEXPORT wxClientData; class WXDLLEXPORT wxClientData;
class WXDLLEXPORT wxCommandEvent: public wxEvent class WXDLLEXPORT wxCommandEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxCommandEvent) DECLARE_DYNAMIC_CLASS(wxCommandEvent)
public:
wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0); wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
inline ~wxCommandEvent(void) {} ~wxCommandEvent() {}
/* /*
* Accessors dependent on context * Accessors dependent on context
@@ -325,33 +327,33 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
*/ */
// Set/Get client data from controls // Set/Get client data from controls
inline void SetClientData(void* clientData) { m_clientData = clientData; } void SetClientData(void* clientData) { m_clientData = clientData; }
inline void *GetClientData() const { return m_clientData; } void *GetClientData() const { return m_clientData; }
// Set/Get client object from controls // Set/Get client object from controls
inline void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
inline void *GetClientObject() const { return m_clientObject; } void *GetClientObject() const { return m_clientObject; }
// Get listbox selection if single-choice // Get listbox selection if single-choice
inline int GetSelection() const { return m_commandInt; } int GetSelection() const { return m_commandInt; }
// Set/Get listbox/choice selection string // Set/Get listbox/choice selection string
inline void SetString(char* s) { m_commandString = s; } void SetString(char* s) { m_commandString = s; }
inline char *GetString() const { return m_commandString; } char *GetString() const { return m_commandString; }
// Get checkbox value // Get checkbox value
inline bool Checked() const { return (m_commandInt != 0); } bool Checked() const { return (m_commandInt != 0); }
// TRUE if the listbox event was a selection. // TRUE if the listbox event was a selection.
inline bool IsSelection() const { return (m_extraLong != 0); } bool IsSelection() const { return (m_extraLong != 0); }
inline void SetExtraLong(long extraLong) { m_extraLong = extraLong; } void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
inline long GetExtraLong(void) const { return m_extraLong ; } long GetExtraLong() const { return m_extraLong ; }
inline void SetInt(int i) { m_commandInt = i; } void SetInt(int i) { m_commandInt = i; }
inline long GetInt(void) const { return m_commandInt ; } long GetInt() const { return m_commandInt ; }
public: public:
char* m_commandString; // String event argument char* m_commandString; // String event argument
int m_commandInt; int m_commandInt;
long m_extraLong; // Additional information (e.g. select/deselect) long m_extraLong; // Additional information (e.g. select/deselect)
@@ -390,23 +392,24 @@ private:
wxEVT_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK
*/ */
class WXDLLEXPORT wxScrollEvent: public wxCommandEvent class WXDLLEXPORT wxScrollEvent : public wxCommandEvent
{ {
DECLARE_DYNAMIC_CLASS(wxScrollEvent) DECLARE_DYNAMIC_CLASS(wxScrollEvent)
public: public:
wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0, int orient = 0); wxScrollEvent(wxEventType commandType = wxEVT_NULL,
inline ~wxScrollEvent(void) {} int id = 0, int pos = 0, int orient = 0);
~wxScrollEvent() {}
/* /*
* Accessors * Accessors
* *
*/ */
inline int GetOrientation(void) const { return (int) m_extraLong ; } int GetOrientation() const { return (int) m_extraLong ; }
inline int GetPosition(void) const { return m_commandInt ; } int GetPosition() const { return m_commandInt ; }
inline void SetOrientation(int orient) { m_extraLong = (long) orient; } void SetOrientation(int orient) { m_extraLong = (long) orient; }
inline void SetPosition(int pos) { m_commandInt = pos; } void SetPosition(int pos) { m_commandInt = pos; }
}; };
// Mouse event class // Mouse event class
@@ -439,15 +442,15 @@ class WXDLLEXPORT wxScrollEvent: public wxCommandEvent
*/ */
class WXDLLEXPORT wxDC; class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMouseEvent: public wxEvent class WXDLLEXPORT wxMouseEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxMouseEvent) DECLARE_DYNAMIC_CLASS(wxMouseEvent)
public: public:
wxMouseEvent(wxEventType mouseType = wxEVT_NULL); wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
// Was it a button event? (*doesn't* mean: is any button *down*?) // Was it a button event? (*doesn't* mean: is any button *down*?)
inline bool IsButton(void) const { return Button(-1); } bool IsButton() const { return Button(-1); }
// Was it a down event from button 1, 2 or 3 or any? // Was it a down event from button 1, 2 or 3 or any?
bool ButtonDown(int but = -1) const; bool ButtonDown(int but = -1) const;
@@ -465,59 +468,68 @@ class WXDLLEXPORT wxMouseEvent: public wxEvent
bool ButtonIsDown(int but) const; bool ButtonIsDown(int but) const;
// Find state of shift/control keys // Find state of shift/control keys
inline bool ControlDown(void) const { return m_controlDown; } bool ControlDown() const { return m_controlDown; }
inline bool MetaDown(void) const { return m_metaDown; } bool MetaDown() const { return m_metaDown; }
inline bool AltDown(void) const { return m_altDown; } bool AltDown() const { return m_altDown; }
inline bool ShiftDown(void) const { return m_shiftDown; } bool ShiftDown() const { return m_shiftDown; }
// Find which event was just generated // Find which event was just generated
inline bool LeftDown(void) const { return (m_eventType == wxEVT_LEFT_DOWN); } bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
inline bool MiddleDown(void) const { return (m_eventType == wxEVT_MIDDLE_DOWN); } bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
inline bool RightDown(void) const { return (m_eventType == wxEVT_RIGHT_DOWN); } bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
inline bool LeftUp(void) const { return (m_eventType == wxEVT_LEFT_UP); } bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
inline bool MiddleUp(void) const { return (m_eventType == wxEVT_MIDDLE_UP); } bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
inline bool RightUp(void) const { return (m_eventType == wxEVT_RIGHT_UP); } bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
inline bool LeftDClick(void) const { return (m_eventType == wxEVT_LEFT_DCLICK); } bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
inline bool MiddleDClick(void) const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
inline bool RightDClick(void) const { return (m_eventType == wxEVT_RIGHT_DCLICK); } bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
// Find the current state of the mouse buttons (regardless // Find the current state of the mouse buttons (regardless
// of current event type) // of current event type)
inline bool LeftIsDown(void) const { return m_leftDown; } bool LeftIsDown() const { return m_leftDown; }
inline bool MiddleIsDown(void) const { return m_middleDown; } bool MiddleIsDown() const { return m_middleDown; }
inline bool RightIsDown(void) const { return m_rightDown; } bool RightIsDown() const { return m_rightDown; }
// True if a button is down and the mouse is moving // True if a button is down and the mouse is moving
inline bool Dragging(void) const { return ((m_eventType == wxEVT_MOTION) && (LeftIsDown() || MiddleIsDown() || RightIsDown())); } bool Dragging() const
{
return ((m_eventType == wxEVT_MOTION) &&
(LeftIsDown() || MiddleIsDown() || RightIsDown()));
}
// True if the mouse is moving, and no button is down // True if the mouse is moving, and no button is down
inline bool Moving(void) const { return (m_eventType == wxEVT_MOTION); } bool Moving() const { return (m_eventType == wxEVT_MOTION); }
// True if the mouse is just entering the window // True if the mouse is just entering the window
inline bool Entering(void) const { return (m_eventType == wxEVT_ENTER_WINDOW); } bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
// True if the mouse is just leaving the window // True if the mouse is just leaving the window
inline bool Leaving(void) const { return (m_eventType == wxEVT_LEAVE_WINDOW); } bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
// Find the position of the event // Find the position of the event
inline void Position(long *xpos, long *ypos) const { *xpos = m_x; *ypos = m_y; } void Position(long *xpos, long *ypos) const { *xpos = m_x; *ypos = m_y; }
// Find the position of the event // Find the position of the event
inline wxPoint GetPosition() const { return wxPoint(m_x, m_y); } wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
// Find the logical position of the event given the DC // Find the logical position of the event given the DC
wxPoint GetLogicalPosition(const wxDC& dc) const ; wxPoint GetLogicalPosition(const wxDC& dc) const ;
// Compatibility // Compatibility
inline void Position(float *xpos, float *ypos) const { *xpos = (float) m_x; *ypos = (float) m_y; } #if WXWIN_COMPATIBILITY
void Position(float *xpos, float *ypos) const
{
*xpos = (float) m_x; *ypos = (float) m_y;
}
#endif // WXWIN_COMPATIBILITY
// Get X position // Get X position
inline long GetX(void) const { return m_x; } long GetX() const { return m_x; }
// Get Y position // Get Y position
inline long GetY(void) const { return m_y; } long GetY() const { return m_y; }
public: public:
long m_x; long m_x;
@@ -530,7 +542,6 @@ public:
bool m_shiftDown; bool m_shiftDown;
bool m_altDown; bool m_altDown;
bool m_metaDown; bool m_metaDown;
}; };
// Keyboard input event class // Keyboard input event class
@@ -542,7 +553,7 @@ public:
wxEVT_KEY_UP wxEVT_KEY_UP
*/ */
class WXDLLEXPORT wxKeyEvent: public wxEvent class WXDLLEXPORT wxKeyEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxKeyEvent) DECLARE_DYNAMIC_CLASS(wxKeyEvent)
@@ -550,30 +561,33 @@ public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL); wxKeyEvent(wxEventType keyType = wxEVT_NULL);
// Find state of shift/control keys // Find state of shift/control keys
inline bool ControlDown(void) const { return m_controlDown; } bool ControlDown() const { return m_controlDown; }
inline bool MetaDown(void) const { return m_metaDown; } bool MetaDown() const { return m_metaDown; }
inline bool AltDown(void) const { return m_altDown; } bool AltDown() const { return m_altDown; }
inline bool ShiftDown(void) const { return m_shiftDown; } bool ShiftDown() const { return m_shiftDown; }
inline long KeyCode(void) const { return m_keyCode; } long KeyCode() const { return m_keyCode; }
#if WXWIN_COMPATIBILITY
// Find the position of the event // Find the position of the event
inline void Position(float *xpos, float *ypos) const { *xpos = m_x; *ypos = m_y; } void Position(float *xpos, float *ypos) const
{ *xpos = (float)m_x; *ypos = (float)m_y; }
// Get X position // Get X position
inline float GetX(void) const { return m_x; } float GetX() const { return (float)m_x; }
// Get Y position // Get Y position
inline float GetY(void) const { return m_y; } float GetY() const { return (float)m_y; }
#endif // WXWIN_COMPATIBILITY
public: public:
float m_x ; long m_x;
float m_y ; long m_y;
long m_keyCode; long m_keyCode;
bool m_controlDown; bool m_controlDown;
bool m_shiftDown; bool m_shiftDown;
bool m_altDown; bool m_altDown;
bool m_metaDown; bool m_metaDown;
}; };
// Size event class // Size event class
@@ -581,18 +595,19 @@ public:
wxEVT_SIZE wxEVT_SIZE
*/ */
class WXDLLEXPORT wxSizeEvent: public wxEvent class WXDLLEXPORT wxSizeEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxSizeEvent) DECLARE_DYNAMIC_CLASS(wxSizeEvent)
public: public:
wxSize m_size; wxSize m_size;
inline wxSizeEvent(void) { m_eventType = wxEVT_SIZE; } wxSizeEvent() { m_eventType = wxEVT_SIZE; }
inline wxSizeEvent(const wxSize& sz, int id = 0) wxSizeEvent(const wxSize& sz, int id = 0)
{ m_eventType = wxEVT_SIZE; m_size.x = sz.x; m_size.y = sz.y; m_id = id; } : m_size(sz)
{ m_eventType = wxEVT_SIZE; m_id = id; }
inline wxSize GetSize(void) const { return m_size; } wxSize GetSize() const { return m_size; }
}; };
// Move event class // Move event class
@@ -601,18 +616,19 @@ class WXDLLEXPORT wxSizeEvent: public wxEvent
wxEVT_MOVE wxEVT_MOVE
*/ */
class WXDLLEXPORT wxMoveEvent: public wxEvent class WXDLLEXPORT wxMoveEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxMoveEvent) DECLARE_DYNAMIC_CLASS(wxMoveEvent)
public: public:
wxPoint m_pos; wxPoint m_pos;
inline wxMoveEvent(void) { m_eventType = wxEVT_MOVE; } wxMoveEvent() { m_eventType = wxEVT_MOVE; }
inline wxMoveEvent(const wxPoint& pos, int id = 0) wxMoveEvent(const wxPoint& pos, int id = 0)
{ m_eventType = wxEVT_MOVE; m_pos.x = pos.x; m_pos.y = pos.y; m_id = id; } : m_pos(pos)
{ m_eventType = wxEVT_MOVE; m_id = id; }
inline wxPoint GetPosition(void) const { return m_pos; } wxPoint GetPosition() const { return m_pos; }
}; };
// Paint event class // Paint event class
@@ -622,12 +638,12 @@ class WXDLLEXPORT wxMoveEvent: public wxEvent
wxEVT_PAINT_ICON wxEVT_PAINT_ICON
*/ */
class WXDLLEXPORT wxPaintEvent: public wxEvent class WXDLLEXPORT wxPaintEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxPaintEvent) DECLARE_DYNAMIC_CLASS(wxPaintEvent)
public: public:
inline wxPaintEvent(int Id = 0) { m_eventType = wxEVT_PAINT; m_id = Id; } wxPaintEvent(int Id = 0) { m_eventType = wxEVT_PAINT; m_id = Id; }
}; };
// Erase background event class // Erase background event class
@@ -636,13 +652,16 @@ class WXDLLEXPORT wxPaintEvent: public wxEvent
*/ */
class WXDLLEXPORT wxDC; class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxEraseEvent: public wxEvent class WXDLLEXPORT wxEraseEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxEraseEvent) DECLARE_DYNAMIC_CLASS(wxEraseEvent)
public:
wxDC *m_dc ; public:
inline wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) { m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; } wxDC *m_dc;
inline wxDC *GetDC() const { return m_dc; }
wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL)
{ m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; }
wxDC *GetDC() const { return m_dc; }
}; };
// Focus event class // Focus event class
@@ -651,12 +670,13 @@ class WXDLLEXPORT wxEraseEvent: public wxEvent
wxEVT_KILL_FOCUS wxEVT_KILL_FOCUS
*/ */
class WXDLLEXPORT wxFocusEvent: public wxEvent class WXDLLEXPORT wxFocusEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxFocusEvent) DECLARE_DYNAMIC_CLASS(wxFocusEvent)
public: public:
inline wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) { m_eventType = type; m_id = Id; } wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0)
{ m_eventType = type; m_id = Id; }
}; };
// Activate event class // Activate event class
@@ -665,14 +685,17 @@ class WXDLLEXPORT wxFocusEvent: public wxEvent
wxEVT_ACTIVATE_APP wxEVT_ACTIVATE_APP
*/ */
class WXDLLEXPORT wxActivateEvent: public wxEvent class WXDLLEXPORT wxActivateEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxActivateEvent) DECLARE_DYNAMIC_CLASS(wxActivateEvent)
public: public:
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0)
{ m_eventType = type; m_active = active; m_id = Id; }
bool GetActive() const { return m_active; }
private:
bool m_active; bool m_active;
inline wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; }
inline bool GetActive(void) const { return m_active; }
}; };
// InitDialog event class // InitDialog event class
@@ -680,12 +703,13 @@ class WXDLLEXPORT wxActivateEvent: public wxEvent
wxEVT_INIT_DIALOG wxEVT_INIT_DIALOG
*/ */
class WXDLLEXPORT wxInitDialogEvent: public wxEvent class WXDLLEXPORT wxInitDialogEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxInitDialogEvent) DECLARE_DYNAMIC_CLASS(wxInitDialogEvent)
public: public:
inline wxInitDialogEvent(int Id = 0) { m_eventType = wxEVT_INIT_DIALOG; m_id = Id; } wxInitDialogEvent(int Id = 0)
{ m_eventType = wxEVT_INIT_DIALOG; m_id = Id; }
}; };
// Miscellaneous menu event class // Miscellaneous menu event class
@@ -697,16 +721,18 @@ class WXDLLEXPORT wxInitDialogEvent: public wxEvent
wxEVT_CONTEXT_MENU, wxEVT_CONTEXT_MENU,
*/ */
class WXDLLEXPORT wxMenuEvent: public wxEvent class WXDLLEXPORT wxMenuEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxMenuEvent) DECLARE_DYNAMIC_CLASS(wxMenuEvent)
public: public:
wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
{ m_eventType = type; m_menuId = id; }
int GetMenuId() const { return m_menuId; }
private:
int m_menuId; int m_menuId;
inline wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) { m_eventType = type; m_menuId = id; }
inline int GetMenuId(void) const { return m_menuId; }
}; };
// Window close or session close event class // Window close or session close event class
@@ -716,49 +742,63 @@ public:
wxEVT_QUERY_END_SESSION wxEVT_QUERY_END_SESSION
*/ */
class WXDLLEXPORT wxCloseEvent: public wxEvent class WXDLLEXPORT wxCloseEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxCloseEvent) DECLARE_DYNAMIC_CLASS(wxCloseEvent)
public: public:
wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0)
{
m_eventType = type;
m_loggingOff = TRUE;
m_veto = FALSE; // should be FALSE by default
m_id = id;
#if WXWIN_COMPATIBILITY
m_force = FALSE;
#endif // WXWIN_COMPATIBILITY
m_canVeto = TRUE;
}
inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0) void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
{ m_eventType = type; m_loggingOff = TRUE; m_veto = FALSE; bool GetLoggingOff() const { return m_loggingOff; }
m_id = id; m_force = FALSE; m_canVeto = FALSE; }
inline void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } void Veto(bool veto = TRUE) { wxASSERT( m_canVeto ); m_veto = veto; }
inline bool GetLoggingOff(void) const { return m_loggingOff; } void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
inline void Veto(bool veto = TRUE) { m_veto = veto; } bool CanVeto() const { return m_canVeto; }
inline void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } bool GetVeto() const { wxASSERT( m_canVeto ); return m_veto; }
inline bool CanVeto() const { return m_canVeto; }
inline bool GetVeto(void) const { return m_veto; }
#if WXWIN_COMPATIBILITY
// This is probably obsolete now, since we use CanVeto instead, in // This is probably obsolete now, since we use CanVeto instead, in
// both OnCloseWindow and OnQueryEndSession. // both OnCloseWindow and OnQueryEndSession.
// m_force == ! m_canVeto i.e., can't veto means we must force it to close. // m_force == ! m_canVeto i.e., can't veto means we must force it to close.
inline void SetForce(bool force) { m_force = force; } void SetForce(bool force) { m_force = force; }
inline bool GetForce(void) const { return m_force; } bool GetForce() const { return m_force; }
#endif
protected: protected:
bool m_loggingOff; bool m_loggingOff;
bool m_veto; bool m_veto, m_canVeto;
#if WXWIN_COMPATIBILITY
bool m_force; bool m_force;
bool m_canVeto; #endif
}; };
/* /*
wxEVT_SHOW wxEVT_SHOW
*/ */
class WXDLLEXPORT wxShowEvent: public wxEvent class WXDLLEXPORT wxShowEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxShowEvent) DECLARE_DYNAMIC_CLASS(wxShowEvent)
public: public:
inline wxShowEvent(int id = 0, bool show = FALSE) wxShowEvent(int id = 0, bool show = FALSE)
{ m_eventType = wxEVT_SHOW; m_id = id; m_show = show; } { m_eventType = wxEVT_SHOW; m_id = id; m_show = show; }
inline void SetShow(bool show) { m_show = show; } void SetShow(bool show) { m_show = show; }
inline bool GetShow(void) const { return m_show; } bool GetShow() const { return m_show; }
protected: protected:
bool m_show; bool m_show;
@@ -768,12 +808,12 @@ protected:
wxEVT_ICONIZE wxEVT_ICONIZE
*/ */
class WXDLLEXPORT wxIconizeEvent: public wxEvent class WXDLLEXPORT wxIconizeEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxIconizeEvent) DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
public:
inline wxIconizeEvent(int id = 0) public:
wxIconizeEvent(int id = 0)
{ m_eventType = wxEVT_ICONIZE; m_id = id; } { m_eventType = wxEVT_ICONIZE; m_id = id; }
}; };
@@ -781,12 +821,12 @@ public:
wxEVT_MAXIMIZE wxEVT_MAXIMIZE
*/ */
class WXDLLEXPORT wxMaximizeEvent: public wxEvent class WXDLLEXPORT wxMaximizeEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxMaximizeEvent) DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
public:
inline wxMaximizeEvent(int id = 0) public:
wxMaximizeEvent(int id = 0)
{ m_eventType = wxEVT_MAXIMIZE; m_id = id; } { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
}; };
@@ -809,55 +849,64 @@ public:
#define wxJOY_BUTTON4 8 #define wxJOY_BUTTON4 8
#define wxJOY_BUTTON_ANY -1 #define wxJOY_BUTTON_ANY -1
class WXDLLEXPORT wxJoystickEvent: public wxEvent class WXDLLEXPORT wxJoystickEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxJoystickEvent) DECLARE_DYNAMIC_CLASS(wxJoystickEvent)
public: public:
wxPoint m_pos; wxPoint m_pos;
int m_zPosition; int m_zPosition;
int m_buttonChange; // Which button changed? int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down? int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick? int m_joyStick; // Which joystick?
inline wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, int change = 0) wxJoystickEvent(wxEventType type = wxEVT_NULL,
{ m_eventType = type; m_buttonState = state; m_pos = wxPoint(0,0); m_zPosition = 0; int state = 0,
m_joyStick = joystick; m_buttonChange = change; } int joystick = wxJOYSTICK1,
int change = 0)
{
m_eventType = type;
m_buttonState = state;
m_pos = wxPoint(0,0);
m_zPosition = 0;
m_joyStick = joystick;
m_buttonChange = change;
}
inline wxPoint GetPosition(void) const { return m_pos; } wxPoint GetPosition() const { return m_pos; }
inline int GetZPosition(void) const { return m_zPosition; } int GetZPosition() const { return m_zPosition; }
inline int GetButtonState(void) const { return m_buttonState; } int GetButtonState() const { return m_buttonState; }
inline int GetButtonChange(void) const { return m_buttonChange; } int GetButtonChange() const { return m_buttonChange; }
inline int GetJoystick(void) const { return m_joyStick; } int GetJoystick() const { return m_joyStick; }
inline void SetJoystick(int stick) { m_joyStick = stick; } void SetJoystick(int stick) { m_joyStick = stick; }
inline void SetButtonState(int state) { m_buttonState = state; } void SetButtonState(int state) { m_buttonState = state; }
inline void SetButtonChange(int change) { m_buttonChange = change; } void SetButtonChange(int change) { m_buttonChange = change; }
inline void SetPosition(const wxPoint& pos) { m_pos = pos; } void SetPosition(const wxPoint& pos) { m_pos = pos; }
inline void SetZPosition(int zPos) { m_zPosition = zPos; } void SetZPosition(int zPos) { m_zPosition = zPos; }
// Was it a button event? (*doesn't* mean: is any button *down*?) // Was it a button event? (*doesn't* mean: is any button *down*?)
inline bool IsButton(void) const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
(GetEventType() == wxEVT_JOY_BUTTON_DOWN)); } (GetEventType() == wxEVT_JOY_BUTTON_DOWN)); }
// Was it a move event? // Was it a move event?
inline bool IsMove(void) const { return (GetEventType() == wxEVT_JOY_MOVE) ; } bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE) ; }
// Was it a zmove event? // Was it a zmove event?
inline bool IsZMove(void) const { return (GetEventType() == wxEVT_JOY_ZMOVE) ; } bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE) ; }
// Was it a down event from button 1, 2, 3, 4 or any? // Was it a down event from button 1, 2, 3, 4 or any?
inline bool ButtonDown(int but = wxJOY_BUTTON_ANY) const bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was it a up event from button 1, 2, 3 or any? // Was it a up event from button 1, 2, 3 or any?
inline bool ButtonUp(int but = wxJOY_BUTTON_ANY) const bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
{ return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
// Was the given button 1,2,3,4 or any in Down state? // Was the given button 1,2,3,4 or any in Down state?
inline bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
{ return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
((m_buttonState & but) == but)); } ((m_buttonState & but) == but)); }
}; };
@@ -867,21 +916,23 @@ class WXDLLEXPORT wxJoystickEvent: public wxEvent
wxEVT_DROP_FILES wxEVT_DROP_FILES
*/ */
class WXDLLEXPORT wxDropFilesEvent: public wxEvent class WXDLLEXPORT wxDropFilesEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxDropFilesEvent) DECLARE_DYNAMIC_CLASS(wxDropFilesEvent)
public: public:
int m_noFiles; int m_noFiles;
wxPoint m_pos; wxPoint m_pos;
wxString* m_files; // Memory (de)allocated by code calling ProcessEvent wxString* m_files; // Memory (de)allocated by code calling ProcessEvent
inline wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, wxString *files = (wxString *) NULL) wxDropFilesEvent(wxEventType type = wxEVT_NULL,
int noFiles = 0,
wxString *files = (wxString *) NULL)
{ m_eventType = type; m_noFiles = noFiles; m_files = files; } { m_eventType = type; m_noFiles = noFiles; m_files = files; }
inline wxPoint GetPosition(void) const { return m_pos; } wxPoint GetPosition() const { return m_pos; }
inline int GetNumberOfFiles(void) const { return m_noFiles; } int GetNumberOfFiles() const { return m_noFiles; }
inline wxString *GetFiles(void) const { return m_files; } wxString *GetFiles() const { return m_files; }
}; };
// Idle event // Idle event
@@ -889,16 +940,16 @@ class WXDLLEXPORT wxDropFilesEvent: public wxEvent
wxEVT_IDLE wxEVT_IDLE
*/ */
class WXDLLEXPORT wxIdleEvent: public wxEvent class WXDLLEXPORT wxIdleEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxIdleEvent) DECLARE_DYNAMIC_CLASS(wxIdleEvent)
public: public:
inline wxIdleEvent(void) wxIdleEvent()
{ m_eventType = wxEVT_IDLE; m_requestMore = FALSE; } { m_eventType = wxEVT_IDLE; m_requestMore = FALSE; }
inline void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; } void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; }
inline bool MoreRequested(void) const { return m_requestMore; } bool MoreRequested() const { return m_requestMore; }
protected: protected:
bool m_requestMore; bool m_requestMore;
@@ -912,35 +963,41 @@ protected:
class WXDLLEXPORT wxMenu; class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxWindow; class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxUpdateUIEvent: public wxCommandEvent class WXDLLEXPORT wxUpdateUIEvent : public wxCommandEvent
{ {
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent) DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
inline wxUpdateUIEvent(wxWindowID commandId = 0) public:
{ m_eventType = wxEVT_UPDATE_UI; m_id = commandId; wxUpdateUIEvent(wxWindowID commandId = 0)
m_checked = FALSE; m_setChecked = FALSE; m_enabled = FALSE; m_setEnabled = FALSE; {
m_setText = FALSE; m_text = ""; } m_eventType = wxEVT_UPDATE_UI;
m_id = commandId;
m_checked = FALSE;
m_setChecked = FALSE;
m_enabled = FALSE;
m_setEnabled = FALSE;
m_setText = FALSE;
m_text = "";
}
inline bool GetChecked(void) const { return m_checked; } bool GetChecked() const { return m_checked; }
inline bool GetEnabled(void) const { return m_enabled; } bool GetEnabled() const { return m_enabled; }
inline wxString GetText(void) const { return m_text; } wxString GetText() const { return m_text; }
inline bool GetSetText(void) const { return m_setText; } bool GetSetText() const { return m_setText; }
inline bool GetSetChecked(void) const { return m_setChecked; } bool GetSetChecked() const { return m_setChecked; }
inline bool GetSetEnabled(void) const { return m_setEnabled; } bool GetSetEnabled() const { return m_setEnabled; }
inline void Check(bool check) { m_checked = check; m_setChecked = TRUE; } void Check(bool check) { m_checked = check; m_setChecked = TRUE; }
inline void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; } void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; }
inline void SetText(const wxString& text) { m_text = text; m_setText = TRUE; } void SetText(const wxString& text) { m_text = text; m_setText = TRUE; }
protected:
protected:
bool m_checked; bool m_checked;
bool m_enabled; bool m_enabled;
bool m_setEnabled; bool m_setEnabled;
bool m_setText; bool m_setText;
bool m_setChecked; bool m_setChecked;
wxString m_text; wxString m_text;
}; };
/* /*
@@ -948,12 +1005,12 @@ class WXDLLEXPORT wxUpdateUIEvent: public wxCommandEvent
*/ */
// TODO: shouldn't all events record the window ID? // TODO: shouldn't all events record the window ID?
class WXDLLEXPORT wxSysColourChangedEvent: public wxEvent class WXDLLEXPORT wxSysColourChangedEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent) DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
public: public:
inline wxSysColourChangedEvent(void) wxSysColourChangedEvent()
{ m_eventType = wxEVT_SYS_COLOUR_CHANGED; } { m_eventType = wxEVT_SYS_COLOUR_CHANGED; }
}; };
@@ -961,16 +1018,19 @@ class WXDLLEXPORT wxSysColourChangedEvent: public wxEvent
wxEVT_PALETTE_CHANGED wxEVT_PALETTE_CHANGED
*/ */
class WXDLLEXPORT wxPaletteChangedEvent: public wxEvent class WXDLLEXPORT wxPaletteChangedEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxPaletteChangedEvent) DECLARE_DYNAMIC_CLASS(wxPaletteChangedEvent)
public: public:
inline wxPaletteChangedEvent(wxWindowID id = 0): wxEvent(id) wxPaletteChangedEvent(wxWindowID id = 0) : wxEvent(id)
{ m_eventType = wxEVT_PALETTE_CHANGED; m_changedWindow = (wxWindow *) NULL; } {
m_eventType = wxEVT_PALETTE_CHANGED;
m_changedWindow = (wxWindow *) NULL;
}
inline void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
inline wxWindow* GetChangedWindow() const { return m_changedWindow; } wxWindow* GetChangedWindow() const { return m_changedWindow; }
protected: protected:
wxWindow* m_changedWindow; wxWindow* m_changedWindow;
@@ -981,17 +1041,17 @@ protected:
Indicates the window is getting keyboard focus and should re-do its palette. Indicates the window is getting keyboard focus and should re-do its palette.
*/ */
class WXDLLEXPORT wxQueryNewPaletteEvent: public wxEvent class WXDLLEXPORT wxQueryNewPaletteEvent : public wxEvent
{ {
DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent) DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent)
public: public:
inline wxQueryNewPaletteEvent(wxWindowID id = 0): wxEvent(id) wxQueryNewPaletteEvent(wxWindowID id = 0): wxEvent(id)
{ m_eventType = wxEVT_QUERY_NEW_PALETTE; m_paletteRealized = FALSE; } { m_eventType = wxEVT_QUERY_NEW_PALETTE; m_paletteRealized = FALSE; }
// App sets this if it changes the palette. // App sets this if it changes the palette.
inline void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
inline bool GetPaletteRealized() const { return m_paletteRealized; } bool GetPaletteRealized() const { return m_paletteRealized; }
protected: protected:
bool m_paletteRealized; bool m_paletteRealized;
@@ -1050,8 +1110,9 @@ struct WXDLLEXPORT wxEventTableEntry
int m_eventType; // main event type int m_eventType; // main event type
int m_id; // control/menu/toolbar id int m_id; // control/menu/toolbar id
int m_lastId; // used for ranges of ids int m_lastId; // used for ranges of ids
wxObjectEventFunction m_fn; // function to call: not wxEventFunction, because wxObjectEventFunction m_fn; // function to call: not wxEventFunction,
// of dependency problems // because of dependency problems
wxObject* m_callbackUserData; wxObject* m_callbackUserData;
}; };
@@ -1061,46 +1122,55 @@ struct WXDLLEXPORT wxEventTable
const wxEventTableEntry *entries; // Points to bottom of entry array const wxEventTableEntry *entries; // Points to bottom of entry array
}; };
class WXDLLEXPORT wxEvtHandler: public wxObject class WXDLLEXPORT wxEvtHandler : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxEvtHandler) DECLARE_DYNAMIC_CLASS(wxEvtHandler)
public:
wxEvtHandler(void);
~wxEvtHandler(void);
inline wxEvtHandler *GetNextHandler(void) const { return m_nextHandler; } public:
inline wxEvtHandler *GetPreviousHandler(void) const { return m_previousHandler; } wxEvtHandler();
inline void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } ~wxEvtHandler();
inline void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
inline void SetEvtHandlerEnabled(bool en) { m_enabled = en; } wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
inline bool GetEvtHandlerEnabled(void) const { return m_enabled; } wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
void SetEvtHandlerEnabled(bool en) { m_enabled = en; }
bool GetEvtHandlerEnabled() const { return m_enabled; }
virtual void OnCommand(wxWindow& WXUNUSED(win),
wxCommandEvent& WXUNUSED(event))
{
}
inline virtual void OnCommand(wxWindow& WXUNUSED(win), wxCommandEvent& WXUNUSED(event)) {};
// Called if child control has no // Called if child control has no
// callback function // callback function
// Default behaviour // Default behaviour
virtual long Default(void) { if (GetNextHandler()) return GetNextHandler()->Default(); else return 0; }; virtual long Default()
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; };
virtual bool OnClose(void); virtual bool OnClose();
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
// Dynamic association of a member function handler with the event handler, id and event type // Dynamic association of a member function handler with the event handler,
// id and event type
void Connect( int id, int lastId, wxEventType eventType, void Connect( int id, int lastId, wxEventType eventType,
wxObjectEventFunction func, wxObjectEventFunction func,
wxObject *userData = (wxObject *) NULL ); wxObject *userData = (wxObject *) NULL );
// Convenience function: take just one id // Convenience function: take just one id
inline void Connect( int id, wxEventType eventType, void Connect( int id, wxEventType eventType,
wxObjectEventFunction func, wxObjectEventFunction func,
wxObject *userData = (wxObject *) NULL ) { Connect(id, -1, eventType, func, userData); } wxObject *userData = (wxObject *) NULL )
{ Connect(id, -1, eventType, func, userData); }
bool SearchDynamicEventTable( wxEvent& event ); bool SearchDynamicEventTable( wxEvent& event );
private: private:
static const wxEventTableEntry sm_eventTableEntries[]; static const wxEventTableEntry sm_eventTableEntries[];
protected: protected:
static const wxEventTable sm_eventTable; static const wxEventTable sm_eventTable;
virtual const wxEventTable* GetEventTable() const; virtual const wxEventTable* GetEventTable() const;
@@ -1109,7 +1179,6 @@ protected:
wxEvtHandler* m_previousHandler; wxEvtHandler* m_previousHandler;
bool m_enabled; // Is event handler enabled? bool m_enabled; // Is event handler enabled?
wxList* m_dynamicEvents; wxList* m_dynamicEvents;
}; };
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);

View File

@@ -58,7 +58,6 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const; wxString GetTitle() const;
bool OnClose();
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );

View File

@@ -33,27 +33,27 @@ class wxMiniFrame: public wxFrame
DECLARE_DYNAMIC_CLASS(wxMiniFrame) DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public: public:
inline wxMiniFrame(void) {} wxMiniFrame() {}
inline wxMiniFrame(wxWindow *parent, wxMiniFrame(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr) const wxString& name = wxFrameNameStr)
{ {
Create(parent, id, title, pos, size, style, name); Create(parent, id, title, pos, size, style, name);
} }
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr); const wxString& name = wxFrameNameStr);
// implementation // implementation
bool m_isDragging; bool m_isDragging;
int m_oldX,m_oldY; int m_oldX,m_oldY;
int m_diffX,m_diffY; int m_diffX,m_diffY;

View File

@@ -184,7 +184,6 @@ public:
virtual void MakeModal( bool modal ); virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; } virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled() const { return IsEnabled(); } inline bool Enabled() const { return IsEnabled(); }
virtual bool OnClose();
virtual void SetFocus(); virtual void SetFocus();
static wxWindow *FindFocus(); static wxWindow *FindFocus();
@@ -195,6 +194,7 @@ public:
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
wxWindow *GetParent() const wxWindow *GetParent() const
{ return m_parent; } { return m_parent; }
wxWindow *GetGrandParent() const wxWindow *GetGrandParent() const
@@ -260,10 +260,10 @@ public:
virtual wxFont& GetFont() { return m_font; } virtual wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont& GetLabelFont() { return GetFont(); }; virtual wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
@@ -277,7 +277,7 @@ public:
virtual wxString GetName() const; virtual wxString GetName() const;
virtual wxString GetLabel() const; virtual wxString GetLabel() const;
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {}; void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
void OnKeyDown( wxKeyEvent &event ); void OnKeyDown( wxKeyEvent &event );
virtual bool IsShown() const; virtual bool IsShown() const;
@@ -289,8 +289,8 @@ public:
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) { }
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) { }
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );

View File

@@ -58,7 +58,6 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const; wxString GetTitle() const;
bool OnClose();
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );

View File

@@ -33,27 +33,27 @@ class wxMiniFrame: public wxFrame
DECLARE_DYNAMIC_CLASS(wxMiniFrame) DECLARE_DYNAMIC_CLASS(wxMiniFrame)
public: public:
inline wxMiniFrame(void) {} wxMiniFrame() {}
inline wxMiniFrame(wxWindow *parent, wxMiniFrame(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr) const wxString& name = wxFrameNameStr)
{ {
Create(parent, id, title, pos, size, style, name); Create(parent, id, title, pos, size, style, name);
} }
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME|wxTINY_CAPTION_HORIZ, long style = wxDEFAULT_FRAME_STYLE | wxTINY_CAPTION_HORIZ,
const wxString& name = wxFrameNameStr); const wxString& name = wxFrameNameStr);
// implementation // implementation
bool m_isDragging; bool m_isDragging;
int m_oldX,m_oldY; int m_oldX,m_oldY;
int m_diffX,m_diffY; int m_diffX,m_diffY;

View File

@@ -184,7 +184,6 @@ public:
virtual void MakeModal( bool modal ); virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; } virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled() const { return IsEnabled(); } inline bool Enabled() const { return IsEnabled(); }
virtual bool OnClose();
virtual void SetFocus(); virtual void SetFocus();
static wxWindow *FindFocus(); static wxWindow *FindFocus();
@@ -195,6 +194,7 @@ public:
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
wxWindow *GetParent() const wxWindow *GetParent() const
{ return m_parent; } { return m_parent; }
wxWindow *GetGrandParent() const wxWindow *GetGrandParent() const
@@ -260,10 +260,10 @@ public:
virtual wxFont& GetFont() { return m_font; } virtual wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont& GetLabelFont() { return GetFont(); }; virtual wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
@@ -277,7 +277,7 @@ public:
virtual wxString GetName() const; virtual wxString GetName() const;
virtual wxString GetLabel() const; virtual wxString GetLabel() const;
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {}; void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
void OnKeyDown( wxKeyEvent &event ); void OnKeyDown( wxKeyEvent &event );
virtual bool IsShown() const; virtual bool IsShown() const;
@@ -289,8 +289,8 @@ public:
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) { }
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) { }
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );

View File

@@ -875,7 +875,7 @@ bool wxTabView::OnEvent(wxMouseEvent& event)
if (!event.LeftDown()) if (!event.LeftDown())
return FALSE; return FALSE;
float x, y; long x, y;
event.Position(&x, &y); event.Position(&x, &y);
wxTabControl *hitControl = (wxTabControl *) NULL; wxTabControl *hitControl = (wxTabControl *) NULL;

View File

@@ -217,11 +217,12 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
// yes // yes
} }
bool wxDialog::OnClose() void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
static wxList closing; static wxList closing;
if (closing.Member(this)) return FALSE; // no loops if (closing.Member(this))
return; // no loops
closing.Append(this); closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent); GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this); closing.DeleteObject(this);
return FALSE; if ( event.CanVeto() )
event.Veto();
} }
bool wxDialog::Destroy() bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
return TRUE; return TRUE;
} }
void wxDialog::OnCloseWindow( wxCloseEvent& event )
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
}
}
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{ {
// due to a bug in gtk, x,y are always 0 // due to a bug in gtk, x,y are always 0

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize) EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );

View File

@@ -1716,9 +1716,15 @@ bool wxWindow::Close( bool force )
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
event.SetForce(force); event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(event);
// when we're forced to close we do it anyhow, otherwise only if the
// application didn't forbid it (if the event wasn't processed, GetVeto()
// will return FALSE too)
if ( force || !event.GetVeto() )
Destroy();
} }
bool wxWindow::Destroy() bool wxWindow::Destroy()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus; return IsEnabled() && IsShown() && m_acceptsFocus;
} }
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );

View File

@@ -217,11 +217,12 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
// yes // yes
} }
bool wxDialog::OnClose() void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
static wxList closing; static wxList closing;
if (closing.Member(this)) return FALSE; // no loops if (closing.Member(this))
return; // no loops
closing.Append(this); closing.Append(this);
@@ -230,7 +231,8 @@ bool wxDialog::OnClose()
GetEventHandler()->ProcessEvent(cancelEvent); GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this); closing.DeleteObject(this);
return FALSE; if ( event.CanVeto() )
event.Veto();
} }
bool wxDialog::Destroy() bool wxDialog::Destroy()
@@ -240,14 +242,6 @@ bool wxDialog::Destroy()
return TRUE; return TRUE;
} }
void wxDialog::OnCloseWindow( wxCloseEvent& event )
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
}
}
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{ {
// due to a bug in gtk, x,y are always 0 // due to a bug in gtk, x,y are always 0

View File

@@ -104,7 +104,6 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize) EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -226,11 +225,6 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy();
}
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );

View File

@@ -1716,9 +1716,15 @@ bool wxWindow::Close( bool force )
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this); event.SetEventObject(this);
event.SetForce(force); event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); (void)GetEventHandler()->ProcessEvent(event);
// when we're forced to close we do it anyhow, otherwise only if the
// application didn't forbid it (if the event wasn't processed, GetVeto()
// will return FALSE too)
if ( force || !event.GetVeto() )
Destroy();
} }
bool wxWindow::Destroy() bool wxWindow::Destroy()
@@ -2235,11 +2241,6 @@ bool wxWindow::AcceptsFocus() const
return IsEnabled() && IsShown() && m_acceptsFocus; return IsEnabled() && IsShown() && m_acceptsFocus;
} }
bool wxWindow::OnClose()
{
return TRUE;
}
void wxWindow::AddChild( wxWindow *child ) void wxWindow::AddChild( wxWindow *child )
{ {
wxCHECK_RET( (m_widget != NULL), "invalid window" ); wxCHECK_RET( (m_widget != NULL), "invalid window" );