]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/textctrl.h
1. wxImageHandler::DoCanRead() introduced to solve the virtual function name
[wxWidgets.git] / include / wx / gtk / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id: $Id$
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __GTKTEXTCTRLH__
12 #define __GTKTEXTCTRLH__
13
14 #ifdef __GNUG__
15 #pragma interface "textctrl.h"
16 #endif
17
18 //-----------------------------------------------------------------------------
19 // classes
20 //-----------------------------------------------------------------------------
21
22 class wxTextCtrl;
23
24 //-----------------------------------------------------------------------------
25 // wxTextCtrl
26 //-----------------------------------------------------------------------------
27
28 class wxTextCtrl: public wxTextCtrlBase
29 {
30 public:
31 wxTextCtrl();
32 wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
33 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
34 int style = 0, const wxValidator& validator = wxDefaultValidator,
35 const wxString &name = wxTextCtrlNameStr );
36 bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
37 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
38 int style = 0, const wxValidator& validator = wxDefaultValidator,
39 const wxString &name = wxTextCtrlNameStr );
40
41 // implement base class pure virtuals
42 // ----------------------------------
43
44 virtual wxString GetValue() const;
45 virtual void SetValue(const wxString& value);
46
47 virtual int GetLineLength(long lineNo) const;
48 virtual wxString GetLineText(long lineNo) const;
49 virtual int GetNumberOfLines() const;
50
51 virtual bool IsModified() const;
52 virtual bool IsEditable() const;
53
54 // If the return values from and to are the same, there is no selection.
55 virtual void GetSelection(long* from, long* to) const;
56
57 // operations
58 // ----------
59
60 // editing
61 virtual void Clear();
62 virtual void Replace(long from, long to, const wxString& value);
63 virtual void Remove(long from, long to);
64
65 // clears the dirty flag
66 virtual void DiscardEdits();
67
68 // writing text inserts it at the current position, appending always
69 // inserts it at the end
70 virtual void WriteText(const wxString& text);
71 virtual void AppendText(const wxString& text);
72
73 // translate between the position (which is just an index in the text ctrl
74 // considering all its contents as a single strings) and (x, y) coordinates
75 // which represent column and line.
76 virtual long XYToPosition(long x, long y) const;
77 virtual bool PositionToXY(long pos, long *x, long *y) const;
78
79 virtual void ShowPosition(long pos);
80
81 // Clipboard operations
82 virtual void Copy();
83 virtual void Cut();
84 virtual void Paste();
85
86 virtual bool CanCopy() const;
87 virtual bool CanCut() const;
88 virtual bool CanPaste() const;
89
90 // Undo/redo
91 virtual void Undo();
92 virtual void Redo();
93
94 virtual bool CanUndo() const;
95 virtual bool CanRedo() const;
96
97 // Insertion point
98 virtual void SetInsertionPoint(long pos);
99 virtual void SetInsertionPointEnd();
100 virtual long GetInsertionPoint() const;
101 virtual long GetLastPosition() const;
102
103 virtual void SetSelection(long from, long to);
104 virtual void SetEditable(bool editable);
105
106 // Implementation from now on
107 void OnDropFiles( wxDropFilesEvent &event );
108 void OnChar( wxKeyEvent &event );
109
110 void OnCut(wxCommandEvent& event);
111 void OnCopy(wxCommandEvent& event);
112 void OnPaste(wxCommandEvent& event);
113 void OnUndo(wxCommandEvent& event);
114 void OnRedo(wxCommandEvent& event);
115
116 void OnUpdateCut(wxUpdateUIEvent& event);
117 void OnUpdateCopy(wxUpdateUIEvent& event);
118 void OnUpdatePaste(wxUpdateUIEvent& event);
119 void OnUpdateUndo(wxUpdateUIEvent& event);
120 void OnUpdateRedo(wxUpdateUIEvent& event);
121
122 bool SetFont( const wxFont &font );
123 bool SetForegroundColour(const wxColour &colour);
124 bool SetBackgroundColour(const wxColour &colour);
125
126 GtkWidget* GetConnectWidget();
127 bool IsOwnGtkWindow( GdkWindow *window );
128 void ApplyWidgetStyle();
129 void CalculateScrollbar();
130 void OnInternalIdle();
131
132 void SetModified() { m_modified = TRUE; }
133
134 private:
135 bool m_modified;
136 GtkWidget *m_text;
137 GtkWidget *m_vScrollbar;
138 bool m_vScrollbarVisible;
139
140 DECLARE_EVENT_TABLE()
141 DECLARE_DYNAMIC_CLASS(wxTextCtrl);
142 };
143
144 #endif // __GTKTEXTCTRLH__
145