]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/textctrl.h
add IsOk() to all classes having Ok() method (patch 1570985)
[wxWidgets.git] / include / wx / motif / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
14
15 // Single-line text item
16 class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
17 {
18 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
19
20 public:
21 // creation
22 // --------
23 wxTextCtrl();
24 wxTextCtrl(wxWindow *parent,
25 wxWindowID id,
26 const wxString& value = wxEmptyString,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxTextCtrlNameStr)
32 {
33 Create(parent, id, value, pos, size, style, validator, name);
34 }
35
36 bool Create(wxWindow *parent, wxWindowID id,
37 const wxString& value = wxEmptyString,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize, long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxTextCtrlNameStr);
42
43 // accessors
44 // ---------
45 virtual wxString GetValue() const;
46 virtual void SetValue(const wxString& value)
47 { ChangeValue(value); SendTextUpdatedEvent(); }
48
49 virtual void ChangeValue(const wxString &value);
50
51 virtual int GetLineLength(long lineNo) const;
52 virtual wxString GetLineText(long lineNo) const;
53 virtual int GetNumberOfLines() const;
54
55 // operations
56 // ----------
57
58 // Clipboard operations
59 virtual void Copy();
60 virtual void Cut();
61 virtual void Paste();
62 virtual bool CanCopy() const;
63 virtual bool CanCut() const;
64 virtual bool CanPaste() const;
65
66 // Undo/redo
67 virtual void Undo();
68 virtual void Redo();
69
70 virtual bool CanUndo() const;
71 virtual bool CanRedo() const;
72
73 virtual void SetInsertionPoint(long pos);
74 virtual void SetInsertionPointEnd();
75 virtual long GetInsertionPoint() const;
76 virtual wxTextPos GetLastPosition() const;
77 virtual void Replace(long from, long to, const wxString& value);
78 virtual void Remove(long from, long to);
79 virtual void SetSelection(long from, long to);
80 virtual void SetEditable(bool editable);
81 // If the return values from and to are the same, there is no
82 // selection.
83 virtual void GetSelection(long* from, long* to) const;
84 virtual bool IsEditable() const ;
85
86 virtual void WriteText(const wxString& text);
87 virtual void AppendText(const wxString& text);
88 virtual void MarkDirty();
89 virtual void DiscardEdits();
90 virtual bool IsModified() const;
91
92 virtual long XYToPosition(long x, long y) const;
93 virtual bool PositionToXY(long pos, long *x, long *y) const;
94 virtual void ShowPosition(long pos);
95 virtual void Clear();
96
97 // callbacks
98 // ---------
99 void OnDropFiles(wxDropFilesEvent& event);
100 void OnChar(wxKeyEvent& event);
101 // void OnEraseBackground(wxEraseEvent& event);
102
103 void OnCut(wxCommandEvent& event);
104 void OnCopy(wxCommandEvent& event);
105 void OnPaste(wxCommandEvent& event);
106 void OnUndo(wxCommandEvent& event);
107 void OnRedo(wxCommandEvent& event);
108
109 void OnUpdateCut(wxUpdateUIEvent& event);
110 void OnUpdateCopy(wxUpdateUIEvent& event);
111 void OnUpdatePaste(wxUpdateUIEvent& event);
112 void OnUpdateUndo(wxUpdateUIEvent& event);
113 void OnUpdateRedo(wxUpdateUIEvent& event);
114
115 virtual void Command(wxCommandEvent& event);
116
117 // implementation from here to the end
118 // -----------------------------------
119 virtual void ChangeFont(bool keepOriginalSize = true);
120 virtual void ChangeBackgroundColour();
121 virtual void ChangeForegroundColour();
122 void SetModified(bool mod) { m_modified = mod; }
123 virtual WXWidget GetTopWidget() const;
124
125 // send the CHAR and TEXT_UPDATED events
126 void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
127 long keycode);
128
129 protected:
130 wxString m_fileName;
131
132 virtual wxSize DoGetBestSize() const;
133 public:
134 // Motif-specific
135 void* m_tempCallbackStruct;
136 bool m_modified;
137 wxString m_value; // Required for password text controls
138
139 // Did we call wxTextCtrl::OnChar? If so, generate a command event.
140 bool m_processedDefault;
141
142 private:
143 DECLARE_EVENT_TABLE()
144 };
145
146 #endif
147 // _WX_TEXTCTRL_H_