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