Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIFrameWindow.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 "../CEGUIBase.h"
34 #include "../CEGUIWindow.h"
35 #include "CEGUIFrameWindowProperties.h"
36 
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
51 class CEGUIEXPORT FrameWindow : public Window
52 {
53 public:
54  static const String EventNamespace;
55  static const String WidgetTypeName;
56 
57  /*************************************************************************
58  Constants
59  *************************************************************************/
60  // additional event names for this window
66  static const String EventRollupToggled;
72  static const String EventCloseClicked;
85 
86  // other bits
87  static const float DefaultSizingBorderSize;
88 
89  /*************************************************************************
90  Child Widget name suffix constants
91  *************************************************************************/
92  static const String TitlebarNameSuffix;
94 
95 
109  SizingRight
110  };
111 
122  virtual void initialiseComponents(void);
123 
124 
132  bool isSizingEnabled(void) const {return d_sizingEnabled && isFrameEnabled();}
133 
134 
142  bool isFrameEnabled(void) const {return d_frameEnabled;}
143 
144 
152  bool isTitleBarEnabled(void) const;
153 
154 
162  bool isCloseButtonEnabled(void) const;
163 
164 
172  bool isRollupEnabled(void) const {return d_rollupEnabled;}
173 
174 
182  bool isRolledup(void) const {return d_rolledup;}
183 
184 
192  float getSizingBorderThickness(void) const {return d_borderSize;}
193 
194 
205  void setSizingEnabled(bool setting);
206 
207 
218  void setFrameEnabled(bool setting);
219 
220 
231  void setTitleBarEnabled(bool setting);
232 
233 
244  void setCloseButtonEnabled(bool setting);
245 
246 
257  void setRollupEnabled(bool setting);
258 
259 
267  void toggleRollup(void);
268 
269 
280  void setSizingBorderThickness(float pixels) {d_borderSize = pixels;}
281 
282 
295  void offsetPixelPosition(const Vector2& offset);
296 
297 
305  bool isDragMovingEnabled(void) const {return d_dragMovable;}
306 
307 
318  void setDragMovingEnabled(bool setting);
319 
320 
329  const Image* getNSSizingCursorImage() const;
330 
339  const Image* getEWSizingCursorImage() const;
340 
349  const Image* getNWSESizingCursorImage() const;
350 
359  const Image* getNESWSizingCursorImage() const;
360 
371  void setNSSizingCursorImage(const Image* image);
372 
383  void setEWSizingCursorImage(const Image* image);
384 
395  void setNWSESizingCursorImage(const Image* image);
396 
407  void setNESWSizingCursorImage(const Image* image);
408 
424  void setNSSizingCursorImage(const String& imageset, const String& image);
425 
441  void setEWSizingCursorImage(const String& imageset, const String& image);
442 
458  void setNWSESizingCursorImage(const String& imageset, const String& image);
459 
475  void setNESWSizingCursorImage(const String& imageset, const String& image);
476 
477  // overridden from Window class
478  bool isHit(const Point& position, const bool /*allow_disabled*/) const
479  { return Window::isHit(position) && !d_rolledup; }
480 
491  Titlebar* getTitlebar() const;
492 
504  PushButton* getCloseButton() const;
505 
506  /*************************************************************************
507  Construction / Destruction
508  *************************************************************************/
513  FrameWindow(const String& type, const String& name);
514 
519  virtual ~FrameWindow(void);
520 
521 
522 protected:
523  /*************************************************************************
524  Implementation Functions
525  *************************************************************************/
533  bool moveLeftEdge(float delta, URect& out_area);
534 
535 
543  bool moveRightEdge(float delta, URect& out_area);
544 
545 
553  bool moveTopEdge(float delta, URect& out_area);
554 
555 
563  bool moveBottomEdge(float delta, URect& out_area);
564 
565 
579  SizingLocation getSizingBorderAtPoint(const Point& pt) const;
580 
581 
592  bool isLeftSizingLocation(SizingLocation loc) const {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
593 
594 
605  bool isRightSizingLocation(SizingLocation loc) const {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
606 
607 
618  bool isTopSizingLocation(SizingLocation loc) const {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
619 
620 
631  bool isBottomSizingLocation(SizingLocation loc) const {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
632 
633 
638  bool closeClickHandler(const EventArgs& e);
639 
640 
645  void setCursorForPoint(const Point& pt) const;
646 
647 
652  virtual Rect getSizingRect(void) const {return Rect(0, 0, d_pixelSize.d_width, d_pixelSize.d_height);}
653 
654 
665  virtual bool testClassName_impl(const String& class_name) const
666  {
667  if (class_name=="FrameWindow") return true;
668  return Window::testClassName_impl(class_name);
669  }
670 
671 
672  /*************************************************************************
673  New events for Frame Windows
674  *************************************************************************/
680  virtual void onRollupToggled(WindowEventArgs& e);
681 
682 
687  virtual void onCloseClicked(WindowEventArgs& e);
688 
690  virtual void onDragSizingStarted(WindowEventArgs& e);
691 
693  virtual void onDragSizingEnded(WindowEventArgs& e);
694 
695  /*************************************************************************
696  Overridden event handlers
697  *************************************************************************/
698  virtual void onMouseMove(MouseEventArgs& e);
699  virtual void onMouseButtonDown(MouseEventArgs& e);
700  virtual void onMouseButtonUp(MouseEventArgs& e);
701  virtual void onCaptureLost(WindowEventArgs& e);
702  virtual void onTextChanged(WindowEventArgs& e);
703  virtual void onActivated(ActivationEventArgs& e);
704  virtual void onDeactivated(ActivationEventArgs& e);
705 
706 
707  /*************************************************************************
708  Implementation Data
709  *************************************************************************/
710  // frame data
712 
713  // window roll-up data
715  bool d_rolledup;
716 
717  // drag-sizing data
720  float d_borderSize;
722 
723  // images for cursor when on sizing border
728 
730 
731 
732 private:
733  /*************************************************************************
734  Static Properties for this class
735  *************************************************************************/
736  static FrameWindowProperties::SizingEnabled d_sizingEnabledProperty;
737  static FrameWindowProperties::FrameEnabled d_frameEnabledProperty;
738  static FrameWindowProperties::TitlebarEnabled d_titlebarEnabledProperty;
739  static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
740  static FrameWindowProperties::RollUpState d_rollUpStateProperty;
741  static FrameWindowProperties::RollUpEnabled d_rollUpEnabledProperty;
742  static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
743  static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
744  static FrameWindowProperties::NSSizingCursorImage d_nsSizingCursorProperty;
745  static FrameWindowProperties::EWSizingCursorImage d_ewSizingCursorProperty;
746  static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
747  static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
748 
749 
750  /*************************************************************************
751  Private methods
752  *************************************************************************/
753  void addFrameWindowProperties(void);
754 };
755 
756 } // End of CEGUI namespace section
757 
758 #if defined(_MSC_VER)
759 # pragma warning(pop)
760 #endif
761 
762 #endif // end of guard _CEGUIFrameWindow_h_