Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIFrameWindow.h

Go to the documentation of this file.
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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIFrameWindow_h_
00027 #define _CEGUIFrameWindow_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIFrameWindowProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00047 class CEGUIBASE_API FrameWindow : public Window
00048 {
00049 public:
00050         static const String EventNamespace;                             
00051 
00052 
00053         /*************************************************************************
00054                 Constants       
00055         *************************************************************************/
00056         // additional event names for this window
00057         static const String EventRollupToggled;         
00058         static const String EventCloseClicked;          
00059 
00060         // other bits
00061         static const float      DefaultSizingBorderSize;        
00062 
00063 
00068         enum SizingLocation {
00069                 SizingNone,                     
00070                 SizingTopLeft,          
00071                 SizingTopRight,         
00072                 SizingBottomLeft,       
00073                 SizingBottomRight,      
00074                 SizingTop,                      
00075                 SizingLeft,                     
00076                 SizingBottom,           
00077                 SizingRight,            
00078         };
00079 
00090         virtual void    initialise(void);
00091         
00092         
00100         bool    isSizingEnabled(void) const                                     {return d_sizingEnabled && isFrameEnabled();}
00101 
00102 
00110         bool    isFrameEnabled(void) const                                      {return d_frameEnabled;}
00111 
00112 
00120         bool    isTitleBarEnabled(void) const                           {return (d_titlebar != NULL) && !((Window*)d_titlebar)->isDisabled();}
00121 
00122 
00130         bool    isCloseButtonEnabled(void) const                        {return (d_closeButton != NULL) && !((Window*)d_closeButton)->isDisabled();}
00131 
00132 
00140         bool    isRollupEnabled(void) const                                     {return d_rollupEnabled;}
00141 
00142 
00150         bool    isRolledup(void) const                                          {return d_rolledup;}
00151 
00152 
00160         float   getSizingBorderThickness(void) const            {return d_borderSize;}
00161 
00162 
00173         void    setSizingEnabled(bool setting);
00174 
00175 
00186         void    setFrameEnabled(bool setting);
00187 
00188 
00199         void    setTitleBarEnabled(bool setting);
00200 
00201 
00212         void    setCloseButtonEnabled(bool setting);
00213 
00214 
00225         void    setRollupEnabled(bool setting);
00226 
00227 
00235         void    toggleRollup(void);
00236 
00237 
00248         void    setSizingBorderThickness(float pixels)          {d_borderSize = pixels;}
00249 
00250 
00261         void    setTitlebarFont(const String& name);
00262 
00263 
00274         void    setTitlebarFont(Font* font);
00275 
00276 
00289         void    offsetPixelPosition(const Vector2& offset);
00290 
00291 
00299         bool    isDragMovingEnabled(void) const         {return d_dragMovable;}
00300 
00301 
00312         void    setDragMovingEnabled(bool setting);
00313 
00314 
00322         const Font*     getTitlebarFont(void) const;
00323 
00324 
00332         colour  getCaptionColour(void) const;
00333 
00334 
00345         void    setCaptionColour(colour col);
00346 
00347 
00348         /*************************************************************************
00349                 Construction / Destruction
00350         *************************************************************************/
00355         FrameWindow(const String& name, const String& type);
00356 
00361         virtual ~FrameWindow(void);
00362 
00363 
00364 protected:
00365         /*************************************************************************
00366                 Implementation Functions
00367         *************************************************************************/
00375         virtual Titlebar*       createTitlebar(void) const              = 0;
00376 
00377 
00385         virtual PushButton*     createCloseButton(void) const   = 0;
00386 
00387 
00395         virtual void    layoutComponentWidgets()                = 0;
00396 
00397 
00405         void    moveLeftEdge(float delta);
00406 
00407 
00415         void    moveRightEdge(float delta);
00416 
00417 
00425         void    moveTopEdge(float delta);
00426 
00427 
00435         void    moveBottomEdge(float delta);
00436 
00437 
00451         SizingLocation  getSizingBorderAtPoint(const Point& pt) const;
00452 
00453  
00464         bool    isLeftSizingLocation(SizingLocation loc) const                  {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
00465 
00466 
00477         bool    isRightSizingLocation(SizingLocation loc) const                 {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
00478 
00479 
00490         bool    isTopSizingLocation(SizingLocation loc) const                   {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
00491 
00492 
00503         bool    isBottomSizingLocation(SizingLocation loc) const                {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
00504 
00505 
00510         void    addFrameWindowEvents(void);
00511 
00512 
00517         bool    closeClickHandler(const EventArgs& e);
00518 
00519 
00524         void    setCursorForPoint(const Point& pt) const;
00525 
00526 
00531         virtual Rect    getSizingRect(void) const               {return Rect(0, 0, d_abs_area.getWidth(), d_abs_area.getHeight());}
00532 
00533 
00534         /*************************************************************************
00535                 New events for Frame Windows
00536         *************************************************************************/
00542         virtual void    onRollupToggled(WindowEventArgs& e);
00543 
00544 
00549         virtual void    onCloseClicked(WindowEventArgs& e);
00550 
00551 
00552         /*************************************************************************
00553                 Overridden event handlers
00554         *************************************************************************/
00555         virtual void    onMouseMove(MouseEventArgs& e);
00556         virtual void    onMouseButtonDown(MouseEventArgs& e);
00557         virtual void    onMouseButtonUp(MouseEventArgs& e);
00558         virtual void    onCaptureLost(WindowEventArgs& e);
00559         virtual void    onSized(WindowEventArgs& e);
00560         virtual void    onParentSized(WindowEventArgs& e);
00561 
00562 
00563         /*************************************************************************
00564                 Implementation Data
00565         *************************************************************************/
00566         // frame data
00567         bool    d_frameEnabled;         
00568 
00569         // window roll-up data
00570         bool    d_rollupEnabled;        
00571         bool    d_rolledup;                     
00572         Size    d_abs_openSize;         
00573         Size    d_rel_openSize;         
00574 
00575         // drag-sizing data
00576         bool    d_sizingEnabled;        
00577         bool    d_beingSized;           
00578         float   d_borderSize;           
00579         Point   d_dragPoint;            
00580 
00581         // composite controls
00582         Titlebar*       d_titlebar;                             
00583         PushButton*     d_closeButton;                  
00584 
00585         // images for cursor when on sizing border
00586         const Image*    d_nsSizingCursor;               
00587         const Image*    d_ewSizingCursor;               
00588         const Image*    d_nwseSizingCursor;             
00589         const Image*    d_neswSizingCursor;             
00590 
00591         bool    d_dragMovable;          
00592 
00593 
00594 private:
00595         /*************************************************************************
00596                 Static Properties for this class
00597         *************************************************************************/
00598         static FrameWindowProperties::SizingEnabled             d_sizingEnabledProperty;
00599         static FrameWindowProperties::FrameEnabled              d_frameEnabledProperty;
00600         static FrameWindowProperties::TitlebarEnabled   d_titlebarEnabledProperty;
00601         static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
00602         static FrameWindowProperties::RollUpState               d_rollUpStateProperty;
00603         static FrameWindowProperties::RollUpEnabled             d_rollUpEnabledProperty;
00604         static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
00605         static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
00606         static FrameWindowProperties::TitlebarFont              d_titlebarFontProperty;
00607         static FrameWindowProperties::CaptionColour             d_captionColourProperty;
00608 
00609 
00610         /*************************************************************************
00611                 Private methods
00612         *************************************************************************/
00613         void    addFrameWindowProperties(void);
00614 };
00615 
00616 } // End of  CEGUI namespace section
00617 
00618 #if defined(_MSC_VER)
00619 #       pragma warning(pop)
00620 #endif
00621 
00622 #endif  // end of guard _CEGUIFrameWindow_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1