TabTitleBar.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. GWEN
  3. Copyright (c) 2010 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_CONTROLS_TABTITLEBAR_H
  8. #define GWEN_CONTROLS_TABTITLEBAR_H
  9. #include "Gwen/Controls/Base.h"
  10. #include "Gwen/Controls/Label.h"
  11. #include "Gwen/Controls/TabButton.h"
  12. #include "Gwen/DragAndDrop.h"
  13. #include "Gwen/Skin.h"
  14. namespace Gwen
  15. {
  16. namespace Controls
  17. {
  18. class GWEN_EXPORT TabTitleBar : public Label
  19. {
  20. public:
  21. GWEN_CONTROL_INLINE( TabTitleBar, Label )
  22. {
  23. SetMouseInputEnabled( true );
  24. SetTextPadding( Gwen::Padding( 5, 2, 5, 2 ) );
  25. SetPadding( Gwen::Padding( 1, 2, 1, 2 ) );
  26. DragAndDrop_SetPackage( true, "TabWindowMove" );
  27. }
  28. void Render( Skin::Base* skin )
  29. {
  30. skin->DrawTabTitleBar( this );
  31. }
  32. void DragAndDrop_StartDragging( Gwen::DragAndDrop::Package* pPackage, int x, int y )
  33. {
  34. DragAndDrop::SourceControl = GetParent();
  35. DragAndDrop::SourceControl->DragAndDrop_StartDragging( pPackage, x, y );
  36. }
  37. void UpdateFromTab( TabButton* pButton )
  38. {
  39. SetText( pButton->GetText() );
  40. SizeToContents();
  41. }
  42. private:
  43. };
  44. }
  45. }
  46. #endif