NXWidgets: cstickyimage.cxx Source File

NXWidgets 1.19

cstickyimage.cxx
Go to the documentation of this file.
1 /****************************************************************************
2 * NxWidgets/libnxwidgets/src/cstickyimage.cxx
3 *
4 * Copyright (C) 2014 Gregory Nutt. All rights reserved.
5 * Author: Gregory Nutt <gnutt@nuttx.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
18 * me be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 ****************************************************************************/
35
36 /****************************************************************************
37 * Included Files
38 ****************************************************************************/
39
40 #include <nuttx/config.h>
41
42 #include <sys/types.h>
43 #include <stdint.h>
44 #include <stdbool.h>
45
46 #include <nuttx/nx/nxglib.h>
47
48 #include "cstickyimage.hxx"
49 #include "cgraphicsport.hxx"
50
51 /****************************************************************************
52 * Pre-Processor Definitions
53 ****************************************************************************/
54
55 /****************************************************************************
56 * CImage Method Implementations
57 ****************************************************************************/
58
59 using namespace NXWidgets;
60
61 /**
62 * Constructor for an image.
63 *
64 * @param pWidgetControl The controlling widget for the display
65 * @param x The x coordinate of the image box, relative to its parent.
66 * @param y The y coordinate of the image box, relative to its parent.
67 * @param width The width of the image box.
68 * @param height The height of the image box.
69 * @param bitmap The source bitmap image.
70 * @param style The style that the widget should use. If this is not
71 * specified, the image will use the global default widget
72 * style.
73 */
74
75 CStickyImage::CStickyImage(CWidgetControl *pWidgetControl,
76 nxgl_coord_t x, nxgl_coord_t y,
77 nxgl_coord_t width, nxgl_coord_t height,
78 FAR IBitmap *bitmap, CWidgetStyle *style)
79 : CImage(pWidgetControl, x, y, width, height, bitmap, style)
80 {
81 m_stuckSelection = false;
82 }
83
84 /**
85 * Sets the image's stuck selection state.
86 *
87 * @param selection The new stuck selection state.
88 */
89
90 void CStickyImage::setStuckSelection(bool selection)
91 {
92 m_stuckSelection = selection;
93 redraw();
94 }
95
96 /**
97 * Draw the area of this widget that falls within the clipping region.
98 * Called by the redraw() function to draw all visible regions.
99 *
100 * @param port The CGraphicsPort to draw to.
101 * @see redraw()
102 */
103
104 void CStickyImage::drawContents(CGraphicsPort *port)
105 {
106 CImage::drawContents(port, m_stuckSelection);
107 }
108
109 /**
110 * Draw the area of this widget that falls within the clipping region.
111 * Called by the redraw() function to draw all visible regions.
112 *
113 * @param port The CGraphicsPort to draw to.
114 * @see redraw()
115 */
116
117 void CStickyImage::drawBorder(CGraphicsPort *port)
118 {
119 CImage::drawBorder(port, m_stuckSelection);
120 }
NXWidgets::CStickyImage::m_stuckSelection
bool m_stuckSelection
Definition: cstickyimage.hxx:74
NXWidgets::CWidgetStyle
Definition: cwidgetstyle.hxx:125
NXWidgets::CWidgetControl
Definition: cwidgetcontrol.hxx:95
cgraphicsport.hxx
NXWidgets::CImage::drawBorder
void drawBorder(CGraphicsPort *port, bool selected)
Definition: cimage.cxx:367
NXWidgets::CNxWidget::redraw
void redraw(void)
Definition: cnxwidget.cxx:483
NXWidgets
Definition: cbgwindow.hxx:65
NXWidgets::CImage::drawContents
void drawContents(CGraphicsPort *port, bool selected)
Definition: cimage.cxx:175
NXWidgets::CStickyImage::setStuckSelection
void setStuckSelection(bool selection)
Definition: cstickyimage.cxx:90
NXWidgets::CStickyImage::drawBorder
virtual void drawBorder(CGraphicsPort *port)
Definition: cstickyimage.cxx:117
NXWidgets::CStickyImage::CStickyImage
CStickyImage(const CStickyImage &image)
Definition: cstickyimage.hxx:130
cstickyimage.hxx
NXWidgets::CImage
Definition: cimage.hxx:109
bitmap
static const NXWidgets::SRlePaletteBitmapEntry bitmap[]
Definition: glyph_mediaplayer24x24.cxx:85
NXWidgets::CStickyImage::drawContents
virtual void drawContents(CGraphicsPort *port)
Definition: cstickyimage.cxx:104
NXWidgets::IBitmap
Definition: ibitmap.hxx:103
NXWidgets::CGraphicsPort
Definition: cgraphicsport.hxx:106