From a9d171bd008f9512f14693438af33c89ccf166a9 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Sun, 5 May 2002 09:35:44 +0000
Subject: [PATCH] Doc tweaks Added back mouse sensitivity to wxStaticText Added
 code to widgets sample to test for sensitive wxStaticTexts

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/datetime.tex |  3 +-
 docs/latex/wx/function.tex |  4 +--
 docs/latex/wx/scrolwin.tex | 62 +++++++++++++++++++-------------------
 include/wx/msw/stattext.h  |  1 +
 samples/widgets/static.cpp | 23 +++++++++++++-
 src/msw/stattext.cpp       |  9 ++++++
 6 files changed, 67 insertions(+), 35 deletions(-)

diff --git a/docs/latex/wx/datetime.tex b/docs/latex/wx/datetime.tex
index 665275f07c..00823a44b0 100644
--- a/docs/latex/wx/datetime.tex
+++ b/docs/latex/wx/datetime.tex
@@ -650,7 +650,8 @@ Same as \helpref{Set}{wxdatetimewxdatetimetime}
 
 \membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedate}
 
-\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month        }{month = Inv\_Month}, \param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
+\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{int}{ Inv_Year}, 
+\param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
 
 Same as \helpref{Set}{wxdatetimesetdate}
 
diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index 33ee4e679e..90d1f7f7a9 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -3275,14 +3275,14 @@ Returns the number of seconds since local time 00:00:00 Jan 1st 1970.
 
 \membersection{::wxGetLocalTimeMillis}\label{wxgetlocaltimemillis}
 
-\func{wxLongLone}{wxGetLocalTimeMillis}{\void}
+\func{wxLongLong}{wxGetLocalTimeMillis}{\void}
 
 Returns the number of milliseconds since local time 00:00:00 Jan 1st 1970.
 
 \wxheading{See also}
 
 \helpref{wxDateTime::Now}{wxdatetimenow},\\
-\helpref{wxLongLone}{wxlonglong}
+\helpref{wxLongLong}{wxlonglong}
 
 \wxheading{Include files}
 
diff --git a/docs/latex/wx/scrolwin.tex b/docs/latex/wx/scrolwin.tex
index f71a9789ba..15c5be4cc1 100644
--- a/docs/latex/wx/scrolwin.tex
+++ b/docs/latex/wx/scrolwin.tex
@@ -205,6 +205,37 @@ parameters and returns a tuple of values for xUnit and yUnit.}
 \perlnote{In wxPerl this method takes no parameters and returns a
 2-element list {\tt ( xUnit, yUnit )}.}
 
+\membersection{wxScrolledWindow::GetViewStart}\label{wxscrolledwindowgetviewstart}
+
+\constfunc{void}{GetViewStart}{\param{int* }{x}, \param{int* }{ y}}
+
+Get the position at which the visible portion of the window starts.
+
+\wxheading{Parameters}
+
+\docparam{x}{Receives the first visible x position in scroll units.}
+
+\docparam{y}{Receives the first visible y position in scroll units.}
+
+\wxheading{Remarks}
+
+If either of the scrollbars is not at the home position, {\it x} and/or
+\rtfsp{\it y} will be greater than zero.  Combined with \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize},
+the application can use this function to efficiently redraw only the
+visible portion of the window.  The positions are in logical scroll
+units, not pixels, so to convert to pixels you will have to multiply
+by the number of pixels per scroll increment.
+
+\wxheading{See also}
+
+\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}
+
+\pythonnote{The wxPython version of this methods accepts no
+parameters and returns a tuple of values for x and y.}
+
+\perlnote{In wxPerl this method takes no parameters and returns a
+2-element list {\tt ( x, y )}.}
+
 \membersection{wxScrolledWindow::GetVirtualSize}\label{wxscrolledwindowgetvirtualsize}
 
 \constfunc{void}{GetVirtualSize}{\param{int* }{x}, \param{int* }{y}}
@@ -376,34 +407,3 @@ parameter in SetScrollbars.
 Call this function to tell wxScrolledWindow to perform the actual scrolling on
 a different window (not on itself).
 
-\membersection{wxScrolledWindow::GetViewStart}\label{wxscrolledwindowgetviewstart}
-
-\constfunc{void}{GetViewStart}{\param{int* }{x}, \param{int* }{ y}}
-
-Get the position at which the visible portion of the window starts.
-
-\wxheading{Parameters}
-
-\docparam{x}{Receives the first visible x position in scroll units.}
-
-\docparam{y}{Receives the first visible y position in scroll units.}
-
-\wxheading{Remarks}
-
-If either of the scrollbars is not at the home position, {\it x} and/or
-\rtfsp{\it y} will be greater than zero.  Combined with \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize},
-the application can use this function to efficiently redraw only the
-visible portion of the window.  The positions are in logical scroll
-units, not pixels, so to convert to pixels you will have to multiply
-by the number of pixels per scroll increment.
-
-\wxheading{See also}
-
-\helpref{wxScrolledWindow::SetScrollbars}{wxscrolledwindowsetscrollbars}
-
-\pythonnote{The wxPython version of this methods accepts no
-parameters and returns a tuple of values for x and y.}
-
-\perlnote{In wxPerl this method takes no parameters and returns a
-2-element list {\tt ( x, y )}.}
-
diff --git a/include/wx/msw/stattext.h b/include/wx/msw/stattext.h
index 20c49b73a4..29561640a9 100644
--- a/include/wx/msw/stattext.h
+++ b/include/wx/msw/stattext.h
@@ -48,6 +48,7 @@ protected:
     virtual void DoSetSize(int x, int y, int w, int h,
                            int sizeFlags = wxSIZE_AUTO);
     virtual wxSize DoGetBestSize() const;
+    virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
 
     DECLARE_DYNAMIC_CLASS(wxStaticText)
 };
diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp
index 991f823d19..7c230e1f9c 100644
--- a/samples/widgets/static.cpp
+++ b/samples/widgets/static.cpp
@@ -73,6 +73,27 @@ enum
     StaticVAlign_Max
 };
 
+class DerivedStaticText: public wxStaticText
+{
+public:
+    DerivedStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
+        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+        long style = 0):
+        wxStaticText(parent, id, label, pos, size, style)
+    {
+    }
+    void OnMouseEvent(wxMouseEvent& event)
+    {
+        if (event.LeftDown())
+            wxMessageBox(wxT("Clicked on static text"));
+    }
+DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(DerivedStaticText, wxStaticText)
+    EVT_MOUSE_EVENTS(DerivedStaticText::OnMouseEvent)
+END_EVENT_TABLE()
+
 // ----------------------------------------------------------------------------
 // StaticWidgetsPage
 // ----------------------------------------------------------------------------
@@ -324,7 +345,7 @@ void StaticWidgetsPage::CreateStatic()
     m_sizerStatBox = new wxStaticBoxSizer(box, isVert ? wxHORIZONTAL
                                                       : wxVERTICAL);
 
-    m_statText = new wxStaticText(this, -1, m_textLabel->GetValue(),
+    m_statText = new DerivedStaticText(this, -1, m_textLabel->GetValue(),
                                   wxDefaultPosition, wxDefaultSize,
                                   flagsText);
 
diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp
index 1c0810694c..a7f9c58876 100644
--- a/src/msw/stattext.cpp
+++ b/src/msw/stattext.cpp
@@ -170,4 +170,13 @@ bool wxStaticText::SetFont(const wxFont& font)
     return ret;
 }
 
+long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+  // Ensure that static items get messages. Some controls don't like this
+  // message to be intercepted (e.g. RichEdit), hence the tests.
+  if (nMsg == WM_NCHITTEST)
+    return (long)HTCLIENT;
+
+  return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
+}
 #endif // wxUSE_STATTEXT
-- 
2.50.0

