fix a few hundreds of harmless unused parameters warnings and a couple of real bugs discovered thanks to them
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -219,14 +219,7 @@ wxString wxTextCtrl::GetValue() const
|
||||
}
|
||||
else
|
||||
{
|
||||
// just get the string from Motif
|
||||
char *s = XmTextGetString ((Widget) m_mainWidget);
|
||||
if ( s )
|
||||
{
|
||||
str = s;
|
||||
XtFree (s);
|
||||
}
|
||||
//else: return empty string
|
||||
str = wxTextEntry::GetValue();
|
||||
|
||||
if ( m_tempCallbackStruct )
|
||||
{
|
||||
@@ -258,159 +251,6 @@ void wxTextCtrl::DoSetValue(const wxString& text, int flags)
|
||||
SendTextUpdatedEvent();
|
||||
}
|
||||
|
||||
// Clipboard operations
|
||||
void wxTextCtrl::Copy()
|
||||
{
|
||||
XmTextCopy((Widget) m_mainWidget, CurrentTime);
|
||||
}
|
||||
|
||||
void wxTextCtrl::Cut()
|
||||
{
|
||||
XmTextCut((Widget) m_mainWidget, CurrentTime);
|
||||
}
|
||||
|
||||
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) && (IsEditable());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPoint(long pos)
|
||||
{
|
||||
XmTextSetInsertionPosition ((Widget) m_mainWidget, (XmTextPosition) pos);
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPointEnd()
|
||||
{
|
||||
wxTextPos pos = GetLastPosition();
|
||||
SetInsertionPoint(pos);
|
||||
}
|
||||
|
||||
long wxTextCtrl::GetInsertionPoint() const
|
||||
{
|
||||
return (long) XmTextGetInsertionPosition ((Widget) m_mainWidget);
|
||||
}
|
||||
|
||||
wxTextPos wxTextCtrl::GetLastPosition() const
|
||||
{
|
||||
return (long) XmTextGetLastPosition ((Widget) m_mainWidget);
|
||||
}
|
||||
|
||||
void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
||||
{
|
||||
XmTextReplace ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||
value.char_str());
|
||||
}
|
||||
|
||||
void wxTextCtrl::Remove(long from, long to)
|
||||
{
|
||||
XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||
(Time) 0);
|
||||
XmTextRemove ((Widget) m_mainWidget);
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetSelection(long from, long to)
|
||||
{
|
||||
if( to == -1 )
|
||||
to = GetLastPosition();
|
||||
|
||||
XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||
(Time) 0);
|
||||
}
|
||||
|
||||
void wxTextCtrl::WriteText(const wxString& text)
|
||||
{
|
||||
long textPosition = GetInsertionPoint() + text.length();
|
||||
XmTextInsert ((Widget) m_mainWidget, GetInsertionPoint(),
|
||||
text.char_str());
|
||||
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
|
||||
SetInsertionPoint(textPosition);
|
||||
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
void wxTextCtrl::AppendText(const wxString& text)
|
||||
{
|
||||
wxTextPos textPosition = GetLastPosition() + text.length();
|
||||
XmTextInsert ((Widget) m_mainWidget, GetLastPosition(),
|
||||
text.char_str());
|
||||
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
|
||||
SetInsertionPoint(textPosition);
|
||||
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
void wxTextCtrl::Clear()
|
||||
{
|
||||
XmTextSetString ((Widget) m_mainWidget, wxMOTIF_STR(""));
|
||||
m_modified = false;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::IsModified() const
|
||||
{
|
||||
return m_modified;
|
||||
|
Reference in New Issue
Block a user