BsEditorGUI.cpp 30 KB

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