]> git.saurik.com Git - wxWidgets.git/commitdiff
Added some missing wxTextCtrl functions: Undo, Redo, CanUndo, CanRedo,
authorJulian Smart <julian@anthemion.co.uk>
Tue, 6 Apr 1999 16:32:33 +0000 (16:32 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 6 Apr 1999 16:32:33 +0000 (16:32 +0000)
CanCopy, CanCut, CanPaste, GetSelection, IsEditable.
Also added wxNotebook::SetTabSize (only implemented on wxMSW but necessary
when using just an icon).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

19 files changed:
docs/latex/wx/text.tex
include/wx/generic/notebook.h
include/wx/gtk/notebook.h
include/wx/gtk/textctrl.h
include/wx/gtk1/notebook.h
include/wx/gtk1/textctrl.h
include/wx/motif/textctrl.h
include/wx/msw/textctrl.h
include/wx/stubs/notebook.h
include/wx/stubs/textctrl.h
src/generic/notebook.cpp
src/gtk/notebook.cpp
src/gtk/textctrl.cpp
src/gtk1/notebook.cpp
src/gtk1/textctrl.cpp
src/motif/textctrl.cpp
src/msw/textctrl.cpp
src/stubs/notebook.cpp
src/stubs/textctrl.cpp

index 7b431f267207b5cf01e150fc4aad9d34cda25e20..54395fae08920458349d244fc80597b2fec56cf9 100644 (file)
@@ -122,6 +122,59 @@ apply.
 
 Destructor, destroying the text control.
 
+\membersection{wxTextCtrl::AppendText}\label{wxtextctrlappendtext}
+
+\func{void}{AppendText}{\param{const wxString\& }{ text}}
+
+Appends the text to the end of the text control.
+
+\wxheading{Parameters}
+
+\docparam{text}{Text to write to the text control.}
+
+\wxheading{Remarks}
+
+After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired,
+the programmer should use \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} and \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}.
+
+\wxheading{See also}
+
+\helpref{wxTextCtrl::WriteText}{wxtextctrlwritetext}
+
+\membersection{wxTextCtrl::CanCopy}\label{wxtextctrlcancopy}
+
+\func{virtual bool}{CanCopy}{\void}
+
+Returns TRUE if the selection can be copied to the clipboard.
+
+\membersection{wxTextCtrl::CanCut}\label{wxtextctrlcancut}
+
+\func{virtual bool}{CanCut}{\void}
+
+Returns TRUE if the selection can be cut to the clipboard.
+
+\membersection{wxTextCtrl::CanPaste}\label{wxtextctrlcanpaste}
+
+\func{virtual bool}{CanPaste}{\void}
+
+Returns TRUE if the contents of the clipboard can be pasted into the
+text control. On some platforms (Motif, GTK) this is an approximation
+and returns TRUE if the control is editable, FALSE otherwise.
+
+\membersection{wxTextCtrl::CanRedo}\label{wxtextctrlcanredo}
+
+\func{virtual bool}{CanRedo}{\void}
+
+Returns TRUE if there is a redo facility available and the last operation
+can be redone.
+
+\membersection{wxTextCtrl::CanUndo}\label{wxtextctrlcanundo}
+
+\func{virtual bool}{CanUndo}{\void}
+
+Returns TRUE if there is an undo facility available and the last operation
+can be undone.
+
 \membersection{wxTextCtrl::Clear}\label{wxtextctrlclear}
 
 \func{virtual void}{Clear}{\void}
@@ -232,6 +285,19 @@ calculated by actually counting newline characters in the buffer. You
 may wish to avoid using functions that work with line numbers if you are
 working with controls that contain large amounts of text.
 
+\membersection{wxTextCtrl::GetSelection}\label{wxtextctrlgetselection}
+
+\func{virtual void}{GetSelection}{\param{long*}{ from}, \param{long*}{ to}}
+
+Gets the current selection span. If the returned values are equal, there was
+no selection.
+
+\wxheading{Parameters}
+
+\docparam{from}{The returned first position.}
+
+\docparam{to}{The returned last position.}
+
 \membersection{wxTextCtrl::GetValue}\label{wxtextctrlgetvalue}
 
 \constfunc{wxString}{GetValue}{\void}
@@ -338,6 +404,13 @@ parameter).
 y values, so (x,y) = PositionToXY() is equivalent to the call described
 above.}
 
+\membersection{wxTextCtrl::Redo}\label{wxtextctrlredo}
+
+\func{virtual void}{Redo}{\void}
+
+If there is a redo facility and the last operation can be redone, redoes the last operation. Does nothing
+if there is no redo facility.
+
 \membersection{wxTextCtrl::Remove}\label{wxtextctrlremove}
 
 \func{virtual void}{Remove}{\param{long}{ from}, \param{long}{ to}}
@@ -440,6 +513,13 @@ Makes the line containing the given position visible.
 
 \docparam{pos}{The position that should be visible.}
 
+\membersection{wxTextCtrl::Undo}\label{wxtextctrlundo}
+
+\func{virtual void}{Undo}{\void}
+
+If there is an undo facility and the last operation can be undone, undoes the last operation. Does nothing
+if there is no undo facility.
+
 \membersection{wxTextCtrl::WriteText}\label{wxtextctrlwritetext}
 
 \func{void}{WriteText}{\param{const wxString\& }{ text}}
@@ -458,25 +538,6 @@ line breaks.  See \helpref{wxTextCtrl::\cinsert}{wxtextctrlinsert} and \helpref{
 
 After the write operation, the insertion point will be at the end of the inserted text, so subsequent write operations will be appended. To append text after the user may have interacted with the control, call \helpref{wxTextCtrl::SetInsertionPointEnd}{wxtextctrlsetinsertionpointend} before writing.
 
-\membersection{wxTextCtrl::AppendText}\label{wxtextctrlappendtext}
-
-\func{void}{AppendText}{\param{const wxString\& }{ text}}
-
-Appends the text to the end of the text control.
-
-\wxheading{Parameters}
-
-\docparam{text}{Text to write to the text control.}
-
-\wxheading{Remarks}
-
-After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired,
-the programmer should use \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} and \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}.
-
-\wxheading{See also}
-
-\helpref{wxTextCtrl::WriteText}{wxtextctrlwritetext}
-
 \membersection{wxTextCtrl::XYToPosition}\label{wxtextctrlxytoposition}
 
 \func{long}{XYToPosition}{\param{long}{ x}, \param{long}{ y}}
index 99fb13d1adeef1376b0c83ca887a0aa4a8d13aee..fe6d8c82deccad07742e8b0e80385990e5b578da 100644 (file)
@@ -149,6 +149,9 @@ public:
     // set the padding between tabs (in pixels)
   void SetPadding(const wxSize& padding);
 
+    // Sets the size of the tabs (assumes all tabs are the same size)
+  void SetTabSize(const wxSize& sz);
+
   // operations
   // ----------
     // remove one page from the notebook, and delete the page.
index 97c86e7ee9dd577e7e7400c8cdef12f92b22243b..34e2906a9c61460fedecee7ffae41075f8e6d0c1 100644 (file)
@@ -134,6 +134,9 @@ public:
     // set the padding between tabs (in pixels)
   void SetPadding(const wxSize& padding);
 
+    // Sets the size of the tabs (assumes all tabs are the same size)
+  void SetTabSize(const wxSize& sz);
+
   // operations
   // ----------
     // remove one page from the notebook but do not destroy it
index fcc1be71f3ed4f3cce96b098568ae3125967e398..2512ce42c1bc6df0bfbb298e8fbc85682216f31e 100644 (file)
@@ -100,6 +100,22 @@ class wxTextCtrl: public wxControl
     void Paste();
     void Clear();
 
+    virtual bool CanCopy() const;
+    virtual bool CanCut() const;
+    virtual bool CanPaste() const;
+
+    // Undo/redo
+    virtual void Undo();
+    virtual void Redo();
+
+    virtual bool CanUndo() const;
+    virtual bool CanRedo() const;
+
+    // If the return values from and to are the same, there is no
+    // selection.
+    virtual void GetSelection(long* from, long* to) const;
+    virtual bool IsEditable() const ;
+
     void OnChar( wxKeyEvent &event );
 
 #ifndef NO_TEXT_WINDOW_STREAM
index 97c86e7ee9dd577e7e7400c8cdef12f92b22243b..34e2906a9c61460fedecee7ffae41075f8e6d0c1 100644 (file)
@@ -134,6 +134,9 @@ public:
     // set the padding between tabs (in pixels)
   void SetPadding(const wxSize& padding);
 
+    // Sets the size of the tabs (assumes all tabs are the same size)
+  void SetTabSize(const wxSize& sz);
+
   // operations
   // ----------
     // remove one page from the notebook but do not destroy it
index fcc1be71f3ed4f3cce96b098568ae3125967e398..2512ce42c1bc6df0bfbb298e8fbc85682216f31e 100644 (file)
@@ -100,6 +100,22 @@ class wxTextCtrl: public wxControl
     void Paste();
     void Clear();
 
+    virtual bool CanCopy() const;
+    virtual bool CanCut() const;
+    virtual bool CanPaste() const;
+
+    // Undo/redo
+    virtual void Undo();
+    virtual void Redo();
+
+    virtual bool CanUndo() const;
+    virtual bool CanRedo() const;
+
+    // If the return values from and to are the same, there is no
+    // selection.
+    virtual void GetSelection(long* from, long* to) const;
+    virtual bool IsEditable() const ;
+
     void OnChar( wxKeyEvent &event );
 
 #ifndef NO_TEXT_WINDOW_STREAM
index 091f5e6763cd70e112c5bf993f899374045dfc86..6622976caf5707bc28e75e79fdb8c135b6f43205 100644 (file)
@@ -77,6 +77,16 @@ public:
     virtual void Copy();
     virtual void Cut();
     virtual void Paste();
+    virtual bool CanCopy() const;
+    virtual bool CanCut() const;
+    virtual bool CanPaste() const;
+
+    // Undo/redo
+    virtual void Undo();
+    virtual void Redo();
+
+    virtual bool CanUndo() const;
+    virtual bool CanRedo() const;
 
     virtual void SetInsertionPoint(long pos);
     virtual void SetInsertionPointEnd();
@@ -86,6 +96,10 @@ public:
     virtual void Remove(long from, long to);
     virtual void SetSelection(long from, long to);
     virtual void SetEditable(bool editable);
+    // If the return values from and to are the same, there is no
+    // selection.
+    virtual void GetSelection(long* from, long* to) const;
+    virtual bool IsEditable() const ;
 
     // streambuf implementation
 #ifndef NO_TEXT_WINDOW_STREAM
index 1e47cb75474e737beb195398758eaae494ea02b7..142ee8ba4985e6b9c7c052af2b75a90666ba04d8 100644 (file)
@@ -93,6 +93,17 @@ public:
     virtual void Cut();
     virtual void Paste();
 
+    virtual bool CanCopy() const;
+    virtual bool CanCut() const;
+    virtual bool CanPaste() const;
+
+    // Undo/redo
+    virtual void Undo();
+    virtual void Redo();
+
+    virtual bool CanUndo() const;
+    virtual bool CanRedo() const;
+
     virtual void SetInsertionPoint(long pos);
     virtual void SetInsertionPointEnd();
     virtual long GetInsertionPoint() const ;
@@ -102,6 +113,11 @@ public:
     virtual void SetSelection(long from, long to);
     virtual void SetEditable(bool editable);
 
+    // If the return values from and to are the same, there is no
+    // selection.
+    virtual void GetSelection(long* from, long* to) const;
+    virtual bool IsEditable() const ;
+
     // streambuf implementation
 #ifndef NO_TEXT_WINDOW_STREAM
     int overflow(int i);
index 83f8c1ce4e1d7ff81c7cf285c1f2cd4bbb2e7292..18b0793da201a93c99693c17e0a48cb92b0e6611 100644 (file)
@@ -128,6 +128,9 @@ public:
     // set the padding between tabs (in pixels)
   void SetPadding(const wxSize& padding);
 
+    // Sets the size of the tabs (assumes all tabs are the same size)
+  void SetTabSize(const wxSize& sz);
+
   // operations
   // ----------
     // remove one page from the notebook
index 675e21bb3fcabe3f523f9cbfe46cfdd5580b0de2..0834e1a43bfe6828ac54b2d2bae085e911005a30 100644 (file)
@@ -85,6 +85,17 @@ public:
   virtual void Cut();
   virtual void Paste();
   
+  virtual bool CanCopy() const;
+  virtual bool CanCut() const;
+  virtual bool CanPaste() const;
+
+  // Undo/redo
+  virtual void Undo();
+  virtual void Redo();
+
+  virtual bool CanUndo() const;
+  virtual bool CanRedo() const;
+
   virtual void SetInsertionPoint(long pos);
   virtual void SetInsertionPointEnd();
   virtual long GetInsertionPoint() const ;
@@ -93,7 +104,12 @@ public:
   virtual void Remove(long from, long to);
   virtual void SetSelection(long from, long to);
   virtual void SetEditable(bool editable);
-  
+
+  // If the return values from and to are the same, there is no
+  // selection.
+  virtual void GetSelection(long* from, long* to) const;
+  virtual bool IsEditable() const ;
+
   // streambuf implementation
 #ifndef NO_TEXT_WINDOW_STREAM
   int overflow(int i);
index 3be3cd9634d6801cbc5d89f3515e80e0f0d99bd0..90782f45457acf2afbdbef48298007c9054ae4bc 100644 (file)
@@ -601,6 +601,11 @@ wxRect wxNotebook::GetAvailableClientSize()
     return rect;
 }
 
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+    // TODO
+}
+
 /*
  * wxNotebookTabView
  */
index 96be1af67e42dc33a13da66883129ca6753b0f6f..ea57e8c4338a1137c224680f52c3dc19fc1faece 100644 (file)
@@ -509,6 +509,11 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
     wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
 }
 
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+    wxFAIL_MSG( "wxNotebook::SetTabSize not implemented" );
+}
+
 bool wxNotebook::DeleteAllPages()
 {
     wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
index 94e4126e60c4f6cf993e979c51e4ca0ee515d8e2..4da56a23e5cadb20ca2770c2fe5aad4fa35b2c48 100644 (file)
@@ -703,6 +703,71 @@ void wxTextCtrl::Paste()
 #endif
 }
 
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    return IsEditable() ;
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::Undo not implemented" );
+}
+
+void wxTextCtrl::Redo()
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::Redo not implemented" );
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::CanUndo not implemented" );
+    return FALSE;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::CanRedo not implemented" );
+    return FALSE;
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+    // TODO
+    *from = 0;
+    *to = 0;
+    wxFAIL_MSG( "wxTextCtrl::GetSelection not implemented" );
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::IsEditable not implemented" );
+    return FALSE;
+}
+
 void wxTextCtrl::Clear()
 {
     SetValue( "" );
index 96be1af67e42dc33a13da66883129ca6753b0f6f..ea57e8c4338a1137c224680f52c3dc19fc1faece 100644 (file)
@@ -509,6 +509,11 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
     wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
 }
 
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+    wxFAIL_MSG( "wxNotebook::SetTabSize not implemented" );
+}
+
 bool wxNotebook::DeleteAllPages()
 {
     wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
index 94e4126e60c4f6cf993e979c51e4ca0ee515d8e2..4da56a23e5cadb20ca2770c2fe5aad4fa35b2c48 100644 (file)
@@ -703,6 +703,71 @@ void wxTextCtrl::Paste()
 #endif
 }
 
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    return IsEditable() ;
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::Undo not implemented" );
+}
+
+void wxTextCtrl::Redo()
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::Redo not implemented" );
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::CanUndo not implemented" );
+    return FALSE;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::CanRedo not implemented" );
+    return FALSE;
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+    // TODO
+    *from = 0;
+    *to = 0;
+    wxFAIL_MSG( "wxTextCtrl::GetSelection not implemented" );
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+    // TODO
+    wxFAIL_MSG( "wxTextCtrl::IsEditable not implemented" );
+    return FALSE;
+}
+
 void wxTextCtrl::Clear()
 {
     SetValue( "" );
index b84167773a1ba0647c6845b8be9455a04b227c98..a9ae3f9b0a363033184875fc5719e7dd3a5df77a 100644 (file)
@@ -245,6 +245,67 @@ void wxTextCtrl::Paste()
     XmTextPaste((Widget) m_mainWidget);
 }
 
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    return IsEditable() ;
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+    // Not possible in Motif
+}
+
+void wxTextCtrl::Redo()
+{
+    // Not possible in Motif
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    // No Undo in Motif
+    return FALSE;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    // No Redo in Motif
+    return FALSE;
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+    XmTextPosition left, right;
+
+    XmTextGetSelectionPosition((Widget) m_mainWidget, & left, & right);
+
+    *from = (long) left;
+    *to = (long) right;
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+    return (XmTextGetEditable((Widget) m_mainWidget) != 0);
+}
+
 void wxTextCtrl::SetEditable(bool editable)
 {
     XmTextSetEditable((Widget) m_mainWidget, (Boolean) editable);
index 9d5a411fdbee0f8da9ade0753e91b23c3b46f1fc..d08a18f0286ab4f512ece930c72f12b0446cf93e 100644 (file)
@@ -729,9 +729,87 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
   return wxString(wxBuffer);
 }
 
-/*
- * Text item
- */
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    int dataFormat = 0; // 0 == any format
+    return (::SendMessage( (HWND) GetHWND(), EM_CANPASTE, (WPARAM) (UINT) dataFormat, 0) != 0);
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+    if (CanUndo())
+    {
+        ::SendMessage((HWND) GetHWND(), EM_UNDO, 0, 0);
+    }
+}
+
+void wxTextCtrl::Redo()
+{
+    if (CanRedo())
+    {
+        // Same as Undo, since Undo undoes the undo, i.e. a redo.
+        ::SendMessage((HWND) GetHWND(), EM_UNDO, 0, 0);
+    }
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    return (::SendMessage((HWND) GetHWND(), EM_CANUNDO, 0, 0) != 0);
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    return (::SendMessage((HWND) GetHWND(), EM_CANUNDO, 0, 0) != 0);
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+#if wxUSE_RICHEDIT
+    if (m_isRich)
+    {
+        CHARRANGE charRange;
+        ::SendMessage((HWND) GetHWND(), EM_EXGETSEL, 0, (LPARAM) (CHARRANGE*) & charRange);
+
+        *from = charRange.cpMin;
+        *to = charRange.cpMax;
+
+        return;
+    }
+#endif
+    DWORD dwStart, dwEnd;
+    WPARAM wParam = (WPARAM) (DWORD*) dwStart; // receives starting position
+    LPARAM lParam = (LPARAM) (DWORD*) dwEnd;   // receives ending position
+
+    ::SendMessage((HWND) GetHWND(), EM_GETSEL, wParam, lParam);
+
+    *from = dwStart;
+    *to = dwEnd;
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+    long style = ::GetWindowLong((HWND) GetHWND(), GWL_STYLE);
+    return ((style & ES_READONLY) == 0);
+}
 
 void wxTextCtrl::Command(wxCommandEvent & event)
 {
index 312dd0f3d3ae8a62ddf0ac466bb04cd20a4c5aa9..f7ee49cd5d09c1aec3707f8d9685a54308bb94ba 100644 (file)
@@ -375,3 +375,8 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
     m_nSelection = nSel;
 }
 
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+    // TODO
+}
+
index a9ede8a5a4ba9488ededcb4b569592d8a8d95b29..a43a38acc97c13df0c17439ce3902020413b8975 100644 (file)
@@ -267,10 +267,65 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
     return wxString("");
 }
 
-/*
- * Text item
- */
+bool wxTextCtrl::CanCopy() const
+{
+    // Can copy if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+    // Can cut if there's a selection
+    long from, to;
+    GetSelection(& from, & to);
+    return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+    return IsEditable() ;
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+    // TODO
+}
+
+void wxTextCtrl::Redo()
+{
+    // TODO
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+    // TODO
+    return FALSE;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+    // TODO
+    return FALSE;
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+    // TODO
+    *from = 0;
+    *to = 0;
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+    // TODO
+    return FALSE;
+}
+
 void wxTextCtrl::Command(wxCommandEvent & event)
 {
     SetValue (event.GetString());