// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __X11TEXTCTRLH__
#define __X11TEXTCTRLH__
-#if defined(__GNUG__) && !defined(__APPLE__)
- #pragma interface "textctrl.h"
-#endif
+// Set to 1 to use wxUniv's implementation, 0
+// to use wxX11's.
+#define wxUSE_UNIV_TEXTCTRL 1
+
+#if wxUSE_UNIV_TEXTCTRL
+#include "wx/univ/textctrl.h"
+#else
#include "wx/scrolwin.h"
-#include "wx/dynarray.h"
-#include "wx/datetime.h"
+#include "wx/arrstr.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
-class wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
//-----------------------------------------------------------------------------
// helpers
// wxTextCtrl
//-----------------------------------------------------------------------------
-class wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper
+class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper
{
public:
wxTextCtrl() { Init(); }
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr);
+ virtual ~wxTextCtrl();
bool Create(wxWindow *parent,
wxWindowID id,
// implement base class pure virtuals
// ----------------------------------
- virtual wxString GetValue() const;
- virtual void SetValue(const wxString& value);
+ virtual void ChangeValue(const wxString &value);
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
// more readable flag testing methods
// ----------------------------------
- bool IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); }
bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
- bool WrapLines() const { return FALSE; }
+ bool WrapLines() const { return false; }
// If the return values from and to are the same, there is no selection.
virtual void GetSelection(long* from, long* to) const;
virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
- virtual bool CanRedo() const { return FALSE; }
+ virtual bool CanRedo() const { return false; }
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
- virtual bool Enable( bool enable = TRUE );
+ virtual bool Enable( bool enable = true );
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour);
- void SetModified() { m_modified = TRUE; }
-
- virtual void Freeze();
- virtual void Thaw();
+ void SetModified() { m_modified = true; }
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
void OnInternalIdle();
void RefreshLine( int n );
void RefreshDown( int n );
- void MoveCursor( int new_x, int new_y, bool shift = FALSE, bool centre = FALSE );
+ void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false );
void MyAdjustScrollbars();
protected:
virtual wxSize DoGetBestSize() const;
+ virtual void DoSetValue(const wxString& value, int flags = 0);
+
friend class wxSourceUndoStep;
wxSourceLineArray m_lines;
//-----------------------------------------------------------------------------
// cursor movement and also selection and delete operations
-#define wxACTION_TEXT_GOTO _T("goto") // to pos in numArg
-#define wxACTION_TEXT_FIRST _T("first") // go to pos 0
-#define wxACTION_TEXT_LAST _T("last") // go to last pos
-#define wxACTION_TEXT_HOME _T("home")
-#define wxACTION_TEXT_END _T("end")
-#define wxACTION_TEXT_LEFT _T("left")
-#define wxACTION_TEXT_RIGHT _T("right")
-#define wxACTION_TEXT_UP _T("up")
-#define wxACTION_TEXT_DOWN _T("down")
-#define wxACTION_TEXT_WORD_LEFT _T("wordleft")
-#define wxACTION_TEXT_WORD_RIGHT _T("wordright")
-#define wxACTION_TEXT_PAGE_UP _T("pageup")
-#define wxACTION_TEXT_PAGE_DOWN _T("pagedown")
+#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg
+#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0
+#define wxACTION_TEXT_LAST wxT("last") // go to last pos
+#define wxACTION_TEXT_HOME wxT("home")
+#define wxACTION_TEXT_END wxT("end")
+#define wxACTION_TEXT_LEFT wxT("left")
+#define wxACTION_TEXT_RIGHT wxT("right")
+#define wxACTION_TEXT_UP wxT("up")
+#define wxACTION_TEXT_DOWN wxT("down")
+#define wxACTION_TEXT_WORD_LEFT wxT("wordleft")
+#define wxACTION_TEXT_WORD_RIGHT wxT("wordright")
+#define wxACTION_TEXT_PAGE_UP wxT("pageup")
+#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown")
// clipboard operations
-#define wxACTION_TEXT_COPY _T("copy")
-#define wxACTION_TEXT_CUT _T("cut")
-#define wxACTION_TEXT_PASTE _T("paste")
+#define wxACTION_TEXT_COPY wxT("copy")
+#define wxACTION_TEXT_CUT wxT("cut")
+#define wxACTION_TEXT_PASTE wxT("paste")
// insert text at the cursor position: the text is in strArg of PerformAction
-#define wxACTION_TEXT_INSERT _T("insert")
+#define wxACTION_TEXT_INSERT wxT("insert")
// if the action starts with either of these prefixes and the rest of the
// string is one of the movement commands, it means to select/delete text from
// the current cursor position to the new one
-#define wxACTION_TEXT_PREFIX_SEL _T("sel")
-#define wxACTION_TEXT_PREFIX_DEL _T("del")
+#define wxACTION_TEXT_PREFIX_SEL wxT("sel")
+#define wxACTION_TEXT_PREFIX_DEL wxT("del")
// mouse selection
-#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel")
-#define wxACTION_TEXT_EXTEND_SEL _T("extendsel")
-#define wxACTION_TEXT_SEL_WORD _T("wordsel")
-#define wxACTION_TEXT_SEL_LINE _T("linesel")
+#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel")
+#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel")
+#define wxACTION_TEXT_SEL_WORD wxT("wordsel")
+#define wxACTION_TEXT_SEL_LINE wxT("linesel")
// undo or redo
-#define wxACTION_TEXT_UNDO _T("undo")
-#define wxACTION_TEXT_REDO _T("redo")
+#define wxACTION_TEXT_UNDO wxT("undo")
+#define wxACTION_TEXT_REDO wxT("redo")
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
-// wxTextPos is the position in the text
-typedef long wxTextPos;
-
-// wxTextCoord is the line or row number (which should have been unsigned but
-// is long for backwards compatibility)
-typedef long wxTextCoord;
-
-class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
+class WXDLLIMPEXP_CORE wxStdTextCtrlInputHandler : public wxStdInputHandler
{
public:
wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {}
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
- bool pressed) { return FALSE; }
- virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
- virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
- virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return FALSE; }
+ bool pressed) { return false; }
+ virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
+ virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
+ virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; }
protected:
// get the position of the mouse click
wxTextCtrl *m_winCapture;
};
-#endif // __GTKTEXTCTRLH__
+#endif
+// wxUSE_UNIV_TEXTCTRL
+
+#endif // __X11TEXTCTRLH__