Crazy Eddies GUI System: CEGUIWindow.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# CEGUIWindow.h

    00001 /************************************************************************
    00002         filename:       CEGUIWindow.h
    00003         created:        21/2/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Defines abstract base class for Window objects
    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 _CEGUIWindow_h_
    00027 #define _CEGUIWindow_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIString.h"
    00031 #include "CEGUIVector.h"
    00032 #include "CEGUIRect.h"
    00033 #include "CEGUISize.h"
    00034 #include "CEGUIEventSet.h"
    00035 #include "CEGUIPropertySet.h"
    00036 #include "CEGUISystem.h"
    00037 #include "CEGUIInputEvent.h"
    00038 #include "CEGUIWindowProperties.h"
    00039 #include "CEGUIUDim.h"
    00040 #include "CEGUIRenderCache.h"
    00041 #include <vector>
    00042
    00043
    00044 #if defined(_MSC_VER)
    00045 #       pragma warning(push)
    00046 #       pragma warning(disable : 4251)
    00047 #endif
    00048
    00049
    00050 // Start of CEGUI namespace section
    00051 namespace CEGUI
    00052 {
    00053
    00062 enum MetricsMode
    00063 {
    00064         Relative,
    00065         Absolute,
    00066         Inherited
    00067 };
    00068
    00073 enum VerticalAlignment
    00074 {
    00075     VA_TOP,
    00076     VA_CENTRE,
    00077     VA_BOTTOM
    00078 };
    00079
    00084 enum HorizontalAlignment
    00085 {
    00086     HA_LEFT,
    00087     HA_CENTRE,
    00088     HA_RIGHT
    00089 };
    00090
    00100 class CEGUIEXPORT Window : public PropertySet, public EventSet
    00101 {
    00102 public:
    00103         static const String EventNamespace;
    00104
    00105         /*************************************************************************
    00106                 Event name constants
    00107         *************************************************************************/
    00108         // generated internally by Window
    00109         static const String EventParentSized;
    00110         static const String EventSized;
    00111         static const String EventMoved;
    00112         static const String EventTextChanged;
    00113         static const String EventFontChanged;
    00114         static const String EventAlphaChanged;
    00115         static const String EventIDChanged;
    00116         static const String EventActivated;
    00117         static const String EventDeactivated;
    00118         static const String EventShown;
    00119         static const String EventHidden;
    00120         static const String EventEnabled;
    00121         static const String EventDisabled;
    00122         static const String EventMetricsModeChanged;
    00123         static const String EventClippedByParentChanged;
    00124         static const String EventDestroyedByParentChanged;
    00125         static const String EventInheritsAlphaChanged;
    00126         static const String EventAlwaysOnTopChanged;
    00127         static const String EventInputCaptureGained;
    00128         static const String EventInputCaptureLost;
    00129         static const String EventRenderingStarted;
    00130         static const String EventRenderingEnded;
    00131         static const String EventChildAdded;
    00132         static const String EventChildRemoved;
    00133         static const String EventDestructionStarted;
    00134         static const String EventZOrderChanged;
    00135         static const String EventDragDropItemEnters;
    00136         static const String EventDragDropItemLeaves;
    00137         static const String EventDragDropItemDropped;
    00138     static const String EventVerticalAlignmentChanged;
    00139     static const String EventHorizontalAlignmentChanged;
    00140
    00141         // generated externally (inputs)
    00142         static const String EventMouseEnters;
    00143         static const String EventMouseLeaves;
    00144         static const String EventMouseMove;
    00145         static const String EventMouseWheel;
    00146         static const String EventMouseButtonDown;
    00147         static const String EventMouseButtonUp;
    00148         static const String EventMouseClick;
    00149         static const String EventMouseDoubleClick;
    00150         static const String EventMouseTripleClick;
    00151         static const String EventKeyDown;
    00152         static const String EventKeyUp;
    00153         static const String EventCharacterKey;
    00154
    00155
    00156         /*************************************************************************
    00157                 Construction and Destruction
    00158         *************************************************************************/
    00169         Window(const String& type, const String& name);
    00170
    00171
    00176         virtual ~Window(void);
    00177
    00178
    00179         /*************************************************************************
    00180                 Accessor functions
    00181         *************************************************************************/
    00189         const String& getType(void) const;
    00190
    00191
    00199         const String& getName(void) const               {return d_name;}
    00200
    00201
    00209         bool    isDestroyedByParent(void) const         {return d_destroyedByParent;}
    00210
    00211
    00219         bool    isAlwaysOnTop(void) const                       {return d_alwaysOnTop;}
    00220
    00221
    00233         bool    isDisabled(bool localOnly = false) const;
    00234
    00235
    00250         bool    isVisible(bool localOnly = false) const;
    00251
    00252
    00263         bool    isActive(void) const;
    00264
    00265
    00273         bool    isClippedByParent(void) const           {return d_clippedByParent;}
    00274
    00275
    00283         uint    getID(void) const               {return d_ID;}
    00284
    00285
    00293         uint   getChildCount(void) const      {return (uint)d_children.size();}
    00294
    00295
    00306         bool    isChild(const String& name) const;
    00307
    00308
    00323         bool    isChild(uint ID) const;
    00324
    00325
    00336         bool    isChild(const Window* window) const;
    00337
    00338
    00356         Window* getChild(const String& name) const;
    00357
    00358
    00376         Window* getChild(uint ID) const;
    00377
    00378
    00390         Window* getChildAtIdx(uint idx) const           {return d_children[idx];}
    00391
    00392
    00402         Window* getActiveChild(void);
    00403         const Window* getActiveChild(void) const;
    00404
    00405
    00416         bool    isAncestor(const String& name) const;
    00417
    00418
    00429         bool    isAncestor(uint ID) const;
    00430
    00431
    00442         bool    isAncestor(const Window* window) const;
    00443
    00444
    00455         const Font*             getFont(bool useDefault = true) const;
    00456
    00457
    00465         const String&   getText(void) const             {return d_text;}
    00466
    00467
    00475         bool    inheritsAlpha(void) const               {return d_inheritsAlpha;}
    00476
    00477
    00491         float   getAlpha(void) const                    {return d_alpha;}
    00492
    00493
    00502         float   getEffectiveAlpha(void) const;
    00503
    00504
    00513         Rect    getRect(void) const;
    00514
    00515
    00527         virtual Rect    getPixelRect(void) const;
    00528
    00529
    00537         Rect    getInnerRect(void) const;
    00538
    00539
    00548         Rect    getUnclippedPixelRect(void) const;
    00549
    00550
    00559         virtual Rect    getUnclippedInnerRect(void) const;
    00560
    00561
    00569         static  Window* getCaptureWindow(void)          {return d_captureWindow;}
    00570
    00571
    00579         bool    isCapturedByThis(void) const            {return getCaptureWindow() == this;}
    00580
    00581
    00589         bool    isCapturedByAncestor(void) const        {return isAncestor(getCaptureWindow());}
    00590
    00591
    00599         bool    isCapturedByChild(void) const           {return isChild(getCaptureWindow());}
    00600
    00601
    00612         virtual bool    isHit(const Point& position) const;
    00613
    00614
    00625         Window* getChildAtPosition(const Point& position) const;
    00626
    00627
    00635         MetricsMode     getMetricsMode(void) const;
    00636
    00637
    00646         float   getXPosition(void) const;
    00647
    00648
    00657         float   getYPosition(void) const;
    00658
    00659
    00668         Point   getPosition(void) const;
    00669
    00670
    00679         float   getWidth(void) const;
    00680
    00689         float   getHeight(void) const;
    00690
    00691
    00700         Size    getSize(void) const;
    00701
    00702
    00711         Window* getParent(void) const                           {return d_parent;}
    00712
    00713
    00722         Size    getMaximumSize(void) const;
    00723
    00724
    00733         Size    getMinimumSize(void) const;
    00734
    00735
    00746         const Image*    getMouseCursor(bool useDefault = true) const;
    00747
    00748
    00756     Rect        getRelativeRect(void) const                             { return d_area.asRelative(getParentSize()); }
    00757
    00758
    00766         Point   getRelativePosition(void) const                 { return d_area.getPosition().asRelative(getParentSize()); }
    00767
    00768
    00776         float   getRelativeXPosition(void) const                { return d_area.d_min.d_x.asRelative(getParentWidth()); }
    00777
    00778
    00786         float   getRelativeYPosition(void) const                { return d_area.d_min.d_y.asRelative(getParentHeight()); }
    00787
    00788
    00796     Size        getRelativeSize(void) const                             { return d_area.getSize().asRelative(getParentSize()).asSize(); }
    00797
    00798
    00806         float   getRelativeWidth(void) const                    { return d_area.getWidth().asRelative(getParentWidth()); }
    00807
    00808
    00816         float   getRelativeHeight(void) const                   { return d_area.getHeight().asRelative(getParentHeight()); }
    00817
    00818
    00826     Rect        getAbsoluteRect(void) const                             { return Rect(d_area.getPosition().asAbsolute(getParentSize()), d_pixelSize); }
    00827
    00828
    00836         Point   getAbsolutePosition(void) const                 { return d_area.getPosition().asAbsolute(getParentSize()); }
    00837
    00838
    00846         float   getAbsoluteXPosition(void) const                { return d_area.d_min.d_x.asAbsolute(getParentWidth()); }
    00847
    00848
    00856         float   getAbsoluteYPosition(void) const                { return d_area.d_min.d_y.asAbsolute(getParentHeight()); }
    00857
    00858
    00866         Size    getAbsoluteSize(void) const                             { return d_pixelSize; }
    00867
    00868
    00876         float   getAbsoluteWidth(void) const                    { return d_pixelSize.d_width; }
    00877
    00878
    00886         float   getAbsoluteHeight(void) const                   { return d_pixelSize.d_height; }
    00887
    00888
    00899         void*   getUserData(void) const                 {return d_userData;}
    00900
    00901
    00912         float   getXPosition(MetricsMode mode) const;
    00913
    00914
    00925         float   getYPosition(MetricsMode mode) const;
    00926
    00927
    00938         Point   getPosition(MetricsMode mode) const;
    00939
    00940
    00951         float   getWidth(MetricsMode mode) const;
    00952
    00953
    00964         float   getHeight(MetricsMode mode) const;
    00965
    00966
    00977         Size    getSize(MetricsMode mode) const;
    00978
    00979
    00990         Rect    getRect(MetricsMode mode) const;
    00991
    00992
    01003         bool    restoresOldCapture(void) const          {return d_restoreOldCapture;}
    01004
    01005
    01014         bool    isZOrderingEnabled(void) const;
    01015
    01016
    01025     bool    wantsMultiClickEvents(void) const;
    01026
    01027
    01036     bool    isMouseAutoRepeatEnabled(void) const;
    01037
    01038
    01046     float   getAutoRepeatDelay(void) const;
    01047
    01048
    01056     float   getAutoRepeatRate(void) const;
    01057
    01058
    01068     bool    distributesCapturedInputs(void) const;
    01069
    01070
    01079     bool isUsingDefaultTooltip(void) const;
    01080
    01089     Tooltip* getTooltip(void) const;
    01090
    01098     String getTooltipType(void) const;
    01099
    01107     const String& getTooltipText(void) const;
    01108
    01117     bool inheritsTooltipText(void) const;
    01118
    01127     bool isRiseOnClickEnabled(void) const   { return d_riseOnClick; }
    01128
    01139         bool testClassName(const String& class_name) const              {return testClassName_impl(class_name);}
    01140
    01151     VerticalAlignment getVerticalAlignment() const  {return d_vertAlign;}
    01152
    01163     HorizontalAlignment getHorizontalAlignment() const  {return d_horzAlign;}
    01164
    01172     RenderCache& getRenderCache()   { return d_renderCache; }
    01173
    01182     const String& getLookNFeel();
    01183
    01191         bool getModalState(void) const  {return (System::getSingleton().getModalTarget() == this);}
    01192
    01193
    01206     const String& getUserString(const String& name) const;
    01207
    01219     bool isUserStringDefined(const String& name) const;
    01220
    01235     Window* getActiveSibling();
    01236
    01237     /*************************************************************************
    01238                 Manipulator functions
    01239         *************************************************************************/
    01250     void rename(const String& new_name);
    01251
    01262         virtual void    initialise(void) {}
    01263
    01264
    01276         void    setDestroyedByParent(bool setting);
    01277
    01278
    01289         void    setAlwaysOnTop(bool setting);
    01290
    01291
    01302         void    setEnabled(bool setting);
    01303
    01304
    01312         void    enable(void)            {setEnabled(true);}
    01313
    01314
    01322         void    disable(void)           {setEnabled(false);}
    01323
    01324
    01335         void    setVisible(bool setting);
    01336
    01337
    01345         void    show(void)                      {setVisible(true);}
    01346
    01347
    01355         void    hide(void)                      {setVisible(false);}
    01356
    01357
    01365         void    activate(void);
    01366
    01367
    01376         void    deactivate(void);
    01377
    01378
    01390         void    setClippedByParent(bool setting);
    01391
    01392
    01403         void    setID(uint ID);
    01404
    01405
    01416         void    setText(const String& text);
    01417
    01418
    01429         void    setWidth(float width);
    01430
    01431
    01442         void    setHeight(float height);
    01443
    01444
    01455         void    setSize(const Size& size);
    01456
    01457
    01468         void    setXPosition(float x);
    01469
    01470
    01481         void    setYPosition(float y);
    01482
    01483
    01494         void    setPosition(const Point& position);
    01495
    01496
    01508         void    setAreaRect(const Rect& area);
    01509
    01510
    01521         void    setFont(const Font* font);
    01522
    01523
    01536         void    setFont(const String& name);
    01537
    01538
    01553         void    addChildWindow(const String& name);
    01554
    01555
    01569         void    addChildWindow(Window* window);
    01570
    01571
    01582         void    removeChildWindow(const String& name);
    01583
    01584
    01595         void    removeChildWindow(Window* window);
    01596
    01597
    01609         void    removeChildWindow(uint ID);
    01610
    01611
    01623         void    moveToFront();
    01624
    01625
    01636         void    moveToBack();
    01637
    01638
    01647         bool    captureInput(void);
    01648
    01649
    01657         void    releaseInput(void);
    01658
    01659
    01675         void    setRestoreCapture(bool setting);
    01676
    01677
    01694         void    setAlpha(float alpha);
    01695
    01696
    01707         void    setInheritsAlpha(bool setting);
    01708
    01709
    01717         void    requestRedraw(void) const;
    01718
    01719
    01730         void setMetricsMode(MetricsMode mode);
    01731
    01732
    01741         void    setMinimumSize(const Size& sz);
    01742
    01743
    01752         void    setMaximumSize(const Size& sz);
    01753
    01754
    01765         void    setMouseCursor(const Image* image)              {d_mouseCursor = image;}
    01766
    01767
    01778         void    setMouseCursor(MouseCursorImage image)          {d_mouseCursor = (const Image*)image;}
    01779
    01780
    01796         void    setMouseCursor(const String& imageset, const String& image_name);
    01797
    01798
    01812         void    setUserData(void* user_data)            {d_userData = user_data;}
    01813
    01814
    01828         void    setXPosition(MetricsMode mode, float x);
    01829
    01830
    01844         void    setYPosition(MetricsMode mode, float y);
    01845
    01846
    01860         void    setPosition(MetricsMode mode, const Point& position);
    01861
    01862
    01876         void    setWidth(MetricsMode mode, float width);
    01877
    01878
    01892         void    setHeight(MetricsMode mode, float height);
    01893
    01894
    01908         void    setSize(MetricsMode mode, const Size& size);
    01909
    01910
    01924         void    setRect(MetricsMode mode, const Rect& area);
    01925
    01926
    01938         void    setZOrderingEnabled(bool setting);
    01939
    01940
    01952     void setWantsMultiClickEvents(bool setting);
    01953
    01954
    01966     void    setMouseAutoRepeatEnabled(bool setting);
    01967
    01968
    01979     void   setAutoRepeatDelay(float delay);
    01980
    01981
    01992     void   setAutoRepeatRate(float rate);
    01993
    01994
    02004     void    setDistributesCapturedInputs(bool setting);
    02005
    02011     void    notifyDragDropItemEnters(DragContainer* item);
    02012
    02018     void    notifyDragDropItemLeaves(DragContainer* item);
    02019
    02025     void    notifyDragDropItemDropped(DragContainer* item);
    02026
    02040     virtual void    destroy(void);
    02041
    02055     void setTooltip(Tooltip* tooltip);
    02056
    02072     void setTooltipType(const String& tooltipType);
    02073
    02084     void setTooltipText(const String& tip);
    02085
    02097     void setInheritsTooltipText(bool setting);
    02098
    02110     void setRiseOnClickEnabled(bool setting)    { d_riseOnClick = setting; }
    02111
    02125     void setVerticalAlignment(const VerticalAlignment alignment);
    02126
    02140     void setHorizontalAlignment(const HorizontalAlignment alignment);
    02141
    02158     void setLookNFeel(const String& falagardType, const String& look);
    02159
    02172         void setModalState(bool state);
    02173
    02184     virtual void performChildWindowLayout();
    02185
    02199     void setUserString(const String& name, const String& value);
    02200
    02201     /*************************************************************************
    02202                 Co-ordinate and Size Conversion Functions
    02203         *************************************************************************/
    02214         float   absoluteToRelativeX(float val) const;
    02215
    02216
    02227         float   absoluteToRelativeY(float val) const;
    02228
    02229
    02240         Point   absoluteToRelative(const Point& pt) const;
    02241
    02242
    02253         Size    absoluteToRelative(const Size& sze) const;
    02254
    02255
    02266         Rect    absoluteToRelative(const Rect& rect) const;
    02267
    02268
    02279         float   relativeToAbsoluteX(float val) const;
    02280
    02281
    02292         float   relativeToAbsoluteY(float val) const;
    02293
    02294
    02305         Point   relativeToAbsolute(const Point& pt) const;
    02306
    02307
    02318         Size    relativeToAbsolute(const Size& sze) const;
    02319
    02320
    02331         Rect    relativeToAbsolute(const Rect& rect) const;
    02332
    02333
    02344         float   windowToScreenX(float x) const;
    02345
    02346
    02357         float   windowToScreenY(float y) const;
    02358
    02359
    02370         Point   windowToScreen(const Point& pt) const;
    02371
    02372
    02383         Size    windowToScreen(const Size& sze) const;
    02384
    02385
    02396         Rect    windowToScreen(const Rect& rect) const;
    02397
    02398
    02409         float   screenToWindowX(float x) const;
    02410
    02411
    02422         float   screenToWindowY(float y) const;
    02423
    02424
    02435         Point   screenToWindow(const Point& pt) const;
    02436
    02437
    02448         Size    screenToWindow(const Size& sze) const;
    02449
    02450
    02461         Rect    screenToWindow(const Rect& rect) const;
    02462
    02463
    02474     float unifiedToRelativeX(const UDim& val) const;
    02475
    02476
    02487     float       unifiedToRelativeY(const UDim& val) const;
    02488
    02489
    02500     Vector2 unifiedToRelative(const UVector2& val) const;
    02501
    02502
    02513     Rect unifiedToRelative(const URect& val) const;
    02514
    02515
    02526     float unifiedToAbsoluteX(const UDim& val) const;
    02527
    02528
    02539     float       unifiedToAbsoluteY(const UDim& val) const;
    02540
    02541
    02552     Vector2 unifiedToAbsolute(const UVector2& val) const;
    02553
    02554
    02565     Rect unifiedToAbsolute(const URect& val) const;
    02566
    02567
    02578     float windowToScreenX(const UDim& x) const;
    02579
    02580
    02591     float windowToScreenY(const UDim& y) const;
    02592
    02593
    02604     Vector2 windowToScreen(const UVector2& vec) const;
    02605
    02606
    02617     Rect windowToScreen(const URect& rect) const;
    02618
    02619
    02630     float screenToWindowX(const UDim& x) const;
    02631
    02632
    02643     float screenToWindowY(const UDim& y) const;
    02644
    02645
    02656     Vector2 screenToWindow(const UVector2& vec) const;
    02657
    02658
    02669     Rect screenToWindow(const URect& rect) const;
    02670
    02671
    02672     /*************************************************************************
    02673         Interface to unified co-ordinate system
    02674     *************************************************************************/
    02699     void setWindowArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
    02700
    02719     void setWindowArea(const UVector2& pos, const UVector2& size);
    02720
    02736     void setWindowArea(const URect& area);
    02737
    02753     void setWindowPosition(const UVector2& pos);
    02754
    02770     void setWindowXPosition(const UDim& x);
    02771
    02787     void setWindowYPosition(const UDim& y);
    02788
    02802     void setWindowSize(const UVector2& size);
    02803
    02817     void setWindowWidth(const UDim& width);
    02818
    02832     void setWindowHeight(const UDim& height);
    02833
    02848     void setWindowMaxSize(const UVector2& size);
    02849
    02864     void setWindowMinSize(const UVector2& size);
    02865
    02881     const URect& getWindowArea() const;
    02882
    02898     const UVector2& getWindowPosition() const;
    02899
    02915     const UDim& getWindowXPosition() const;
    02916
    02932     const UDim& getWindowYPosition() const;
    02933
    02947     UVector2 getWindowSize() const;
    02948
    02962     UDim getWindowWidth() const;
    02963
    02977     UDim getWindowHeight() const;
    02978
    02993     const UVector2& getWindowMaxSize() const;
    02994
    03009     const UVector2& getWindowMinSize() const;
    03010
    03011
    03012         /*************************************************************************
    03013                 Main render function.
    03014         *************************************************************************/
    03022         void    render(void);
    03023
    03024
    03040         void    update(float elapsed);
    03041
    03042
    03053     virtual void writeXMLToStream(OutStream& out_stream) const;
    03054
    03055 protected:
    03056         /*************************************************************************
    03057                 System object can trigger events directly
    03058         *************************************************************************/
    03059         friend  class System;
    03060
    03061
    03062         /*************************************************************************
    03063                 Event trigger methods
    03064         *************************************************************************/
    03073         virtual void    onSized(WindowEventArgs& e);
    03074
    03075
    03084         virtual void    onMoved(WindowEventArgs& e);
    03085
    03086
    03095         virtual void    onTextChanged(WindowEventArgs& e);
    03096
    03097
    03106         virtual void    onFontChanged(WindowEventArgs& e);
    03107
    03108
    03117         virtual void    onAlphaChanged(WindowEventArgs& e);
    03118
    03119
    03128         virtual void    onIDChanged(WindowEventArgs& e);
    03129
    03130
    03139         virtual void    onShown(WindowEventArgs& e);
    03140
    03141
    03150         virtual void    onHidden(WindowEventArgs& e);
    03151
    03152
    03161         virtual void    onEnabled(WindowEventArgs& e);
    03162
    03163
    03172         virtual void    onDisabled(WindowEventArgs& e);
    03173
    03174
    03183         virtual void    onMetricsChanged(WindowEventArgs& e);
    03184
    03185
    03194         virtual void    onClippingChanged(WindowEventArgs& e);
    03195
    03196
    03205         virtual void    onParentDestroyChanged(WindowEventArgs& e);
    03206
    03207
    03216         virtual void    onInheritsAlphaChanged(WindowEventArgs& e);
    03217
    03218
    03227         virtual void    onAlwaysOnTopChanged(WindowEventArgs& e);
    03228
    03229
    03238         virtual void    onCaptureGained(WindowEventArgs& e);
    03239
    03240
    03249         virtual void    onCaptureLost(WindowEventArgs& e);
    03250
    03251
    03260         virtual void    onRenderingStarted(WindowEventArgs& e);
    03261
    03262
    03271         virtual void    onRenderingEnded(WindowEventArgs& e);
    03272
    03273
    03282         virtual void    onZChanged(WindowEventArgs& e);
    03283
    03284
    03293         virtual void    onDestructionStarted(WindowEventArgs& e);
    03294
    03295
    03303         virtual void    onActivated(ActivationEventArgs& e);
    03304
    03305
    03313         virtual void    onDeactivated(ActivationEventArgs& e);
    03314
    03315
    03325         virtual void    onParentSized(WindowEventArgs& e);
    03326
    03327
    03335         virtual void    onChildAdded(WindowEventArgs& e);
    03336
    03337
    03345         virtual void    onChildRemoved(WindowEventArgs& e);
    03346
    03347
    03355         virtual void    onMouseEnters(MouseEventArgs& e);
    03356
    03357
    03365         virtual void    onMouseLeaves(MouseEventArgs& e);
    03366
    03367
    03375         virtual void    onMouseMove(MouseEventArgs& e);
    03376
    03377
    03385         virtual void    onMouseWheel(MouseEventArgs& e);
    03386
    03387
    03395         virtual void    onMouseButtonDown(MouseEventArgs& e);
    03396
    03397
    03405         virtual void    onMouseButtonUp(MouseEventArgs& e);
    03406
    03407
    03416         virtual void    onMouseClicked(MouseEventArgs& e);
    03417
    03418
    03426         virtual void    onMouseDoubleClicked(MouseEventArgs& e);
    03427
    03428
    03436         virtual void    onMouseTripleClicked(MouseEventArgs& e);
    03437
    03438
    03447         virtual void    onKeyDown(KeyEventArgs& e);
    03448
    03449
    03459         virtual void    onKeyUp(KeyEventArgs& e);
    03460
    03461
    03471         virtual void    onCharacter(KeyEventArgs& e);
    03472
    03482     virtual void    onDragDropItemEnters(DragDropEventArgs& e);
    03483
    03484
    03494     virtual void    onDragDropItemLeaves(DragDropEventArgs& e);
    03495
    03496
    03506     virtual void    onDragDropItemDropped(DragDropEventArgs& e);
    03507
    03508
    03517     virtual void    onVerticalAlignmentChanged(WindowEventArgs& e);
    03518
    03519
    03528     virtual void    onHorizontalAlignmentChanged(WindowEventArgs& e);
    03529
    03530
    03531         /*************************************************************************
    03532                 Implementation Functions
    03533         *************************************************************************/
    03544         virtual void    updateSelf(float elapsed);
    03545
    03546
    03557         virtual void    drawSelf(float z);
    03558
    03559
    03566     virtual void populateRenderCache()  {}
    03567
    03568
    03579         virtual bool    testClassName_impl(const String& class_name) const
    03580         {
    03581                 if (class_name==(const utf8*)"Window")  return true;
    03582                 return false;
    03583         }
    03584
    03585
    03596         void    setParent(Window* parent);
    03597
    03598
    03606         float   getParentWidth(void) const;
    03607
    03608
    03616         float   getParentHeight(void) const;
    03617
    03618
    03626         Size    getParentSize(void) const;
    03627
    03628
    03643         Rect    absoluteToRelative_impl(const Window* window, const Rect& rect) const;
    03644         Size    absoluteToRelative_impl(const Window* window, const Size& sz) const;
    03645         Point   absoluteToRelative_impl(const Window* window, const Point& pt) const;
    03646         float   absoluteToRelativeX_impl(const Window* window, float x) const;
    03647         float   absoluteToRelativeY_impl(const Window* window, float y) const;
    03648
    03649
    03664         Rect    relativeToAbsolute_impl(const Window* window, const Rect& rect) const;
    03665         Size    relativeToAbsolute_impl(const Window* window, const Size& sz) const;
    03666         Point   relativeToAbsolute_impl(const Window* window, const Point& pt) const;
    03667         float   relativeToAbsoluteX_impl(const Window* window, float x) const;
    03668         float   relativeToAbsoluteY_impl(const Window* window, float y) const;
    03669
    03670         Size    getWindowSize_impl(const Window* window) const;
    03671
    03672
    03678         MetricsMode getInheritedMetricsMode(void) const;
    03679
    03680
    03685     void    generateAutoRepeatEvent(MouseButton button);
    03686
    03687
    03688         /*************************************************************************
    03689                 Implementation Data
    03690         *************************************************************************/
    03691         // child stuff
    03692         typedef std::vector<Window*>    ChildList;
    03693         ChildList               d_children;
    03694     ChildList       d_drawList;
    03695
    03696         // general data
    03697         MetricsMode             d_metricsMode;
    03698         static Window*  d_captureWindow;
    03699         Window*                 d_oldCapture;
    03700         Window*                 d_parent;
    03701         const Font*             d_font;
    03702         String                  d_text;
    03703         uint                    d_ID;
    03704         float                   d_alpha;
    03705     URect                       d_area;
    03706     Size            d_pixelSize;
    03707         const Image*    d_mouseCursor;
    03708         void*                   d_userData;
    03709
    03710         typedef std::map<String, String>   UserStringMap;
    03711         UserStringMap  d_userStrings;
    03712
    03713     // positional alignments
    03714     HorizontalAlignment d_horzAlign;
    03715     VerticalAlignment   d_vertAlign;
    03716
    03717         // maximum and minimum sizes
    03718         UVector2       d_minSize;
    03719         UVector2       d_maxSize;
    03720
    03721         // settings
    03722         bool    d_enabled;
    03723         bool    d_visible;
    03724         bool    d_active;
    03725         bool    d_clippedByParent;
    03726         bool    d_destroyedByParent;
    03727         bool    d_alwaysOnTop;
    03728         bool    d_inheritsAlpha;
    03729         bool    d_restoreOldCapture;
    03730         bool    d_zOrderingEnabled;
    03731     bool    d_wantsMultiClicks;
    03732     bool    d_distCapturedInputs;
    03733     bool    d_riseOnClick;
    03734
    03735     // mouse button autorepeat data
    03736     bool    d_autoRepeat;
    03737     float   d_repeatDelay;
    03738     float   d_repeatRate;
    03739     bool    d_repeating;
    03740     float   d_repeatElapsed;
    03741     MouseButton d_repeatButton;
    03742
    03743     // Tooltip stuff
    03744     String   d_tooltipText;
    03745     Tooltip* d_customTip;
    03746     bool     d_weOwnTip;
    03747     bool     d_inheritsTipText;
    03748
    03749     // rendering
    03750     RenderCache d_renderCache;
    03751     mutable bool d_needsRedraw;
    03752
    03753     // Look'N'Feel stuff
    03754     String  d_lookName;
    03755
    03756 protected:
    03757         /*************************************************************************
    03758                 Properties for Window base class
    03759         *************************************************************************/
    03760         static  WindowProperties::AbsoluteHeight        d_absHeightProperty;
    03761         static  WindowProperties::AbsoluteMaxSize       d_absMaxSizeProperty;
    03762         static  WindowProperties::AbsoluteMinSize       d_absMinSizeProperty;
    03763         static  WindowProperties::AbsolutePosition      d_absPositionProperty;
    03764         static  WindowProperties::AbsoluteRect          d_absRectProperty;
    03765         static  WindowProperties::AbsoluteSize          d_absSizeProperty;
    03766         static  WindowProperties::AbsoluteWidth         d_absWidthProperty;
    03767         static  WindowProperties::AbsoluteXPosition     d_absXPosProperty;
    03768         static  WindowProperties::AbsoluteYPosition     d_absYPosProperty;
    03769         static  WindowProperties::Alpha                         d_alphaProperty;
    03770         static  WindowProperties::AlwaysOnTop           d_alwaysOnTopProperty;
    03771         static  WindowProperties::ClippedByParent       d_clippedByParentProperty;
    03772         static  WindowProperties::DestroyedByParent     d_destroyedByParentProperty;
    03773         static  WindowProperties::Disabled                      d_disabledProperty;
    03774         static  WindowProperties::Font                          d_fontProperty;
    03775         static  WindowProperties::Height                        d_heightProperty;
    03776         static  WindowProperties::ID                            d_IDProperty;
    03777         static  WindowProperties::InheritsAlpha         d_inheritsAlphaProperty;
    03778         static  WindowProperties::MetricsMode           d_metricsModeProperty;
    03779         static  WindowProperties::MouseCursorImage      d_mouseCursorProperty;
    03780         static  WindowProperties::Position                      d_positionProperty;
    03781         static  WindowProperties::Rect                          d_rectProperty;
    03782         static  WindowProperties::RelativeHeight        d_relHeightProperty;
    03783         static  WindowProperties::RelativeMaxSize       d_relMaxSizeProperty;
    03784         static  WindowProperties::RelativeMinSize       d_relMinSizeProperty;
    03785         static  WindowProperties::RelativePosition      d_relPositionProperty;
    03786         static  WindowProperties::RelativeRect          d_relRectProperty;
    03787         static  WindowProperties::RelativeSize          d_relSizeProperty;
    03788         static  WindowProperties::RelativeWidth         d_relWidthProperty;
    03789         static  WindowProperties::RelativeXPosition     d_relXPosProperty;
    03790         static  WindowProperties::RelativeYPosition     d_relYPosProperty;
    03791         static  WindowProperties::RestoreOldCapture     d_restoreOldCaptureProperty;
    03792         static  WindowProperties::Size                          d_sizeProperty;
    03793         static  WindowProperties::Text                          d_textProperty;
    03794         static  WindowProperties::Visible                       d_visibleProperty;
    03795         static  WindowProperties::Width                         d_widthProperty;
    03796         static  WindowProperties::XPosition                     d_xPosProperty;
    03797         static  WindowProperties::YPosition                     d_yPosProperty;
    03798         static  WindowProperties::ZOrderChangeEnabled   d_zOrderChangeProperty;
    03799     static  WindowProperties::WantsMultiClickEvents d_wantsMultiClicksProperty;
    03800     static  WindowProperties::MouseButtonDownAutoRepeat d_autoRepeatProperty;
    03801     static  WindowProperties::AutoRepeatDelay   d_autoRepeatDelayProperty;
    03802     static  WindowProperties::AutoRepeatRate    d_autoRepeatRateProperty;
    03803     static  WindowProperties::DistributeCapturedInputs d_distInputsProperty;
    03804     static  WindowProperties::CustomTooltipType d_tooltipTypeProperty;
    03805     static  WindowProperties::Tooltip           d_tooltipProperty;
    03806     static  WindowProperties::InheritsTooltipText d_inheritsTooltipProperty;
    03807     static  WindowProperties::RiseOnClick       d_riseOnClickProperty;
    03808     static  WindowProperties::VerticalAlignment   d_vertAlignProperty;
    03809     static  WindowProperties::HorizontalAlignment d_horzAlignProperty;
    03810     static      WindowProperties::UnifiedAreaRect       d_unifiedAreaRectProperty;
    03811     static      WindowProperties::UnifiedPosition       d_unifiedPositionProperty;
    03812     static      WindowProperties::UnifiedXPosition      d_unifiedXPositionProperty;
    03813     static      WindowProperties::UnifiedYPosition      d_unifiedYPositionProperty;
    03814     static      WindowProperties::UnifiedSize           d_unifiedSizeProperty;
    03815     static      WindowProperties::UnifiedWidth          d_unifiedWidthProperty;
    03816     static      WindowProperties::UnifiedHeight         d_unifiedHeightProperty;
    03817     static      WindowProperties::UnifiedMinSize        d_unifiedMinSizeProperty;
    03818     static      WindowProperties::UnifiedMaxSize        d_unifiedMaxSizeProperty;
    03819
    03820
    03821         /*************************************************************************
    03822                 implementation functions
    03823         *************************************************************************/
    03828         void    addStandardEvents(void);
    03829
    03834         virtual void    cleanupChildren(void);
    03835
    03840         virtual void    addChild_impl(Window* wnd);
    03841
    03846         virtual void    removeChild_impl(Window* wnd);
    03847
    03852         virtual void    onZChange_impl(void);
    03853
    03854
    03859         void    addStandardProperties(void);
    03860
    03861
    03866     virtual void moveToFront_impl(bool wasClicked);
    03867
    03868
    03873     void doRiseOnClick(void);
    03874
    03875
    03903     void setWindowArea_impl(const UVector2& pos, const UVector2& size, bool topLeftSizing = false, bool fireEvents = true);
    03904
    03922     void addWindowToDrawList(Window& wnd, bool at_back = false);
    03923
    03935     void removeWindowFromDrawList(const Window& wnd);
    03936
    03937     virtual int writePropertiesXML(OutStream& out_stream) const;
    03938     virtual int writeChildWindowsXML(OutStream& out_stream) const;
    03939
    03940         /*************************************************************************
    03941                 May not copy or assign Window objects
    03942         *************************************************************************/
    03943         Window(const Window& wnd) {}
    03944         Window& operator=(const Window& wnd) {return *this;}
    03945
    03946         /*************************************************************************
    03947                 Private implementation Data
    03948         *************************************************************************/
    03949         const String    d_type;
    03950         String  d_name;
    03951         String    d_falagardType;
    03952 };
    03953
    03954 } // End of  CEGUI namespace section
    03955
    03956
    03957 #if defined(_MSC_VER)
    03958 #       pragma warning(pop)
    03959 #endif
    03960
    03961 #endif  // end of guard _CEGUIWindow_h_