From 5f1ea0eeda0b1eb9178931f6338d6eb8d8fa9ab9 Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Mon, 26 Jul 1999 16:06:20 +0000
Subject: [PATCH]   Typos in documentation   list and tree ctrl now actually
 set the text themselves     and no longer crash   various compile fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/classes.tex     |  1 +
 docs/latex/wx/window.tex      |  6 +++---
 include/wx/generic/listctrl.h |  5 +++--
 include/wx/generic/treectrl.h |  3 ++-
 include/wx/helpbase.h         |  1 +
 src/generic/listctrl.cpp      | 30 ++++++++++++++++++------------
 src/generic/treectrl.cpp      | 34 +++++++++++++++++++++++++++-------
 src/unix/gsocket.c            |  4 ++++
 8 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex
index 8f2b027969..1964b23df7 100644
--- a/docs/latex/wx/classes.tex
+++ b/docs/latex/wx/classes.tex
@@ -174,6 +174,7 @@
 \input sashwin.tex
 \input screendc.tex
 \input scrolbar.tex
+\input scrlwevt.tex
 \input scrolevt.tex
 \input scrolwin.tex
 \input sngchdlg.tex
diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex
index 8cb18c8594..77a4e88110 100644
--- a/docs/latex/wx/window.tex
+++ b/docs/latex/wx/window.tex
@@ -1393,9 +1393,9 @@ void MyWindow::OnPaint(wxPaintEvent& event)
 
 \membersection{wxWindow::OnScroll}\label{wxwindowonscroll}
 
-\func{void}{OnScroll}{\param{wxScrollEvent\& }{event}}
+\func{void}{OnScroll}{\param{wxScrollWinEvent\& }{event}}
 
-Called when a scroll event is received from one of the window's built-in scrollbars.
+Called when a scroll window event is received from one of the window's built-in scrollbars.
 
 \wxheading{Parameters}
 
@@ -1411,7 +1411,7 @@ for horizontal events).
 
 \wxheading{See also}
 
-\helpref{wxScrollEvent}{wxscrollevent},\rtfsp
+\helpref{wxScrollWinEvent}{wxscrollwinevent},\rtfsp
 \helpref{Event handling overview}{eventhandlingoverview}
 
 \membersection{wxWindow::OnSetFocus}\label{wxwindowonsetfocus}
diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h
index 15a2c57b03..4b14eb011c 100644
--- a/include/wx/generic/listctrl.h
+++ b/include/wx/generic/listctrl.h
@@ -371,6 +371,7 @@ class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
     bool               *m_accept;
     wxString           *m_res;
     wxListMainWindow   *m_owner;
+    wxString            m_startValue;
 
   public:
     wxListTextCtrl(void) {};
@@ -434,8 +435,8 @@ class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow
     void DeselectLine( wxListLineData *line );
     void DeleteLine( wxListLineData *line );
     
-    wxTextCtrl *EditLabel( long item );
-    void Edit( long item ) { (void)EditLabel(item); }         // deprecated
+    void EditLabel( long item );
+    void Edit( long item ) { EditLabel(item); }         // deprecated
     void OnRenameTimer();
     void OnRenameAccept();
     
diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h
index 6c332b0b6f..7720cddc91 100644
--- a/include/wx/generic/treectrl.h
+++ b/include/wx/generic/treectrl.h
@@ -172,7 +172,8 @@ class WXDLLEXPORT wxTreeTextCtrl: public wxTextCtrl
   private:
     bool               *m_accept;
     wxString           *m_res;
-    wxTreeCtrl        *m_owner;
+    wxTreeCtrl         *m_owner;
+    wxString            m_startValue;
 
   public:
     wxTreeTextCtrl(void) {};
diff --git a/include/wx/helpbase.h b/include/wx/helpbase.h
index d6a9b0d989..32ed2987b0 100644
--- a/include/wx/helpbase.h
+++ b/include/wx/helpbase.h
@@ -20,6 +20,7 @@
 #include "wx/object.h"
 #include "wx/string.h"
 #include "wx/gdicmn.h"
+#include "wx/frame.h"
 
 #if wxUSE_HELP
 
diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp
index 56e6b6c1ac..7dc0dd3c52 100644
--- a/src/generic/listctrl.cpp
+++ b/src/generic/listctrl.cpp
@@ -899,6 +899,9 @@ wxListTextCtrl::wxListTextCtrl( wxWindow *parent, const wxWindowID id,
     m_res = res;
     m_accept = accept;
     m_owner = owner;
+    (*m_accept) = FALSE;
+    (*m_res) = "";
+    m_startValue = value;
 }
 
 void wxListTextCtrl::OnChar( wxKeyEvent &event )
@@ -907,15 +910,14 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
     {
         (*m_accept) = TRUE;
         (*m_res) = GetValue();
-        m_owner->OnRenameAccept();
-        if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
+	m_owner->SetFocus();
         return;
     }
     if (event.m_keyCode == WXK_ESCAPE)
     {
         (*m_accept) = FALSE;
         (*m_res) = "";
-        if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
+	m_owner->SetFocus();
         return;
     }
     event.Skip();
@@ -923,10 +925,12 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
 
 void wxListTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
 {
-    (*m_accept) = FALSE;
-    (*m_res) = "";
-    if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
-    return;
+    if (wxPendingDelete.Member(this)) return;
+
+    wxPendingDelete.Append(this);
+    
+    if ((*m_accept) && ((*m_res) != m_startValue))
+        m_owner->OnRenameAccept();
 }
 
 //-----------------------------------------------------------------------------
@@ -1139,7 +1143,7 @@ void wxListMainWindow::DeleteLine( wxListLineData *line )
 
 /* *** */
 
-wxTextCtrl *wxListMainWindow::EditLabel( long item )
+void wxListMainWindow::EditLabel( long item )
 {
     wxNode *node = m_lines.Nth( item );
     wxCHECK_MSG( node, (wxTextCtrl *)NULL, _T("wrong index in wxListCtrl::Edit()") );
@@ -1153,7 +1157,7 @@ wxTextCtrl *wxListMainWindow::EditLabel( long item )
     GetParent()->GetEventHandler()->ProcessEvent( le );
     
     if (!le.IsAllowed())
-        return (wxTextCtrl *)NULL;
+        return;
     
     wxString s;
     m_currentEdit->GetText( 0, s );
@@ -1171,8 +1175,6 @@ wxTextCtrl *wxListMainWindow::EditLabel( long item )
     wxListTextCtrl *text = new wxListTextCtrl(
       this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) );
     text->SetFocus();
-
-    return text;
 }
 
 void wxListMainWindow::OnRenameTimer()
@@ -1193,7 +1195,11 @@ void wxListMainWindow::OnRenameAccept()
     
     if (!le.IsAllowed()) return;
     
-    /* DO CHANGE LABEL */
+    wxListItem info;
+    info.m_mask = wxLIST_MASK_TEXT;
+    info.m_itemId = le.m_itemIndex;
+    info.m_text = m_renameRes;
+    SetItem( info );
 }
 
 void wxListMainWindow::OnMouse( wxMouseEvent &event )
diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp
index bb316835d7..70bb1c58b3 100644
--- a/src/generic/treectrl.cpp
+++ b/src/generic/treectrl.cpp
@@ -192,6 +192,9 @@ wxTreeTextCtrl::wxTreeTextCtrl( wxWindow *parent, const wxWindowID id,
     m_res = res;
     m_accept = accept;
     m_owner = owner;
+    (*m_accept) = FALSE;
+    (*m_res) = "";
+    m_startValue = value;
 }
 
 void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
@@ -200,15 +203,14 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
     {
         (*m_accept) = TRUE;
         (*m_res) = GetValue();
-        m_owner->OnRenameAccept();
-        if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
+	m_owner->SetFocus();
         return;
     }
     if (event.m_keyCode == WXK_ESCAPE)
     {
         (*m_accept) = FALSE;
         (*m_res) = "";
-        if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
+	m_owner->SetFocus();
         return;
     }
     event.Skip();
@@ -216,9 +218,12 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
 
 void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
 {
-    (*m_accept) = FALSE;
-    (*m_res) = "";
-    if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
+    if (wxPendingDelete.Member(this)) return;
+
+    wxPendingDelete.Append(this);
+    
+    if ((*m_accept) && ((*m_res) != m_startValue))
+        m_owner->OnRenameAccept();
 }
 
 #define PIXELS_PER_UNIT 10
@@ -1801,6 +1806,21 @@ void wxTreeCtrl::Edit( const wxTreeItemId& item )
     int y = m_currentEdit->GetY();
     int w = m_currentEdit->GetWidth();
     int h = m_currentEdit->GetHeight();
+    
+    int image_h = 0;
+    int image_w = 0;
+    if ((m_currentEdit->IsExpanded()) && (m_currentEdit->GetSelectedImage() != -1))
+    {
+        m_imageListNormal->GetSize( m_currentEdit->GetSelectedImage(), image_w, image_h );
+        image_w += 4;
+    }
+    else if (m_currentEdit->GetImage() != -1)
+    {
+        m_imageListNormal->GetSize( m_currentEdit->GetImage(), image_w, image_h );
+        image_w += 4;
+    }
+    x += image_w;
+    w -= image_w + 4; // I don't know why +4 is needed
 
     wxClientDC dc(this);
     PrepareDC( dc );
@@ -1827,7 +1847,7 @@ void wxTreeCtrl::OnRenameAccept()
     
     if (!le.IsAllowed()) return;
     
-    /* DO CHANGE LABEL */
+    SetItemText( m_currentEdit, m_renameRes );
 }
     
 void wxTreeCtrl::OnMouse( wxMouseEvent &event )
diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c
index fa01cea280..594c772a26 100644
--- a/src/unix/gsocket.c
+++ b/src/unix/gsocket.c
@@ -62,6 +62,10 @@ void GSocket_Cleanup()
 {
 }
 
+void GSocket_Done()
+{
+}
+
 /* Constructors / Destructors */
 
 GSocket *GSocket_new()
-- 
2.50.0

