wxNO_BORDER honoured by wxTextCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,6 +9,14 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "textctrl.h"
|
||||
#endif
|
||||
@@ -16,37 +24,27 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(__WIN32__)
|
||||
#include <alloc.h>
|
||||
#else
|
||||
#ifndef __GNUWIN32__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <Xm/Text.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
|
||||
static void
|
||||
wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr);
|
||||
static void
|
||||
wxTextWindowModifyProc (Widget w, XtPointer clientData, XmTextVerifyCallbackStruct *cbs);
|
||||
static void
|
||||
wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
|
||||
static void
|
||||
wxTextWindowLoseFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
|
||||
static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
|
||||
XmAnyCallbackStruct *ptr);
|
||||
// ----------------------------------------------------------------------------
|
||||
// private functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// callbacks
|
||||
static void wxTextWindowChangedProc(Widget w, XtPointer clientData, XtPointer ptr);
|
||||
static void wxTextWindowModifyProc(Widget w, XtPointer clientData, XmTextVerifyCallbackStruct *cbs);
|
||||
static void wxTextWindowGainFocusProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
|
||||
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)
|
||||
@@ -57,36 +55,45 @@ EVT_CHAR(wxTextCtrl::OnChar)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Text item
|
||||
wxTextCtrl::wxTextCtrl()
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
: streambuf()
|
||||
#endif
|
||||
{
|
||||
m_fileName = "";
|
||||
m_tempCallbackStruct = (void*) NULL;
|
||||
m_modified = FALSE;
|
||||
m_processedDefault = FALSE;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
bool wxTextCtrl::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
m_tempCallbackStruct = (void*) NULL;
|
||||
m_modified = FALSE;
|
||||
m_processedDefault = FALSE;
|
||||
m_fileName = "";
|
||||
// m_backgroundColour = parent->GetBackgroundColour();
|
||||
m_backgroundColour = * wxWHITE;
|
||||
m_foregroundColour = parent->GetForegroundColour();
|
||||
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
if (parent) parent->AddChild(this);
|
||||
if (parent)
|
||||
parent->AddChild(this);
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
@@ -108,7 +115,9 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
XtSetArg (args[0], XmNscrollHorizontal, wantHorizScrolling ? True : False);
|
||||
XtSetArg (args[1], XmNwordWrap, wantWordWrap ? True : False);
|
||||
|
||||
m_mainWidget = (WXWidget) XmCreateScrolledText (parentWidget, (char*) (const char*) name, args, 2);
|
||||
m_mainWidget = (WXWidget) XmCreateScrolledText(parentWidget,
|
||||
(char*)name.c_str(),
|
||||
args, 2);
|
||||
|
||||
XtVaSetValues ((Widget) m_mainWidget,
|
||||
XmNeditable, ((style & wxTE_READONLY) ? False : True),
|
||||
@@ -118,9 +127,13 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
|
||||
xmTextWidgetClass, parentWidget,
|
||||
NULL);
|
||||
m_mainWidget = (WXWidget)XtVaCreateManagedWidget
|
||||
(
|
||||
(char*)name.c_str(),
|
||||
xmTextWidgetClass,
|
||||
parentWidget,
|
||||
NULL
|
||||
);
|
||||
|
||||
// TODO: Is this relevant? What does it do?
|
||||
int noCols = 2;
|
||||
@@ -131,9 +144,18 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (!value.IsNull())
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*) (const char*) value);
|
||||
// remove border if asked for
|
||||
if ( style & wxNO_BORDER )
|
||||
{
|
||||
XtVaSetValues((Widget)m_mainWidget,
|
||||
XmNshadowThickness, 0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if ( !!value )
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
|
||||
|
||||
// install callbacks
|
||||
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
|
||||
|
||||
XtAddCallback((Widget) m_mainWidget, XmNmodifyVerifyCallback, (XtCallbackProc)wxTextWindowModifyProc, (XtPointer)this);
|
||||
@@ -144,6 +166,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
|
||||
|
||||
// font
|
||||
m_windowFont = parent->GetFont();
|
||||
ChangeFont(FALSE);
|
||||
|
||||
@@ -182,12 +205,9 @@ wxString wxTextCtrl::GetValue() const
|
||||
|
||||
void wxTextCtrl::SetValue(const wxString& value)
|
||||
{
|
||||
// This assert is wrong -- means that you can't set an empty
|
||||
// string (IsNull == IsEmpty).
|
||||
// wxASSERT_MSG( (!value.IsNull()), "Must not pass a null string to wxTextCtrl::SetValue." ) ;
|
||||
m_inSetValue = TRUE;
|
||||
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*) (const char*) value);
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*)value.c_str());
|
||||
|
||||
m_inSetValue = FALSE;
|
||||
}
|
||||
@@ -857,6 +877,10 @@ wxTextWindowModifyProc (Widget w, XtPointer clientData, XmTextVerifyCallbackStru
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// callbacks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs)
|
||||
{
|
||||
@@ -888,15 +912,6 @@ static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
|
||||
return;
|
||||
|
||||
wxTextCtrl *tw = (wxTextCtrl *) clientData;
|
||||
/*
|
||||
case XmCR_ACTIVATE:
|
||||
type_event = wxEVENT_TYPE_TEXT_ENTER_COMMAND ;
|
||||
break;
|
||||
default:
|
||||
type_event = wxEVENT_TYPE_TEXT_COMMAND ;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
if (tw->InSetValue())
|
||||
return;
|
||||
|
Reference in New Issue
Block a user