Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXTextFieldIcon.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2006-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18//
19/****************************************************************************/
20
21#pragma once
22#include <config.h>
23
24#include "fxheader.h"
25
26
27// ===========================================================================
28// class definitions
29// ===========================================================================
30
31class MFXTextFieldIcon : public FXFrame {
33 FXDECLARE(MFXTextFieldIcon)
34
35public:
37 MFXTextFieldIcon(FXComposite* p, FXint ncols, FXIcon* ic, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = TEXTFIELD_NORMAL,
38 FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
39 FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
40
42 virtual ~MFXTextFieldIcon();
43
45 virtual void create();
46
48 virtual void layout();
49
51 virtual void enable();
52
54 virtual void disable();
55
57 virtual FXint getDefaultWidth();
58
60 virtual FXint getDefaultHeight();
61
63 virtual bool canFocus() const;
64
66 virtual void setFocus();
67
69 virtual void killFocus();
70
72 void setEditable(FXbool edit = TRUE);
73
75 FXbool isEditable() const;
76
78 void setOverstrike(FXbool over = TRUE);
79
81 FXbool isOverstrike() const;
82
84 void setCursorPos(FXint pos);
85
87 FXint getCursorPos() const {
88 return cursor;
89 }
90
92 void setAnchorPos(FXint pos);
93
95 FXint getAnchorPos() const {
96 return anchor;
97 }
98
100 void setText(const FXString& text, FXbool notify = FALSE);
101
103 void setIcon(FXIcon* ic);
104
106 FXString getText() const {
107 return contents;
108 }
109
111 void setFont(FXFont* fnt);
112
114 FXFont* getFont() const {
115 return font;
116 }
117
119 void setTextColor(FXColor clr);
120
122 FXColor getTextColor() const {
123 return textColor;
124 }
125
127 void setSelBackColor(FXColor clr);
128
130 FXColor getSelBackColor() const {
131 return selbackColor;
132 }
133
135 void setSelTextColor(FXColor clr);
136
138 FXColor getSelTextColor() const {
139 return seltextColor;
140 }
141
143 void setCursorColor(FXColor clr);
144
146 FXColor getCursorColor() const {
147 return cursorColor;
148 }
149
151 void setNumColumns(FXint cols);
152
154 FXint getNumColumns() const {
155 return columns;
156 }
157
159 void setJustify(FXuint mode);
160
162 FXuint getJustify() const;
163
165 void setDelimiters(const FXchar* delims = FXTextField::textDelimiters) {
166 delimiters = delims;
167 }
168
170 const FXchar* getDelimiters() const {
171 return delimiters;
172 }
173
175 void setHelpText(const FXString& text) {
176 help = text;
177 }
178
180 const FXString& getHelpText() const {
181 return help;
182 }
183
185 void setTipText(const FXString& text) {
186 tip = text;
187 }
188
190 const FXString& getTipText() const {
191 return tip;
192 }
193
195 void setTextStyle(FXuint style);
196
198 FXuint getTextStyle() const;
199
201 FXbool selectAll();
202
204 FXbool setSelection(FXint pos, FXint len);
205
207 FXbool extendSelection(FXint pos);
208
210 FXbool killSelection();
211
213 FXbool isPosSelected(FXint pos) const;
214
216 FXbool isPosVisible(FXint pos) const;
217
219 void makePositionVisible(FXint pos);
220
222 virtual void save(FXStream& store) const;
223
225 virtual void load(FXStream& store);
226
229
230 long onPaint(FXObject*, FXSelector, void*);
231 long onUpdate(FXObject*, FXSelector, void*);
232 long onKeyPress(FXObject*, FXSelector, void*);
233 long onKeyRelease(FXObject*, FXSelector, void*);
234 long onLeftBtnPress(FXObject*, FXSelector, void*);
235 long onLeftBtnRelease(FXObject*, FXSelector, void*);
236 long onMiddleBtnPress(FXObject*, FXSelector, void*);
237 long onMiddleBtnRelease(FXObject*, FXSelector, void*);
238 long onVerify(FXObject*, FXSelector, void*);
239 long onMotion(FXObject*, FXSelector, void*);
240 long onSelectionLost(FXObject*, FXSelector, void*);
241 long onSelectionGained(FXObject*, FXSelector, void*);
242 long onSelectionRequest(FXObject*, FXSelector, void* ptr);
243 long onClipboardLost(FXObject*, FXSelector, void*);
244 long onClipboardGained(FXObject*, FXSelector, void*);
245 long onClipboardRequest(FXObject*, FXSelector, void*);
246 long onFocusSelf(FXObject*, FXSelector, void*);
247 long onFocusIn(FXObject*, FXSelector, void*);
248 long onFocusOut(FXObject*, FXSelector, void*);
249 long onBlink(FXObject*, FXSelector, void*);
250 long onAutoScroll(FXObject*, FXSelector, void*);
251 long onCmdSetValue(FXObject*, FXSelector, void*);
252 long onCmdSetIntValue(FXObject*, FXSelector, void*);
253 long onCmdSetRealValue(FXObject*, FXSelector, void*);
254 long onCmdSetStringValue(FXObject*, FXSelector, void*);
255 long onCmdGetIntValue(FXObject*, FXSelector, void*);
256 long onCmdGetRealValue(FXObject*, FXSelector, void*);
257 long onCmdGetStringValue(FXObject*, FXSelector, void*);
258 long onCmdCursorHome(FXObject*, FXSelector, void*);
259 long onCmdCursorEnd(FXObject*, FXSelector, void*);
260 long onCmdCursorRight(FXObject*, FXSelector, void*);
261 long onCmdCursorLeft(FXObject*, FXSelector, void*);
262 long onCmdCursorWordLeft(FXObject*, FXSelector, void*);
263 long onCmdCursorWordRight(FXObject*, FXSelector, void*);
264 long onCmdCursorWordStart(FXObject*, FXSelector, void*);
265 long onCmdCursorWordEnd(FXObject*, FXSelector, void*);
266 long onCmdMark(FXObject*, FXSelector, void*);
267 long onCmdExtend(FXObject*, FXSelector, void*);
268 long onCmdSelectAll(FXObject*, FXSelector, void*);
269 long onCmdDeselectAll(FXObject*, FXSelector, void*);
270 long onCmdCutSel(FXObject*, FXSelector, void*);
271 long onCmdCopySel(FXObject*, FXSelector, void*);
272 long onCmdPasteSel(FXObject*, FXSelector, void*);
273 long onCmdPasteMiddle(FXObject*, FXSelector, void*);
274 long onCmdDeleteSel(FXObject*, FXSelector, void*);
275 long onCmdDeleteAll(FXObject*, FXSelector, void*);
276 long onCmdOverstString(FXObject*, FXSelector, void*);
277 long onCmdInsertString(FXObject*, FXSelector, void*);
278 long onCmdBackspace(FXObject*, FXSelector, void*);
279 long onCmdDelete(FXObject*, FXSelector, void*);
280 long onCmdToggleEditable(FXObject*, FXSelector, void*);
281 long onUpdToggleEditable(FXObject*, FXSelector, void*);
282 long onCmdToggleOverstrike(FXObject*, FXSelector, void*);
283 long onUpdToggleOverstrike(FXObject*, FXSelector, void*);
284 long onUpdHaveSelection(FXObject*, FXSelector, void*);
285 long onUpdSelectAll(FXObject*, FXSelector, void*);
286 long onCmdSetHelp(FXObject*, FXSelector, void*);
287 long onCmdGetHelp(FXObject*, FXSelector, void*);
288 long onCmdSetTip(FXObject*, FXSelector, void*);
289 long onCmdGetTip(FXObject*, FXSelector, void*);
290 long onQueryHelp(FXObject*, FXSelector, void*);
291 long onQueryTip(FXObject*, FXSelector, void*);
292
294
295protected:
297 FXString contents;
298
300 const FXchar* delimiters = FXTextField::textDelimiters;
301
303 FXFont* font;
304
306 FXColor textColor = 0;
307
309 FXColor selbackColor = 0;
310
312 FXColor seltextColor = 0;
313
315 FXColor cursorColor = 0;
316
318 FXint cursor = 0;
319
321 FXint anchor = 0;
322
324 FXint columns = 0;
325
327 FXint shift = 0;
328
330 FXString clipped;
331
333 FXString help;
334
336 FXString tip;
337
339 FXIcon* icon = nullptr;
340
343
345 FXint index(FXint x) const;
346
348 FXint coord(FXint i) const;
349
351 void drawCursor(FXuint state);
352
354 void drawTextRange(FXDCWindow& dc, FXint fm, FXint to);
355
357 void drawTextFragment(FXDCWindow& dc, FXint x, FXint y, FXint fm, FXint to);
358
360 void drawPWDTextFragment(FXDCWindow& dc, FXint x, FXint y, FXint fm, FXint to);
361
363 FXint rightWord(FXint pos) const;
364
366 FXint leftWord(FXint pos) const;
367
369 FXint wordStart(FXint pos) const;
370
372 FXint wordEnd(FXint pos) const;
373
374private:
377
380};
FXString clipped
Clipped text.
FXint cursor
Cursor position.
FXString contents
Edited text.
long onCmdOverstString(FXObject *, FXSelector, void *)
MFXTextFieldIcon & operator=(const MFXTextFieldIcon &)=delete
invalidate assigment constructor
virtual void save(FXStream &store) const
Save text field to a stream.
virtual void disable()
Disable text field.
FXint coord(FXint i) const
coordinates
const FXchar * delimiters
Set of delimiters.
long onCmdSelectAll(FXObject *, FXSelector, void *)
long onCmdGetStringValue(FXObject *, FXSelector, void *)
void setCursorColor(FXColor clr)
Changes the cursor color.
void setSelTextColor(FXColor clr)
Change selected text color.
virtual void setFocus()
Move the focus to this window.
void setOverstrike(FXbool over=TRUE)
Set overstrike mode.
long onLeftBtnRelease(FXObject *, FXSelector, void *)
long onCmdGetRealValue(FXObject *, FXSelector, void *)
long onCmdGetHelp(FXObject *, FXSelector, void *)
long onBlink(FXObject *, FXSelector, void *)
long onCmdCursorHome(FXObject *, FXSelector, void *)
long onCmdCursorWordStart(FXObject *, FXSelector, void *)
const FXString & getTipText() const
Get the tool tip message for this text field.
long onKeyPress(FXObject *, FXSelector, void *)
FXint getCursorPos() const
Return cursor position.
long onFocusIn(FXObject *, FXSelector, void *)
virtual void killFocus()
Remove the focus from this window.
long onCmdSetTip(FXObject *, FXSelector, void *)
FXint wordStart(FXint pos) const
word start
long onCmdToggleOverstrike(FXObject *, FXSelector, void *)
void drawPWDTextFragment(FXDCWindow &dc, FXint x, FXint y, FXint fm, FXint to)
draw password text fragment
FXint columns
Number of columns visible.
virtual void enable()
Enable text field.
long onClipboardGained(FXObject *, FXSelector, void *)
long onLeftBtnPress(FXObject *, FXSelector, void *)
long onFocusOut(FXObject *, FXSelector, void *)
virtual FXint getDefaultWidth()
Return default width.
long onAutoScroll(FXObject *, FXSelector, void *)
FXFont * font
Text font.
MFXTextFieldIcon()
FOX need this.
FXint anchor
Anchor position.
void drawTextFragment(FXDCWindow &dc, FXint x, FXint y, FXint fm, FXint to)
draw text fragment
FXbool killSelection()
Unselect the text.
long onCmdPasteSel(FXObject *, FXSelector, void *)
long onQueryTip(FXObject *, FXSelector, void *)
FXColor selbackColor
Selected background color.
long onCmdCopySel(FXObject *, FXSelector, void *)
void makePositionVisible(FXint pos)
Scroll text to make the given position visible.
void setSelBackColor(FXColor clr)
Change selected background color.
FXColor textColor
Text color.
long onUpdToggleOverstrike(FXObject *, FXSelector, void *)
long onVerify(FXObject *, FXSelector, void *)
FXint leftWord(FXint pos) const
left word
long onCmdCursorLeft(FXObject *, FXSelector, void *)
long onCmdExtend(FXObject *, FXSelector, void *)
void drawTextRange(FXDCWindow &dc, FXint fm, FXint to)
draw text range
FXbool setSelection(FXint pos, FXint len)
Select len characters starting at given position pos.
long onMiddleBtnRelease(FXObject *, FXSelector, void *)
long onCmdCursorWordEnd(FXObject *, FXSelector, void *)
void drawCursor(FXuint state)
draw cursor
FXString tip
Tooltip.
void setAnchorPos(FXint pos)
Change anchor position.
FXColor getTextColor() const
Return text color.
long onKeyRelease(FXObject *, FXSelector, void *)
long onSelectionRequest(FXObject *, FXSelector, void *ptr)
long onCmdDelete(FXObject *, FXSelector, void *)
long onCmdDeleteSel(FXObject *, FXSelector, void *)
long onClipboardLost(FXObject *, FXSelector, void *)
long onCmdSetRealValue(FXObject *, FXSelector, void *)
long onCmdCursorEnd(FXObject *, FXSelector, void *)
FXColor cursorColor
Color of the Cursor.
FXColor seltextColor
Selected text color.
virtual bool canFocus() const
Yes, text field may receive focus.
long onCmdSetValue(FXObject *, FXSelector, void *)
void setCursorPos(FXint pos)
Set cursor position.
virtual void load(FXStream &store)
Load text field from a stream.
void setFont(FXFont *fnt)
Set the text font.
long onUpdate(FXObject *, FXSelector, void *)
FXbool extendSelection(FXint pos)
Extend the selection from the anchor to the given position.
FXString getText() const
Get the text for this label.
long onUpdSelectAll(FXObject *, FXSelector, void *)
FXint index(FXint x) const
index
long onCmdPasteMiddle(FXObject *, FXSelector, void *)
long onCmdCursorWordLeft(FXObject *, FXSelector, void *)
FXString help
Help string.
void setEditable(FXbool edit=TRUE)
Set editable mode.
long onCmdSetStringValue(FXObject *, FXSelector, void *)
long onMotion(FXObject *, FXSelector, void *)
virtual FXint getDefaultHeight()
Return default height.
MFXTextFieldIcon(const MFXTextFieldIcon &)=delete
invalidate copy constructor
long onCmdCutSel(FXObject *, FXSelector, void *)
long onFocusSelf(FXObject *, FXSelector, void *)
void setJustify(FXuint mode)
Change text justification mode.
FXuint getTextStyle() const
Return text style.
virtual ~MFXTextFieldIcon()
Destructor.
long onSelectionGained(FXObject *, FXSelector, void *)
long onCmdDeselectAll(FXObject *, FXSelector, void *)
FXbool isPosVisible(FXint pos) const
Return TRUE if position is fully visible.
FXint getAnchorPos() const
Return anchor position.
long onUpdToggleEditable(FXObject *, FXSelector, void *)
FXbool selectAll()
Select all text.
void setNumColumns(FXint cols)
Change the default width of the text field.
FXint rightWord(FXint pos) const
right word
long onCmdGetTip(FXObject *, FXSelector, void *)
long onClipboardRequest(FXObject *, FXSelector, void *)
void setTextColor(FXColor clr)
Change text color.
long onSelectionLost(FXObject *, FXSelector, void *)
FXint getNumColumns() const
Return number of columns.
long onCmdToggleEditable(FXObject *, FXSelector, void *)
long onCmdSetHelp(FXObject *, FXSelector, void *)
long onCmdInsertString(FXObject *, FXSelector, void *)
FXFont * getFont() const
Get the text font.
long onPaint(FXObject *, FXSelector, void *)
fox callbacks
long onCmdDeleteAll(FXObject *, FXSelector, void *)
const FXString & getHelpText() const
Get the status line help text for this label.
const FXchar * getDelimiters() const
Return word delimiters.
long onUpdHaveSelection(FXObject *, FXSelector, void *)
void setHelpText(const FXString &text)
Set the status line help text for this label.
FXbool isEditable() const
Return TRUE if text field may be edited.
FXColor getSelBackColor() const
Return selected background color.
FXint shift
Shift amount.
long onQueryHelp(FXObject *, FXSelector, void *)
void setIcon(FXIcon *ic)
Change the icon.
void setDelimiters(const FXchar *delims=FXTextField::textDelimiters)
Change word delimiters.
long onCmdSetIntValue(FXObject *, FXSelector, void *)
void setTextStyle(FXuint style)
Change text style.
FXColor getSelTextColor() const
Return selected text color.
long onCmdCursorRight(FXObject *, FXSelector, void *)
FXColor getCursorColor() const
Return the cursor color.
void setTipText(const FXString &text)
Set the tool tip message for this text field.
FXint wordEnd(FXint pos) const
word end
long onMiddleBtnPress(FXObject *, FXSelector, void *)
virtual void create()
Create server-side resources.
virtual void layout()
Perform layout.
FXbool isPosSelected(FXint pos) const
Return TRUE if position pos is selected.
void setText(const FXString &text, FXbool notify=FALSE)
Change the text and move cursor to end.
long onCmdGetIntValue(FXObject *, FXSelector, void *)
long onCmdBackspace(FXObject *, FXSelector, void *)
FXbool isOverstrike() const
Return TRUE if overstrike mode in effect.
long onCmdCursorWordRight(FXObject *, FXSelector, void *)
FXuint getJustify() const
Return text justification mode.
long onCmdMark(FXObject *, FXSelector, void *)