Skin.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. GWEN
  3. Copyright (c) 2010 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_SKIN_H
  8. #define GWEN_SKIN_H
  9. #include "Gwen/BaseRender.h"
  10. #include "Gwen/Font.h"
  11. namespace Gwen
  12. {
  13. namespace Controls
  14. {
  15. class Base;
  16. }
  17. namespace Skin
  18. {
  19. namespace Symbol
  20. {
  21. const unsigned char None = 0;
  22. const unsigned char ArrowRight = 1;
  23. const unsigned char Check = 2;
  24. const unsigned char Dot = 3;
  25. }
  26. class GWEN_EXPORT Base
  27. {
  28. public:
  29. Base()
  30. {
  31. m_DefaultFont.facename = L"Arial";
  32. m_DefaultFont.size = 10.0f;
  33. m_Render = NULL;
  34. }
  35. virtual ~Base()
  36. {
  37. ReleaseFont( &m_DefaultFont );
  38. }
  39. virtual void ReleaseFont( Gwen::Font* fnt )
  40. {
  41. if ( !fnt ) return;
  42. if ( !m_Render ) return;
  43. m_Render->FreeFont( fnt );
  44. }
  45. virtual void DrawButton( Controls::Base* control, bool bDepressed, bool bHovered ) = 0;
  46. virtual void DrawTabButton( Controls::Base* control, bool bActive ) = 0;
  47. virtual void DrawTabControl( Controls::Base* control, Gwen::Rect CurrentButtonRect ) = 0;
  48. virtual void DrawTabTitleBar( Controls::Base* control ) = 0;
  49. virtual void DrawMenuItem( Controls::Base* control, bool bSubmenuOpen, bool bChecked ) = 0;
  50. virtual void DrawMenuStrip( Controls::Base* control ) = 0;
  51. virtual void DrawMenu( Controls::Base* control, bool bPaddingDisabled ) = 0;
  52. virtual void DrawRadioButton(Controls::Base* control, bool bSelected, bool bDepressed) = 0;
  53. virtual void DrawCheckBox( Controls::Base* control, bool bSelected, bool bDepressed ) = 0;
  54. virtual void DrawGroupBox( Controls::Base* control, int textStart, int textHeight, int textWidth ) = 0;
  55. virtual void DrawTextBox( Controls::Base* control ) = 0;
  56. virtual void DrawWindow( Controls::Base* control, int topHeight, bool inFocus ) = 0;
  57. virtual void DrawHighlight( Controls::Base* control ) = 0;
  58. virtual void DrawBackground( Controls::Base* control ) = 0;
  59. virtual void DrawStatusBar( Controls::Base* control ) = 0;
  60. virtual void DrawShadow( Controls::Base* control ) = 0;
  61. virtual void DrawScrollBarBar( Controls::Base* control, bool bDepressed, bool isHovered, bool isHorizontal ) = 0;
  62. virtual void DrawScrollBar( Controls::Base* control, bool isHorizontal, bool bDepressed ) = 0;
  63. virtual void DrawScrollButton( Controls::Base* control, int iDirection, bool bDepressed ) = 0;
  64. virtual void DrawProgressBar( Controls::Base* control, bool isHorizontal, float progress) = 0;
  65. virtual void DrawListBox( Controls::Base* control ) = 0;
  66. virtual void DrawListBoxLine( Controls::Base* control, bool bSelected ) = 0;
  67. virtual void DrawSlider( Controls::Base* control, bool bIsHorizontal, int numNotches, int barSize) = 0;
  68. virtual void DrawComboBox( Controls::Base* control ) = 0;
  69. virtual void DrawComboBoxButton( Controls::Base* control, bool bDepressed ) = 0;
  70. virtual void DrawKeyboardHighlight( Controls::Base* control, const Gwen::Rect& rect, int offset ) = 0;
  71. //virtual void DrawComboBoxKeyboardHighlight( Controls::Base* control );
  72. virtual void DrawToolTip( Controls::Base* control ) = 0;
  73. virtual void DrawNumericUpDownButton( Controls::Base* control, bool bDepressed, bool bUp ) = 0;
  74. virtual void DrawTreeButton( Controls::Base* control, bool bOpen ) = 0;
  75. virtual void DrawTreeControl( Controls::Base* control ) = 0;
  76. virtual void DrawTreeNode( Controls::Base* ctrl, bool bOpen, bool bSelected, int iLabelHeight, int iLabelWidth, int iHalfWay, int iLastBranch, bool bIsRoot ) = 0;
  77. virtual void DrawPropertyRow( Controls::Base* control, int iWidth, bool bBeingEdited ) = 0;
  78. virtual void DrawPropertyTreeNode( Controls::Base* control, int BorderLeft, int BorderTop ) = 0;
  79. virtual void DrawColorDisplay( Controls::Base* control, Gwen::Color color ) = 0;
  80. virtual void DrawModalControl( Controls::Base* control ) = 0;
  81. virtual void DrawMenuDivider( Controls::Base* control ) = 0;
  82. virtual void SetRender( Gwen::Renderer::Base* renderer )
  83. {
  84. m_Render = renderer;
  85. }
  86. virtual Gwen::Renderer::Base* GetRender()
  87. {
  88. return m_Render;
  89. }
  90. virtual void DrawArrowDown( Gwen::Rect rect );
  91. virtual void DrawArrowUp( Gwen::Rect rect );
  92. virtual void DrawArrowLeft( Gwen::Rect rect );
  93. virtual void DrawArrowRight( Gwen::Rect rect );
  94. virtual void DrawCheck( Gwen::Rect rect );
  95. public:
  96. virtual Gwen::Font* GetDefaultFont()
  97. {
  98. return &m_DefaultFont;
  99. }
  100. virtual void SetDefaultFont( const Gwen::UnicodeString& strFacename, float fSize = 10.0f )
  101. {
  102. m_DefaultFont.facename = strFacename;
  103. m_DefaultFont.size = fSize;
  104. }
  105. protected:
  106. Gwen::Font m_DefaultFont;
  107. Gwen::Renderer::Base* m_Render;
  108. };
  109. };
  110. }
  111. #endif