]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
b4408f36e9622f0189d655f4c23fe354c919445d
[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 wxTextCtrl();
19 wxTextCtrl( wxWindow* pParent
20 ,wxWindowID vId
21 ,const wxString& rsValue = wxEmptyString
22 ,const wxPoint& rPos = wxDefaultPosition
23 ,const wxSize& rSize = wxDefaultSize
24 ,long lStyle = 0
25 ,const wxValidator& rValidator = wxDefaultValidator
26 ,const wxString& rsName = wxTextCtrlNameStr
27 )
28 {
29 Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName);
30 }
31 ~wxTextCtrl();
32
33 bool Create( wxWindow* pParent
34 ,wxWindowID vId
35 ,const wxString& rsValue = wxEmptyString
36 ,const wxPoint& rPos = wxDefaultPosition
37 ,const wxSize& rSize = wxDefaultSize
38 ,long lStyle = 0
39 ,const wxValidator& rValidator = wxDefaultValidator
40 ,const wxString& rsName = wxTextCtrlNameStr
41 );
42
43 //
44 // Implement base class pure virtuals
45 // ----------------------------------
46 //
47 virtual wxString GetValue(void) const;
48 virtual void SetValue(const wxString& rsValue);
49
50 virtual int GetLineLength(long nLineNo) const;
51 virtual wxString GetLineText(long nLineNo) const;
52 virtual int GetNumberOfLines(void) const;
53
54 virtual bool IsModified(void) const;
55 virtual bool IsEditable(void) const;
56
57 virtual void GetSelection( long* pFrom
58 ,long* pTo
59 ) const;
60 //
61 // Operations
62 // ----------
63 //
64 virtual void Clear(void);
65 virtual void Replace( long lFrom
66 ,long lTo
67 ,const wxString& rsValue
68 );
69 virtual void Remove( long lFrom
70 ,long lTo
71 );
72
73 virtual bool LoadFile(const wxString& rsFile);
74
75 virtual void DiscardEdits(void);
76
77 virtual void WriteText(const wxString& rsText);
78 virtual void AppendText(const wxString& rsText);
79 virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
80
81 virtual bool SetStyle( long lStart
82 ,long lEnd
83 ,const wxTextAttr& rStyle
84 );
85 virtual long XYToPosition( long lX
86 ,long lY
87 ) const;
88 virtual bool PositionToXY( long lPos
89 ,long* plX
90 ,long* plY
91 ) const;
92
93 virtual void ShowPosition(long lPos);
94
95 virtual void Copy(void);
96 virtual void Cut(void);
97 virtual void Paste(void);
98
99 virtual bool CanCopy(void) const;
100 virtual bool CanCut(void) const;
101 virtual bool CanPaste(void) const;
102
103 virtual void Undo(void);
104 virtual void Redo(void);
105
106 virtual bool CanUndo(void) const;
107 virtual bool CanRedo(void) const;
108
109 virtual void SetInsertionPoint(long lPos);
110 virtual void SetInsertionPointEnd(void);
111 virtual long GetInsertionPoint(void) const;
112 virtual long GetLastPosition(void) const;
113
114 virtual void SetSelection( long lFrom
115 ,long lTo
116 );
117 virtual void SetEditable(bool bEditable);
118 virtual void SetWindowStyleFlag(long lStyle);
119
120 //
121 // Implementation from now on
122 // --------------------------
123 //
124 virtual void Command(wxCommandEvent& rEvent);
125 virtual bool OS2Command( WXUINT uParam
126 ,WXWORD wId
127 );
128
129 virtual WXHBRUSH OnCtlColor( WXHDC hDC
130 ,WXHWND pWnd
131 ,WXUINT nCtlColor
132 ,WXUINT message
133 ,WXWPARAM wParam
134 ,WXLPARAM lParam
135 );
136
137 virtual bool SetBackgroundColour(const wxColour& colour);
138 virtual bool SetForegroundColour(const wxColour& colour);
139
140 virtual void AdoptAttributesFromHWND(void);
141 virtual void SetupColours(void);
142
143 virtual bool AcceptsFocus(void) const;
144
145 // callbacks
146 void OnDropFiles(wxDropFilesEvent& rEvent);
147 void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
148
149 void OnCut(wxCommandEvent& rEvent);
150 void OnCopy(wxCommandEvent& rEvent);
151 void OnPaste(wxCommandEvent& rEvent);
152 void OnUndo(wxCommandEvent& rEvent);
153 void OnRedo(wxCommandEvent& rEvent);
154 void OnDelete(wxCommandEvent& rEvent);
155 void OnSelectAll(wxCommandEvent& rEvent);
156
157 void OnUpdateCut(wxUpdateUIEvent& rEvent);
158 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
159 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
160 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
161 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
162 void OnUpdateDelete(wxUpdateUIEvent& rEvent);
163 void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
164
165 inline bool IsMLE(void) {return m_bIsMLE;}
166 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
167
168 protected:
169 //
170 // call this to increase the size limit (will do nothing if the current
171 // limit is big enough)
172 //
173 void AdjustSpaceLimit(void);
174 virtual wxSize DoGetBestSize(void) const;
175 virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
176
177 virtual WXDWORD OS2GetStyle( long lStyle
178 ,WXDWORD* dwExstyle
179 ) const;
180 private:
181 bool m_bIsMLE;
182 DECLARE_EVENT_TABLE()
183 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
184 }; // end of CLASS wxTextCtrl
185
186 #endif
187 // _WX_TEXTCTRL_H_