Removed lots of OnClose functions; doc'ed OnCloseWindow better;

MM_... -> wxMM_...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-02-05 23:55:04 +00:00
parent cd743a6f71
commit e306597309
130 changed files with 533 additions and 659 deletions

View File

@@ -148,7 +148,7 @@ same API;
temporarily with the window as an argument; temporarily with the window as an argument;
\item events from sliders and scrollbars can be handled more flexibly; \item events from sliders and scrollbars can be handled more flexibly;
\item the handling of window close events has been changed in line with the new \item the handling of window close events has been changed in line with the new
event system, but backward {\bf OnClose} compatibility has been retained; event system;
\item the concept of {\it validator} has been added to allow much easier coding of \item the concept of {\it validator} has been added to allow much easier coding of
the relationship between controls and application data; the relationship between controls and application data;
\item the documentation has been revised, with more cross-referencing. \item the documentation has been revised, with more cross-referencing.

View File

@@ -644,12 +644,12 @@ PostScript output.
The mapping mode can be one of the following: The mapping mode can be one of the following:
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{MM\_TWIPS}{Each logical unit is 1/20 of a point, or 1/1440 of \twocolitem{wxMM\_TWIPS}{Each logical unit is 1/20 of a point, or 1/1440 of
an inch.} an inch.}
\twocolitem{MM\_POINTS}{Each logical unit is a point, or 1/72 of an inch.} \twocolitem{wxMM\_POINTS}{Each logical unit is a point, or 1/72 of an inch.}
\twocolitem{MM\_METRIC}{Each logical unit is 1 mm.} \twocolitem{wxMM\_METRIC}{Each logical unit is 1 mm.}
\twocolitem{MM\_LOMETRIC}{Each logical unit is 1/10 of a mm.} \twocolitem{wxMM\_LOMETRIC}{Each logical unit is 1/10 of a mm.}
\twocolitem{MM\_TEXT}{Each logical unit is 1 pixel.} \twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
\end{twocollist} \end{twocollist}
\membersection{wxDC::SetOptimization}\label{wxsetoptimization} \membersection{wxDC::SetOptimization}\label{wxsetoptimization}

View File

@@ -463,7 +463,7 @@ the equivalent of the following code to the start of the metafile data:
SetWindowExt(dc, maxX - minX, maxY - minY); SetWindowExt(dc, maxX - minX, maxY - minY);
\end{verbatim} \end{verbatim}
This simulates the MM\_TEXT mapping mode, which wxWindows assumes. This simulates the wxMM\_TEXT mapping mode, which wxWindows assumes.
Placeable metafiles may be imported by many Windows applications, and can be Placeable metafiles may be imported by many Windows applications, and can be
used in RTF (Rich Text Format) files. used in RTF (Rich Text Format) files.

View File

@@ -167,9 +167,9 @@ in the application.
This function should be called by the application prior to This function should be called by the application prior to
showing the frame. showing the frame.
\membersection{wxPreviewFrame::OnClose} \membersection{wxPreviewFrame::OnCloseWindow}
\func{bool}{OnClose}{\void} \func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
Enables the other frames in the application, and deletes the print preview Enables the other frames in the application, and deletes the print preview
object, implicitly deleting any printout objects associated with the print object, implicitly deleting any printout objects associated with the print

View File

@@ -9,15 +9,18 @@ to close windows.
\wxheading{What is the sequence of events in a window deletion?} \wxheading{What is the sequence of events in a window deletion?}
When the user clicks on the system close button or system close command, When the user clicks on the system close button or system close command,
in a frame or a dialog, wxWindows calls \helpref{wxWindow::Close}{wxwindowclose}. in a frame or a dialog, wxWindows calls \helpref{wxWindow::Close}{wxwindowclose}. This
in turn generates an EVT\_CLOSE event: see \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow}.
This function then generates a \helpref{wxCloseEvent}{wxcloseevent} event which It is the duty of the application to define a suitable event handler, and
can be handled by the application (by using an EVT\_CLOSE event table entry). It is the duty of the application to decide whether or not to destroy the window.
define a suitable event handler, and decide whether or not to destroy the window. If the application is for some reason forcing the application to close
If the application is for some reason forcing the application to close, (\helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto} returns FALSE), the window should always be destroyed, otherwise there is the option to
the window should always be destroyed, otherwise there is the option to
ignore the request, or maybe wait until the user has answered a question ignore the request, or maybe wait until the user has answered a question
before deciding whether it's safe to close. before deciding whether it's safe to close. The handler for EVT\_CLOSE should
signal to the calling code if it does not destroy the window, by calling
\helpref{wxCloseEvent::Veto}{wxcloseeventveto}. Calling this provides useful information
to the calling code.
The wxCloseEvent handler should only call \helpref{wxWindow::Destroy}{wxwindowdestroy} to The wxCloseEvent handler should only call \helpref{wxWindow::Destroy}{wxwindowdestroy} to
delete the window, and not use the {\bf delete} operator. This is because delete the window, and not use the {\bf delete} operator. This is because
@@ -26,24 +29,28 @@ since otherwise there is the danger that events will be sent to a non-existent w
\wxheading{How can the application close a window itself?} \wxheading{How can the application close a window itself?}
Your application can use the \helpref{wxWindow::Close}{wxwindowclose} event just as Your application can either use \helpref{wxWindow::Close}{wxwindowclose} event just as
the framework does. Pass a TRUE argument to this function to tell the event handler the framework does, or it can call \helpref{wxWindow::Destroy}{wxwindowdestroy} directly.
that we definitely want to delete the frame. If using Close(), you can pass a TRUE argument to this function to tell the event handler
that we definitely want to delete the frame and it cannot be vetoed.
If for some reason you don't wish to use the {\bf Close} function to delete a window, at least use The advantage of using Close instead of Destroy is that it will call any clean-up code
the {\bf Destroy} function so that wxWindows can decide when it's safe to delete the window. defined by the EVT\_CLOSE handler; for example it may close a document contained in
a window after first asking the user whether the work should be saved. Close can be vetoed
by this process (return FALSE), whereas Destroy definitely destroys the window.
\wxheading{What is the default behaviour?} \wxheading{What is the default behaviour?}
By default, the close event handlers for wxFrame and wxDialog The default close event handler for wxDialog simulates a Cancel command,
both call the old \helpref{wxWindow::OnClose}{wxwindowonclose} handler
for backward compatibility. So you can still use the old form if you wish.
In addition, the default close event handler for wxDialog simulates a Cancel command,
generating a wxID\_CANCEL event. Since the handler for this cancel event might generating a wxID\_CANCEL event. Since the handler for this cancel event might
itself call {\bf Close}, there is a check for infinite looping. itself call {\bf Close}, there is a check for infinite looping. The default handler
for wxID\_CANCEL hides the dialog (if modeless) or calls EndModal(wxID\_CANCEL) (if modal).
In other words, by default, the dialog is not destroyed (it might have been created
on the stack, so the assumption of dynamic creation cannot be made).
Under Windows, wxDialog also defines a handler for \helpref{wxWindow::OnCharHook}{wxwindowoncharhook} that The default close event handler for wxFrame destroys the frame using Destroy().
Under Windows, wxDialog defines a handler for \helpref{wxWindow::OnCharHook}{wxwindowoncharhook} that
generates a Cancel event if the Escape key has been pressed. generates a Cancel event if the Escape key has been pressed.
\wxheading{What should I do when the user calls up Exit from a menu?} \wxheading{What should I do when the user calls up Exit from a menu?}
@@ -63,9 +70,6 @@ In wxWindows 1.xx, the {\bf OnClose} function did not actually delete 'this', bu
to the calling function (either {\bf Close}, or the wxWindows framework) to delete to the calling function (either {\bf Close}, or the wxWindows framework) to delete
or not delete the window. or not delete the window.
You can still use this function unchanged in 2.0, but it's worth upgrading to
the new method in case future versions of wxWindows does not support the old one.
To update your code, you should provide an event table entry in your frame or To update your code, you should provide an event table entry in your frame or
dialog, using the EVT\_CLOSE macro. The event handler function might look like this: dialog, using the EVT\_CLOSE macro. The event handler function might look like this:
@@ -73,22 +77,13 @@ dialog, using the EVT\_CLOSE macro. The event handler function might look like t
\begin{verbatim} \begin{verbatim}
void MyFrame::OnCloseWindow(wxCloseEvent& event) void MyFrame::OnCloseWindow(wxCloseEvent& event)
{ {
// If the application forces the deletion,
// obey without question.
if (event.GetForce())
{
this->Destroy();
return;
}
// Otherwise...
if (MyDataHasBeenModified()) if (MyDataHasBeenModified())
{ {
wxMessageDialog* dialog = new wxMessageDialog(this, wxMessageDialog* dialog = new wxMessageDialog(this,
"Save changed data?", "My app", wxYES_NO|wxCANCEL); "Save changed data?", "My app", wxYES_NO|wxCANCEL);
int ans = dialog->ShowModal(); int ans = dialog->ShowModal();
dialog->Close(TRUE); dialog->Destroy();
switch (ans) switch (ans)
{ {
@@ -101,6 +96,10 @@ dialog, using the EVT\_CLOSE macro. The event handler function might look like t
break; break;
case wxID_CANCEL: // Do nothing - so don't quit app. case wxID_CANCEL: // Do nothing - so don't quit app.
default: default:
if (!event.CanVeto()) // Test if we can veto this deletion
this->Destroy(); // If not, destroy the window anyway.
else
event.Veto(); // Notify the calling code that we didn't delete the frame.
break; break;
} }
} }
@@ -111,7 +110,8 @@ dialog, using the EVT\_CLOSE macro. The event handler function might look like t
\wxheading{How do I exit the application gracefully?} \wxheading{How do I exit the application gracefully?}
A wxWindows application automatically exits when the designated top window, or the A wxWindows application automatically exits when the designated top window, or the
last frame or dialog, is destroyed. last frame or dialog, is destroyed. Put any application-wide cleanup code in \helpref{wxApp::OnExit}{wxapponexit} (this
is a virtual function, not an event handler).
\wxheading{Do child windows get deleted automatically?} \wxheading{Do child windows get deleted automatically?}

View File

@@ -27,7 +27,7 @@ or if allowing the user to specify a face name, store the family id with any fil
might be transported to a different Windows machine or other platform. might be transported to a different Windows machine or other platform.
\normalbox{{\bf Note:} There is currently a difference between the appearance of fonts on the \normalbox{{\bf Note:} There is currently a difference between the appearance of fonts on the
two platforms, if the mapping mode is anything other than MM\_TEXT. two platforms, if the mapping mode is anything other than wxMM\_TEXT.
Under X, font size is always specified in points. Under MS Windows, the Under X, font size is always specified in points. Under MS Windows, the
unit for text is points but the text is scaled according to the unit for text is points but the text is scaled according to the
current mapping mode. However, user scaling on a device context will current mapping mode. However, user scaling on a device context will

View File

@@ -898,7 +898,7 @@ the control(s) in question.
Called when the user has tried to close a a frame Called when the user has tried to close a a frame
or dialog box using the window manager (X) or system menu (Windows). or dialog box using the window manager (X) or system menu (Windows).
{\bf Note:} This is an obsolete function retained for backward compatibility. {\bf Note:} This is an obsolete function.
It is superceded by the \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow} event It is superceded by the \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow} event
handler. handler.
@@ -908,10 +908,6 @@ If TRUE is returned by OnClose, the window will be deleted by the system, otherw
attempt will be ignored. Do not delete the window from within this handler, although attempt will be ignored. Do not delete the window from within this handler, although
you may delete other windows. you may delete other windows.
\wxheading{Remarks}
Derive your own class to handle this message. The default handler returns TRUE.
\wxheading{See also} \wxheading{See also}
\helpref{Window deletion overview}{windowdeletionoverview},\rtfsp \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp

View File

@@ -296,3 +296,7 @@ General Notes
and it's also on the wxWindows CD-ROM under Packages. and it's also on the wxWindows CD-ROM under Packages.
- If you are installing wxWindows 2 from CVS, you may find that
include/wx/msw/setup.h is missing. This is deliberate, to avoid
developers' different setup.h configurations getting confused.
Please copy setup0.h to setup.h before compiling.

View File

@@ -946,6 +946,19 @@ enum
#define wxID_HIGHEST 5999 #define wxID_HIGHEST 5999
// Mapping modes (as per Windows)
#define wxMM_TEXT 1
#define wxMM_LOMETRIC 2
#define wxMM_HIMETRIC 3
#define wxMM_LOENGLISH 4
#define wxMM_HIENGLISH 5
#define wxMM_TWIPS 6
#define wxMM_ISOTROPIC 7
#define wxMM_ANISOTROPIC 8
#define wxMM_POINTS 9
#define wxMM_METRIC 10
/* Shortcut for easier dialog-unit-to-pixel conversion */ /* Shortcut for easier dialog-unit-to-pixel conversion */
#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)

View File

@@ -188,7 +188,7 @@ 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 #if WXWIN_COMPATIBILITY
// Defeat compiler warning // Defeat compiler warning
bool OnClose(void) { return wxEvtHandler::OnClose(); } bool OnClose(void) { return wxEvtHandler::OnClose(); }
#endif #endif

View File

@@ -771,6 +771,7 @@ public:
m_veto = veto; m_veto = veto;
} }
void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
// No more asserts here please, the one you put here was wrong.
bool CanVeto() const { return m_canVeto; } bool CanVeto() const { return m_canVeto; }
bool GetVeto() const { return m_canVeto && m_veto; } bool GetVeto() const { return m_canVeto && m_veto; }
@@ -1156,7 +1157,9 @@ public:
virtual long Default() virtual long Default()
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; }; { return GetNextHandler() ? GetNextHandler()->Default() : 0; };
#if WXWIN_COMPATIBILITY
virtual bool OnClose(); virtual bool OnClose();
#endif
virtual bool ProcessEvent(wxEvent& event); virtual bool ProcessEvent(wxEvent& event);
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);

View File

@@ -88,8 +88,6 @@ class WXDLLEXPORT wxGenericColourDialog: public wxDialog
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
bool OnClose(void);
virtual void CalculateMeasurements(void); virtual void CalculateMeasurements(void);
virtual void CreateWidgets(void); virtual void CreateWidgets(void);
virtual void InitializeColours(void); virtual void InitializeColours(void);
@@ -102,17 +100,14 @@ class WXDLLEXPORT wxGenericColourDialog: public wxDialog
virtual void OnBasicColourClick(int which); virtual void OnBasicColourClick(int which);
virtual void OnCustomColourClick(int which); virtual void OnCustomColourClick(int which);
/*
virtual void OnOk(void);
virtual void OnCancel(void);
virtual void OnAddCustom(void);
*/
void OnAddCustom(wxCommandEvent& event); void OnAddCustom(wxCommandEvent& event);
void OnRedSlider(wxCommandEvent& event); void OnRedSlider(wxCommandEvent& event);
void OnGreenSlider(wxCommandEvent& event); void OnGreenSlider(wxCommandEvent& event);
void OnBlueSlider(wxCommandEvent& event); void OnBlueSlider(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent& event);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -72,7 +72,7 @@ class WXDLLEXPORT wxGenericFontDialog: public wxDialog
// Internal functions // Internal functions
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
virtual void CreateWidgets(void); virtual void CreateWidgets(void);
virtual void InitializeFont(void); virtual void InitializeFont(void);

View File

@@ -71,7 +71,6 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const ; wxString GetTitle() const ;
bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);

View File

@@ -63,8 +63,6 @@ public:
void ClientToScreen(int *x, int *y) const; void ClientToScreen(int *x, int *y) const;
void ScreenToClient(int *x, int *y) const; void ScreenToClient(int *x, int *y) const;
virtual bool OnClose();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);

View File

@@ -87,7 +87,7 @@ protected:
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */

View File

@@ -80,7 +80,7 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const ; wxString GetTitle() const ;
bool OnClose(); // bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);

View File

@@ -79,8 +79,6 @@ public:
void ScreenToClient(int *x, int *y) const; void ScreenToClient(int *x, int *y) const;
wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); } wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); }
virtual bool OnClose();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);

View File

@@ -87,7 +87,7 @@ protected:
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */

View File

@@ -420,8 +420,8 @@ protected:
#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x) #define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y) #define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
#define MM_POINTS 7 #define MM_POINTS 9
#define MM_METRIC 8 #define MM_METRIC 10
extern int wxPageNumber; extern int wxPageNumber;

View File

@@ -82,7 +82,6 @@ public:
wxString GetTitle() const ; wxString GetTitle() const ;
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);

View File

@@ -74,8 +74,6 @@ public:
virtual void ScreenToClient(int *x, int *y) const; virtual void ScreenToClient(int *x, int *y) const;
virtual bool OnClose();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);

View File

@@ -119,7 +119,7 @@ protected:
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */

View File

@@ -173,7 +173,7 @@ public:
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"); long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
~wxPreviewFrame(); ~wxPreviewFrame();
bool OnClose(); void OnCloseWindow(wxCloseEvent& event);
virtual void Initialize(); virtual void Initialize();
virtual void CreateCanvas(); virtual void CreateCanvas();
virtual void CreateControlBar(); virtual void CreateControlBar();
@@ -182,6 +182,8 @@ protected:
wxWindow* m_previewCanvas; wxWindow* m_previewCanvas;
wxPreviewControlBar* m_controlBar; wxPreviewControlBar* m_controlBar;
wxPrintPreviewBase* m_printPreview; wxPrintPreviewBase* m_printPreview;
DECLARE_EVENT_TABLE()
}; };
/* /*

View File

@@ -61,7 +61,7 @@ class WXDLLEXPORT wxPropertyFormView: public wxPropertyView
void OnUpdate(wxCommandEvent& event); void OnUpdate(wxCommandEvent& event);
void OnRevert(wxCommandEvent& event); void OnRevert(wxCommandEvent& event);
virtual bool OnClose(void); virtual bool OnClose();
virtual void OnDoubleClick(wxControl *item); virtual void OnDoubleClick(wxControl *item);
// TODO: does OnCommand still get called...??? // TODO: does OnCommand still get called...???
@@ -230,7 +230,8 @@ class WXDLLEXPORT wxPropertyFormDialog: public wxDialog
wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
bool OnClose(void);
void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item); void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
@@ -239,6 +240,8 @@ class WXDLLEXPORT wxPropertyFormDialog: public wxDialog
private: private:
wxPropertyFormView* m_view; wxPropertyFormView* m_view;
DECLARE_EVENT_TABLE()
}; };
/* /*
@@ -281,7 +284,7 @@ class WXDLLEXPORT wxPropertyFormFrame: public wxFrame
m_view = v; m_view = v;
m_propertyPanel = NULL; m_propertyPanel = NULL;
} }
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view // Must call this to create panel and associate view
virtual bool Initialize(void); virtual bool Initialize(void);
@@ -291,6 +294,8 @@ class WXDLLEXPORT wxPropertyFormFrame: public wxFrame
private: private:
wxPropertyFormView* m_view; wxPropertyFormView* m_view;
wxPanel* m_propertyPanel; wxPanel* m_propertyPanel;
DECLARE_EVENT_TABLE()
}; };
#endif #endif

View File

@@ -276,7 +276,7 @@ class WXDLLEXPORT wxPropertyListDialog: public wxDialog
wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox");
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item); void OnDefaultAction(wxControl *item);
void OnCancel(wxCommandEvent& event); void OnCancel(wxCommandEvent& event);
@@ -338,7 +338,7 @@ class WXDLLEXPORT wxPropertyListFrame: public wxFrame
m_view = v; m_view = v;
m_propertyPanel = NULL; m_propertyPanel = NULL;
} }
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view // Must call this to create panel and associate view
virtual bool Initialize(void); virtual bool Initialize(void);
@@ -348,6 +348,8 @@ class WXDLLEXPORT wxPropertyListFrame: public wxFrame
private: private:
wxPropertyListView* m_view; wxPropertyListView* m_view;
wxPropertyListPanel* m_propertyPanel; wxPropertyListPanel* m_propertyPanel;
DECLARE_EVENT_TABLE()
}; };
/* /*

View File

@@ -71,7 +71,6 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const ; wxString GetTitle() const ;
bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);

View File

@@ -61,8 +61,6 @@ public:
void GetPosition(int *x, int *y) const ; void GetPosition(int *x, int *y) const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual bool OnClose();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);

View File

@@ -71,7 +71,6 @@ public:
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle() const ; wxString GetTitle() const ;
bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);

View File

@@ -63,8 +63,6 @@ public:
void ClientToScreen(int *x, int *y) const; void ClientToScreen(int *x, int *y) const;
void ScreenToClient(int *x, int *y) const; void ScreenToClient(int *x, int *y) const;
virtual bool OnClose();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);

View File

@@ -87,7 +87,7 @@ protected:
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */

View File

@@ -167,7 +167,7 @@ BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wx
dc.GetTextExtent(buf, &chw, &chh); dc.GetTextExtent(buf, &chw, &chh);
dc.SetFont(wxNullFont); dc.SetFont(wxNullFont);
dc.SetMapMode(MM_METRIC); dc.SetMapMode(wxMM_METRIC);
int xcm = dc.LogicalToDeviceX(10.0); int xcm = dc.LogicalToDeviceX(10.0);
int ycm = dc.LogicalToDeviceY(10.0); int ycm = dc.LogicalToDeviceY(10.0);
@@ -183,7 +183,7 @@ BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wx
} }
x_cell = (sx+3+X_UNIT)/X_UNIT; x_cell = (sx+3+X_UNIT)/X_UNIT;
y_cell = (sy+3+Y_UNIT)/Y_UNIT; y_cell = (sy+3+Y_UNIT)/Y_UNIT;
dc.SetMapMode(MM_TEXT); dc.SetMapMode(wxMM_TEXT);
bmp=NULL; bmp=NULL;
UpdateFieldSize(); UpdateFieldSize();
} }

View File

@@ -154,7 +154,7 @@ void CheckListBoxFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void CheckListBoxFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void CheckListBoxFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageDialog dialog(this, "Demo of wxCheckListBox control\n" wxMessageDialog dialog(this, "Demo of wxCheckListBox control\n",
"About wxCheckListBox", wxYES_NO | wxCANCEL); "About wxCheckListBox", wxYES_NO | wxCANCEL);
dialog.ShowModal(); dialog.ShowModal();
} }

View File

@@ -46,7 +46,7 @@ public:
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnDelete(wxCommandEvent& event); void OnDelete(wxCommandEvent& event);
bool OnClose() { return TRUE; } void OnCloseWindow(wxCloseEvent& event);
private: private:
wxTextCtrl *m_text; wxTextCtrl *m_text;
@@ -69,6 +69,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit) EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout) EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Delete, MyFrame::OnDelete) EVT_MENU(Minimal_Delete, MyFrame::OnDelete)
EVT_CLOSE(MyFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// ============================================================================ // ============================================================================
@@ -189,6 +190,11 @@ MyFrame::MyFrame()
SetClientSize(w, h); SetClientSize(w, h);
} }
void MyFrame::OnCloseWindow(wxCloseEvent& event)
{
this->Destroy();
}
void MyFrame::OnQuit(wxCommandEvent&) void MyFrame::OnQuit(wxCommandEvent&)
{ {
Close(TRUE); Close(TRUE);

View File

@@ -264,7 +264,7 @@ void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event)
// to close the program here that is not done elsewhere // to close the program here that is not done elsewhere
this->Destroy(); this->Destroy();
} // DatabaseDemoFrame::OnClose() } // DatabaseDemoFrame::OnCloseWindow()
void DatabaseDemoFrame::CreateDataTable() void DatabaseDemoFrame::CreateDataTable()
@@ -651,21 +651,21 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455)
} // CeditorDlg constructor } // CeditorDlg constructor
bool CeditorDlg::OnClose() void CeditorDlg::OnCloseWindow(wxCloseEvent& event)
{ {
// Clean up time // Clean up time
if ((mode != mCreate) && (mode != mEdit)) if ((mode != mCreate) && (mode != mEdit))
{ {
if (Contact) if (Contact)
delete Contact; delete Contact;
return TRUE; this->Destroy();
} }
else else
{ {
wxMessageBox("Must finish processing the current record being created/modified before exiting","Notice...",wxOK | wxICON_INFORMATION); wxMessageBox("Must finish processing the current record being created/modified before exiting","Notice...",wxOK | wxICON_INFORMATION);
return FALSE; event.Veto();
} }
} // CeditorDlg::OnClose() } // CeditorDlg::OnCloseWindow()
void CeditorDlg::OnButton( wxCommandEvent &event ) void CeditorDlg::OnButton( wxCommandEvent &event )
@@ -1283,6 +1283,11 @@ bool CeditorDlg::GetRec(char *whereStr)
/* /*
* CparameterDlg constructor * CparameterDlg constructor
*/ */
BEGIN_EVENT_TABLE(CparameterDlg, wxDialog)
EVT_CLOSE(CparameterDlg::OnCloseWindow)
END_EVENT_TABLE()
CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIALOG, "ODBC parameter settings", wxPoint(-1, -1), wxSize(400, 275)) CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIALOG, "ODBC parameter settings", wxPoint(-1, -1), wxSize(400, 275))
{ {
// Since the ::OnCommand() function is overridden, this prevents the widget // Since the ::OnCommand() function is overridden, this prevents the widget
@@ -1315,7 +1320,7 @@ CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIA
} // CparameterDlg constructor } // CparameterDlg constructor
bool CparameterDlg::OnClose() void CparameterDlg::OnCloseWindow(wxCloseEvent& event)
{ {
// Put any additional checking necessary to make certain it is alright // Put any additional checking necessary to make certain it is alright
// to close the program here that is not done elsewhere // to close the program here that is not done elsewhere
@@ -1324,15 +1329,19 @@ bool CparameterDlg::OnClose()
bool Ok = (wxMessageBox("No changes have been saved.\n\nAre you sure you wish exit the parameter screen?","Confirm",wxYES_NO|wxICON_QUESTION) == wxYES); bool Ok = (wxMessageBox("No changes have been saved.\n\nAre you sure you wish exit the parameter screen?","Confirm",wxYES_NO|wxICON_QUESTION) == wxYES);
if (!Ok) if (!Ok)
return FALSE; {
event.Veto();
return;
}
wxGetApp().params = savedParamSettings; wxGetApp().params = savedParamSettings;
} }
if (GetParent() != NULL) if (GetParent() != NULL)
GetParent()->SetFocus(); GetParent()->SetFocus();
return TRUE; this->Destroy();
} // Cparameter::OnClose()
} // Cparameter::OnCloseWindow()
void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& event) void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
@@ -1471,6 +1480,7 @@ void CparameterDlg::FillDataSourceList()
BEGIN_EVENT_TABLE(CqueryDlg, wxDialog) BEGIN_EVENT_TABLE(CqueryDlg, wxDialog)
EVT_BUTTON(-1, CqueryDlg::OnButton) EVT_BUTTON(-1, CqueryDlg::OnButton)
EVT_CLOSE(CqueryDlg::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// CqueryDlg() constructor // CqueryDlg() constructor
@@ -1800,7 +1810,7 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
} // CqueryDlg::OnCommand } // CqueryDlg::OnCommand
bool CqueryDlg::OnClose() void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
{ {
// Clean up // Clean up
if (colInf) if (colInf)
@@ -1817,9 +1827,10 @@ bool CqueryDlg::OnClose()
GetParent()->SetFocus(); GetParent()->SetFocus();
wxEndBusyCursor(); wxEndBusyCursor();
return TRUE;
} // CqueryDlg::OnClose() this->Destroy();
} // CqueryDlg::OnCloseWindow()
/* /*
bool CqueryDlg::SetWidgetPtrs() bool CqueryDlg::SetWidgetPtrs()

View File

@@ -165,7 +165,7 @@ class CeditorDlg : public wxPanel
Ccontact *Contact; // this is the table object that will be being manipulated Ccontact *Contact; // this is the table object that will be being manipulated
CeditorDlg(wxWindow *parent); CeditorDlg(wxWindow *parent);
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
void OnButton( wxCommandEvent &event ); void OnButton( wxCommandEvent &event );
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
void OnActivate(bool) {}; // necessary for hot keys void OnActivate(bool) {}; // necessary for hot keys
@@ -243,7 +243,7 @@ class CparameterDlg : public wxDialog
public: public:
CparameterDlg(wxWindow *parent); CparameterDlg(wxWindow *parent);
bool OnClose(void); void OnCloseWindow(wxCloseEvent& event);
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
void OnActivate(bool) {}; // necessary for hot keys void OnActivate(bool) {}; // necessary for hot keys
@@ -252,6 +252,7 @@ class CparameterDlg : public wxDialog
bool Save(); bool Save();
void FillDataSourceList(); void FillDataSourceList();
DECLARE_EVENT_TABLE()
}; // CparameterDlg }; // CparameterDlg
#define PARAMETER_DIALOG 400 #define PARAMETER_DIALOG 400
@@ -341,7 +342,7 @@ class CqueryDlg : public wxDialog
void OnButton( wxCommandEvent &event ); void OnButton( wxCommandEvent &event );
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
bool OnClose(); void OnCloseWindow(wxCloseEvent& event);
void OnActivate(bool) {}; // necessary for hot keys void OnActivate(bool) {}; // necessary for hot keys
// bool SetWidgetPtrs(); // bool SetWidgetPtrs();

View File

@@ -26,7 +26,6 @@ class MyFrame: public wxFrame
{ public: { public:
MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,
const wxSize& size); const wxSize& size);
bool OnClose(void) { return TRUE; }
void ChooseColour(wxCommandEvent& event); void ChooseColour(wxCommandEvent& event);
void ChooseFont(wxCommandEvent& event); void ChooseFont(wxCommandEvent& event);

View File

@@ -91,8 +91,6 @@ public:
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event); void OnRightDown(wxMouseEvent& event);
bool OnClose();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
@@ -302,11 +300,6 @@ void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
m_ctrlLog->Clear(); m_ctrlLog->Clear();
} }
bool DnDFrame::OnClose()
{
return TRUE;
}
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{ {
if ( !m_strText.IsEmpty() ) if ( !m_strText.IsEmpty() )

View File

@@ -43,7 +43,6 @@ class MyFrame: public wxFrame
public: public:
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
bool OnClose(void) { return TRUE; }
}; };
// ID for the menu commands // ID for the menu commands

View File

@@ -123,13 +123,13 @@ void FortyCanvas::OnDraw(wxDC& dc)
/* /*
Called when the main frame is closed Called when the main frame is closed
*/ */
bool FortyCanvas::OnClose() bool FortyCanvas::OnCloseCanvas()
{ {
if (m_game->InPlay() && if (m_game->InPlay() &&
wxMessageBox("Are you sure you want to\nabandon the current game?", wxMessageBox("Are you sure you want to\nabandon the current game?",
"Warning", wxYES_NO | wxICON_QUESTION) == wxNO) "Warning", wxYES_NO | wxICON_QUESTION) == wxNO)
{ {
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }

View File

@@ -25,7 +25,7 @@ public:
virtual ~FortyCanvas(); virtual ~FortyCanvas();
virtual void OnDraw(wxDC& dc); virtual void OnDraw(wxDC& dc);
bool OnClose(); bool OnCloseCanvas();
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void SetCursorStyle(int x, int y); void SetCursorStyle(int x, int y);

View File

@@ -40,7 +40,7 @@ public:
FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h); FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
virtual ~FortyFrame(); virtual ~FortyFrame();
bool OnClose(); void OnCloseWindow(wxCloseEvent& event);
// Menu callbacks // Menu callbacks
void NewGame(wxCommandEvent& event); void NewGame(wxCommandEvent& event);
@@ -73,6 +73,7 @@ BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
EVT_MENU(SCORES, FortyFrame::Scores) EVT_MENU(SCORES, FortyFrame::Scores)
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo) EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand) EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
EVT_CLOSE(FortyFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// Create a new application object // Create a new application object
@@ -189,9 +190,14 @@ FortyFrame::~FortyFrame()
{ {
} }
bool FortyFrame::OnClose() void FortyFrame::OnCloseWindow(wxCloseEvent& event)
{ {
return m_canvas->OnClose(); if (m_canvas->OnCloseCanvas())
{
this->Destroy();
}
else
event.Veto();
} }
void void
@@ -205,7 +211,7 @@ FortyFrame::Exit(wxCommandEvent&)
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
// wxGTK doesn't call OnClose() so we do it here // wxGTK doesn't call OnClose() so we do it here
if (OnClose()) // if (OnClose())
#endif #endif
Close(TRUE); Close(TRUE);
} }

View File

@@ -37,6 +37,7 @@ BEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog)
EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback) EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback) EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback) EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
PlayerSelectionDialog::PlayerSelectionDialog( PlayerSelectionDialog::PlayerSelectionDialog(
@@ -142,13 +143,10 @@ const wxString& PlayerSelectionDialog::GetPlayersName()
return m_player; return m_player;
} }
bool PlayerSelectionDialog::OnClose() void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// hide the dialog
// NB don't return TRUE otherwise delete is called
m_player = ""; m_player = "";
Show(FALSE); EndModal(wxID_CANCEL);
return FALSE;
} }
void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event) void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event)

View File

@@ -28,7 +28,7 @@ public:
protected: protected:
friend void SelectCallback(wxListBox&, wxCommandEvent&); friend void SelectCallback(wxListBox&, wxCommandEvent&);
bool OnClose(); void OnCloseWindow(wxCloseEvent& event);
private: private:
ScoreFile* m_scoreFile; ScoreFile* m_scoreFile;

View File

@@ -137,6 +137,9 @@ void ScoreCanvas::OnDraw(wxDC& dc)
} }
} }
BEGIN_EVENT_TABLE(ScoreDialog, wxDialog)
EVT_CLOSE(ScoreDialog::OnCloseWindow)
END_EVENT_TABLE()
ScoreDialog::ScoreDialog( ScoreDialog::ScoreDialog(
wxWindow* parent, wxWindow* parent,
@@ -183,10 +186,7 @@ void ScoreDialog::Display()
Show(TRUE); Show(TRUE);
} }
bool ScoreDialog::OnClose() void ScoreDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// hide the dialog EndModal(wxID_OK);
// NB don't return TRUE otherwise delete is called
Show(FALSE);
return FALSE;
} }

View File

@@ -22,11 +22,13 @@ public:
void Display(); void Display();
protected: protected:
bool OnClose(); void OnCloseWindow(wxCloseEvent& event);
private: private:
ScoreFile* m_scoreFile; ScoreFile* m_scoreFile;
wxButton* m_OK; wxButton* m_OK;
DECLARE_EVENT_TABLE()
}; };
#endif #endif

View File

@@ -40,8 +40,6 @@ class MyFrame: public wxFrame
wxGrid *grid; wxGrid *grid;
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
bool OnClose(void) { return TRUE; }
void ToggleEditable(wxCommandEvent& event); void ToggleEditable(wxCommandEvent& event);
void ToggleRowLabel(wxCommandEvent& event); void ToggleRowLabel(wxCommandEvent& event);
void ToggleColLabel(wxCommandEvent& event); void ToggleColLabel(wxCommandEvent& event);

View File

@@ -54,8 +54,7 @@ public:
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnPlay(wxCommandEvent& event); void OnPlay(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event); void OnOpen(wxCommandEvent& event);
bool OnClose() { return TRUE; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -164,8 +164,3 @@ void MyFrame::OnActivate(wxActivateEvent& event)
if (event.GetActive() && canvas) if (event.GetActive() && canvas)
canvas->SetFocus(); canvas->SetFocus();
} }
bool MyFrame::OnClose(void)
{
return TRUE;
}

View File

@@ -40,7 +40,6 @@ class MyFrame: public wxFrame
MyCanvas *canvas; MyCanvas *canvas;
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyFrame(void); ~MyFrame(void);
bool OnClose(void);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);

View File

@@ -244,14 +244,6 @@ void MyWindow::OnPaint(wxPaintEvent& WXUNUSED(event) )
frame->Draw(dc,TRUE); frame->Draw(dc,TRUE);
} }
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
bool MyFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}
SizerFrame::SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h): SizerFrame::SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
@@ -346,10 +338,3 @@ void SizerFrame::OnSize(wxSizeEvent& event)
panel->Layout(); panel->Layout();
} }
bool SizerFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}

View File

@@ -29,7 +29,6 @@ class MyFrame: public wxFrame
MyWindow *canvas; MyWindow *canvas;
MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
bool OnClose(void);
void Draw(wxDC& dc, bool draw_bitmaps = TRUE); void Draw(wxDC& dc, bool draw_bitmaps = TRUE);
void LoadFile(wxCommandEvent& event); void LoadFile(wxCommandEvent& event);
@@ -68,7 +67,6 @@ class SizerFrame: public wxFrame
wxPanel *panel; wxPanel *panel;
SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h); SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
bool OnClose(void);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -60,7 +60,6 @@ class MyFrame: public wxFrame
void OnIconTextView(wxCommandEvent& event); void OnIconTextView(wxCommandEvent& event);
void OnSmallIconView(wxCommandEvent& event); void OnSmallIconView(wxCommandEvent& event);
void OnSmallIconTextView(wxCommandEvent& event); void OnSmallIconTextView(wxCommandEvent& event);
bool OnClose(void) { return TRUE; }
void OnDeselectAll(wxCommandEvent& event); void OnDeselectAll(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event); void OnSelectAll(wxCommandEvent& event);

View File

@@ -237,23 +237,6 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
ypos = pt.y; ypos = pt.y;
} }
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
bool MyFrame::OnClose(void)
{
// Must delete children
wxNode *node = my_children.First();
while (node)
{
MyChild *child = (MyChild *)node->Data();
wxNode *next = node->Next();
child->OnClose();
delete child;
node = next;
}
return TRUE;
}
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event) ) void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event) )
{ {
int w, h; int w, h;
@@ -295,11 +278,6 @@ void MyChild::OnActivate(wxActivateEvent& event)
canvas->SetFocus(); canvas->SetFocus();
} }
bool MyChild::OnClose(void)
{
return TRUE;
}
void MyFrame::InitToolBar(wxToolBar* toolBar) void MyFrame::InitToolBar(wxToolBar* toolBar)
{ {
wxBitmap* bitmaps[8]; wxBitmap* bitmaps[8];

View File

@@ -38,7 +38,6 @@ class MyFrame: public wxMDIParentFrame
void InitToolBar(wxToolBar* toolBar); void InitToolBar(wxToolBar* toolBar);
bool OnClose(void);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event); void OnNewWindow(wxCommandEvent& event);
@@ -53,7 +52,6 @@ class MyChild: public wxMDIChildFrame
MyCanvas *canvas; MyCanvas *canvas;
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void); ~MyChild(void);
bool OnClose(void);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);

View File

@@ -93,7 +93,6 @@ class MyChild: public wxFrame
MyCanvas *canvas; MyCanvas *canvas;
MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void); ~MyChild(void);
bool OnClose(void);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnNew(wxCommandEvent& event); void OnNew(wxCommandEvent& event);
@@ -376,12 +375,6 @@ void MyChild::OnActivate(wxActivateEvent& event)
canvas->SetFocus(); canvas->SetFocus();
} }
bool MyChild::OnClose(void)
{
return TRUE;
}
// Dummy MFC window for specifying a valid main window to MFC, using // Dummy MFC window for specifying a valid main window to MFC, using
// a wxWindows HWND. // a wxWindows HWND.
CDummyWindow::CDummyWindow(HWND hWnd):CWnd() CDummyWindow::CDummyWindow(HWND hWnd):CWnd()

View File

@@ -108,13 +108,6 @@ void MyFrame::OnTest1(wxCommandEvent& event)
dialog->Close(TRUE); dialog->Close(TRUE);
} }
bool MyFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}
BEGIN_EVENT_TABLE(MyDialog, wxDialog) BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_BUTTON(wxID_OK, MyDialog::OnOk) EVT_BUTTON(wxID_OK, MyDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel)

View File

@@ -26,7 +26,6 @@ class MyFrame: public wxFrame
public: public:
wxWindow *panel; wxWindow *panel;
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
bool OnClose(void);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnTest1(wxCommandEvent& event); void OnTest1(wxCommandEvent& event);

View File

@@ -263,7 +263,8 @@ void OwnerDrawnFrame::OnQuit(wxCommandEvent& event)
void OwnerDrawnFrame::OnAbout(wxCommandEvent& event) void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
{ {
wxMessageDialog dialog(this, "Demo of owner-drawn controls\n" wxMessageDialog dialog(this,
"Demo of owner-drawn controls\n",
"About wxOwnerDrawn", wxYES_NO | wxCANCEL); "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
dialog.ShowModal(); dialog.ShowModal();
} }

View File

@@ -207,12 +207,4 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
} }
} }
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
bool MyFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}

View File

@@ -32,7 +32,6 @@ class MyFrame: public wxFrame
MyCanvas *canvas; MyCanvas *canvas;
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size);
bool OnClose(void);
void OnActivate(bool) {} void OnActivate(bool) {}
void OnLoadFile(wxCommandEvent& event); void OnLoadFile(wxCommandEvent& event);
void OnSaveFile(wxCommandEvent& event); void OnSaveFile(wxCommandEvent& event);

View File

@@ -131,6 +131,12 @@ bool MyApp::OnInit(void)
return TRUE; return TRUE;
} }
int MyApp::OnExit()
{
delete wxGetApp().m_testFont;
return 1;
}
BEGIN_EVENT_TABLE(MyFrame, wxFrame) BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit) EVT_MENU(WXPRINT_QUIT, MyFrame::OnExit)
EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint) EVT_MENU(WXPRINT_PRINT, MyFrame::OnPrint)
@@ -317,14 +323,6 @@ void MyCanvas::OnEvent(wxMouseEvent& WXUNUSED(event))
{ {
} }
bool MyFrame::OnClose(void)
{
Show(FALSE);
delete wxGetApp().m_testFont;
return TRUE;
}
bool MyPrintout::OnPrintPage(int page) bool MyPrintout::OnPrintPage(int page)
{ {
wxDC *dc = GetDC(); wxDC *dc = GetDC();

View File

@@ -17,8 +17,9 @@
class MyApp: public wxApp class MyApp: public wxApp
{ {
public: public:
MyApp(void) ; MyApp() ;
bool OnInit(void); bool OnInit();
int OnExit();
wxFont* m_testFont; wxFont* m_testFont;
}; };
@@ -34,8 +35,6 @@ class MyFrame: public wxFrame
MyCanvas *canvas; MyCanvas *canvas;
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
bool OnClose(void);
void Draw(wxDC& dc); void Draw(wxDC& dc);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);

View File

@@ -173,13 +173,6 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
dialog->Close(TRUE); dialog->Close(TRUE);
} }
bool MyFrame::OnClose(void)
{
Show(FALSE);
return TRUE;
}
BEGIN_EVENT_TABLE(MyDialog, wxDialog) BEGIN_EVENT_TABLE(MyDialog, wxDialog)
// EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk) // EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk)
EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel) EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel)

View File

@@ -40,7 +40,6 @@ class MyFrame: public wxFrame
public: public:
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size); const wxPoint& pos, const wxSize& size);
bool OnClose();
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnTestDialog(wxCommandEvent& event); void OnTestDialog(wxCommandEvent& event);

View File

@@ -312,23 +312,6 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
ypos = pt.y; ypos = pt.y;
} }
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
bool MyFrame::OnClose(void)
{
// Must delete children
wxNode *node = my_children.First();
while (node)
{
MyChild *child = (MyChild *)node->Data();
wxNode *next = node->Next();
child->OnClose();
delete child;
node = next;
}
return TRUE;
}
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{ {
wxLayoutAlgorithm layout; wxLayoutAlgorithm layout;
@@ -367,9 +350,3 @@ void MyChild::OnActivate(wxActivateEvent& event)
canvas->SetFocus(); canvas->SetFocus();
} }
bool MyChild::OnClose(void)
{
return TRUE;
}

View File

@@ -35,7 +35,6 @@ class MyFrame: public wxMDIParentFrame
MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
bool OnClose(void);
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
void OnNewWindow(wxCommandEvent& event); void OnNewWindow(wxCommandEvent& event);
@@ -58,7 +57,6 @@ class MyChild: public wxMDIChildFrame
MyCanvas *canvas; MyCanvas *canvas;
MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void); ~MyChild(void);
bool OnClose(void);
void OnActivate(wxActivateEvent& event); void OnActivate(wxActivateEvent& event);
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);

View File

@@ -62,8 +62,6 @@ public:
MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size); MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size);
virtual ~MyFrame(); virtual ~MyFrame();
bool OnClose();
// Menu commands // Menu commands
void SplitHorizontal(wxCommandEvent& event); void SplitHorizontal(wxCommandEvent& event);
void SplitVertical(wxCommandEvent& event); void SplitVertical(wxCommandEvent& event);
@@ -185,11 +183,6 @@ MyFrame::~MyFrame()
{ {
} }
bool MyFrame::OnClose()
{
return TRUE;
}
void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) )
{ {
Close(TRUE); Close(TRUE);

View File

@@ -73,7 +73,6 @@ public:
void OnResumeThread(wxCommandEvent& event); void OnResumeThread(wxCommandEvent& event);
void OnIdle(wxIdleEvent &event); void OnIdle(wxIdleEvent &event);
bool OnClose() { return TRUE; }
// called by dying thread _in_that_thread_context_ // called by dying thread _in_that_thread_context_
void OnThreadExit(wxThread *thread); void OnThreadExit(wxThread *thread);

View File

@@ -47,7 +47,6 @@ public:
public: public:
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); void OnAbout(wxCommandEvent& event);
bool OnClose(void) { return TRUE; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@@ -27,7 +27,6 @@ class MyFrame: public wxFrame
public: public:
void OnQuit(wxCommandEvent& event); void OnQuit(wxCommandEvent& event);
void OnTestDialog(wxCommandEvent& event); void OnTestDialog(wxCommandEvent& event);
bool OnClose(void) { return TRUE; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@@ -47,6 +47,13 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#ifdef __WINDOWS__
#include <windows.h>
#ifdef DrawText
#undef DrawText
#endif
#endif
#define buf_size 10000 #define buf_size 10000
#define DEFAULT_POETRY_DAT "wxpoem" #define DEFAULT_POETRY_DAT "wxpoem"
#define DEFAULT_POETRY_IND "wxpoem" #define DEFAULT_POETRY_IND "wxpoem"

View File

@@ -476,6 +476,7 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
return FALSE; return FALSE;
}; };
#if WXWIN_COMPATIBILITY
bool wxEvtHandler::OnClose() bool wxEvtHandler::OnClose()
{ {
if (GetNextHandler()) if (GetNextHandler())
@@ -483,3 +484,5 @@ bool wxEvtHandler::OnClose()
else else
return FALSE; return FALSE;
} }
#endif

View File

@@ -429,6 +429,10 @@ int wxPreviewControlBar::GetZoomControl()
* Preview frame * Preview frame
*/ */
BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
END_EVENT_TABLE()
wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title, wxPreviewFrame::wxPreviewFrame(wxPrintPreviewBase *preview, wxFrame *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name): const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxFrame(parent, -1, title, pos, size, style, name) wxFrame(parent, -1, title, pos, size, style, name)
@@ -442,7 +446,7 @@ wxPreviewFrame::~wxPreviewFrame()
{ {
} }
bool wxPreviewFrame::OnClose() void wxPreviewFrame::OnCloseWindow(wxCloseEvent& event)
{ {
MakeModal(FALSE); MakeModal(FALSE);
@@ -456,7 +460,8 @@ bool wxPreviewFrame::OnClose()
m_printPreview->SetFrame(NULL); m_printPreview->SetFrame(NULL);
} }
delete m_printPreview; delete m_printPreview;
return TRUE;
Destroy();
} }
void wxPreviewFrame::Initialize() void wxPreviewFrame::Initialize()

View File

@@ -46,6 +46,7 @@ BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint) EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
EVT_CLOSE(wxGenericColourDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -129,10 +130,9 @@ wxGenericColourDialog::~wxGenericColourDialog(void)
{ {
} }
bool wxGenericColourDialog::OnClose(void) void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& event)
{ {
Show(FALSE); EndModal(wxID_CANCEL);
return FALSE;
} }
bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data) bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data)

View File

@@ -51,6 +51,7 @@ BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint) EVT_PAINT(wxGenericFontDialog::OnPaint)
EVT_CLOSE(wxGenericFontDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -132,10 +133,9 @@ wxGenericFontDialog::~wxGenericFontDialog(void)
{ {
} }
bool wxGenericFontDialog::OnClose(void) void wxGenericFontDialog::OnCloseWindow(wxCloseEvent& event)
{ {
Show(FALSE); EndModal(wxID_CANCEL);
return FALSE;
} }
bool wxGenericFontDialog::Create(wxWindow *parent, wxFontData *data) bool wxGenericFontDialog::Create(wxWindow *parent, wxFontData *data)

View File

@@ -284,6 +284,10 @@ void wxPropertyFormView::OnDoubleClick(wxControl *item)
IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog) IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog)
BEGIN_EVENT_TABLE(wxPropertyFormDialog, wxDialog)
EVT_CLOSE(wxPropertyFormDialog::OnCloseWindow)
END_EVENT_TABLE()
wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name): const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name) wxDialog(parent, -1, title, pos, size, style, name)
@@ -294,16 +298,16 @@ wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *pare
// SetAutoLayout(TRUE); // SetAutoLayout(TRUE);
} }
bool wxPropertyFormDialog::OnClose(void) void wxPropertyFormDialog::OnCloseWindow(wxCloseEvent& event)
{ {
if (m_view) if (m_view)
{ {
m_view->OnClose(); m_view->OnClose();
m_view = NULL; m_view = NULL;
return TRUE; this->Destroy();
} }
else else
return FALSE; event.Veto();
} }
void wxPropertyFormDialog::OnDefaultAction(wxControl *item) void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
@@ -358,12 +362,16 @@ bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame) IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
bool wxPropertyFormFrame::OnClose(void) BEGIN_EVENT_TABLE(wxPropertyFormFrame, wxFrame)
EVT_CLOSE(wxPropertyFormFrame::OnCloseWindow)
END_EVENT_TABLE()
void wxPropertyFormFrame::OnCloseWindow(wxCloseEvent& event)
{ {
if (m_view) if (m_view && m_view->OnClose())
return m_view->OnClose(); this->Destroy();
else else
return FALSE; event.Veto();
} }
wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v) wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)

View File

@@ -808,6 +808,7 @@ IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog)
BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog) BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel)
EVT_CLOSE(wxPropertyListDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent,
@@ -821,17 +822,19 @@ wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *pare
SetAutoLayout(TRUE); SetAutoLayout(TRUE);
} }
bool wxPropertyListDialog::OnClose(void) void wxPropertyListDialog::OnCloseWindow(wxCloseEvent& event)
{ {
if (m_view) if (m_view)
{ {
SetReturnCode(wxID_CANCEL); SetReturnCode(wxID_CANCEL);
m_view->OnClose(); m_view->OnClose();
m_view = NULL; m_view = NULL;
return TRUE; this->Destroy();
} }
else else
return FALSE; {
event.Veto();
}
} }
void wxPropertyListDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) void wxPropertyListDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
@@ -899,7 +902,11 @@ void wxPropertyListPanel::OnSize(wxSizeEvent& WXUNUSED(event))
IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame) IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame)
bool wxPropertyListFrame::OnClose(void) BEGIN_EVENT_TABLE(wxPropertyListFrame, wxFrame)
EVT_CLOSE(wxPropertyListFrame::OnCloseWindow)
END_EVENT_TABLE()
void wxPropertyListFrame::OnCloseWindow(wxCloseEvent& event)
{ {
if (m_view) if (m_view)
{ {
@@ -907,10 +914,12 @@ bool wxPropertyListFrame::OnClose(void)
m_propertyPanel->SetView(NULL); m_propertyPanel->SetView(NULL);
m_view->OnClose(); m_view->OnClose();
m_view = NULL; m_view = NULL;
return TRUE; this->Destroy();
} }
else else
return FALSE; {
event.Veto();
}
} }
wxPropertyListPanel *wxPropertyListFrame::OnCreatePanel(wxFrame *parent, wxPropertyListView *v) wxPropertyListPanel *wxPropertyListFrame::OnCreatePanel(wxFrame *parent, wxPropertyListView *v)

View File

@@ -57,7 +57,7 @@ wxDC::wxDC()
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_mappingMode = MM_TEXT; m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; /* not used yet */ m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */ m_needComputeScaleY = FALSE; /* not used yet */
@@ -217,25 +217,25 @@ void wxDC::SetMapMode( int mode )
{ {
switch (mode) switch (mode)
{ {
case MM_TWIPS: case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break; break;
case MM_POINTS: case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break; break;
case MM_METRIC: case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break; break;
case MM_LOMETRIC: case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break; break;
default: default:
case MM_TEXT: case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 ); SetLogicalScale( 1.0, 1.0 );
break; break;
} }
/* we don't do this mega optimisation /* we don't do this mega optimisation
if (mode != MM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE; m_needComputeScaleY = TRUE;

View File

@@ -219,14 +219,25 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
void wxDialog::OnCloseWindow(wxCloseEvent& event) void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// We'll send a Cancel message by default,
// which may close the dialog.
// Check for looping if the Cancel event handler calls Close().
// Note that if a cancel button and handler aren't present in the dialog,
// nothing will happen when you close the dialog via the window manager, or
// via Close().
// We wouldn't want to destroy the dialog by default, since the dialog may have been
// created on the stack.
// However, this does mean that calling dialog->Close() won't delete the dialog
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
// sure to destroy the dialog.
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
static wxList closing; static wxList closing;
if (closing.Member(this)) if (closing.Member(this))
return; // no loops return; // no loops
if ( event.GetVeto() )
return;
closing.Append(this); closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);

View File

@@ -478,8 +478,8 @@ void wxFrame::OnInternalIdle()
void wxFrame::OnCloseWindow( wxCloseEvent& event ) void wxFrame::OnCloseWindow( wxCloseEvent& event )
{ {
// close the window if it wasn't vetoed by the application // close the window if it wasn't vetoed by the application
if ( !event.GetVeto() ) // if ( !event.GetVeto() ) // No, this isn't the interpretation of GetVeto.
Destroy(); Destroy();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )

View File

@@ -57,7 +57,7 @@ wxDC::wxDC()
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_mappingMode = MM_TEXT; m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; /* not used yet */ m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */ m_needComputeScaleY = FALSE; /* not used yet */
@@ -217,25 +217,25 @@ void wxDC::SetMapMode( int mode )
{ {
switch (mode) switch (mode)
{ {
case MM_TWIPS: case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break; break;
case MM_POINTS: case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break; break;
case MM_METRIC: case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break; break;
case MM_LOMETRIC: case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break; break;
default: default:
case MM_TEXT: case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 ); SetLogicalScale( 1.0, 1.0 );
break; break;
} }
/* we don't do this mega optimisation /* we don't do this mega optimisation
if (mode != MM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE; m_needComputeScaleY = TRUE;

View File

@@ -219,14 +219,25 @@ void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
void wxDialog::OnCloseWindow(wxCloseEvent& event) void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// We'll send a Cancel message by default,
// which may close the dialog.
// Check for looping if the Cancel event handler calls Close().
// Note that if a cancel button and handler aren't present in the dialog,
// nothing will happen when you close the dialog via the window manager, or
// via Close().
// We wouldn't want to destroy the dialog by default, since the dialog may have been
// created on the stack.
// However, this does mean that calling dialog->Close() won't delete the dialog
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
// sure to destroy the dialog.
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
static wxList closing; static wxList closing;
if (closing.Member(this)) if (closing.Member(this))
return; // no loops return; // no loops
if ( event.GetVeto() )
return;
closing.Append(this); closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);

View File

@@ -478,8 +478,8 @@ void wxFrame::OnInternalIdle()
void wxFrame::OnCloseWindow( wxCloseEvent& event ) void wxFrame::OnCloseWindow( wxCloseEvent& event )
{ {
// close the window if it wasn't vetoed by the application // close the window if it wasn't vetoed by the application
if ( !event.GetVeto() ) // if ( !event.GetVeto() ) // No, this isn't the interpretation of GetVeto.
Destroy(); Destroy();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )

View File

@@ -1414,6 +1414,10 @@ void wxApp::doMacInGoAway(WindowPtr window)
{ {
if (TrackGoAway(window, m_event.where)) if (TrackGoAway(window, m_event.where))
{ {
// TODO: Stefan, I think you need to send a wxCloseEvent to the window
// here. The OnCloseWindow handler will take care of delete the frame
// if it wishes to (there should be a default wxFrame::OnCloseWindow
// that destroys the frame).
if (theMacWxFrame->OnClose()) { if (theMacWxFrame->OnClose()) {
#if WXGARBAGE_COLLECTION_ON #if WXGARBAGE_COLLECTION_ON
theMacWxFrame->Show(FALSE); theMacWxFrame->Show(FALSE);

View File

@@ -1414,6 +1414,10 @@ void wxApp::doMacInGoAway(WindowPtr window)
{ {
if (TrackGoAway(window, m_event.where)) if (TrackGoAway(window, m_event.where))
{ {
// TODO: Stefan, I think you need to send a wxCloseEvent to the window
// here. The OnCloseWindow handler will take care of delete the frame
// if it wishes to (there should be a default wxFrame::OnCloseWindow
// that destroys the frame).
if (theMacWxFrame->OnClose()) { if (theMacWxFrame->OnClose()) {
#if WXGARBAGE_COLLECTION_ON #if WXGARBAGE_COLLECTION_ON
theMacWxFrame->Show(FALSE); theMacWxFrame->Show(FALSE);

View File

@@ -61,7 +61,7 @@ wxDC::wxDC(void)
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_mappingMode = MM_TEXT; m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; m_needComputeScaleX = FALSE;
m_needComputeScaleY = FALSE; m_needComputeScaleY = FALSE;
@@ -211,24 +211,24 @@ void wxDC::SetMapMode( int mode )
{ {
switch (mode) switch (mode)
{ {
case MM_TWIPS: case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break; break;
case MM_POINTS: case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break; break;
case MM_METRIC: case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break; break;
case MM_LOMETRIC: case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break; break;
default: default:
case MM_TEXT: case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 ); SetLogicalScale( 1.0, 1.0 );
break; break;
}; };
if (mode != MM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE; m_needComputeScaleY = TRUE;

View File

@@ -237,37 +237,34 @@ void wxDialog::OnCancel(wxCommandEvent& event)
} }
} }
bool wxDialog::OnClose()
{
// Behaviour changed in 2.0: we'll send a Cancel message by default,
// which may close the dialog.
// Check for looping if the Cancel event handler calls Close()
static wxList closing;
if ( closing.Member(this) )
return FALSE;
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
}
void wxDialog::OnCloseWindow(wxCloseEvent& event) void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// Compatibility // We'll send a Cancel message by default,
if ( GetEventHandler()->OnClose() || !event.CanVeto()) // which may close the dialog.
{ // Check for looping if the Cancel event handler calls Close().
this->Destroy();
} // Note that if a cancel button and handler aren't present in the dialog,
else // nothing will happen when you close the dialog via the window manager, or
event.Veto(TRUE); // via Close().
// We wouldn't want to destroy the dialog by default, since the dialog may have been
// created on the stack.
// However, this does mean that calling dialog->Close() won't delete the dialog
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
// sure to destroy the dialog.
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
static wxList closing;
if ( closing.Member(this) )
return;
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
closing.DeleteObject(this);
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -371,23 +371,10 @@ void wxFrame::OnActivate(wxActivateEvent& event)
} }
} }
// The default implementation for the close window event - calls // The default implementation for the close window event.
// OnClose for backward compatibility.
void wxFrame::OnCloseWindow(wxCloseEvent& event) void wxFrame::OnCloseWindow(wxCloseEvent& event)
{ {
// Compatibility this->Destroy();
if ( GetEventHandler()->OnClose() || !event.CanVeto())
{
this->Destroy();
}
else
event.Veto(TRUE);
}
bool wxFrame::OnClose()
{
return TRUE;
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -128,7 +128,7 @@ struct mfPLACEABLEHEADER {
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */
@@ -198,7 +198,7 @@ bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, i
modeRecord->rdSize = 4; modeRecord->rdSize = 4;
modeRecord->rdFunction = META_SETMAPMODE; modeRecord->rdFunction = META_SETMAPMODE;
modeRecord->rdParm[0] = MM_ANISOTROPIC; modeRecord->rdParm[0] = wxMM_ANISOTROPIC;
originRecord->rdSize = 5; originRecord->rdSize = 5;
originRecord->rdFunction = META_SETWINDOWORG; originRecord->rdFunction = META_SETWINDOWORG;

View File

@@ -1110,7 +1110,10 @@ 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);
#if WXWIN_COMPATIBILITY
event.SetForce(force); event.SetForce(force);
#endif
event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
} }

View File

@@ -61,7 +61,7 @@ wxDC::wxDC(void)
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_mappingMode = MM_TEXT; m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; m_needComputeScaleX = FALSE;
m_needComputeScaleY = FALSE; m_needComputeScaleY = FALSE;
@@ -211,24 +211,24 @@ void wxDC::SetMapMode( int mode )
{ {
switch (mode) switch (mode)
{ {
case MM_TWIPS: case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break; break;
case MM_POINTS: case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break; break;
case MM_METRIC: case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break; break;
case MM_LOMETRIC: case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break; break;
default: default:
case MM_TEXT: case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 ); SetLogicalScale( 1.0, 1.0 );
break; break;
}; };
if (mode != MM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE; m_needComputeScaleY = TRUE;

View File

@@ -237,37 +237,34 @@ void wxDialog::OnCancel(wxCommandEvent& event)
} }
} }
bool wxDialog::OnClose()
{
// Behaviour changed in 2.0: we'll send a Cancel message by default,
// which may close the dialog.
// Check for looping if the Cancel event handler calls Close()
static wxList closing;
if ( closing.Member(this) )
return FALSE;
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
}
void wxDialog::OnCloseWindow(wxCloseEvent& event) void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// Compatibility // We'll send a Cancel message by default,
if ( GetEventHandler()->OnClose() || !event.CanVeto()) // which may close the dialog.
{ // Check for looping if the Cancel event handler calls Close().
this->Destroy();
} // Note that if a cancel button and handler aren't present in the dialog,
else // nothing will happen when you close the dialog via the window manager, or
event.Veto(TRUE); // via Close().
// We wouldn't want to destroy the dialog by default, since the dialog may have been
// created on the stack.
// However, this does mean that calling dialog->Close() won't delete the dialog
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
// sure to destroy the dialog.
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
static wxList closing;
if ( closing.Member(this) )
return;
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
closing.DeleteObject(this);
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -371,23 +371,10 @@ void wxFrame::OnActivate(wxActivateEvent& event)
} }
} }
// The default implementation for the close window event - calls // The default implementation for the close window event.
// OnClose for backward compatibility.
void wxFrame::OnCloseWindow(wxCloseEvent& event) void wxFrame::OnCloseWindow(wxCloseEvent& event)
{ {
// Compatibility this->Destroy();
if ( GetEventHandler()->OnClose() || !event.CanVeto())
{
this->Destroy();
}
else
event.Veto(TRUE);
}
bool wxFrame::OnClose()
{
return TRUE;
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -128,7 +128,7 @@ struct mfPLACEABLEHEADER {
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */
@@ -198,7 +198,7 @@ bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, i
modeRecord->rdSize = 4; modeRecord->rdSize = 4;
modeRecord->rdFunction = META_SETMAPMODE; modeRecord->rdFunction = META_SETMAPMODE;
modeRecord->rdParm[0] = MM_ANISOTROPIC; modeRecord->rdParm[0] = wxMM_ANISOTROPIC;
originRecord->rdSize = 5; originRecord->rdSize = 5;
originRecord->rdFunction = META_SETWINDOWORG; originRecord->rdFunction = META_SETWINDOWORG;

View File

@@ -1110,7 +1110,10 @@ 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);
#if WXWIN_COMPATIBILITY
event.SetForce(force); event.SetForce(force);
#endif
event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
} }

View File

@@ -61,7 +61,7 @@ wxDC::wxDC(void)
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_mappingMode = MM_TEXT; m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; m_needComputeScaleX = FALSE;
m_needComputeScaleY = FALSE; m_needComputeScaleY = FALSE;
@@ -238,24 +238,24 @@ void wxDC::SetMapMode( int mode )
{ {
switch (mode) switch (mode)
{ {
case MM_TWIPS: case wxMM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break; break;
case MM_POINTS: case wxMM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break; break;
case MM_METRIC: case wxMM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break; break;
case MM_LOMETRIC: case wxMM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break; break;
default: default:
case MM_TEXT: case wxMM_TEXT:
SetLogicalScale( 1.0, 1.0 ); SetLogicalScale( 1.0, 1.0 );
break; break;
}; };
if (mode != MM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE; m_needComputeScaleY = TRUE;

View File

@@ -564,37 +564,34 @@ void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
} }
} }
bool wxDialog::OnClose() void wxDialog::OnCloseWindow(wxCloseEvent& event)
{ {
// Behaviour changed in 2.0: we'll send a Cancel message by default, // We'll send a Cancel message by default,
// which may close the dialog. // which may close the dialog.
// Check for looping if the Cancel event handler calls Close() // Check for looping if the Cancel event handler calls Close().
// Note that if a cancel button and handler aren't present in the dialog,
// nothing will happen when you close the dialog via the window manager, or
// via Close().
// We wouldn't want to destroy the dialog by default, since the dialog may have been
// created on the stack.
// However, this does mean that calling dialog->Close() won't delete the dialog
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
// sure to destroy the dialog.
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
static wxList closing; static wxList closing;
if ( closing.Member(this) ) if ( closing.Member(this) )
return FALSE; return;
closing.Append(this); closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this ); cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent); GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
closing.DeleteObject(this);
return FALSE;
}
void wxDialog::OnCloseWindow(wxCloseEvent& event) closing.DeleteObject(this);
{
// Compatibility
if ( GetEventHandler()->OnClose() || !event.CanVeto())
{
this->Destroy();
}
else
event.Veto(TRUE);
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -782,23 +782,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
} }
} }
// The default implementation for the close window event - calls // The default implementation for the close window event.
// OnClose for backward compatibility. // OnClose for backward compatibility.
void wxFrame::OnCloseWindow(wxCloseEvent& event) void wxFrame::OnCloseWindow(wxCloseEvent& event)
{ {
// Compatibility this->Destroy();
if ( GetEventHandler()->OnClose() || !event.CanVeto())
{
this->Destroy();
}
else
event.Veto(TRUE);
}
bool wxFrame::OnClose()
{
return TRUE;
} }
// Destroy the window (delayed, if a managed window) // Destroy the window (delayed, if a managed window)

View File

@@ -128,7 +128,7 @@ struct mfPLACEABLEHEADER {
/* /*
* Pass filename of existing non-placeable metafile, and bounding box. * Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic, * Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the MM_TEXT mapping mode. * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
* *
*/ */
@@ -198,7 +198,7 @@ bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, i
modeRecord->rdSize = 4; modeRecord->rdSize = 4;
modeRecord->rdFunction = META_SETMAPMODE; modeRecord->rdFunction = META_SETMAPMODE;
modeRecord->rdParm[0] = MM_ANISOTROPIC; modeRecord->rdParm[0] = wxMM_ANISOTROPIC;
originRecord->rdSize = 5; originRecord->rdSize = 5;
originRecord->rdFunction = META_SETWINDOWORG; originRecord->rdFunction = META_SETWINDOWORG;

Some files were not shown because too many files have changed in this diff Show More