2
0

BsEditorGUI.cpp 29 KB

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