source: GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboDropList.h @ 1092

Revision 1092, 6.1 KB checked in by gumbau, 18 years ago (diff)

LodStrips? and LODTrees demos

Line 
1/************************************************************************
2        filename:       CEGUIComboDropList.h
3        created:        13/6/2004
4        author:         Paul D Turner
5       
6        purpose:        Interface for the Combobox Drop-List widget base class
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 _CEGUIComboDropList_h_
27#define _CEGUIComboDropList_h_
28
29#include "elements/CEGUIListbox.h"
30
31
32#if defined(_MSC_VER)
33#       pragma warning(push)
34#       pragma warning(disable : 4251)
35#endif
36
37
38// Start of CEGUI namespace section
39namespace CEGUI
40{
41/*!
42\brief
43        Base class for the combo box drop down list.  This is a specialisation of the Listbox class.
44*/
45class CEGUIEXPORT ComboDropList : public Listbox
46{
47public:
48        static const String EventNamespace;                             //!< Namespace for global events
49
50
51        /*************************************************************************
52                Constants
53        *************************************************************************/
54        // Event names
55        static const String EventListSelectionAccepted;         //!< Event fired when the user confirms the selection by clicking the mouse.
56
57
58        /*!
59        \brief
60                Initialise the Window based object ready for use.
61
62        \note
63                This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
64
65        \return
66                Nothing
67        */
68        virtual void    initialise(void);
69
70
71        /*!
72        \brief
73                Set whether the drop-list is 'armed' for selection.
74
75        \note
76                This setting is not exclusively under client control; the ComboDropList will auto-arm in
77                response to certain left mouse button events.  This is also dependant upon the autoArm
78                setting of the ComboDropList.
79
80        \param setting
81                - true to arm the box; items will be highlighted and the next left button up event
82                will cause dismissal and possible item selection.
83
84                - false to disarm the box; items will not be highlighted or selected until the box is armed.
85
86        \return
87                Nothing.
88        */
89        void    setArmed(bool setting)          { d_armed = setting; }
90
91
92        /*!
93        \brief
94                Return the 'armed' state of the ComboDropList.
95
96        \return
97                - true if the box is armed; items will be highlighted and the next left button up event
98                will cause dismissal and possible item selection.
99
100                - false if the box is not armed; items will not be highlighted or selected until the box is armed.
101        */
102        bool    isArmed(void) const             { return d_armed; }
103
104
105        /*!
106        \brief
107                Set the mode of operation for the ComboDropList.
108
109        \param setting
110                - true if the ComboDropList auto-arms when the mouse enters the box.
111                - false if the user must click to arm the box.
112
113        \return
114                Nothing.
115        */
116        void    setAutoArmEnabled(bool setting)         { d_autoArm = setting; }
117
118
119        /*!
120        \brief
121                returns the mode of operation for the drop-list
122
123        \return
124                - true if the ComboDropList auto-arms when the mouse enters the box.
125                - false if the user must click to arm the box.
126        */
127        bool    isAutoArmEnabled(void) const            { return d_autoArm; }
128
129
130        /*************************************************************************
131                Constructor & Destructor
132        *************************************************************************/
133        /*!
134        \brief
135                Constructor for ComboDropList base class
136        */
137        ComboDropList(const String& type, const String& name);
138
139
140        /*!
141        \brief
142                Destructor for ComboDropList base class
143        */
144        virtual ~ComboDropList(void);
145
146
147protected:
148        /*!
149        \brief
150                Add drop-list specific events
151        */
152        void    addComboDropListEvents(void);
153
154
155        /*!
156        \brief
157                Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
158
159        \param class_name
160                The class name that is to be checked.
161
162        \return
163                true if this window was inherited from \a class_name. false if not.
164        */
165        virtual bool    testClassName_impl(const String& class_name) const
166        {
167                if (class_name==(const utf8*)"ComboDropList")   return true;
168                return Listbox::testClassName_impl(class_name);
169        }
170       
171        /*************************************************************************
172                New event handlers
173        *************************************************************************/
174        /*!
175        \brief
176                Handler for when list selection is confirmed.
177        */
178        void    onListSelectionAccepted(WindowEventArgs& e);
179
180
181        /*************************************************************************
182                Overridden Event handling
183        *************************************************************************/
184        virtual void    onMouseMove(MouseEventArgs& e);
185        virtual void    onMouseButtonDown(MouseEventArgs& e);
186        virtual void    onMouseButtonUp(MouseEventArgs& e);
187        virtual void    onCaptureLost(WindowEventArgs& e);
188        virtual void    onActivated(ActivationEventArgs& e);
189
190
191        /*************************************************************************
192                Implementation Data
193        *************************************************************************/
194        bool    d_autoArm;              //!< true if the box auto-arms when the mouse enters it.
195        bool    d_armed;                //!< true when item selection has been armed.
196};
197
198} // End of  CEGUI namespace section
199
200#if defined(_MSC_VER)
201#       pragma warning(pop)
202#endif
203
204#endif  // end of guard _CEGUIComboDropList_h_
Note: See TracBrowser for help on using the repository browser.