Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
widgets/ScrollablePane.h
1 /***********************************************************************
2  filename: CEGUIScrollablePane.h
3  created: 1/3/2005
4  author: Paul D Turner
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIScrollablePane_h_
29 #define _CEGUIScrollablePane_h_
30 
31 #include "../Base.h"
32 #include "../Window.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
43 class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
44 {
45 public:
48 
57  virtual Rectf getViewableArea(void) const = 0;
58 };
59 
68 class CEGUIEXPORT ScrollablePane : public Window
69 {
70 public:
72  static const String WidgetTypeName;
74  static const String EventNamespace;
105  static const String VertScrollbarName;
107  static const String HorzScrollbarName;
110 
112  ScrollablePane(const String& type, const String& name);
113 
115  ~ScrollablePane(void);
116 
129  const ScrolledContainer* getContentPane(void) const;
130 
139  bool isVertScrollbarAlwaysShown(void) const;
140 
154  void setShowVertScrollbar(bool setting);
155 
164  bool isHorzScrollbarAlwaysShown(void) const;
165 
179  void setShowHorzScrollbar(bool setting);
180 
190  bool isContentPaneAutoSized(void) const;
191 
204  void setContentPaneAutoSized(bool setting);
205 
214  const Rectf& getContentPaneArea(void) const;
215 
231  void setContentPaneArea(const Rectf& area);
232 
242  float getHorizontalStepSize(void) const;
243 
256  void setHorizontalStepSize(float step);
257 
267  float getHorizontalOverlapSize(void) const;
268 
281  void setHorizontalOverlapSize(float overlap);
282 
291  float getHorizontalScrollPosition(void) const;
292 
304  void setHorizontalScrollPosition(float position);
305 
315  float getVerticalStepSize(void) const;
316 
329  void setVerticalStepSize(float step);
330 
340  float getVerticalOverlapSize(void) const;
341 
354  void setVerticalOverlapSize(float overlap);
355 
364  float getVerticalScrollPosition(void) const;
365 
377  void setVerticalScrollPosition(float position);
378 
387  Rectf getViewableArea(void) const;
388 
400  Scrollbar* getVertScrollbar() const;
401 
413  Scrollbar* getHorzScrollbar() const;
414 
415  // Overridden from Window
416  void initialiseComponents(void);
417  void destroy(void);
418 
419 protected:
426  void configureScrollbars(void);
427 
436  bool isVertScrollbarNeeded(void) const;
437 
446  bool isHorzScrollbarNeeded(void) const;
447 
453  void updateContainerPosition(void);
454 
466  ScrolledContainer* getScrolledContainer() const;
467 
468  // validate window renderer
469  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
470 
471  /*************************************************************************
472  Event triggers
473  *************************************************************************/
485  virtual void onContentPaneChanged(WindowEventArgs& e);
486 
498  virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
499 
511  virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
512 
524  virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
525 
537  virtual void onContentPaneScrolled(WindowEventArgs& e);
538 
539  /*************************************************************************
540  Event handler methods
541  *************************************************************************/
547  bool handleScrollChange(const EventArgs& e);
548 
554  bool handleContentAreaChange(const EventArgs& e);
555 
561  bool handleAutoSizePaneChanged(const EventArgs& e);
562 
563  // Overridden from Window
564  void addChild_impl(Element* element);
565  void removeChild_impl(Element* element);
566 
567  void onSized(ElementEventArgs& e);
568  void onMouseWheel(MouseEventArgs& e);
569 
571  NamedElement* getChildByNamePath_impl(const String& name_path) const;
572 
580  float d_vertStep;
584  float d_horzStep;
591 
592 private:
593  void addScrollablePaneProperties(void);
594 };
595 
596 } // End of CEGUI namespace section
597 
598 #if defined(_MSC_VER)
599 # pragma warning(pop)
600 #endif
601 
602 #endif // end of guard _CEGUIScrollablePane_h_