]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/textctrl.cpp
Remove some cruft
[wxWidgets.git] / src / univ / textctrl.cpp
index 0765852720df60322dc84ea845e0495fd2122623..3f6168f230e23d3bb21e1ef005230025509adfc5 100644 (file)
@@ -487,7 +487,7 @@ struct WXDLLEXPORT wxTextWrappedData : public wxTextMultiLineData
 // ----------------------------------------------------------------------------
 
 /*
 // ----------------------------------------------------------------------------
 
 /*
-   We use custom versions of wxWindows command processor to implement undo/redo
+   We use custom versions of wxWidgets command processor to implement undo/redo
    as we want to avoid storing the backpointer to wxTextCtrl in wxCommand
    itself: this is a waste of memory as all commands in the given command
    processor always have the same associated wxTextCtrl and so it makes sense
    as we want to avoid storing the backpointer to wxTextCtrl in wxCommand
    itself: this is a waste of memory as all commands in the given command
    processor always have the same associated wxTextCtrl and so it makes sense
@@ -622,25 +622,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 // creation
 // ----------------------------------------------------------------------------
 
 // creation
 // ----------------------------------------------------------------------------
 
-wxTextCtrl::wxTextCtrl()
-{
-    Init();
-}
-
-wxTextCtrl::wxTextCtrl(wxWindow *parent,
-                       wxWindowID id,
-                       const wxString& value,
-                       const wxPoint& pos,
-                       const wxSize& size,
-                       long style,
-                       const wxValidator& validator,
-                       const wxString& name)
-{
-    Init();
-
-    Create(parent, id, value, pos, size, style, validator, name);
-}
-
 void wxTextCtrl::Init()
 {
     m_selAnchor =
 void wxTextCtrl::Init()
 {
     m_selAnchor =
@@ -1667,6 +1648,9 @@ wxString wxTextCtrl::GetLineText(wxTextCoord line) const
     }
     else // multiline
     {
     }
     else // multiline
     {
+        //this is called during DoGetBestSize
+        if (line == 0 && GetLineCount() == 0) return wxEmptyString ;
+       
         wxCHECK_MSG( (size_t)line < GetLineCount(), _T(""),
                      _T("line index out of range") );
 
         wxCHECK_MSG( (size_t)line < GetLineCount(), _T(""),
                      _T("line index out of range") );
 
@@ -2968,6 +2952,18 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line,
     return res;
 }
 
     return res;
 }
 
+wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
+{
+    wxTextCoord x, y;
+    wxTextCtrlHitTestResult rc = HitTest(pt, &x, &y);
+    if ( rc != wxTE_HT_UNKNOWN && pos )
+    {
+        *pos = XYToPosition(x, y);
+    }
+
+    return rc;
+}
+
 wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pos,
                                             wxTextCoord *colOut,
                                             wxTextCoord *rowOut) const
 wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pos,
                                             wxTextCoord *colOut,
                                             wxTextCoord *rowOut) const