00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUIFrameWindow_h_
00031 #define _CEGUIFrameWindow_h_
00032
00033 #include "../CEGUIBase.h"
00034 #include "../CEGUIWindow.h"
00035 #include "CEGUIFrameWindowProperties.h"
00036
00037
00038 #if defined(_MSC_VER)
00039 # pragma warning(push)
00040 # pragma warning(disable : 4251)
00041 #endif
00042
00043
00044
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT FrameWindow : public Window
00052 {
00053 public:
00054 static const String EventNamespace;
00055 static const String WidgetTypeName;
00056
00057
00058
00059
00060
00061 static const String EventRollupToggled;
00062 static const String EventCloseClicked;
00063
00064 static const String EventDragSizingStarted;
00066 static const String EventDragSizingEnded;
00067
00068
00069 static const float DefaultSizingBorderSize;
00070
00071
00072
00073
00074 static const String TitlebarNameSuffix;
00075 static const String CloseButtonNameSuffix;
00076
00077
00082 enum SizingLocation {
00083 SizingNone,
00084 SizingTopLeft,
00085 SizingTopRight,
00086 SizingBottomLeft,
00087 SizingBottomRight,
00088 SizingTop,
00089 SizingLeft,
00090 SizingBottom,
00091 SizingRight
00092 };
00093
00104 virtual void initialiseComponents(void);
00105
00106
00114 bool isSizingEnabled(void) const {return d_sizingEnabled && isFrameEnabled();}
00115
00116
00124 bool isFrameEnabled(void) const {return d_frameEnabled;}
00125
00126
00134 bool isTitleBarEnabled(void) const;
00135
00136
00144 bool isCloseButtonEnabled(void) const;
00145
00146
00154 bool isRollupEnabled(void) const {return d_rollupEnabled;}
00155
00156
00164 bool isRolledup(void) const {return d_rolledup;}
00165
00166
00174 float getSizingBorderThickness(void) const {return d_borderSize;}
00175
00176
00187 void setSizingEnabled(bool setting);
00188
00189
00200 void setFrameEnabled(bool setting);
00201
00202
00213 void setTitleBarEnabled(bool setting);
00214
00215
00226 void setCloseButtonEnabled(bool setting);
00227
00228
00239 void setRollupEnabled(bool setting);
00240
00241
00249 void toggleRollup(void);
00250
00251
00262 void setSizingBorderThickness(float pixels) {d_borderSize = pixels;}
00263
00264
00277 void offsetPixelPosition(const Vector2& offset);
00278
00279
00287 bool isDragMovingEnabled(void) const {return d_dragMovable;}
00288
00289
00300 void setDragMovingEnabled(bool setting);
00301
00302
00311 const Image* getNSSizingCursorImage() const;
00312
00321 const Image* getEWSizingCursorImage() const;
00322
00331 const Image* getNWSESizingCursorImage() const;
00332
00341 const Image* getNESWSizingCursorImage() const;
00342
00353 void setNSSizingCursorImage(const Image* image);
00354
00365 void setEWSizingCursorImage(const Image* image);
00366
00377 void setNWSESizingCursorImage(const Image* image);
00378
00389 void setNESWSizingCursorImage(const Image* image);
00390
00406 void setNSSizingCursorImage(const String& imageset, const String& image);
00407
00423 void setEWSizingCursorImage(const String& imageset, const String& image);
00424
00440 void setNWSESizingCursorImage(const String& imageset, const String& image);
00441
00457 void setNESWSizingCursorImage(const String& imageset, const String& image);
00458
00459
00460 bool isHit(const Point& position, const bool ) const
00461 { return Window::isHit(position) && !d_rolledup; }
00462
00473 Titlebar* getTitlebar() const;
00474
00486 PushButton* getCloseButton() const;
00487
00488
00489
00490
00495 FrameWindow(const String& name, const String& type);
00496
00501 virtual ~FrameWindow(void);
00502
00503
00504 protected:
00505
00506
00507
00515 bool moveLeftEdge(float delta, URect& out_area);
00516
00517
00525 bool moveRightEdge(float delta, URect& out_area);
00526
00527
00535 bool moveTopEdge(float delta, URect& out_area);
00536
00537
00545 bool moveBottomEdge(float delta, URect& out_area);
00546
00547
00561 SizingLocation getSizingBorderAtPoint(const Point& pt) const;
00562
00563
00574 bool isLeftSizingLocation(SizingLocation loc) const {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
00575
00576
00587 bool isRightSizingLocation(SizingLocation loc) const {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
00588
00589
00600 bool isTopSizingLocation(SizingLocation loc) const {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
00601
00602
00613 bool isBottomSizingLocation(SizingLocation loc) const {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
00614
00615
00620 bool closeClickHandler(const EventArgs& e);
00621
00622
00627 void setCursorForPoint(const Point& pt) const;
00628
00629
00634 virtual Rect getSizingRect(void) const {return Rect(0, 0, d_pixelSize.d_width, d_pixelSize.d_height);}
00635
00636
00647 virtual bool testClassName_impl(const String& class_name) const
00648 {
00649 if (class_name=="FrameWindow") return true;
00650 return Window::testClassName_impl(class_name);
00651 }
00652
00653
00654
00655
00656
00662 virtual void onRollupToggled(WindowEventArgs& e);
00663
00664
00669 virtual void onCloseClicked(WindowEventArgs& e);
00670
00672 virtual void onDragSizingStarted(WindowEventArgs& e);
00673
00675 virtual void onDragSizingEnded(WindowEventArgs& e);
00676
00677
00678
00679
00680 virtual void onMouseMove(MouseEventArgs& e);
00681 virtual void onMouseButtonDown(MouseEventArgs& e);
00682 virtual void onMouseButtonUp(MouseEventArgs& e);
00683 virtual void onCaptureLost(WindowEventArgs& e);
00684 virtual void onTextChanged(WindowEventArgs& e);
00685 virtual void onActivated(ActivationEventArgs& e);
00686 virtual void onDeactivated(ActivationEventArgs& e);
00687
00688
00689
00690
00691
00692
00693 bool d_frameEnabled;
00694
00695
00696 bool d_rollupEnabled;
00697 bool d_rolledup;
00698
00699
00700 bool d_sizingEnabled;
00701 bool d_beingSized;
00702 float d_borderSize;
00703 Point d_dragPoint;
00704
00705
00706 const Image* d_nsSizingCursor;
00707 const Image* d_ewSizingCursor;
00708 const Image* d_nwseSizingCursor;
00709 const Image* d_neswSizingCursor;
00710
00711 bool d_dragMovable;
00712
00713
00714 private:
00715
00716
00717
00718 static FrameWindowProperties::SizingEnabled d_sizingEnabledProperty;
00719 static FrameWindowProperties::FrameEnabled d_frameEnabledProperty;
00720 static FrameWindowProperties::TitlebarEnabled d_titlebarEnabledProperty;
00721 static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
00722 static FrameWindowProperties::RollUpState d_rollUpStateProperty;
00723 static FrameWindowProperties::RollUpEnabled d_rollUpEnabledProperty;
00724 static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
00725 static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
00726 static FrameWindowProperties::NSSizingCursorImage d_nsSizingCursorProperty;
00727 static FrameWindowProperties::EWSizingCursorImage d_ewSizingCursorProperty;
00728 static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
00729 static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
00730
00731
00732
00733
00734
00735 void addFrameWindowProperties(void);
00736 };
00737
00738 }
00739
00740 #if defined(_MSC_VER)
00741 # pragma warning(pop)
00742 #endif
00743
00744 #endif // end of guard _CEGUIFrameWindow_h_