BsEditorGUI.cpp 29 KB

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