NXWidgets: clistbox.cxx Source File

NXWidgets 1.19

clistbox.cxx
Go to the documentation of this file.
1 /****************************************************************************
2 * NxWidgets/libnxwidgets/src/clistbox.cxx
3 *
4 * Copyright (C) 2012, 2016 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 <cstdint>
77 #include <cstdbool>
78
79 #include "cwidgetcontrol.hxx"
80 #include "clistbox.hxx"
81 #include "cgraphicsport.hxx"
82 #include "cnxfont.hxx"
83 #include "singletons.hxx"
84
85 /****************************************************************************
86 * Pre-Processor Definitions
87 ****************************************************************************/
88
89 /****************************************************************************
90 * Method Implementations
91 ****************************************************************************/
92
93 using namespace NXWidgets;
94
95 /**
96 * Constructor.
97 *
98 * @param pWidgetControl The controlling widget for the display.
99 * @param x The x coordinate of the widget.
100 * @param y The y coordinate of the widget.
101 * @param width The width of the widget.
102 * @param height The height of the widget.
103 * @param style The style that the widget should use. If this is not
104 * specified, the widget will use the values stored in the global
105 * g_defaultWidgetStyle object. The widget will copy the properties of
106 * the style into its own internal style object.
107 */
108
109 CListBox::CListBox(CWidgetControl *pWidgetControl,
110 nxgl_coord_t x, nxgl_coord_t y,
111 nxgl_coord_t width, nxgl_coord_t height,
112 CWidgetStyle *style)
113 : CScrollingPanel(pWidgetControl, x, y, width, height, 0, style)
114 {
115 m_flags.draggable = true;
116 m_flags.doubleClickable = true;
117 m_optionPadding = 2;
118 m_options.addListDataEventHandler(this);
119 m_lastSelectedIndex = -1;
120
121 // Disallow horizontal scrolling
122
123 setAllowsHorizontalScroll(false);
124 }
125
126 /**
127 * Destructor.
128 */
129
130 CListBox::~CListBox(void)
131 {
132 m_options.removeListDataEventHandler(this);
133 }
134
135
136 /**
137 * Add a new option to the widget using default colors.
138 *
139 * @param text Text to show in the option.
140 * @param value The value of the option.
141 */
142
143 void CListBox::addOption(const CNxString &text, const uint32_t value)
144 {
145 addOption(text, value,
146 getEnabledTextColor(), getBackgroundColor(),
147 getSelectedTextColor(), getSelectedBackgroundColor());
148 }
149
150 /**
151 * Add an option to the widget.
152 *
153 * @param option The option to add.
154 */
155
156 void CListBox::addOption(CListBoxDataItem *option)
157 {
158 m_options.addItem(option);
159 }
160
161 /**
162 * Remove an option from the widget by its index.
163 *
164 * @param index The index of the option to remove.
165 */
166
167 void CListBox::removeOption(const int index)
168 {
169 m_options.removeItem(index);
170 }
171
172 /**
173 * Remove all options from the widget.
174 */
175
176 void CListBox::removeAllOptions(void)
177 {
178 m_options.removeAllItems();
179 }
180
181 /**
182 * Add a new option to the widget.
183 *
184 * @param text Text to show in the option.
185 * @param value The value of the option.
186 * @param normalTextColor Color to draw the text with when not selected.
187 * @param normalBackColor Color to draw the background with when not selected.
188 * @param selectedTextColor Color to draw the text with when selected.
189 * @param selectedBackColor Color to draw the background with when selected.
190 */
191
192 void CListBox::addOption(const CNxString &text, const uint32_t value,
193 const nxwidget_pixel_t normalTextColor,
194 const nxwidget_pixel_t normalBackColor,
195 const nxwidget_pixel_t selectedTextColor,
196 const nxwidget_pixel_t selectedBackColor)
197 {
198 addOption(new CListBoxDataItem(text, value,
199 normalTextColor, normalBackColor,
200 selectedTextColor, selectedBackColor));
201 }
202
203 /**
204 * Select an option by its index.
205 * Redraws the widget and raises a value changed event.
206 *
207 * @param index The index of the option to select.
208 */
209
210 void CListBox::selectOption(const int index)
211 {
212 setOptionSelected(index, true);
213 }
214
215 /**
216 * Select an option by its index.
217 * Redraws the widget and raises a value changed event.
218 *
219 * @param index The index of the option to select.
220 */
221
222 void CListBox::deselectOption(const int index)
223 {
224 setOptionSelected(index, false);
225 }
226
227 /**
228 * Select all options. Does nothing if the listbox does not allow
229 * multiple selections. Redraws the widget and raises a value changed
230 * event.
231 */
232
233 void CListBox::selectAllOptions(void)
234 {
235 m_options.selectAllItems();
236 }
237
238 /**
239 * Deselect all options.
240 * Redraws the widget and raises a value changed event.
241 */
242
243 void CListBox::deselectAllOptions(void)
244 {
245 m_options.deselectAllItems();
246 }
247
248 /**
249 * Get the selected index. Returns -1 if nothing is selected. If
250 * more than one option is selected, the index of the first selected
251 * option is returned.
252 *
253 * @return The selected index.
254 */
255
256 const int CListBox::getSelectedIndex(void) const
257 {
258 return m_options.getSelectedIndex();
259 }
260
261 /**
262 * Sets the selected index. Specify -1 to select nothing. Resets any
263 * other selected options to deselected. Redraws the widget and raises
264 * a value changed event.
265 *
266 * @param index The selected index.
267 */
268
269 void CListBox::setSelectedIndex(const int index)
270 {
271 setOptionSelected(index, true);
272 }
273
274 /**
275 * Get the selected option. Returns NULL if nothing is selected.
276 *
277 * @return The selected option.
278 */
279
280 const CListBoxDataItem *CListBox::getSelectedOption(void) const
281 {
282 return (const CListBoxDataItem*)m_options.getSelectedItem();
283 }
284
285 /**
286 * Resize the scrolling canvas to encompass all options.
287 */
288
289 void CListBox::resizeCanvas(void)
290 {
291 // Get client area
292
293 CRect rect;
294 getClientRect(rect);
295
296 int oldCanvasHeight = m_canvasHeight;
297
298 // Resize the canvas
299
300 m_canvasHeight = (m_options.getItemCount() * getOptionHeight());
301
302 // Ensure canvas is at least as tall as the widget
303
304 m_canvasHeight = m_canvasHeight < rect.getHeight() ? rect.getHeight() : m_canvasHeight;
305
306 // If resize has left scroll position beyond end of canvas, adjust
307 // to compensate
308
309 if (m_canvasY + (m_canvasHeight - getHeight()) < 0)
310 {
311 scroll(0, -(oldCanvasHeight - (m_canvasHeight - getHeight())));
312 }
313 }
314
315 /**
316 * Sort the options alphabetically by the text of the options.
317 */
318
319 void CListBox::sort(void)
320 {
321 m_options.sort();
322 }
323
324 /**
325 * Get the height of a single option.
326 *
327 * @return The height of an option.
328 */
329
330 const nxgl_coord_t CListBox::getOptionHeight(void) const
331 {
332 return getFont()->getHeight() + (m_optionPadding << 1);
333 }
334
335 /**
336 * Handles list data changed events.
337 *
338 * @param e Event arguments.
339 */
340
341 void CListBox::handleListDataChangedEvent(const CListDataEventArgs &e)
342 {
343 // Forget the last selected item as it may have changed
344
345 m_lastSelectedIndex = -1;
346 resizeCanvas();
347 redraw();
348 }
349
350 /**
351 * Handles list selection changed events.
352 *
353 * @param e Event arguments.
354 */
355
356 void CListBox::handleListDataSelectionChangedEvent(const CListDataEventArgs &e)
357 {
358 redraw();
359 m_widgetEventHandlers->raiseValueChangeEvent();
360 }
361
362 /**
363 * Insert the dimensions that this widget wants to have into the rect
364 * passed in as a parameter. All coordinates are relative to the widget's
365 * parent. Value is based on the length of the largest string in the
366 * set of options.
367 *
368 * @param rect Reference to a rect to populate with data.
369 */
370
371 void CListBox::getPreferredDimensions(CRect &rect) const
372 {
373 nxgl_coord_t width;
374 nxgl_coord_t height;
375
376 if (!m_flags.borderless)
377 {
378 width = m_borderSize.left + m_borderSize.right;
379 height = m_borderSize.top + m_borderSize.bottom;
380 }
381 else
382 {
383 width = 0;
384 height = 0;
385 }
386
387 nxgl_coord_t maxWidth = 0;
388 nxgl_coord_t optionWidth = 0;
389
390 // Locate longest string in options
391
392 for (int i = 0; i < m_options.getItemCount(); ++i)
393 {
394 optionWidth = getFont()->getStringWidth(m_options.getItem(i)->getText());
395
396 if (optionWidth > maxWidth)
397 {
398 maxWidth = optionWidth;
399 }
400 }
401
402 rect.setX(m_rect.getX());
403 rect.setY(m_rect.getY());
404 rect.setWidth(width + (m_optionPadding << 1) + maxWidth);
405 rect.setHeight(height + getOptionHeight() * 3);
406 }
407
408 /**
409 * Check if the click is a double-click.
410 *
411 * @param x X coordinate of the click.
412 * @param y Y coordinate of the click.
413 * @return True if the click is a double-click.
414 */
415
416 bool CListBox::isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
417 {
418 if (CNxWidget::isDoubleClick(x, y))
419 {
420 // Calculate which option was clicked
421
422 int selectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
423
424 // Has the same option been clicked twice? Ignore double-clicks that
425 // occur on different items
426
427 if (selectedIndex == m_lastSelectedIndex)
428 {
429 // Process click as a double-click
430
431 return true;
432 }
433 }
434
435 return false;
436 }
437
438 /**
439 * Draw the area of this widget that falls within the clipping region.
440 * Called by the redraw() function to draw all visible regions.
441 *
442 * @param port The CGraphicsPort to draw to.
443 * @see redraw()
444 */
445
446 void CListBox::drawContents(CGraphicsPort *port)
447 {
448 // Get the drawing region (excluding the borders)
449
450 CRect rect;
451 getRect(rect);
452
453 // Draw background
454
455 port->drawFilledRect(rect.getX(), rect.getY(),
456 rect.getWidth(), rect.getHeight(),
457 getBackgroundColor());
458
459 // Calculate clipping values
460
461 nxgl_coord_t clipX = rect.getX();
462 nxgl_coord_t clipY = rect.getY();
463 nxgl_coord_t clipHeight = rect.getHeight();
464
465 // Precalculate values for option draw loop
466
467 nxgl_coord_t optionHeight = getOptionHeight();
468
469 // Ensure that we subtract 1 from topOption to ensure that the option
470 // above is drawn if it is partially visible
471
472 int topOption = ((clipY - m_canvasY) / optionHeight) - 1;
473
474 // Ensure that we add 2 to the bottom option to ensure that the option
475 // below is draw if it is partially visible - subbing 1 from topOption
476 // means we need to add an additional 1 to compensate
477
478 int bottomOption = topOption + (clipHeight / optionHeight) + 2;
479
480 // Ensure top options is not negative
481
482 if (topOption < 0)
483 {
484 topOption = 0;
485 }
486
487 // Ensure bottom option does not exceed number of options
488
489 if (bottomOption >= m_options.getItemCount())
490 {
491 bottomOption = m_options.getItemCount() - 1;
492 }
493
494 // Calculate values for loop
495
496 int y = m_canvasY + (topOption * optionHeight);
497 int i = topOption;
498
499 const CListBoxDataItem *item = (CListBoxDataItem *)NULL;
500
501 // Loop through all options drawing each ones
502
503 while (i <= bottomOption)
504 {
505 item = (const CListBoxDataItem*)m_options.getItem(i);
506
507 // Is the option selected?
508
509 if (item->isSelected())
510 {
511 // Draw background
512
513 if (item->getSelectedBackColor() != getBackgroundColor())
514 {
515 port->drawFilledRect(rect.getX(), rect.getY() + y,
516 rect.getWidth(), optionHeight,
517 item->getSelectedBackColor());
518 }
519
520 // Draw text
521
522 struct nxgl_point_s pos;
523 pos.x = rect.getX() + m_optionPadding;
524 pos.y = rect.getY() + y + m_optionPadding;
525
526 if (isEnabled())
527 {
528 port->drawText(&pos, &rect, getFont(), item->getText(), 0,
529 item->getText().getLength(),
530 item->getSelectedTextColor());
531 }
532 else
533 {
534 port->drawText(&pos, &rect, getFont(), item->getText(), 0,
535 item->getText().getLength(),
536 getDisabledTextColor());
537 }
538 }
539 else
540 {
541 // Draw background
542
543 if (item->getNormalBackColor() != getBackgroundColor())
544 {
545 port->drawFilledRect(clipX, y, getWidth(), optionHeight,
546 item->getNormalBackColor());
547 }
548
549 // Draw text
550
551 struct nxgl_point_s pos;
552 pos.x = rect.getX() + m_optionPadding;
553 pos.y = rect.getY() + y + m_optionPadding;
554
555 if (isEnabled())
556 {
557 port->drawText(&pos, &rect, getFont(), item->getText(), 0,
558 item->getText().getLength(),
559 item->getNormalTextColor());
560 }
561 else
562 {
563 port->drawText(&pos, &rect, getFont(), item->getText(), 0,
564 item->getText().getLength(),
565 getDisabledTextColor());
566 }
567 }
568
569 i++;
570 y += optionHeight;
571 }
572 }
573
574 /**
575 * Draw the area of this widget that falls within the clipping region.
576 * Called by the redraw() function to draw all visible regions.
577 *
578 * @param port The CGraphicsPort to draw to.
579 * @see redraw()
580 */
581
582 void CListBox::drawBorder(CGraphicsPort *port)
583 {
584 // Stop drawing if the widget indicates it should not have an outline
585
586 if (!isBorderless())
587 {
588 port->drawBevelledRect(0, 0, getWidth(), getHeight(),
589 getShadowEdgeColor(), getShineEdgeColor());
590 }
591 }
592
593 /**
594 * Determines which item was clicked and selects or deselects it as
595 * appropriate. Also starts the dragging system.
596 *
597 * @param x The x coordinate of the click.
598 * @param y The y coordinate of the click.
599 */
600
601 void CListBox::onClick(nxgl_coord_t x, nxgl_coord_t y)
602 {
603 // Calculate which option was clicked
604
605 m_lastSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
606
607 const CListBoxDataItem *item =
608 (const CListBoxDataItem*)m_options.getItem(m_lastSelectedIndex);
609
610 if (!item)
611 {
612 return; // No item at click position
613 }
614
615 // Are we selecting or de-selecting?
616
617 if (item->isSelected())
618 {
619 // Deselecting
620
621 m_options.deselectItem(m_lastSelectedIndex);
622 }
623 else
624 {
625 // Selecting
626
627 m_options.selectItem(m_lastSelectedIndex);
628 }
629
630 startDragging(x, y);
631 }
632
633 /**
634 * Selects the clicked item and deselects all others.
635 *
636 * @param x The x coordinate of the click.
637 * @param y The y coordinate of the click.
638 */
639
640 void CListBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
641 {
642 // Calculate which option was clicked
643
644 int newSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight();
645
646 // Double-click - select the item exclusively
647
648 deselectAllOptions();
649 setSelectedIndex(newSelectedIndex);
650 m_widgetEventHandlers->raiseActionEvent();
651 }
652
653 /**
654 * Select or deselect an option by its index. Does not deselect any other selected options.
655 * Set index to -1 to select nothing.
656 * Redraws the widget and raises a value changed event.
657 *
658 * @param index The index of the option to select.
659 * @param selected True to select the option, false to deselect it.
660 */
661
662 void CListBox::setOptionSelected(const int index, bool selected)
663 {
664 m_options.setItemSelected(index, selected);
665 }
NXWidgets::CListBox::getPreferredDimensions
virtual void getPreferredDimensions(CRect &rect) const
Definition: clistbox.cxx:371
NXWidgets::CListDataItem::isSelected
const bool isSelected(void) const
Definition: clistdataitem.hxx:155
NXWidgets::CNxWidget::m_borderSize
WidgetBorderSize m_borderSize
Definition: cnxwidget.hxx:208
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::CListBoxDataItem::getNormalTextColor
nxwidget_pixel_t getNormalTextColor(void) const
Definition: clistboxdataitem.hxx:137
NXWidgets::CListBoxDataItem::getNormalBackColor
nxwidget_pixel_t getNormalBackColor(void) const
Definition: clistboxdataitem.hxx:148
NXWidgets::CWidgetStyle
Definition: cwidgetstyle.hxx:125
NXWidgets::CRect::getHeight
nxgl_coord_t getHeight(void) const
Definition: crect.hxx:204
NXWidgets::CListData::getItem
virtual const CListDataItem * getItem(const int index) const
Definition: clistdata.hxx:260
NXWidgets::CNxWidget::isDoubleClick
virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:687
NXWidgets::CListBox::removeOption
virtual void removeOption(const int index)
Definition: clistbox.cxx:167
NXWidgets::CListBox::sort
virtual void sort(void)
Definition: clistbox.cxx:319
NXWidgets::CListBox::handleListDataSelectionChangedEvent
virtual void handleListDataSelectionChangedEvent(const CListDataEventArgs &e)
Definition: clistbox.cxx:356
NXWidgets::CListBox::m_options
CListData m_options
Definition: clistbox.hxx:117
NXWidgets::CWidgetControl
Definition: cwidgetcontrol.hxx:95
singletons.hxx
NXWidgets::CNxWidget::getRect
void getRect(CRect &rect) const
Definition: cnxwidget.cxx:448
NXWidgets::CListBox::resizeCanvas
virtual void resizeCanvas(void)
Definition: clistbox.cxx:289
NXWidgets::CListBox::setSelectedIndex
virtual void setSelectedIndex(const int index)
Definition: clistbox.cxx:269
NXWidgets::CListBox::onClick
virtual void onClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: clistbox.cxx:601
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::CScrollingPanel
Definition: cscrollingpanel.hxx:105
NXWidgets::CListBox::onDoubleClick
virtual void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: clistbox.cxx:640
NXWidgets::CListData::removeItem
virtual void removeItem(const int index)
Definition: clistdata.cxx:159
NXWidgets::CWidgetEventHandlerList::raiseActionEvent
void raiseActionEvent(void)
Definition: cwidgeteventhandlerlist.cxx:507
NXWidgets::CListBoxDataItem
Definition: clistboxdataitem.hxx:104
cgraphicsport.hxx
NXWidgets::CNxWidget::getBackgroundColor
nxgl_mxpixel_t getBackgroundColor(void) const
Definition: cnxwidget.hxx:716
NXWidgets::CListBox::deselectAllOptions
virtual void deselectAllOptions(void)
Definition: clistbox.cxx:243
NXWidgets::CListData::removeListDataEventHandler
void removeListDataEventHandler(IListDataEventHandler *eventHandler)
Definition: clistdata.cxx:346
NXWidgets::CListBoxDataItem::getSelectedBackColor
nxwidget_pixel_t getSelectedBackColor(void) const
Definition: clistboxdataitem.hxx:170
NXWidgets::CListBox::selectAllOptions
virtual void selectAllOptions(void)
Definition: clistbox.cxx:233
NXWidgets::CListBox::m_optionPadding
uint8_t m_optionPadding
Definition: clistbox.hxx:118
NXWidgets::CListBox::m_lastSelectedIndex
int m_lastSelectedIndex
Definition: clistbox.hxx:119
NXWidgets::CListBox::isDoubleClick
virtual bool isDoubleClick(nxgl_coord_t x, nxgl_coord_t y)
Definition: clistbox.cxx:416
cwidgetcontrol.hxx
NXWidgets::CListData::getSelectedItem
virtual const CListDataItem * getSelectedItem(void) const
Definition: clistdata.cxx:255
NXWidgets::nxwidget_pixel_t
uint8_t nxwidget_pixel_t
Definition: nxconfig.hxx:442
NXWidgets::CListDataEventArgs
Definition: clistdataeventargs.hxx:103
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::CScrollingPanel::m_canvasHeight
int32_t m_canvasHeight
Definition: cscrollingpanel.hxx:114
NXWidgets::CNxWidget::getEnabledTextColor
nxgl_mxpixel_t getEnabledTextColor(void) const
Definition: cnxwidget.hxx:782
NXWidgets::CListData::sort
virtual void sort(void)
Definition: clistdata.cxx:271
NXWidgets
Definition: cbgwindow.hxx:65
NXWidgets::CNxWidget::getHeight
nxgl_coord_t getHeight(void) const
Definition: cnxwidget.hxx:593
NXWidgets::CRect::setHeight
void setHeight(nxgl_coord_t height)
Definition: crect.hxx:261
NXWidgets::CNxWidget::m_rect
CRect m_rect
Definition: cnxwidget.hxx:172
NXWidgets::CNxWidget::WidgetBorderSize::left
uint8_t left
Definition: cnxwidget.hxx:167
NXWidgets::CListBox::~CListBox
virtual ~CListBox(void)
Definition: clistbox.cxx:130
NXWidgets::CNxWidget::getClientRect
void getClientRect(CRect &rect) const
Definition: cnxwidget.cxx:421
NXWidgets::CListBox::getOptionHeight
virtual const nxgl_coord_t getOptionHeight(void) const
Definition: clistbox.cxx:330
NXWidgets::CListBox::getSelectedIndex
virtual const int getSelectedIndex(void) const
Definition: clistbox.cxx:256
NXWidgets::CListData::getSelectedIndex
virtual const int getSelectedIndex(void) const
Definition: clistdata.cxx:222
NXWidgets::CRect::setX
void setX(nxgl_coord_t x)
Definition: crect.hxx:229
NXWidgets::CNxWidget::getSelectedBackgroundColor
nxgl_mxpixel_t getSelectedBackgroundColor(void) const
Definition: cnxwidget.hxx:727
NXWidgets::CListData::getItemCount
virtual const int getItemCount(void) const
Definition: clistdata.hxx:284
NXWidgets::CNxWidget::WidgetBorderSize::right
uint8_t right
Definition: cnxwidget.hxx:165
NXWidgets::CListData::removeAllItems
virtual void removeAllItems(void)
Definition: clistdata.cxx:202
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::CScrollingPanel::setAllowsHorizontalScroll
void setAllowsHorizontalScroll(bool allow)
Definition: cscrollingpanel.hxx:313
NXWidgets::CListData::deselectItem
virtual void deselectItem(const int index)
Definition: clistdata.cxx:193
NXWidgets::CNxWidget::getFont
CNxFont * getFont(void) const
Definition: cnxwidget.hxx:705
NXWidgets::CListBox::handleListDataChangedEvent
virtual void handleListDataChangedEvent(const CListDataEventArgs &e)
Definition: clistbox.cxx:341
NXWidgets::CListDataItem::getText
const CNxString & getText(void) const
Definition: clistdataitem.hxx:133
NXWidgets::CNxWidget::WidgetBorderSize::bottom
uint8_t bottom
Definition: cnxwidget.hxx:166
NXWidgets::CListBox::getSelectedOption
virtual const CListBoxDataItem * getSelectedOption(void) const
Definition: clistbox.cxx:280
NXWidgets::CListBox::drawBorder
virtual void drawBorder(CGraphicsPort *port)
Definition: clistbox.cxx:582
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::CListData::addListDataEventHandler
void addListDataEventHandler(IListDataEventHandler *eventHandler)
Definition: clistdata.hxx:341
NXWidgets::CNxFont::getHeight
const uint8_t getHeight(void) const
Definition: cnxfont.hxx:229
NXWidgets::CListBoxDataItem::getSelectedTextColor
nxwidget_pixel_t getSelectedTextColor(void) const
Definition: clistboxdataitem.hxx:159
NXWidgets::CNxWidget::m_widgetEventHandlers
CWidgetEventHandlerList * m_widgetEventHandlers
Definition: cnxwidget.hxx:191
NXWidgets::CListBox::setOptionSelected
virtual void setOptionSelected(const int index, const bool selected)
Definition: clistbox.cxx:662
NXWidgets::CNxString::getLength
const unsigned int getLength(void) const
Definition: cnxstring.hxx:325
NXWidgets::CRect
Definition: crect.hxx:101
NXWidgets::CListData::selectItem
virtual void selectItem(const int index)
Definition: clistdata.cxx:182
NXWidgets::CScrollingPanel::scroll
virtual void scroll(int32_t dx, int32_t dy)
Definition: cscrollingpanel.cxx:144
cnxfont.hxx
NXWidgets::CListBox::deselectOption
virtual void deselectOption(const int index)
Definition: clistbox.cxx:222
NXWidgets::CListBox::drawContents
virtual void drawContents(CGraphicsPort *port)
Definition: clistbox.cxx:446
NXWidgets::CNxWidget::getY
nxgl_coord_t getY(void) const
Definition: cnxwidget.cxx:261
NXWidgets::CRect::setWidth
void setWidth(nxgl_coord_t width)
Definition: crect.hxx:250
NXWidgets::CNxWidget::getWidth
nxgl_coord_t getWidth(void) const
Definition: cnxwidget.hxx:582
NXWidgets::CNxWidget::Flags::draggable
uint8_t draggable
Definition: cnxwidget.hxx:149
NXWidgets::CListData::deselectAllItems
virtual void deselectAllItems(void)
Definition: clistdata.cxx:299
NXWidgets::CNxString
Definition: cnxstring.hxx:121
NXWidgets::CRect::getY
nxgl_coord_t getY(void) const
Definition: crect.hxx:170
NXWidgets::CListBox::CListBox
CListBox(const CListBox &listBox)
Definition: clistbox.hxx:175
NXWidgets::CListData::selectAllItems
virtual void selectAllItems(void)
Definition: clistdata.cxx:282
NXWidgets::CNxWidget::getDisabledTextColor
nxgl_mxpixel_t getDisabledTextColor(void) const
Definition: cnxwidget.hxx:771
NXWidgets::CListBox::addOption
virtual void addOption(const CNxString &text, const uint32_t value)
Definition: clistbox.cxx:143
NXWidgets::CNxWidget::Flags::doubleClickable
uint8_t doubleClickable
Definition: cnxwidget.hxx:155
NXWidgets::CListBox::removeAllOptions
virtual void removeAllOptions(void)
Definition: clistbox.cxx:176
NXWidgets::CListData::setItemSelected
virtual void setItemSelected(const int index, const bool selected)
Definition: clistdata.cxx:317
clistbox.hxx
NXWidgets::CNxWidget::Flags::borderless
uint8_t borderless
Definition: cnxwidget.hxx:148
NXWidgets::CRect::setY
void setY(nxgl_coord_t y)
Definition: crect.hxx:240
NXWidgets::CNxWidget::startDragging
void startDragging(nxgl_coord_t x, nxgl_coord_t y)
Definition: cnxwidget.cxx:1542
NXWidgets::CGraphicsPort::drawText
void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string)
Definition: cgraphicsport.cxx:609
NXWidgets::CListData::addItem
virtual void addItem(const CNxString &text, const uint32_t value)
Definition: clistdata.cxx:119
NXWidgets::CScrollingPanel::m_canvasY
int32_t m_canvasY
Definition: cscrollingpanel.hxx:111
NXWidgets::CListBox::selectOption
virtual void selectOption(const int index)
Definition: clistbox.cxx:210
NXWidgets::CWidgetEventHandlerList::raiseValueChangeEvent
void raiseValueChangeEvent(void)
Definition: cwidgeteventhandlerlist.cxx:443
NXWidgets::CNxWidget::getSelectedTextColor
nxgl_mxpixel_t getSelectedTextColor(void) const
Definition: cnxwidget.hxx:793
NXWidgets::CGraphicsPort
Definition: cgraphicsport.hxx:106
NXWidgets::CNxWidget::m_flags
Flags m_flags
Definition: cnxwidget.hxx:187