Added some missing wxTextCtrl functions: Undo, Redo, CanUndo, CanRedo,
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
This commit is contained in:
parent
49d5d881d4
commit
ca8b28f2ef
@ -122,6 +122,59 @@ apply.
|
|||||||
|
|
||||||
Destructor, destroying the text control.
|
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}
|
\membersection{wxTextCtrl::Clear}\label{wxtextctrlclear}
|
||||||
|
|
||||||
\func{virtual void}{Clear}{\void}
|
\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
|
may wish to avoid using functions that work with line numbers if you are
|
||||||
working with controls that contain large amounts of text.
|
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}
|
\membersection{wxTextCtrl::GetValue}\label{wxtextctrlgetvalue}
|
||||||
|
|
||||||
\constfunc{wxString}{GetValue}{\void}
|
\constfunc{wxString}{GetValue}{\void}
|
||||||
@ -338,6 +404,13 @@ parameter).
|
|||||||
y values, so (x,y) = PositionToXY() is equivalent to the call described
|
y values, so (x,y) = PositionToXY() is equivalent to the call described
|
||||||
above.}
|
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}
|
\membersection{wxTextCtrl::Remove}\label{wxtextctrlremove}
|
||||||
|
|
||||||
\func{virtual void}{Remove}{\param{long}{ from}, \param{long}{ to}}
|
\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.}
|
\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}
|
\membersection{wxTextCtrl::WriteText}\label{wxtextctrlwritetext}
|
||||||
|
|
||||||
\func{void}{WriteText}{\param{const wxString\& }{ text}}
|
\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.
|
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}
|
\membersection{wxTextCtrl::XYToPosition}\label{wxtextctrlxytoposition}
|
||||||
|
|
||||||
\func{long}{XYToPosition}{\param{long}{ x}, \param{long}{ y}}
|
\func{long}{XYToPosition}{\param{long}{ x}, \param{long}{ y}}
|
||||||
|
@ -149,6 +149,9 @@ public:
|
|||||||
// set the padding between tabs (in pixels)
|
// set the padding between tabs (in pixels)
|
||||||
void SetPadding(const wxSize& padding);
|
void SetPadding(const wxSize& padding);
|
||||||
|
|
||||||
|
// Sets the size of the tabs (assumes all tabs are the same size)
|
||||||
|
void SetTabSize(const wxSize& sz);
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
// ----------
|
// ----------
|
||||||
// remove one page from the notebook, and delete the page.
|
// remove one page from the notebook, and delete the page.
|
||||||
|
@ -134,6 +134,9 @@ public:
|
|||||||
// set the padding between tabs (in pixels)
|
// set the padding between tabs (in pixels)
|
||||||
void SetPadding(const wxSize& padding);
|
void SetPadding(const wxSize& padding);
|
||||||
|
|
||||||
|
// Sets the size of the tabs (assumes all tabs are the same size)
|
||||||
|
void SetTabSize(const wxSize& sz);
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
// ----------
|
// ----------
|
||||||
// remove one page from the notebook but do not destroy it
|
// remove one page from the notebook but do not destroy it
|
||||||
|
@ -100,6 +100,22 @@ class wxTextCtrl: public wxControl
|
|||||||
void Paste();
|
void Paste();
|
||||||
void Clear();
|
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 );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
#ifndef NO_TEXT_WINDOW_STREAM
|
||||||
|
@ -134,6 +134,9 @@ public:
|
|||||||
// set the padding between tabs (in pixels)
|
// set the padding between tabs (in pixels)
|
||||||
void SetPadding(const wxSize& padding);
|
void SetPadding(const wxSize& padding);
|
||||||
|
|
||||||
|
// Sets the size of the tabs (assumes all tabs are the same size)
|
||||||
|
void SetTabSize(const wxSize& sz);
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
// ----------
|
// ----------
|
||||||
// remove one page from the notebook but do not destroy it
|
// remove one page from the notebook but do not destroy it
|
||||||
|
@ -100,6 +100,22 @@ class wxTextCtrl: public wxControl
|
|||||||
void Paste();
|
void Paste();
|
||||||
void Clear();
|
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 );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
#ifndef NO_TEXT_WINDOW_STREAM
|
||||||
|
@ -77,6 +77,16 @@ public:
|
|||||||
virtual void Copy();
|
virtual void Copy();
|
||||||
virtual void Cut();
|
virtual void Cut();
|
||||||
virtual void Paste();
|
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 SetInsertionPoint(long pos);
|
||||||
virtual void SetInsertionPointEnd();
|
virtual void SetInsertionPointEnd();
|
||||||
@ -86,6 +96,10 @@ public:
|
|||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
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
|
// streambuf implementation
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
#ifndef NO_TEXT_WINDOW_STREAM
|
||||||
|
@ -93,6 +93,17 @@ public:
|
|||||||
virtual void Cut();
|
virtual void Cut();
|
||||||
virtual void Paste();
|
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 SetInsertionPoint(long pos);
|
||||||
virtual void SetInsertionPointEnd();
|
virtual void SetInsertionPointEnd();
|
||||||
virtual long GetInsertionPoint() const ;
|
virtual long GetInsertionPoint() const ;
|
||||||
@ -102,6 +113,11 @@ public:
|
|||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
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
|
// streambuf implementation
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
#ifndef NO_TEXT_WINDOW_STREAM
|
||||||
int overflow(int i);
|
int overflow(int i);
|
||||||
|
@ -128,6 +128,9 @@ public:
|
|||||||
// set the padding between tabs (in pixels)
|
// set the padding between tabs (in pixels)
|
||||||
void SetPadding(const wxSize& padding);
|
void SetPadding(const wxSize& padding);
|
||||||
|
|
||||||
|
// Sets the size of the tabs (assumes all tabs are the same size)
|
||||||
|
void SetTabSize(const wxSize& sz);
|
||||||
|
|
||||||
// operations
|
// operations
|
||||||
// ----------
|
// ----------
|
||||||
// remove one page from the notebook
|
// remove one page from the notebook
|
||||||
|
@ -85,6 +85,17 @@ public:
|
|||||||
virtual void Cut();
|
virtual void Cut();
|
||||||
virtual void Paste();
|
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 SetInsertionPoint(long pos);
|
||||||
virtual void SetInsertionPointEnd();
|
virtual void SetInsertionPointEnd();
|
||||||
virtual long GetInsertionPoint() const ;
|
virtual long GetInsertionPoint() const ;
|
||||||
@ -94,6 +105,11 @@ public:
|
|||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
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
|
// streambuf implementation
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
#ifndef NO_TEXT_WINDOW_STREAM
|
||||||
int overflow(int i);
|
int overflow(int i);
|
||||||
|
@ -601,6 +601,11 @@ wxRect wxNotebook::GetAvailableClientSize()
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxNotebookTabView
|
* wxNotebookTabView
|
||||||
*/
|
*/
|
||||||
|
@ -509,6 +509,11 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
|
|||||||
wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
|
wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "wxNotebook::SetTabSize not implemented" );
|
||||||
|
}
|
||||||
|
|
||||||
bool wxNotebook::DeleteAllPages()
|
bool wxNotebook::DeleteAllPages()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||||
|
@ -703,6 +703,71 @@ void wxTextCtrl::Paste()
|
|||||||
#endif
|
#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()
|
void wxTextCtrl::Clear()
|
||||||
{
|
{
|
||||||
SetValue( "" );
|
SetValue( "" );
|
||||||
|
@ -509,6 +509,11 @@ void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
|
|||||||
wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
|
wxFAIL_MSG( "wxNotebook::SetPadding not implemented" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "wxNotebook::SetTabSize not implemented" );
|
||||||
|
}
|
||||||
|
|
||||||
bool wxNotebook::DeleteAllPages()
|
bool wxNotebook::DeleteAllPages()
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid notebook" );
|
||||||
|
@ -703,6 +703,71 @@ void wxTextCtrl::Paste()
|
|||||||
#endif
|
#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()
|
void wxTextCtrl::Clear()
|
||||||
{
|
{
|
||||||
SetValue( "" );
|
SetValue( "" );
|
||||||
|
@ -245,6 +245,67 @@ void wxTextCtrl::Paste()
|
|||||||
XmTextPaste((Widget) m_mainWidget);
|
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)
|
void wxTextCtrl::SetEditable(bool editable)
|
||||||
{
|
{
|
||||||
XmTextSetEditable((Widget) m_mainWidget, (Boolean) editable);
|
XmTextSetEditable((Widget) m_mainWidget, (Boolean) editable);
|
||||||
|
@ -729,9 +729,87 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||||||
return wxString(wxBuffer);
|
return wxString(wxBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
bool wxTextCtrl::CanCopy() const
|
||||||
* Text item
|
{
|
||||||
*/
|
// 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)
|
void wxTextCtrl::Command(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
|
@ -375,3 +375,8 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|||||||
m_nSelection = nSel;
|
m_nSelection = nSel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -267,9 +267,64 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||||||
return wxString("");
|
return wxString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
bool wxTextCtrl::CanCopy() const
|
||||||
* Text item
|
{
|
||||||
*/
|
// 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)
|
void wxTextCtrl::Command(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user