TexturedBase.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. #pragma once
  2. #ifndef GWEN_SKINS_TEXTUREDBASE_H
  3. #define GWEN_SKINS_TEXTUREDBASE_H
  4. #include "Gwen/Skin.h"
  5. #include "Gwen/Gwen.h"
  6. #include "Gwen/Controls/Base.h"
  7. #include "Gwen/Texture.h"
  8. #include "Gwen/Skins/Texturing.h"
  9. namespace Gwen
  10. {
  11. namespace Skin
  12. {
  13. class TexturedBase : public Gwen::Skin::Base
  14. {
  15. public:
  16. Gwen::Color m_colBorderColor;
  17. Gwen::Color m_colControlOutlineLight;
  18. Gwen::Color m_colControlOutlineLighter;
  19. Gwen::Color m_colBG;
  20. Gwen::Color m_colBGDark;
  21. Gwen::Color m_colControl;
  22. Gwen::Color m_colControlBorderHighlight;
  23. Gwen::Color m_colControlDarker;
  24. Gwen::Color m_colControlOutlineNormal;
  25. Gwen::Color m_colControlBright;
  26. Gwen::Color m_colControlDark;
  27. Gwen::Color m_colHighlightBG;
  28. Gwen::Color m_colHighlightBorder;
  29. Gwen::Color m_colToolTipBackground;
  30. Gwen::Color m_colToolTipBorder;
  31. Gwen::Color m_colModal;
  32. Texture m_Texture;
  33. Texturing::Bordered m_texButton;
  34. Texturing::Bordered m_texButton_Hovered;
  35. Texturing::Bordered m_texButton_Pressed;
  36. Texturing::Bordered m_texMenu_Strip, m_texMenu_Panel, m_texMenu_Panel_Border;
  37. Texturing::Bordered m_texMenu_Hover;
  38. Texturing::Bordered m_texShadow;
  39. Texturing::Bordered m_texTextBox, m_texTextBox_Focus;
  40. Texturing::Bordered m_texTab_Control, m_texTab, m_texTab_Inactive, m_texTab_Gap, m_texTabBar;
  41. Texturing::Bordered m_texWindow, m_texWindow_Inactive;
  42. Texturing::Bordered m_texTreeBG;
  43. Texturing::Single m_Checkbox, m_Checkbox_Checked;
  44. Texturing::Single m_RadioButton, m_RadioButton_Checked;
  45. Texturing::Single m_CheckMark;
  46. Texturing::Single m_TreeMinus, m_TreePlus;
  47. virtual void Init( const TextObject& TextureName )
  48. {
  49. m_colBorderColor = Gwen::Color( 80, 80, 80, 255 );
  50. m_colBG = Gwen::Color( 248, 248, 248, 255 );
  51. m_colBGDark = Gwen::Color( 235, 235, 235, 255 );
  52. m_colControl = Gwen::Color( 240, 240, 240, 255 );
  53. m_colControlBright = Gwen::Color( 255, 255, 255, 255 );
  54. m_colControlDark = Gwen::Color( 214, 214, 214, 255 );
  55. m_colControlDarker = Gwen::Color( 180, 180, 180, 255 );
  56. m_colControlOutlineNormal = Gwen::Color( 112, 112, 112, 255 );
  57. m_colControlOutlineLight = Gwen::Color( 144, 144, 144, 255 );
  58. m_colControlOutlineLighter = Gwen::Color( 210, 210, 210, 255 );
  59. m_colHighlightBG = Gwen::Color( 192, 221, 252, 255 );
  60. m_colHighlightBorder = Gwen::Color( 51, 153, 255, 255 );
  61. m_colToolTipBackground = Gwen::Color( 255, 255, 225, 255 );
  62. m_colToolTipBorder = Gwen::Color( 0, 0, 0, 255 );
  63. m_colModal = Gwen::Color( 25, 25, 25, 150 );
  64. m_DefaultFont.facename = L"Microsoft Sans Serif";
  65. m_DefaultFont.size = 11;
  66. m_Texture.Load( TextureName, GetRender() );
  67. m_texButton.Init( &m_Texture, 194, 0, 24, 24, Margin( 8, 8, 8, 8 ) );
  68. m_texButton_Hovered.Init( &m_Texture, 194, 25, 24, 24, Margin( 8, 8, 8, 8 ) );
  69. m_texButton_Pressed.Init( &m_Texture, 194, 50, 24, 24, Margin( 8, 8, 8, 8 ) );
  70. m_texMenu_Strip.Init( &m_Texture, 194, 75, 62, 21, Margin( 8, 8, 8, 8 ) );
  71. m_texMenu_Panel.Init( &m_Texture, 194, 130, 62, 32, Margin( 8, 8, 8, 8 ) );
  72. m_texMenu_Panel_Border.Init( &m_Texture, 194, 97, 62, 32, Margin( 24, 8, 8, 8 ) );
  73. m_texMenu_Hover.Init( &m_Texture, 219, 50, 24, 24, Margin( 8, 8, 8, 8 ) );
  74. m_texShadow.Init( &m_Texture, 223, 0, 32, 32, Margin( 8, 8, 8, 8 ) );
  75. m_texTextBox.Init( &m_Texture, 0, 122, 24, 24, Margin( 8, 8, 8, 8 ) );
  76. m_texTextBox_Focus.Init( &m_Texture, 25, 122, 24, 24, Margin( 8, 8, 8, 8 ) );
  77. m_texTab.Init( &m_Texture, 0, 97, 24, 24, Margin( 8, 8, 8, 8 ) );
  78. m_texTab_Inactive.Init( &m_Texture, 25, 97, 24, 24, Margin( 8, 8, 8, 8 ) );
  79. m_texTab_Control.Init( &m_Texture, 50, 97, 24, 24, Margin( 8, 8, 8, 8 ) );
  80. m_texTab_Gap.Init( &m_Texture, 50+8, 97+8, 8, 8, Margin( 8, 8, 8, 8 ) );
  81. m_texTabBar.Init( &m_Texture, 0, 147, 74, 16, Margin( 4, 4, 4, 4 ) );
  82. m_texWindow.Init( &m_Texture, 0, 0, 96, 96, Margin( 16, 32, 16, 16 ) );
  83. m_texWindow_Inactive.Init( &m_Texture, 97, 0, 96, 96, Margin( 16, 32, 16, 16 ) );
  84. m_Checkbox.Init( &m_Texture, 75, 97, 16, 16 );
  85. m_Checkbox_Checked.Init( &m_Texture, 93, 97, 16, 16 );
  86. m_RadioButton.Init( &m_Texture, 110, 97, 16, 16 );
  87. m_RadioButton_Checked.Init( &m_Texture, 127, 97, 16, 16 );
  88. m_CheckMark.Init( &m_Texture, 145, 97, 16, 16 );
  89. m_TreeMinus.Init( &m_Texture, 75, 115, 11, 11 );
  90. m_TreePlus.Init( &m_Texture, 93, 115, 11, 11 );
  91. m_texTreeBG.Init( &m_Texture, 0, 164, 49, 49, Margin( 16, 16, 16, 16 ) );
  92. }
  93. virtual void DrawButton( Gwen::Controls::Base* control, bool bDepressed, bool bHovered )
  94. {
  95. if ( bDepressed )
  96. m_texButton_Pressed.Draw( GetRender(), control->GetRenderBounds() );
  97. else
  98. m_texButton.Draw( GetRender(), control->GetRenderBounds() );
  99. if ( bHovered )
  100. m_texButton_Hovered.Draw( GetRender(), control->GetRenderBounds() );
  101. }
  102. virtual void DrawMenuItem( Gwen::Controls::Base* control, bool bSubmenuOpen, bool bChecked )
  103. {
  104. if ( bSubmenuOpen || control->IsHovered() )
  105. m_texMenu_Hover.Draw( GetRender(), control->GetRenderBounds() );
  106. if ( bChecked )
  107. m_CheckMark.Draw( GetRender(), Gwen::Rect( control->GetRenderBounds().x+2, control->GetRenderBounds().y+2, 16, 16 ));
  108. }
  109. virtual void DrawMenuStrip( Gwen::Controls::Base* control )
  110. {
  111. m_texMenu_Strip.Draw( GetRender(), control->GetRenderBounds() );
  112. }
  113. virtual void DrawMenu( Gwen::Controls::Base* control, bool bPaddingDisabled )
  114. {
  115. if ( !bPaddingDisabled )
  116. {
  117. return m_texMenu_Panel_Border.Draw( GetRender(), control->GetRenderBounds() );
  118. }
  119. m_texMenu_Panel.Draw( GetRender(), control->GetRenderBounds() );
  120. }
  121. virtual void DrawShadow( Gwen::Controls::Base* control )
  122. {
  123. Gwen::Rect r = control->GetRenderBounds();
  124. r.x -= 8;
  125. r.y -= 8;
  126. r.w += 16;
  127. r.h += 16;
  128. // m_texShadow.Draw( r );
  129. }
  130. virtual void DrawRadioButton( Gwen::Controls::Base* control, bool bSelected, bool bDepressed)
  131. {
  132. if ( bSelected )
  133. m_RadioButton_Checked.Draw( GetRender(), control->GetRenderBounds() );
  134. else
  135. m_RadioButton.Draw( GetRender(), control->GetRenderBounds() );
  136. }
  137. virtual void DrawCheckBox( Gwen::Controls::Base* control, bool bSelected, bool bDepressed)
  138. {
  139. if ( bSelected )
  140. m_Checkbox_Checked.Draw( GetRender(), control->GetRenderBounds() );
  141. else
  142. m_Checkbox.Draw( GetRender(), control->GetRenderBounds() );
  143. }
  144. virtual void DrawGroupBox( Gwen::Controls::Base* control, int textStart, int textHeight, int textWidth )
  145. {
  146. Gwen::Rect rect = control->GetRenderBounds();
  147. rect.y += textHeight * 0.5f;
  148. rect.h -= textHeight * 0.5f;
  149. Gwen::Color m_colDarker = Gwen::Color( 0, 50, 60, 50 );
  150. Gwen::Color m_colLighter = Gwen::Color( 255, 255, 255, 150 );
  151. GetRender()->SetDrawColor( m_colLighter );
  152. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, textStart-3, 1 ) );
  153. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1+textStart+textWidth, rect.y+1, rect.w-textStart+textWidth-2, 1 ) );
  154. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1, (rect.y + rect.h)-1, rect.x+rect.w-2, 1 ) );
  155. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, 1, rect.h ) );
  156. GetRender()->DrawFilledRect( Gwen::Rect( (rect.x + rect.w)-2, rect.y+1, 1, rect.h-1 ) );
  157. GetRender()->SetDrawColor( m_colDarker );
  158. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y, textStart-3, 1 ) );
  159. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1+textStart+textWidth, rect.y, rect.w-textStart-textWidth-2, 1 ) );
  160. GetRender()->DrawFilledRect( Gwen::Rect( rect.x+1, (rect.y + rect.h)-1, rect.x+rect.w-2, 1 ) );
  161. GetRender()->DrawFilledRect( Gwen::Rect( rect.x, rect.y+1, 1, rect.h-1 ) );
  162. GetRender()->DrawFilledRect( Gwen::Rect( (rect.x + rect.w)-1, rect.y+1, 1, rect.h-1 ) );
  163. }
  164. virtual void DrawTextBox( Gwen::Controls::Base* control )
  165. {
  166. Gwen::Rect rect = control->GetRenderBounds();
  167. bool bHasFocus = control->HasFocus();
  168. if ( bHasFocus )
  169. m_texTextBox_Focus.Draw( GetRender(), control->GetRenderBounds() );
  170. else
  171. m_texTextBox.Draw( GetRender(), control->GetRenderBounds() );
  172. //I dunno what this is for yet
  173. /*
  174. if ( CursorRect.w == 1 )
  175. {
  176. if ( bHasFocus )
  177. {
  178. GetRender()->SetDrawColor( Gwen::Color( 0, 0, 0, 200 ) );
  179. GetRender()->DrawFilledRect( CursorRect );
  180. }
  181. }
  182. else
  183. {
  184. if ( bHasFocus )
  185. {
  186. GetRender()->SetDrawColor( Gwen::Color( 50, 150, 255, 250 ) );
  187. GetRender()->DrawFilledRect( CursorRect );
  188. }
  189. }
  190. */
  191. }
  192. virtual void DrawTabButton( Gwen::Controls::Base* control, bool bActive )
  193. {
  194. if ( bActive )
  195. m_texTab.Draw( GetRender(), control->GetRenderBounds() );
  196. else
  197. m_texTab_Inactive.Draw( GetRender(), control->GetRenderBounds() );
  198. }
  199. virtual void DrawTabControl( Gwen::Controls::Base* control, Gwen::Rect CurrentButtonRect )
  200. {
  201. m_texTab_Control.Draw( GetRender(), control->GetRenderBounds() );
  202. if ( CurrentButtonRect.w > 0 && CurrentButtonRect.h > 0 )
  203. m_texTab_Gap.Draw( GetRender(), CurrentButtonRect );
  204. }
  205. virtual void DrawTabTitleBar( Gwen::Controls::Base* control )
  206. {
  207. m_texTabBar.Draw( GetRender(), control->GetRenderBounds() );
  208. }
  209. virtual void DrawWindow( Gwen::Controls::Base* control, int topHeight, bool inFocus )
  210. {
  211. Gwen::Rect rect = control->GetRenderBounds();
  212. if ( inFocus ) m_texWindow.Draw( GetRender(), control->GetRenderBounds() );
  213. else m_texWindow_Inactive.Draw( GetRender(), control->GetRenderBounds() );
  214. }
  215. virtual void DrawHighlight( Gwen::Controls::Base* control )
  216. {
  217. Gwen::Rect rect = control->GetRenderBounds();
  218. GetRender()->SetDrawColor( Gwen::Color( 255, 100, 255, 255 ) );
  219. GetRender()->DrawFilledRect( rect );
  220. }
  221. virtual void DrawScrollBar( Gwen::Controls::Base* control, bool isHorizontal, bool bDepressed )
  222. {
  223. Gwen::Rect rect = control->GetRenderBounds();
  224. if (bDepressed)
  225. GetRender()->SetDrawColor( m_colControlDarker );
  226. else
  227. GetRender()->SetDrawColor( m_colControlBright );
  228. GetRender()->DrawFilledRect( rect );
  229. }
  230. virtual void DrawScrollBarBar( Controls::Base* control, bool bDepressed, bool isHovered, bool isHorizontal )
  231. {
  232. //TODO: something specialized
  233. DrawButton( control, bDepressed, isHovered );
  234. }
  235. virtual void DrawProgressBar( Gwen::Controls::Base* control, bool isHorizontal, float progress)
  236. {
  237. Gwen::Rect rect = control->GetRenderBounds();
  238. Gwen::Color FillColour( 0, 211, 40, 255 );
  239. if ( isHorizontal )
  240. {
  241. //Background
  242. GetRender()->SetDrawColor( m_colControlDark );
  243. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  244. //Right half
  245. GetRender()->SetDrawColor( FillColour );
  246. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1, rect.w*progress-2, rect.h-2 ) );
  247. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  248. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h*0.45f ) );
  249. }
  250. else
  251. {
  252. //Background
  253. GetRender()->SetDrawColor( m_colControlDark );
  254. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  255. //Top half
  256. GetRender()->SetDrawColor( FillColour );
  257. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1 + (rect.h * (1 - progress)), rect.w-2, rect.h * progress - 2 ) );
  258. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  259. GetRender()->DrawFilledRect( Gwen::Rect( 1, 1, rect.w*0.45f, rect.h-2 ) );
  260. }
  261. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  262. GetRender()->DrawShavedCornerRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  263. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 70 ) );
  264. GetRender()->DrawShavedCornerRect( Gwen::Rect( 2, 2, rect.w-4, rect.h-4 ) );
  265. GetRender()->SetDrawColor( m_colBorderColor );
  266. GetRender()->DrawShavedCornerRect( rect );
  267. }
  268. virtual void DrawListBox( Gwen::Controls::Base* control )
  269. {
  270. Gwen::Rect rect = control->GetRenderBounds();
  271. GetRender()->SetDrawColor( m_colControlBright );
  272. GetRender()->DrawFilledRect( rect );
  273. GetRender()->SetDrawColor( m_colBorderColor );
  274. GetRender()->DrawLinedRect( rect );
  275. }
  276. virtual void DrawListBoxLine( Gwen::Controls::Base* control, bool bSelected )
  277. {
  278. Gwen::Rect rect = control->GetRenderBounds();
  279. if ( bSelected )
  280. {
  281. GetRender()->SetDrawColor( m_colHighlightBorder );
  282. GetRender()->DrawFilledRect( rect );
  283. }
  284. else if ( control->IsHovered() )
  285. {
  286. GetRender()->SetDrawColor( m_colHighlightBG );
  287. GetRender()->DrawFilledRect( rect );
  288. }
  289. }
  290. virtual void DrawSlider( Gwen::Controls::Base* control, bool bIsHorizontal, int numNotches, int barSize)
  291. {
  292. Gwen::Rect rect = control->GetRenderBounds();
  293. Gwen::Rect notchRect = rect;
  294. if ( bIsHorizontal )
  295. {
  296. rect.y += rect.h * 0.4;
  297. rect.h -= rect.h * 0.8;
  298. }
  299. else
  300. {
  301. rect.x += rect.w * 0.4;
  302. rect.w -= rect.w * 0.8;
  303. }
  304. GetRender()->SetDrawColor( m_colBGDark );
  305. GetRender()->DrawFilledRect( rect );
  306. GetRender()->SetDrawColor( m_colControlDarker );
  307. GetRender()->DrawLinedRect( rect );
  308. }
  309. virtual void DrawComboBox( Gwen::Controls::Base* control )
  310. {
  311. DrawTextBox( control );
  312. }
  313. virtual void DrawKeyboardHighlight( Gwen::Controls::Base* control, const Gwen::Rect& r, int iOffset )
  314. {
  315. Gwen::Rect rect = r;
  316. rect.x += iOffset;
  317. rect.y += iOffset;
  318. rect.w -= iOffset*2;
  319. rect.h -= iOffset*2;
  320. //draw the top and bottom
  321. bool skip = true;
  322. for(int i=0; i< rect.w*0.5; i++)
  323. {
  324. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  325. if (!skip)
  326. {
  327. GetRender()->DrawPixel(rect.x + (i*2), rect.y);
  328. GetRender()->DrawPixel(rect.x + (i*2), rect.y+rect.h-1);
  329. }
  330. else
  331. skip = !skip;
  332. }
  333. skip = false;
  334. for(int i=0; i< rect.h*0.5; i++)
  335. {
  336. GetRender()->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  337. if (!skip)
  338. {
  339. GetRender()->DrawPixel(rect.x , rect.y +i*2);
  340. GetRender()->DrawPixel(rect.x +rect.w-1, rect.y +i*2 );
  341. }
  342. else
  343. skip = !skip;
  344. }
  345. }
  346. virtual void DrawToolTip( Gwen::Controls::Base* control )
  347. {
  348. Gwen::Rect rct = control->GetRenderBounds();
  349. rct.x -= 3;
  350. rct.y -= 3;
  351. rct.w += 6;
  352. rct.h += 6;
  353. GetRender()->SetDrawColor( m_colToolTipBackground );
  354. GetRender()->DrawFilledRect( rct );
  355. GetRender()->SetDrawColor( m_colToolTipBorder );
  356. GetRender()->DrawLinedRect( rct );
  357. }
  358. virtual void DrawScrollButton( Gwen::Controls::Base* control, int iDirection, bool bDepressed )
  359. {
  360. DrawButton( control, bDepressed, false );
  361. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  362. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  363. if ( iDirection == Gwen::Pos::Top ) DrawArrowUp( r );
  364. else if ( iDirection == Gwen::Pos::Bottom ) DrawArrowDown( r );
  365. else if ( iDirection == Gwen::Pos::Left ) DrawArrowLeft( r );
  366. else DrawArrowRight( r );
  367. }
  368. virtual void DrawComboBoxButton( Gwen::Controls::Base* control, bool bDepressed )
  369. {
  370. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  371. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  372. DrawArrowDown( r );
  373. }
  374. virtual void DrawNumericUpDownButton( Gwen::Controls::Base* control, bool bDepressed, bool bUp )
  375. {
  376. // DrawButton( control->Width(), control->Height(), bDepressed, false, true );
  377. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  378. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  379. if ( bUp ) DrawArrowUp( r );
  380. else DrawArrowDown( r );
  381. }
  382. virtual void DrawStatusBar( Controls::Base* control )
  383. {
  384. DrawBackground( control );
  385. }
  386. virtual void DrawBackground( Gwen::Controls::Base* control )
  387. {
  388. Gwen::Rect rect = control->GetRenderBounds();
  389. m_Render->SetDrawColor( m_colBGDark );
  390. m_Render->DrawFilledRect( rect );
  391. m_Render->SetDrawColor( m_colControlDarker);
  392. m_Render->DrawLinedRect( rect );
  393. }
  394. virtual void DrawTreeButton( Controls::Base* control, bool bOpen )
  395. {
  396. Gwen::Rect rect = control->GetRenderBounds();
  397. rect.x += 2;
  398. rect.y += 2;
  399. rect.w -= 2;
  400. rect.h -= 2;
  401. if ( bOpen )
  402. {
  403. m_TreeMinus.Draw( GetRender(), rect );
  404. }
  405. else
  406. m_TreePlus.Draw( GetRender(), rect );
  407. }
  408. virtual void DrawTreeControl( Controls::Base* control )
  409. {
  410. m_texTreeBG.Draw( GetRender(), control->GetRenderBounds() );
  411. }
  412. virtual void DrawPropertyRow( Controls::Base* control, int iWidth, bool bBeingEdited )
  413. {
  414. Gwen::Rect rect = control->GetRenderBounds();
  415. if ( bBeingEdited )
  416. {
  417. GetRender()->SetDrawColor( m_colHighlightBG );
  418. GetRender()->DrawFilledRect( Gwen::Rect( 0, rect.y, iWidth, rect.h ) );
  419. }
  420. GetRender()->SetDrawColor( m_colControlOutlineLighter );
  421. GetRender()->DrawFilledRect( Gwen::Rect( iWidth, rect.y, 1, rect.h ) );
  422. rect.y += rect.h-1;
  423. rect.h = 1;
  424. GetRender()->DrawFilledRect( rect );
  425. }
  426. virtual void DrawPropertyTreeNode( Controls::Base* control, int BorderLeft, int BorderTop )
  427. {
  428. Gwen::Rect rect = control->GetRenderBounds();
  429. GetRender()->SetDrawColor( m_colControlOutlineLighter );
  430. GetRender()->DrawFilledRect( Gwen::Rect( rect.x, rect.y, BorderLeft, rect.h ) );
  431. GetRender()->DrawFilledRect( Gwen::Rect( rect.x + BorderLeft, rect.y, rect.w - BorderLeft, BorderTop ) );
  432. }
  433. void DrawTreeNode( Controls::Base* ctrl, bool bOpen, bool bSelected, int iLabelHeight, int iLabelWidth, int iHalfWay, int iLastBranch, bool bIsRoot )
  434. {
  435. if ( bSelected )
  436. {
  437. GetRender()->SetDrawColor( Color( 0, 150, 255, 100 ) );
  438. GetRender()->DrawFilledRect( Gwen::Rect( 17, 0, iLabelWidth + 2, iLabelHeight-1 ) );
  439. GetRender()->SetDrawColor( Color( 0, 150, 255, 200 ) );
  440. GetRender()->DrawLinedRect( Gwen::Rect( 17, 0, iLabelWidth + 2, iLabelHeight-1 ) );
  441. }
  442. GetRender()->SetDrawColor( Color( 0, 0, 0, 50 ) );
  443. if ( !bIsRoot )
  444. GetRender()->DrawFilledRect( Gwen::Rect( 9, iHalfWay, 16-9, 1 ) );
  445. if ( !bOpen ) return;
  446. GetRender()->DrawFilledRect( Gwen::Rect( 14 + 8, iLabelHeight, 1, iLastBranch + iHalfWay - iLabelHeight ) );
  447. }
  448. void DrawColorDisplay( Controls::Base* control, Gwen::Color color )
  449. {
  450. Gwen::Rect rect = control->GetRenderBounds();
  451. if ( color.a != 255)
  452. {
  453. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 255 ) );
  454. GetRender()->DrawFilledRect( rect );
  455. GetRender()->SetDrawColor( Gwen::Color( 128, 128, 128, 128 ) );
  456. GetRender()->DrawFilledRect( Gwen::Rect( 0, 0, rect.w * 0.5, rect.h * 0.5) );
  457. GetRender()->DrawFilledRect( Gwen::Rect( rect.w * 0.5, rect.h * 0.5, rect.w * 0.5,rect.h * 0.5) );
  458. }
  459. GetRender()->SetDrawColor( color );
  460. GetRender()->DrawFilledRect( rect );
  461. GetRender()->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  462. GetRender()->DrawLinedRect( rect );
  463. }
  464. virtual void DrawModalControl( Controls::Base* control )
  465. {
  466. if ( control->ShouldDrawBackground() )
  467. {
  468. Gwen::Rect rect = control->GetRenderBounds();
  469. GetRender()->SetDrawColor( m_colModal );
  470. GetRender()->DrawFilledRect( rect );
  471. }
  472. }
  473. virtual void DrawMenuDivider( Controls::Base* control )
  474. {
  475. Gwen::Rect rect = control->GetRenderBounds();
  476. GetRender()->SetDrawColor( m_colBGDark );
  477. GetRender()->DrawFilledRect( rect );
  478. GetRender()->SetDrawColor( m_colControlDarker);
  479. GetRender()->DrawLinedRect( rect );
  480. }
  481. };
  482. }
  483. }
  484. #endif