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

Revision 692, 9.8 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1/************************************************************************
2        filename:       CEGUIScrolledContainer.h
3        created:        1/3/2005
4        author:         Paul D Turner
5*************************************************************************/
6/*************************************************************************
7    Crazy Eddie's GUI System (http://www.cegui.org.uk)
8    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
9
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 2.1 of the License, or (at your option) any later version.
14
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Lesser General Public License for more details.
19
20    You should have received a copy of the GNU Lesser General Public
21    License along with this library; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23*************************************************************************/
24#ifndef _CEGUIScrolledContainer_h_
25#define _CEGUIScrolledContainer_h_
26
27#include "CEGUIWindow.h"
28#include "CEGUIWindowFactory.h"
29#include "elements/CEGUIScrolledContainerProperties.h"
30#include <map>
31
32#if defined(_MSC_VER)
33#       pragma warning(push)
34#       pragma warning(disable : 4251)
35#endif
36
37// Start of CEGUI namespace section
38namespace CEGUI
39{
40    /*!
41    \brief
42        Helper container window class which is used in the implementation of the
43        ScrollablePane widget class.
44    */
45    class CEGUIEXPORT ScrolledContainer : public Window
46    {
47    public:
48        /*************************************************************************
49            Constants
50        *************************************************************************/
51        static const String WidgetTypeName;     //!< Type name for ScrolledContainer.
52        static const String EventNamespace;     //!< Namespace for global events
53        static const String EventContentChanged;    //!< Event fired whenever some child changes.
54        static const String EventAutoSizeSettingChanged;    //!< Event fired when the autosize setting changes.
55
56        /*************************************************************************
57                Object construction and destruction
58        *************************************************************************/
59        /*!
60        \brief
61            Constructor for ScrolledContainer objects.
62        */
63        ScrolledContainer(const String& type, const String& name);
64
65        /*!
66        \brief
67            Destructor for ScrolledContainer objects.
68        */
69        ~ScrolledContainer(void);
70
71        /*************************************************************************
72                Public interface methods
73        *************************************************************************/
74        /*!
75        \brief
76            Return whether the content pane is auto sized.
77
78        \return
79            - true to indicate the content pane will automatically resize itself.
80            - false to indicate the content pane will not automatically resize itself.
81        */
82        bool isContentPaneAutoSized(void) const;
83
84        /*!
85        \brief
86            Set whether the content pane should be auto-sized.
87
88        \param setting
89            - true to indicate the content pane should automatically resize itself.
90            - false to indicate the content pane should not automatically resize itself.
91
92        \return
93            Nothing.
94        */
95        void setContentPaneAutoSized(bool setting);
96
97        /*!
98        \brief
99            Return the current content pane area for the ScrolledContainer.
100
101        \return
102            Rect object that details the current pixel extents of the content
103            pane represented by this ScrolledContainer.
104        */
105        const Rect& getContentArea(void) const;
106
107        /*!
108        \brief
109            Set the current content pane area for the ScrolledContainer.
110
111        \note
112            If the ScrolledContainer is configured to auto-size the content pane
113            this call will have no effect.
114
115        \param area
116            Rect object that details the pixel extents to use for the content
117            pane represented by this ScrolledContainer.
118
119        \return
120            Nothing.
121        */
122        void setContentArea(const Rect& area);
123
124        /*!
125        \brief
126            Return the current extents of the attached content.
127
128        \return
129            Rect object that describes the pixel extents of the attached
130            child windows.  This is effectively the smallest bounding box
131            that could contain all the attached windows.
132        */
133        Rect getChildExtentsArea(void) const;
134
135    protected:
136        /*************************************************************************
137                Implementation methods
138        *************************************************************************/
139        /*!
140        \brief
141            Adds events for this widget type.
142        */
143        void addScrolledContainerEvents(void);
144
145
146                /*!
147                \brief
148                        Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
149
150                \param class_name
151                        The class name that is to be checked.
152
153                \return
154                        true if this window was inherited from \a class_name. false if not.
155                */
156                virtual bool    testClassName_impl(const String& class_name) const
157                {
158                        if (class_name==(const utf8*)"ScrolledContainer")       return true;
159                        return Window::testClassName_impl(class_name);
160                }
161
162        /*************************************************************************
163                Implementation of abstract methods from Window
164        *************************************************************************/
165        void drawSelf(float z) {};
166
167        /*************************************************************************
168                Event trigger methods.
169        *************************************************************************/
170        /*!
171        \brief
172            Notification method called whenever the content size may have changed.
173
174        \param e
175            WindowEventArgs object.
176
177        \return
178            Nothing.
179        */
180        virtual void onContentChanged(WindowEventArgs& e);
181
182        /*!
183        \brief
184            Notification method called whenever the setting that controls whether
185            the content pane is automatically sized is changed.
186
187        \param e
188            WindowEventArgs object.
189
190        \return
191            Nothing.
192        */
193        virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
194
195        /*************************************************************************
196                Event callbacks
197        *************************************************************************/
198        /*!
199        \brief
200            Method which receives notifications about child windows being moved.
201        */
202        bool handleChildSized(const EventArgs& e);
203
204        /*!
205        \brief
206            Method which receives notifications about child windows being sized.
207        */
208        bool handleChildMoved(const EventArgs& e);
209
210        /*************************************************************************
211                Overridden from Window.
212        *************************************************************************/
213        Rect getUnclippedInnerRect(void) const;
214        void onChildAdded(WindowEventArgs& e);
215        void onChildRemoved(WindowEventArgs& e);
216        void onParentSized(WindowEventArgs& e);
217
218        /*************************************************************************
219                Data fields
220        *************************************************************************/
221        typedef std::multimap<Window*, Event::Connection>  ConnectionTracker;
222        ConnectionTracker d_eventConnections;   //!< Tracks event connections we make.
223        Rect d_contentArea;     //!< Holds extents of the content pane.
224        bool d_autosizePane;    //!< true if the pane auto-sizes itself.
225
226    private:
227            /*************************************************************************
228                    Static Properties for this class
229            *************************************************************************/
230            static ScrolledContainerProperties::ContentPaneAutoSized    d_autoSizedProperty;
231            static ScrolledContainerProperties::ContentArea             d_contentAreaProperty;
232            static ScrolledContainerProperties::ChildExtentsArea        d_childExtentsAreaProperty;
233
234            /*************************************************************************
235                    Private methods
236            *************************************************************************/
237            void addScrolledContainerProperties(void);
238    };
239
240    /*!
241    \brief
242        Factory class for producing ScrolledContainer windows
243    */
244    class ScrolledContainerFactory : public WindowFactory
245    {
246    public:
247        ScrolledContainerFactory(void) : WindowFactory(ScrolledContainer::WidgetTypeName) { }
248        ~ScrolledContainerFactory(void){}
249
250        Window* createWindow(const String& name)
251        {
252            ScrolledContainer* wnd = new ScrolledContainer(d_type, name);
253            return wnd;
254        }
255
256        void destroyWindow(Window* window)
257        {
258            if (window->getType() == d_type)
259                delete window;
260        }
261
262    };
263
264} // End of  CEGUI namespace section
265
266
267#if defined(_MSC_VER)
268#       pragma warning(pop)
269#endif
270
271#endif  // end of guard _CEGUIScrolledContainer_h_
Note: See TracBrowser for help on using the repository browser.