#pragma implementation "textctrl.h"
#endif
+#ifdef __VMS
+#define XtParent XTPARENT
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fstream.h>
#include "wx/filefn.h"
#include "wx/utils.h"
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/Text.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
#include "wx/motif/private.h"
static void wxTextWindowLoseFocusProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
static void wxTextWindowActivateProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *ptr);
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
END_EVENT_TABLE()
-#endif
// ============================================================================
// implementation
NULL
);
+ XtVaSetValues ((Widget) m_mainWidget,
+ XmNeditable, ((style & wxTE_READONLY) ? False : True),
+ NULL);
+
// TODO: Is this relevant? What does it do?
int noCols = 2;
if (!value.IsNull() && (value.Length() > (unsigned int) noCols))
}
if ( !!value )
+ {
+#if 0
+ // don't do this because it is just linking the text to a source
+ // string which is unsafe. MB
+ //
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
-
+#else
+ // do this instead... MB
+ //
+ XtVaSetValues( (Widget) m_mainWidget,
+ XmNvalue, (char *)value.c_str(),
+ NULL);
+#endif
+ }
+
// install callbacks
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
{
m_inSetValue = TRUE;
+#if 0
+ // don't do this because it is just linking the text to a source
+ // string which is unsafe. MB
+ //
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
+#else
+ // do this instead... MB
+ //
+ XtVaSetValues( (Widget) m_mainWidget,
+ XmNvalue, (char *)value.c_str(),
+ NULL);
+#endif
m_inSetValue = FALSE;
}
// Can cut if there's a selection
long from, to;
GetSelection(& from, & to);
- return (from != to) ;
+ return (from != to) && (IsEditable());
}
bool wxTextCtrl::CanPaste() const
Clear();
Widget textWidget = (Widget) m_mainWidget;
- FILE *fp;
+ FILE *fp = 0;
struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
return r+x;
}
-void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
+bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
{
Position xx, yy;
XmTextPosToXY((Widget) m_mainWidget, pos, &xx, &yy);
- *x = xx; *y = yy;
+ if ( x )
+ *x = xx;
+ if ( y )
+ *y = yy;
+
+ return TRUE;
}
void wxTextCtrl::ShowPosition(long pos)
}
static void
-wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr)
+wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
{
if (!wxGetWindowFromTable(w))
// Widget has been deleted!
}
static void
-wxTextWindowModifyProc (Widget w, XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
+wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
{
wxTextCtrl *tw = (wxTextCtrl *) clientData;
tw->m_processedDefault = FALSE;
}
static void
-wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs)
+wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
{
if (!wxGetWindowFromTable(w))
return;
}
static void
-wxTextWindowLoseFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs)
+wxTextWindowLoseFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
{
if (!wxGetWindowFromTable(w))
return;
}
static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
- XmAnyCallbackStruct *ptr)
+ XmAnyCallbackStruct *WXUNUSED(ptr))
{
if (!wxGetWindowFromTable(w))
return;