BsEditorGUI.cpp 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. #include "BsEditorGUI.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIToggle.h"
  7. #include "BsGUIColor.h"
  8. #include "BsTextSprite.h"
  9. #include "BsSpriteTexture.h"
  10. #include "BsGUITreeViewEditBox.h"
  11. #include "CmFont.h"
  12. #include "CmFontImportOptions.h"
  13. #include "CmImporter.h"
  14. #include "CmRTTIType.h"
  15. #include "CmFileSystem.h"
  16. using namespace CamelotFramework;
  17. using namespace BansheeEngine;
  18. namespace BansheeEditor
  19. {
  20. const WString EditorGUI::DefaultFontPath = L"arial.ttf";
  21. const UINT32 EditorGUI::DefaultFontSize = 10;
  22. const WString EditorGUI::DefaultFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
  23. const WString EditorGUI::WindowBackgroundTexture = L"WindowBgTile.psd";
  24. const WString EditorGUI::ButtonNormalTex = L"ButtonNormal.psd";
  25. const WString EditorGUI::ButtonHoverTex = L"ButtonHover.psd";
  26. const WString EditorGUI::ToggleNormalTex = L"ToggleNormal.psd";
  27. const WString EditorGUI::ToggleHoverTex = L"ToggleHover.psd";
  28. const WString EditorGUI::ToggleActiveTex = L"ToggleActive.psd";
  29. const WString EditorGUI::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  30. const WString EditorGUI::ToggleHoverOnTex = L"ToggleOnHover.psd";
  31. const WString EditorGUI::ToggleActiveOnTex = L"ToggleOnActive.psd";
  32. const WString EditorGUI::WindowFrameNormal = L"WindowFrameNormal.psd";
  33. const WString EditorGUI::WindowFrameFocused = L"WindowFrameFocused.psd";
  34. const WString EditorGUI::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  35. const WString EditorGUI::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  36. const WString EditorGUI::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  37. const WString EditorGUI::WindowMinButtonNormal = L"WindowMaxBtnNormal.psd";
  38. const WString EditorGUI::WindowMinButtonHover = L"WindowMaxBtnHover.psd";
  39. const WString EditorGUI::WindowMaxButtonNormal = L"WindowMinBtnNormal.psd";
  40. const WString EditorGUI::WindowMaxButtonHover = L"WindowMinBtnHover.psd";
  41. const WString EditorGUI::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  42. const WString EditorGUI::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  43. const WString EditorGUI::InputBoxNormalTex = L"InputBoxNormal.psd";
  44. const WString EditorGUI::InputBoxHoverTex = L"InputBoxHover.psd";
  45. const WString EditorGUI::InputBoxFocusedTex = L"InputBoxFocused.psd";
  46. const WString EditorGUI::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  47. const WString EditorGUI::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  48. const WString EditorGUI::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  49. const WString EditorGUI::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  50. const WString EditorGUI::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  51. const WString EditorGUI::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  52. const WString EditorGUI::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  53. const WString EditorGUI::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  54. const WString EditorGUI::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  55. const WString EditorGUI::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  56. const WString EditorGUI::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  57. const WString EditorGUI::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  58. const WString EditorGUI::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  59. const WString EditorGUI::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  60. const WString EditorGUI::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  61. const WString EditorGUI::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  62. const WString EditorGUI::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  63. const WString EditorGUI::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  64. const WString EditorGUI::DropDownBtnNormalTex = L"DropDownNormal.psd";
  65. const WString EditorGUI::DropDownBtnHoverTex = L"DropDownHover.psd";
  66. const WString EditorGUI::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  67. const WString EditorGUI::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  68. const WString EditorGUI::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  69. const WString EditorGUI::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  70. const WString EditorGUI::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  71. const WString EditorGUI::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  72. const WString EditorGUI::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  73. const WString EditorGUI::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  74. const WString EditorGUI::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  75. const WString EditorGUI::DropDownSeparatorTex = L"DropDownSeparator.psd";
  76. const WString EditorGUI::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  77. const WString EditorGUI::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  78. const WString EditorGUI::ScrollBarBgTex = L"ScrollBarBg.psd";
  79. const WString EditorGUI::MenuBarBgTex = L"MenuBarBg.psd";
  80. const WString EditorGUI::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  81. const WString EditorGUI::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  82. const WString EditorGUI::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  83. const WString EditorGUI::DockSliderNormalTex = L"DockSliderBtn.psd";
  84. const WString EditorGUI::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  85. const WString EditorGUI::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  86. const WString EditorGUI::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  87. const WString EditorGUI::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  88. const WString EditorGUI::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  89. const WString EditorGUI::TreeViewEditBox = L"TreeViewEditBox.psd";
  90. const WString EditorGUI::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  91. const WString EditorGUI::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  92. EditorGUI::EditorGUI()
  93. {
  94. // TODO - Normally I want to load this from some file
  95. // Label
  96. // TODO - Instead of importing font every time, try to save a resource and then just load it?
  97. HFont font;
  98. {
  99. WString fontPath = DefaultFolder + DefaultFontPath;
  100. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  101. if(rtti_is_of_type<FontImportOptions>(fontImportOptions))
  102. {
  103. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  104. Vector<CamelotFramework::UINT32>::type fontSizes;
  105. fontSizes.push_back(DefaultFontSize);
  106. importOptions->setFontSizes(fontSizes);
  107. importOptions->setAntialiasing(false);
  108. }
  109. font = Importer::instance().import(fontPath, fontImportOptions);
  110. }
  111. GUIElementStyle labelStyle;
  112. labelStyle.font = font;
  113. labelStyle.fontSize = DefaultFontSize;
  114. labelStyle.fixedWidth = false;
  115. labelStyle.fixedHeight = true;
  116. labelStyle.height = 16;
  117. labelStyle.minWidth = 10;
  118. mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
  119. // Window frame
  120. GUIElementStyle windowFrameStyle;
  121. windowFrameStyle.normal.texture = getTexture(WindowFrameNormal);
  122. windowFrameStyle.focused.texture = getTexture(WindowFrameFocused);
  123. windowFrameStyle.border.left = 1;
  124. windowFrameStyle.border.right = 1;
  125. windowFrameStyle.border.top = 1;
  126. windowFrameStyle.border.bottom = 1;
  127. mSkin.setStyle("WindowFrame", windowFrameStyle);
  128. // Button
  129. GUIElementStyle buttonStyle;
  130. buttonStyle.normal.texture = getTexture(ButtonNormalTex);
  131. buttonStyle.hover.texture = getTexture(ButtonHoverTex);
  132. buttonStyle.active.texture = buttonStyle.hover.texture;
  133. buttonStyle.border.left = 5;
  134. buttonStyle.border.right = 5;
  135. buttonStyle.border.top = 5;
  136. buttonStyle.border.bottom = 5;
  137. buttonStyle.margins.left = 4;
  138. buttonStyle.margins.right = 4;
  139. buttonStyle.margins.top = 4;
  140. buttonStyle.margins.bottom = 4;
  141. buttonStyle.contentOffset.left = 2;
  142. buttonStyle.contentOffset.right = 2;
  143. buttonStyle.fixedHeight = true;
  144. buttonStyle.height = 21;
  145. buttonStyle.minWidth = 50;
  146. buttonStyle.font = font;
  147. buttonStyle.fontSize = DefaultFontSize;
  148. buttonStyle.textHorzAlign = THA_Center;
  149. buttonStyle.textVertAlign = TVA_Center;
  150. mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
  151. // Toggle
  152. GUIElementStyle toggleStyle;
  153. toggleStyle.normal.texture = getTexture(ToggleNormalTex);
  154. toggleStyle.hover.texture = getTexture(ToggleHoverTex);
  155. toggleStyle.active.texture = getTexture(ToggleActiveTex);
  156. toggleStyle.normalOn.texture = getTexture(ToggleNormalOnTex);
  157. toggleStyle.hoverOn.texture = getTexture(ToggleHoverOnTex);
  158. toggleStyle.activeOn.texture = getTexture(ToggleActiveOnTex);
  159. toggleStyle.fixedHeight = true;
  160. toggleStyle.fixedWidth = true;
  161. toggleStyle.height = 15;
  162. toggleStyle.width = 15;
  163. mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  164. // Color
  165. GUIElementStyle colorStyle;
  166. colorStyle.margins.left = 2;
  167. colorStyle.margins.right = 2;
  168. colorStyle.margins.top = 2;
  169. colorStyle.margins.bottom = 2;
  170. colorStyle.fixedHeight = true;
  171. colorStyle.height = 10;
  172. colorStyle.minWidth = 10;
  173. mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
  174. // Window background texture
  175. GUIElementStyle windowBgStyle;
  176. windowBgStyle.normal.texture = getTexture(WindowBackgroundTexture);
  177. mSkin.setStyle("WindowBackground", windowBgStyle);
  178. // Window title bar background
  179. GUIElementStyle titleBarBgStyle;
  180. titleBarBgStyle.normal.texture = getTexture(WindowTitleBarBg);
  181. titleBarBgStyle.fixedHeight = true;
  182. titleBarBgStyle.height = 13;
  183. mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
  184. // Tabbed title bar tab button
  185. GUIElementStyle tabbedBarButton;
  186. tabbedBarButton.normal.texture = getTexture(TabbedBarBtnNormal);
  187. tabbedBarButton.hover.texture = getTexture(TabbedBarBtnActive);
  188. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  189. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  190. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  191. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  192. tabbedBarButton.fixedHeight = true;
  193. tabbedBarButton.height = 13;
  194. tabbedBarButton.minWidth = 10;
  195. tabbedBarButton.maxWidth = 110;
  196. tabbedBarButton.font = font;
  197. tabbedBarButton.fontSize = DefaultFontSize;
  198. tabbedBarButton.textHorzAlign = THA_Center;
  199. tabbedBarButton.textVertAlign = TVA_Center;
  200. mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
  201. // Tabbed title bar drag/drop button
  202. GUIElementStyle tabbedBarDropButton;
  203. tabbedBarDropButton.fixedHeight = true;
  204. tabbedBarDropButton.fixedWidth = true;
  205. tabbedBarDropButton.height = 13;
  206. tabbedBarDropButton.width = 6;
  207. mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
  208. // Window minimize button
  209. GUIElementStyle winMinButtonStyle;
  210. winMinButtonStyle.normal.texture = getTexture(WindowMinButtonNormal);
  211. winMinButtonStyle.hover.texture = getTexture(WindowMinButtonHover);
  212. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  213. winMinButtonStyle.fixedHeight = true;
  214. winMinButtonStyle.fixedWidth = true;
  215. winMinButtonStyle.height = 7;
  216. winMinButtonStyle.width = 8;
  217. mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
  218. // Window maximize button
  219. GUIElementStyle winMaxButtonStyle;
  220. winMaxButtonStyle.normal.texture = getTexture(WindowMaxButtonNormal);
  221. winMaxButtonStyle.hover.texture = getTexture(WindowMaxButtonHover);
  222. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  223. winMaxButtonStyle.fixedHeight = true;
  224. winMaxButtonStyle.fixedWidth = true;
  225. winMaxButtonStyle.height = 8;
  226. winMaxButtonStyle.width = 8;
  227. mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
  228. // Window close button
  229. GUIElementStyle winCloseButtonStyle;
  230. winCloseButtonStyle.normal.texture = getTexture(WindowCloseButtonNormal);
  231. winCloseButtonStyle.hover.texture = getTexture(WindowCloseButtonHover);
  232. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  233. winCloseButtonStyle.fixedHeight = true;
  234. winCloseButtonStyle.fixedWidth = true;
  235. winCloseButtonStyle.height = 7;
  236. winCloseButtonStyle.width = 8;
  237. mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
  238. // Input box
  239. GUIElementStyle inputBoxStyle;
  240. inputBoxStyle.normal.texture = getTexture(InputBoxNormalTex);
  241. inputBoxStyle.hover.texture = getTexture(InputBoxHoverTex);
  242. inputBoxStyle.focused.texture = getTexture(InputBoxFocusedTex);
  243. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  244. inputBoxStyle.border.left = 5;
  245. inputBoxStyle.border.right = 5;
  246. inputBoxStyle.border.top = 5;
  247. inputBoxStyle.border.bottom = 5;
  248. inputBoxStyle.margins.left = 4;
  249. inputBoxStyle.margins.right = 4;
  250. inputBoxStyle.margins.top = 4;
  251. inputBoxStyle.margins.bottom = 4;
  252. inputBoxStyle.contentOffset.left = 2;
  253. inputBoxStyle.contentOffset.right = 2;
  254. inputBoxStyle.fixedHeight = true;
  255. inputBoxStyle.height = 21;
  256. inputBoxStyle.minWidth = 10;
  257. inputBoxStyle.font = font;
  258. inputBoxStyle.fontSize = DefaultFontSize;
  259. inputBoxStyle.textHorzAlign = THA_Left;
  260. inputBoxStyle.textVertAlign = TVA_Top;
  261. mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  262. /************************************************************************/
  263. /* SCROLL BAR */
  264. /************************************************************************/
  265. // Up button
  266. GUIElementStyle scrollUpBtnStyle;
  267. scrollUpBtnStyle.normal.texture = getTexture(ScrollBarUpNormalTex);
  268. scrollUpBtnStyle.hover.texture = getTexture(ScrollBarUpHoverTex);
  269. scrollUpBtnStyle.active.texture = getTexture(ScrollBarUpActiveTex);
  270. scrollUpBtnStyle.fixedHeight = true;
  271. scrollUpBtnStyle.fixedWidth = true;
  272. scrollUpBtnStyle.height = 4;
  273. scrollUpBtnStyle.width = 8;
  274. mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
  275. // Down button
  276. GUIElementStyle scrollDownBtnStyle;
  277. scrollDownBtnStyle.normal.texture = getTexture(ScrollBarDownNormalTex);
  278. scrollDownBtnStyle.hover.texture = getTexture(ScrollBarDownHoverTex);
  279. scrollDownBtnStyle.active.texture = getTexture(ScrollBarDownActiveTex);
  280. scrollDownBtnStyle.fixedHeight = true;
  281. scrollDownBtnStyle.fixedWidth = true;
  282. scrollDownBtnStyle.height = 4;
  283. scrollDownBtnStyle.width = 8;
  284. mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
  285. // Left button
  286. GUIElementStyle scrollLeftBtnStyle;
  287. scrollLeftBtnStyle.normal.texture = getTexture(ScrollBarLeftNormalTex);
  288. scrollLeftBtnStyle.hover.texture = getTexture(ScrollBarLeftHoverTex);
  289. scrollLeftBtnStyle.active.texture = getTexture(ScrollBarLeftActiveTex);
  290. scrollLeftBtnStyle.fixedHeight = true;
  291. scrollLeftBtnStyle.fixedWidth = true;
  292. scrollLeftBtnStyle.height = 8;
  293. scrollLeftBtnStyle.width = 4;
  294. mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  295. // Right button
  296. GUIElementStyle scrollRightBtnStyle;
  297. scrollRightBtnStyle.normal.texture = getTexture(ScrollBarRightNormalTex);
  298. scrollRightBtnStyle.hover.texture = getTexture(ScrollBarRightHoverTex);
  299. scrollRightBtnStyle.active.texture = getTexture(ScrollBarRightActiveTex);
  300. scrollRightBtnStyle.fixedHeight = true;
  301. scrollRightBtnStyle.fixedWidth = true;
  302. scrollRightBtnStyle.height = 8;
  303. scrollRightBtnStyle.width = 4;
  304. mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
  305. // Horizontal handle
  306. GUIElementStyle scrollBarHorzBtnStyle;
  307. scrollBarHorzBtnStyle.normal.texture = getTexture(ScrollBarHandleHorzNormalTex);
  308. scrollBarHorzBtnStyle.hover.texture = getTexture(ScrollBarHandleHorzHoverTex);
  309. scrollBarHorzBtnStyle.active.texture = getTexture(ScrollBarHandleHorzActiveTex);
  310. scrollBarHorzBtnStyle.fixedHeight = true;
  311. scrollBarHorzBtnStyle.fixedWidth = true;
  312. scrollBarHorzBtnStyle.height = 6;
  313. scrollBarHorzBtnStyle.width = 4;
  314. mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  315. // Vertical handle
  316. GUIElementStyle scrollBarVertBtnStyle;
  317. scrollBarVertBtnStyle.normal.texture = getTexture(ScrollBarHandleVertNormalTex);
  318. scrollBarVertBtnStyle.hover.texture = getTexture(ScrollBarHandleVertHoverTex);
  319. scrollBarVertBtnStyle.active.texture = getTexture(ScrollBarHandleVertActiveTex);
  320. scrollBarVertBtnStyle.fixedHeight = true;
  321. scrollBarVertBtnStyle.fixedWidth = true;
  322. scrollBarVertBtnStyle.height = 4;
  323. scrollBarVertBtnStyle.width = 6;
  324. mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  325. HSpriteTexture scrollBarBgPtr = getTexture(ScrollBarBgTex);
  326. // Vertical scroll bar
  327. GUIElementStyle vertScrollBarStyle;
  328. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  329. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  330. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  331. vertScrollBarStyle.fixedHeight = false;
  332. vertScrollBarStyle.fixedWidth = true;
  333. vertScrollBarStyle.minHeight = 16;
  334. vertScrollBarStyle.width = 8;
  335. mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
  336. // Horizontal scroll bar
  337. GUIElementStyle horzScrollBarStyle;
  338. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  339. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  340. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  341. horzScrollBarStyle.fixedHeight = true;
  342. horzScrollBarStyle.fixedWidth = false;
  343. horzScrollBarStyle.minWidth = 16;
  344. horzScrollBarStyle.height = 8;
  345. mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
  346. /************************************************************************/
  347. /* DROP DOWN BOX */
  348. /************************************************************************/
  349. // ListBox button
  350. GUIElementStyle dropDownListStyle;
  351. dropDownListStyle.normal.texture = getTexture(DropDownBtnNormalTex);
  352. dropDownListStyle.hover.texture = getTexture(DropDownBtnHoverTex);
  353. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  354. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  355. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  356. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  357. dropDownListStyle.fixedHeight = true;
  358. dropDownListStyle.fixedWidth = false;
  359. dropDownListStyle.height = 13;
  360. dropDownListStyle.width = 30;
  361. dropDownListStyle.contentOffset.left = 3;
  362. dropDownListStyle.contentOffset.right = 11;
  363. dropDownListStyle.contentOffset.top = 1;
  364. dropDownListStyle.contentOffset.bottom = 1;
  365. dropDownListStyle.border.left = 1;
  366. dropDownListStyle.border.right = 10;
  367. dropDownListStyle.border.top = 1;
  368. dropDownListStyle.border.bottom = 1;
  369. dropDownListStyle.font = font;
  370. dropDownListStyle.fontSize = DefaultFontSize;
  371. dropDownListStyle.textHorzAlign = THA_Left;
  372. dropDownListStyle.textVertAlign = TVA_Top;
  373. mSkin.setStyle("ListBox", dropDownListStyle);
  374. // DropDown scroll up button arrow
  375. HTexture dropDownBtnScrollUpArrow = getTexture(DropDownBoxBtnUpArrowTex);
  376. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  377. dropDownScrollUpBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnUpArrowTex);
  378. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  379. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  380. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  381. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  382. dropDownScrollUpBtnArrowStyle.height = 7;
  383. dropDownScrollUpBtnArrowStyle.width = 30;
  384. dropDownScrollUpBtnArrowStyle.border.left = 1;
  385. dropDownScrollUpBtnArrowStyle.border.right = 1;
  386. dropDownScrollUpBtnArrowStyle.border.top = 1;
  387. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  388. mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  389. mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  390. mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  391. // DropDown scroll up button
  392. GUIElementStyle dropDownScrollUpBtnStyle;
  393. dropDownScrollUpBtnStyle.normal.texture = getTexture(DropDownBoxBtnUpNormalTex);
  394. dropDownScrollUpBtnStyle.hover.texture = getTexture(DropDownBoxBtnUpHoverTex);
  395. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  396. dropDownScrollUpBtnStyle.fixedHeight = true;
  397. dropDownScrollUpBtnStyle.fixedWidth = false;
  398. dropDownScrollUpBtnStyle.height = 7;
  399. dropDownScrollUpBtnStyle.width = 30;
  400. dropDownScrollUpBtnStyle.border.left = 1;
  401. dropDownScrollUpBtnStyle.border.right = 1;
  402. dropDownScrollUpBtnStyle.border.top = 1;
  403. dropDownScrollUpBtnStyle.border.bottom = 1;
  404. mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  405. mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  406. mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  407. // DropDown scroll down button arrow
  408. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  409. dropDownScrollDownBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnDownArrowTex);
  410. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  411. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  412. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  413. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  414. dropDownScrollDownBtnArrowStyle.height = 7;
  415. dropDownScrollDownBtnArrowStyle.width = 30;
  416. dropDownScrollDownBtnArrowStyle.border.left = 1;
  417. dropDownScrollDownBtnArrowStyle.border.right = 1;
  418. dropDownScrollDownBtnArrowStyle.border.top = 1;
  419. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  420. mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  421. mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  422. mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  423. // DropDown scroll down button
  424. GUIElementStyle dropDownScrollDownBtnStyle;
  425. dropDownScrollDownBtnStyle.normal.texture = getTexture(DropDownBoxBtnDownNormalTex);
  426. dropDownScrollDownBtnStyle.hover.texture = getTexture(DropDownBoxBtnDownHoverTex);
  427. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  428. dropDownScrollDownBtnStyle.fixedHeight = true;
  429. dropDownScrollDownBtnStyle.fixedWidth = false;
  430. dropDownScrollDownBtnStyle.height = 7;
  431. dropDownScrollDownBtnStyle.width = 30;
  432. dropDownScrollDownBtnStyle.border.left = 1;
  433. dropDownScrollDownBtnStyle.border.right = 1;
  434. dropDownScrollDownBtnStyle.border.top = 1;
  435. dropDownScrollDownBtnStyle.border.bottom = 1;
  436. mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  437. mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  438. mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  439. // DropDown entry button
  440. GUIElementStyle dropDownEntryBtnStyle;
  441. dropDownEntryBtnStyle.normal.texture = getTexture(DropDownBoxEntryNormalTex);
  442. dropDownEntryBtnStyle.hover.texture = getTexture(DropDownBoxEntryHoverTex);
  443. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  444. dropDownEntryBtnStyle.fixedHeight = true;
  445. dropDownEntryBtnStyle.fixedWidth = false;
  446. dropDownEntryBtnStyle.height = 14;
  447. dropDownEntryBtnStyle.width = 30;
  448. dropDownEntryBtnStyle.border.left = 1;
  449. dropDownEntryBtnStyle.border.right = 1;
  450. dropDownEntryBtnStyle.border.top = 1;
  451. dropDownEntryBtnStyle.border.bottom = 1;
  452. dropDownEntryBtnStyle.font = font;
  453. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  454. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  455. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  456. mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
  457. mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
  458. mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
  459. // DropDown entry button with expand
  460. GUIElementStyle dropDownEntryExpBtnStyle;
  461. dropDownEntryExpBtnStyle.normal.texture = getTexture(DropDownBoxEntryExpNormalTex);
  462. dropDownEntryExpBtnStyle.hover.texture = getTexture(DropDownBoxEntryExpHoverTex);
  463. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  464. dropDownEntryExpBtnStyle.fixedHeight = true;
  465. dropDownEntryExpBtnStyle.fixedWidth = false;
  466. dropDownEntryExpBtnStyle.height = 14;
  467. dropDownEntryExpBtnStyle.width = 30;
  468. dropDownEntryExpBtnStyle.border.left = 1;
  469. dropDownEntryExpBtnStyle.border.right = 6;
  470. dropDownEntryExpBtnStyle.border.top = 1;
  471. dropDownEntryExpBtnStyle.border.bottom = 1;
  472. dropDownEntryExpBtnStyle.font = font;
  473. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  474. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  475. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  476. mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
  477. mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
  478. mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
  479. // DropDown box frame
  480. GUIElementStyle dropDownBoxStyle;
  481. dropDownBoxStyle.normal.texture = getTexture(DropDownBoxBgTex);
  482. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  483. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  484. dropDownBoxStyle.fixedHeight = false;
  485. dropDownBoxStyle.fixedWidth = false;
  486. dropDownBoxStyle.border.left = 1;
  487. dropDownBoxStyle.border.right = 1;
  488. dropDownBoxStyle.border.top = 1;
  489. dropDownBoxStyle.border.bottom = 1;
  490. dropDownBoxStyle.margins.left = 1;
  491. dropDownBoxStyle.margins.right = 1;
  492. dropDownBoxStyle.margins.top = 1;
  493. dropDownBoxStyle.margins.bottom = 1;
  494. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  495. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  496. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  497. // Drop down separator
  498. GUIElementStyle dropDownSeparatorStyle;
  499. dropDownSeparatorStyle.normal.texture = getTexture(DropDownSeparatorTex);
  500. dropDownSeparatorStyle.fixedHeight = true;
  501. dropDownSeparatorStyle.fixedWidth = false;
  502. dropDownSeparatorStyle.height = 3;
  503. dropDownSeparatorStyle.width = 30;
  504. dropDownSeparatorStyle.border.left = 1;
  505. dropDownSeparatorStyle.border.right = 1;
  506. dropDownSeparatorStyle.border.top = 1;
  507. dropDownSeparatorStyle.border.bottom = 1;
  508. mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
  509. mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
  510. mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
  511. /************************************************************************/
  512. /* MENU BAR */
  513. /************************************************************************/
  514. // MenuBar background
  515. GUIElementStyle menuBarBgStyle;
  516. menuBarBgStyle.normal.texture = getTexture(MenuBarBgTex);
  517. menuBarBgStyle.fixedHeight = false;
  518. menuBarBgStyle.fixedWidth = false;
  519. menuBarBgStyle.height = 4;
  520. menuBarBgStyle.width = 4;
  521. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  522. // MenuBar Banshee logo
  523. GUIElementStyle menuBarBansheeLogoStyle;
  524. menuBarBansheeLogoStyle.normal.texture = getTexture(MenuBarBansheeLogoTex);
  525. menuBarBansheeLogoStyle.fixedHeight = true;
  526. menuBarBansheeLogoStyle.fixedWidth = true;
  527. menuBarBansheeLogoStyle.height = 7;
  528. menuBarBansheeLogoStyle.width = 51;
  529. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  530. // MenuBar button
  531. GUIElementStyle menuBarBtnStyle;
  532. menuBarBtnStyle.normal.texture = getTexture(MenuBarBtnNormalTex);
  533. menuBarBtnStyle.hover.texture = getTexture(MenuBarBtnHoverTex);
  534. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  535. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  536. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  537. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  538. menuBarBtnStyle.fixedHeight = true;
  539. menuBarBtnStyle.fixedWidth = false;
  540. menuBarBtnStyle.height = 15;
  541. menuBarBtnStyle.width = 4;
  542. menuBarBtnStyle.margins.left = 2;
  543. menuBarBtnStyle.margins.right = 2;
  544. menuBarBtnStyle.margins.top = 2;
  545. menuBarBtnStyle.margins.bottom = 2;
  546. menuBarBtnStyle.font = font;
  547. menuBarBtnStyle.fontSize = DefaultFontSize;
  548. menuBarBtnStyle.textHorzAlign = THA_Left;
  549. menuBarBtnStyle.textVertAlign = TVA_Top;
  550. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  551. /************************************************************************/
  552. /* DOCK SLIDER */
  553. /************************************************************************/
  554. GUIElementStyle dockSliderBtnStyle;
  555. dockSliderBtnStyle.normal.texture = getTexture(DockSliderNormalTex);
  556. dockSliderBtnStyle.fixedHeight = false;
  557. dockSliderBtnStyle.fixedWidth = false;
  558. dockSliderBtnStyle.height = 2;
  559. dockSliderBtnStyle.width = 2;
  560. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  561. /************************************************************************/
  562. /* TREE VIEW */
  563. /************************************************************************/
  564. // Expand button
  565. GUIElementStyle treeViewExpandButtonStyle;
  566. treeViewExpandButtonStyle.normal.texture = getTexture(TreeViewExpandButtonOffNormal);
  567. treeViewExpandButtonStyle.hover.texture = getTexture(TreeViewExpandButtonOffHover);
  568. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  569. treeViewExpandButtonStyle.normalOn.texture = getTexture(TreeViewExpandButtonOnNormal);
  570. treeViewExpandButtonStyle.hoverOn.texture = getTexture(TreeViewExpandButtonOnHover);
  571. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  572. treeViewExpandButtonStyle.margins.left = 4;
  573. treeViewExpandButtonStyle.margins.right = 4;
  574. treeViewExpandButtonStyle.margins.top = 5;
  575. treeViewExpandButtonStyle.margins.bottom = 4;
  576. treeViewExpandButtonStyle.fixedHeight = true;
  577. treeViewExpandButtonStyle.fixedWidth = true;
  578. treeViewExpandButtonStyle.height = 16;
  579. treeViewExpandButtonStyle.width = 16;
  580. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  581. // Entry
  582. GUIElementStyle treeViewEntryStyle;
  583. treeViewEntryStyle.font = font;
  584. treeViewEntryStyle.fontSize = DefaultFontSize;
  585. treeViewEntryStyle.fixedWidth = false;
  586. treeViewEntryStyle.fixedHeight = true;
  587. treeViewEntryStyle.height = 16;
  588. treeViewEntryStyle.minWidth = 10;
  589. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  590. // Selection background
  591. GUIElementStyle treeViewSelBackgroundStyle;
  592. treeViewSelBackgroundStyle.normal.texture = getTexture(TreeViewSelectionBackground);
  593. treeViewSelBackgroundStyle.fixedHeight = false;
  594. treeViewSelBackgroundStyle.fixedWidth = false;
  595. treeViewSelBackgroundStyle.height = 2;
  596. treeViewSelBackgroundStyle.width = 2;
  597. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  598. // Edit box
  599. GUIElementStyle treeViewEditBox;
  600. treeViewEditBox.normal.texture = getTexture(TreeViewEditBox);
  601. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  602. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  603. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  604. treeViewEditBox.border.left = 1;
  605. treeViewEditBox.border.right = 1;
  606. treeViewEditBox.border.top = 1;
  607. treeViewEditBox.border.bottom = 1;
  608. treeViewEditBox.margins.left = 1;
  609. treeViewEditBox.margins.right = 1;
  610. treeViewEditBox.margins.top = 1;
  611. treeViewEditBox.margins.bottom = 1;
  612. treeViewEditBox.fixedHeight = true;
  613. treeViewEditBox.height = 13;
  614. treeViewEditBox.minWidth = 10;
  615. treeViewEditBox.font = font;
  616. treeViewEditBox.fontSize = DefaultFontSize;
  617. treeViewEditBox.textHorzAlign = THA_Left;
  618. treeViewEditBox.textVertAlign = TVA_Top;
  619. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  620. // Element highlight
  621. GUIElementStyle treeViewElementHighlight;
  622. treeViewElementHighlight.normal.texture = getTexture(TreeViewElementHighlight);
  623. treeViewElementHighlight.border.left = 1;
  624. treeViewElementHighlight.border.right = 1;
  625. treeViewElementHighlight.border.top = 1;
  626. treeViewElementHighlight.border.bottom = 1;
  627. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  628. // Element separator highlight
  629. GUIElementStyle treeViewElementSepHighlight;
  630. treeViewElementSepHighlight.normal.texture = getTexture(TreeViewElementSepHighlight);
  631. treeViewElementSepHighlight.border.left = 1;
  632. treeViewElementSepHighlight.border.right = 1;
  633. treeViewElementSepHighlight.border.top = 1;
  634. treeViewElementSepHighlight.border.bottom = 1;
  635. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  636. }
  637. HSpriteTexture EditorGUI::getTexture(const CM::WString& name)
  638. {
  639. return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath() + L"\\" + DefaultFolder + name)));
  640. }
  641. }