guiSplitContainer.h
Engine/source/gui/containers/guiSplitContainer.h
Classes:
class
Public Typedefs
GuiSplitFixedPanel
GuiSplitOrientation
Public Functions
Detailed Description
Public Typedefs
typedef GuiSplitContainer::FixedPanel GuiSplitFixedPanel
typedef GuiSplitContainer::Orientation GuiSplitOrientation
Public Functions
DefineEnumType(GuiSplitFixedPanel )
DefineEnumType(GuiSplitOrientation )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23#ifndef _GUI_SPLTCONTAINER_H_ 24#define _GUI_SPLTCONTAINER_H_ 25 26#ifndef _GUICONTROL_H_ 27#include "gui/core/guiControl.h" 28#endif 29#ifndef _GUICONTAINER_H_ 30#include "gui/containers/guiContainer.h" 31#endif 32#ifndef _GUI_PANEL_H_ 33#include "gui/containers/guiPanel.h" 34#endif 35#ifndef _PLATFORMINPUT_H_ 36#include "platform/platformInput.h" 37#endif 38 39 40 41/// @addtogroup gui_container_group Containers 42/// 43/// @ingroup gui_group Gui System 44/// @{ 45class GuiSplitContainer : public GuiContainer 46{ 47 typedef GuiContainer Parent; 48public: 49 50 enum Orientation 51 { 52 Vertical = 0, 53 Horizontal = 1 54 }; 55 56 enum FixedPanel 57 { 58 None = 0, 59 FirstPanel = 1, 60 SecondPanel 61 }; 62 63 GuiSplitContainer(); 64 65 DECLARE_CONOBJECT( GuiSplitContainer ); 66 DECLARE_DESCRIPTION( "A container that splits its area between two child controls.\n" 67 "The split ratio can be dynamically adjusted with a handle control between the two children.\n" 68 "Splitting can be either horizontal or vertical." ); 69 70 // ConsoleObject 71 static void initPersistFields(); 72 virtual bool onAdd(); 73 74 // GuiControl 75 virtual bool onWake(); 76 virtual void parentResized(const RectI &oldParentRect, const RectI &newParentRect); 77 virtual bool resize( const Point2I &newPosition, const Point2I &newExtent ); 78 virtual void onRender(Point2I offset, const RectI &updateRect); 79 virtual void onMouseDown(const GuiEvent &event); 80 virtual void onMouseUp(const GuiEvent &event); 81 virtual void onMouseDragged(const GuiEvent &event); 82 83 virtual bool layoutControls( RectI &clientRect ); 84 virtual void getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent); 85 virtual inline Point2I getSplitPoint() { return mSplitPoint; }; 86 /// The Splitters entire Client Rectangle, this takes into account padding of this control 87 virtual inline RectI getSplitRect() { return mSplitRect; }; 88 virtual void solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect); 89 virtual Point2I getMinExtent() const; 90 91 //Set the positin of the split handler 92 void setSplitPoint(Point2I splitPoint); 93 94protected: 95 96 S32 mFixedPanel; 97 S32 mFixedPanelSize; 98 S32 mOrientation; 99 S32 mSplitterSize; 100 Point2I mSplitPoint; 101 RectI mSplitRect; 102 bool mDragging; 103 104}; 105 106typedef GuiSplitContainer::Orientation GuiSplitOrientation; 107typedef GuiSplitContainer::FixedPanel GuiSplitFixedPanel; 108 109DefineEnumType( GuiSplitOrientation ); 110DefineEnumType( GuiSplitFixedPanel ); 111 112/// @} 113 114#endif // _GUI_SPLTCONTAINER_H_ 115