diff options
Diffstat (limited to 'NxWidgets/libnxwidgets/src')
72 files changed, 920 insertions, 920 deletions
diff --git a/NxWidgets/libnxwidgets/src/cbgwindow.cxx b/NxWidgets/libnxwidgets/src/cbgwindow.cxx index 268bc5d80..2cb3d2389 100644 --- a/NxWidgets/libnxwidgets/src/cbgwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cbgwindow.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -63,7 +63,7 @@ using namespace NXWidgets; * @param hNxServer Handle to the NX server. * @param widgetControl Controlling widget for this window. */ - + CBgWindow::CBgWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl) : CCallback(pWidgetControl), m_hNxServer(hNxServer), m_hWindow(0), m_widgetControl(pWidgetControl) @@ -76,7 +76,7 @@ CBgWindow::CBgWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl) /** * Destructor. Returns the background window to the server. */ - + CBgWindow::~CBgWindow(void) { // Release the background. We do not release the widget control @@ -134,7 +134,7 @@ CWidgetControl *CBgWindow::getWidgetControl(void) const * * @return Always returns true. */ - + bool CBgWindow::requestPosition(void) { // The background window is always at {0,0} and the size never changes. @@ -178,7 +178,7 @@ bool CBgWindow::getSize(FAR struct nxgl_size_s *pSize) * @param pPos The new position of the window. * @return Always returns false. */ - + bool CBgWindow::setPosition(FAR const struct nxgl_point_s *pPos) { // The position of the background cannot be changed @@ -194,7 +194,7 @@ bool CBgWindow::setPosition(FAR const struct nxgl_point_s *pPos) * @param pSize The new size of the window. * @return Always returns false. */ - + bool CBgWindow::setSize(FAR const struct nxgl_size_s *pSize) { // The position of the background cannot be changed diff --git a/NxWidgets/libnxwidgets/src/cbitmap.cxx b/NxWidgets/libnxwidgets/src/cbitmap.cxx index c0cf71ea4..1a7294f38 100644 --- a/NxWidgets/libnxwidgets/src/cbitmap.cxx +++ b/NxWidgets/libnxwidgets/src/cbitmap.cxx @@ -84,7 +84,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * Method Implementations ****************************************************************************/ @@ -180,7 +180,7 @@ bool CBitmap::getRun(nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, // is an even multiple of bytes). FAR uint8_t *start = (FAR uint8_t*)m_bitmap->data + - y * m_bitmap->stride + + y * m_bitmap->stride + ((x * m_bitmap->bpp) >> 3); // Get the number of bytes to copy. diff --git a/NxWidgets/libnxwidgets/src/cbutton.cxx b/NxWidgets/libnxwidgets/src/cbutton.cxx index 429905759..24af6f48d 100644 --- a/NxWidgets/libnxwidgets/src/cbutton.cxx +++ b/NxWidgets/libnxwidgets/src/cbutton.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -140,12 +140,12 @@ void CButton::drawOutline(CGraphicsPort *port, bool useClicked) { return; } - + // Work out which colors to use nxgl_coord_t color1; nxgl_coord_t color2; - + if (useClicked) { // Bevelled into the screen @@ -160,7 +160,7 @@ void CButton::drawOutline(CGraphicsPort *port, bool useClicked) color1 = getShineEdgeColor(); color2 = getShadowEdgeColor(); } - + port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(), color1, color2); } diff --git a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx index 28f14062b..4efc99f13 100644 --- a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx +++ b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -51,7 +51,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * CButtonArray Method Implementations ****************************************************************************/ @@ -79,7 +79,7 @@ CButtonArray::CButtonArray(CWidgetControl *pWidgetControl, nxgl_coord_t buttonWidth, nxgl_coord_t buttonHeight, CWidgetStyle *style) : CNxWidget(pWidgetControl, x, y, - buttonColumns * buttonWidth + 2, buttonRows * buttonHeight + 2, + buttonColumns * buttonWidth + 2, buttonRows * buttonHeight + 2, 0, style) { // Save configuration @@ -367,7 +367,7 @@ void CButtonArray::drawContents(CGraphicsPort *port) { int column; int row; - + // Just one. Get the row/column indices from the last click (void)posToButton(m_clickX, m_clickY, column, row); @@ -452,7 +452,7 @@ void CButtonArray::drawButton(CGraphicsPort *port, int column, int row, bool use if (useClicked || isCursorPosition(column, row)) { // "Selected" text color on unique "Selected" background color - + backColor = getSelectedBackgroundColor(); textColor = getSelectedTextColor(); } @@ -465,7 +465,7 @@ void CButtonArray::drawButton(CGraphicsPort *port, int column, int row, bool use } // Pick the border colors. Should we use the 'clicked' button style? - + if (useClicked) { // Yes.. Bevelled into the screen diff --git a/NxWidgets/libnxwidgets/src/ccheckbox.cxx b/NxWidgets/libnxwidgets/src/ccheckbox.cxx index a6cc9400a..d10e3b410 100644 --- a/NxWidgets/libnxwidgets/src/ccheckbox.cxx +++ b/NxWidgets/libnxwidgets/src/ccheckbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/ccyclebutton.cxx b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx index b4dff685b..c17571830 100644 --- a/NxWidgets/libnxwidgets/src/ccyclebutton.cxx +++ b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -305,7 +305,7 @@ void CCycleButton::getPreferredDimensions(CRect &rect) const void CCycleButton::drawContents(CGraphicsPort *port) { // Get the drawing region (excluding any border) - + CRect rect; getRect(rect); @@ -393,12 +393,12 @@ void CCycleButton::drawOutline(CGraphicsPort *port) { return; } - + // Work out which colors to use nxgl_coord_t color1; nxgl_coord_t color2; - + if (isClicked()) { // Bevelled into the screen @@ -413,7 +413,7 @@ void CCycleButton::drawOutline(CGraphicsPort *port) color1 = getShineEdgeColor(); color2 = getShadowEdgeColor(); } - + port->drawBevelledRect(getX(), getY(), getWidth(), getHeight(), color1, color2); } @@ -447,7 +447,7 @@ void CCycleButton::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) } redraw(); - + CButton::onPreRelease(x, y); } diff --git a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx index 93984e1bc..786cbec9f 100644 --- a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx +++ b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontal.cxx @@ -105,10 +105,10 @@ using namespace NXWidgets; * @param height The height of the slider. */ -CGlyphSliderHorizontal::CGlyphSliderHorizontal(CWidgetControl * pWidgetControl, - nxgl_coord_t x, nxgl_coord_t y, - nxgl_coord_t width, nxgl_coord_t height, - IBitmap * pGripBitmap, +CGlyphSliderHorizontal::CGlyphSliderHorizontal(CWidgetControl * pWidgetControl, + nxgl_coord_t x, nxgl_coord_t y, + nxgl_coord_t width, nxgl_coord_t height, + IBitmap * pGripBitmap, nxwidget_pixel_t fillColor, bool fill) :CNxWidget(pWidgetControl, x, y, width, height, WIDGET_DRAGGABLE) { @@ -389,11 +389,11 @@ void CGlyphSliderHorizontal::drawBorder(CGraphicsPort * port) nxwidget_pixel_t shadow; y1 = getY() + (getHeight() >> 1) - (m_barThickness >> 1); - y2 = getY() + (getHeight() >> 1) + m_barThickness - + y2 = getY() + (getHeight() >> 1) + m_barThickness - (m_barThickness >> 1) - 1; // To the Left of the grip. Only draw if the icon isn't covering the - // edge of the bar + // edge of the bar width = gripX - x - halfGripWidth; if (width > 0) @@ -416,7 +416,7 @@ void CGlyphSliderHorizontal::drawBorder(CGraphicsPort * port) } // To the Right of the grip - // Only draw if the icon isn't covering the edge of the bar + // Only draw if the icon isn't covering the edge of the bar width = getWidth() - (gripX - x + gripWidth) - 1 - halfGripWidth; if (width > 0) @@ -434,7 +434,7 @@ void CGlyphSliderHorizontal::drawBorder(CGraphicsPort * port) if (gripX > x + halfGripWidth) { - port->drawVertLine(x + halfGripWidth, y1, m_barThickness, + port->drawVertLine(x + halfGripWidth, y1, m_barThickness, getShineEdgeColor()); } @@ -442,7 +442,7 @@ void CGlyphSliderHorizontal::drawBorder(CGraphicsPort * port) if (gripX + gripWidth < x + getWidth() - 1 - halfGripWidth) { - port->drawVertLine(x + getWidth() - 1 - halfGripWidth, + port->drawVertLine(x + getWidth() - 1 - halfGripWidth, y1, m_barThickness, getShadowEdgeColor()); } } diff --git a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontalgrip.cxx b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontalgrip.cxx index 331ec8d8b..6e7be0af2 100644 --- a/NxWidgets/libnxwidgets/src/cglyphsliderhorizontalgrip.cxx +++ b/NxWidgets/libnxwidgets/src/cglyphsliderhorizontalgrip.cxx @@ -72,7 +72,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include "cglyphsliderhorizontalgrip.hxx" #include "ibitmap.hxx" @@ -100,7 +100,7 @@ CGlyphSliderHorizontalGrip::CGlyphSliderHorizontalGrip(CWidgetControl *pWidgetCo nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, IBitmap *pGripBitmap) -: CImage(pWidgetControl, 0, (height>>1) - (pGripBitmap->getHeight() >> 1), +: CImage(pWidgetControl, 0, (height>>1) - (pGripBitmap->getHeight() >> 1), pGripBitmap->getWidth(), pGripBitmap->getHeight(), pGripBitmap, 0) { diff --git a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx index 85548a381..cbda90d6e 100644 --- a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx +++ b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -401,7 +401,7 @@ void CGraphicsPort::drawBitmap(nxgl_coord_t x, nxgl_coord_t y, bitmapY * bitmap->stride + ((bitmapX * bitmap->bpp + 7) >> 3); FAR nxwidget_pixel_t *srcPtr = (nxwidget_pixel_t *)srcLine; - + // Loop until all rows have been displayed nxgl_coord_t firstX = x; @@ -552,7 +552,7 @@ void CGraphicsPort::drawBitmapGreyScale(nxgl_coord_t x, nxgl_coord_t y, dest.pt2.y = y; // Convert each row to greyscale and send it to the display - + for (int row = 0; row < height; row++) { // Convert the next row @@ -571,7 +571,7 @@ void CGraphicsPort::drawBitmapGreyScale(nxgl_coord_t x, nxgl_coord_t y, // A truly accurate greyscale conversion would be complex. Let's // just average. - + nxwidget_pixel_t avg = (r + g + b) / 3; *runDest++ = MKRGB(avg, avg, avg); } @@ -679,9 +679,9 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, { nxgl_mxpixel_t savedColor = font->getColor(); font->setColor(color); - + _drawText(pos, bound, font, string, startIndex, length, background, false); - + font->setColor(savedColor); } @@ -727,7 +727,7 @@ void CGraphicsPort::_drawText(struct nxgl_point_s *pos, CRect *bound, background = m_backColor; } #endif - + // Allocate a bit of memory to hold the largest rendered font unsigned int bmWidth = ((unsigned int)font->getMaxWidth() * CONFIG_NXWIDGETS_BPP + 7) >> 3; @@ -740,7 +740,7 @@ void CGraphicsPort::_drawText(struct nxgl_point_s *pos, CRect *bound, struct nxgl_rect_s boundingBox; bound->getNxRect(&boundingBox); - + // Loop setup struct SBitmap bitmap; @@ -796,7 +796,7 @@ void CGraphicsPort::_drawText(struct nxgl_point_s *pos, CRect *bound, // If we have been given a background color, use it to fill the array. // Otherwise initialize the bitmap memory by reading from the display. // The font renderer always renders the fonts on a transparent background. - + if (!transparent) { // Set the glyph memory to the background color @@ -829,7 +829,7 @@ void CGraphicsPort::_drawText(struct nxgl_point_s *pos, CRect *bound, } } - // Adjust the X position for the next character in the string + // Adjust the X position for the next character in the string pos->x += fontWidth; } diff --git a/NxWidgets/libnxwidgets/src/ckeypad.cxx b/NxWidgets/libnxwidgets/src/ckeypad.cxx index 898885c62..8d9089081 100644 --- a/NxWidgets/libnxwidgets/src/ckeypad.cxx +++ b/NxWidgets/libnxwidgets/src/ckeypad.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -65,7 +65,7 @@ using namespace NXWidgets; static FAR const char *g_alphaLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = { - "=>", "A", "B", "<DEL", + "=>", "A", "B", "<DEL", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", @@ -75,7 +75,7 @@ static FAR const char *g_alphaLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = { }; static FAR const char *g_numLabels[BUTTONARRAY_NCOLUMNS*BUTTONARRAY_NROWS] = { - "=>", "0", "1", "<DEL", + "=>", "0", "1", "<DEL", "2", "3", "4", "5", "6", "7", "8", "9", "-", "#", "*", "&", @@ -211,4 +211,4 @@ void CKeypad::configureKeypadMode(void) onTextChange(); } - + diff --git a/NxWidgets/libnxwidgets/src/clatchbutton.cxx b/NxWidgets/libnxwidgets/src/clatchbutton.cxx index 673d50319..f344b726c 100644 --- a/NxWidgets/libnxwidgets/src/clatchbutton.cxx +++ b/NxWidgets/libnxwidgets/src/clatchbutton.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx b/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx index d8292941b..a96e1546d 100644 --- a/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx +++ b/NxWidgets/libnxwidgets/src/clatchbuttonarray.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/clistbox.cxx b/NxWidgets/libnxwidgets/src/clistbox.cxx index a8d3db0a6..d37915e42 100644 --- a/NxWidgets/libnxwidgets/src/clistbox.cxx +++ b/NxWidgets/libnxwidgets/src/clistbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -465,12 +465,12 @@ void CListBox::drawContents(CGraphicsPort *port) // Precalc values for option draw loop nxgl_coord_t optionHeight = getOptionHeight(); - + // Ensure that we subtract 1 from topOption to ensure that the option // above is drawn if it is partially visible int topOption = ((clipY - m_canvasY) / optionHeight) - 1; - + // Ensure that we add 2 to the bottom option to ensure that the option // below is draw if it is partially visible - subbing 1 from topOption // means we need to add an additional 1 to compensate @@ -503,7 +503,7 @@ void CListBox::drawContents(CGraphicsPort *port) while (i <= bottomOption) { item = (const CListBoxDataItem*)m_options.getItem(i); - + // Is the option selected? if (item->isSelected()) @@ -516,13 +516,13 @@ void CListBox::drawContents(CGraphicsPort *port) rect.getWidth(), optionHeight, item->getSelectedBackColor()); } - + // Draw text struct nxgl_point_s pos; pos.x = rect.getX() + m_optionPadding; pos.y = rect.getY() + y + m_optionPadding; - + if (isEnabled()) { port->drawText(&pos, &rect, getFont(), item->getText(), 0, @@ -551,7 +551,7 @@ void CListBox::drawContents(CGraphicsPort *port) struct nxgl_point_s pos; pos.x = rect.getX() + m_optionPadding; pos.y = rect.getY() + y + m_optionPadding; - + if (isEnabled()) { port->drawText(&pos, &rect, getFont(), item->getText(), 0, @@ -602,8 +602,8 @@ void CListBox::onClick(nxgl_coord_t x, nxgl_coord_t y) { // Calculate which option was clicked - m_lastSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight(); - + m_lastSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight(); + const CListBoxDataItem *item = (const CListBoxDataItem*)m_options.getItem(m_lastSelectedIndex); @@ -637,7 +637,7 @@ void CListBox::onDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { // Calculate which option was clicked - int newSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight(); + int newSelectedIndex = (-m_canvasY + (y - getY())) / getOptionHeight(); // Double-click - select the item exclusively diff --git a/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx b/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx index 0ef1b2d25..22a9323bb 100644 --- a/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx +++ b/NxWidgets/libnxwidgets/src/clistboxdataitem.cxx @@ -1,114 +1,114 @@ -/****************************************************************************
- * NxWidgets/libnxwidgets/src/clistboxdataitem.cxx
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
- * me be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- *
- * Portions of this package derive from Woopsi (http://woopsi.org/) and
- * portions are original efforts. It is difficult to determine at this
- * point what parts are original efforts and which parts derive from Woopsi.
- * However, in any event, the work of Antony Dzeryn will be acknowledged
- * in most NxWidget files. Thanks Antony!
- *
- * Copyright (c) 2007-2011, Antony Dzeryn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the names "Woopsi", "Simian Zombie" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "cwidgetcontrol.hxx"
-#include "clistboxdataitem.hxx"
-
-/****************************************************************************
- * Pre-Processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Method Implementations
- ****************************************************************************/
-
-using namespace NXWidgets;
-
-/**
- * Constructor.
- *
- * @param text The text to display in the item.
- * @param value The value of the item.
- * @param normalTextColor Color to draw the text with when not selected.
- * @param normalBackColor Color to draw the background with when not selected.
- * @param selectedTextColor Color to draw the text with when selected.
- * @param selectedBackColor Color to draw the background with when selected.
- */
-
-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)
-: CListDataItem(text, value)
-{
- m_normalTextColor = normalTextColor;
- m_normalBackColor = normalBackColor;
- m_selectedTextColor = selectedTextColor;
- m_selectedBackColor = selectedBackColor;
-}
+/**************************************************************************** + * NxWidgets/libnxwidgets/src/clistboxdataitem.cxx + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors + * me be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************** + * + * Portions of this package derive from Woopsi (http://woopsi.org/) and + * portions are original efforts. It is difficult to determine at this + * point what parts are original efforts and which parts derive from Woopsi. + * However, in any event, the work of Antony Dzeryn will be acknowledged + * in most NxWidget files. Thanks Antony! + * + * Copyright (c) 2007-2011, Antony Dzeryn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the names "Woopsi", "Simian Zombie" nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> +#include <stdbool.h> + +#include "cwidgetcontrol.hxx" +#include "clistboxdataitem.hxx" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Method Implementations + ****************************************************************************/ + +using namespace NXWidgets; + +/** + * Constructor. + * + * @param text The text to display in the item. + * @param value The value of the item. + * @param normalTextColor Color to draw the text with when not selected. + * @param normalBackColor Color to draw the background with when not selected. + * @param selectedTextColor Color to draw the text with when selected. + * @param selectedBackColor Color to draw the background with when selected. + */ + +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) +: CListDataItem(text, value) +{ + m_normalTextColor = normalTextColor; + m_normalBackColor = normalBackColor; + m_selectedTextColor = selectedTextColor; + m_selectedBackColor = selectedBackColor; +} diff --git a/NxWidgets/libnxwidgets/src/clistdata.cxx b/NxWidgets/libnxwidgets/src/clistdata.cxx index 3b9601fc0..7a02e3e37 100644 --- a/NxWidgets/libnxwidgets/src/clistdata.cxx +++ b/NxWidgets/libnxwidgets/src/clistdata.cxx @@ -1,462 +1,462 @@ -/****************************************************************************
- * NxWidgets/libnxwidgets/src/clistdata.cxx
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
- * me be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- *
- * Portions of this package derive from Woopsi (http://woopsi.org/) and
- * portions are original efforts. It is difficult to determine at this
- * point what parts are original efforts and which parts derive from Woopsi.
- * However, in any event, the work of Antony Dzeryn will be acknowledged
- * in most NxWidget files. Thanks Antony!
- *
- * Copyright (c) 2007-2011, Antony Dzeryn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the names "Woopsi", "Simian Zombie" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <cstring>
-
-#include "clistdata.hxx"
-#include "ilistdataeventhandler.hxx"
-
-/****************************************************************************
- * Pre-Processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Method Implementations
- ****************************************************************************/
-
-using namespace NXWidgets;
-
-/**
- * Constructor.
- */
-
-CListData::CListData(void)
-{
- m_allowMultipleSelections = true;
- m_sortInsertedItems = false;
-}
-
-/**
- * Destructor.
- */
-
-CListData::~CListData(void)
-{
- removeAllItems();
-}
-
-/**
- * Add a new item.
- *
- * @param text Text to show in the option.
- * @param value The value of the option.
- */
-
-void CListData::addItem(const CNxString &text, const uint32_t value)
-{
- // Create new option
-
- addItem(new CListDataItem(text, value));
-}
-
-/**
- * Add an existing item. CListData becomes the owner of the option and will delete it
- * when the list is deleted.
- *
- * @param item The item to add.
- */
-
-void CListData::addItem(CListDataItem *item)
-{
- // Determine insert type
-
- if (m_sortInsertedItems)
- {
- // Sorted insert
-
- m_items.insert(getSortedInsertionIndex(item), item);
- }
- else
- {
- // Append
-
- m_items.push_back(item);
- }
-
- raiseDataChangedEvent();
-}
-
-/**
- * Remove an item by its index.
- *
- * @param index The index of the option to remove.
- */
-
-void CListData::removeItem(const int index)
-{
- // Bounds check
-
- if (index < m_items.size())
- {
- // Delete the option
-
- delete m_items[index];
-
- // Erase the option from the list
-
- m_items.erase(index);
- raiseDataChangedEvent();
- }
-}
-
-/**
- * Select an item by its index.
- *
- * @param index The index of the item to select.
- */
-
-void CListData::selectItem(const int index)
-{
- setItemSelected(index, true);
-}
-
-/**
- * Deselect an item by its index.
- *
- * @param index The index of the item to select.
- */
-
-void CListData::deselectItem(const int index)
-{
- setItemSelected(index, false);
-}
-
-/**
- * Remove all items.
- */
-
-void CListData::removeAllItems(void)
-{
- // Delete all option data
-
- for (int i = 0; i < m_items.size(); i++)
- {
- delete m_items[i];
- }
-
- m_items.clear();
- raiseDataChangedEvent();
-}
-
-/**
- * Get the selected index. Returns -1 if nothing is selected. If more than one
- * item is selected, the index of the first selected item is returned.
- *
- * @return The selected index.
- */
-
-const int CListData::getSelectedIndex(void) const
-{
- // Get the first selected index
-
- for (int i = 0; i < m_items.size(); i++)
- {
- if (m_items[i]->isSelected())
- {
- return i;
- }
- }
-
- return -1;
-}
-
-/**
- * Sets the selected index. Specify -1 to select nothing. Resets any
- * other selected items to deselected.
- *
- * @param index The selected index.
- */
-
-void CListData::setSelectedIndex(const int index)
-{
- setItemSelected(index, true);
-}
-
-/**
- * Get the selected item. Returns NULL if nothing is selected.
- *
- * @return The selected option.
- */
-
-const CListDataItem *CListData::getSelectedItem(void) const
-{
- // Get the first selected option
-
- int index = getSelectedIndex();
- if (index > -1)
- {
- return m_items[index];
- }
- return (CListDataItem *)NULL;
-}
-
-/**
- * Sort the items using their compareTo() methods.
- */
-
-void CListData::sort(void)
-{
- quickSort(0, m_items.size() - 1);
- raiseDataChangedEvent();
-}
-
-/**
- * Select all items. Does nothing if the list does not allow
- * multiple selections.
- */
-
-void CListData::selectAllItems(void)
-{
- if (m_allowMultipleSelections)
- {
- for (int i = 0; i < m_items.size(); i++)
- {
- m_items[i]->setSelected(true);
- }
-
- raiseSelectionChangedEvent();
- }
-}
-
-/**
- * Deselect all items.
- */
-
-void CListData::deselectAllItems(void)
-{
- for (int i = 0; i < m_items.size(); i++)
- {
- m_items[i]->setSelected(false);
- }
-
- raiseSelectionChangedEvent();
-}
-
-/**
- * Select or deselect an item by its index. Does not deselect any
- * other selected items. Set index to -1 to select nothing.
- *
- * @param index The index of the item to select.
- * @param selected True to select the item, false to deselect it.
- */
-
-void CListData::setItemSelected(const int index, bool selected)
-{
- // Deselect old options if we're making an option selected and
- // we're not a multiple list
-
- if (((!m_allowMultipleSelections) || (index == -1)) && (selected))
- {
- for (int i = 0; i < m_items.size(); i++)
- {
- m_items[i]->setSelected(false);
- }
- }
-
- // Select or deselect the new option
-
- if ((index > -1) && (index < m_items.size()))
- {
- m_items[index]->setSelected(selected);
- }
-
- raiseSelectionChangedEvent();
-}
-
-/**
- * Remove an event handler.
- *
- * @param eventHandler The event handler to remove.
- */
-
-void CListData::removeListDataEventHandler(IListDataEventHandler *eventHandler)
-{
- for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
- {
- if (m_listDataEventhandlers.at(i) == eventHandler)
- {
- m_listDataEventhandlers.erase(i);
- return;
- }
- }
-}
-
-/**
- * Quick sort the items using their compareTo() methods.
- *
- * @param start The index to start sorting at.
- * @param end The index to stop sorting at.
- */
-
-void CListData::quickSort(const int start, const int end)
-{
- if (end > start)
- {
- int left = start;
- int right = end;
-
- CListDataItem *pivot = m_items[(start + end) >> 1];
-
- do
- {
- while ((pivot->compareTo(m_items[left]) > 0) && (left < end))
- {
- left++;
- }
-
- while ((pivot->compareTo(m_items[right]) < 0) && (right > start))
- {
- right--;
- }
-
- if (left > right)
- {
- break;
- }
-
- swapItems(left, right);
- left++;
- right--;
- }
- while (left <= right);
-
- quickSort(start, right);
- quickSort(left, end);
- }
-}
-
-/**
- * Swap the locations of two items in the array.
- *
- * @param index1 The index of the first item to swap.
- * @param index2 The index of the second item to swap.
- */
-
-void CListData::swapItems(const int index1, const int index2)
-{
- CListDataItem *tmp = m_items[index1];
- m_items[index1] = m_items[index2];
- m_items[index2] = tmp;
-}
-
-/**
- * Return the index that an item should be inserted at to maintain a sorted list of data.
- *
- * @param item The item to insert.
- * @return The index that the item should be imserted into at.
- */
-
-const int CListData::getSortedInsertionIndex(const CListDataItem *item) const
-{
- int i = 0;
-
- // Locate slot where new option should go
-
- while ((i < m_items.size()) && (item->compareTo(m_items[i]) > 0))
- {
- i++;
- }
- return i;
-}
-
-/**
- * Raise a data changed event.
- */
-
-void CListData::raiseDataChangedEvent(void)
-{
- CListDataEventArgs eventArgs(this);
-
- for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
- {
- m_listDataEventhandlers.at(i)->handleListDataChangedEvent(eventArgs);
- }
-}
-
-/**
- * Raise a selection changed event.
- */
-
-void CListData::raiseSelectionChangedEvent(void)
-{
- CListDataEventArgs eventArgs(this);
-
- for (int i = 0; i < m_listDataEventhandlers.size(); ++i)
- {
- m_listDataEventhandlers.at(i)->handleListDataSelectionChangedEvent(eventArgs);
- }
-}
+/**************************************************************************** + * NxWidgets/libnxwidgets/src/clistdata.cxx + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors + * me be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************** + * + * Portions of this package derive from Woopsi (http://woopsi.org/) and + * portions are original efforts. It is difficult to determine at this + * point what parts are original efforts and which parts derive from Woopsi. + * However, in any event, the work of Antony Dzeryn will be acknowledged + * in most NxWidget files. Thanks Antony! + * + * Copyright (c) 2007-2011, Antony Dzeryn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the names "Woopsi", "Simian Zombie" nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> +#include <stdbool.h> +#include <cstring> + +#include "clistdata.hxx" +#include "ilistdataeventhandler.hxx" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Method Implementations + ****************************************************************************/ + +using namespace NXWidgets; + +/** + * Constructor. + */ + +CListData::CListData(void) +{ + m_allowMultipleSelections = true; + m_sortInsertedItems = false; +} + +/** + * Destructor. + */ + +CListData::~CListData(void) +{ + removeAllItems(); +} + +/** + * Add a new item. + * + * @param text Text to show in the option. + * @param value The value of the option. + */ + +void CListData::addItem(const CNxString &text, const uint32_t value) +{ + // Create new option + + addItem(new CListDataItem(text, value)); +} + +/** + * Add an existing item. CListData becomes the owner of the option and will delete it + * when the list is deleted. + * + * @param item The item to add. + */ + +void CListData::addItem(CListDataItem *item) +{ + // Determine insert type + + if (m_sortInsertedItems) + { + // Sorted insert + + m_items.insert(getSortedInsertionIndex(item), item); + } + else + { + // Append + + m_items.push_back(item); + } + + raiseDataChangedEvent(); +} + +/** + * Remove an item by its index. + * + * @param index The index of the option to remove. + */ + +void CListData::removeItem(const int index) +{ + // Bounds check + + if (index < m_items.size()) + { + // Delete the option + + delete m_items[index]; + + // Erase the option from the list + + m_items.erase(index); + raiseDataChangedEvent(); + } +} + +/** + * Select an item by its index. + * + * @param index The index of the item to select. + */ + +void CListData::selectItem(const int index) +{ + setItemSelected(index, true); +} + +/** + * Deselect an item by its index. + * + * @param index The index of the item to select. + */ + +void CListData::deselectItem(const int index) +{ + setItemSelected(index, false); +} + +/** + * Remove all items. + */ + +void CListData::removeAllItems(void) +{ + // Delete all option data + + for (int i = 0; i < m_items.size(); i++) + { + delete m_items[i]; + } + + m_items.clear(); + raiseDataChangedEvent(); +} + +/** + * Get the selected index. Returns -1 if nothing is selected. If more than one + * item is selected, the index of the first selected item is returned. + * + * @return The selected index. + */ + +const int CListData::getSelectedIndex(void) const +{ + // Get the first selected index + + for (int i = 0; i < m_items.size(); i++) + { + if (m_items[i]->isSelected()) + { + return i; + } + } + + return -1; +} + +/** + * Sets the selected index. Specify -1 to select nothing. Resets any + * other selected items to deselected. + * + * @param index The selected index. + */ + +void CListData::setSelectedIndex(const int index) +{ + setItemSelected(index, true); +} + +/** + * Get the selected item. Returns NULL if nothing is selected. + * + * @return The selected option. + */ + +const CListDataItem *CListData::getSelectedItem(void) const +{ + // Get the first selected option + + int index = getSelectedIndex(); + if (index > -1) + { + return m_items[index]; + } + return (CListDataItem *)NULL; +} + +/** + * Sort the items using their compareTo() methods. + */ + +void CListData::sort(void) +{ + quickSort(0, m_items.size() - 1); + raiseDataChangedEvent(); +} + +/** + * Select all items. Does nothing if the list does not allow + * multiple selections. + */ + +void CListData::selectAllItems(void) +{ + if (m_allowMultipleSelections) + { + for (int i = 0; i < m_items.size(); i++) + { + m_items[i]->setSelected(true); + } + + raiseSelectionChangedEvent(); + } +} + +/** + * Deselect all items. + */ + +void CListData::deselectAllItems(void) +{ + for (int i = 0; i < m_items.size(); i++) + { + m_items[i]->setSelected(false); + } + + raiseSelectionChangedEvent(); +} + +/** + * Select or deselect an item by its index. Does not deselect any + * other selected items. Set index to -1 to select nothing. + * + * @param index The index of the item to select. + * @param selected True to select the item, false to deselect it. + */ + +void CListData::setItemSelected(const int index, bool selected) +{ + // Deselect old options if we're making an option selected and + // we're not a multiple list + + if (((!m_allowMultipleSelections) || (index == -1)) && (selected)) + { + for (int i = 0; i < m_items.size(); i++) + { + m_items[i]->setSelected(false); + } + } + + // Select or deselect the new option + + if ((index > -1) && (index < m_items.size())) + { + m_items[index]->setSelected(selected); + } + + raiseSelectionChangedEvent(); +} + +/** + * Remove an event handler. + * + * @param eventHandler The event handler to remove. + */ + +void CListData::removeListDataEventHandler(IListDataEventHandler *eventHandler) +{ + for (int i = 0; i < m_listDataEventhandlers.size(); ++i) + { + if (m_listDataEventhandlers.at(i) == eventHandler) + { + m_listDataEventhandlers.erase(i); + return; + } + } +} + +/** + * Quick sort the items using their compareTo() methods. + * + * @param start The index to start sorting at. + * @param end The index to stop sorting at. + */ + +void CListData::quickSort(const int start, const int end) +{ + if (end > start) + { + int left = start; + int right = end; + + CListDataItem *pivot = m_items[(start + end) >> 1]; + + do + { + while ((pivot->compareTo(m_items[left]) > 0) && (left < end)) + { + left++; + } + + while ((pivot->compareTo(m_items[right]) < 0) && (right > start)) + { + right--; + } + + if (left > right) + { + break; + } + + swapItems(left, right); + left++; + right--; + } + while (left <= right); + + quickSort(start, right); + quickSort(left, end); + } +} + +/** + * Swap the locations of two items in the array. + * + * @param index1 The index of the first item to swap. + * @param index2 The index of the second item to swap. + */ + +void CListData::swapItems(const int index1, const int index2) +{ + CListDataItem *tmp = m_items[index1]; + m_items[index1] = m_items[index2]; + m_items[index2] = tmp; +} + +/** + * Return the index that an item should be inserted at to maintain a sorted list of data. + * + * @param item The item to insert. + * @return The index that the item should be imserted into at. + */ + +const int CListData::getSortedInsertionIndex(const CListDataItem *item) const +{ + int i = 0; + + // Locate slot where new option should go + + while ((i < m_items.size()) && (item->compareTo(m_items[i]) > 0)) + { + i++; + } + return i; +} + +/** + * Raise a data changed event. + */ + +void CListData::raiseDataChangedEvent(void) +{ + CListDataEventArgs eventArgs(this); + + for (int i = 0; i < m_listDataEventhandlers.size(); ++i) + { + m_listDataEventhandlers.at(i)->handleListDataChangedEvent(eventArgs); + } +} + +/** + * Raise a selection changed event. + */ + +void CListData::raiseSelectionChangedEvent(void) +{ + CListDataEventArgs eventArgs(this); + + for (int i = 0; i < m_listDataEventhandlers.size(); ++i) + { + m_listDataEventhandlers.at(i)->handleListDataSelectionChangedEvent(eventArgs); + } +} diff --git a/NxWidgets/libnxwidgets/src/clistdataitem.cxx b/NxWidgets/libnxwidgets/src/clistdataitem.cxx index 036cea61e..4be7d3005 100644 --- a/NxWidgets/libnxwidgets/src/clistdataitem.cxx +++ b/NxWidgets/libnxwidgets/src/clistdataitem.cxx @@ -1,128 +1,128 @@ -/****************************************************************************
- * NxWidgets/libnxwidgets/src/clistdataitem.cxx
- *
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
- * me be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- *
- * Portions of this package derive from Woopsi (http://woopsi.org/) and
- * portions are original efforts. It is difficult to determine at this
- * point what parts are original efforts and which parts derive from Woopsi.
- * However, in any event, the work of Antony Dzeryn will be acknowledged
- * in most NxWidget files. Thanks Antony!
- *
- * Copyright (c) 2007-2011, Antony Dzeryn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the names "Woopsi", "Simian Zombie" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "cwidgetcontrol.hxx"
-#include "clistdataitem.hxx"
-
-/****************************************************************************
- * Pre-Processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Method Implementations
- ****************************************************************************/
-
-using namespace NXWidgets;
-/**
- * Constructor.
- *
- * @param text The text to display in the item.
- * @param value The value of the item.
- */
-
-CListDataItem::CListDataItem(const CNxString &text, const uint32_t value)
-{
- m_text = text;
- m_value = value;
- m_isSelected = false;
-}
-
-/**
- * Destructor.
- */
-
-CListDataItem::~CListDataItem(void)
-{
-}
-
-/**
- * Compare the item with another. Comparison is based on the text of
- * the item. Returns 0 if the text in the two items is the same,
- * a value less than 0 if this item is less than the argument, and
- * a value greater than 0 if this item is greater than the argument.
- *
- * @param item An item to compare this object with.
- * @return 0 if the text in the two items is the same,
- * a value less than 0 if this item is less than the argument, and
- * a value greater than 0 if this item is greater than the argument.
- */
-
-int CListDataItem::compareTo(const CListDataItem *item) const
-{
- return m_text.compareTo(item->getText());
-}
+/**************************************************************************** + * NxWidgets/libnxwidgets/src/clistdataitem.cxx + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors + * me be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************** + * + * Portions of this package derive from Woopsi (http://woopsi.org/) and + * portions are original efforts. It is difficult to determine at this + * point what parts are original efforts and which parts derive from Woopsi. + * However, in any event, the work of Antony Dzeryn will be acknowledged + * in most NxWidget files. Thanks Antony! + * + * Copyright (c) 2007-2011, Antony Dzeryn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the names "Woopsi", "Simian Zombie" nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <stdint.h> +#include <stdbool.h> + +#include "cwidgetcontrol.hxx" +#include "clistdataitem.hxx" + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Method Implementations + ****************************************************************************/ + +using namespace NXWidgets; +/** + * Constructor. + * + * @param text The text to display in the item. + * @param value The value of the item. + */ + +CListDataItem::CListDataItem(const CNxString &text, const uint32_t value) +{ + m_text = text; + m_value = value; + m_isSelected = false; +} + +/** + * Destructor. + */ + +CListDataItem::~CListDataItem(void) +{ +} + +/** + * Compare the item with another. Comparison is based on the text of + * the item. Returns 0 if the text in the two items is the same, + * a value less than 0 if this item is less than the argument, and + * a value greater than 0 if this item is greater than the argument. + * + * @param item An item to compare this object with. + * @return 0 if the text in the two items is the same, + * a value less than 0 if this item is less than the argument, and + * a value greater than 0 if this item is greater than the argument. + */ + +int CListDataItem::compareTo(const CListDataItem *item) const +{ + return m_text.compareTo(item->getText()); +} diff --git a/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx b/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx index df060f037..e7af8f23d 100644 --- a/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx +++ b/NxWidgets/libnxwidgets/src/cmultilinetextbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -472,7 +472,7 @@ void CMultiLineTextBox::handleKeyPressEvent(const CWidgetEventArgs &e) // Not modifier; append value insertTextAtCursor(key); - } + } } /** @@ -502,10 +502,10 @@ void CMultiLineTextBox::getCursorCoordinates(nxgl_coord_t &x, nxgl_coord_t &y) c // start of the line uint8_t cursorLineOffset = m_cursorPos - m_text->getLineStartIndex(cursorRow); - + CStringIterator *iterator = m_text->newStringIterator(); iterator->moveTo(m_text->getLineStartIndex(cursorRow)); - + // Sum the width of each char in the row to find the x coordinate for (int i = 0; i < cursorLineOffset; ++i) diff --git a/NxWidgets/libnxwidgets/src/cnxfont.cxx b/NxWidgets/libnxwidgets/src/cnxfont.cxx index 189cfb9e0..326dd5619 100644 --- a/NxWidgets/libnxwidgets/src/cnxfont.cxx +++ b/NxWidgets/libnxwidgets/src/cnxfont.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -150,14 +150,14 @@ nxgl_coord_t CNxFont::getStringWidth(const CNxString &text) const if (iter->moveToFirst()) { // moveToFirst returns true if there is at least one character - + do { // Add the width of the font bitmap for this character and // move the the next character nxwidget_char_t ch = iter->getChar(); - + width += getCharWidth(ch); } while (iter->moveToNext()); @@ -178,7 +178,7 @@ nxgl_coord_t CNxFont::getStringWidth(const CNxString &text) const * @param length The length of the substring in chars. * @return The width of the substring in pixels. */ - + nxgl_coord_t CNxFont::getStringWidth(const CNxString &text, int startIndex, int length) const { diff --git a/NxWidgets/libnxwidgets/src/cnxstring.cxx b/NxWidgets/libnxwidgets/src/cnxstring.cxx index 3ad3855b9..8548de636 100644 --- a/NxWidgets/libnxwidgets/src/cnxstring.cxx +++ b/NxWidgets/libnxwidgets/src/cnxstring.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -355,7 +355,7 @@ void CNxString::insert(const CNxString &text, int index) delete[] m_text; - // Swap pointers + // Swap pointers m_stringLength = newLength; m_text = newText; @@ -374,7 +374,7 @@ void CNxString::insert(const CNxString &text, int index) // Insert the additional text into the new string dest = &m_text[index]; - src = text.getCharArray(); + src = text.getCharArray(); for (int i = 0; i < text.getLength(); i++) { *dest++ = *src++; @@ -741,7 +741,7 @@ void CNxString::allocateMemory(int nChars, bool preserve) // Do we already have enough memory allocated to contain this new size? // If so, we can avoid deallocating and allocating new memory by re-using the old - + if (nBytesNeeded > m_allocatedSize) { // Not enough space in existing memory; allocate new memory diff --git a/NxWidgets/libnxwidgets/src/cnxtimer.cxx b/NxWidgets/libnxwidgets/src/cnxtimer.cxx index d67cee6e8..d54981570 100644 --- a/NxWidgets/libnxwidgets/src/cnxtimer.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtimer.cxx @@ -199,7 +199,7 @@ void CNxTimer::workQueueCallback(FAR void *arg) { This->start(); } - + // Raise the action event. This->m_widgetEventHandlers->raiseActionEvent(); diff --git a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx index 725a368fa..3c336f06a 100644 --- a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx @@ -184,7 +184,7 @@ bool CNxToolbar::getSize(FAR struct nxgl_size_s *pSize) * @param pPos The new position of the toolbar. * @return Always returns false. */ - + bool CNxToolbar::setPosition(FAR const struct nxgl_point_s *pPos) { return false; @@ -198,7 +198,7 @@ bool CNxToolbar::setPosition(FAR const struct nxgl_point_s *pPos) * @param pSize The new size of the toolbar. * @return Always returns false. */ - + bool CNxToolbar::setSize(FAR const struct nxgl_size_s *pSize) { return false; diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 15ed501e6..4cf7b9b28 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -188,7 +188,7 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl, m_doubleClickBounds = DOUBLE_CLICK_BOUNDS; // Set border size to 1 line - + m_borderSize.top = 1; m_borderSize.right = 1; m_borderSize.bottom = 1; @@ -294,7 +294,7 @@ nxgl_coord_t CNxWidget::getRelativeY(void) const /** * Has the widget been marked for deletion? This function recurses up the widget * hierarchy and only returns true if all of the widgets in the ancestor - * chain are not deleted. + * chain are not deleted. * * Widgets marked for deletion are automatically deleted and should not be * interacted with. @@ -495,7 +495,7 @@ void CNxWidget::redraw(void) m_flags.erased = false; // Draw the children of the widget - + drawChildren(); } } @@ -555,7 +555,7 @@ void CNxWidget::close(void) m_flags.deleted = true; m_flags.drawingEnabled = false; - + // Unset clicked widget if necessary CNxWidget *clickedWidget = m_widgetControl->getClickedWidget(); @@ -680,7 +680,7 @@ bool CNxWidget::click(nxgl_coord_t x, nxgl_coord_t y) * @param y Y coordinate of the click. * @return True if the click is a double-click. */ - + bool CNxWidget::isDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { // Check for a double-click @@ -858,7 +858,7 @@ bool CNxWidget::keyPress(nxwidget_char_t key) { return false; } - + // Raise keypress for this widget m_widgetEventHandlers->raiseKeyPressEvent(key); @@ -886,7 +886,7 @@ bool CNxWidget::cursorControl(ECursorControl control) { return false; } - + // Raise cursor control for this widget m_widgetEventHandlers->raiseCursorControlEvent(control); @@ -931,7 +931,7 @@ bool CNxWidget::focus(void) if (!hadFocus) { onFocus(); - + m_widgetEventHandlers->raiseFocusEvent(); return true; } @@ -967,7 +967,7 @@ bool CNxWidget::blur(void) if (hadFocus) { onBlur(); - + m_widgetEventHandlers->raiseBlurEvent(); return true; } @@ -1046,7 +1046,7 @@ bool CNxWidget::moveTo(nxgl_coord_t x, nxgl_coord_t y) } } } - + // Perform move if necessary if ((m_rect.getX() != x) || (m_rect.getY() != y)) diff --git a/NxWidgets/libnxwidgets/src/cnxwindow.cxx b/NxWidgets/libnxwidgets/src/cnxwindow.cxx index b38667d8d..046660774 100644 --- a/NxWidgets/libnxwidgets/src/cnxwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwindow.cxx @@ -61,7 +61,7 @@ using namespace NXWidgets; * * @param hNxServer Handle to the NX server. */ - + CNxWindow::CNxWindow(NXHANDLE hNxServer, CWidgetControl *pWidgetControl) : CCallback(pWidgetControl), m_hNxServer(hNxServer), m_hNxWindow(0), m_widgetControl(pWidgetControl) @@ -161,7 +161,7 @@ bool CNxWindow::getSize(FAR struct nxgl_size_s *pSize) * @param pPos The new position of the window. * @return True on success, false on any failure. */ - + bool CNxWindow::setPosition(FAR const struct nxgl_point_s *pPos) { // Set the window size and position @@ -175,7 +175,7 @@ bool CNxWindow::setPosition(FAR const struct nxgl_point_s *pPos) * @param pSize The new size of the window. * @return True on success, false on any failure. */ - + bool CNxWindow::setSize(FAR const struct nxgl_size_s *pSize) { // Set the window size diff --git a/NxWidgets/libnxwidgets/src/cprogressbar.cxx b/NxWidgets/libnxwidgets/src/cprogressbar.cxx index 5f29a3f7e..d76d42903 100644 --- a/NxWidgets/libnxwidgets/src/cprogressbar.cxx +++ b/NxWidgets/libnxwidgets/src/cprogressbar.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -117,7 +117,7 @@ CProgressBar::CProgressBar(CWidgetControl *pWidgetControl, } /** - * Set the value that of the progress bar. + * Set the value that of the progress bar. * * @param value The new value. */ @@ -159,7 +159,7 @@ void CProgressBar::drawContents(CGraphicsPort *port) // Calculate ratio of pixels to value range (max fractional value of 255) uint32_t ratio = ((uint32_t)rect.getWidth() << 8) / (uint32_t)(m_maximumValue - m_minimumValue); - + // Convert value using ratio, rounding up and shifting down int16_t barWidth = ((m_value * ratio) + 128) >> 8; @@ -167,7 +167,7 @@ void CProgressBar::drawContents(CGraphicsPort *port) // Draw filled region port->drawFilledRect(rect.getX(), rect.getY(), barWidth, rect.getHeight(), getHighlightColor()); - + // Draw unfilled background if (barWidth < rect.getWidth()) diff --git a/NxWidgets/libnxwidgets/src/cradiobutton.cxx b/NxWidgets/libnxwidgets/src/cradiobutton.cxx index 86ad4118f..a5680d5c6 100644 --- a/NxWidgets/libnxwidgets/src/cradiobutton.cxx +++ b/NxWidgets/libnxwidgets/src/cradiobutton.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx b/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx index b1d75f625..62c4f9aad 100644 --- a/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx +++ b/NxWidgets/libnxwidgets/src/cradiobuttongroup.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/crect.cxx b/NxWidgets/libnxwidgets/src/crect.cxx index 8e0ed2cd4..9ed2df830 100644 --- a/NxWidgets/libnxwidgets/src/crect.cxx +++ b/NxWidgets/libnxwidgets/src/crect.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -188,7 +188,7 @@ CRect fromCoordinates(nxgl_coord_t x1, nxgl_coord_t y1, * * @param x2 The x coordinate of the rect's bottom-right corner. */ - + void CRect::setX2(nxgl_coord_t x2) { // Ensure that x contains the smaller value diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx index 1fb2518a5..a648f0533 100644 --- a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx +++ b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx @@ -304,7 +304,7 @@ bool CRlePaletteBitmap::skipPixels(nxgl_coord_t npixels) return true; } - + /** Seek to the beginning of the next row * * @return False if this was the last row of the image diff --git a/NxWidgets/libnxwidgets/src/cscaledbitmap.cxx b/NxWidgets/libnxwidgets/src/cscaledbitmap.cxx index 1ebf60324..083868f70 100644 --- a/NxWidgets/libnxwidgets/src/cscaledbitmap.cxx +++ b/NxWidgets/libnxwidgets/src/cscaledbitmap.cxx @@ -375,7 +375,7 @@ bool CScaledBitmap::cacheRows(unsigned int row) FAR uint8_t *saveRow = m_rowCache[0]; m_rowCache[0] = m_rowCache[1]; m_rowCache[1] = saveRow; - + // Save number of the first row that we have in the cache m_row = row; @@ -484,7 +484,7 @@ bool CScaledBitmap::scaleColor(FAR const struct rgbcolor_s &incolor1, * @param row - The pointer to the row in the row cache to use * @param column - The non-integer column offset * @param outcolor - The returned, interpolated color - * + * */ bool CScaledBitmap::rowColor(FAR uint8_t *row, b16_t column, diff --git a/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx b/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx index 13e33815d..236ab4594 100644 --- a/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollbarhorizontal.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -91,7 +91,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * Method Implementation ****************************************************************************/ @@ -115,7 +115,7 @@ using namespace NXWidgets; CScrollbarHorizontal::CScrollbarHorizontal(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, - CWidgetStyle* style) + CWidgetStyle* style) : CNxWidget(pWidgetControl, x, y, width, height, WIDGET_BORDERLESS, style) { m_buttonWidth = 10; @@ -263,7 +263,7 @@ void CScrollbarHorizontal::setPageSize(nxgl_coord_t pageSize) m_slider->setPageSize(pageSize); } -/** +/** * Process events fired by the grip. * * @param e The event details. diff --git a/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx b/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx index 76b5c5dec..e287b14f2 100644 --- a/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollbarvertical.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -88,7 +88,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * Method Implementation ****************************************************************************/ @@ -261,7 +261,7 @@ void CScrollbarVertical::setPageSize(nxgl_coord_t pageSize) m_slider->setPageSize(pageSize); } -/** +/** * Process events fired by the grip. * * @param e The event details. diff --git a/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx b/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx index e0d041d34..d397a98db 100644 --- a/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollinglistbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx index 2541bb572..c93d113a6 100644 --- a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx @@ -216,9 +216,9 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) m_canvasX += dx; // Move children but do not redraw. - + scrollChildren(dx, dy, false); - + if (revealedRects.size() > 0) { // Draw background to revealed sections @@ -234,7 +234,7 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) port->drawFilledRect(rrect.getX(), rrect.getY(), rrect.getWidth(), rrect.getHeight(), getBackgroundColor()); - + // Check if any children intersect this region. // If it does, it should be redrawn. @@ -255,7 +255,7 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) m_canvasY += dy; m_canvasX += dx; - + // Scroll all child widgets and redraw them scrollChildren(dx, dy, true); @@ -362,16 +362,16 @@ void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy, bool do_redraw) { widget = m_children[i]; bool oldstate = widget->isDrawingEnabled(); - + if (!do_redraw) { widget->disableDrawing(); } - + widgetX = (widget->getX() - thisX) + dx; widgetY = (widget->getY() - thisY) + dy; widget->moveTo(widgetX, widgetY); - + if (!do_redraw && oldstate) { widget->enableDrawing(); diff --git a/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx b/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx index 4de63fdf6..f9f9beadc 100644 --- a/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollingtextbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -125,7 +125,7 @@ CScrollingTextBox::CScrollingTextBox(CWidgetControl *pWidgetControl, 0, 0, width - m_scrollbarWidth, height, text, flags, maxRows, &m_style); m_texbox->addWidgetEventHandler(this); - + // Create scrollbar CRect rect; diff --git a/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx b/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx index 2fe47556c..4462d6e74 100644 --- a/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx +++ b/NxWidgets/libnxwidgets/src/csliderhorizontal.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -155,14 +155,14 @@ void CSliderHorizontal::setValueWithBitshift(const int32_t value) { CRect rect; getClientRect(rect); - + // Can the grip move? if ((rect.getWidth() > m_grip->getWidth()) && (m_maximumValue != m_minimumValue)) { int32_t newValue = value; int32_t maxValue = getPhysicalMaximumValueWithBitshift(); - + // Limit to max/min values if (newValue > maxValue) @@ -174,13 +174,13 @@ void CSliderHorizontal::setValueWithBitshift(const int32_t value) { newValue = m_minimumValue << 16; } - + uint32_t scrollRatio = newValue / m_contentSize; int32_t newGripX = m_gutterWidth * scrollRatio; newGripX += newGripX & 0x8000; newGripX >>= 16; newGripX += rect.getX(); - + m_grip->moveTo(newGripX, rect.getY()); // Update stored value if necessary @@ -395,7 +395,7 @@ void CSliderHorizontal::resizeGrip(void) // height) of the gutter. Each position in the gutter needs to be // reduced in value. } - + m_grip->resize(gripSize, rect.getHeight()); } diff --git a/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx b/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx index aebdbf51d..25feaed78 100644 --- a/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx +++ b/NxWidgets/libnxwidgets/src/csliderhorizontalgrip.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cslidervertical.cxx b/NxWidgets/libnxwidgets/src/cslidervertical.cxx index 74d2d956b..9b9b0f91a 100644 --- a/NxWidgets/libnxwidgets/src/cslidervertical.cxx +++ b/NxWidgets/libnxwidgets/src/cslidervertical.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -156,14 +156,14 @@ void CSliderVertical::setValueWithBitshift(const int32_t value) { CRect rect; getClientRect(rect); - + // Can the grip move? if ((rect.getHeight() > m_grip->getHeight()) && (m_maximumValue != m_minimumValue)) { int32_t newValue = value; int32_t maxValue = getPhysicalMaximumValueWithBitshift(); - + // Limit to max/min values if (newValue > maxValue) @@ -175,13 +175,13 @@ void CSliderVertical::setValueWithBitshift(const int32_t value) { newValue = m_minimumValue << 16; } - + uint32_t scrollRatio = newValue / m_contentSize; int32_t newGripY = m_gutterHeight * scrollRatio; newGripY += newGripY & 0x8000; newGripY >>= 16; newGripY += rect.getY(); - + m_grip->moveTo(rect.getX(), newGripY); // Update stored value if necessary @@ -397,6 +397,6 @@ void CSliderVertical::resizeGrip(void) // height) of the gutter. Each position in the gutter needs to be // reduced in value. } - + m_grip->resize(rect.getWidth(), gripSize); } diff --git a/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx b/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx index 2ddf364e8..d1eb0177a 100644 --- a/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx +++ b/NxWidgets/libnxwidgets/src/csliderverticalgrip.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> diff --git a/NxWidgets/libnxwidgets/src/cstickybutton.cxx b/NxWidgets/libnxwidgets/src/cstickybutton.cxx index 76852eaf7..d9c2b0883 100644 --- a/NxWidgets/libnxwidgets/src/cstickybutton.cxx +++ b/NxWidgets/libnxwidgets/src/cstickybutton.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx b/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx index 05c9d8928..69dbd01f6 100644 --- a/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx +++ b/NxWidgets/libnxwidgets/src/cstickybuttonarray.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -51,7 +51,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * CStickyButtonArray Method Implementations ****************************************************************************/ @@ -221,7 +221,7 @@ void CStickyButtonArray::drawContents(CGraphicsPort *port) drawButton(port, m_stickyColumn, m_stickyRow, useClicked); } - // Do we draw just one button (due to click or release)? + // Do we draw just one button (due to click or release)? else if (m_redrawButton) { diff --git a/NxWidgets/libnxwidgets/src/cstringiterator.cxx b/NxWidgets/libnxwidgets/src/cstringiterator.cxx index 2327af38f..ed7cad704 100644 --- a/NxWidgets/libnxwidgets/src/cstringiterator.cxx +++ b/NxWidgets/libnxwidgets/src/cstringiterator.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -132,7 +132,7 @@ bool CStringIterator::moveToLast(void) int length = m_pString->getLength(); if (length > 0) { - m_pCurrentChar = m_pString->getCharArray() + length - 1; + m_pCurrentChar = m_pString->getCharArray() + length - 1; m_currentIndex = length - 1; return true; } @@ -154,7 +154,7 @@ bool CStringIterator::moveToNext(void) m_currentIndex++; return true; } - + return false; } diff --git a/NxWidgets/libnxwidgets/src/ctabpanel.cxx b/NxWidgets/libnxwidgets/src/ctabpanel.cxx index f1723fdba..1f1769e00 100644 --- a/NxWidgets/libnxwidgets/src/ctabpanel.cxx +++ b/NxWidgets/libnxwidgets/src/ctabpanel.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -51,7 +51,7 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ - + /**************************************************************************** * CTabPanel Method Implementations ****************************************************************************/ @@ -73,7 +73,7 @@ CTabPanel::CTabPanel(CWidgetControl *pWidgetControl, uint8_t numPages, 0); m_buttonbar->addWidgetEventHandler(this); this->addWidget(m_buttonbar); - + for (int i = 0; i < numPages; i++) { CNxWidget *tabpage = new CNxWidget(pWidgetControl, x, y + buttonHeight, @@ -83,7 +83,7 @@ CTabPanel::CTabPanel(CWidgetControl *pWidgetControl, uint8_t numPages, m_tabpages.push_back(tabpage); this->addWidget(tabpage); } - + // Activate the first page showPage(0); @@ -100,7 +100,7 @@ void CTabPanel::showPage(uint8_t index) { m_buttonbar->stickDown(index, 0); } - + for (int i = 0; i < m_tabpages.size(); i++) { if (i == index) diff --git a/NxWidgets/libnxwidgets/src/ctext.cxx b/NxWidgets/libnxwidgets/src/ctext.cxx index caa0c02e8..60b726ca3 100644 --- a/NxWidgets/libnxwidgets/src/ctext.cxx +++ b/NxWidgets/libnxwidgets/src/ctext.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <stdint.h> @@ -206,7 +206,7 @@ void CText::setLineSpacing(uint8_t lineSpacing) } /** - * Sets the pixel width of the text; text wider than + * Sets the pixel width of the text; text wider than * this will automatically wrap. * * @param width Maximum pixel width of the text. @@ -243,7 +243,7 @@ const int CText::getLineLength(const int lineNumber) const { return m_linePositions[lineNumber + 1] - m_linePositions[lineNumber]; } - + return getLength() - m_linePositions[lineNumber]; } @@ -258,11 +258,11 @@ const int CText::getLineLength(const int lineNumber) const const int CText::getLineTrimmedLength(const int lineNumber) const { nxgl_coord_t length = getLineLength(lineNumber); - + // Loop through string until the end CStringIterator *iterator = newStringIterator(); - + // Get char at the end of the line if (iterator->moveTo(m_linePositions[lineNumber] + length - 1)) @@ -280,7 +280,7 @@ const int CText::getLineTrimmedLength(const int lineNumber) const delete iterator; return length; } - + // May occur if data has been horribly corrupted somewhere delete iterator; @@ -336,7 +336,7 @@ void CText::stripTopLines(const int lines) // Get the start point of the text we want to keep nxgl_coord_t textStart = 0; - + for (int i = 0; i < lines; i++) { textStart += getLineLength(i); @@ -345,7 +345,7 @@ void CText::stripTopLines(const int lines) // Remove the characters from the start of the string to the found location remove(0, textStart); - + // Rewrap the text wrap(); @@ -375,12 +375,12 @@ void CText::wrap(int charIndex) int lineWidth; int breakIndex; bool endReached = false; - + if (m_linePositions.size() == 0) { charIndex = 0; } - + // If we're wrapping from an offset in the text, ensure that any existing data // after the offset gets removed @@ -399,7 +399,7 @@ void CText::wrap(int charIndex) { m_longestLines.pop_back(); } - + // If there are any longest line records remaining, update the text pixel width // The last longest line record will always be the last valid longest line as // the vector is sorted by length @@ -432,33 +432,33 @@ void CText::wrap(int charIndex) else { // Remove all wrapping data - + // Wipe the width variable m_textPixelWidth = 0; - + // Empty existing longest lines m_longestLines.clear(); - + // Empty existing line positions m_linePositions.clear(); - + // Push first line start into vector m_linePositions.push_back(0); } - + // Loop through string until the end CStringIterator *iterator = newStringIterator(); - + while (!endReached) { breakIndex = 0; lineWidth = 0; - + if (iterator->moveTo(pos)) { // Search for line breaks and valid breakpoints until we @@ -541,9 +541,9 @@ void CText::wrap(int charIndex) } } } - + delete breakIterator; - + // Add the start of the next line to the vector pos = breakIndex + 1; @@ -574,7 +574,7 @@ void CText::wrap(int charIndex) m_linePositions.push_back(pos); } } - + // Add marker indicating end of text // If we reached the end of the text, append the stopping point @@ -584,11 +584,11 @@ void CText::wrap(int charIndex) } delete iterator; - + // Calculate the total height of the text m_textPixelHeight = getLineCount() * (m_font->getHeight() + m_lineSpacing); - + // Ensure height is always at least one row if (m_textPixelHeight == 0) @@ -627,13 +627,13 @@ const int CText::getLineContainingCharIndex(const int index) const int bottom = 0; int top = m_linePositions.size() - 1; int mid; - + while (bottom <= top) { // Standard binary search mid = (bottom + top) >> 1; - + if (index < m_linePositions[mid]) { // Index is somewhere in the lower search space @@ -652,7 +652,7 @@ const int CText::getLineContainingCharIndex(const int index) const return mid; } - + // Check to see if we've moved past the line that contains the index // We have to do this because the index we're looking for can be within // a line; it isn't necessarily the start of a line (which is what is diff --git a/NxWidgets/libnxwidgets/src/ctextbox.cxx b/NxWidgets/libnxwidgets/src/ctextbox.cxx index 9c22a2bfa..d40776170 100644 --- a/NxWidgets/libnxwidgets/src/ctextbox.cxx +++ b/NxWidgets/libnxwidgets/src/ctextbox.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -280,7 +280,7 @@ void CTextBox::handleKeyPressEvent(const CWidgetEventArgs &e) // Not modifier; append value insertTextAtCursor(key); - } + } } /** @@ -389,7 +389,7 @@ void CTextBox::drawContents(CGraphicsPort *port) pos.y = m_align.y; // Calculate the cursor width - + struct nxgl_size_s size; size.w = getCursorWidth(); size.h = getFont()->getHeight(); @@ -402,7 +402,7 @@ void CTextBox::drawContents(CGraphicsPort *port) pos.x += rect.getX(); pos.y += rect.getY(); - + port->invert(pos.x, pos.y, size.w, size.h); } } @@ -454,13 +454,13 @@ void CTextBox::moveCursorToClickLocation(nxgl_coord_t x, nxgl_coord_t y) while (charX < clickX) { charX += getFont()->getCharWidth(iterator->getChar()); - + if (!iterator->moveToNext()) { break; } } - + int index = iterator->getIndex(); // Move back to the clicked character if we've moved past it @@ -553,13 +553,13 @@ const nxgl_coord_t CTextBox::getCursorXPos(void) const nxgl_coord_t cursorX = 0; CStringIterator *iterator = m_text.newStringIterator(); - + for (nxgl_coord_t i = 0; i < m_cursorPos; i++) { cursorX += getFont()->getCharWidth(iterator->getChar()); iterator->moveToNext(); } - + delete iterator; return cursorX; } @@ -598,7 +598,7 @@ void CTextBox::calculateTextPositionHorizontal(void) // ignore alignment and align left nxgl_coord_t stringWidth = getFont()->getStringWidth(m_text); - + // Add the width of a blank space to the width to ensure that we can // see the cursor @@ -606,10 +606,10 @@ void CTextBox::calculateTextPositionHorizontal(void) { stringWidth += getFont()->getCharWidth(' '); } - + CRect rect; getClientRect(rect); - + // Use alignment options if cursor is hidden or string is smaller // than textbox diff --git a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx index bebab89aa..840778bac 100644 --- a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx @@ -97,7 +97,7 @@ using namespace NXWidgets; * * @param widget The owning widget. */ - + CWidgetEventHandlerList::CWidgetEventHandlerList(CNxWidget *widget) { m_widget = widget; @@ -120,7 +120,7 @@ bool CWidgetEventHandlerList::isEnabled(void) const * all events raised by this object. * @param eventHandler A pointer to the event handler. */ - + void CWidgetEventHandlerList::addWidgetEventHandler(CWidgetEventHandler *eventHandler) { // Prevent insertion if the handler already exists @@ -529,7 +529,7 @@ void CWidgetEventHandlerList::raiseScrollEvent(nxgl_coord_t vX, nxgl_coord_t vY) if (isEnabled()) { CWidgetEventArgs e(m_widget, 0, 0, vX, vY, KEY_CODE_NONE); - + for (int i = 0; i < m_widgetEventHandlers.size(); i++) { m_widgetEventHandlers.at(i)->handleScrollEvent(e); diff --git a/NxWidgets/libnxwidgets/src/cwindoweventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwindoweventhandlerlist.cxx index dfdabcf08..79dd97d7f 100644 --- a/NxWidgets/libnxwidgets/src/cwindoweventhandlerlist.cxx +++ b/NxWidgets/libnxwidgets/src/cwindoweventhandlerlist.cxx @@ -57,7 +57,7 @@ using namespace NXWidgets; * all events raised by this object. * @param eventHandler A pointer to the event handler. */ - + void CWindowEventHandlerList::addWindowEventHandler(CWindowEventHandler *eventHandler) { // Make sure that the event handler does not already exist @@ -93,7 +93,7 @@ void CWindowEventHandlerList::removeWindowEventHandler(CWindowEventHandler *even /** * Return the index to the window event handler. */ - + bool CWindowEventHandlerList::findWindowEventHandler(CWindowEventHandler *eventHandler, int &index) { for (int i = 0; i < m_eventHandlers.size(); ++i) diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx index c304e9281..fc200e099 100644 --- a/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_arrowdown.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx index ae322dcc2..143a1c3c1 100644 --- a/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_arrowleft.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx index 5969527d9..3f8b833f2 100644 --- a/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_arrowright.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx b/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx index 9ea10bde2..b1543266c 100644 --- a/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_arrowup.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_backspace.cxx b/NxWidgets/libnxwidgets/src/glyph_backspace.cxx index 86c1fb93a..5271b0f66 100644 --- a/NxWidgets/libnxwidgets/src/glyph_backspace.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_backspace.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_capslock.cxx b/NxWidgets/libnxwidgets/src/glyph_capslock.cxx index d9e00bc78..b61d4dbdb 100644 --- a/NxWidgets/libnxwidgets/src/glyph_capslock.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_capslock.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx index 96dbec9c1..48011b1c8 100644 --- a/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_checkboxmu.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx index 7be6a50b2..8222bee84 100644 --- a/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_checkboxoff.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx b/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx index b598e60ce..255c88449 100644 --- a/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_checkboxon.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_control.cxx b/NxWidgets/libnxwidgets/src/glyph_control.cxx index cd2e373e6..4cb8432c1 100644 --- a/NxWidgets/libnxwidgets/src/glyph_control.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_control.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_cycle.cxx b/NxWidgets/libnxwidgets/src/glyph_cycle.cxx index 7983d4566..ff3476ff4 100644 --- a/NxWidgets/libnxwidgets/src/glyph_cycle.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_cycle.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_nxlogo160x160.cxx b/NxWidgets/libnxwidgets/src/glyph_nxlogo160x160.cxx index 6a38b45cb..9eb5746e3 100644 --- a/NxWidgets/libnxwidgets/src/glyph_nxlogo160x160.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_nxlogo160x160.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -1048,7 +1048,7 @@ static const struct SRlePaletteBitmapEntry g_nuttxRleEntries[] = { 77, 0}, { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ }; - + #elif CONFIG_NXWIDGETS_BPP == 16 static const struct SRlePaletteBitmapEntry g_nuttxRleEntries[] = @@ -3443,7 +3443,7 @@ const struct SRlePaletteBitmap NXWidgets::g_nuttxBitmap160x160 = CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel CONFIG_NXWIDGETS_FMT, // fmt - Color format BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) - 160, // width - Width in pixels + 160, // width - Width in pixels 160, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) g_nuttxLut, // Index 0: Unselected LUT diff --git a/NxWidgets/libnxwidgets/src/glyph_nxlogo320x320.cxx b/NxWidgets/libnxwidgets/src/glyph_nxlogo320x320.cxx index c83ab7159..b2e1eaad5 100644 --- a/NxWidgets/libnxwidgets/src/glyph_nxlogo320x320.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_nxlogo320x320.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -1033,7 +1033,7 @@ const struct SRlePaletteBitmap NXWidgets::g_nuttxBitmap320x320 = CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel CONFIG_NXWIDGETS_FMT, // fmt - Color format BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) - BITMAP_NCOLUMNS, // width - Width in pixels + BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NROWS, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) g_nuttxLut, // Index 0: Unselected LUT diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx index 1359c5b96..896129ffc 100644 --- a/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonmu.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx index 422db01a9..7b832a15a 100644 --- a/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonoff.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx b/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx index 04ca63757..919d11c75 100644 --- a/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_radiobuttonon.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_return.cxx b/NxWidgets/libnxwidgets/src/glyph_return.cxx index 3989ff89a..951d3a9d0 100644 --- a/NxWidgets/libnxwidgets/src/glyph_return.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_return.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx b/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx index e55e0686a..dab46122f 100644 --- a/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_screendepthdown.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx b/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx index e693b7488..9826bc4ce 100644 --- a/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_screendepthup.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx b/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx index 488315d7a..d3e45504d 100644 --- a/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_screenflipdown.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx b/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx index 7d45dbf93..bb928e262 100644 --- a/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_screenflipup.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_shift.cxx b/NxWidgets/libnxwidgets/src/glyph_shift.cxx index c1cce8686..77b0d186b 100644 --- a/NxWidgets/libnxwidgets/src/glyph_shift.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_shift.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx b/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx index 62d6ee718..bd176f412 100644 --- a/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_windowclose.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx b/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx index b85ed053a..5bf616047 100644 --- a/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_windowdepthdown.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx b/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx index 056e27c1c..584b51b21 100644 --- a/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx +++ b/NxWidgets/libnxwidgets/src/glyph_windowdepthup.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> diff --git a/NxWidgets/libnxwidgets/src/singletons.cxx b/NxWidgets/libnxwidgets/src/singletons.cxx index fc5d919e6..7af47eb92 100644 --- a/NxWidgets/libnxwidgets/src/singletons.cxx +++ b/NxWidgets/libnxwidgets/src/singletons.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include <nuttx/config.h> #include <sys/types.h> @@ -131,7 +131,7 @@ void NXWidgets::instantiateSingletons(void) if (!g_defaultWidgetStyle) { // Create the singleton - + g_defaultWidgetStyle = new CWidgetStyle(); // Default colors |