BsEditorGUI.cpp 42 KB

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