Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
widgets/ScrollablePane.h
1 /***********************************************************************
2  created: 1/3/2005
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIScrollablePane_h_
28 #define _CEGUIScrollablePane_h_
29 
30 #include "../Base.h"
31 #include "../Window.h"
32 
33 #if defined(_MSC_VER)
34 # pragma warning(push)
35 # pragma warning(disable : 4251)
36 #endif
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
42 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
43 {
44 public:
47 
56  virtual Rectf getViewableArea(void) const = 0;
57 };
58 
67 class CEGUIEXPORT ScrollablePane : public Window
68 {
69 public:
71  static const String WidgetTypeName;
73  static const String EventNamespace;
104  static const String VertScrollbarName;
106  static const String HorzScrollbarName;
109 
111  ScrollablePane(const String& type, const String& name);
112 
114  ~ScrollablePane(void);
115 
128  const ScrolledContainer* getContentPane(void) const;
129 
138  bool isVertScrollbarAlwaysShown(void) const;
139 
153  void setShowVertScrollbar(bool setting);
154 
163  bool isHorzScrollbarAlwaysShown(void) const;
164 
178  void setShowHorzScrollbar(bool setting);
179 
189  bool isContentPaneAutoSized(void) const;
190 
203  void setContentPaneAutoSized(bool setting);
204 
213  const Rectf& getContentPaneArea(void) const;
214 
230  void setContentPaneArea(const Rectf& area);
231 
241  float getHorizontalStepSize(void) const;
242 
255  void setHorizontalStepSize(float step);
256 
266  float getHorizontalOverlapSize(void) const;
267 
280  void setHorizontalOverlapSize(float overlap);
281 
290  float getHorizontalScrollPosition(void) const;
291 
303  void setHorizontalScrollPosition(float position);
304 
314  float getVerticalStepSize(void) const;
315 
328  void setVerticalStepSize(float step);
329 
339  float getVerticalOverlapSize(void) const;
340 
353  void setVerticalOverlapSize(float overlap);
354 
363  float getVerticalScrollPosition(void) const;
364 
376  void setVerticalScrollPosition(float position);
377 
386  Rectf getViewableArea(void) const;
387 
399  Scrollbar* getVertScrollbar() const;
400 
412  Scrollbar* getHorzScrollbar() const;
413 
414  // Overridden from Window
415  void initialiseComponents(void);
416  void destroy(void);
417 
418 protected:
425  void configureScrollbars(void);
426 
435  bool isVertScrollbarNeeded(void) const;
436 
445  bool isHorzScrollbarNeeded(void) const;
446 
452  void updateContainerPosition(void);
453 
465  ScrolledContainer* getScrolledContainer() const;
466 
467  // validate window renderer
468  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
469 
470  /*************************************************************************
471  Event triggers
472  *************************************************************************/
484  virtual void onContentPaneChanged(WindowEventArgs& e);
485 
497  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
498 
510  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
511 
523  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
524 
536  virtual void onContentPaneScrolled(WindowEventArgs& e);
537 
538  /*************************************************************************
539  Event handler methods
540  *************************************************************************/
546  bool handleScrollChange(const EventArgs& e);
547 
553  bool handleContentAreaChange(const EventArgs& e);
554 
560  bool handleAutoSizePaneChanged(const EventArgs& e);
561 
562  // Overridden from Window
563  void addChild_impl(Element* element);
564  void removeChild_impl(Element* element);
565 
566  void onSized(ElementEventArgs& e);
567  void onMouseWheel(MouseEventArgs& e);
568 
570  NamedElement* getChildByNamePath_impl(const String& name_path) const;
571 
579  float d_vertStep;
583  float d_horzStep;
590 
591 private:
592  void addScrollablePaneProperties(void);
593 };
594 
595 } // End of CEGUI namespace section
596 
597 #if defined(_MSC_VER)
598 # pragma warning(pop)
599 #endif
600 
601 #endif // end of guard _CEGUIScrollablePane_h_