-#endif
-
- m_inSetValue = FALSE;
-}
-
-// 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) ;
-}
-
-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()
-{
- long pos = GetLastPosition();
- SetInsertionPoint(pos);
-}
-
-long wxTextCtrl::GetInsertionPoint() const
-{
- return (long) XmTextGetInsertionPosition ((Widget) m_mainWidget);
-}
-
-long 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,
- (char*) (const char*) value);
-}
-
-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)
-{
- XmTextSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
- (Time) 0);
-}
-
-bool wxTextCtrl::LoadFile(const wxString& file)
-{
- if (!wxFileExists(file))
- return FALSE;
-
- m_fileName = file;
-
- Clear();
-
- Widget textWidget = (Widget) m_mainWidget;
- FILE *fp;
-
- struct stat statb;
- if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
- !(fp = fopen ((char*) (const char*) file, "r")))
- {
- return FALSE;
- }
- else
- {
- long len = statb.st_size;
- char *text;
- if (!(text = XtMalloc ((unsigned) (len + 1))))
- {
- fclose (fp);
- return FALSE;
- }
- if (fread (text, sizeof (char), len, fp) != (size_t) len)
- {
- }
- fclose (fp);
-
- text[len] = 0;
- XmTextSetString (textWidget, text);
- // m_textPosition = len;
- XtFree (text);
- m_modified = FALSE;
- return TRUE;
- }
-}
-
-// If file is null, try saved file name first
-// Returns TRUE if succeeds.
-bool wxTextCtrl::SaveFile(const wxString& file)
-{
- wxString theFile(file);
- if (theFile == "")
- theFile = m_fileName;
- if (theFile == "")
- return FALSE;
- m_fileName = theFile;