source: OGRE/trunk/ogre_dependencies/Dependencies/include/CEGUI/elements/CEGUITabButton.h @ 692

Revision 692, 5.7 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

Line 
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
33namespace CEGUI
34{
35/*!
36\brief
37    Base class for TabButtons.  A TabButton based class is used internally as
38    the button that appears at the top of a TabControl widget to select the
39    active tab pane.
40*/
41class CEGUIEXPORT TabButton : public ButtonBase
42{
43public:
44        static const String EventNamespace;                             //!< Namespace for global events
45
46
47        /*************************************************************************
48                Event name constants
49        *************************************************************************/
50        // generated internally by Window
51        static const String EventClicked;                                       //!< The button was clicked.
52
53        /*************************************************************************
54                Construction and Destruction
55        *************************************************************************/
56        /*!
57        \brief
58                Constructor for base TabButton class
59        */
60        TabButton(const String& type, const String& name);
61
62
63        /*!
64        \brief
65                Destructor for TabButton class
66        */
67        virtual ~TabButton(void);
68
69    /*!
70    \brief
71        Set whether this tab button is selected or not
72    */
73    virtual void setSelected(bool selected) { d_selected = selected; requestRedraw(); }
74
75    /*!
76    \brief
77        Set whether this tab button is on the right of the selected button,
78        used to disable edges of buttons when deselected (to give an overlapping
79        look)
80    */
81    virtual void setRightOfSelected(bool isRight) { d_rightOfSelected = isRight; requestRedraw(); }
82
83    /*!
84    \brief
85        Return whether this tab button is selected or not
86    */
87    bool isSelected(void) const { return d_selected; }
88
89
90    /*!
91    \brief
92        Set the target window which is the content pane which this button is
93        covering.
94    */
95    void setTargetWindow(Window* wnd);
96    /*!
97    \brief
98        Get the target window which is the content pane which this button is
99        covering.
100    */
101    Window* getTargetWindow(void) { return d_targetWindow; }
102
103    /*!
104    \brief
105        Set the index at which this tab is positioned.
106    */
107    void setTabIndex(uint idx) { d_tabIndex = idx; }
108
109    /*!
110    \brief
111        Get the index at which this tab is positioned.
112    */
113    uint getTabIndex(void) { return d_tabIndex; }
114protected:
115    /*************************************************************************
116    Implementation Data
117    *************************************************************************/
118    bool    d_selected;             //!< Is this button selected?
119    bool    d_rightOfSelected;      //!< Is this button to the right of the selected tab?
120    Window* d_targetWindow;         //!< The target window which this button is representing
121    uint    d_tabIndex;             //!< The index at which this tab is positioned
122        /*************************************************************************
123                New Event Handlers
124        *************************************************************************/
125        /*!
126        \brief
127                handler invoked internally when the button is clicked.
128        */
129        virtual void    onClicked(WindowEventArgs& e);
130
131
132        /*************************************************************************
133                Overridden Event Handlers
134        *************************************************************************/
135        virtual void    onMouseButtonUp(MouseEventArgs& e);
136
137
138        /*************************************************************************
139                Implementation Functions
140        *************************************************************************/
141        /*!
142        \brief
143                Add button specific events
144        */
145        void    addTabButtonEvents(void);
146        /*!
147        \brief
148                Perform the rendering for this widget.
149
150        \param z
151                float value specifying the base Z co-ordinate that should be used when rendering
152
153        \return
154                Nothing
155        */
156        void    drawSelf(float z);
157
158
159        /*!
160        \brief
161                Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
162
163        \param class_name
164                The class name that is to be checked.
165
166        \return
167                true if this window was inherited from \a class_name. false if not.
168        */
169        virtual bool    testClassName_impl(const String& class_name) const
170        {
171                if (class_name==(const utf8*)"TabButton")       return true;
172                return ButtonBase::testClassName_impl(class_name);
173        }
174};
175
176
177} // End of  CEGUI namespace section
178
179
180#endif  // end of guard _CEGUITabButton_h_
Note: See TracBrowser for help on using the repository browser.