From 818e52c20151ce0c22aa752ccbab94f1ae7afc99 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Fri, 5 Feb 1999 15:06:25 +0000
Subject: [PATCH] Changed GetForce -> !CanVeto

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/html/index.htm               |  1 +
 docs/latex/wx/keyevent.tex        |  2 +-
 docs/latex/wx/window.tex          |  6 +++---
 include/wx/defs.h                 | 10 +++++++++-
 samples/mfc/mfctest.cpp           |  4 ++++
 src/mac/carbon/dialog.cpp         |  4 +++-
 src/mac/carbon/frame.cpp          |  4 +++-
 src/mac/dialog.cpp                |  4 +++-
 src/mac/frame.cpp                 |  4 +++-
 src/motif/dialog.cpp              |  4 +++-
 src/motif/frame.cpp               |  4 +++-
 src/msw/dialog.cpp                |  2 +-
 src/msw/frame.cpp                 |  2 +-
 src/qt/dialog.cpp                 |  4 +++-
 src/qt/frame.cpp                  |  4 +++-
 src/stubs/dialog.cpp              |  4 +++-
 src/stubs/frame.cpp               |  4 +++-
 utils/wxPython/src/gtk/events.cpp |  2 +-
 18 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/docs/html/index.htm b/docs/html/index.htm
index 493a111e02..be88c494e3 100644
--- a/docs/html/index.htm
+++ b/docs/html/index.htm
@@ -137,6 +137,7 @@ scheme is used whereby child windows have full sizing and moving rights within t
 window. On other platforms, tabbed windows are used, where the children are always maximized.
 <li><a href="../../samples/memcheck">memcheck</a>: demonstrates the memory checking/debugging facilities.
 <li><a href="../../samples/mfc">mfc</a>: shows how to use MFC and wxWindows code in the same application (Windows only).
+To compile this, you must edit include/wx/wxprec.h, comment out the windows.h inclusion, and recompile wxWindows.
 <li><a href="../../samples/minifram">minifram</a>: demonstrates a frame with a small title bar. On
 platforms that don't support it, a normal-sized title bar is displayed.
 <li><a href="../../samples/minimal">minimal</a>: just shows a frame, a menubar, and a statusbar. About as
diff --git a/docs/latex/wx/keyevent.tex b/docs/latex/wx/keyevent.tex
index 96919d7cff..f06eefa1fc 100644
--- a/docs/latex/wx/keyevent.tex
+++ b/docs/latex/wx/keyevent.tex
@@ -13,7 +13,7 @@ functions that take a wxKeyEvent argument.
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
-\twocolitem{{\bf EVT\_CHAR(func)}}{Process a wxEVT\_CHAR event (an ASCII key has been pressed).}
+\twocolitem{{\bf EVT\_CHAR(func)}}{Process a wxEVT\_CHAR event (a non-modifier key has been pressed).}
 \twocolitem{{\bf EVT\_KEY\_DOWN(func)}}{Process a wxEVT\_KEY\_DOWN event (any key has been pressed).}
 \twocolitem{{\bf EVT\_KEY\_UP(func)}}{Process a wxEVT\_KEY\_UP event (any key has been released).}
 \twocolitem{{\bf EVT\_CHAR(func)}}{Process a wxEVT\_CHAR event.}
diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex
index f086ccca6a..add8503f92 100644
--- a/docs/latex/wx/window.tex
+++ b/docs/latex/wx/window.tex
@@ -807,7 +807,7 @@ otherwise it returns FALSE (it is being deactivated).
 
 \func{void}{OnChar}{\param{wxKeyEvent\&}{ event}}
 
-Called when the user has pressed a key, which has been translated into an ASCII value.
+Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
 
 \wxheading{Parameters}
 
@@ -823,8 +823,8 @@ default function to achieve default keypress functionality.
 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
 values.
 
-Note that not all keypresses can be intercepted this way. If you wish to intercept special
-keys, such as shift, control, and function keys, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or 
+Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
+keypresses, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or 
 \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}.
 
 Most, but not all, windows allow keypresses to be intercepted.
diff --git a/include/wx/defs.h b/include/wx/defs.h
index 48507c825a..5aac4cbde8 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -158,7 +158,15 @@
 #elif defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
     typedef unsigned int bool;
 #elif defined(__WATCOMC__)
-    typedef unsigned int bool;
+//    typedef unsigned int bool;
+
+ #if __WATCOMC__<1100
+ typedef enum _tagbool {
+     false,
+     true
+ } bool ;
+ #endif
+
 #elif defined(__SUNCC__)
     #ifdef __SUNPRO_CC
         // starting from version 5.0 Sun CC understands 'bool'
diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp
index 740bfbbbc1..79a7006bcf 100644
--- a/samples/mfc/mfctest.cpp
+++ b/samples/mfc/mfctest.cpp
@@ -44,6 +44,10 @@
 
 #include "wx/wx.h"
 
+#ifdef _WINDOWS_
+#error Sorry, you need to edit include/wx/wxprec.h, comment out the windows.h inclusion, and recompile.
+#endif
+
 #ifdef new
 #undef new
 #endif
diff --git a/src/mac/carbon/dialog.cpp b/src/mac/carbon/dialog.cpp
index 7d6d99744d..e2bdb7c984 100644
--- a/src/mac/carbon/dialog.cpp
+++ b/src/mac/carbon/dialog.cpp
@@ -262,10 +262,12 @@ bool wxDialog::OnClose()
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp
index 1e8c9e9ae5..a961e3616f 100644
--- a/src/mac/carbon/frame.cpp
+++ b/src/mac/carbon/frame.cpp
@@ -377,10 +377,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 bool wxFrame::OnClose()
diff --git a/src/mac/dialog.cpp b/src/mac/dialog.cpp
index 7d6d99744d..e2bdb7c984 100644
--- a/src/mac/dialog.cpp
+++ b/src/mac/dialog.cpp
@@ -262,10 +262,12 @@ bool wxDialog::OnClose()
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
diff --git a/src/mac/frame.cpp b/src/mac/frame.cpp
index 1e8c9e9ae5..a961e3616f 100644
--- a/src/mac/frame.cpp
+++ b/src/mac/frame.cpp
@@ -377,10 +377,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 bool wxFrame::OnClose()
diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp
index 16fc52abd5..d67152d0fc 100644
--- a/src/motif/dialog.cpp
+++ b/src/motif/dialog.cpp
@@ -589,10 +589,12 @@ bool wxDialog::OnClose()
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp
index 4ea8a6716e..d12ac787a5 100644
--- a/src/motif/frame.cpp
+++ b/src/motif/frame.cpp
@@ -788,10 +788,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 bool wxFrame::OnClose()
diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp
index 765092e7da..9f5bbaa74b 100644
--- a/src/msw/dialog.cpp
+++ b/src/msw/dialog.cpp
@@ -589,7 +589,7 @@ void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp
index 79b3b5d1db..d849fbc4a9 100644
--- a/src/msw/frame.cpp
+++ b/src/msw/frame.cpp
@@ -865,7 +865,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
diff --git a/src/qt/dialog.cpp b/src/qt/dialog.cpp
index 9b72fb0f69..3042b1f1eb 100644
--- a/src/qt/dialog.cpp
+++ b/src/qt/dialog.cpp
@@ -272,10 +272,12 @@ bool wxDialog::OnClose()
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp
index 56f72c6dfe..cd830e4f10 100644
--- a/src/qt/frame.cpp
+++ b/src/qt/frame.cpp
@@ -373,10 +373,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 bool wxFrame::OnClose()
diff --git a/src/stubs/dialog.cpp b/src/stubs/dialog.cpp
index 7d6d99744d..e2bdb7c984 100644
--- a/src/stubs/dialog.cpp
+++ b/src/stubs/dialog.cpp
@@ -262,10 +262,12 @@ bool wxDialog::OnClose()
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
diff --git a/src/stubs/frame.cpp b/src/stubs/frame.cpp
index 1e8c9e9ae5..a961e3616f 100644
--- a/src/stubs/frame.cpp
+++ b/src/stubs/frame.cpp
@@ -377,10 +377,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 void wxFrame::OnCloseWindow(wxCloseEvent& event)
 {
     // Compatibility
-    if ( GetEventHandler()->OnClose() || event.GetForce())
+    if ( GetEventHandler()->OnClose() || !event.CanVeto())
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 bool wxFrame::OnClose()
diff --git a/utils/wxPython/src/gtk/events.cpp b/utils/wxPython/src/gtk/events.cpp
index d0009d9d6a..4145b36f2f 100644
--- a/utils/wxPython/src/gtk/events.cpp
+++ b/utils/wxPython/src/gtk/events.cpp
@@ -539,7 +539,7 @@ static PyObject *_wrap_wxCloseEvent_SetLoggingOff(PyObject *self, PyObject *args
     return _resultobj;
 }
 
-#define wxCloseEvent_GetForce(_swigobj)  (_swigobj->GetForce())
+#define wxCloseEvent_GetForce(_swigobj)  (!_swigobj->CanVeto())
 static PyObject *_wrap_wxCloseEvent_GetForce(PyObject *self, PyObject *args) {
     PyObject * _resultobj;
     bool  _result;
-- 
2.45.2

