BsEditorGUI.cpp 40 KB

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