Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
widgets/FrameWindow.h
1 /***********************************************************************
2  created: 13/4/2004
3  author: Paul D Turner
4 
5  purpose: Interface to base class for FrameWindow
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIFrameWindow_h_
30 #define _CEGUIFrameWindow_h_
31 
32 #include "../Base.h"
33 #include "../Window.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
48 class CEGUIEXPORT FrameWindow : public Window
49 {
50 public:
51  static const String EventNamespace;
52  static const String WidgetTypeName;
53 
54  /*************************************************************************
55  Constants
56  *************************************************************************/
57  // additional event names for this window
63  static const String EventRollupToggled;
69  static const String EventCloseClicked;
82 
83  // other bits
84  static const float DefaultSizingBorderSize;
85 
86  /*************************************************************************
87  Child Widget name constants
88  *************************************************************************/
89  static const String TitlebarName;
90  static const String CloseButtonName;
91 
92 
106  SizingRight
107  };
108 
119  virtual void initialiseComponents(void);
120 
121 
129  bool isSizingEnabled(void) const {return d_sizingEnabled && isFrameEnabled();}
130 
131 
139  bool isFrameEnabled(void) const {return d_frameEnabled;}
140 
141 
149  bool isTitleBarEnabled(void) const;
150 
151 
159  bool isCloseButtonEnabled(void) const;
160 
161 
169  bool isRollupEnabled(void) const {return d_rollupEnabled;}
170 
178  void setRolledup(bool val);
179 
187  bool isRolledup(void) const {return d_rolledup;}
188 
189 
197  float getSizingBorderThickness(void) const {return d_borderSize;}
198 
199 
210  void setSizingEnabled(bool setting);
211 
212 
223  void setFrameEnabled(bool setting);
224 
225 
236  void setTitleBarEnabled(bool setting);
237 
238 
249  void setCloseButtonEnabled(bool setting);
250 
251 
262  void setRollupEnabled(bool setting);
263 
264 
272  void toggleRollup(void);
273 
284  void setSizingBorderThickness(float pixels) {d_borderSize = pixels;}
285 
286 
299  void offsetPixelPosition(const Vector2f& offset);
300 
301 
309  bool isDragMovingEnabled(void) const {return d_dragMovable;}
310 
311 
322  void setDragMovingEnabled(bool setting);
323 
324 
333  const Image* getNSSizingCursorImage() const;
334 
343  const Image* getEWSizingCursorImage() const;
344 
353  const Image* getNWSESizingCursorImage() const;
354 
363  const Image* getNESWSizingCursorImage() const;
364 
375  void setNSSizingCursorImage(const Image* image);
376 
387  void setEWSizingCursorImage(const Image* image);
388 
399  void setNWSESizingCursorImage(const Image* image);
400 
411  void setNESWSizingCursorImage(const Image* image);
412 
425  void setNSSizingCursorImage(const String& name);
426 
439  void setEWSizingCursorImage(const String& name);
440 
453  void setNWSESizingCursorImage(const String& name);
454 
467  void setNESWSizingCursorImage(const String& name);
468 
469  // overridden from Window class
470  bool isHit(const Vector2f& position, const bool /*allow_disabled*/) const
471  { return Window::isHit(position) && !d_rolledup; }
472 
483  Titlebar* getTitlebar() const;
484 
496  PushButton* getCloseButton() const;
497 
498  /*************************************************************************
499  Construction / Destruction
500  *************************************************************************/
505  FrameWindow(const String& type, const String& name);
506 
511  virtual ~FrameWindow(void);
512 
513 
514 protected:
515  /*************************************************************************
516  Implementation Functions
517  *************************************************************************/
525  bool moveLeftEdge(float delta, URect& out_area);
526 
527 
535  bool moveRightEdge(float delta, URect& out_area);
536 
537 
545  bool moveTopEdge(float delta, URect& out_area);
546 
547 
555  bool moveBottomEdge(float delta, URect& out_area);
556 
557 
571  SizingLocation getSizingBorderAtPoint(const Vector2f& pt) const;
572 
573 
584  bool isLeftSizingLocation(SizingLocation loc) const {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
585 
586 
597  bool isRightSizingLocation(SizingLocation loc) const {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
598 
599 
610  bool isTopSizingLocation(SizingLocation loc) const {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
611 
612 
623  bool isBottomSizingLocation(SizingLocation loc) const {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
624 
625 
630  bool closeClickHandler(const EventArgs& e);
631 
632 
637  void setCursorForPoint(const Vector2f& pt) const;
638 
639 
644  virtual Rectf getSizingRect(void) const {return Rectf(0, 0, d_pixelSize.d_width, d_pixelSize.d_height);}
645 
646  /*************************************************************************
647  New events for Frame Windows
648  *************************************************************************/
654  virtual void onRollupToggled(WindowEventArgs& e);
655 
656 
661  virtual void onCloseClicked(WindowEventArgs& e);
662 
664  virtual void onDragSizingStarted(WindowEventArgs& e);
665 
667  virtual void onDragSizingEnded(WindowEventArgs& e);
668 
669  /*************************************************************************
670  Overridden event handlers
671  *************************************************************************/
672  virtual void onMouseMove(MouseEventArgs& e);
673  virtual void onMouseButtonDown(MouseEventArgs& e);
674  virtual void onMouseButtonUp(MouseEventArgs& e);
675  virtual void onCaptureLost(WindowEventArgs& e);
676  virtual void onTextChanged(WindowEventArgs& e);
677  virtual void onActivated(ActivationEventArgs& e);
678  virtual void onDeactivated(ActivationEventArgs& e);
679 
680 
681  /*************************************************************************
682  Implementation Data
683  *************************************************************************/
684  // frame data
686 
687  // window roll-up data
689  bool d_rolledup;
690 
691  // drag-sizing data
694  float d_borderSize;
696 
697  // images for cursor when on sizing border
702 
704 
705 
706 private:
707  /*************************************************************************
708  Private methods
709  *************************************************************************/
710  void addFrameWindowProperties(void);
711 };
712 
713 } // End of CEGUI namespace section
714 
715 #if defined(_MSC_VER)
716 # pragma warning(pop)
717 #endif
718 
719 #endif // end of guard _CEGUIFrameWindow_h_
720