1 /* 2 GWEN 3 Copyright (c) 2010 Facepunch Studios 4 See license in Gwen.h 5 */ 6 7 #pragma once 8 #ifndef GWEN_CONTROLS_DOCKBASE_H 9 #define GWEN_CONTROLS_DOCKBASE_H 10 11 #include "Gwen/Controls/Base.h" 12 #include "Gwen/Controls/Button.h" 13 14 namespace Gwen 15 { 16 namespace Controls 17 { 18 class DockedTabControl; 19 class TabControl; 20 21 class GWEN_EXPORT DockBase : public Base 22 { 23 public: 24 GWEN_CONTROL(DockBase, Base); 25 26 virtual void Render(Skin::Base* skin); 27 virtual void RenderOver(Skin::Base* skin); 28 virtual bool IsEmpty(); 29 30 virtual TabControl* GetTabControl(); 31 GetRight()32 virtual DockBase* GetRight() { return GetChildDock(Pos::Right); } GetLeft()33 virtual DockBase* GetLeft() { return GetChildDock(Pos::Left); } GetTop()34 virtual DockBase* GetTop() { return GetChildDock(Pos::Top); } GetBottom()35 virtual DockBase* GetBottom() { return GetChildDock(Pos::Bottom); } 36 37 // No action on space (default button action is to press) OnKeySpace(bool)38 virtual bool OnKeySpace(bool /*bDown*/) { return false; } 39 40 private: 41 // Drag n Drop 42 virtual bool DragAndDrop_HandleDrop(Gwen::DragAndDrop::Package* pPackage, int x, int y); 43 virtual bool DragAndDrop_CanAcceptPackage(Gwen::DragAndDrop::Package* pPackage); 44 virtual void DragAndDrop_HoverEnter(Gwen::DragAndDrop::Package* pPackage, int x, int y); 45 virtual void DragAndDrop_HoverLeave(Gwen::DragAndDrop::Package* pPackage); 46 virtual void DragAndDrop_Hover(Gwen::DragAndDrop::Package* pPackage, int x, int y); 47 48 virtual void SetupChildDock(int iPos); 49 50 virtual void DoRedundancyCheck(); 51 virtual void DoConsolidateCheck(); 52 virtual void OnRedundantChildDock(DockBase* pDockBase); 53 54 virtual int GetDroppedTabDirection(int x, int y); 55 virtual void OnTabRemoved(Gwen::Controls::Base* pControl); 56 57 DockBase* GetChildDock(int iPos); 58 DockBase** GetChildDockPtr(int iPos); 59 60 DockBase* m_Left; 61 DockBase* m_Right; 62 DockBase* m_Top; 63 DockBase* m_Bottom; 64 65 // Only CHILD dockpanels have a tabcontrol. 66 DockedTabControl* m_DockedTabControl; 67 68 bool m_bDrawHover; 69 bool m_bDropFar; 70 Gwen::Rect m_HoverRect; 71 }; 72 } // namespace Controls 73 } // namespace Gwen 74 #endif 75