]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
new y position transforms in dc. Def updates and add imagexpm.cpp to make.
[wxWidgets.git] / include / wx / os2 / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/17/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
14
15 class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
16 {
17 public:
18 // creation
19 // --------
20
21 wxTextCtrl();
22 wxTextCtrl( wxWindow* pParent
23 ,wxWindowID vId
24 ,const wxString& rsValue = wxEmptyString
25 ,const wxPoint& rPos = wxDefaultPosition
26 ,const wxSize& rSize = wxDefaultSize
27 ,long lStyle = 0
28 #if wxUSE_VALIDATORS
29 ,const wxValidator& rValidator = wxDefaultValidator
30 #endif
31 ,const wxString& rsName = wxTextCtrlNameStr
32 )
33 {
34 Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName);
35 }
36
37 bool Create( wxWindow* pParent
38 ,wxWindowID vId
39 ,const wxString& rsValue = wxEmptyString
40 ,const wxPoint& rPos = wxDefaultPosition
41 ,const wxSize& rSize = wxDefaultSize
42 ,long lStyle = 0
43 #if wxUSE_VALIDATORS
44 ,const wxValidator& rValidator = wxDefaultValidator
45 #endif
46 ,const wxString& rsName = wxTextCtrlNameStr
47 );
48
49 // implement base class pure virtuals
50 // ----------------------------------
51
52 virtual wxString GetValue(void) const;
53 virtual void SetValue(const wxString& rsValue);
54
55 virtual int GetLineLength(long nLineNo) const;
56 virtual wxString GetLineText(long nLineNo) const;
57 virtual int GetNumberOfLines(void) const;
58
59 virtual bool IsModified(void) const;
60 virtual bool IsEditable(void) const;
61
62 // If the return values from and to are the same, there is no selection.
63 virtual void GetSelection( long* pFrom
64 ,long* pTo
65 ) const;
66
67 // operations
68 // ----------
69
70 // editing
71 virtual void Clear(void);
72 virtual void Replace( long lFrom
73 ,long lTo
74 ,const wxString& rsValue
75 );
76 virtual void Remove( long lFrom
77 ,long lTo
78 );
79
80 // load the controls contents from the file
81 virtual bool LoadFile(const wxString& rsFile);
82
83 // clears the dirty flag
84 virtual void DiscardEdits(void);
85
86 // writing text inserts it at the current position, appending always
87 // inserts it at the end
88 virtual void WriteText(const wxString& rsText);
89 virtual void AppendText(const wxString& rsText);
90
91 // translate between the position (which is just an index in the text ctrl
92 // considering all its contents as a single strings) and (x, y) coordinates
93 // which represent column and line.
94 virtual long XYToPosition( long lX
95 ,long lY
96 ) const;
97 virtual bool PositionToXY( long lPos
98 ,long* plX
99 ,long* plY
100 ) const;
101
102 virtual void ShowPosition(long lPos);
103
104 // Clipboard operations
105 virtual void Copy(void);
106 virtual void Cut(void);
107 virtual void Paste(void);
108
109 virtual bool CanCopy(void) const;
110 virtual bool CanCut(void) const;
111 virtual bool CanPaste(void) const;
112
113 // Undo/redo
114 virtual void Undo(void);
115 virtual void Redo(void);
116
117 virtual bool CanUndo(void) const;
118 virtual bool CanRedo(void) const;
119
120 // Insertion point
121 virtual void SetInsertionPoint(long lPos);
122 virtual void SetInsertionPointEnd(void);
123 virtual long GetInsertionPoint(void) const;
124 virtual long GetLastPosition(void) const;
125
126 virtual void SetSelection( long lFrom
127 ,long lTo
128 );
129 virtual void SetEditable(bool bEditable);
130
131 //
132 // Implementation from now on
133 // --------------------------
134 //
135 virtual void Command(wxCommandEvent& rEvent);
136 virtual bool OS2Command( WXUINT uParam
137 ,WXWORD wId
138 );
139
140 virtual WXHBRUSH OnCtlColor( WXHDC hDC
141 ,WXHWND pWnd
142 ,WXUINT nCtlColor
143 ,WXUINT message
144 ,WXWPARAM wParam
145 ,WXLPARAM lParam
146 );
147
148 virtual bool SetBackgroundColour(const wxColour& colour);
149 virtual bool SetForegroundColour(const wxColour& colour);
150
151 virtual void AdoptAttributesFromHWND(void);
152 virtual void SetupColours(void);
153
154 virtual bool AcceptsFocus(void) const;
155
156 // callbacks
157 void OnDropFiles(wxDropFilesEvent& rEvent);
158 void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
159
160 void OnCut(wxCommandEvent& rEvent);
161 void OnCopy(wxCommandEvent& rEvent);
162 void OnPaste(wxCommandEvent& rEvent);
163 void OnUndo(wxCommandEvent& rEvent);
164 void OnRedo(wxCommandEvent& rEvent);
165
166 void OnUpdateCut(wxUpdateUIEvent& rEvent);
167 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
168 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
169 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
170 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
171
172 inline bool IsMLE(void) {return m_bIsMLE;}
173 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
174
175 protected:
176 //
177 // call this to increase the size limit (will do nothing if the current
178 // limit is big enough)
179 //
180 void AdjustSpaceLimit(void);
181 virtual wxSize DoGetBestSize(void) const;
182
183 private:
184 bool m_bIsMLE;
185 DECLARE_EVENT_TABLE()
186 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
187 }; // end of CLASS wxTextCtrl
188
189 #endif
190 // _WX_TEXTCTRL_H_