Simple.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. #pragma once
  2. #ifndef GWEN_SKINS_SIMPLE_H
  3. #define GWEN_SKINS_SIMPLE_H
  4. #include "Gwen/Skin.h"
  5. #include "Gwen/Gwen.h"
  6. #include "Gwen/Controls/Base.h"
  7. namespace Gwen
  8. {
  9. namespace Skin
  10. {
  11. class Simple : public Gwen::Skin::Base
  12. {
  13. public:
  14. Gwen::Color m_colBorderColor;
  15. Gwen::Color m_colControlOutlineLight;
  16. Gwen::Color m_colControlOutlineLighter;
  17. Gwen::Color m_colBG;
  18. Gwen::Color m_colBGDark;
  19. Gwen::Color m_colControl;
  20. Gwen::Color m_colControlBorderHighlight;
  21. Gwen::Color m_colControlDarker;
  22. Gwen::Color m_colControlOutlineNormal;
  23. Gwen::Color m_colControlBright;
  24. Gwen::Color m_colControlDark;
  25. Gwen::Color m_colHighlightBG;
  26. Gwen::Color m_colHighlightBorder;
  27. Gwen::Color m_colToolTipBackground;
  28. Gwen::Color m_colToolTipBorder;
  29. Gwen::Color m_colModal;
  30. Simple()
  31. {
  32. m_colBorderColor = Gwen::Color( 80, 80, 80, 255 );
  33. m_colBG = Gwen::Color( 248, 248, 248, 255 );
  34. m_colBGDark = Gwen::Color( 235, 235, 235, 255 );
  35. m_colControl = Gwen::Color( 240, 240, 240, 255 );
  36. m_colControlBright = Gwen::Color( 255, 255, 255, 255 );
  37. m_colControlDark = Gwen::Color( 214, 214, 214, 255 );
  38. m_colControlDarker = Gwen::Color( 180, 180, 180, 255 );
  39. m_colControlOutlineNormal = Gwen::Color( 112, 112, 112, 255 );
  40. m_colControlOutlineLight = Gwen::Color( 144, 144, 144, 255 );
  41. m_colControlOutlineLighter = Gwen::Color( 210, 210, 210, 255 );
  42. m_colHighlightBG = Gwen::Color( 192, 221, 252, 255 );
  43. m_colHighlightBorder = Gwen::Color( 51, 153, 255, 255 );
  44. m_colToolTipBackground = Gwen::Color( 255, 255, 225, 255 );
  45. m_colToolTipBorder = Gwen::Color( 0, 0, 0, 255 );
  46. m_colModal = Gwen::Color( 25, 25, 25, 150 );
  47. m_DefaultFont.facename = L"Microsoft Sans Serif";
  48. m_DefaultFont.size = 11;
  49. }
  50. virtual void DrawButton( Gwen::Controls::Base* control, bool bDepressed, bool bHovered )
  51. {
  52. int w = control->Width();
  53. int h = control->Height();
  54. DrawButton( w, h, bDepressed, bHovered );
  55. }
  56. virtual void DrawMenuItem( Gwen::Controls::Base* control, bool bSubmenuOpen, bool bChecked )
  57. {
  58. if ( bSubmenuOpen || control->IsHovered() )
  59. {
  60. m_Render->SetDrawColor( m_colHighlightBG );
  61. m_Render->DrawFilledRect( control->GetRenderBounds() );
  62. m_Render->SetDrawColor( m_colHighlightBorder );
  63. m_Render->DrawLinedRect( control->GetRenderBounds() );
  64. }
  65. // Gwen::Rect rect = control->GetRenderBounds();
  66. if ( bChecked )
  67. {
  68. m_Render->SetDrawColor( Color( 0, 0, 0, 255) );
  69. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  70. DrawCheck( r );
  71. }
  72. }
  73. virtual void DrawMenuStrip( Gwen::Controls::Base* control )
  74. {
  75. int w = control->Width();
  76. int h = control->Height();
  77. m_Render->SetDrawColor( Gwen::Color( 246, 248, 252, 255 ) );
  78. m_Render->DrawFilledRect( Gwen::Rect( 0, 0, w, h ) );
  79. m_Render->SetDrawColor( Gwen::Color( 218, 224, 241, 150 ) );
  80. m_Render->DrawFilledRect( Gwen::Rect( 0, h*0.4f, w, h*0.6f ) );
  81. m_Render->DrawFilledRect( Gwen::Rect( 0, h*0.5f, w, h*0.5f ) );
  82. }
  83. virtual void DrawMenu( Gwen::Controls::Base* control, bool bPaddingDisabled )
  84. {
  85. int w = control->Width();
  86. int h = control->Height();
  87. m_Render->SetDrawColor( m_colControlBright );
  88. m_Render->DrawFilledRect( Gwen::Rect( 0, 0, w, h ) );
  89. if ( !bPaddingDisabled )
  90. {
  91. m_Render->SetDrawColor( m_colControl );
  92. m_Render->DrawFilledRect( Gwen::Rect( 1, 0, 22, h ) );
  93. }
  94. m_Render->SetDrawColor( m_colControlOutlineNormal );
  95. m_Render->DrawLinedRect( Gwen::Rect( 0, 0, w, h ) );
  96. }
  97. virtual void DrawShadow( Gwen::Controls::Base* control )
  98. {
  99. int w = control->Width();
  100. int h = control->Height();
  101. int x = 4;
  102. int y = 6;
  103. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 10 ) );
  104. m_Render->DrawFilledRect( Gwen::Rect( x, y, w, h ) );
  105. x+=2;
  106. m_Render->DrawFilledRect( Gwen::Rect( x, y, w, h ) );
  107. y+=2;
  108. m_Render->DrawFilledRect( Gwen::Rect( x, y, w, h ) );
  109. }
  110. virtual void DrawButton( int w, int h, bool bDepressed, bool bHovered, bool bSquared = false )
  111. {
  112. if ( bDepressed ) m_Render->SetDrawColor( m_colControlDark );
  113. else if ( bHovered )m_Render->SetDrawColor( m_colControlBright );
  114. else m_Render->SetDrawColor( m_colControl );
  115. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, w-2, h-2 ) );
  116. if ( bDepressed ) m_Render->SetDrawColor( m_colControlDark );
  117. else if ( bHovered )m_Render->SetDrawColor( m_colControl );
  118. else m_Render->SetDrawColor( m_colControlDark );
  119. m_Render->DrawFilledRect( Gwen::Rect( 1, h*0.5, w-2, h*0.5-2 ) );
  120. if ( !bDepressed )
  121. {
  122. m_Render->SetDrawColor( m_colControlBright );
  123. m_Render->DrawShavedCornerRect( Gwen::Rect( 1, 1, w-2, h-2 ), bSquared );
  124. }
  125. else
  126. {
  127. m_Render->SetDrawColor( m_colControlDarker );
  128. m_Render->DrawShavedCornerRect( Gwen::Rect( 1, 1, w-2, h-2 ), bSquared );
  129. }
  130. // Border
  131. m_Render->SetDrawColor( m_colControlOutlineNormal );
  132. m_Render->DrawShavedCornerRect( Gwen::Rect( 0, 0, w, h ), bSquared );
  133. }
  134. virtual void DrawRadioButton( Gwen::Controls::Base* control, bool bSelected, bool bDepressed)
  135. {
  136. Gwen::Rect rect = control->GetRenderBounds();
  137. // Inside colour
  138. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 220, 242, 254, 255 ) );
  139. else m_Render->SetDrawColor( m_colControlBright );
  140. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  141. // Border
  142. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 85, 130, 164, 255 ) );
  143. else m_Render->SetDrawColor( m_colControlOutlineLight );
  144. m_Render->DrawShavedCornerRect( rect );
  145. m_Render->SetDrawColor( Gwen::Color( 0, 50, 60, 15 ) );
  146. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w-4, rect.h-4 ) );
  147. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w*0.3f, rect.h-4 ) );
  148. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w-4, rect.h*0.3f ) );
  149. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 121, 198, 249, 255 ) );
  150. else m_Render->SetDrawColor( Gwen::Color( 0, 50, 60, 50 ) );
  151. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+3, 1, rect.h-5 ) );
  152. m_Render->DrawFilledRect( Gwen::Rect( rect.x+3, rect.y+2, rect.w-5, 1 ) );
  153. if ( bSelected )
  154. {
  155. m_Render->SetDrawColor( Gwen::Color( 40, 230, 30, 255 ) );
  156. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w -4, rect.h-4 ) );
  157. }
  158. }
  159. virtual void DrawCheckBox( Gwen::Controls::Base* control, bool bSelected, bool bDepressed)
  160. {
  161. Gwen::Rect rect = control->GetRenderBounds();
  162. // Inside colour
  163. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 220, 242, 254, 255 ) );
  164. else m_Render->SetDrawColor( m_colControlBright );
  165. m_Render->DrawFilledRect( rect );
  166. // Border
  167. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 85, 130, 164, 255 ) );
  168. else m_Render->SetDrawColor( m_colControlOutlineLight );
  169. m_Render->DrawLinedRect( rect );
  170. m_Render->SetDrawColor( Gwen::Color( 0, 50, 60, 15 ) );
  171. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w-4, rect.h-4 ) );
  172. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w*0.3f, rect.h-4 ) );
  173. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w-4, rect.h*0.3f ) );
  174. if ( control->IsHovered() ) m_Render->SetDrawColor( Gwen::Color( 121, 198, 249, 255 ) );
  175. else m_Render->SetDrawColor( Gwen::Color( 0, 50, 60, 50 ) );
  176. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, 1, rect.h-4 ) );
  177. m_Render->DrawFilledRect( Gwen::Rect( rect.x+2, rect.y+2, rect.w-4, 1 ) );
  178. if ( bDepressed )
  179. {
  180. m_Render->SetDrawColor( Color( 100, 100, 100, 255) );
  181. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  182. DrawCheck( r );
  183. }
  184. else if ( bSelected )
  185. {
  186. m_Render->SetDrawColor( Color( 0, 0, 0, 255) );
  187. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  188. DrawCheck( r );
  189. }
  190. }
  191. virtual void DrawGroupBox( Gwen::Controls::Base* control, int textStart, int textHeight, int textWidth )
  192. {
  193. Gwen::Rect rect = control->GetRenderBounds();
  194. rect.y += textHeight * 0.5f;
  195. rect.h -= textHeight * 0.5f;
  196. Gwen::Color m_colDarker = Gwen::Color( 0, 50, 60, 50 );
  197. Gwen::Color m_colLighter = Gwen::Color( 255, 255, 255, 150 );
  198. m_Render->SetDrawColor( m_colLighter );
  199. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, textStart-3, 1 ) );
  200. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1+textStart+textWidth, rect.y+1, rect.w-textStart+textWidth-2, 1 ) );
  201. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, (rect.y + rect.h)-1, rect.w-2, 1 ) );
  202. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, 1, rect.h ) );
  203. m_Render->DrawFilledRect( Gwen::Rect( (rect.x + rect.w)-2, rect.y+1, 1, rect.h-1 ) );
  204. m_Render->SetDrawColor( m_colDarker );
  205. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y, textStart-3, 1 ) );
  206. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1+textStart+textWidth, rect.y, rect.w-textStart-textWidth-2, 1 ) );
  207. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, (rect.y + rect.h) -1, rect.w-2, 1 ) );
  208. m_Render->DrawFilledRect( Gwen::Rect( rect.x, rect.y+1, 1, rect.h-1 ) );
  209. m_Render->DrawFilledRect( Gwen::Rect( (rect.x + rect.w)-1, rect.y+1, 1, rect.h-1 ) );
  210. }
  211. virtual void DrawTextBox( Gwen::Controls::Base* control )
  212. {
  213. Gwen::Rect rect = control->GetRenderBounds();
  214. bool bHasFocus = control->HasFocus();
  215. // Box inside
  216. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 255 ) );
  217. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  218. m_Render->SetDrawColor( m_colControlOutlineLight );
  219. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y, rect.w-2, 1 ) );
  220. m_Render->DrawFilledRect( Gwen::Rect( rect.x, rect.y+1, 1, rect.h-2 ) );
  221. m_Render->SetDrawColor( m_colControlOutlineLighter );
  222. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, (rect.y + rect.h)-1, rect.w-2, 1 ) );
  223. m_Render->DrawFilledRect( Gwen::Rect( (rect.x + rect.w)-1, rect.y+1, 1, rect.h-2 ) );
  224. if ( bHasFocus )
  225. {
  226. m_Render->SetDrawColor( Gwen::Color( 50, 200, 255, 150 ) );
  227. m_Render->DrawLinedRect( rect );
  228. }
  229. }
  230. virtual void DrawTabButton( Gwen::Controls::Base* control, bool bActive )
  231. {
  232. Gwen::Rect rect = control->GetRenderBounds();
  233. bool bHovered = control->IsHovered();
  234. if ( bActive )
  235. {
  236. m_Render->SetDrawColor( m_colControl );
  237. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, rect.w-2, rect.h-1 ) );
  238. }
  239. else
  240. {
  241. if ( bHovered )m_Render->SetDrawColor( m_colControlBright );
  242. else m_Render->SetDrawColor( m_colControl );
  243. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-1 ) );
  244. if ( bHovered )m_Render->SetDrawColor( m_colControl );
  245. else m_Render->SetDrawColor( m_colControlDark );
  246. m_Render->DrawFilledRect( Gwen::Rect( 1, rect.h*0.5, rect.w-2, rect.h*0.5-1 ) );
  247. m_Render->SetDrawColor( m_colControlBright );
  248. m_Render->DrawShavedCornerRect( Gwen::Rect( 1, 1, rect.w-2, rect.h ) );
  249. }
  250. m_Render->SetDrawColor( m_colBorderColor );
  251. m_Render->DrawShavedCornerRect( Gwen::Rect( 0, 0, rect.w, rect.h ) );
  252. }
  253. virtual void DrawTabControl( Gwen::Controls::Base* control, Gwen::Rect CurrentButtonRect )
  254. {
  255. Gwen::Rect rect = control->GetRenderBounds();
  256. m_Render->SetDrawColor( m_colControl );
  257. m_Render->DrawFilledRect( rect );
  258. m_Render->SetDrawColor( m_colBorderColor );
  259. m_Render->DrawLinedRect( rect );
  260. m_Render->SetDrawColor( m_colControl );
  261. m_Render->DrawFilledRect( CurrentButtonRect );
  262. }
  263. virtual void DrawWindow( Gwen::Controls::Base* control, int topHeight, bool inFocus )
  264. {
  265. Gwen::Rect rect = control->GetRenderBounds();
  266. // Titlebar
  267. if ( inFocus )
  268. m_Render->SetDrawColor( Gwen::Color( 87, 164, 232, 230 ) );
  269. else
  270. m_Render->SetDrawColor( Gwen::Color( 87*0.70, 164*0.70, 232*0.70, 230 ) );
  271. int iBorderSize = 5;
  272. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+1, rect.w-2, topHeight-1 ) );
  273. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+topHeight-1, iBorderSize, rect.h-2-topHeight ) );
  274. m_Render->DrawFilledRect( Gwen::Rect( rect.x+rect.w-iBorderSize, rect.y+topHeight-1, iBorderSize, rect.h-2-topHeight ) );
  275. m_Render->DrawFilledRect( Gwen::Rect( rect.x+1, rect.y+rect.h-iBorderSize, rect.w-2, iBorderSize ) );
  276. // Main inner
  277. m_Render->SetDrawColor( Gwen::Color( m_colControlDark.r, m_colControlDark.g, m_colControlDark.b, 230 ) );
  278. m_Render->DrawFilledRect( Gwen::Rect( rect.x+iBorderSize+1, rect.y+topHeight, rect.w-iBorderSize*2-2, rect.h-topHeight-iBorderSize-1 ) );
  279. // Light inner border
  280. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 100 ) );
  281. m_Render->DrawShavedCornerRect( Gwen::Rect( rect.x+1, rect.y+1, rect.w-2, rect.h-2 ) );
  282. // Dark line between titlebar and main
  283. m_Render->SetDrawColor( m_colBorderColor );
  284. // Inside border
  285. m_Render->SetDrawColor( m_colControlOutlineNormal );
  286. m_Render->DrawLinedRect( Gwen::Rect( rect.x+iBorderSize, rect.y+topHeight-1, rect.w - 10, rect.h - topHeight - (iBorderSize - 1) ) );
  287. // Dark outer border
  288. m_Render->SetDrawColor( m_colBorderColor );
  289. m_Render->DrawShavedCornerRect( Gwen::Rect( rect.x, rect.y, rect.w, rect.h ) );
  290. }
  291. virtual void DrawHighlight( Gwen::Controls::Base* control )
  292. {
  293. Gwen::Rect rect = control->GetRenderBounds();
  294. m_Render->SetDrawColor( Gwen::Color( 255, 100, 255, 255 ) );
  295. m_Render->DrawFilledRect( rect );
  296. }
  297. virtual void DrawScrollBar( Gwen::Controls::Base* control, bool isHorizontal, bool bDepressed )
  298. {
  299. Gwen::Rect rect = control->GetRenderBounds();
  300. if (bDepressed)
  301. m_Render->SetDrawColor( m_colControlDarker );
  302. else
  303. m_Render->SetDrawColor( m_colControlBright );
  304. m_Render->DrawFilledRect( rect );
  305. }
  306. virtual void DrawScrollBarBar( Controls::Base* control, bool bDepressed, bool isHovered, bool isHorizontal )
  307. {
  308. //TODO: something specialized
  309. DrawButton( control, bDepressed, isHovered );
  310. }
  311. virtual void DrawTabTitleBar( Gwen::Controls::Base* control )
  312. {
  313. Gwen::Rect rect = control->GetRenderBounds();
  314. m_Render->SetDrawColor( Gwen::Color( 177, 193, 214, 255 ) );
  315. m_Render->DrawFilledRect( rect );
  316. m_Render->SetDrawColor( m_colBorderColor );
  317. rect.h += 1;
  318. m_Render->DrawLinedRect( rect );
  319. }
  320. virtual void DrawProgressBar( Gwen::Controls::Base* control, bool isHorizontal, float progress)
  321. {
  322. Gwen::Rect rect = control->GetRenderBounds();
  323. Gwen::Color FillColour( 0, 211, 40, 255 );
  324. if ( isHorizontal )
  325. {
  326. //Background
  327. m_Render->SetDrawColor( m_colControlDark );
  328. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  329. //Right half
  330. m_Render->SetDrawColor( FillColour );
  331. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w*progress-2, rect.h-2 ) );
  332. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  333. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h*0.45f ) );
  334. }
  335. else
  336. {
  337. //Background
  338. m_Render->SetDrawColor( m_colControlDark );
  339. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  340. //Top half
  341. m_Render->SetDrawColor( FillColour );
  342. m_Render->DrawFilledRect( Gwen::Rect( 1, 1 + (rect.h * (1 - progress)), rect.w-2, rect.h * progress - 2 ) );
  343. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  344. m_Render->DrawFilledRect( Gwen::Rect( 1, 1, rect.w*0.45f, rect.h-2 ) );
  345. }
  346. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 150 ) );
  347. m_Render->DrawShavedCornerRect( Gwen::Rect( 1, 1, rect.w-2, rect.h-2 ) );
  348. m_Render->SetDrawColor( Gwen::Color( 255, 255, 255, 70 ) );
  349. m_Render->DrawShavedCornerRect( Gwen::Rect( 2, 2, rect.w-4, rect.h-4 ) );
  350. m_Render->SetDrawColor( m_colBorderColor );
  351. m_Render->DrawShavedCornerRect( rect );
  352. }
  353. virtual void DrawListBox( Gwen::Controls::Base* control )
  354. {
  355. Gwen::Rect rect = control->GetRenderBounds();
  356. m_Render->SetDrawColor( m_colControlBright );
  357. m_Render->DrawFilledRect( rect );
  358. m_Render->SetDrawColor( m_colBorderColor );
  359. m_Render->DrawLinedRect( rect );
  360. }
  361. virtual void DrawListBoxLine( Gwen::Controls::Base* control, bool bSelected )
  362. {
  363. Gwen::Rect rect = control->GetRenderBounds();
  364. if ( bSelected )
  365. {
  366. m_Render->SetDrawColor( m_colHighlightBorder );
  367. m_Render->DrawFilledRect( rect );
  368. }
  369. else if ( control->IsHovered() )
  370. {
  371. m_Render->SetDrawColor( m_colHighlightBG );
  372. m_Render->DrawFilledRect( rect );
  373. }
  374. }
  375. virtual void DrawSlider( Gwen::Controls::Base* control, bool bIsHorizontal, int numNotches, int barSize)
  376. {
  377. Gwen::Rect rect = control->GetRenderBounds();
  378. // Gwen::Rect notchRect = rect;
  379. if ( bIsHorizontal )
  380. {
  381. rect.y += rect.h * 0.4;
  382. rect.h -= rect.h * 0.8;
  383. }
  384. else
  385. {
  386. rect.x += rect.w * 0.4;
  387. rect.w -= rect.w * 0.8;
  388. }
  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 DrawComboBox( Gwen::Controls::Base* control )
  395. {
  396. DrawTextBox( control );
  397. }
  398. virtual void DrawBackground( Gwen::Controls::Base* control )
  399. {
  400. Gwen::Rect rect = control->GetRenderBounds();
  401. m_Render->SetDrawColor( m_colBGDark );
  402. m_Render->DrawFilledRect( rect );
  403. m_Render->SetDrawColor( m_colControlDarker);
  404. m_Render->DrawLinedRect( rect );
  405. }
  406. virtual void DrawKeyboardHighlight( Gwen::Controls::Base* control, const Gwen::Rect& r, int iOffset )
  407. {
  408. Gwen::Rect rect = r;
  409. rect.x += iOffset;
  410. rect.y += iOffset;
  411. rect.w -= iOffset*2;
  412. rect.h -= iOffset*2;
  413. //draw the top and bottom
  414. bool skip = true;
  415. for(int i=0; i< rect.w*0.5; i++)
  416. {
  417. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  418. if (!skip)
  419. {
  420. m_Render->DrawPixel(rect.x + (i*2), rect.y);
  421. m_Render->DrawPixel(rect.x + (i*2), rect.y+rect.h-1);
  422. }
  423. else
  424. skip = !skip;
  425. }
  426. skip = false;
  427. for(int i=0; i< rect.h*0.5; i++)
  428. {
  429. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  430. if (!skip)
  431. {
  432. m_Render->DrawPixel(rect.x , rect.y +i*2);
  433. m_Render->DrawPixel(rect.x +rect.w-1, rect.y +i*2 );
  434. }
  435. else
  436. skip = !skip;
  437. }
  438. }
  439. virtual void DrawToolTip( Gwen::Controls::Base* control )
  440. {
  441. Gwen::Rect rct = control->GetRenderBounds();
  442. rct.x -= 3;
  443. rct.y -= 3;
  444. rct.w += 6;
  445. rct.h += 6;
  446. m_Render->SetDrawColor( m_colToolTipBackground );
  447. m_Render->DrawFilledRect( rct );
  448. m_Render->SetDrawColor( m_colToolTipBorder );
  449. m_Render->DrawLinedRect( rct );
  450. }
  451. virtual void DrawScrollButton( Gwen::Controls::Base* control, int iDirection, bool bDepressed )
  452. {
  453. DrawButton( control, bDepressed, false );
  454. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  455. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  456. if ( iDirection == Gwen::Pos::Top ) DrawArrowUp( r );
  457. else if ( iDirection == Gwen::Pos::Bottom ) DrawArrowDown( r );
  458. else if ( iDirection == Gwen::Pos::Left ) DrawArrowLeft( r );
  459. else DrawArrowRight( r );
  460. }
  461. virtual void DrawComboBoxButton( Gwen::Controls::Base* control, bool bDepressed )
  462. {
  463. //DrawButton( control->Width(), control->Height(), bDepressed, false, true );
  464. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  465. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  466. DrawArrowDown( r );
  467. }
  468. virtual void DrawNumericUpDownButton( Gwen::Controls::Base* control, bool bDepressed, bool bUp )
  469. {
  470. //DrawButton( control->Width(), control->Height(), bDepressed, false, true );
  471. m_Render->SetDrawColor( Gwen::Color( 0, 0, 0, 240 ) );
  472. Gwen::Rect r( control->Width() / 2 - 2, control->Height() / 2 - 2, 5, 5 );
  473. if ( bUp ) DrawArrowUp( r );
  474. else DrawArrowDown( r );
  475. }
  476. virtual void DrawTreeButton( Controls::Base* control, bool bOpen )
  477. {
  478. Gwen::Rect rect = control->GetRenderBounds();
  479. rect.x += 2;
  480. rect.y += 2;
  481. rect.w -= 4;
  482. rect.h -= 4;
  483. m_Render->SetDrawColor( m_colControlBright );
  484. m_Render->DrawFilledRect( rect );
  485. m_Render->SetDrawColor( m_colBorderColor );
  486. m_Render->DrawLinedRect( rect );
  487. m_Render->SetDrawColor( m_colBorderColor );
  488. if ( !bOpen ) // ! because the button shows intention, not the current state
  489. m_Render->DrawFilledRect( Gwen::Rect( rect.x + rect.w/2, rect.y + 2, 1, rect.h - 4 ) );
  490. m_Render->DrawFilledRect( Gwen::Rect( rect.x +2, rect.y + rect.h/2, rect.w-4, 1 ) );
  491. }
  492. virtual void DrawTreeControl( Controls::Base* control )
  493. {
  494. Gwen::Rect rect = control->GetRenderBounds();
  495. m_Render->SetDrawColor( m_colControlBright );
  496. m_Render->DrawFilledRect( rect );
  497. m_Render->SetDrawColor( m_colBorderColor );
  498. m_Render->DrawLinedRect( rect );
  499. }
  500. void DrawTreeNode( Controls::Base* ctrl, bool bOpen, bool bSelected, int iLabelHeight, int iLabelWidth, int iHalfWay, int iLastBranch, bool bIsRoot )
  501. {
  502. if ( bSelected )
  503. {
  504. m_Render->SetDrawColor( Color( 0, 150, 255, 100 ) );
  505. m_Render->DrawFilledRect( Gwen::Rect( 17, 0, iLabelWidth + 2, iLabelHeight-1 ) );
  506. m_Render->SetDrawColor( Color( 0, 150, 255, 200 ) );
  507. m_Render->DrawLinedRect( Gwen::Rect( 17, 0, iLabelWidth + 2, iLabelHeight-1 ) );
  508. }
  509. m_Render->SetDrawColor( Color( 0, 0, 0, 50 ) );
  510. if ( !bIsRoot )
  511. m_Render->DrawFilledRect( Gwen::Rect( 9, iHalfWay, 16-9, 1 ) );
  512. if ( !bOpen ) return;
  513. m_Render->DrawFilledRect( Gwen::Rect( 14 + 8, iLabelHeight, 1, iLastBranch + iHalfWay - iLabelHeight ) );
  514. }
  515. virtual void DrawStatusBar( Controls::Base* control )
  516. {
  517. DrawBackground( control );
  518. }
  519. virtual void DrawPropertyRow( Controls::Base* control, int iWidth, bool bBeingEdited )
  520. {
  521. Gwen::Rect rect = control->GetRenderBounds();
  522. if ( bBeingEdited )
  523. {
  524. m_Render->SetDrawColor( m_colHighlightBG );
  525. m_Render->DrawFilledRect( Gwen::Rect( 0, rect.y, iWidth, rect.h ) );
  526. }
  527. m_Render->SetDrawColor( m_colControlOutlineLighter );
  528. m_Render->DrawFilledRect( Gwen::Rect( iWidth, rect.y, 1, rect.h ) );
  529. rect.y += rect.h-1;
  530. rect.h = 1;
  531. m_Render->DrawFilledRect( rect );
  532. }
  533. virtual void DrawPropertyTreeNode( Controls::Base* control, int BorderLeft, int BorderTop )
  534. {
  535. Gwen::Rect rect = control->GetRenderBounds();
  536. m_Render->SetDrawColor( m_colControlOutlineLighter );
  537. m_Render->DrawFilledRect( Gwen::Rect( rect.x, rect.y, BorderLeft, rect.h ) );
  538. m_Render->DrawFilledRect( Gwen::Rect( rect.x + BorderLeft, rect.y, rect.w - BorderLeft, BorderTop ) );
  539. }
  540. void DrawColorDisplay( Controls::Base* control, Gwen::Color color )
  541. {
  542. Gwen::Rect rect = control->GetRenderBounds();
  543. if ( color.a != 255 )
  544. {
  545. GetRender()->SetDrawColor( Gwen::Color( 255, 255, 255, 255 ) );
  546. GetRender()->DrawFilledRect( rect );
  547. GetRender()->SetDrawColor( Gwen::Color( 128, 128, 128, 128 ) );
  548. GetRender()->DrawFilledRect( Gwen::Rect( 0, 0, rect.w * 0.5, rect.h * 0.5) );
  549. GetRender()->DrawFilledRect( Gwen::Rect( rect.w * 0.5, rect.h * 0.5, rect.w * 0.5,rect.h * 0.5) );
  550. }
  551. GetRender()->SetDrawColor( color );
  552. GetRender()->DrawFilledRect( rect );
  553. GetRender()->SetDrawColor( Gwen::Color( 0, 0, 0, 255 ) );
  554. GetRender()->DrawLinedRect( rect );
  555. }
  556. virtual void DrawModalControl( Controls::Base* control )
  557. {
  558. if ( control->ShouldDrawBackground() )
  559. {
  560. Gwen::Rect rect = control->GetRenderBounds();
  561. GetRender()->SetDrawColor( m_colModal );
  562. GetRender()->DrawFilledRect( rect );
  563. }
  564. }
  565. virtual void DrawMenuDivider( Controls::Base* control )
  566. {
  567. Gwen::Rect rect = control->GetRenderBounds();
  568. GetRender()->SetDrawColor( m_colBGDark );
  569. GetRender()->DrawFilledRect( rect );
  570. GetRender()->SetDrawColor( m_colControlDarker);
  571. GetRender()->DrawLinedRect( rect );
  572. }
  573. };
  574. }
  575. }
  576. #endif