From 82540ef2327daaf6ae78189139a669afc9edf9d9 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Fri, 29 Jan 1999 17:22:47 +0000
Subject: [PATCH] Doc mods, sash window bug

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/docchfrm.tex     |  6 ++---
 docs/latex/wx/docmdich.tex     |  6 ++---
 docs/latex/wx/docmdipr.tex     | 42 ++++++++++------------------------
 docs/latex/wx/docprfrm.tex     | 42 ++++++++++------------------------
 docs/latex/wx/doctempl.tex     |  1 -
 docs/latex/wx/view.tex         |  2 +-
 src/generic/gridg.cpp          |  2 ++
 src/generic/sashwin.cpp        |  2 +-
 utils/dialoged/src/winprop.cpp | 14 ++++++++----
 9 files changed, 43 insertions(+), 74 deletions(-)

diff --git a/docs/latex/wx/docchfrm.tex b/docs/latex/wx/docchfrm.tex
index 37479e12bf..1c03f01935 100644
--- a/docs/latex/wx/docchfrm.tex
+++ b/docs/latex/wx/docchfrm.tex
@@ -61,15 +61,15 @@ Returns the view associated with this frame.
 
 \membersection{wxDocChildFrame::OnActivate}
 
-\func{void}{OnActivate}{\param{bool}{ active}}
+\func{void}{OnActivate}{\param{wxActivateEvent}{ event}}
 
 Sets the currently active view to be the frame's view. You may need
 to override (but still call) this function in order to set the keyboard
 focus for your subwindow.
 
-\membersection{wxDocChildFrame::OnClose}
+\membersection{wxDocChildFrame::OnCloseWindow}
 
-\func{virtual bool}{OnClose}{\void}
+\func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
 
 Closes and deletes the current view and document.
 
diff --git a/docs/latex/wx/docmdich.tex b/docs/latex/wx/docmdich.tex
index b9b16ac740..63c86d32f7 100644
--- a/docs/latex/wx/docmdich.tex
+++ b/docs/latex/wx/docmdich.tex
@@ -62,15 +62,15 @@ Returns the view associated with this frame.
 
 \membersection{wxDocMDIChildFrame::OnActivate}
 
-\func{void}{OnActivate}{\param{bool}{ active}}
+\func{void}{OnActivate}{\param{wxActivateEvent}{ event}}
 
 Sets the currently active view to be the frame's view. You may need
 to override (but still call) this function in order to set the keyboard
 focus for your subwindow.
 
-\membersection{wxDocMDIChildFrame::OnClose}
+\membersection{wxDocMDIChildFrame::OnCloseWindow}
 
-\func{virtual bool}{OnClose}{\void}
+\func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
 
 Closes and deletes the current view and document.
 
diff --git a/docs/latex/wx/docmdipr.tex b/docs/latex/wx/docmdipr.tex
index 5bb084dcfe..3730dc9d9e 100644
--- a/docs/latex/wx/docmdipr.tex
+++ b/docs/latex/wx/docmdipr.tex
@@ -24,9 +24,10 @@ See the example application in {\tt samples/docview}.
 
 \membersection{wxDocMDIParentFrame::wxDocMDIParentFrame}
 
-\func{}{wxDocMDIParentFrame}{\param{wxFrame *}{parent}, \param{wxWindowID}{ id},
- \param{const wxString\& }{title}, \param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height},
- \param{long}{ style}, \param{const wxString\& }{name}}
+\func{}{wxDocParentFrame}{\param{wxDocManager*}{ manager}, \param{wxFrame *}{parent}, \param{wxWindowID}{ id},
+ \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
+ \param{const wxSize\&}{ size = wxDefaultSize},
+ \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = "frame"}}
 
 Constructor.
 
@@ -36,44 +37,25 @@ Constructor.
 
 Destructor.
 
-\membersection{wxDocMDIParentFrame::OnClose}
+\membersection{wxDocMDIParentFrame::OnCloseWindow}
 
-\func{bool}{OnClose}{\void}
+\func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
 
 Deletes all views and documents. If no user input cancelled the
-operation, the function returns TRUE and the application will exit.
+operation, the frame will be destroyed and the application will exit.
 
 Since understanding how document/view clean-up takes place can be difficult,
 the implementation of this function is shown below.
 
 \begin{verbatim}
-bool wxDocMDIParentFrame::OnClose(void)
+void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
 {
-  // Delete all views and documents
-  wxNode *node = docManager->GetDocuments().First();
-  while (node)
+  if (m_docManager->Clear(!event.CanVeto()))
   {
-    wxDocument *doc = (wxDocument *)node->Data();
-    wxNode *next = node->Next();
-
-    if (!doc->Close())
-      return FALSE;
-
-    // Implicitly deletes the document when the last
-    // view is removed (deleted)
-    doc->DeleteAllViews();
-
-    // Check document is deleted
-    if (docManager->GetDocuments().Member(doc))
-      delete doc;
-
-    // This assumes that documents are not connected in
-    // any way, i.e. deleting one document does NOT
-    // delete another.
-    node = next;
+    this->Destroy();
   }
-  return TRUE;
+  else
+    event.Veto();
 }
 \end{verbatim}
 
-
diff --git a/docs/latex/wx/docprfrm.tex b/docs/latex/wx/docprfrm.tex
index f0eff917de..a39c6d55a2 100644
--- a/docs/latex/wx/docprfrm.tex
+++ b/docs/latex/wx/docprfrm.tex
@@ -23,9 +23,10 @@ See the example application in {\tt samples/docview}.
 
 \membersection{wxDocParentFrame::wxDocParentFrame}
 
-\func{}{wxDocParentFrame}{\param{wxFrame *}{parent}, \param{wxWindowID}{ id},
- \param{const wxString\& }{title}, \param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height},
- \param{long}{ style}, \param{const wxString\& }{name}}
+\func{}{wxDocParentFrame}{\param{wxDocManager*}{ manager}, \param{wxFrame *}{parent}, \param{wxWindowID}{ id},
+ \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
+ \param{const wxSize\&}{ size = wxDefaultSize},
+ \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = "frame"}}
 
 Constructor.
 
@@ -35,44 +36,25 @@ Constructor.
 
 Destructor.
 
-\membersection{wxDocParentFrame::OnClose}
+\membersection{wxDocParentFrame::OnCloseWindow}
 
-\func{bool}{OnClose}{\void}
+\func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
 
 Deletes all views and documents. If no user input cancelled the
-operation, the function returns TRUE and the application will exit.
+operation, the frame will be destroyed and the application will exit.
 
 Since understanding how document/view clean-up takes place can be difficult,
 the implementation of this function is shown below.
 
 \begin{verbatim}
-bool wxDocParentFrame::OnClose(void)
+void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
 {
-  // Delete all views and documents
-  wxNode *node = docManager->GetDocuments().First();
-  while (node)
+  if (m_docManager->Clear(!event.CanVeto()))
   {
-    wxDocument *doc = (wxDocument *)node->Data();
-    wxNode *next = node->Next();
-
-    if (!doc->Close())
-      return FALSE;
-
-    // Implicitly deletes the document when the last
-    // view is removed (deleted)
-    doc->DeleteAllViews();
-
-    // Check document is deleted
-    if (docManager->GetDocuments().Member(doc))
-      delete doc;
-
-    // This assumes that documents are not connected in
-    // any way, i.e. deleting one document does NOT
-    // delete another.
-    node = next;
+    this->Destroy();
   }
-  return TRUE;
+  else
+    event.Veto();
 }
 \end{verbatim}
 
-
diff --git a/docs/latex/wx/doctempl.tex b/docs/latex/wx/doctempl.tex
index daae6ace61..e4bd82ef7d 100644
--- a/docs/latex/wx/doctempl.tex
+++ b/docs/latex/wx/doctempl.tex
@@ -230,4 +230,3 @@ Sets the file filter.
 
 Sets the internal document template flags (see the constructor description for more details).
 
-
diff --git a/docs/latex/wx/view.tex b/docs/latex/wx/view.tex
index f8ec2b2ebc..139269555d 100644
--- a/docs/latex/wx/view.tex
+++ b/docs/latex/wx/view.tex
@@ -2,7 +2,7 @@
 
 The view class can be used to model the viewing and editing component of
 an application's file-based data. It is part of the document/view framework supported by wxWindows,
-and cooperates with the \helpref{wxDocument}{wxdocument}, \helpref{wxDocTemplate}{wxdoctemplate}
+and cooperates with the \helpref{wxDocument}{wxdocument}, \helpref{wxDocTemplate}{wxdoctemplate} 
 and \helpref{wxDocManager}{wxdocmanager} classes.
 
 \wxheading{Derived from}
diff --git a/src/generic/gridg.cpp b/src/generic/gridg.cpp
index 0747e1917f..34da5b84a3 100644
--- a/src/generic/gridg.cpp
+++ b/src/generic/gridg.cpp
@@ -222,6 +222,8 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
   m_hScrollBar = new wxScrollBar(this, wxGRID_HSCROLL, wxPoint(0, 0), wxSize(20, 100), wxHORIZONTAL);
   m_vScrollBar = new wxScrollBar(this, wxGRID_VSCROLL, wxPoint(0, 0), wxSize(100, 20), wxVERTICAL);
 
+  SetSize(-1, -1, size.x, size.y);
+
   return TRUE;
 }
 
diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp
index 2553c9f700..35dc510806 100644
--- a/src/generic/sashwin.cpp
+++ b/src/generic/sashwin.cpp
@@ -324,7 +324,7 @@ wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int WXUNUSED(toleranc
                 }
                 case wxSASH_LEFT:
                 {
-                    if ((x >= GetEdgeMargin(position)) && (x >= 0))
+                    if ((x <= GetEdgeMargin(position)) && (x >= 0))
                         return wxSASH_LEFT;
                     break;
                 }
diff --git a/utils/dialoged/src/winprop.cpp b/utils/dialoged/src/winprop.cpp
index 5985d0adc7..4f3a64b6f5 100644
--- a/utils/dialoged/src/winprop.cpp
+++ b/utils/dialoged/src/winprop.cpp
@@ -1829,12 +1829,16 @@ bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property)
     scrollBar->SetWindowStyleFlag(windowStyle);
     
     // If the window style has changed, we swap the width and height parameters.
-    int w, h;
-    scrollBar->GetSize(&w, &h);
-    
+//    int w, h;
+//    scrollBar->GetSize(&w, &h);
+    wxItemResource	*item = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(scrollBar);
+ 	if ( item ) {
+ 		item->SetSize(item->GetX(), item->GetY(), item->GetHeight(), item->GetWidth());
+ 		item->SetStyle(windowStyle);
+ 	} /* IF */
+
     scrollBar = (wxScrollBar *)wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(scrollBar, this);
-    scrollBar->SetSize(-1, -1, h, w);
-    
+
     return TRUE;
   }
   else if (name == "pageSize")
-- 
2.50.0

