1. OnNcPaint() fixed, seems to work
2. start of wxTextCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
176
include/wx/univ/textctrl.h
Normal file
176
include/wx/univ/textctrl.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/textctrl.h
|
||||
// Purpose: wxTextCtrl class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 15.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_TEXTCTRL_H_
|
||||
#define _WX_UNIV_TEXTCTRL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "univtextctrl.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxCaret;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
|
||||
wxTextCtrl() { Init(); }
|
||||
|
||||
wxTextCtrl(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, value, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr);
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual wxString GetValue() const;
|
||||
virtual void SetValue(const wxString& value);
|
||||
|
||||
virtual int GetLineLength(long lineNo) const;
|
||||
virtual wxString GetLineText(long lineNo) const;
|
||||
virtual int GetNumberOfLines() const;
|
||||
|
||||
virtual bool IsModified() const;
|
||||
virtual bool IsEditable() const;
|
||||
|
||||
// If the return values from and to are the same, there is no selection.
|
||||
virtual void GetSelection(long* from, long* to) const;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// editing
|
||||
virtual void Clear();
|
||||
virtual void Replace(long from, long to, const wxString& value);
|
||||
virtual void Remove(long from, long to);
|
||||
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits();
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
virtual void AppendText(const wxString& text);
|
||||
|
||||
// translate between the position (which is just an index in the text ctrl
|
||||
// considering all its contents as a single strings) and (x, y) coordinates
|
||||
// which represent column and line.
|
||||
virtual long XYToPosition(long x, long y) const;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const;
|
||||
|
||||
virtual void ShowPosition(long pos);
|
||||
|
||||
// Clipboard operations
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
|
||||
// Undo/redo
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
// Insertion point
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual long GetLastPosition() const;
|
||||
|
||||
virtual void SetSelection(long from, long to);
|
||||
virtual void SetEditable(bool editable);
|
||||
|
||||
// wxUniv-specific methods
|
||||
// -----------------------
|
||||
|
||||
// caret stuff
|
||||
virtual void ShowCaret(bool show = TRUE);
|
||||
void HideCaret() { ShowCaret(FALSE); }
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// set the right colours
|
||||
virtual bool IsContainerWindow() const { return TRUE; }
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; }
|
||||
|
||||
protected:
|
||||
// draw the text
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
// calc the size from the text extent
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// input support
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
virtual wxString GetInputHandlerType() const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// is this a single-line control?
|
||||
bool IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); }
|
||||
|
||||
private:
|
||||
// the value (may be only part of it for the multiline controls)
|
||||
wxString m_value;
|
||||
|
||||
// current position
|
||||
long m_curPos,
|
||||
m_curLine,
|
||||
m_curRow;
|
||||
|
||||
// selection
|
||||
long m_selStart,
|
||||
m_selEnd;
|
||||
|
||||
// flags
|
||||
bool m_isModified:1,
|
||||
m_isEditable:1;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TEXTCTRL_H_
|
||||
|
Reference in New Issue
Block a user