CEGUIFrameWindow.h

00001 /***********************************************************************
00002         filename:       CEGUIFrameWindow.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for FrameWindow
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
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 // Start of CEGUI namespace section
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                 Constants       
00059         *************************************************************************/
00060         // additional event names for this window
00061         static const String EventRollupToggled;         
00062         static const String EventCloseClicked;          
00063 
00064         // other bits
00065         static const float      DefaultSizingBorderSize;        
00066 
00067     /*************************************************************************
00068         Child Widget name suffix constants
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     // overridden from Window class
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                 Construction / Destruction
00485         *************************************************************************/
00490         FrameWindow(const String& name, const String& type);
00491 
00496         virtual ~FrameWindow(void);
00497 
00498 
00499 protected:
00500         /*************************************************************************
00501                 Implementation Functions
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                 New events for Frame Windows
00651         *************************************************************************/
00657         virtual void    onRollupToggled(WindowEventArgs& e);
00658 
00659 
00664         virtual void    onCloseClicked(WindowEventArgs& e);
00665 
00666 
00667         /*************************************************************************
00668                 Overridden event handlers
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                 Implementation Data
00681         *************************************************************************/
00682         // frame data
00683         bool    d_frameEnabled;         
00684 
00685         // window roll-up data
00686         bool    d_rollupEnabled;        
00687         bool    d_rolledup;                     
00688 
00689         // drag-sizing data
00690         bool    d_sizingEnabled;        
00691         bool    d_beingSized;           
00692         float   d_borderSize;           
00693         Point   d_dragPoint;            
00694 
00695         // images for cursor when on sizing border
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                 Static Properties for this class
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                 Private methods
00724         *************************************************************************/
00725         void    addFrameWindowProperties(void);
00726 };
00727 
00728 } // End of  CEGUI namespace section
00729 
00730 #if defined(_MSC_VER)
00731 #       pragma warning(pop)
00732 #endif
00733 
00734 #endif  // end of guard _CEGUIFrameWindow_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4