Crazy Eddies GUI System  0.6.0
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 "elements/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
61  static const String EventRollupToggled;
62  static const String EventCloseClicked;
63 
64  // other bits
65  static const float DefaultSizingBorderSize;
66 
67  /*************************************************************************
68  Child Widget name suffix constants
69  *************************************************************************/
70  static const String TitlebarNameSuffix;
72 
73 
87  SizingRight
88  };
89 
100  virtual void initialiseComponents(void);
101 
102 
110  bool isSizingEnabled(void) const {return d_sizingEnabled && isFrameEnabled();}
111 
112 
120  bool isFrameEnabled(void) const {return d_frameEnabled;}
121 
122 
130  bool isTitleBarEnabled(void) const;
131 
132 
140  bool isCloseButtonEnabled(void) const;
141 
142 
150  bool isRollupEnabled(void) const {return d_rollupEnabled;}
151 
152 
160  bool isRolledup(void) const {return d_rolledup;}
161 
162 
170  float getSizingBorderThickness(void) const {return d_borderSize;}
171 
172 
183  void setSizingEnabled(bool setting);
184 
185 
196  void setFrameEnabled(bool setting);
197 
198 
209  void setTitleBarEnabled(bool setting);
210 
211 
222  void setCloseButtonEnabled(bool setting);
223 
224 
235  void setRollupEnabled(bool setting);
236 
237 
245  void toggleRollup(void);
246 
247 
258  void setSizingBorderThickness(float pixels) {d_borderSize = pixels;}
259 
260 
273  void offsetPixelPosition(const Vector2& offset);
274 
275 
283  bool isDragMovingEnabled(void) const {return d_dragMovable;}
284 
285 
296  void setDragMovingEnabled(bool setting);
297 
298 
307  const Image* getNSSizingCursorImage() const;
308 
317  const Image* getEWSizingCursorImage() const;
318 
327  const Image* getNWSESizingCursorImage() const;
328 
337  const Image* getNESWSizingCursorImage() const;
338 
349  void setNSSizingCursorImage(const Image* image);
350 
361  void setEWSizingCursorImage(const Image* image);
362 
373  void setNWSESizingCursorImage(const Image* image);
374 
385  void setNESWSizingCursorImage(const Image* image);
386 
402  void setNSSizingCursorImage(const String& imageset, const String& image);
403 
419  void setEWSizingCursorImage(const String& imageset, const String& image);
420 
436  void setNWSESizingCursorImage(const String& imageset, const String& image);
437 
453  void setNESWSizingCursorImage(const String& imageset, const String& image);
454 
455  // overridden from Window class
456  bool isHit(const Point& position) const { return Window::isHit(position) && !d_rolledup; }
457 
468  Titlebar* getTitlebar() const;
469 
481  PushButton* getCloseButton() const;
482 
483  /*************************************************************************
484  Construction / Destruction
485  *************************************************************************/
490  FrameWindow(const String& name, const String& type);
491 
496  virtual ~FrameWindow(void);
497 
498 
499 protected:
500  /*************************************************************************
501  Implementation Functions
502  *************************************************************************/
510  void moveLeftEdge(float delta);
511 
512 
520  void moveRightEdge(float delta);
521 
522 
530  void moveTopEdge(float delta);
531 
532 
540  void moveBottomEdge(float delta);
541 
542 
556  SizingLocation getSizingBorderAtPoint(const Point& pt) const;
557 
558 
569  bool isLeftSizingLocation(SizingLocation loc) const {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
570 
571 
582  bool isRightSizingLocation(SizingLocation loc) const {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
583 
584 
595  bool isTopSizingLocation(SizingLocation loc) const {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
596 
597 
608  bool isBottomSizingLocation(SizingLocation loc) const {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
609 
610 
615  bool closeClickHandler(const EventArgs& e);
616 
617 
622  void setCursorForPoint(const Point& pt) const;
623 
624 
629  virtual Rect getSizingRect(void) const {return Rect(0, 0, d_pixelSize.d_width, d_pixelSize.d_height);}
630 
631 
642  virtual bool testClassName_impl(const String& class_name) const
643  {
644  if (class_name=="FrameWindow") return true;
645  return Window::testClassName_impl(class_name);
646  }
647 
648 
649  /*************************************************************************
650  New events for Frame Windows
651  *************************************************************************/
657  virtual void onRollupToggled(WindowEventArgs& e);
658 
659 
664  virtual void onCloseClicked(WindowEventArgs& e);
665 
666 
667  /*************************************************************************
668  Overridden event handlers
669  *************************************************************************/
670  virtual void onMouseMove(MouseEventArgs& e);
671  virtual void onMouseButtonDown(MouseEventArgs& e);
672  virtual void onMouseButtonUp(MouseEventArgs& e);
673  virtual void onCaptureLost(WindowEventArgs& e);
674  virtual void onTextChanged(WindowEventArgs& e);
675  virtual void onActivated(ActivationEventArgs& e);
676  virtual void onDeactivated(ActivationEventArgs& e);
677 
678 
679  /*************************************************************************
680  Implementation Data
681  *************************************************************************/
682  // frame data
684 
685  // window roll-up data
687  bool d_rolledup;
688 
689  // drag-sizing data
692  float d_borderSize;
694 
695  // images for cursor when on sizing border
700 
702 
703 
704 private:
705  /*************************************************************************
706  Static Properties for this class
707  *************************************************************************/
708  static FrameWindowProperties::SizingEnabled d_sizingEnabledProperty;
709  static FrameWindowProperties::FrameEnabled d_frameEnabledProperty;
710  static FrameWindowProperties::TitlebarEnabled d_titlebarEnabledProperty;
711  static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
712  static FrameWindowProperties::RollUpState d_rollUpStateProperty;
713  static FrameWindowProperties::RollUpEnabled d_rollUpEnabledProperty;
714  static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
715  static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
716  static FrameWindowProperties::NSSizingCursorImage d_nsSizingCursorProperty;
717  static FrameWindowProperties::EWSizingCursorImage d_ewSizingCursorProperty;
718  static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
719  static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
720 
721 
722  /*************************************************************************
723  Private methods
724  *************************************************************************/
725  void addFrameWindowProperties(void);
726 };
727 
728 } // End of CEGUI namespace section
729 
730 #if defined(_MSC_VER)
731 # pragma warning(pop)
732 #endif
733 
734 #endif // end of guard _CEGUIFrameWindow_h_