BsEditorGUI.cpp 41 KB

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