TabControl.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. GWEN
  3. Copyright (c) 2010 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_CONTROLS_TABCONTROL_H
  8. #define GWEN_CONTROLS_TABCONTROL_H
  9. #include "Gwen/Controls/Base.h"
  10. #include "Gwen/Controls/Button.h"
  11. #include "Gwen/Controls/TabButton.h"
  12. #include "Gwen/Controls/TabStrip.h"
  13. #include "Gwen/Controls/TabTitleBar.h"
  14. namespace Gwen
  15. {
  16. namespace ControlsInternal
  17. {
  18. class ScrollBarButton;
  19. }
  20. namespace Controls
  21. {
  22. class GWEN_EXPORT TabControl : public Base
  23. {
  24. GWEN_CONTROL( TabControl, Base );
  25. virtual TabButton* AddPage( const UnicodeString& strText, Controls::Base* pPage = NULL );
  26. virtual void AddPage( TabButton* pButton );
  27. virtual void OnTabPressed( Controls::Base* control );
  28. virtual void OnLoseTab( TabButton* pButton );
  29. virtual int TabCount( void );
  30. virtual TabButton* GetCurrentButton(){ return m_pCurrentButton; }
  31. virtual TabStrip* GetTabStrip(){ return m_TabStrip; }
  32. virtual void SetTabStripPosition( int iDock );
  33. virtual bool DoesAllowDrag();
  34. virtual void SetAllowReorder( bool b ){ GetTabStrip()->SetAllowReorder( b ); }
  35. Gwen::Event::Caller onLoseTab;
  36. Gwen::Event::Caller onAddTab;
  37. private:
  38. virtual void PostLayout( Skin::Base* skin );
  39. void HandleOverflow();
  40. void ScrollPressLeft( Base* pFrom );
  41. void ScrollPressRight( Base* pFrom );
  42. TabStrip* m_TabStrip;
  43. TabButton* m_pCurrentButton;
  44. ControlsInternal::ScrollBarButton* m_pScroll[2];
  45. int m_iScrollOffset;
  46. };
  47. }
  48. }
  49. #endif