BsEditorGUI.cpp 31 KB

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