1 | /************************************************************************
|
---|
2 | filename: CEGUITabButton.h
|
---|
3 | created: 8/8/2004
|
---|
4 | author: Steve Streeting
|
---|
5 |
|
---|
6 | purpose: Interface to base class for TabButton widget
|
---|
7 | *************************************************************************/
|
---|
8 | /*************************************************************************
|
---|
9 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
11 |
|
---|
12 | This library is free software; you can redistribute it and/or
|
---|
13 | modify it under the terms of the GNU Lesser General Public
|
---|
14 | License as published by the Free Software Foundation; either
|
---|
15 | version 2.1 of the License, or (at your option) any later version.
|
---|
16 |
|
---|
17 | This library is distributed in the hope that it will be useful,
|
---|
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | Lesser General Public License for more details.
|
---|
21 |
|
---|
22 | You should have received a copy of the GNU Lesser General Public
|
---|
23 | License along with this library; if not, write to the Free Software
|
---|
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *************************************************************************/
|
---|
26 | #ifndef _CEGUITabButton_h_
|
---|
27 | #define _CEGUITabButton_h_
|
---|
28 |
|
---|
29 | #include "CEGUIBase.h"
|
---|
30 | #include "elements/CEGUIButtonBase.h"
|
---|
31 |
|
---|
32 | // Start of CEGUI namespace section
|
---|
33 | namespace CEGUI
|
---|
34 | {
|
---|
35 | /*!
|
---|
36 | \brief
|
---|
37 |
|
---|
38 | */
|
---|
39 | class CEGUIEXPORT TabButton : public ButtonBase
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | static const String EventNamespace; //!< Namespace for global events
|
---|
43 |
|
---|
44 |
|
---|
45 | /*************************************************************************
|
---|
46 | Event name constants
|
---|
47 | *************************************************************************/
|
---|
48 | // generated internally by Window
|
---|
49 | static const String EventClicked; //!< The button was clicked.
|
---|
50 |
|
---|
51 | /*************************************************************************
|
---|
52 | Construction and Destruction
|
---|
53 | *************************************************************************/
|
---|
54 | /*!
|
---|
55 | \brief
|
---|
56 | Constructor for base TabButton class
|
---|
57 | */
|
---|
58 | TabButton(const String& type, const String& name);
|
---|
59 |
|
---|
60 |
|
---|
61 | /*!
|
---|
62 | \brief
|
---|
63 | Destructor for TabButton class
|
---|
64 | */
|
---|
65 | virtual ~TabButton(void);
|
---|
66 |
|
---|
67 | /*!
|
---|
68 | \brief
|
---|
69 | Set whether this tab button is selected or not
|
---|
70 | */
|
---|
71 | virtual void setSelected(bool selected) { d_selected = selected; requestRedraw(); }
|
---|
72 |
|
---|
73 | /*!
|
---|
74 | \brief
|
---|
75 | Set whether this tab button is on the right of the selected button,
|
---|
76 | used to disable edges of buttons when deselected (to give an overlapping
|
---|
77 | look)
|
---|
78 | */
|
---|
79 | virtual void setRightOfSelected(bool isRight) { d_rightOfSelected = isRight; requestRedraw(); }
|
---|
80 |
|
---|
81 | /*!
|
---|
82 | \brief
|
---|
83 | Return whether this tab button is selected or not
|
---|
84 | */
|
---|
85 | bool isSelected(void) const { return d_selected; }
|
---|
86 |
|
---|
87 |
|
---|
88 | /*!
|
---|
89 | \brief
|
---|
90 | Set the target window which is the content pane which this button is
|
---|
91 | covering.
|
---|
92 | */
|
---|
93 | void setTargetWindow(Window* wnd);
|
---|
94 | /*!
|
---|
95 | \brief
|
---|
96 | Get the target window which is the content pane which this button is
|
---|
97 | covering.
|
---|
98 | */
|
---|
99 | Window* getTargetWindow(void) { return d_targetWindow; }
|
---|
100 |
|
---|
101 | /*!
|
---|
102 | \brief
|
---|
103 | Set the index at which this tab is positioned.
|
---|
104 | */
|
---|
105 | void setTabIndex(uint idx) { d_tabIndex = idx; }
|
---|
106 |
|
---|
107 | /*!
|
---|
108 | \brief
|
---|
109 | Get the index at which this tab is positioned.
|
---|
110 | */
|
---|
111 | uint getTabIndex(void) { return d_tabIndex; }
|
---|
112 | protected:
|
---|
113 | /*************************************************************************
|
---|
114 | Implementation Data
|
---|
115 | *************************************************************************/
|
---|
116 | bool d_selected; //!< Is this button selected?
|
---|
117 | bool d_rightOfSelected; //!< Is this button to the right of the selected tab?
|
---|
118 | Window* d_targetWindow; //!< The target window which this button is representing
|
---|
119 | uint d_tabIndex; //!< The index at which this tab is positioned
|
---|
120 | /*************************************************************************
|
---|
121 | New Event Handlers
|
---|
122 | *************************************************************************/
|
---|
123 | /*!
|
---|
124 | \brief
|
---|
125 | handler invoked internally when the button is clicked.
|
---|
126 | */
|
---|
127 | virtual void onClicked(WindowEventArgs& e);
|
---|
128 |
|
---|
129 |
|
---|
130 | /*************************************************************************
|
---|
131 | Overridden Event Handlers
|
---|
132 | *************************************************************************/
|
---|
133 | virtual void onMouseButtonUp(MouseEventArgs& e);
|
---|
134 |
|
---|
135 |
|
---|
136 | /*************************************************************************
|
---|
137 | Implementation Functions
|
---|
138 | *************************************************************************/
|
---|
139 | /*!
|
---|
140 | \brief
|
---|
141 | Add button specific events
|
---|
142 | */
|
---|
143 | void addTabButtonEvents(void);
|
---|
144 | /*!
|
---|
145 | \brief
|
---|
146 | Perform the rendering for this widget.
|
---|
147 |
|
---|
148 | \param z
|
---|
149 | float value specifying the base Z co-ordinate that should be used when rendering
|
---|
150 |
|
---|
151 | \return
|
---|
152 | Nothing
|
---|
153 | */
|
---|
154 | void drawSelf(float z);
|
---|
155 |
|
---|
156 |
|
---|
157 | /*!
|
---|
158 | \brief
|
---|
159 | Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
|
---|
160 |
|
---|
161 | \param class_name
|
---|
162 | The class name that is to be checked.
|
---|
163 |
|
---|
164 | \return
|
---|
165 | true if this window was inherited from \a class_name. false if not.
|
---|
166 | */
|
---|
167 | virtual bool testClassName_impl(const String& class_name) const
|
---|
168 | {
|
---|
169 | if (class_name==(const utf8*)"TabButton") return true;
|
---|
170 | return ButtonBase::testClassName_impl(class_name);
|
---|
171 | }
|
---|
172 | };
|
---|
173 |
|
---|
174 |
|
---|
175 | } // End of CEGUI namespace section
|
---|
176 |
|
---|
177 |
|
---|
178 | #endif // end of guard _CEGUITabButton_h_
|
---|