BsEditorGUI.cpp 27 KB

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