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