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_
bool d_rolledup
true if window is rolled up.
Definition: CEGUIFrameWindow.h:715
Property to access the setting for whether the user is able to roll-up / shade the window...
Definition: CEGUIFrameWindowProperties.h:163
Position will size from the left.
Definition: CEGUIFrameWindow.h:107
bool d_rollupEnabled
true if roll-up of window is allowed.
Definition: CEGUIFrameWindow.h:714
static const String WidgetTypeName
Window factory name.
Definition: CEGUIFrameWindow.h:55
Class used as a two dimensional vector (aka a Point)
Definition: CEGUIVector.h:45
static const String TitlebarNameSuffix
Widget name suffix for the titlebar component.
Definition: CEGUIFrameWindow.h:92
Property to access the E-W (left/right) sizing cursor image.
Definition: CEGUIFrameWindowProperties.h:285
bool d_sizingEnabled
true if sizing is enabled for this window.
Definition: CEGUIFrameWindow.h:718
Area rectangle class built using unified dimensions (UDims).
Definition: CEGUIUDim.h:245
Position will size from the bottom left.
Definition: CEGUIFrameWindow.h:104
Class that represents a single Image of an Imageset.
Definition: CEGUIImage.h:57
Position will size from the top-right.
Definition: CEGUIFrameWindow.h:103
Base class used as the argument to all subscribers Event object.
Definition: CEGUIEventArgs.h:52
static const float DefaultSizingBorderSize
Default size for the sizing border (in pixels)
Definition: CEGUIFrameWindow.h:87
static const String EventNamespace
Namespace for global events.
Definition: CEGUIFrameWindow.h:54
const Image * d_nwseSizingCursor
North-West/South-East cursor image.
Definition: CEGUIFrameWindow.h:726
bool isRolledup(void) const
Return whether the window is currently rolled up (a.k.a shaded).
Definition: CEGUIFrameWindow.h:182
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIWindow.h:3928
static const String EventDragSizingStarted
Definition: CEGUIFrameWindow.h:78
Property to access the setting for the sizing border thickness.
Definition: CEGUIFrameWindowProperties.h:240
SizingLocation
Enumeration that defines the set of possible locations for the mouse on a frame windows sizing border...
Definition: CEGUIFrameWindow.h:100
void setSizingBorderThickness(float pixels)
Set the size of the sizing border for this window.
Definition: CEGUIFrameWindow.h:280
Property to access the setting for whether the window frame will be displayed.
Definition: CEGUIFrameWindowProperties.h:85
bool d_beingSized
true if window is being sized.
Definition: CEGUIFrameWindow.h:719
bool isRightSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on right edge.
Definition: CEGUIFrameWindow.h:605
Point d_dragPoint
point window is being dragged at.
Definition: CEGUIFrameWindow.h:721
Property to access the N-S (up-down) sizing cursor image.
Definition: CEGUIFrameWindowProperties.h:263
static const String CloseButtonNameSuffix
Widget name suffix for the close button component.
Definition: CEGUIFrameWindow.h:93
Property to access the state of the sizable setting for the FrameWindow.
Definition: CEGUIFrameWindowProperties.h:59
bool isDragMovingEnabled(void) const
Return whether this FrameWindow can be moved by dragging the title bar.
Definition: CEGUIFrameWindow.h:305
Position will size from the bottom right.
Definition: CEGUIFrameWindow.h:105
Position will size from the top.
Definition: CEGUIFrameWindow.h:106
Class representing the title bar for Frame Windows.
Definition: CEGUITitlebar.h:52
Property to access the roll-up / shade state of the window.
Definition: CEGUIFrameWindowProperties.h:189
Position is not a sizing location.
Definition: CEGUIFrameWindow.h:101
float d_borderSize
thickness of the sizing border around this window
Definition: CEGUIFrameWindow.h:720
Base class to provide logic for push button type widgets.
Definition: CEGUIPushButton.h:48
bool d_dragMovable
true if the window will move when dragged by the title bar.
Definition: CEGUIFrameWindow.h:729
static const String EventCloseClicked
Definition: CEGUIFrameWindow.h:72
virtual Rect getSizingRect(void) const
Return a Rect that describes, in window relative pixel co-ordinates, the outer edge of the sizing are...
Definition: CEGUIFrameWindow.h:652
float getSizingBorderThickness(void) const
Return the thickness of the sizing border.
Definition: CEGUIFrameWindow.h:192
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: CEGUIWindow.h:138
Abstract base class for a movable, sizable, window with a title-bar and a frame.
Definition: CEGUIFrameWindow.h:51
bool isSizingEnabled(void) const
Return whether this window is sizable. Note that this requires that the window have an enabled frame ...
Definition: CEGUIFrameWindow.h:132
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIFrameWindow.h:665
bool d_frameEnabled
true if window frame should be drawn.
Definition: CEGUIFrameWindow.h:711
Position will size from the top-left.
Definition: CEGUIFrameWindow.h:102
const Image * d_ewSizingCursor
East/West sizing cursor image.
Definition: CEGUIFrameWindow.h:725
bool isFrameEnabled(void) const
Return whether the frame for this window is enabled.
Definition: CEGUIFrameWindow.h:142
static const String EventDragSizingEnded
Definition: CEGUIFrameWindow.h:84
Property to access the NW-SE diagonal sizing cursor image.
Definition: CEGUIFrameWindowProperties.h:307
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: CEGUIInputEvent.h:245
Property to access the setting for whether the window title-bar will be enabled (or displayed dependi...
Definition: CEGUIFrameWindowProperties.h:111
Property to access the setting for whether the user may drag the window around by its title bar...
Definition: CEGUIFrameWindowProperties.h:215
Property to access the setting for whether the window close button will be enabled (or displayed depe...
Definition: CEGUIFrameWindowProperties.h:137
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: CEGUIInputEvent.h:274
bool isBottomSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on bottom edge.
Definition: CEGUIFrameWindow.h:631
static const String EventRollupToggled
Definition: CEGUIFrameWindow.h:66
bool isLeftSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on left edge.
Definition: CEGUIFrameWindow.h:592
Position will size from the bottom.
Definition: CEGUIFrameWindow.h:108
bool isTopSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on top edge.
Definition: CEGUIFrameWindow.h:618
Property to access the NE-SW diagonal sizing cursor image.
Definition: CEGUIFrameWindowProperties.h:329
bool isRollupEnabled(void) const
Return whether roll up (a.k.a shading) is enabled for this window.
Definition: CEGUIFrameWindow.h:172
const Image * d_nsSizingCursor
North/South sizing cursor image.
Definition: CEGUIFrameWindow.h:724
const Image * d_neswSizingCursor
North-East/South-West cursor image.
Definition: CEGUIFrameWindow.h:727
EventArgs based class that is used for Activated and Deactivated window events.
Definition: CEGUIInputEvent.h:323
Class encapsulating operations on a Rectangle.
Definition: CEGUIRect.h:44
virtual bool isHit(const Vector2 &position, const bool allow_disabled=false) const
check if the given pixel position would hit this window.
String class used within the GUI system.
Definition: CEGUIString.h:57
bool isHit(const Point &position, const bool) const
check if the given pixel position would hit this window.
Definition: CEGUIFrameWindow.h:478