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

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 CEGUIEXPORT 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 
00355     const Image* getNSSizingCursorImage() const;
00356 
00365     const Image* getEWSizingCursorImage() const;
00366 
00375     const Image* getNWSESizingCursorImage() const;
00376 
00385     const Image* getNESWSizingCursorImage() const;
00386 
00397     void setNSSizingCursorImage(const Image* image);
00398 
00409     void setEWSizingCursorImage(const Image* image);
00410 
00421     void setNWSESizingCursorImage(const Image* image);
00422 
00433     void setNESWSizingCursorImage(const Image* image);
00434 
00450     void setNSSizingCursorImage(const String& imageset, const String& image);
00451 
00467     void setEWSizingCursorImage(const String& imageset, const String& image);
00468 
00484     void setNWSESizingCursorImage(const String& imageset, const String& image);
00485 
00501     void setNESWSizingCursorImage(const String& imageset, const String& image);
00502 
00503     // overridden from Window class
00504     bool    isHit(const Point& position) const      { return Window::isHit(position) && !d_rolledup; }
00505 
00506 
00507         /*************************************************************************
00508                 Construction / Destruction
00509         *************************************************************************/
00514         FrameWindow(const String& name, const String& type);
00515 
00520         virtual ~FrameWindow(void);
00521 
00522 
00523 protected:
00524         /*************************************************************************
00525                 Implementation Functions
00526         *************************************************************************/
00537         virtual Titlebar*       createTitlebar(const String& name) const                = 0;
00538 
00539 
00550         virtual PushButton*     createCloseButton(const String& name) const     = 0;
00551 
00552 
00560         void    moveLeftEdge(float delta);
00561 
00562 
00570         void    moveRightEdge(float delta);
00571 
00572 
00580         void    moveTopEdge(float delta);
00581 
00582 
00590         void    moveBottomEdge(float delta);
00591 
00592 
00606         SizingLocation  getSizingBorderAtPoint(const Point& pt) const;
00607 
00608  
00619         bool    isLeftSizingLocation(SizingLocation loc) const                  {return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
00620 
00621 
00632         bool    isRightSizingLocation(SizingLocation loc) const                 {return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
00633 
00634 
00645         bool    isTopSizingLocation(SizingLocation loc) const                   {return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
00646 
00647 
00658         bool    isBottomSizingLocation(SizingLocation loc) const                {return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
00659 
00660 
00665         void    addFrameWindowEvents(void);
00666 
00667 
00672         bool    closeClickHandler(const EventArgs& e);
00673 
00674 
00679         void    setCursorForPoint(const Point& pt) const;
00680 
00681 
00686         virtual Rect    getSizingRect(void) const               {return Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight());}
00687 
00688 
00699         virtual bool    testClassName_impl(const String& class_name) const
00700         {
00701                 if (class_name==(const utf8*)"FrameWindow")     return true;
00702                 return Window::testClassName_impl(class_name);
00703         }
00704 
00705 
00706         /*************************************************************************
00707                 New events for Frame Windows
00708         *************************************************************************/
00714         virtual void    onRollupToggled(WindowEventArgs& e);
00715 
00716 
00721         virtual void    onCloseClicked(WindowEventArgs& e);
00722 
00723 
00724         /*************************************************************************
00725                 Overridden event handlers
00726         *************************************************************************/
00727         virtual void    onMouseMove(MouseEventArgs& e);
00728         virtual void    onMouseButtonDown(MouseEventArgs& e);
00729         virtual void    onMouseButtonUp(MouseEventArgs& e);
00730         virtual void    onCaptureLost(WindowEventArgs& e);
00731         virtual void    onTextChanged(WindowEventArgs& e);
00732         virtual void    onActivated(ActivationEventArgs& e);
00733         virtual void    onDeactivated(ActivationEventArgs& e);
00734 
00735 
00736         /*************************************************************************
00737                 Implementation Data
00738         *************************************************************************/
00739         // frame data
00740         bool    d_frameEnabled;         
00741 
00742         // window roll-up data
00743         bool    d_rollupEnabled;        
00744         bool    d_rolledup;                     
00745 
00746         // drag-sizing data
00747         bool    d_sizingEnabled;        
00748         bool    d_beingSized;           
00749         float   d_borderSize;           
00750         Point   d_dragPoint;            
00751 
00752         // composite controls
00753         Titlebar*       d_titlebar;                             
00754         PushButton*     d_closeButton;                  
00755 
00756         // images for cursor when on sizing border
00757         const Image*    d_nsSizingCursor;               
00758         const Image*    d_ewSizingCursor;               
00759         const Image*    d_nwseSizingCursor;             
00760         const Image*    d_neswSizingCursor;             
00761 
00762         bool    d_dragMovable;          
00763 
00764 
00765 private:
00766         /*************************************************************************
00767                 Static Properties for this class
00768         *************************************************************************/
00769         static FrameWindowProperties::SizingEnabled             d_sizingEnabledProperty;
00770         static FrameWindowProperties::FrameEnabled              d_frameEnabledProperty;
00771         static FrameWindowProperties::TitlebarEnabled   d_titlebarEnabledProperty;
00772         static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
00773         static FrameWindowProperties::RollUpState               d_rollUpStateProperty;
00774         static FrameWindowProperties::RollUpEnabled             d_rollUpEnabledProperty;
00775         static FrameWindowProperties::DragMovingEnabled d_dragMovingEnabledProperty;
00776         static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
00777         static FrameWindowProperties::TitlebarFont              d_titlebarFontProperty;
00778         static FrameWindowProperties::CaptionColour             d_captionColourProperty;
00779     static FrameWindowProperties::NSSizingCursorImage   d_nsSizingCursorProperty;
00780     static FrameWindowProperties::EWSizingCursorImage   d_ewSizingCursorProperty;
00781     static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
00782     static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
00783 
00784 
00785         /*************************************************************************
00786                 Private methods
00787         *************************************************************************/
00788         void    addFrameWindowProperties(void);
00789 };
00790 
00791 } // End of  CEGUI namespace section
00792 
00793 #if defined(_MSC_VER)
00794 #       pragma warning(pop)
00795 #endif
00796 
00797 #endif  // end of guard _CEGUIFrameWindow_h_

Generated on Wed Sep 7 09:56:31 2005 for Crazy Eddies GUI System by  doxygen 1.4.3