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 "elements/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
00065 static const float DefaultSizingBorderSize;
00066
00067
00068
00069
00070 static const String TitlebarNameSuffix;
00071 static const String CloseButtonNameSuffix;
00072
00073
00078 enum SizingLocation {
00079 SizingNone,
00080 SizingTopLeft,
00081 SizingTopRight,
00082 SizingBottomLeft,
00083 SizingBottomRight,
00084 SizingTop,
00085 SizingLeft,
00086 SizingBottom,
00087 SizingRight
00088 };
00089
00100 virtual void initialiseComponents(void);
00101
00102
00110 bool isSizingEnabled(void) const {return d_sizingEnabled && isFrameEnabled();}
00111
00112
00120 bool isFrameEnabled(void) const {return d_frameEnabled;}
00121
00122
00130 bool isTitleBarEnabled(void) const;
00131
00132
00140 bool isCloseButtonEnabled(void) const;
00141
00142
00150 bool isRollupEnabled(void) const {return d_rollupEnabled;}
00151
00152
00160 bool isRolledup(void) const {return d_rolledup;}
00161
00162
00170 float getSizingBorderThickness(void) const {return d_borderSize;}
00171
00172
00183 void setSizingEnabled(bool setting);
00184
00185
00196 void setFrameEnabled(bool setting);
00197
00198
00209 void setTitleBarEnabled(bool setting);
00210
00211
00222 void setCloseButtonEnabled(bool setting);
00223
00224
00235 void setRollupEnabled(bool setting);
00236
00237
00245 void toggleRollup(void);
00246
00247
00258 void setSizingBorderThickness(float pixels) {d_borderSize = pixels;}
00259
00260
00273 void offsetPixelPosition(const Vector2& offset);
00274
00275
00283 bool isDragMovingEnabled(void) const {return d_dragMovable;}
00284
00285
00296 void setDragMovingEnabled(bool setting);
00297
00298
00307 const Image* getNSSizingCursorImage() const;
00308
00317 const Image* getEWSizingCursorImage() const;
00318
00327 const Image* getNWSESizingCursorImage() const;
00328
00337 const Image* getNESWSizingCursorImage() const;
00338
00349 void setNSSizingCursorImage(const Image* image);
00350
00361 void setEWSizingCursorImage(const Image* image);
00362
00373 void setNWSESizingCursorImage(const Image* image);
00374
00385 void setNESWSizingCursorImage(const Image* image);
00386
00402 void setNSSizingCursorImage(const String& imageset, const String& image);
00403
00419 void setEWSizingCursorImage(const String& imageset, const String& image);
00420
00436 void setNWSESizingCursorImage(const String& imageset, const String& image);
00437
00453 void setNESWSizingCursorImage(const String& imageset, const String& image);
00454
00455
00456 bool isHit(const Point& position) const { return Window::isHit(position) && !d_rolledup; }
00457
00468 Titlebar* getTitlebar() const;
00469
00481 PushButton* getCloseButton() const;
00482
00483
00484
00485
00490 FrameWindow(const String& name, const String& type);
00491
00496 virtual ~FrameWindow(void);
00497
00498
00499 protected:
00500
00501
00502
00510 void moveLeftEdge(float delta);
00511
00512
00520 void moveRightEdge(float delta);
00521
00522
00530 void moveTopEdge(float delta);
00531
00532
00540 void moveBottomEdge(float delta);
00541
00542
00556 SizingLocation getSizingBorderAtPoint(const Point& pt) const;
00557
00558
00569 bool isLeftSizingLocation(SizingLocation loc) const {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
00570
00571
00582 bool isRightSizingLocation(SizingLocation loc) const {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
00583
00584
00595 bool isTopSizingLocation(SizingLocation loc) const {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
00596
00597
00608 bool isBottomSizingLocation(SizingLocation loc) const {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
00609
00610
00615 bool closeClickHandler(const EventArgs& e);
00616
00617
00622 void setCursorForPoint(const Point& pt) const;
00623
00624
00629 virtual Rect getSizingRect(void) const {return Rect(0, 0, d_pixelSize.d_width, d_pixelSize.d_height);}
00630
00631
00642 virtual bool testClassName_impl(const String& class_name) const
00643 {
00644 if (class_name=="FrameWindow") return true;
00645 return Window::testClassName_impl(class_name);
00646 }
00647
00648
00649
00650
00651
00657 virtual void onRollupToggled(WindowEventArgs& e);
00658
00659
00664 virtual void onCloseClicked(WindowEventArgs& e);
00665
00666
00667
00668
00669
00670 virtual void onMouseMove(MouseEventArgs& e);
00671 virtual void onMouseButtonDown(MouseEventArgs& e);
00672 virtual void onMouseButtonUp(MouseEventArgs& e);
00673 virtual void onCaptureLost(WindowEventArgs& e);
00674 virtual void onTextChanged(WindowEventArgs& e);
00675 virtual void onActivated(ActivationEventArgs& e);
00676 virtual void onDeactivated(ActivationEventArgs& e);
00677
00678
00679
00680
00681
00682
00683 bool d_frameEnabled;
00684
00685
00686 bool d_rollupEnabled;
00687 bool d_rolledup;
00688
00689
00690 bool d_sizingEnabled;
00691 bool d_beingSized;
00692 float d_borderSize;
00693 Point d_dragPoint;
00694
00695
00696 const Image* d_nsSizingCursor;
00697 const Image* d_ewSizingCursor;
00698 const Image* d_nwseSizingCursor;
00699 const Image* d_neswSizingCursor;
00700
00701 bool d_dragMovable;
00702
00703
00704 private:
00705
00706
00707
00708 static FrameWindowProperties::SizingEnabled d_sizingEnabledProperty;
00709 static FrameWindowProperties::FrameEnabled d_frameEnabledProperty;
00710 static FrameWindowProperties::TitlebarEnabled d_titlebarEnabledProperty;
00711 static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
00712 static FrameWindowProperties::RollUpState d_rollUpStateProperty;
00713 static FrameWindowProperties::RollUpEnabled d_rollUpEnabledProperty;
00714 static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
00715 static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
00716 static FrameWindowProperties::NSSizingCursorImage d_nsSizingCursorProperty;
00717 static FrameWindowProperties::EWSizingCursorImage d_ewSizingCursorProperty;
00718 static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
00719 static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
00720
00721
00722
00723
00724
00725 void addFrameWindowProperties(void);
00726 };
00727
00728 }
00729
00730 #if defined(_MSC_VER)
00731 # pragma warning(pop)
00732 #endif
00733
00734 #endif // end of guard _CEGUIFrameWindow_h_