NXWidgets: ctabpanel.hxx Source File

NXWidgets 1.19

ctabpanel.hxx
Go to the documentation of this file.
1 /****************************************************************************
2 * NxWidgets/libnxwidgets/include/ctabpanel.hxx
3 *
4 * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
5 * Author: Petteri Aimonen <jpa@kapsi.fi>
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 #ifndef __INCLUDE_CTABPANEL_HXX
37 #define __INCLUDE_CTABPANEL_HXX
38
39 /****************************************************************************
40 * Included Files
41 ****************************************************************************/
42
43 #include <nuttx/config.h>
44
45 #include <stdint.h>
46 #include <stdbool.h>
47
48 #include <nuttx/nx/nxglib.h>
49
50 #include "cnxwidget.hxx"
51 #include "cwidgetstyle.hxx"
52 #include "cnxstring.hxx"
53 #include "tnxarray.hxx"
54 #include "clatchbuttonarray.hxx"
55
56 /****************************************************************************
57 * Pre-Processor Definitions
58 ****************************************************************************/
59
60 /****************************************************************************
61 * Implementation Classes
62 ****************************************************************************/
63
64 #if defined(__cplusplus)
65
66 namespace NXWidgets
67 {
68 /**
69 * Forward references
70 */
71
72 class CWidgetControl;
73 class CRect;
74 class CStickyButtonArray;
75
76 /**
77 * Tab panel, with tabs at the top and a panel at the bottom.
78 */
79
80 class CTabPanel : public CNxWidget, public CWidgetEventHandler
81 {
82 protected:
83 TNxArray<CNxWidget*> m_tabpages;
84 CLatchButtonArray *m_buttonbar;
85
86 virtual void handleActionEvent(const CWidgetEventArgs &e);
87
88 virtual void drawContents(CGraphicsPort* port) {}
89 virtual void drawBorder(CGraphicsPort* port) {}
90
91 public:
92 CTabPanel(CWidgetControl *pWidgetControl, uint8_t numPages,
93 nxgl_coord_t x, nxgl_coord_t y,
94 nxgl_coord_t width, nxgl_coord_t height,
95 nxgl_coord_t buttonHeight,
96 FAR const CWidgetStyle *style = (FAR const CWidgetStyle *)NULL
97 );
98
99 inline CNxWidget &page(uint8_t index) { return *m_tabpages.at(index); }
100
101 void setPageName(uint8_t index, const CNxString &name);
102
103 void showPage(uint8_t index);
104
105 uint8_t getCurrentPageIndex() const;
106 };
107 }
108
109 #endif
110 #endif
NXWidgets::CNxWidget
Definition: cnxwidget.hxx:121
NXWidgets::CTabPanel::getCurrentPageIndex
uint8_t getCurrentPageIndex() const
Definition: ctabpanel.cxx:130
NXWidgets::CTabPanel::setPageName
void setPageName(uint8_t index, const CNxString &name)
Definition: ctabpanel.cxx:92
NXWidgets::CWidgetStyle
Definition: cwidgetstyle.hxx:125
NXWidgets::CLatchButtonArray
Definition: clatchbuttonarray.hxx:82
NXWidgets::CWidgetEventHandler
Definition: cwidgeteventhandler.hxx:103
NXWidgets::CWidgetControl
Definition: cwidgetcontrol.hxx:95
NXWidgets::CTabPanel::handleActionEvent
virtual void handleActionEvent(const CWidgetEventArgs &e)
Definition: ctabpanel.cxx:117
NXWidgets::CTabPanel::m_tabpages
TNxArray< CNxWidget * > m_tabpages
Definition: ctabpanel.hxx:83
NXWidgets::CTabPanel::drawContents
virtual void drawContents(CGraphicsPort *port)
Definition: ctabpanel.hxx:88
clatchbuttonarray.hxx
tnxarray.hxx
cwidgetstyle.hxx
NXWidgets::CTabPanel::CTabPanel
CTabPanel(CWidgetControl *pWidgetControl, uint8_t numPages, nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, nxgl_coord_t height, nxgl_coord_t buttonHeight, FAR const CWidgetStyle *style=(FAR const CWidgetStyle *) NULL)
Definition: ctabpanel.cxx:61
NXWidgets
Definition: cbgwindow.hxx:65
TNxArray
Definition: tnxarray.hxx:109
NXWidgets::CWidgetEventArgs
Definition: cwidgeteventargs.hxx:127
NXWidgets::CTabPanel::m_buttonbar
CLatchButtonArray * m_buttonbar
Definition: ctabpanel.hxx:84
NXWidgets::CNxString
Definition: cnxstring.hxx:121
NXWidgets::CTabPanel::drawBorder
virtual void drawBorder(CGraphicsPort *port)
Definition: ctabpanel.hxx:89
NXWidgets::CTabPanel::page
CNxWidget & page(uint8_t index)
Definition: ctabpanel.hxx:99
cnxwidget.hxx
TNxArray::at
T & at(const int index) const
Definition: tnxarray.hxx:404
NXWidgets::CTabPanel
Definition: ctabpanel.hxx:80
cnxstring.hxx
NXWidgets::CTabPanel::showPage
void showPage(uint8_t index)
Definition: ctabpanel.cxx:97
NXWidgets::CGraphicsPort
Definition: cgraphicsport.hxx:106