BsEditorGUI.cpp 42 KB

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