NXWidgets: ctextbox.cxx Source File

NXWidgets 1.19

ctextbox.cxx
Go to the documentation of this file.
1 /****************************************************************************
2 * NxWidgets/libnxwidgets/src/ctextbox.cxx
3 *
4 * Copyright (C) 2012 Gregory Nutt. All rights reserved.
5 * Author: Gregory Nutt <gnutt@nuttx.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
18 * me be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************
35 *
36 * Portions of this package derive from Woopsi (http://woopsi.org/) and
37 * portions are original efforts. It is difficult to determine at this
38 * point what parts are original efforts and which parts derive from Woopsi.
39 * However, in any event, the work of Antony Dzeryn will be acknowledged
40 * in most NxWidget files. Thanks Antony!
41 *
42 * Copyright (c) 2007-2011, Antony Dzeryn
43 * All rights reserved.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions are met:
47 *
48 * * Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer.
50 * * Redistributions in binary form must reproduce the above copyright
51 * notice, this list of conditions and the following disclaimer in the
52 * documentation and/or other materials provided with the distribution.
53 * * Neither the names "Woopsi", "Simian Zombie" nor the
54 * names of its contributors may be used to endorse or promote products
55 * derived from this software without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
58 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
59 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
60 * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
61 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
62 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
63 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
64 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
66 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 *
68 ****************************************************************************/
69
70 /****************************************************************************
71 * Included Files
72 ****************************************************************************/
73
74 #include <nuttx/config.h>
75
76 #include <sys/types.h>
77 #include <stdint.h>
78 #include <stdbool.h>
79
80 #include <nuttx/nx/nxglib.h>
81
82 #include "nxconfig.hxx"
83 #include "ctextbox.hxx"
84 #include "cgraphicsport.hxx"
85 #include "cnxtimer.hxx"
86 #include "cstringiterator.hxx"
87
88 /****************************************************************************
89 * Pre-Processor Definitions
90 ****************************************************************************/
91
92 /****************************************************************************
93 * CButton Method Implementations
94 ****************************************************************************/
95
96 using namespace NXWidgets;
97
98 /**
99 * Constructor for a textbox containing a string.
100 *
101 * @param pWidgetControl The controlling widget for the window
102 * @param x The x coordinate of the text box, relative to its parent.
103 * @param y The y coordinate of the text box, relative to its parent.
104 * @param width The width of the textbox.
105 * @param height The height of the textbox.
106 * @param text Pointer to a string to display in the textbox.
107 * @param style The style that the widget should use. If this is not
108 * specified, the widget will use the values stored in the global
109 * defaultCWidgetStyle object. The widget will copy the properties of
110 * the style into its own internal style object.
111 */
112
113 CTextBox::CTextBox(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y,
114 nxgl_coord_t width, nxgl_coord_t height,
115 const CNxString &text, CWidgetStyle *style)
116 : CLabel(pWidgetControl, x, y, width, height, text, style)
117 {
118 // Initialize state
119
120 m_cursorPos = 0;
121 m_showCursor = SHOW_CURSOR_ONFOCUS;
122 m_wrapCursor = false;
123 m_textChange = false;
124 m_flags.doubleClickable = true;
125
126 // Set the border thickness (2 lines)
127
128 m_borderSize.top = 2;
129 m_borderSize.right = 2;
130 m_borderSize.bottom = 2;
131 m_borderSize.left = 2;
132
133 // Move the cursor to the end of the string
134
135 moveCursorToPosition(m_text.getLength());
136
137 // Register to receive keypress events
138
139 addWidgetEventHandler(static_cast<CWidgetEventHandler *>(this));
140 }
141
142 /**
143 * Shows the cursor.
144 *
145 * @param cursorMode Determines cursor display mode
146 */
147
148 void CTextBox::showCursor(EShowCursor cursorMode)
149 {
150 if (m_showCursor != cursorMode)
151 {
152 m_showCursor = cursorMode;
153 redraw();
154 }
155 }
156
157 /**
158 * Set the text displayed in the label.
159 *
160 * @param text String to display.
161 */
162
163 void CTextBox::setText(const CNxString &text)
164 {
165 m_text.setText(text);
166 repositionCursor(m_text.getLength());
167 onTextChange();
168 }
169
170 /**
171 * Append new text to the end of the current text displayed in the
172 * label.
173 *
174 * @param text String to append.
175 */
176
177 void CTextBox::appendText(const CNxString &text)
178 {
179 m_text.append(text);
180 repositionCursor(m_text.getLength());
181 onTextChange();
182 }
183
184 /**
185 * Remove all characters from the string from the start index onwards.
186 *
187 * @param startIndex Index to remove from.
188 */
189
190 void CTextBox::removeText(const unsigned int startIndex)
191 {
192 m_text.remove(startIndex);
193 repositionCursor(startIndex);
194 onTextChange();
195 }
196
197 /**
198 * Remove specified number of characters from the string from the
199 * start index onwards.
200 *
201 * @param startIndex Index to remove from.
202 * @param count Number of characters to remove.
203 */
204
205 void CTextBox::removeText(const unsigned int startIndex, const unsigned int count)
206 {
207 m_text.remove(startIndex, count);
208 repositionCursor(startIndex);
209 onTextChange();
210 }
211
212 /**
213 * Insert text at the specified index.
214 *
215 * @param text The text to insert.
216 * @param index Index at which to insert the text.
217 */
218
219 void CTextBox::insertText(const CNxString &text, const unsigned int index)
220 {
221 m_text.insert(text, index);
222 repositionCursor(index + text.getLength());
223 onTextChange();
224 }
225
226 /**
227 * Insert text at the current cursor position.
228 *
229 * @param text The text to insert.
230 */
231
232 void CTextBox::insertTextAtCursor(const CNxString &text)
233 {
234 insertText(text, getCursorPosition());
235 }
236
237 /**
238 * Move the cursor to the text position specified. 0 indicates the
239 * start of the string. If position is greater than the length of the
240 * string, the cursor is moved to the end of the string.
241 *
242 * @param position The new cursor position.
243 */
244
245 void CTextBox::moveCursorToPosition(const int position)
246 {
247 if (repositionCursor(position))
248 {
249 calculateTextPositionHorizontal();
250 redraw();
251 }
252 }
253
254 /**
255 * Handle a keyboard press event.
256 *
257 * @param e The event data.
258 */
259
260 void CTextBox::handleKeyPressEvent(const CWidgetEventArgs &e)
261 {
262 nxwidget_char_t key = e.getKey();
263
264 if (key == KEY_CODE_BACKSPACE)
265 {
266 if (m_cursorPos == 0) return;
267
268 // Delete the character in front of the cursor
269
270 removeText(m_cursorPos - 1, 1);
271 }
272 else if (key == KEY_CODE_ENTER)
273 {
274 // Fire an action event
275
276 m_widgetEventHandlers->raiseActionEvent();
277 }
278 else if (key != KEY_CODE_NONE)
279 {
280 // Not modifier; append value
281
282 insertTextAtCursor(key);
283 }
284 }
285
286 /**
287 * Handle a cursor control event. Replaces CWidgetEventHandler method.
288 *
289 * @param e The event data.
290 */
291
292 void CTextBox::handleCursorControlEvent(const CWidgetEventArgs &e)
293 {
294 ECursorControl control = e.getCursorControl();
295
296 if (control == CURSOR_LEFT)
297 {
298 if (m_cursorPos > 0)
299 {
300 moveCursorToPosition(m_cursorPos - 1);
301 }
302 else if (m_wrapCursor)
303 {
304 moveCursorToPosition(m_text.getLength() - 1);
305 }
306 }
307 else if (control == CURSOR_RIGHT)
308 {
309 if (m_cursorPos < m_text.getLength())
310 {
311 moveCursorToPosition(m_cursorPos + 1);
312 }
313 else if (m_wrapCursor)
314 {
315 moveCursorToPosition(0);
316 }
317 }
318 }
319
320 /**
321 * Redraws the widget
322 */
323
324 void CTextBox::onBlur(void)
325 {
326 redraw();
327 }
328
329 /**
330 * Draw the area of this widget that falls within the clipping region.
331 * Called by the redraw() function to draw all visible regions.
332 *
333 * @param port The CGraphicsPort to draw to.
334 * @see redraw()
335 */
336
337 void CTextBox::drawContents(CGraphicsPort *port)
338 {
339 // Get the drawing area (excluding the border)
340
341 CRect rect;
342 getRect(rect);
343
344 // Determine the background and text color
345
346 nxgl_mxpixel_t textColor;
347 nxgl_mxpixel_t backColor;
348
349 if (!isEnabled())
350 {
351 textColor = getDisabledTextColor();
352 backColor = getBackgroundColor();
353 }
354 else if (m_highlighted)
355 {
356 textColor = getSelectedTextColor();
357 backColor = getSelectedBackgroundColor();
358 }
359 else
360 {
361 textColor = getEnabledTextColor();
362 backColor = getBackgroundColor();
363 }
364
365 // Draw the background (excluding the border)
366
367 port->drawFilledRect(rect.getX(), rect.getY(),
368 rect.getWidth(), rect.getHeight(), backColor);
369
370 // Get the X/Y position of the text within the textbox
371
372 struct nxgl_point_s pos;
373 pos.x = rect.getX() + m_align.x;
374 pos.y = rect.getY() + m_align.y;
375
376 // And draw the text
377
378 CNxFont *font = getFont();
379 port->drawText(&pos, &rect, font, m_text, 0, m_text.getLength(), textColor);
380
381 // Draw cursor
382
383 if (isCursorVisible())
384 {
385 // Calculate the (relative) cursor position
386 // Warning: drawText modifies pos!
387
388 pos.x = getCursorXPos() + m_align.x;
389 pos.y = m_align.y;
390
391 // Calculate the cursor width
392
393 struct nxgl_size_s size;
394 size.w = getCursorWidth();
395 size.h = getFont()->getHeight();
396
397 // Is the cursor wholly within the visible region?
398
399 if (pos.x >= 0 && pos.x + size.w < rect.getWidth())
400 {
401 // Invert the colors in the cursor region.
402
403 pos.x += rect.getX();
404 pos.y += rect.getY();
405
406 port->invert(pos.x, pos.y, size.w, size.h);
407 }
408 }
409 }
410
411 /**
412 * Moves the cursor without redrawing.
413 *
414 * @param position New cursor position.
415 */
416
417 bool CTextBox::repositionCursor(const int position)
418 {
419 int len = m_text.getLength();
420
421 // Set the cursor position if the new position is within the string.
422
423 if (m_cursorPos != position && position <= len)
424 {
425 m_cursorPos = position;
426 return true;
427 }
428
429 return false;
430 }
431
432 /**
433 * Move the cursor to the specified coordinates. The coordinates
434 * are expected to be the result of a click, and therefore in
435 * world-space rather than widget-space.
436 */
437
438 void CTextBox::moveCursorToClickLocation(nxgl_coord_t x, nxgl_coord_t y)
439 {
440 // Work out where in the string the click coordinates represent
441 // and move the cursor to that location
442
443 if (m_text.getLength() > 0)
444 {
445 // Transform click coordinates to widget-space coordinates
446
447 nxgl_coord_t clickX = x - getX() - m_borderSize.left;
448 nxgl_coord_t charX = m_align.x;
449
450 // Locate the first character that comes after the clicked character
451
452 CStringIterator *iterator = m_text.newStringIterator();
453
454 while (charX < clickX)
455 {
456 charX += getFont()->getCharWidth(iterator->getChar());
457
458 if (!iterator->moveToNext())
459 {
460 break;
461 }
462 }
463
464 int index = iterator->getIndex();
465
466 // Move back to the clicked character if we've moved past it
467
468 if (charX > clickX)
469 {
470 iterator->moveToPrevious();
471 index = iterator->getIndex();
472 }
473 else if (charX < clickX)
474 {
475 // Move past end of string if click is after the text
476
477 index++;
478 }
479
480 moveCursorToPosition(index);
481 delete iterator;
482 }
483 }
484
485 /**
486 * Draw the area of this widget that falls within the clipping region.
487 * Called by the redraw() function to draw all visible regions.
488 *
489 * @param port The CGraphicsPort to draw to.
490 * @see redraw()
491 */
492
493 void CTextBox::drawBorder(CGraphicsPort *port)
494 {
495 // Check if the widget indicates it should have an outline: That
496 // the outline is enabled and the this is not just a text-only
497 // redraw
498
499 if (!isBorderless() && !isTextChange())
500 {
501 port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(),
502 getShineEdgeColor(), getShadowEdgeColor());
503 port->drawBevelledRect(getX() + 1, getY() + 1, getWidth() - 2, getHeight() - 2,
504 getShadowEdgeColor(), getShineEdgeColor());
505 }
506 }
507
508 /**
509 * Moves the cursor to the clicked coordinates.
510 *
511 * @param x The x coordinates of the click.
512 * @param y The y coordinates of the click.
513 */
514
515 void CTextBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
516 {
517 moveCursorToClickLocation(x, y);
518 }
519
520 /**
521 * Does nothing.
522 *
523 * @param x The x coordinates of the click.
524 * @param y The y coordinates of the click.
525 */
526
527 void CTextBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
528 {
529 // No double click action
530 }
531
532 /**
533 * Return true if the cursor is visible
534 */
535
536 bool CTextBox::isCursorVisible(void) const
537 {
538 return (m_showCursor == SHOW_CURSOR_ALWAYS ||
539 (m_showCursor == SHOW_CURSOR_ONFOCUS && hasFocus()));
540 }
541
542 /**
543 * Get the x coordinate of the cursor in pixels relative
544 * to the left-hand edge of the client rect.
545 *
546 * @return The x coordinate of the cursor in pixels.
547 */
548
549 const nxgl_coord_t CTextBox::getCursorXPos(void) const
550 {
551 // Calculate position of cursor
552
553 nxgl_coord_t cursorX = 0;
554
555 CStringIterator *iterator = m_text.newStringIterator();
556
557 for (nxgl_coord_t i = 0; i < m_cursorPos; i++)
558 {
559 cursorX += getFont()->getCharWidth(iterator->getChar());
560 iterator->moveToNext();
561 }
562
563 delete iterator;
564 return cursorX;
565 }
566
567 /**
568 * Get the width of the cursor in pixels.
569 *
570 * @return The width of the cursor in pixels.
571 */
572
573 nxgl_coord_t CTextBox::getCursorWidth(void) const
574 {
575 if (m_cursorPos < m_text.getLength())
576 {
577 // Cursor within the string - get the width of the character
578
579 return getFont()->getCharWidth(m_text.getCharAt(m_cursorPos));
580 }
581 else
582 {
583 // Cursor past end of string - get the width of a space
584
585 return getFont()->getCharWidth(' ');
586 }
587 }
588
589 /**
590 * Calculate the horizontal position of the string based on its length
591 * and the alignment options. Alignment options are overridden if the
592 * width of the string exceeds the width of the textbox.
593 */
594
595 void CTextBox::calculateTextPositionHorizontal(void)
596 {
597 // Calculate the string width - if the width is longer than the box,
598 // ignore alignment and align left
599
600 nxgl_coord_t stringWidth = getFont()->getStringWidth(m_text);
601
602 // Add the width of a blank space to the width to ensure that we can
603 // see the cursor
604
605 if (isCursorVisible())
606 {
607 stringWidth += getFont()->getCharWidth(' ');
608 }
609
610 CRect rect;
611 getClientRect(rect);
612
613 // Use alignment options if cursor is hidden or string is smaller
614 // than textbox
615
616 nxgl_coord_t width = rect.getWidth();
617 if ((stringWidth < width) || !isCursorVisible())
618 {
619 // Text not wider than box, so apply alignment options
620
621 switch (m_hAlignment)
622 {
623 case TEXT_ALIGNMENT_HORIZ_CENTER:
624 m_align.x = (width - stringWidth) >> 1;
625 break;
626
627 case TEXT_ALIGNMENT_HORIZ_LEFT:
628 m_align.x = rect.getX();
629 break;
630
631 case TEXT_ALIGNMENT_HORIZ_RIGHT:
632 m_align.x = width - stringWidth;
633 break;
634 }
635
636 return;
637 }
638
639 // Text is wider than box - view needs to follow the cursor
640 // If cursor is at the end of the text, we can just right-align
641
642 if (m_cursorPos == m_text.getLength())
643 {
644 m_align.x = width - stringWidth;
645 return;
646 }
647
648 // Work out the coordinates of the left edge of the cursor
649
650 int cursorX1 = getCursorXPos();
651
652 // Work out the coordinates of the right edge of the cursor
653
654 int cursorX2 = cursorX1 + getCursorWidth();
655
656 // Ensure that the cursor is on-screen
657
658 if (cursorX1 + m_align.x < 0)
659 {
660 // Cursor is off left side of screen, so adjust m_align.x
661
662 m_align.x = 0 - cursorX1;
663 }
664 else if (cursorX2 + m_align.x > width)
665 {
666 // Cursor is off right side of screen, so adjust m_align.x
667
668 m_align.x = width - cursorX2;
669 }
670
671 // We need to ensure that the text cannot be positioned in
672 // such a way that there is a gap between the end of the
673 // text and the right edge of the textbox
674
675 if (stringWidth + m_align.x < width)
676 {
677 m_align.x = width - stringWidth;
678 }
679 }
NXWidgets::CStringIterator
Definition: cstringiterator.hxx:102
NXWidgets::CStringIterator::getIndex
int getIndex(void) const
Definition: cstringiterator.hxx:172
NXWidgets::CNxFont::getCharWidth
nxgl_coord_t getCharWidth(nxwidget_char_t letter) const
Definition: cnxfont.cxx:254
NXWidgets::CNxWidget::m_borderSize
WidgetBorderSize m_borderSize
Definition: cnxwidget.hxx:208
NXWidgets::CTextBox::insertText
virtual void insertText(const CNxString &text, const unsigned int index)
Definition: ctextbox.cxx:219
NXWidgets::CNxWidget::isBorderless
bool isBorderless(void) const
Definition: cnxwidget.hxx:549
NXWidgets::CNxWidget::getShadowEdgeColor
nxgl_mxpixel_t getShadowEdgeColor(void) const
Definition: cnxwidget.hxx:749
NXWidgets::CWidgetStyle
Definition: cwidgetstyle.hxx:125
NXWidgets::CRect::getHeight
nxgl_coord_t getHeight(void) const
Definition: crect.hxx:204
NXWidgets::CTextBox::moveCursorToClickLocation
void moveCursorToClickLocation(nxgl_coord_t x, nxgl_coord_t y)
Definition: ctextbox.cxx:438
NXWidgets::CLabel::m_textChange
bool m_textChange
Definition: clabel.hxx:143
NXWidgets::CWidgetControl
Definition: cwidgetcontrol.hxx:95
NXWidgets::CTextBox::insertTextAtCursor
virtual void insertTextAtCursor(const CNxString &text)
Definition: ctextbox.cxx:232
NXWidgets::CTextBox::m_cursorPos
int m_cursorPos
Definition: ctextbox.hxx:122
NXWidgets::CNxWidget::getRect
void getRect(CRect &rect) const
Definition: cnxwidget.cxx:448
NXWidgets::CLabel::isTextChange
virtual bool isTextChange(void) const
Definition: clabel.hxx:348
NXWidgets::CRect::getWidth
nxgl_coord_t getWidth(void) const
Definition: crect.hxx:181
NXWidgets::CGraphicsPort::drawBevelledRect
void drawBevelledRect(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_mxpixel_t shineColor, nxgl_mxpixel_t shadowColor)
Definition: cgraphicsport.cxx:323
NXWidgets::CRect::getX
nxgl_coord_t getX(void) const
Definition: crect.hxx:160
NXWidgets::CStringIterator::moveToPrevious
bool moveToPrevious(void)
Definition: cstringiterator.cxx:167
NXWidgets::CWidgetEventHandlerList::raiseActionEvent
void raiseActionEvent(void)
Definition: cwidgeteventhandlerlist.cxx:507
NXWidgets::CTextBox::onDoubleClick
virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: ctextbox.cxx:527
cgraphicsport.hxx
ctextbox.hxx
NXWidgets::CNxWidget::getBackgroundColor
nxgl_mxpixel_t getBackgroundColor(void) const
Definition: cnxwidget.hxx:716
NXWidgets::CURSOR_LEFT
Definition: cwidgeteventargs.hxx:117
NXWidgets::CNxString::append
void append(const CNxString &text)
Definition: cnxstring.cxx:267
NXWidgets::CLabel::m_align
struct nxgl_point_s m_align
Definition: clabel.hxx:140
NXWidgets::CLabel::m_highlighted
bool m_highlighted
Definition: clabel.hxx:144
NXWidgets::EShowCursor
EShowCursor
Definition: itextbox.hxx:104
cstringiterator.hxx
NXWidgets::CTextBox::m_wrapCursor
bool m_wrapCursor
Definition: ctextbox.hxx:124
NXWidgets::CNxWidget::isEnabled
bool isEnabled(void) const
Definition: cnxwidget.cxx:381
NXWidgets::CNxFont::getStringWidth
nxgl_coord_t getStringWidth(const CNxString &text) const
Definition: cnxfont.cxx:142
NXWidgets::CNxWidget::redraw
void redraw(void)
Definition: cnxwidget.cxx:483
NXWidgets::CURSOR_RIGHT
Definition: cwidgeteventargs.hxx:118
NXWidgets::CTextBox::getCursorXPos
virtual const nxgl_coord_t getCursorXPos(void) const
Definition: ctextbox.cxx:549
NXWidgets::CNxWidget::getEnabledTextColor
nxgl_mxpixel_t getEnabledTextColor(void) const
Definition: cnxwidget.hxx:782
NXWidgets::CTextBox::onBlur
void onBlur(void)
Definition: ctextbox.cxx:324
NXWidgets::CLabel::m_hAlignment
TextAlignmentHoriz m_hAlignment
Definition: clabel.hxx:141
NXWidgets
Definition: cbgwindow.hxx:65
NXWidgets::CNxWidget::getHeight
nxgl_coord_t getHeight(void) const
Definition: cnxwidget.hxx:593
NXWidgets::CNxString::remove
void remove(const int startIndex)
Definition: cnxstring.cxx:398
NXWidgets::CNxWidget::WidgetBorderSize::left
uint8_t left
Definition: cnxwidget.hxx:167
NXWidgets::CNxWidget::getClientRect
void getClientRect(CRect &rect) const
Definition: cnxwidget.cxx:421
NXWidgets::CTextBox::handleCursorControlEvent
void handleCursorControlEvent(const CWidgetEventArgs &e)
Definition: ctextbox.cxx:292
NXWidgets::CLabel::onTextChange
virtual void onTextChange(void)
Definition: clabel.cxx:448
NXWidgets::CNxWidget::addWidgetEventHandler
void addWidgetEventHandler(CWidgetEventHandler *eventHandler)
Definition: cnxwidget.hxx:854
NXWidgets::CStringIterator::moveToNext
bool moveToNext(void)
Definition: cstringiterator.cxx:149
NXWidgets::nxwidget_char_t
uint16_t nxwidget_char_t
Definition: nxconfig.hxx:454
nxconfig.hxx
NXWidgets::CNxWidget::getSelectedBackgroundColor
nxgl_mxpixel_t getSelectedBackgroundColor(void) const
Definition: cnxwidget.hxx:727
NXWidgets::CTextBox::calculateTextPositionHorizontal
virtual void calculateTextPositionHorizontal(void)
Definition: ctextbox.cxx:595
NXWidgets::CLabel::m_text
CNxString m_text
Definition: clabel.hxx:139
cnxtimer.hxx
NXWidgets::SHOW_CURSOR_ONFOCUS
Definition: itextbox.hxx:106
NXWidgets::CNxFont
Definition: cnxfont.hxx:70
NXWidgets::CNxWidget::WidgetBorderSize::right
uint8_t right
Definition: cnxwidget.hxx:165
NXWidgets::CTextBox::getCursorWidth
virtual nxgl_coord_t getCursorWidth(void) const
Definition: ctextbox.cxx:573
NXWidgets::CStringIterator::getChar
nxwidget_char_t getChar(void) const
Definition: cstringiterator.hxx:183
NXWidgets::CTextBox::drawBorder
virtual void drawBorder(CGraphicsPort *port)
Definition: ctextbox.cxx:493
NXWidgets::CGraphicsPort::drawFilledRect
void drawFilledRect(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_mxpixel_t color)
Definition: cgraphicsport.cxx:280
NXWidgets::CNxString::setText
void setText(const CNxString &text)
Definition: cnxstring.cxx:185
NXWidgets::CNxWidget::getFont
CNxFont * getFont(void) const
Definition: cnxwidget.hxx:705
NXWidgets::CWidgetEventArgs::getKey
const nxwidget_char_t getKey(void) const
Definition: cwidgeteventargs.hxx:216
NXWidgets::CGraphicsPort::invert
void invert(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height)
Definition: cgraphicsport.cxx:995
NXWidgets::CNxWidget::WidgetBorderSize::bottom
uint8_t bottom
Definition: cnxwidget.hxx:166
NXWidgets::CTextBox::m_showCursor
uint8_t m_showCursor
Definition: ctextbox.hxx:123
NXWidgets::CTextBox::removeText
virtual void removeText(const unsigned int startIndex)
Definition: ctextbox.cxx:190
NXWidgets::CNxWidget::getShineEdgeColor
nxgl_mxpixel_t getShineEdgeColor(void) const
Definition: cnxwidget.hxx:738
NXWidgets::CNxWidget::WidgetBorderSize::top
uint8_t top
Definition: cnxwidget.hxx:164
NXWidgets::CNxFont::getHeight
const uint8_t getHeight(void) const
Definition: cnxfont.hxx:229
NXWidgets::CNxWidget::m_widgetEventHandlers
CWidgetEventHandlerList * m_widgetEventHandlers
Definition: cnxwidget.hxx:191
NXWidgets::CNxString::getLength
const unsigned int getLength(void) const
Definition: cnxstring.hxx:325
NXWidgets::CWidgetEventArgs
Definition: cwidgeteventargs.hxx:127
NXWidgets::CRect
Definition: crect.hxx:101
NXWidgets::CTextBox::setText
virtual void setText(const CNxString &text)
Definition: ctextbox.cxx:163
NXWidgets::CTextBox::moveCursorToPosition
virtual void moveCursorToPosition(const int position)
Definition: ctextbox.cxx:245
NXWidgets::ECursorControl
ECursorControl
Definition: cwidgeteventargs.hxx:111
NXWidgets::CNxString::getCharAt
const nxwidget_char_t getCharAt(int index) const
Definition: cnxstring.cxx:467
NXWidgets::CTextBox::getCursorPosition
virtual const int getCursorPosition(void) const
Definition: ctextbox.hxx:350
NXWidgets::CNxWidget::getY
nxgl_coord_t getY(void) const
Definition: cnxwidget.cxx:261
NXWidgets::CNxWidget::getWidth
nxgl_coord_t getWidth(void) const
Definition: cnxwidget.hxx:582
NXWidgets::CTextBox::appendText
virtual void appendText(const CNxString &text)
Definition: ctextbox.cxx:177
NXWidgets::CNxWidget::getX
nxgl_coord_t getX(void) const
Definition: cnxwidget.cxx:245
NXWidgets::CNxString::newStringIterator
CStringIterator * newStringIterator(void) const
Definition: cnxstring.cxx:156
NXWidgets::CNxString
Definition: cnxstring.hxx:121
NXWidgets::CRect::getY
nxgl_coord_t getY(void) const
Definition: crect.hxx:170
NXWidgets::CLabel
Definition: clabel.hxx:112
NXWidgets::CNxWidget::getDisabledTextColor
nxgl_mxpixel_t getDisabledTextColor(void) const
Definition: cnxwidget.hxx:771
NXWidgets::SHOW_CURSOR_ALWAYS
Definition: itextbox.hxx:108
NXWidgets::CNxWidget::Flags::doubleClickable
uint8_t doubleClickable
Definition: cnxwidget.hxx:155
NXWidgets::CNxString::insert
void insert(const CNxString &text, const int index)
Definition: cnxstring.cxx:295
NXWidgets::CTextBox::showCursor
virtual void showCursor(void)
Definition: ctextbox.hxx:256
NXWidgets::CTextBox::drawContents
virtual void drawContents(CGraphicsPort *port)
Definition: ctextbox.cxx:337
NXWidgets::CGraphicsPort::drawText
void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string)
Definition: cgraphicsport.cxx:609
NXWidgets::CLabel::TEXT_ALIGNMENT_HORIZ_RIGHT
Definition: clabel.hxx:124
NXWidgets::CLabel::TEXT_ALIGNMENT_HORIZ_CENTER
Definition: clabel.hxx:122
NXWidgets::CTextBox::isCursorVisible
virtual bool isCursorVisible(void) const
Definition: ctextbox.cxx:536
NXWidgets::CLabel::TEXT_ALIGNMENT_HORIZ_LEFT
Definition: clabel.hxx:123
NXWidgets::CTextBox::CTextBox
CTextBox(const CTextBox &textbox)
Definition: ctextbox.hxx:222
NXWidgets::CTextBox::onClick
virtual void onClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: ctextbox.cxx:515
NXWidgets::CTextBox::repositionCursor
virtual bool repositionCursor(const int position)
Definition: ctextbox.cxx:417
NXWidgets::CNxWidget::getSelectedTextColor
nxgl_mxpixel_t getSelectedTextColor(void) const
Definition: cnxwidget.hxx:793
NXWidgets::CGraphicsPort
Definition: cgraphicsport.hxx:106
NXWidgets::CWidgetEventArgs::getCursorControl
const ECursorControl getCursorControl(void) const
Definition: cwidgeteventargs.hxx:228
NXWidgets::CNxWidget::m_flags
Flags m_flags
Definition: cnxwidget.hxx:187
NXWidgets::CTextBox::handleKeyPressEvent
void handleKeyPressEvent(const CWidgetEventArgs &e)
Definition: ctextbox.cxx:260
NXWidgets::CNxWidget::hasFocus
bool hasFocus(void) const
Definition: cnxwidget.hxx:472