BsEditorGUI.cpp 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. #include "BsEditorGUI.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIToggle.h"
  7. #include "BsGUIColor.h"
  8. #include "BsTextSprite.h"
  9. #include "BsSpriteTexture.h"
  10. #include "BsGUITreeViewEditBox.h"
  11. #include "BsGUIIntField.h"
  12. #include "BsGUIFloatField.h"
  13. #include "BsGUIColorField.h"
  14. #include "BsGUITextField.h"
  15. #include "BsGUIToggleField.h"
  16. #include "BsGUIVector2Field.h"
  17. #include "BsGUIVector3Field.h"
  18. #include "BsGUIVector4Field.h"
  19. #include "BsGUIComponentFoldout.h"
  20. #include "BsGUIFoldout.h"
  21. #include "BsFont.h"
  22. #include "BsFontImportOptions.h"
  23. #include "BsImporter.h"
  24. #include "BsRTTIType.h"
  25. #include "BsFileSystem.h"
  26. namespace BansheeEngine
  27. {
  28. const String EditorGUI::ObjectFieldStyleName = "GUIObjectField";
  29. const String EditorGUI::ObjectFieldLabelStyleName = "EditorFieldLabel";
  30. const String EditorGUI::ObjectFieldDropBtnStyleName = "DropButton";
  31. const String EditorGUI::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  32. const WString EditorGUI::DefaultFontPath = L"arial.ttf";
  33. const UINT32 EditorGUI::DefaultFontSize = 10;
  34. const Path EditorGUI::DefaultFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
  35. const WString EditorGUI::WindowBackgroundTexture = L"WindowBgTile.psd";
  36. const WString EditorGUI::ButtonNormalTex = L"ButtonNormal.psd";
  37. const WString EditorGUI::ButtonHoverTex = L"ButtonHover.psd";
  38. const WString EditorGUI::ButtonActiveTex = L"ButtonActive.psd";
  39. const WString EditorGUI::ToggleNormalTex = L"ToggleNormal.psd";
  40. const WString EditorGUI::ToggleHoverTex = L"ToggleHover.psd";
  41. const WString EditorGUI::ToggleActiveTex = L"ToggleActive.psd";
  42. const WString EditorGUI::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  43. const WString EditorGUI::ToggleHoverOnTex = L"ToggleOnHover.psd";
  44. const WString EditorGUI::ToggleActiveOnTex = L"ToggleOnActive.psd";
  45. const WString EditorGUI::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  46. const WString EditorGUI::ObjectDropBtnNormalOnTex = L"ObjectFieldDropNormalOn.psd";
  47. const WString EditorGUI::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  48. const WString EditorGUI::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  49. const WString EditorGUI::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  50. const WString EditorGUI::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  51. const WString EditorGUI::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  52. const WString EditorGUI::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  53. const WString EditorGUI::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  54. const WString EditorGUI::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  55. const WString EditorGUI::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  56. const WString EditorGUI::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  57. const WString EditorGUI::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  58. const WString EditorGUI::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  59. const WString EditorGUI::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  60. const WString EditorGUI::WindowFrameNormal = L"WindowFrameNormal.psd";
  61. const WString EditorGUI::WindowFrameFocused = L"WindowFrameFocused.psd";
  62. const WString EditorGUI::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  63. const WString EditorGUI::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  64. const WString EditorGUI::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  65. const WString EditorGUI::WindowMinButtonNormal = L"WindowMaxBtnNormal.psd";
  66. const WString EditorGUI::WindowMinButtonHover = L"WindowMaxBtnHover.psd";
  67. const WString EditorGUI::WindowMaxButtonNormal = L"WindowMinBtnNormal.psd";
  68. const WString EditorGUI::WindowMaxButtonHover = L"WindowMinBtnHover.psd";
  69. const WString EditorGUI::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  70. const WString EditorGUI::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  71. const WString EditorGUI::InputBoxNormalTex = L"InputBoxNormal.psd";
  72. const WString EditorGUI::InputBoxHoverTex = L"InputBoxHover.psd";
  73. const WString EditorGUI::InputBoxFocusedTex = L"InputBoxFocused.psd";
  74. const WString EditorGUI::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  75. const WString EditorGUI::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  76. const WString EditorGUI::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  77. const WString EditorGUI::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  78. const WString EditorGUI::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  79. const WString EditorGUI::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  80. const WString EditorGUI::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  81. const WString EditorGUI::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  82. const WString EditorGUI::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  83. const WString EditorGUI::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  84. const WString EditorGUI::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  85. const WString EditorGUI::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  86. const WString EditorGUI::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  87. const WString EditorGUI::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  88. const WString EditorGUI::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  89. const WString EditorGUI::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  90. const WString EditorGUI::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  91. const WString EditorGUI::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  92. const WString EditorGUI::DropDownBtnNormalTex = L"DropDownNormal.psd";
  93. const WString EditorGUI::DropDownBtnHoverTex = L"DropDownHover.psd";
  94. const WString EditorGUI::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  95. const WString EditorGUI::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  96. const WString EditorGUI::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  97. const WString EditorGUI::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  98. const WString EditorGUI::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  99. const WString EditorGUI::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  100. const WString EditorGUI::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  101. const WString EditorGUI::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  102. const WString EditorGUI::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  103. const WString EditorGUI::DropDownSeparatorTex = L"DropDownSeparator.psd";
  104. const WString EditorGUI::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  105. const WString EditorGUI::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  106. const WString EditorGUI::ScrollBarBgTex = L"ScrollBarBg.psd";
  107. const WString EditorGUI::MenuBarBgTex = L"MenuBarBg.psd";
  108. const WString EditorGUI::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  109. const WString EditorGUI::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  110. const WString EditorGUI::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  111. const WString EditorGUI::DockSliderNormalTex = L"DockSliderBtn.psd";
  112. const WString EditorGUI::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  113. const WString EditorGUI::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  114. const WString EditorGUI::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  115. const WString EditorGUI::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  116. const WString EditorGUI::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  117. const WString EditorGUI::TreeViewEditBox = L"TreeViewEditBox.psd";
  118. const WString EditorGUI::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  119. const WString EditorGUI::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  120. EditorGUI::EditorGUI()
  121. {
  122. // TODO - Normally I want to load this from some file
  123. // Label
  124. // TODO - Instead of importing font every time, try to save a resource and then just load it?
  125. HFont font;
  126. {
  127. Path fontPath = DefaultFolder;
  128. fontPath.append(DefaultFontPath);
  129. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  130. if(rtti_is_of_type<FontImportOptions>(fontImportOptions))
  131. {
  132. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  133. Vector<BansheeEngine::UINT32> fontSizes;
  134. fontSizes.push_back(DefaultFontSize);
  135. importOptions->setFontSizes(fontSizes);
  136. importOptions->setAntialiasing(false);
  137. }
  138. font = Importer::instance().import(fontPath, fontImportOptions);
  139. }
  140. GUIElementStyle labelStyle;
  141. labelStyle.font = font;
  142. labelStyle.fontSize = DefaultFontSize;
  143. labelStyle.fixedWidth = false;
  144. labelStyle.fixedHeight = true;
  145. labelStyle.height = 11;
  146. labelStyle.minWidth = 10;
  147. mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
  148. // Window frame
  149. GUIElementStyle windowFrameStyle;
  150. windowFrameStyle.normal.texture = getTexture(WindowFrameNormal);
  151. windowFrameStyle.focused.texture = getTexture(WindowFrameFocused);
  152. windowFrameStyle.border.left = 1;
  153. windowFrameStyle.border.right = 1;
  154. windowFrameStyle.border.top = 1;
  155. windowFrameStyle.border.bottom = 1;
  156. mSkin.setStyle("WindowFrame", windowFrameStyle);
  157. // Button
  158. GUIElementStyle buttonStyle;
  159. buttonStyle.normal.texture = getTexture(ButtonNormalTex);
  160. buttonStyle.hover.texture = getTexture(ButtonHoverTex);
  161. buttonStyle.active.texture = getTexture(ButtonActiveTex);
  162. buttonStyle.border.left = 6;
  163. buttonStyle.border.right = 6;
  164. buttonStyle.border.top = 6;
  165. buttonStyle.border.bottom = 6;
  166. buttonStyle.contentOffset.left = 3;
  167. buttonStyle.contentOffset.right = 3;
  168. buttonStyle.fixedHeight = true;
  169. buttonStyle.height = 15;
  170. buttonStyle.minWidth = 50;
  171. buttonStyle.font = font;
  172. buttonStyle.fontSize = DefaultFontSize;
  173. buttonStyle.textHorzAlign = THA_Center;
  174. buttonStyle.textVertAlign = TVA_Center;
  175. mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
  176. // Toggle
  177. GUIElementStyle toggleStyle;
  178. toggleStyle.normal.texture = getTexture(ToggleNormalTex);
  179. toggleStyle.hover.texture = getTexture(ToggleHoverTex);
  180. toggleStyle.active.texture = getTexture(ToggleActiveTex);
  181. toggleStyle.normalOn.texture = getTexture(ToggleNormalOnTex);
  182. toggleStyle.hoverOn.texture = getTexture(ToggleHoverOnTex);
  183. toggleStyle.activeOn.texture = getTexture(ToggleActiveOnTex);
  184. toggleStyle.fixedHeight = true;
  185. toggleStyle.fixedWidth = true;
  186. toggleStyle.height = 15;
  187. toggleStyle.width = 15;
  188. mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  189. // Color
  190. GUIElementStyle colorStyle;
  191. colorStyle.margins.left = 2;
  192. colorStyle.margins.right = 2;
  193. colorStyle.margins.top = 2;
  194. colorStyle.margins.bottom = 2;
  195. colorStyle.fixedHeight = true;
  196. colorStyle.height = 10;
  197. colorStyle.minWidth = 10;
  198. mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
  199. // Window background texture
  200. GUIElementStyle windowBgStyle;
  201. windowBgStyle.normal.texture = getTexture(WindowBackgroundTexture);
  202. mSkin.setStyle("WindowBackground", windowBgStyle);
  203. // Window title bar background
  204. GUIElementStyle titleBarBgStyle;
  205. titleBarBgStyle.normal.texture = getTexture(WindowTitleBarBg);
  206. titleBarBgStyle.fixedHeight = true;
  207. titleBarBgStyle.height = 13;
  208. mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
  209. // Tabbed title bar tab button
  210. GUIElementStyle tabbedBarButton;
  211. tabbedBarButton.normal.texture = getTexture(TabbedBarBtnNormal);
  212. tabbedBarButton.hover.texture = getTexture(TabbedBarBtnActive);
  213. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  214. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  215. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  216. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  217. tabbedBarButton.fixedHeight = true;
  218. tabbedBarButton.height = 13;
  219. tabbedBarButton.minWidth = 10;
  220. tabbedBarButton.maxWidth = 110;
  221. tabbedBarButton.font = font;
  222. tabbedBarButton.fontSize = DefaultFontSize;
  223. tabbedBarButton.textHorzAlign = THA_Center;
  224. tabbedBarButton.textVertAlign = TVA_Center;
  225. mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
  226. // Tabbed title bar drag/drop button
  227. GUIElementStyle tabbedBarDropButton;
  228. tabbedBarDropButton.fixedHeight = true;
  229. tabbedBarDropButton.fixedWidth = true;
  230. tabbedBarDropButton.height = 13;
  231. tabbedBarDropButton.width = 6;
  232. mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
  233. // Window minimize button
  234. GUIElementStyle winMinButtonStyle;
  235. winMinButtonStyle.normal.texture = getTexture(WindowMinButtonNormal);
  236. winMinButtonStyle.hover.texture = getTexture(WindowMinButtonHover);
  237. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  238. winMinButtonStyle.fixedHeight = true;
  239. winMinButtonStyle.fixedWidth = true;
  240. winMinButtonStyle.height = 7;
  241. winMinButtonStyle.width = 8;
  242. mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
  243. // Window maximize button
  244. GUIElementStyle winMaxButtonStyle;
  245. winMaxButtonStyle.normal.texture = getTexture(WindowMaxButtonNormal);
  246. winMaxButtonStyle.hover.texture = getTexture(WindowMaxButtonHover);
  247. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  248. winMaxButtonStyle.fixedHeight = true;
  249. winMaxButtonStyle.fixedWidth = true;
  250. winMaxButtonStyle.height = 8;
  251. winMaxButtonStyle.width = 8;
  252. mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
  253. // Window close button
  254. GUIElementStyle winCloseButtonStyle;
  255. winCloseButtonStyle.normal.texture = getTexture(WindowCloseButtonNormal);
  256. winCloseButtonStyle.hover.texture = getTexture(WindowCloseButtonHover);
  257. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  258. winCloseButtonStyle.fixedHeight = true;
  259. winCloseButtonStyle.fixedWidth = true;
  260. winCloseButtonStyle.height = 7;
  261. winCloseButtonStyle.width = 8;
  262. mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
  263. // Input box
  264. GUIElementStyle inputBoxStyle;
  265. inputBoxStyle.normal.texture = getTexture(InputBoxNormalTex);
  266. inputBoxStyle.hover.texture = getTexture(InputBoxHoverTex);
  267. inputBoxStyle.focused.texture = getTexture(InputBoxFocusedTex);
  268. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  269. inputBoxStyle.border.left = 1;
  270. inputBoxStyle.border.right = 1;
  271. inputBoxStyle.border.top = 1;
  272. inputBoxStyle.border.bottom = 1;
  273. inputBoxStyle.contentOffset.left = 3;
  274. inputBoxStyle.contentOffset.right = 3;
  275. inputBoxStyle.contentOffset.top = 2;
  276. inputBoxStyle.contentOffset.bottom = 2;
  277. inputBoxStyle.fixedHeight = true;
  278. inputBoxStyle.height = 15;
  279. inputBoxStyle.minWidth = 10;
  280. inputBoxStyle.font = font;
  281. inputBoxStyle.fontSize = DefaultFontSize;
  282. inputBoxStyle.textHorzAlign = THA_Left;
  283. inputBoxStyle.textVertAlign = TVA_Top;
  284. mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  285. /************************************************************************/
  286. /* SCROLL BAR */
  287. /************************************************************************/
  288. // Up button
  289. GUIElementStyle scrollUpBtnStyle;
  290. scrollUpBtnStyle.normal.texture = getTexture(ScrollBarUpNormalTex);
  291. scrollUpBtnStyle.hover.texture = getTexture(ScrollBarUpHoverTex);
  292. scrollUpBtnStyle.active.texture = getTexture(ScrollBarUpActiveTex);
  293. scrollUpBtnStyle.fixedHeight = true;
  294. scrollUpBtnStyle.fixedWidth = true;
  295. scrollUpBtnStyle.height = 4;
  296. scrollUpBtnStyle.width = 8;
  297. mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
  298. // Down button
  299. GUIElementStyle scrollDownBtnStyle;
  300. scrollDownBtnStyle.normal.texture = getTexture(ScrollBarDownNormalTex);
  301. scrollDownBtnStyle.hover.texture = getTexture(ScrollBarDownHoverTex);
  302. scrollDownBtnStyle.active.texture = getTexture(ScrollBarDownActiveTex);
  303. scrollDownBtnStyle.fixedHeight = true;
  304. scrollDownBtnStyle.fixedWidth = true;
  305. scrollDownBtnStyle.height = 4;
  306. scrollDownBtnStyle.width = 8;
  307. mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
  308. // Left button
  309. GUIElementStyle scrollLeftBtnStyle;
  310. scrollLeftBtnStyle.normal.texture = getTexture(ScrollBarLeftNormalTex);
  311. scrollLeftBtnStyle.hover.texture = getTexture(ScrollBarLeftHoverTex);
  312. scrollLeftBtnStyle.active.texture = getTexture(ScrollBarLeftActiveTex);
  313. scrollLeftBtnStyle.fixedHeight = true;
  314. scrollLeftBtnStyle.fixedWidth = true;
  315. scrollLeftBtnStyle.height = 8;
  316. scrollLeftBtnStyle.width = 4;
  317. mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  318. // Right button
  319. GUIElementStyle scrollRightBtnStyle;
  320. scrollRightBtnStyle.normal.texture = getTexture(ScrollBarRightNormalTex);
  321. scrollRightBtnStyle.hover.texture = getTexture(ScrollBarRightHoverTex);
  322. scrollRightBtnStyle.active.texture = getTexture(ScrollBarRightActiveTex);
  323. scrollRightBtnStyle.fixedHeight = true;
  324. scrollRightBtnStyle.fixedWidth = true;
  325. scrollRightBtnStyle.height = 8;
  326. scrollRightBtnStyle.width = 4;
  327. mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
  328. // Horizontal handle
  329. GUIElementStyle scrollBarHorzBtnStyle;
  330. scrollBarHorzBtnStyle.normal.texture = getTexture(ScrollBarHandleHorzNormalTex);
  331. scrollBarHorzBtnStyle.hover.texture = getTexture(ScrollBarHandleHorzHoverTex);
  332. scrollBarHorzBtnStyle.active.texture = getTexture(ScrollBarHandleHorzActiveTex);
  333. scrollBarHorzBtnStyle.fixedHeight = true;
  334. scrollBarHorzBtnStyle.fixedWidth = true;
  335. scrollBarHorzBtnStyle.height = 6;
  336. scrollBarHorzBtnStyle.width = 4;
  337. mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  338. // Vertical handle
  339. GUIElementStyle scrollBarVertBtnStyle;
  340. scrollBarVertBtnStyle.normal.texture = getTexture(ScrollBarHandleVertNormalTex);
  341. scrollBarVertBtnStyle.hover.texture = getTexture(ScrollBarHandleVertHoverTex);
  342. scrollBarVertBtnStyle.active.texture = getTexture(ScrollBarHandleVertActiveTex);
  343. scrollBarVertBtnStyle.fixedHeight = true;
  344. scrollBarVertBtnStyle.fixedWidth = true;
  345. scrollBarVertBtnStyle.height = 4;
  346. scrollBarVertBtnStyle.width = 6;
  347. mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  348. HSpriteTexture scrollBarBgPtr = getTexture(ScrollBarBgTex);
  349. // Vertical scroll bar
  350. GUIElementStyle vertScrollBarStyle;
  351. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  352. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  353. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  354. vertScrollBarStyle.fixedHeight = false;
  355. vertScrollBarStyle.fixedWidth = true;
  356. vertScrollBarStyle.minHeight = 16;
  357. vertScrollBarStyle.width = 8;
  358. mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
  359. // Horizontal scroll bar
  360. GUIElementStyle horzScrollBarStyle;
  361. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  362. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  363. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  364. horzScrollBarStyle.fixedHeight = true;
  365. horzScrollBarStyle.fixedWidth = false;
  366. horzScrollBarStyle.minWidth = 16;
  367. horzScrollBarStyle.height = 8;
  368. mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
  369. /************************************************************************/
  370. /* DROP DOWN BOX */
  371. /************************************************************************/
  372. // ListBox button
  373. GUIElementStyle dropDownListStyle;
  374. dropDownListStyle.normal.texture = getTexture(DropDownBtnNormalTex);
  375. dropDownListStyle.hover.texture = getTexture(DropDownBtnHoverTex);
  376. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  377. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  378. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  379. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  380. dropDownListStyle.fixedHeight = true;
  381. dropDownListStyle.fixedWidth = false;
  382. dropDownListStyle.height = 13;
  383. dropDownListStyle.width = 30;
  384. dropDownListStyle.contentOffset.left = 3;
  385. dropDownListStyle.contentOffset.right = 11;
  386. dropDownListStyle.contentOffset.top = 1;
  387. dropDownListStyle.contentOffset.bottom = 1;
  388. dropDownListStyle.border.left = 1;
  389. dropDownListStyle.border.right = 10;
  390. dropDownListStyle.border.top = 1;
  391. dropDownListStyle.border.bottom = 1;
  392. dropDownListStyle.font = font;
  393. dropDownListStyle.fontSize = DefaultFontSize;
  394. dropDownListStyle.textHorzAlign = THA_Left;
  395. dropDownListStyle.textVertAlign = TVA_Top;
  396. mSkin.setStyle("ListBox", dropDownListStyle);
  397. // DropDown scroll up button arrow
  398. HTexture dropDownBtnScrollUpArrow = getTexture(DropDownBoxBtnUpArrowTex);
  399. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  400. dropDownScrollUpBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnUpArrowTex);
  401. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  402. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  403. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  404. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  405. dropDownScrollUpBtnArrowStyle.height = 7;
  406. dropDownScrollUpBtnArrowStyle.width = 30;
  407. dropDownScrollUpBtnArrowStyle.border.left = 1;
  408. dropDownScrollUpBtnArrowStyle.border.right = 1;
  409. dropDownScrollUpBtnArrowStyle.border.top = 1;
  410. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  411. mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  412. mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  413. mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  414. // DropDown scroll up button
  415. GUIElementStyle dropDownScrollUpBtnStyle;
  416. dropDownScrollUpBtnStyle.normal.texture = getTexture(DropDownBoxBtnUpNormalTex);
  417. dropDownScrollUpBtnStyle.hover.texture = getTexture(DropDownBoxBtnUpHoverTex);
  418. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  419. dropDownScrollUpBtnStyle.fixedHeight = true;
  420. dropDownScrollUpBtnStyle.fixedWidth = false;
  421. dropDownScrollUpBtnStyle.height = 7;
  422. dropDownScrollUpBtnStyle.width = 30;
  423. dropDownScrollUpBtnStyle.border.left = 1;
  424. dropDownScrollUpBtnStyle.border.right = 1;
  425. dropDownScrollUpBtnStyle.border.top = 1;
  426. dropDownScrollUpBtnStyle.border.bottom = 1;
  427. mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  428. mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  429. mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  430. // DropDown scroll down button arrow
  431. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  432. dropDownScrollDownBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnDownArrowTex);
  433. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  434. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  435. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  436. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  437. dropDownScrollDownBtnArrowStyle.height = 7;
  438. dropDownScrollDownBtnArrowStyle.width = 30;
  439. dropDownScrollDownBtnArrowStyle.border.left = 1;
  440. dropDownScrollDownBtnArrowStyle.border.right = 1;
  441. dropDownScrollDownBtnArrowStyle.border.top = 1;
  442. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  443. mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  444. mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  445. mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  446. // DropDown scroll down button
  447. GUIElementStyle dropDownScrollDownBtnStyle;
  448. dropDownScrollDownBtnStyle.normal.texture = getTexture(DropDownBoxBtnDownNormalTex);
  449. dropDownScrollDownBtnStyle.hover.texture = getTexture(DropDownBoxBtnDownHoverTex);
  450. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  451. dropDownScrollDownBtnStyle.fixedHeight = true;
  452. dropDownScrollDownBtnStyle.fixedWidth = false;
  453. dropDownScrollDownBtnStyle.height = 7;
  454. dropDownScrollDownBtnStyle.width = 30;
  455. dropDownScrollDownBtnStyle.border.left = 1;
  456. dropDownScrollDownBtnStyle.border.right = 1;
  457. dropDownScrollDownBtnStyle.border.top = 1;
  458. dropDownScrollDownBtnStyle.border.bottom = 1;
  459. mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  460. mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  461. mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  462. // DropDown entry button
  463. GUIElementStyle dropDownEntryBtnStyle;
  464. dropDownEntryBtnStyle.normal.texture = getTexture(DropDownBoxEntryNormalTex);
  465. dropDownEntryBtnStyle.hover.texture = getTexture(DropDownBoxEntryHoverTex);
  466. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  467. dropDownEntryBtnStyle.fixedHeight = true;
  468. dropDownEntryBtnStyle.fixedWidth = false;
  469. dropDownEntryBtnStyle.height = 14;
  470. dropDownEntryBtnStyle.width = 30;
  471. dropDownEntryBtnStyle.border.left = 1;
  472. dropDownEntryBtnStyle.border.right = 1;
  473. dropDownEntryBtnStyle.border.top = 1;
  474. dropDownEntryBtnStyle.border.bottom = 1;
  475. dropDownEntryBtnStyle.font = font;
  476. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  477. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  478. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  479. mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
  480. mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
  481. mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
  482. // DropDown entry button with expand
  483. GUIElementStyle dropDownEntryExpBtnStyle;
  484. dropDownEntryExpBtnStyle.normal.texture = getTexture(DropDownBoxEntryExpNormalTex);
  485. dropDownEntryExpBtnStyle.hover.texture = getTexture(DropDownBoxEntryExpHoverTex);
  486. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  487. dropDownEntryExpBtnStyle.fixedHeight = true;
  488. dropDownEntryExpBtnStyle.fixedWidth = false;
  489. dropDownEntryExpBtnStyle.height = 14;
  490. dropDownEntryExpBtnStyle.width = 30;
  491. dropDownEntryExpBtnStyle.border.left = 1;
  492. dropDownEntryExpBtnStyle.border.right = 6;
  493. dropDownEntryExpBtnStyle.border.top = 1;
  494. dropDownEntryExpBtnStyle.border.bottom = 1;
  495. dropDownEntryExpBtnStyle.font = font;
  496. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  497. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  498. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  499. mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
  500. mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
  501. mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
  502. // DropDown box frame
  503. GUIElementStyle dropDownBoxStyle;
  504. dropDownBoxStyle.normal.texture = getTexture(DropDownBoxBgTex);
  505. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  506. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  507. dropDownBoxStyle.fixedHeight = false;
  508. dropDownBoxStyle.fixedWidth = false;
  509. dropDownBoxStyle.border.left = 1;
  510. dropDownBoxStyle.border.right = 1;
  511. dropDownBoxStyle.border.top = 1;
  512. dropDownBoxStyle.border.bottom = 1;
  513. dropDownBoxStyle.margins.left = 1;
  514. dropDownBoxStyle.margins.right = 1;
  515. dropDownBoxStyle.margins.top = 1;
  516. dropDownBoxStyle.margins.bottom = 1;
  517. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  518. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  519. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  520. // Drop down separator
  521. GUIElementStyle dropDownSeparatorStyle;
  522. dropDownSeparatorStyle.normal.texture = getTexture(DropDownSeparatorTex);
  523. dropDownSeparatorStyle.fixedHeight = true;
  524. dropDownSeparatorStyle.fixedWidth = false;
  525. dropDownSeparatorStyle.height = 3;
  526. dropDownSeparatorStyle.width = 30;
  527. dropDownSeparatorStyle.border.left = 1;
  528. dropDownSeparatorStyle.border.right = 1;
  529. dropDownSeparatorStyle.border.top = 1;
  530. dropDownSeparatorStyle.border.bottom = 1;
  531. mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
  532. mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
  533. mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
  534. /************************************************************************/
  535. /* MENU BAR */
  536. /************************************************************************/
  537. // MenuBar background
  538. GUIElementStyle menuBarBgStyle;
  539. menuBarBgStyle.normal.texture = getTexture(MenuBarBgTex);
  540. menuBarBgStyle.fixedHeight = false;
  541. menuBarBgStyle.fixedWidth = false;
  542. menuBarBgStyle.height = 4;
  543. menuBarBgStyle.width = 4;
  544. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  545. // MenuBar Banshee logo
  546. GUIElementStyle menuBarBansheeLogoStyle;
  547. menuBarBansheeLogoStyle.normal.texture = getTexture(MenuBarBansheeLogoTex);
  548. menuBarBansheeLogoStyle.fixedHeight = true;
  549. menuBarBansheeLogoStyle.fixedWidth = true;
  550. menuBarBansheeLogoStyle.height = 7;
  551. menuBarBansheeLogoStyle.width = 51;
  552. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  553. // MenuBar button
  554. GUIElementStyle menuBarBtnStyle;
  555. menuBarBtnStyle.normal.texture = getTexture(MenuBarBtnNormalTex);
  556. menuBarBtnStyle.hover.texture = getTexture(MenuBarBtnHoverTex);
  557. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  558. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  559. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  560. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  561. menuBarBtnStyle.fixedHeight = true;
  562. menuBarBtnStyle.fixedWidth = false;
  563. menuBarBtnStyle.height = 15;
  564. menuBarBtnStyle.width = 4;
  565. menuBarBtnStyle.margins.left = 2;
  566. menuBarBtnStyle.margins.right = 2;
  567. menuBarBtnStyle.margins.top = 2;
  568. menuBarBtnStyle.margins.bottom = 2;
  569. menuBarBtnStyle.font = font;
  570. menuBarBtnStyle.fontSize = DefaultFontSize;
  571. menuBarBtnStyle.textHorzAlign = THA_Left;
  572. menuBarBtnStyle.textVertAlign = TVA_Top;
  573. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  574. /************************************************************************/
  575. /* DOCK SLIDER */
  576. /************************************************************************/
  577. GUIElementStyle dockSliderBtnStyle;
  578. dockSliderBtnStyle.normal.texture = getTexture(DockSliderNormalTex);
  579. dockSliderBtnStyle.fixedHeight = false;
  580. dockSliderBtnStyle.fixedWidth = false;
  581. dockSliderBtnStyle.height = 2;
  582. dockSliderBtnStyle.width = 2;
  583. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  584. /************************************************************************/
  585. /* TREE VIEW */
  586. /************************************************************************/
  587. // Expand button
  588. GUIElementStyle treeViewExpandButtonStyle;
  589. treeViewExpandButtonStyle.normal.texture = getTexture(TreeViewExpandButtonOffNormal);
  590. treeViewExpandButtonStyle.hover.texture = getTexture(TreeViewExpandButtonOffHover);
  591. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  592. treeViewExpandButtonStyle.normalOn.texture = getTexture(TreeViewExpandButtonOnNormal);
  593. treeViewExpandButtonStyle.hoverOn.texture = getTexture(TreeViewExpandButtonOnHover);
  594. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  595. treeViewExpandButtonStyle.margins.left = 4;
  596. treeViewExpandButtonStyle.margins.right = 4;
  597. treeViewExpandButtonStyle.margins.top = 5;
  598. treeViewExpandButtonStyle.margins.bottom = 4;
  599. treeViewExpandButtonStyle.fixedHeight = true;
  600. treeViewExpandButtonStyle.fixedWidth = true;
  601. treeViewExpandButtonStyle.height = 16;
  602. treeViewExpandButtonStyle.width = 16;
  603. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  604. // Entry
  605. GUIElementStyle treeViewEntryStyle;
  606. treeViewEntryStyle.font = font;
  607. treeViewEntryStyle.fontSize = DefaultFontSize;
  608. treeViewEntryStyle.fixedWidth = false;
  609. treeViewEntryStyle.fixedHeight = true;
  610. treeViewEntryStyle.height = 16;
  611. treeViewEntryStyle.minWidth = 10;
  612. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  613. // Selection background
  614. GUIElementStyle treeViewSelBackgroundStyle;
  615. treeViewSelBackgroundStyle.normal.texture = getTexture(TreeViewSelectionBackground);
  616. treeViewSelBackgroundStyle.fixedHeight = false;
  617. treeViewSelBackgroundStyle.fixedWidth = false;
  618. treeViewSelBackgroundStyle.height = 2;
  619. treeViewSelBackgroundStyle.width = 2;
  620. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  621. // Edit box
  622. GUIElementStyle treeViewEditBox;
  623. treeViewEditBox.normal.texture = getTexture(TreeViewEditBox);
  624. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  625. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  626. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  627. treeViewEditBox.border.left = 1;
  628. treeViewEditBox.border.right = 1;
  629. treeViewEditBox.border.top = 1;
  630. treeViewEditBox.border.bottom = 1;
  631. treeViewEditBox.margins.left = 1;
  632. treeViewEditBox.margins.right = 1;
  633. treeViewEditBox.margins.top = 1;
  634. treeViewEditBox.margins.bottom = 1;
  635. treeViewEditBox.fixedHeight = true;
  636. treeViewEditBox.height = 13;
  637. treeViewEditBox.minWidth = 10;
  638. treeViewEditBox.font = font;
  639. treeViewEditBox.fontSize = DefaultFontSize;
  640. treeViewEditBox.textHorzAlign = THA_Left;
  641. treeViewEditBox.textVertAlign = TVA_Top;
  642. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  643. // Element highlight
  644. GUIElementStyle treeViewElementHighlight;
  645. treeViewElementHighlight.normal.texture = getTexture(TreeViewElementHighlight);
  646. treeViewElementHighlight.border.left = 1;
  647. treeViewElementHighlight.border.right = 1;
  648. treeViewElementHighlight.border.top = 1;
  649. treeViewElementHighlight.border.bottom = 1;
  650. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  651. // Element separator highlight
  652. GUIElementStyle treeViewElementSepHighlight;
  653. treeViewElementSepHighlight.normal.texture = getTexture(TreeViewElementSepHighlight);
  654. treeViewElementSepHighlight.border.left = 1;
  655. treeViewElementSepHighlight.border.right = 1;
  656. treeViewElementSepHighlight.border.top = 1;
  657. treeViewElementSepHighlight.border.bottom = 1;
  658. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  659. /************************************************************************/
  660. /* OBJECT DROP FIELD */
  661. /************************************************************************/
  662. GUIElementStyle objectDropStyle;
  663. objectDropStyle.normal.texture = getTexture(ObjectDropBtnNormalTex);
  664. objectDropStyle.normalOn.texture = getTexture(ObjectDropBtnNormalOnTex);
  665. objectDropStyle.fixedHeight = true;
  666. objectDropStyle.height = 15;
  667. objectDropStyle.minWidth = 50;
  668. objectDropStyle.font = font;
  669. objectDropStyle.fontSize = DefaultFontSize;
  670. objectDropStyle.textHorzAlign = THA_Center;
  671. objectDropStyle.textVertAlign = TVA_Center;
  672. mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  673. GUIElementStyle objectClearBtnStyle;
  674. objectClearBtnStyle.normal.texture = getTexture(ObjectClearBtnNormalTex);
  675. objectClearBtnStyle.hover.texture = getTexture(ObjectClearBtnHoverTex);
  676. objectClearBtnStyle.active.texture = getTexture(ObjectClearBtnActiveTex);
  677. objectClearBtnStyle.fixedHeight = true;
  678. objectClearBtnStyle.fixedWidth = true;
  679. objectClearBtnStyle.height = 15;
  680. objectClearBtnStyle.width = 13;
  681. mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  682. GUIElementStyle editorObjectFieldStyle;
  683. editorObjectFieldStyle.fixedHeight = true;
  684. editorObjectFieldStyle.height = 15;
  685. editorObjectFieldStyle.minWidth = 30;
  686. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  687. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  688. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  689. mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  690. /************************************************************************/
  691. /* EDITOR FIELDS */
  692. /************************************************************************/
  693. GUIElementStyle editorFieldLabelStyle;
  694. editorFieldLabelStyle.font = font;
  695. editorFieldLabelStyle.fontSize = DefaultFontSize;
  696. editorFieldLabelStyle.fixedWidth = false;
  697. editorFieldLabelStyle.fixedHeight = true;
  698. editorFieldLabelStyle.height = 11;
  699. editorFieldLabelStyle.minWidth = 10;
  700. editorFieldLabelStyle.textHorzAlign = THA_Left;
  701. mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  702. GUIElementStyle editorIntFieldStyle;
  703. editorIntFieldStyle.fixedHeight = true;
  704. editorIntFieldStyle.height = 15;
  705. editorIntFieldStyle.minWidth = 30;
  706. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  707. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  708. mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  709. GUIElementStyle editorFloatFieldStyle;
  710. editorFloatFieldStyle.fixedHeight = true;
  711. editorFloatFieldStyle.height = 15;
  712. editorFloatFieldStyle.minWidth = 30;
  713. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  714. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  715. mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  716. GUIElementStyle editorTextFieldStyle;
  717. editorTextFieldStyle.fixedHeight = true;
  718. editorTextFieldStyle.height = 15;
  719. editorTextFieldStyle.minWidth = 30;
  720. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  721. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  722. mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  723. GUIElementStyle editorColorFieldStyle;
  724. editorColorFieldStyle.fixedHeight = true;
  725. editorColorFieldStyle.height = 15;
  726. editorColorFieldStyle.minWidth = 30;
  727. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  728. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  729. mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  730. GUIElementStyle editorToggleFieldStyle;
  731. editorToggleFieldStyle.fixedHeight = true;
  732. editorToggleFieldStyle.height = 15;
  733. editorToggleFieldStyle.minWidth = 30;
  734. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  735. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  736. mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  737. GUIElementStyle editorVector2FieldStyle;
  738. editorVector2FieldStyle.fixedHeight = true;
  739. editorVector2FieldStyle.height = 30;
  740. editorVector2FieldStyle.minWidth = 30;
  741. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  742. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  743. mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  744. GUIElementStyle editorVector3FieldStyle;
  745. editorVector3FieldStyle.fixedHeight = true;
  746. editorVector3FieldStyle.height = 30;
  747. editorVector3FieldStyle.minWidth = 30;
  748. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  749. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  750. mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  751. GUIElementStyle editorVector4FieldStyle;
  752. editorVector4FieldStyle.fixedHeight = true;
  753. editorVector4FieldStyle.height = 30;
  754. editorVector4FieldStyle.minWidth = 30;
  755. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  756. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  757. mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  758. /************************************************************************/
  759. /* COMPONENT FOLDOUT */
  760. /************************************************************************/
  761. GUIElementStyle cmpFoldoutBtnStyle;
  762. cmpFoldoutBtnStyle.normal.texture = getTexture(CmpFoldoutClosedNormalTex);
  763. cmpFoldoutBtnStyle.hover.texture = getTexture(CmpFoldoutClosedHoverTex);
  764. cmpFoldoutBtnStyle.active.texture = getTexture(CmpFoldoutOpenActiveTex);
  765. cmpFoldoutBtnStyle.normalOn.texture = getTexture(CmpFoldoutOpenNormalTex);
  766. cmpFoldoutBtnStyle.hoverOn.texture = getTexture(CmpFoldoutOpenHoverTex);
  767. cmpFoldoutBtnStyle.activeOn.texture = getTexture(CmpFoldoutOpenActiveTex);
  768. cmpFoldoutBtnStyle.fixedHeight = true;
  769. cmpFoldoutBtnStyle.fixedWidth = false;
  770. cmpFoldoutBtnStyle.height = 10;
  771. cmpFoldoutBtnStyle.minWidth = 10;
  772. cmpFoldoutBtnStyle.font = font;
  773. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  774. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  775. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  776. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  777. cmpFoldoutBtnStyle.border.left = 8;
  778. mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  779. GUIElementStyle cmpFoldoutStyle;
  780. cmpFoldoutStyle.fixedHeight = true;
  781. cmpFoldoutStyle.height = 12;
  782. cmpFoldoutStyle.minWidth = 30;
  783. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  784. mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  785. /************************************************************************/
  786. /* FOLDOUT */
  787. /************************************************************************/
  788. GUIElementStyle foldoutBtnStyle;
  789. foldoutBtnStyle.normal.texture = getTexture(FoldoutClosedNormalTex);
  790. foldoutBtnStyle.hover.texture = getTexture(FoldoutClosedHoverTex);
  791. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  792. foldoutBtnStyle.normalOn.texture = getTexture(FoldoutOpenNormalTex);
  793. foldoutBtnStyle.hoverOn.texture = getTexture(FoldoutOpenHoverTex);
  794. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  795. foldoutBtnStyle.fixedHeight = true;
  796. foldoutBtnStyle.fixedWidth = true;
  797. foldoutBtnStyle.height = 10;
  798. foldoutBtnStyle.width = 8;
  799. mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  800. GUIElementStyle foldoutStyle;
  801. foldoutStyle.fixedHeight = true;
  802. foldoutStyle.height = 12;
  803. foldoutStyle.minWidth = 30;
  804. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  805. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  806. mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  807. }
  808. HSpriteTexture EditorGUI::getTexture(const WString& name)
  809. {
  810. return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath().append(DefaultFolder).append(name))));
  811. }
  812. }