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