Crazy Eddie's GUI System  0.8.7
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 
334 
344 
354 
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 
484 
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 
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  *************************************************************************/
655 
656 
661  virtual void onCloseClicked(WindowEventArgs& e);
662 
665 
668 
669  /*************************************************************************
670  Overridden event handlers
671  *************************************************************************/
672  virtual void onMouseMove(MouseEventArgs& e);
674  virtual void onMouseButtonUp(MouseEventArgs& e);
675  virtual void onCaptureLost(WindowEventArgs& e);
676  virtual void onTextChanged(WindowEventArgs& 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 
CEGUI::FrameWindow::setNESWSizingCursorImage
void setNESWSizingCursorImage(const Image *image)
Set the Image to be used for the northeast-southwest sizing mouse cursor.
CEGUI::FrameWindow::setRollupEnabled
void setRollupEnabled(bool setting)
Enables or disables roll-up (shading) for this window.
CEGUI::FrameWindow::initialiseComponents
virtual void initialiseComponents(void)
Initialises the Window based object ready for use.
CEGUI::FrameWindow::EventCloseClicked
static const String EventCloseClicked
Definition: widgets/FrameWindow.h:69
CEGUI::FrameWindow::setSizingBorderThickness
void setSizingBorderThickness(float pixels)
Set the size of the sizing border for this window.
Definition: widgets/FrameWindow.h:284
CEGUI::FrameWindow::onMouseButtonUp
virtual void onMouseButtonUp(MouseEventArgs &e)
Handler called when a mouse button has been released within this window's area.
CEGUI::FrameWindow::isDragMovingEnabled
bool isDragMovingEnabled(void) const
Return whether this FrameWindow can be moved by dragging the title bar.
Definition: widgets/FrameWindow.h:309
CEGUI::FrameWindow::SizingBottom
@ SizingBottom
Position will size from the bottom.
Definition: widgets/FrameWindow.h:105
CEGUI::FrameWindow::WidgetTypeName
static const String WidgetTypeName
Window factory name.
Definition: widgets/FrameWindow.h:52
CEGUI::FrameWindow::getNWSESizingCursorImage
const Image * getNWSESizingCursorImage() const
Return a pointer to the currently set Image to be used for the northwest-southeast sizing mouse curso...
CEGUI::FrameWindow::setCloseButtonEnabled
void setCloseButtonEnabled(bool setting)
Enables or disables the close button for the frame window.
CEGUI::FrameWindow::isHit
bool isHit(const Vector2f &position, const bool) const
check if the given pixel position would hit this window.
Definition: widgets/FrameWindow.h:470
CEGUI::FrameWindow::DefaultSizingBorderSize
static const float DefaultSizingBorderSize
Default size for the sizing border (in pixels)
Definition: widgets/FrameWindow.h:84
CEGUI::FrameWindow::onMouseMove
virtual void onMouseMove(MouseEventArgs &e)
Handler called when the mouse cursor has been moved within this window's area.
CEGUI::FrameWindow::onDeactivated
virtual void onDeactivated(ActivationEventArgs &e)
Handler called when this window has lost input focus and has been deactivated.
CEGUI::Window::isHit
virtual bool isHit(const Vector2f &position, const bool allow_disabled=false) const
check if the given pixel position would hit this window.
CEGUI::FrameWindow::isTopSizingLocation
bool isTopSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on top edge.
Definition: widgets/FrameWindow.h:610
CEGUI::FrameWindow::setEWSizingCursorImage
void setEWSizingCursorImage(const String &name)
Set the image to be used for the east-west sizing mouse cursor.
CEGUI::FrameWindow::moveBottomEdge
bool moveBottomEdge(float delta, URect &out_area)
move the window's bottom edge by 'delta'. The rest of the window does not move, thus this changes the...
CEGUI::FrameWindow::isLeftSizingLocation
bool isLeftSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on left edge.
Definition: widgets/FrameWindow.h:584
CEGUI::FrameWindow::SizingNone
@ SizingNone
Position is not a sizing location.
Definition: widgets/FrameWindow.h:98
CEGUI::FrameWindow::~FrameWindow
virtual ~FrameWindow(void)
Destructor for FramwWindow objects.
CEGUI::FrameWindow::d_nwseSizingCursor
const Image * d_nwseSizingCursor
North-West/South-East cursor image.
Definition: widgets/FrameWindow.h:700
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::FrameWindow::isCloseButtonEnabled
bool isCloseButtonEnabled(void) const
Return whether this close button for this window is enabled.
CEGUI::FrameWindow::onTextChanged
virtual void onTextChanged(WindowEventArgs &e)
Handler called when the window's text is changed.
CEGUI::FrameWindow::d_borderSize
float d_borderSize
thickness of the sizing border around this window
Definition: widgets/FrameWindow.h:694
CEGUI::MouseEventArgs
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:281
CEGUI::FrameWindow::d_dragMovable
bool d_dragMovable
true if the window will move when dragged by the title bar.
Definition: widgets/FrameWindow.h:703
CEGUI::FrameWindow::getCloseButton
PushButton * getCloseButton() const
Return a pointer to the close button component widget for this FrameWindow.
CEGUI::FrameWindow::EventDragSizingEnded
static const String EventDragSizingEnded
Definition: widgets/FrameWindow.h:81
CEGUI::FrameWindow::SizingTop
@ SizingTop
Position will size from the top.
Definition: widgets/FrameWindow.h:103
CEGUI::FrameWindow::d_rollupEnabled
bool d_rollupEnabled
true if roll-up of window is allowed.
Definition: widgets/FrameWindow.h:688
CEGUI::FrameWindow::setNESWSizingCursorImage
void setNESWSizingCursorImage(const String &name)
Set the image to be used for the northeast-southwest sizing mouse cursor.
CEGUI::FrameWindow::moveRightEdge
bool moveRightEdge(float delta, URect &out_area)
move the window's right edge by 'delta'. The rest of the window does not move, thus this changes the ...
CEGUI::Vector2< float >
CEGUI::FrameWindow::CloseButtonName
static const String CloseButtonName
Widget name for the close button component.
Definition: widgets/FrameWindow.h:90
CEGUI::FrameWindow::TitlebarName
static const String TitlebarName
Widget name for the titlebar component.
Definition: widgets/FrameWindow.h:89
CEGUI::FrameWindow::isSizingEnabled
bool isSizingEnabled(void) const
Return whether this window is sizable. Note that this requires that the window have an enabled frame ...
Definition: widgets/FrameWindow.h:129
CEGUI::WindowEventArgs
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:252
CEGUI::FrameWindow::onRollupToggled
virtual void onRollupToggled(WindowEventArgs &e)
Event generated internally whenever the roll-up / shade state of the window changes.
CEGUI::FrameWindow::toggleRollup
void toggleRollup(void)
Toggles the state of the window between rolled-up (shaded) and normal sizes. This requires roll-up to...
CEGUI::FrameWindow::isBottomSizingLocation
bool isBottomSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on bottom edge.
Definition: widgets/FrameWindow.h:623
CEGUI::FrameWindow::setNSSizingCursorImage
void setNSSizingCursorImage(const String &name)
Set the image to be used for the north-south sizing mouse cursor.
CEGUI::FrameWindow::EventDragSizingStarted
static const String EventDragSizingStarted
Definition: widgets/FrameWindow.h:75
CEGUI::FrameWindow::EventRollupToggled
static const String EventRollupToggled
Definition: widgets/FrameWindow.h:63
CEGUI::FrameWindow::d_dragPoint
Vector2f d_dragPoint
point window is being dragged at.
Definition: widgets/FrameWindow.h:695
CEGUI::FrameWindow::d_ewSizingCursor
const Image * d_ewSizingCursor
East/West sizing cursor image.
Definition: widgets/FrameWindow.h:699
CEGUI::FrameWindow::onMouseButtonDown
virtual void onMouseButtonDown(MouseEventArgs &e)
Handler called when a mouse button has been depressed within this window's area.
CEGUI::FrameWindow::SizingLeft
@ SizingLeft
Position will size from the left.
Definition: widgets/FrameWindow.h:104
CEGUI::FrameWindow::d_nsSizingCursor
const Image * d_nsSizingCursor
North/South sizing cursor image.
Definition: widgets/FrameWindow.h:698
CEGUI::FrameWindow::getNESWSizingCursorImage
const Image * getNESWSizingCursorImage() const
Return a pointer to the currently set Image to be used for the northeast-southwest sizing mouse curso...
CEGUI::ActivationEventArgs
EventArgs based class that is used for Activated and Deactivated window events.
Definition: InputEvent.h:330
CEGUI::FrameWindow::getNSSizingCursorImage
const Image * getNSSizingCursorImage() const
Return a pointer to the currently set Image to be used for the north-south sizing mouse cursor.
CEGUI::FrameWindow::FrameWindow
FrameWindow(const String &type, const String &name)
Constructor for FrameWindow objects.
CEGUI::FrameWindow::setNWSESizingCursorImage
void setNWSESizingCursorImage(const Image *image)
Set the Image to be used for the northwest-southeast sizing mouse cursor.
CEGUI::FrameWindow::getTitlebar
Titlebar * getTitlebar() const
Return a pointer to the Titlebar component widget for this FrameWindow.
CEGUI::FrameWindow::setRolledup
void setRolledup(bool val)
Sets whether the window is currently rolled up (a.k.a shaded).
CEGUI::FrameWindow::getSizingBorderAtPoint
SizingLocation getSizingBorderAtPoint(const Vector2f &pt) const
check local pixel co-ordinate point 'pt' and return one of the SizingLocation enumerated values depen...
CEGUI::FrameWindow
Abstract base class for a movable, sizable, window with a title-bar and a frame.
Definition: widgets/FrameWindow.h:49
CEGUI::FrameWindow::SizingBottomRight
@ SizingBottomRight
Position will size from the bottom right.
Definition: widgets/FrameWindow.h:102
CEGUI::FrameWindow::setCursorForPoint
void setCursorForPoint(const Vector2f &pt) const
Set the appropriate mouse cursor for the given window-relative pixel point.
CEGUI::FrameWindow::setTitleBarEnabled
void setTitleBarEnabled(bool setting)
Enables or disables the title bar for the frame window.
CEGUI::FrameWindow::setEWSizingCursorImage
void setEWSizingCursorImage(const Image *image)
Set the Image to be used for the east-west sizing mouse cursor.
CEGUI::FrameWindow::d_beingSized
bool d_beingSized
true if window is being sized.
Definition: widgets/FrameWindow.h:693
CEGUI::FrameWindow::moveTopEdge
bool moveTopEdge(float delta, URect &out_area)
move the window's top edge by 'delta'. The rest of the window does not move, thus this changes the si...
CEGUI::FrameWindow::d_sizingEnabled
bool d_sizingEnabled
true if sizing is enabled for this window.
Definition: widgets/FrameWindow.h:692
CEGUI::FrameWindow::isRightSizingLocation
bool isRightSizingLocation(SizingLocation loc) const
return true if given SizingLocation is on right edge.
Definition: widgets/FrameWindow.h:597
CEGUI::FrameWindow::onDragSizingEnded
virtual void onDragSizingEnded(WindowEventArgs &e)
Handler called when drag-sizing of the FrameWindow ends.
CEGUI::FrameWindow::closeClickHandler
bool closeClickHandler(const EventArgs &e)
Method to respond to close button click events and fire our close event.
CEGUI::FrameWindow::getSizingRect
virtual Rectf getSizingRect(void) const
Return a Rect that describes, in window relative pixel co-ordinates, the outer edge of the sizing are...
Definition: widgets/FrameWindow.h:644
CEGUI::FrameWindow::moveLeftEdge
bool moveLeftEdge(float delta, URect &out_area)
move the window's left edge by 'delta'. The rest of the window does not move, thus this changes the s...
CEGUI::FrameWindow::onCaptureLost
virtual void onCaptureLost(WindowEventArgs &e)
Handler called when this window loses capture of mouse inputs.
CEGUI::FrameWindow::SizingLocation
SizingLocation
Enumeration that defines the set of possible locations for the mouse on a frame windows sizing border...
Definition: widgets/FrameWindow.h:97
CEGUI::FrameWindow::isTitleBarEnabled
bool isTitleBarEnabled(void) const
Return whether the title bar for this window is enabled.
CEGUI::Window
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
CEGUI::FrameWindow::setDragMovingEnabled
void setDragMovingEnabled(bool setting)
Set whether this FrameWindow can be moved by dragging the title bar.
CEGUI::FrameWindow::setSizingEnabled
void setSizingEnabled(bool setting)
Enables or disables sizing for this window.
CEGUI::FrameWindow::SizingBottomLeft
@ SizingBottomLeft
Position will size from the bottom left.
Definition: widgets/FrameWindow.h:101
CEGUI::FrameWindow::getSizingBorderThickness
float getSizingBorderThickness(void) const
Return the thickness of the sizing border.
Definition: widgets/FrameWindow.h:197
CEGUI::FrameWindow::SizingTopRight
@ SizingTopRight
Position will size from the top-right.
Definition: widgets/FrameWindow.h:100
CEGUI::FrameWindow::EventNamespace
static const String EventNamespace
Namespace for global events.
Definition: widgets/FrameWindow.h:51
CEGUI::FrameWindow::onCloseClicked
virtual void onCloseClicked(WindowEventArgs &e)
Event generated internally whenever the close button is clicked.
CEGUI::FrameWindow::setFrameEnabled
void setFrameEnabled(bool setting)
Enables or disables the frame for this window.
CEGUI::FrameWindow::SizingTopLeft
@ SizingTopLeft
Position will size from the top-left.
Definition: widgets/FrameWindow.h:99
CEGUI::FrameWindow::d_rolledup
bool d_rolledup
true if window is rolled up.
Definition: widgets/FrameWindow.h:689
CEGUI::FrameWindow::d_frameEnabled
bool d_frameEnabled
true if window frame should be drawn.
Definition: widgets/FrameWindow.h:685
CEGUI::FrameWindow::setNSSizingCursorImage
void setNSSizingCursorImage(const Image *image)
Set the Image to be used for the north-south sizing mouse cursor.
CEGUI::FrameWindow::offsetPixelPosition
void offsetPixelPosition(const Vector2f &offset)
Move the window by the pixel offsets specified in offset.
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::FrameWindow::onActivated
virtual void onActivated(ActivationEventArgs &e)
Handler called when this window has become the active window.
CEGUI::FrameWindow::isFrameEnabled
bool isFrameEnabled(void) const
Return whether the frame for this window is enabled.
Definition: widgets/FrameWindow.h:139
CEGUI::FrameWindow::setNWSESizingCursorImage
void setNWSESizingCursorImage(const String &name)
Set the image to be used for the northwest-southeast sizing mouse cursor.
CEGUI::Rect< UDim >
CEGUI::FrameWindow::isRollupEnabled
bool isRollupEnabled(void) const
Return whether roll up (a.k.a shading) is enabled for this window.
Definition: widgets/FrameWindow.h:169
CEGUI::FrameWindow::isRolledup
bool isRolledup(void) const
Return whether the window is currently rolled up (a.k.a shaded).
Definition: widgets/FrameWindow.h:187
CEGUI::Titlebar
Class representing the title bar for Frame Windows.
Definition: widgets/Titlebar.h:51
CEGUI::PushButton
Base class to provide logic for push button type widgets.
Definition: PushButton.h:48
CEGUI::Image
Interface for Image.
Definition: Image.h:161
CEGUI::FrameWindow::onDragSizingStarted
virtual void onDragSizingStarted(WindowEventArgs &e)
Handler called when drag-sizing of the FrameWindow starts.
CEGUI::FrameWindow::getEWSizingCursorImage
const Image * getEWSizingCursorImage() const
Return a pointer to the currently set Image to be used for the east-west sizing mouse cursor.
CEGUI::EventArgs
Base class used as the argument to all subscribers Event object.
Definition: EventArgs.h:51
CEGUI::FrameWindow::d_neswSizingCursor
const Image * d_neswSizingCursor
North-East/South-West cursor image.
Definition: widgets/FrameWindow.h:701