NXWidgets: clistboxdataitem.hxx Source File

NXWidgets 1.19

clistboxdataitem.hxx
Go to the documentation of this file.
1 /****************************************************************************
2 * include/clistboxdataitem.hxx
3 * NxWidgets/libnxwidgets/
4 *
5 * Copyright (C) 2012 Gregory Nutt. All rights reserved.
6 * Author: Gregory Nutt <gnutt@nuttx.org>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
19 * me be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 ****************************************************************************
36 *
37 * Portions of this package derive from Woopsi (http://woopsi.org/) and
38 * portions are original efforts. It is difficult to determine at this
39 * point what parts are original efforts and which parts derive from Woopsi.
40 * However, in any event, the work of Antony Dzeryn will be acknowledged
41 * in most NxWidget files. Thanks Antony!
42 *
43 * Copyright (c) 2007-2011, Antony Dzeryn
44 * All rights reserved.
45 *
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions are met:
48 *
49 * * Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * * Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * * Neither the names "Woopsi", "Simian Zombie" nor the
55 * names of its contributors may be used to endorse or promote products
56 * derived from this software without specific prior written permission.
57 *
58 * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
59 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
60 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61 * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
62 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
63 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
64 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
65 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
66 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
67 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 *
69 ****************************************************************************/
70
71 #ifndef __INCLUDE_CLISTBOXDATAITEM_HXX
72 #define __INCLUDE_CLISTBOXDATAITEM_HXX
73
74 /****************************************************************************
75 * Included Files
76 ****************************************************************************/
77
78 #include <nuttx/config.h>
79
80 #include <stdint.h>
81 #include <stdbool.h>
82
83 #include <nuttx/nx/nxglib.h>
84
85 #include "clistdataitem.hxx"
86 #include "cnxstring.hxx"
87
88 /****************************************************************************
89 * Pre-Processor Definitions
90 ****************************************************************************/
91
92 /****************************************************************************
93 * Implementation Classes
94 ****************************************************************************/
95
96 #if defined(__cplusplus)
97
98 namespace NXWidgets
99 {
100 /**
101 * Class representing a data item within a ListBox.
102 */
103
104 class CListBoxDataItem : public CListDataItem
105 {
106 private:
107 nxwidget_pixel_t m_normalTextColor; /**< Color used for text when not selected. */
108 nxwidget_pixel_t m_normalBackColor; /**< Color used for background when not selected. */
109 nxwidget_pixel_t m_selectedTextColor; /**< Color used for text when selected. */
110 nxwidget_pixel_t m_selectedBackColor; /**< Color used for background when selected. */
111
112 public:
113
114 /**
115 * Constructor.
116 *
117 * @param text The text to display in the item.
118 * @param value The value of the item.
119 * @param normalTextColor Color to draw the text with when not selected.
120 * @param normalBackColor Color to draw the background with when not selected.
121 * @param selectedTextColor Color to draw the text with when selected.
122 * @param selectedBackColor Color to draw the background with when selected.
123 */
124
125 CListBoxDataItem(const CNxString &text, const uint32_t value,
126 const nxwidget_pixel_t normalTextColor,
127 const nxwidget_pixel_t normalBackColor,
128 const nxwidget_pixel_t selectedTextColor,
129 const nxwidget_pixel_t selectedBackColor);
130
131 /**
132 * Get the color used for text when the item is unselected.
133 *
134 * @return The text color when the item is unselected.
135 */
136
137 inline nxwidget_pixel_t getNormalTextColor(void) const
138 {
139 return m_normalTextColor;
140 }
141
142 /**
143 * Get the color used for the background when the item is unselected.
144 *
145 * @return The background color when the item is unselected.
146 */
147
148 inline nxwidget_pixel_t getNormalBackColor(void) const
149 {
150 return m_normalBackColor;
151 }
152
153 /**
154 * Get the color used for text when the item is selected.
155 *
156 * @return The text color when the item is selected.
157 */
158
159 inline nxwidget_pixel_t getSelectedTextColor(void) const
160 {
161 return m_selectedTextColor;
162 }
163
164 /**
165 * Get the color used for the background when the item is selected.
166 *
167 * @return The background color when the item is selected.
168 */
169
170 inline nxwidget_pixel_t getSelectedBackColor(void) const
171 {
172 return m_selectedBackColor;
173 }
174 };
175 }
176
177 #endif // __cplusplus
178
179 #endif // __INCLUDE_CLISTBOXDATAITEM_HXX
180
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::CListBoxDataItem::CListBoxDataItem
CListBoxDataItem(const CNxString &text, const uint32_t value, const nxwidget_pixel_t normalTextColor, const nxwidget_pixel_t normalBackColor, const nxwidget_pixel_t selectedTextColor, const nxwidget_pixel_t selectedBackColor)
Definition: clistboxdataitem.cxx:103
NXWidgets::CListBoxDataItem::m_normalBackColor
nxwidget_pixel_t m_normalBackColor
Definition: clistboxdataitem.hxx:108
NXWidgets::CListDataItem
Definition: clistdataitem.hxx:103
NXWidgets::CListBoxDataItem
Definition: clistboxdataitem.hxx:104
NXWidgets::CListBoxDataItem::m_normalTextColor
nxwidget_pixel_t m_normalTextColor
Definition: clistboxdataitem.hxx:107
NXWidgets::CListBoxDataItem::getSelectedBackColor
nxwidget_pixel_t getSelectedBackColor(void) const
Definition: clistboxdataitem.hxx:170
NXWidgets::nxwidget_pixel_t
uint8_t nxwidget_pixel_t
Definition: nxconfig.hxx:442
NXWidgets
Definition: cbgwindow.hxx:65
NXWidgets::CListBoxDataItem::m_selectedBackColor
nxwidget_pixel_t m_selectedBackColor
Definition: clistboxdataitem.hxx:110
NXWidgets::CListBoxDataItem::getSelectedTextColor
nxwidget_pixel_t getSelectedTextColor(void) const
Definition: clistboxdataitem.hxx:159
NXWidgets::CNxString
Definition: cnxstring.hxx:121
clistdataitem.hxx
cnxstring.hxx
NXWidgets::CListBoxDataItem::m_selectedTextColor
nxwidget_pixel_t m_selectedTextColor
Definition: clistboxdataitem.hxx:109