Skip to content
Newer
Older
100644 291 lines (240 sloc) 10.5 KB
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
21 ***********************************************************************/
22
23 /// Textfield styles
24 enum {
25 TEXTFIELD_PASSWD = 0x00080000, /// Password mode
26 TEXTFIELD_INTEGER = 0x00100000, /// Integer mode
27 TEXTFIELD_REAL = 0x00200000, /// Real mode
28 TEXTFIELD_READONLY = 0x00400000, /// NOT editable
29 TEXTFIELD_ENTER_ONLY = 0x00800000, /// Only callback when enter hit
30 TEXTFIELD_LIMITED = 0x01000000, /// Limit entry to given number of columns
31 TEXTFIELD_OVERSTRIKE = 0x02000000, /// Overstrike mode
32 TEXTFIELD_AUTOGRAY = 0x04000000, /// Automatically gray out text field when not updated
33 TEXTFIELD_AUTOHIDE = 0x08000000, /// Automatically hide text field when not updated
34 TEXTFIELD_NORMAL = FRAME_SUNKEN|FRAME_THICK
35 };
36
37 %rename("overstrike=") FXTextField::setOverstrike(FXbool);
38 %rename("overstrike?") FXTextField::isOverstrike() const;
39
40 /**
41 * A Text field is a single-line text entry widget.
42 * The text field widget supports clipboard for cut-and-paste
43 * operations.
44 * The text field also sends SEL_COMMAND when the focus moves to another control.
45 * TEXTFIELD_ENTER_ONLY can be passed to suppress this feature. Typically, this
46 * flag is used in dialogs that close when ENTER is hit in a text field.
47 */
48 class FXTextField : public FXFrame {
49 public:
50 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
51 long onUpdate(FXObject*,FXSelector,void* PTR_IGNORE);
52 long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
53 long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
54 long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
55 long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
56 long onMiddleBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
57 long onMiddleBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
58 long onVerify(FXObject*,FXSelector,void* PTR_CSTRING);
59 long onMotion(FXObject*,FXSelector,void* PTR_EVENT);
60 long onSelectionLost(FXObject*,FXSelector,void* PTR_EVENT);
61 long onSelectionGained(FXObject*,FXSelector,void* PTR_EVENT);
62 long onSelectionRequest(FXObject*,FXSelector,void* ptr);
63 long onClipboardLost(FXObject*,FXSelector,void* PTR_EVENT);
64 long onClipboardGained(FXObject*,FXSelector,void* PTR_EVENT);
65 long onClipboardRequest(FXObject*,FXSelector,void* PTR_EVENT);
66 long onFocusSelf(FXObject*,FXSelector,void* PTR_EVENT);
67 long onFocusIn(FXObject*,FXSelector,void* PTR_EVENT);
68 long onFocusOut(FXObject*,FXSelector,void* PTR_EVENT);
69 long onBlink(FXObject*,FXSelector,void* PTR_IGNORE);
70 long onAutoScroll(FXObject*,FXSelector,void* PTR_IGNORE);
71 long onCmdSetValue(FXObject*,FXSelector,void* PTR_CSTRING);
72 long onCmdSetIntValue(FXObject*,FXSelector,void* PTR_PINT);
73 long onCmdSetRealValue(FXObject*,FXSelector,void* PTR_PDOUBLE);
74 long onCmdSetStringValue(FXObject*,FXSelector,void* PTR_STRING);
75 long onCmdGetIntValue(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
76 long onCmdGetRealValue(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
77 long onCmdGetStringValue(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
78 long onCmdCursorHome(FXObject*,FXSelector,void* PTR_IGNORE);
79 long onCmdCursorEnd(FXObject*,FXSelector,void* PTR_IGNORE);
80 long onCmdCursorRight(FXObject*,FXSelector,void* PTR_IGNORE);
81 long onCmdCursorLeft(FXObject*,FXSelector,void* PTR_IGNORE);
82 long onCmdCursorWordLeft(FXObject*,FXSelector,void* PTR_IGNORE);
83 long onCmdCursorWordRight(FXObject*,FXSelector,void* PTR_IGNORE);
84 long onCmdCursorWordStart(FXObject*,FXSelector,void* PTR_IGNORE);
85 long onCmdCursorWordEnd(FXObject*,FXSelector,void* PTR_IGNORE);
86 long onCmdMark(FXObject*,FXSelector,void* PTR_IGNORE);
87 long onCmdExtend(FXObject*,FXSelector,void* PTR_IGNORE);
88 long onCmdSelectAll(FXObject*,FXSelector,void* PTR_IGNORE);
89 long onCmdDeselectAll(FXObject*,FXSelector,void* PTR_IGNORE);
90 long onCmdCutSel(FXObject*,FXSelector,void* PTR_IGNORE);
91 long onCmdCopySel(FXObject*,FXSelector,void* PTR_IGNORE);
92 long onCmdPasteSel(FXObject*,FXSelector,void* PTR_IGNORE);
93 long onCmdPasteMiddle(FXObject*,FXSelector,void* PTR_IGNORE);
94 long onCmdDeleteSel(FXObject*,FXSelector,void* PTR_IGNORE);
95 long onCmdDeleteAll(FXObject*,FXSelector,void* PTR_IGNORE);
96 long onCmdOverstString(FXObject*,FXSelector,void* PTR_CHAR);
97 long onCmdInsertString(FXObject*,FXSelector,void* PTR_CSTRING);
98 long onCmdBackspace(FXObject*,FXSelector,void* PTR_IGNORE);
99 long onCmdDelete(FXObject*,FXSelector,void* PTR_IGNORE);
100 long onCmdToggleEditable(FXObject*,FXSelector,void* PTR_IGNORE);
101 long onUpdToggleEditable(FXObject*,FXSelector,void* PTR_IGNORE);
102 long onCmdToggleOverstrike(FXObject*,FXSelector,void* PTR_IGNORE);
103 long onUpdToggleOverstrike(FXObject*,FXSelector,void* PTR_IGNORE);
104 long onUpdHaveSelection(FXObject*,FXSelector,void* PTR_IGNORE);
105 long onUpdSelectAll(FXObject*,FXSelector,void* PTR_IGNORE);
106 long onCmdSetHelp(FXObject*,FXSelector,void* PTR_STRING);
107 long onCmdGetHelp(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
108 long onCmdSetTip(FXObject*,FXSelector,void* PTR_STRING);
109 long onCmdGetTip(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
110 long onQueryHelp(FXObject*,FXSelector,void* PTR_IGNORE);
111 long onQueryTip(FXObject*,FXSelector,void* PTR_IGNORE);
112 public:
113
114 /// Default text delimiters
115 static const FXchar textDelimiters[];
116
117 public:
118
119 enum{
120 ID_CURSOR_HOME=FXFrame::ID_LAST,
121 ID_CURSOR_END,
122 ID_CURSOR_RIGHT,
123 ID_CURSOR_LEFT,
124 ID_CURSOR_WORD_LEFT,
125 ID_CURSOR_WORD_RIGHT,
126 ID_CURSOR_WORD_START,
127 ID_CURSOR_WORD_END,
128 ID_MARK,
129 ID_EXTEND,
130 ID_SELECT_ALL,
131 ID_DESELECT_ALL,
132 ID_CUT_SEL,
133 ID_COPY_SEL,
134 ID_PASTE_SEL,
135 ID_DELETE_SEL,
136 ID_DELETE_ALL,
137 ID_OVERST_STRING,
138 ID_INSERT_STRING,
139 ID_BACKSPACE,
140 ID_DELETE,
141 ID_TOGGLE_EDITABLE,
142 ID_TOGGLE_OVERSTRIKE,
143 ID_BLINK,
144 ID_LAST
145 };
146 public:
147
148 /// Construct text field wide enough to display ncols columns
149 %extend {
150 FXTextField(FXComposite* p,FXint ncols,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=TEXTFIELD_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD){
151 return new FXRbTextField(p,ncols,tgt,sel,opts,x,y,w,h,pl,pr,pt,pb);
152 }
153 }
154
bea4cad @larskanis Strip all whitespaces on line endings
authored
155 /// Change text field editability
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
156 void setEditable(FXbool edit=TRUE);
157
158 /// Return TRUE if text field may be edited
159 FXbool isEditable() const;
160
161 /// Set overstrike mode
162 void setOverstrike(FXbool over=TRUE);
163
164 /// Return TRUE if overstrike mode in effect
165 FXbool isOverstrike() const;
166
167 /// Set cursor position
168 void setCursorPos(FXint pos);
169
170 /// Return cursor position
171 FXint getCursorPos() const;
172
173 /// Change anchor position
174 void setAnchorPos(FXint pos);
175
176 /// Return anchor position
177 FXint getAnchorPos() const;
178
179 /// Set the text for this label
180 void setText(const FXString& text,FXbool notify=FALSE);
181
182 /// Get the text for this label
183 FXString getText() const;
184
185 /// Set the text font
186 void setFont(FXFont* fnt);
187
188 /// Get the text font
189 FXFont* getFont() const;
190
191 /// Change text color
192 void setTextColor(FXColor clr);
193
194 /// Return text color
195 FXColor getTextColor() const;
196
197 /// Change selected background color
198 void setSelBackColor(FXColor clr);
199
200 /// Return selected background color
201 FXColor getSelBackColor() const;
202
203 /// Change selected text color
204 void setSelTextColor(FXColor clr);
205
206 /// Return selected text color
207 FXColor getSelTextColor() const;
208
209 /// Changes the cursor color
210 void setCursorColor(FXColor clr);
211
212 /// Return the cursor color
213 FXColor getCursorColor() const;
214
215 /**
216 * Change the default width of the text field in terms of a number
217 * of columns times the width of the numeral '8'.
218 */
219 void setNumColumns(FXint cols);
220
221 /// Return number of columns
222 FXint getNumColumns() const;
223
224 /**
225 * Change text justification mode. The justify mode is a combination of
226 * horizontal justification (JUSTIFY_LEFT, JUSTIFY_RIGHT, or JUSTIFY_CENTER_X),
227 * and vertical justification (JUSTIFY_TOP, JUSTIFY_BOTTOM, JUSTIFY_CENTER_Y).
228 * Note that JUSTIFY_CENTER_X can not be set from the constructor since by
229 * default text fields are left-justified.
230 */
231 void setJustify(FXuint mode);
232
233 /// Return text justification mode
234 FXuint getJustify() const;
235
236 /// Change word delimiters
237 void setDelimiters(const FXchar* delims=textDelimiters);
238
239 /// Return word delimiters
240 const FXchar* getDelimiters() const;
241
242 /// Set the status line help text for this label
243 void setHelpText(const FXString& text);
244
245 /// Get the status line help text for this label
246 const FXString& getHelpText() const;
247
248 /// Set the tool tip message for this text field
249 void setTipText(const FXString& text);
250
251 /// Get the tool tip message for this text field
252 const FXString& getTipText() const;
253
254 /// Change text style
255 void setTextStyle(FXuint style);
256
257 /// Return text style
258 FXuint getTextStyle() const;
259
260 /// Select all text
261 FXbool selectAll();
262
263 /// Select len characters starting at given position pos
264 FXbool setSelection(FXint pos,FXint len);
265
266 /// Extend the selection from the anchor to the given position
267 FXbool extendSelection(FXint pos);
268
269 /// Unselect the text
270 FXbool killSelection();
271
272 /// Return TRUE if position pos is selected
273 FXbool isPosSelected(FXint pos) const;
274
275 /// Return TRUE if position is fully visible
276 FXbool isPosVisible(FXint pos) const;
277
278 /// Scroll text to make the given position visible
279 void makePositionVisible(FXint pos);
280
281 /// Destructor
282 virtual ~FXTextField();
283 };
284
285
286 DECLARE_FXOBJECT_VIRTUALS(FXTextField)
287 DECLARE_FXID_VIRTUALS(FXTextField)
288 DECLARE_FXDRAWABLE_VIRTUALS(FXTextField)
289 DECLARE_FXWINDOW_VIRTUALS(FXTextField)
290
Something went wrong with that request. Please try again.