Session management changes for wxMSW.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -850,7 +850,7 @@ enum {
|
||||
#define wxID_HIGHEST 5999
|
||||
|
||||
// Shortcut for easier dialog-unit-to-pixel conversion
|
||||
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixel(pt)
|
||||
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Stand-ins for Windows types, to avoid
|
||||
|
@@ -31,7 +31,6 @@ class wxDocMDIParentFrame: public wxMDIParentFrame
|
||||
const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
|
||||
bool OnClose(void);
|
||||
// Extend event processing to search the document manager's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
@@ -39,6 +38,7 @@ class wxDocMDIParentFrame: public wxMDIParentFrame
|
||||
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnMRUFile(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
protected:
|
||||
wxDocManager *m_docManager;
|
||||
@@ -61,11 +61,11 @@ class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame
|
||||
long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxDocMDIChildFrame(void);
|
||||
|
||||
bool OnClose(void);
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
inline wxDocument *GetDocument(void) const { return m_childDocument; }
|
||||
inline wxView *GetView(void) const { return m_childView; }
|
||||
|
@@ -372,12 +372,11 @@ class WXDLLEXPORT wxDocChildFrame: public wxFrame
|
||||
long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxDocChildFrame(void);
|
||||
|
||||
bool OnClose(void);
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// void OldOnMenuCommand(int id);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
inline wxDocument *GetDocument(void) const { return m_childDocument; }
|
||||
inline wxView *GetView(void) const { return m_childView; }
|
||||
@@ -403,15 +402,14 @@ class WXDLLEXPORT wxDocParentFrame: public wxFrame
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long type = wxDEFAULT_FRAME, const wxString& name = "frame");
|
||||
|
||||
bool OnClose(void);
|
||||
// Extend event processing to search the document manager's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// void OldOnMenuCommand(int id);
|
||||
wxDocManager *GetDocumentManager(void) const { return m_docManager; }
|
||||
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnMRUFile(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
protected:
|
||||
wxDocManager *m_docManager;
|
||||
|
@@ -680,22 +680,27 @@ class WXDLLEXPORT wxCloseEvent: public wxEvent
|
||||
public:
|
||||
|
||||
inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0)
|
||||
{ m_eventType = type; m_sessionEnding = TRUE; m_loggingOff = TRUE; m_veto = FALSE;
|
||||
m_id = id; m_force = FALSE; }
|
||||
{ m_eventType = type; m_loggingOff = TRUE; m_veto = FALSE;
|
||||
m_id = id; m_force = FALSE; m_canVeto = FALSE; }
|
||||
|
||||
inline bool GetSessionEnding(void) const { return m_sessionEnding; }
|
||||
inline void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
|
||||
inline bool GetLoggingOff(void) const { return m_loggingOff; }
|
||||
inline void Veto(bool veto = TRUE) { m_veto = veto; }
|
||||
inline void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
|
||||
inline bool CanVeto() const { return m_canVeto; }
|
||||
inline bool GetVeto(void) const { return m_veto; }
|
||||
|
||||
// This is probably obsolete now, since we use CanVeto instead, in
|
||||
// both OnCloseWindow and OnQueryEndSession.
|
||||
// m_force == ! m_canVeto i.e., can't veto means we must force it to close.
|
||||
inline void SetForce(bool force) { m_force = force; }
|
||||
inline bool GetForce(void) const { return m_force; }
|
||||
|
||||
protected:
|
||||
bool m_sessionEnding;
|
||||
bool m_loggingOff;
|
||||
bool m_veto;
|
||||
bool m_force;
|
||||
|
||||
bool m_canVeto;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1121,6 +1126,8 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
||||
#define EVT_SIZE(func) { wxEVT_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_MOVE(func) { wxEVT_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_CLOSE(func) { wxEVT_CLOSE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_END_SESSION(func) { wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_QUERY_END_SESSION(func) { wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_PAINT(func) { wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_ERASE_BACKGROUND(func) { wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL },
|
||||
#define EVT_CHAR(func) { wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL },
|
||||
|
@@ -54,6 +54,8 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
|
||||
virtual void Dispatch() ;
|
||||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
void OnEndSession(wxCloseEvent& event);
|
||||
void OnQueryEndSession(wxCloseEvent& event);
|
||||
|
||||
// Generic
|
||||
virtual bool OnInit() { return FALSE; };
|
||||
|
@@ -515,6 +515,9 @@ public:
|
||||
virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem);
|
||||
virtual bool MSWOnClose(void);
|
||||
// Return TRUE to end session, FALSE to veto end session.
|
||||
virtual bool MSWOnQueryEndSession(long logOff);
|
||||
virtual bool MSWOnEndSession(bool endSession, long logOff);
|
||||
virtual bool MSWOnDestroy(void);
|
||||
virtual bool MSWOnSetFocus(WXHWND wnd);
|
||||
virtual bool MSWOnKillFocus(WXHWND wnd);
|
||||
|
Reference in New Issue
Block a user