]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/qt/textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextCtrl class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
16 #pragma interface "textctrl.h"
19 #include "wx/control.h"
27 WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr
;
28 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
30 // Single-line text item
31 class WXDLLEXPORT wxTextCtrl
: public wxControl
33 // TODO Some platforms/compilers don't like inheritance from streambuf.
35 #if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__)
36 #define NO_TEXT_WINDOW_STREAM
39 #ifndef NO_TEXT_WINDOW_STREAM
44 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
50 inline wxTextCtrl(wxWindow
*parent
, wxWindowID id
,
51 const wxString
& value
= wxEmptyString
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
, long style
= 0,
54 const wxValidator
& validator
= wxDefaultValidator
,
55 const wxString
& name
= wxTextCtrlNameStr
)
56 #ifndef NO_TEXT_WINDOW_STREAM
60 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
63 bool Create(wxWindow
*parent
, wxWindowID id
,
64 const wxString
& value
= wxEmptyString
,
65 const wxPoint
& pos
= wxDefaultPosition
,
66 const wxSize
& size
= wxDefaultSize
, long style
= 0,
67 const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
& name
= wxTextCtrlNameStr
);
72 virtual wxString
GetValue() const ;
73 virtual void SetValue(const wxString
& value
);
75 virtual int GetLineLength(long lineNo
) const;
76 virtual wxString
GetLineText(long lineNo
) const;
77 virtual int GetNumberOfLines() const;
81 virtual void SetSize(int x
, int y
, int width
, int height
, int sizeFlags
= wxSIZE_AUTO
);
83 // Clipboard operations
88 virtual void SetInsertionPoint(long pos
);
89 virtual void SetInsertionPointEnd();
90 virtual long GetInsertionPoint() const ;
91 virtual long GetLastPosition() const ;
92 virtual void Replace(long from
, long to
, const wxString
& value
);
93 virtual void Remove(long from
, long to
);
94 virtual void SetSelection(long from
, long to
);
95 virtual void SetEditable(bool editable
);
97 // streambuf implementation
98 #ifndef NO_TEXT_WINDOW_STREAM
104 wxTextCtrl
& operator<<(const wxString
& s
);
105 wxTextCtrl
& operator<<(int i
);
106 wxTextCtrl
& operator<<(long i
);
107 wxTextCtrl
& operator<<(float f
);
108 wxTextCtrl
& operator<<(double d
);
109 wxTextCtrl
& operator<<(const char c
);
111 virtual bool LoadFile(const wxString
& file
);
112 virtual bool SaveFile(const wxString
& file
);
113 virtual void WriteText(const wxString
& text
);
114 virtual void AppendText(const wxString
& text
);
115 virtual void DiscardEdits();
116 virtual bool IsModified() const;
118 virtual long XYToPosition(long x
, long y
) const ;
119 virtual void PositionToXY(long pos
, long *x
, long *y
) const ;
120 virtual void ShowPosition(long pos
);
121 virtual void Clear();
125 void OnDropFiles(wxDropFilesEvent
& event
);
126 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
127 void OnEraseBackground(wxEraseEvent
& event
);
131 virtual void Command(wxCommandEvent
& event
);
136 DECLARE_EVENT_TABLE()