BsBuiltinEditorResources.cpp 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341
  1. #include "BsBuiltinEditorResources.h"
  2. #include "BsBuiltinResources.h"
  3. #include "BsGUIElementStyle.h"
  4. #include "BsGUILabel.h"
  5. #include "BsGUITexture.h"
  6. #include "BsGUIButton.h"
  7. #include "BsGUIInputBox.h"
  8. #include "BsGUIToggle.h"
  9. #include "BsGUIColor.h"
  10. #include "BsTextSprite.h"
  11. #include "BsSpriteTexture.h"
  12. #include "BsGUITreeViewEditBox.h"
  13. #include "BsGUIIntField.h"
  14. #include "BsGUIFloatField.h"
  15. #include "BsGUIColorField.h"
  16. #include "BsGUITextField.h"
  17. #include "BsGUIToggleField.h"
  18. #include "BsGUIVector2Field.h"
  19. #include "BsGUIVector3Field.h"
  20. #include "BsGUIVector4Field.h"
  21. #include "BsGUIComponentFoldout.h"
  22. #include "BsGUIFoldout.h"
  23. #include "BsGUIProgressBar.h"
  24. #include "BsGUISlider.h"
  25. #include "BsGUIDropDownContent.h"
  26. #include "BsFont.h"
  27. #include "BsFontImportOptions.h"
  28. #include "BsImporter.h"
  29. #include "BsGpuProgram.h"
  30. #include "BsShader.h"
  31. #include "BsShaderInclude.h"
  32. #include "BsTechnique.h"
  33. #include "BsPass.h"
  34. #include "BsMaterial.h"
  35. #include "BsBlendState.h"
  36. #include "BsDepthStencilState.h"
  37. #include "BsRasterizerState.h"
  38. #include "BsResources.h"
  39. #include "BsRTTIType.h"
  40. #include "BsFileSystem.h"
  41. #include "BsResourceManifest.h"
  42. namespace BansheeEngine
  43. {
  44. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  45. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  46. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  47. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  48. const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
  49. const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
  50. const WString BuiltinEditorResources::GUISkinFile = L"GUISkin";
  51. const Path BuiltinEditorResources::ShaderFolder = L"Shaders\\";
  52. const Path BuiltinEditorResources::SkinFolder = L"Skin\\";
  53. const Path BuiltinEditorResources::IconFolder = L"Skin\\Icons";
  54. const Path BuiltinEditorResources::ShaderIncludeFolder = L"Includes\\";
  55. const Path BuiltinEditorResources::BuiltinRawDataFolder = L"..\\..\\..\\..\\Data\\Raw\\Editor\\";
  56. const Path BuiltinEditorResources::EditorRawSkinFolder = BuiltinRawDataFolder + SkinFolder;
  57. const Path BuiltinEditorResources::EditorRawShaderFolder = BuiltinRawDataFolder + ShaderFolder;
  58. const Path BuiltinEditorResources::EditorRawShaderIncludeFolder = BuiltinRawDataFolder + ShaderIncludeFolder;
  59. const Path BuiltinEditorResources::BuiltinDataFolder = L"..\\..\\..\\..\\Data\\Editor\\";
  60. const Path BuiltinEditorResources::EditorSkinFolder = BuiltinDataFolder + SkinFolder;
  61. const Path BuiltinEditorResources::EditorIconFolder = BuiltinDataFolder + IconFolder;
  62. const Path BuiltinEditorResources::EditorShaderFolder = BuiltinDataFolder + ShaderFolder;
  63. const Path BuiltinEditorResources::EditorShaderIncludeFolder = BuiltinDataFolder + ShaderIncludeFolder;
  64. const Path BuiltinEditorResources::ResourceManifestPath = BuiltinDataFolder + "ResourceManifest.asset";
  65. const WString BuiltinEditorResources::FolderIconTex = L"FolderIcon.psd";
  66. const WString BuiltinEditorResources::MeshIconTex = L"MeshIcon.psd";
  67. const WString BuiltinEditorResources::TextureIconTex = L"TextureIcon.psd";
  68. const WString BuiltinEditorResources::FontIconTex = L"FontIcon.psd";
  69. const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
  70. const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
  71. const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
  72. const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
  73. const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
  74. const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
  75. const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
  76. const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  77. const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
  78. const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
  79. const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  80. const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
  81. const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  82. const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  83. const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  84. const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  85. const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  86. const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  87. const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  88. const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  89. const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  90. const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  91. const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  92. const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  93. const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  94. const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
  95. const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
  96. const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  97. const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  98. const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  99. const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMinBtnNormal.psd";
  100. const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMinBtnHover.psd";
  101. const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMaxBtnNormal.psd";
  102. const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMaxBtnHover.psd";
  103. const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  104. const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  105. const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
  106. const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
  107. const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
  108. const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  109. const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  110. const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  111. const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  112. const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  113. const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  114. const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  115. const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  116. const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  117. const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  118. const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  119. const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  120. const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  121. const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  122. const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  123. const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  124. const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  125. const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  126. const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
  127. const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
  128. const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  129. const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  130. const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  131. const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  132. const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  133. const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  134. const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  135. const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  136. const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  137. const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
  138. const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  139. const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  140. const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
  141. const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
  142. const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  143. const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  144. const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  145. const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
  146. const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  147. const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  148. const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  149. const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  150. const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  151. const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
  152. const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  153. const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  154. const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
  155. const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
  156. const WString BuiltinEditorResources::ColorPickerSlider2DHandleTex = L"ColorPicker2DHandle.psd";
  157. const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.psd";
  158. const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.psd";
  159. /************************************************************************/
  160. /* SHADERS */
  161. /************************************************************************/
  162. const WString BuiltinEditorResources::ShaderDockOverlayFile = L"DockDropOverlay.bsl";
  163. const WString BuiltinEditorResources::ShaderSceneGridFile = L"SceneGrid.bsl";
  164. const WString BuiltinEditorResources::ShaderPickingCullNoneFile = L"PickingCullNone.bsl";
  165. const WString BuiltinEditorResources::ShaderPickingCullCWFile = L"PickingCullCW.bsl";
  166. const WString BuiltinEditorResources::ShaderPickingCullCCWFile = L"PickingCullCCW.bsl";
  167. const WString BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = L"PickingAlphaCullNone.bsl";
  168. const WString BuiltinEditorResources::ShaderPickingAlphaCullCWFile = L"PickingAlphaCullCW.bsl";
  169. const WString BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = L"PickingAlphaCullCCW.bsl";
  170. const WString BuiltinEditorResources::ShaderWireGizmoFile = L"WireGizmo.bsl";
  171. const WString BuiltinEditorResources::ShaderSolidGizmoFile = L"SolidGizmo.bsl";
  172. const WString BuiltinEditorResources::ShaderWireHandleFile = L"WireHandle.bsl";
  173. const WString BuiltinEditorResources::ShaderSolidHandleFile = L"SolidHandle.bsl";
  174. const WString BuiltinEditorResources::ShaderIconGizmoFile = L"IconGizmo.bsl";
  175. const WString BuiltinEditorResources::ShaderGizmoPickingFile = L"GizmoPicking.bsl";
  176. const WString BuiltinEditorResources::ShaderGizmoPickingAlphaFile = L"GizmoPickingAlpha.bsl";
  177. const WString BuiltinEditorResources::ShaderSelectionFile = L"Selection.bsl";
  178. BuiltinEditorResources::BuiltinEditorResources()
  179. {
  180. Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
  181. absoluteDataPath.append(BuiltinDataFolder);
  182. if (FileSystem::exists(ResourceManifestPath))
  183. mResourceManifest = ResourceManifest::load(ResourceManifestPath, absoluteDataPath);
  184. if (mResourceManifest == nullptr)
  185. mResourceManifest = ResourceManifest::create("BuiltinResources");
  186. gResources().registerResourceManifest(mResourceManifest);
  187. #if BS_DEBUG_MODE
  188. if (BuiltinResourcesHelper::checkForModifications(BuiltinRawDataFolder, BuiltinDataFolder + L"Timestamp.asset"))
  189. {
  190. preprocess();
  191. BuiltinResourcesHelper::writeTimestamp(BuiltinDataFolder + L"Timestamp.asset");
  192. Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
  193. absoluteDataPath.append(BuiltinDataFolder);
  194. ResourceManifest::save(mResourceManifest, ResourceManifestPath, absoluteDataPath);
  195. }
  196. #endif
  197. mShaderDockOverlay = getShader(ShaderDockOverlayFile);
  198. mShaderSceneGrid = getShader(ShaderSceneGridFile);
  199. mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
  200. mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
  201. mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
  202. mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
  203. mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
  204. mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
  205. mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
  206. mShaderGizmoWire = getShader(ShaderWireGizmoFile);
  207. mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
  208. mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
  209. mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
  210. mShaderHandleSolid = getShader(ShaderSolidHandleFile);
  211. mShaderHandleWire = getShader(ShaderWireHandleFile);
  212. mShaderSelection = getShader(ShaderSelectionFile);
  213. mSkin = gResources().load<GUISkin>(BuiltinDataFolder + (GUISkinFile + L".asset"));
  214. }
  215. BuiltinEditorResources::~BuiltinEditorResources()
  216. { }
  217. void BuiltinEditorResources::preprocess()
  218. {
  219. FileSystem::remove(EditorShaderIncludeFolder);
  220. FileSystem::remove(EditorShaderFolder);
  221. FileSystem::remove(EditorSkinFolder);
  222. BuiltinResourcesHelper::importAssets(EditorRawShaderIncludeFolder, EditorShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
  223. BuiltinResourcesHelper::importAssets(EditorRawShaderFolder, EditorShaderFolder, mResourceManifest);
  224. BuiltinResourcesHelper::importAssets(EditorRawSkinFolder, EditorSkinFolder, mResourceManifest);
  225. // Import font
  226. BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, BuiltinDataFolder, DefaultFontSize, false, mResourceManifest);
  227. // Generate & save GUI sprite textures
  228. BuiltinResourcesHelper::generateSpriteTextures(EditorSkinFolder, mResourceManifest);
  229. // Generate & save GUI skin
  230. {
  231. HGUISkin skin = generateGUISkin();
  232. Path outputPath = FileSystem::getWorkingDirectoryPath() + BuiltinDataFolder + (GUISkinFile + L".asset");
  233. Resources::instance().save(skin, outputPath, true);
  234. mResourceManifest->registerResource(skin.getUUID(), outputPath);
  235. }
  236. Resources::instance().unloadAllUnused();
  237. }
  238. HGUISkin BuiltinEditorResources::generateGUISkin()
  239. {
  240. HGUISkin skin = GUISkin::create();
  241. Path fontPath = FileSystem::getWorkingDirectoryPath();
  242. fontPath.append(BuiltinDataFolder);
  243. fontPath.append(DefaultFontFilename + L".asset");
  244. HFont font = Resources::instance().load<Font>(fontPath);
  245. // Blank entry
  246. GUIElementStyle blankStyle;
  247. skin->setStyle("Blank", blankStyle);
  248. skin->setStyle(GUITexture::getGUITypeName(), blankStyle);
  249. // Label
  250. GUIElementStyle labelStyle;
  251. labelStyle.font = font;
  252. labelStyle.fontSize = DefaultFontSize;
  253. labelStyle.fixedWidth = false;
  254. labelStyle.fixedHeight = true;
  255. labelStyle.height = 11;
  256. labelStyle.minWidth = 10;
  257. skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
  258. // Multi-line label
  259. GUIElementStyle multiLinelabelStyle;
  260. multiLinelabelStyle.font = font;
  261. multiLinelabelStyle.fontSize = DefaultFontSize;
  262. multiLinelabelStyle.fixedWidth = false;
  263. multiLinelabelStyle.fixedHeight = true;
  264. multiLinelabelStyle.height = 11;
  265. multiLinelabelStyle.minWidth = 10;
  266. multiLinelabelStyle.wordWrap = true;
  267. skin->setStyle("MultiLineLabel", multiLinelabelStyle);
  268. // Window frame
  269. GUIElementStyle windowFrameStyle;
  270. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  271. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  272. windowFrameStyle.border.left = 1;
  273. windowFrameStyle.border.right = 1;
  274. windowFrameStyle.border.top = 1;
  275. windowFrameStyle.border.bottom = 1;
  276. skin->setStyle("WindowFrame", windowFrameStyle);
  277. // Button
  278. GUIElementStyle buttonStyle;
  279. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  280. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  281. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  282. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  283. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  284. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  285. buttonStyle.border.left = 6;
  286. buttonStyle.border.right = 6;
  287. buttonStyle.border.top = 6;
  288. buttonStyle.border.bottom = 6;
  289. buttonStyle.contentOffset.left = 3;
  290. buttonStyle.contentOffset.right = 3;
  291. buttonStyle.fixedHeight = true;
  292. buttonStyle.height = 15;
  293. buttonStyle.minWidth = 50;
  294. buttonStyle.font = font;
  295. buttonStyle.fontSize = DefaultFontSize;
  296. buttonStyle.textHorzAlign = THA_Center;
  297. buttonStyle.textVertAlign = TVA_Center;
  298. skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
  299. // Toggle
  300. GUIElementStyle toggleStyle;
  301. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  302. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  303. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  304. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  305. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  306. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  307. toggleStyle.fixedHeight = true;
  308. toggleStyle.fixedWidth = true;
  309. toggleStyle.height = 15;
  310. toggleStyle.width = 15;
  311. skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  312. // Color
  313. GUIElementStyle colorStyle;
  314. colorStyle.margins.left = 2;
  315. colorStyle.margins.right = 2;
  316. colorStyle.margins.top = 2;
  317. colorStyle.margins.bottom = 2;
  318. colorStyle.fixedHeight = true;
  319. colorStyle.height = 10;
  320. colorStyle.minWidth = 10;
  321. skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
  322. // Window background texture
  323. GUIElementStyle windowBgStyle;
  324. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  325. skin->setStyle("WindowBackground", windowBgStyle);
  326. // Window title bar background
  327. GUIElementStyle titleBarBgStyle;
  328. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  329. titleBarBgStyle.fixedHeight = true;
  330. titleBarBgStyle.height = 13;
  331. skin->setStyle("TitleBarBackground", titleBarBgStyle);
  332. // Tabbed title bar tab button
  333. GUIElementStyle tabbedBarButton;
  334. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  335. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  336. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  337. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  338. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  339. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  340. tabbedBarButton.fixedHeight = true;
  341. tabbedBarButton.height = 13;
  342. tabbedBarButton.minWidth = 10;
  343. tabbedBarButton.maxWidth = 110;
  344. tabbedBarButton.font = font;
  345. tabbedBarButton.fontSize = DefaultFontSize;
  346. tabbedBarButton.textHorzAlign = THA_Center;
  347. tabbedBarButton.textVertAlign = TVA_Center;
  348. skin->setStyle("TabbedBarBtn", tabbedBarButton);
  349. // Tabbed title bar drag/drop button
  350. GUIElementStyle tabbedBarDropButton;
  351. tabbedBarDropButton.fixedHeight = true;
  352. tabbedBarDropButton.fixedWidth = true;
  353. tabbedBarDropButton.height = 13;
  354. tabbedBarDropButton.width = 6;
  355. skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
  356. // Window minimize button
  357. GUIElementStyle winMinButtonStyle;
  358. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  359. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  360. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  361. winMinButtonStyle.fixedHeight = true;
  362. winMinButtonStyle.fixedWidth = true;
  363. winMinButtonStyle.height = 7;
  364. winMinButtonStyle.width = 8;
  365. skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
  366. // Window maximize button
  367. GUIElementStyle winMaxButtonStyle;
  368. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  369. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  370. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  371. winMaxButtonStyle.fixedHeight = true;
  372. winMaxButtonStyle.fixedWidth = true;
  373. winMaxButtonStyle.height = 8;
  374. winMaxButtonStyle.width = 8;
  375. skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
  376. // Window close button
  377. GUIElementStyle winCloseButtonStyle;
  378. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  379. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  380. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  381. winCloseButtonStyle.fixedHeight = true;
  382. winCloseButtonStyle.fixedWidth = true;
  383. winCloseButtonStyle.height = 7;
  384. winCloseButtonStyle.width = 8;
  385. skin->setStyle("WinCloseBtn", winCloseButtonStyle);
  386. // Input box
  387. GUIElementStyle inputBoxStyle;
  388. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  389. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  390. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  391. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  392. inputBoxStyle.border.left = 1;
  393. inputBoxStyle.border.right = 1;
  394. inputBoxStyle.border.top = 1;
  395. inputBoxStyle.border.bottom = 1;
  396. inputBoxStyle.contentOffset.left = 3;
  397. inputBoxStyle.contentOffset.right = 3;
  398. inputBoxStyle.contentOffset.top = 2;
  399. inputBoxStyle.contentOffset.bottom = 2;
  400. inputBoxStyle.fixedHeight = true;
  401. inputBoxStyle.height = 15;
  402. inputBoxStyle.minWidth = 10;
  403. inputBoxStyle.font = font;
  404. inputBoxStyle.fontSize = DefaultFontSize;
  405. inputBoxStyle.textHorzAlign = THA_Left;
  406. inputBoxStyle.textVertAlign = TVA_Top;
  407. skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  408. /************************************************************************/
  409. /* SCROLL BAR */
  410. /************************************************************************/
  411. // Up button
  412. GUIElementStyle scrollUpBtnStyle;
  413. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  414. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  415. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  416. scrollUpBtnStyle.fixedHeight = true;
  417. scrollUpBtnStyle.fixedWidth = true;
  418. scrollUpBtnStyle.height = 4;
  419. scrollUpBtnStyle.width = 8;
  420. skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
  421. // Down button
  422. GUIElementStyle scrollDownBtnStyle;
  423. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  424. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  425. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  426. scrollDownBtnStyle.fixedHeight = true;
  427. scrollDownBtnStyle.fixedWidth = true;
  428. scrollDownBtnStyle.height = 4;
  429. scrollDownBtnStyle.width = 8;
  430. skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
  431. // Left button
  432. GUIElementStyle scrollLeftBtnStyle;
  433. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  434. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  435. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  436. scrollLeftBtnStyle.fixedHeight = true;
  437. scrollLeftBtnStyle.fixedWidth = true;
  438. scrollLeftBtnStyle.height = 8;
  439. scrollLeftBtnStyle.width = 4;
  440. skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  441. // Right button
  442. GUIElementStyle scrollRightBtnStyle;
  443. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  444. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  445. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  446. scrollRightBtnStyle.fixedHeight = true;
  447. scrollRightBtnStyle.fixedWidth = true;
  448. scrollRightBtnStyle.height = 8;
  449. scrollRightBtnStyle.width = 4;
  450. skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
  451. // Horizontal handle
  452. GUIElementStyle scrollBarHorzBtnStyle;
  453. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  454. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  455. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  456. scrollBarHorzBtnStyle.fixedHeight = true;
  457. scrollBarHorzBtnStyle.fixedWidth = true;
  458. scrollBarHorzBtnStyle.height = 6;
  459. scrollBarHorzBtnStyle.width = 4;
  460. skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  461. // Vertical handle
  462. GUIElementStyle scrollBarVertBtnStyle;
  463. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  464. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  465. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  466. scrollBarVertBtnStyle.fixedHeight = true;
  467. scrollBarVertBtnStyle.fixedWidth = true;
  468. scrollBarVertBtnStyle.height = 4;
  469. scrollBarVertBtnStyle.width = 6;
  470. skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  471. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  472. // Vertical scroll bar
  473. GUIElementStyle vertScrollBarStyle;
  474. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  475. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  476. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  477. vertScrollBarStyle.fixedHeight = false;
  478. vertScrollBarStyle.fixedWidth = true;
  479. vertScrollBarStyle.minHeight = 16;
  480. vertScrollBarStyle.width = 8;
  481. skin->setStyle("ScrollBarVert", vertScrollBarStyle);
  482. // Horizontal scroll bar
  483. GUIElementStyle horzScrollBarStyle;
  484. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  485. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  486. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  487. horzScrollBarStyle.fixedHeight = true;
  488. horzScrollBarStyle.fixedWidth = false;
  489. horzScrollBarStyle.minWidth = 16;
  490. horzScrollBarStyle.height = 8;
  491. skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
  492. /************************************************************************/
  493. /* DROP DOWN BOX */
  494. /************************************************************************/
  495. // ListBox button
  496. GUIElementStyle dropDownListStyle;
  497. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  498. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  499. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  500. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  501. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  502. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  503. dropDownListStyle.fixedHeight = true;
  504. dropDownListStyle.fixedWidth = false;
  505. dropDownListStyle.height = 13;
  506. dropDownListStyle.width = 30;
  507. dropDownListStyle.contentOffset.left = 3;
  508. dropDownListStyle.contentOffset.right = 11;
  509. dropDownListStyle.contentOffset.top = 1;
  510. dropDownListStyle.contentOffset.bottom = 1;
  511. dropDownListStyle.border.left = 1;
  512. dropDownListStyle.border.right = 10;
  513. dropDownListStyle.border.top = 1;
  514. dropDownListStyle.border.bottom = 1;
  515. dropDownListStyle.font = font;
  516. dropDownListStyle.fontSize = DefaultFontSize;
  517. dropDownListStyle.textHorzAlign = THA_Left;
  518. dropDownListStyle.textVertAlign = TVA_Top;
  519. skin->setStyle("ListBox", dropDownListStyle);
  520. // DropDown scroll up button arrow
  521. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  522. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  523. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  524. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  525. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  526. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  527. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  528. dropDownScrollUpBtnArrowStyle.height = 7;
  529. dropDownScrollUpBtnArrowStyle.width = 30;
  530. dropDownScrollUpBtnArrowStyle.border.left = 1;
  531. dropDownScrollUpBtnArrowStyle.border.right = 1;
  532. dropDownScrollUpBtnArrowStyle.border.top = 1;
  533. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  534. skin->setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  535. skin->setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  536. skin->setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  537. // DropDown scroll up button
  538. GUIElementStyle dropDownScrollUpBtnStyle;
  539. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  540. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  541. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  542. dropDownScrollUpBtnStyle.fixedHeight = true;
  543. dropDownScrollUpBtnStyle.fixedWidth = false;
  544. dropDownScrollUpBtnStyle.height = 7;
  545. dropDownScrollUpBtnStyle.width = 30;
  546. dropDownScrollUpBtnStyle.border.left = 1;
  547. dropDownScrollUpBtnStyle.border.right = 1;
  548. dropDownScrollUpBtnStyle.border.top = 1;
  549. dropDownScrollUpBtnStyle.border.bottom = 1;
  550. skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  551. skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  552. skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  553. // DropDown scroll down button arrow
  554. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  555. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  556. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  557. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  558. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  559. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  560. dropDownScrollDownBtnArrowStyle.height = 7;
  561. dropDownScrollDownBtnArrowStyle.width = 30;
  562. dropDownScrollDownBtnArrowStyle.border.left = 1;
  563. dropDownScrollDownBtnArrowStyle.border.right = 1;
  564. dropDownScrollDownBtnArrowStyle.border.top = 1;
  565. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  566. skin->setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  567. skin->setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  568. skin->setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  569. // DropDown scroll down button
  570. GUIElementStyle dropDownScrollDownBtnStyle;
  571. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  572. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  573. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  574. dropDownScrollDownBtnStyle.fixedHeight = true;
  575. dropDownScrollDownBtnStyle.fixedWidth = false;
  576. dropDownScrollDownBtnStyle.height = 7;
  577. dropDownScrollDownBtnStyle.width = 30;
  578. dropDownScrollDownBtnStyle.border.left = 1;
  579. dropDownScrollDownBtnStyle.border.right = 1;
  580. dropDownScrollDownBtnStyle.border.top = 1;
  581. dropDownScrollDownBtnStyle.border.bottom = 1;
  582. skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  583. skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  584. skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  585. // DropDown entry button
  586. GUIElementStyle dropDownEntryBtnStyle;
  587. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  588. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  589. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  590. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  591. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  592. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  593. dropDownEntryBtnStyle.fixedHeight = true;
  594. dropDownEntryBtnStyle.fixedWidth = false;
  595. dropDownEntryBtnStyle.height = 14;
  596. dropDownEntryBtnStyle.width = 30;
  597. dropDownEntryBtnStyle.border.left = 1;
  598. dropDownEntryBtnStyle.border.right = 1;
  599. dropDownEntryBtnStyle.border.top = 1;
  600. dropDownEntryBtnStyle.border.bottom = 1;
  601. dropDownEntryBtnStyle.font = font;
  602. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  603. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  604. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  605. skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  606. // DropDown entry button with expand
  607. GUIElementStyle dropDownEntryExpBtnStyle;
  608. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  609. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  610. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  611. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  612. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  613. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  614. dropDownEntryExpBtnStyle.fixedHeight = true;
  615. dropDownEntryExpBtnStyle.fixedWidth = false;
  616. dropDownEntryExpBtnStyle.height = 14;
  617. dropDownEntryExpBtnStyle.width = 30;
  618. dropDownEntryExpBtnStyle.border.left = 1;
  619. dropDownEntryExpBtnStyle.border.right = 6;
  620. dropDownEntryExpBtnStyle.border.top = 1;
  621. dropDownEntryExpBtnStyle.border.bottom = 1;
  622. dropDownEntryExpBtnStyle.font = font;
  623. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  624. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  625. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  626. skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  627. // Drop down separator
  628. GUIElementStyle dropDownSeparatorStyle;
  629. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  630. dropDownSeparatorStyle.fixedHeight = true;
  631. dropDownSeparatorStyle.fixedWidth = false;
  632. dropDownSeparatorStyle.height = 3;
  633. dropDownSeparatorStyle.width = 30;
  634. dropDownSeparatorStyle.border.left = 1;
  635. dropDownSeparatorStyle.border.right = 1;
  636. dropDownSeparatorStyle.border.top = 1;
  637. dropDownSeparatorStyle.border.bottom = 1;
  638. skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  639. // Drop down content
  640. GUIElementStyle dropDownContentStyle;
  641. dropDownContentStyle.minWidth = 50;
  642. dropDownContentStyle.minHeight = 20;
  643. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  644. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  645. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  646. skin->setStyle("ListBoxContent", dropDownContentStyle);
  647. skin->setStyle("MenuBarContent", dropDownContentStyle);
  648. skin->setStyle("ContextMenuContent", dropDownContentStyle);
  649. // DropDown box frame
  650. GUIElementStyle dropDownBoxStyle;
  651. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  652. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  653. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  654. dropDownBoxStyle.fixedHeight = false;
  655. dropDownBoxStyle.fixedWidth = false;
  656. dropDownBoxStyle.border.left = 1;
  657. dropDownBoxStyle.border.right = 1;
  658. dropDownBoxStyle.border.top = 1;
  659. dropDownBoxStyle.border.bottom = 1;
  660. dropDownBoxStyle.margins.left = 1;
  661. dropDownBoxStyle.margins.right = 1;
  662. dropDownBoxStyle.margins.top = 1;
  663. dropDownBoxStyle.margins.bottom = 1;
  664. skin->setStyle("ListBoxFrame", dropDownBoxStyle);
  665. skin->setStyle("MenuBarFrame", dropDownBoxStyle);
  666. skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
  667. /************************************************************************/
  668. /* MENU BAR */
  669. /************************************************************************/
  670. // MenuBar background
  671. GUIElementStyle menuBarBgStyle;
  672. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  673. menuBarBgStyle.fixedHeight = false;
  674. menuBarBgStyle.fixedWidth = false;
  675. menuBarBgStyle.height = 4;
  676. menuBarBgStyle.width = 4;
  677. skin->setStyle("MenuBarBg", menuBarBgStyle);
  678. // MenuBar Banshee logo
  679. GUIElementStyle menuBarBansheeLogoStyle;
  680. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  681. menuBarBansheeLogoStyle.fixedHeight = true;
  682. menuBarBansheeLogoStyle.fixedWidth = true;
  683. menuBarBansheeLogoStyle.height = 7;
  684. menuBarBansheeLogoStyle.width = 51;
  685. skin->setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  686. // MenuBar button
  687. GUIElementStyle menuBarBtnStyle;
  688. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  689. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  690. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  691. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  692. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  693. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  694. menuBarBtnStyle.fixedHeight = true;
  695. menuBarBtnStyle.fixedWidth = false;
  696. menuBarBtnStyle.height = 15;
  697. menuBarBtnStyle.width = 4;
  698. menuBarBtnStyle.margins.left = 2;
  699. menuBarBtnStyle.margins.right = 2;
  700. menuBarBtnStyle.margins.top = 2;
  701. menuBarBtnStyle.margins.bottom = 2;
  702. menuBarBtnStyle.font = font;
  703. menuBarBtnStyle.fontSize = DefaultFontSize;
  704. menuBarBtnStyle.textHorzAlign = THA_Left;
  705. menuBarBtnStyle.textVertAlign = TVA_Top;
  706. skin->setStyle("MenuBarBtn", menuBarBtnStyle);
  707. /************************************************************************/
  708. /* DOCK SLIDER */
  709. /************************************************************************/
  710. GUIElementStyle dockSliderBtnStyle;
  711. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  712. dockSliderBtnStyle.fixedHeight = false;
  713. dockSliderBtnStyle.fixedWidth = false;
  714. dockSliderBtnStyle.height = 2;
  715. dockSliderBtnStyle.width = 2;
  716. skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
  717. /************************************************************************/
  718. /* TREE VIEW */
  719. /************************************************************************/
  720. // Expand button
  721. GUIElementStyle treeViewExpandButtonStyle;
  722. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  723. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  724. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  725. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  726. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  727. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  728. treeViewExpandButtonStyle.margins.left = 4;
  729. treeViewExpandButtonStyle.margins.right = 4;
  730. treeViewExpandButtonStyle.margins.top = 5;
  731. treeViewExpandButtonStyle.margins.bottom = 4;
  732. treeViewExpandButtonStyle.fixedHeight = true;
  733. treeViewExpandButtonStyle.fixedWidth = true;
  734. treeViewExpandButtonStyle.height = 16;
  735. treeViewExpandButtonStyle.width = 16;
  736. skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  737. // Entry
  738. GUIElementStyle treeViewEntryStyle;
  739. treeViewEntryStyle.font = font;
  740. treeViewEntryStyle.fontSize = DefaultFontSize;
  741. treeViewEntryStyle.fixedWidth = false;
  742. treeViewEntryStyle.fixedHeight = true;
  743. treeViewEntryStyle.height = 16;
  744. treeViewEntryStyle.minWidth = 10;
  745. skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
  746. // Selection background
  747. GUIElementStyle treeViewSelBackgroundStyle;
  748. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  749. treeViewSelBackgroundStyle.fixedHeight = false;
  750. treeViewSelBackgroundStyle.fixedWidth = false;
  751. treeViewSelBackgroundStyle.height = 2;
  752. treeViewSelBackgroundStyle.width = 2;
  753. skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  754. // Edit box
  755. GUIElementStyle treeViewEditBox;
  756. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  757. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  758. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  759. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  760. treeViewEditBox.border.left = 1;
  761. treeViewEditBox.border.right = 1;
  762. treeViewEditBox.border.top = 1;
  763. treeViewEditBox.border.bottom = 1;
  764. treeViewEditBox.margins.left = 1;
  765. treeViewEditBox.margins.right = 1;
  766. treeViewEditBox.margins.top = 1;
  767. treeViewEditBox.margins.bottom = 1;
  768. treeViewEditBox.fixedHeight = true;
  769. treeViewEditBox.height = 13;
  770. treeViewEditBox.minWidth = 10;
  771. treeViewEditBox.font = font;
  772. treeViewEditBox.fontSize = DefaultFontSize;
  773. treeViewEditBox.textHorzAlign = THA_Left;
  774. treeViewEditBox.textVertAlign = TVA_Top;
  775. skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  776. // Element highlight
  777. GUIElementStyle treeViewElementHighlight;
  778. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  779. treeViewElementHighlight.border.left = 1;
  780. treeViewElementHighlight.border.right = 1;
  781. treeViewElementHighlight.border.top = 1;
  782. treeViewElementHighlight.border.bottom = 1;
  783. skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  784. // Element separator highlight
  785. GUIElementStyle treeViewElementSepHighlight;
  786. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  787. treeViewElementSepHighlight.border.left = 1;
  788. treeViewElementSepHighlight.border.right = 1;
  789. treeViewElementSepHighlight.border.top = 1;
  790. treeViewElementSepHighlight.border.bottom = 1;
  791. skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  792. /************************************************************************/
  793. /* OBJECT DROP FIELD */
  794. /************************************************************************/
  795. GUIElementStyle objectDropStyle;
  796. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  797. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  798. objectDropStyle.fixedHeight = true;
  799. objectDropStyle.height = 15;
  800. objectDropStyle.minWidth = 50;
  801. objectDropStyle.font = font;
  802. objectDropStyle.fontSize = DefaultFontSize;
  803. objectDropStyle.textHorzAlign = THA_Center;
  804. objectDropStyle.textVertAlign = TVA_Center;
  805. skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  806. GUIElementStyle objectClearBtnStyle;
  807. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  808. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  809. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  810. objectClearBtnStyle.fixedHeight = true;
  811. objectClearBtnStyle.fixedWidth = true;
  812. objectClearBtnStyle.height = 15;
  813. objectClearBtnStyle.width = 13;
  814. skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  815. GUIElementStyle editorObjectFieldStyle;
  816. editorObjectFieldStyle.fixedHeight = true;
  817. editorObjectFieldStyle.height = 15;
  818. editorObjectFieldStyle.minWidth = 30;
  819. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  820. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  821. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  822. skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  823. /************************************************************************/
  824. /* EDITOR FIELDS */
  825. /************************************************************************/
  826. GUIElementStyle editorFieldLabelStyle;
  827. editorFieldLabelStyle.font = font;
  828. editorFieldLabelStyle.fontSize = DefaultFontSize;
  829. editorFieldLabelStyle.fixedWidth = false;
  830. editorFieldLabelStyle.fixedHeight = true;
  831. editorFieldLabelStyle.height = 11;
  832. editorFieldLabelStyle.minWidth = 10;
  833. editorFieldLabelStyle.textHorzAlign = THA_Left;
  834. skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  835. GUIElementStyle editorIntFieldStyle;
  836. editorIntFieldStyle.fixedHeight = true;
  837. editorIntFieldStyle.height = 15;
  838. editorIntFieldStyle.minWidth = 30;
  839. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  840. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  841. skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  842. GUIElementStyle editorFloatFieldStyle;
  843. editorFloatFieldStyle.fixedHeight = true;
  844. editorFloatFieldStyle.height = 15;
  845. editorFloatFieldStyle.minWidth = 30;
  846. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  847. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  848. skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  849. GUIElementStyle editorTextFieldStyle;
  850. editorTextFieldStyle.fixedHeight = true;
  851. editorTextFieldStyle.height = 15;
  852. editorTextFieldStyle.minWidth = 30;
  853. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  854. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  855. skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  856. GUIElementStyle editorColorFieldStyle;
  857. editorColorFieldStyle.fixedHeight = true;
  858. editorColorFieldStyle.height = 15;
  859. editorColorFieldStyle.minWidth = 30;
  860. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  861. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  862. skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  863. GUIElementStyle editorToggleFieldStyle;
  864. editorToggleFieldStyle.fixedHeight = true;
  865. editorToggleFieldStyle.height = 15;
  866. editorToggleFieldStyle.minWidth = 30;
  867. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  868. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  869. skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  870. GUIElementStyle editorVector2FieldStyle;
  871. editorVector2FieldStyle.fixedHeight = true;
  872. editorVector2FieldStyle.height = 30;
  873. editorVector2FieldStyle.minWidth = 30;
  874. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  875. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  876. skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  877. GUIElementStyle editorVector3FieldStyle;
  878. editorVector3FieldStyle.fixedHeight = true;
  879. editorVector3FieldStyle.height = 30;
  880. editorVector3FieldStyle.minWidth = 30;
  881. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  882. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  883. skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  884. GUIElementStyle editorVector4FieldStyle;
  885. editorVector4FieldStyle.fixedHeight = true;
  886. editorVector4FieldStyle.height = 30;
  887. editorVector4FieldStyle.minWidth = 30;
  888. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  889. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  890. skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  891. /************************************************************************/
  892. /* COMPONENT FOLDOUT */
  893. /************************************************************************/
  894. GUIElementStyle cmpFoldoutBtnStyle;
  895. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  896. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  897. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  898. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  899. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  900. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  901. cmpFoldoutBtnStyle.fixedHeight = true;
  902. cmpFoldoutBtnStyle.fixedWidth = false;
  903. cmpFoldoutBtnStyle.height = 10;
  904. cmpFoldoutBtnStyle.minWidth = 10;
  905. cmpFoldoutBtnStyle.font = font;
  906. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  907. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  908. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  909. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  910. cmpFoldoutBtnStyle.border.left = 8;
  911. skin->setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  912. GUIElementStyle cmpFoldoutStyle;
  913. cmpFoldoutStyle.fixedHeight = true;
  914. cmpFoldoutStyle.height = 12;
  915. cmpFoldoutStyle.minWidth = 30;
  916. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  917. skin->setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  918. /************************************************************************/
  919. /* FOLDOUT */
  920. /************************************************************************/
  921. GUIElementStyle foldoutBtnStyle;
  922. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  923. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  924. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  925. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  926. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  927. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  928. foldoutBtnStyle.fixedHeight = true;
  929. foldoutBtnStyle.fixedWidth = true;
  930. foldoutBtnStyle.height = 10;
  931. foldoutBtnStyle.width = 8;
  932. skin->setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  933. GUIElementStyle foldoutStyle;
  934. foldoutStyle.fixedHeight = true;
  935. foldoutStyle.height = 12;
  936. foldoutStyle.minWidth = 30;
  937. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  938. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  939. skin->setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  940. /************************************************************************/
  941. /* PROGRESS BAR */
  942. /************************************************************************/
  943. GUIElementStyle progressBarBgStyle;
  944. progressBarBgStyle.fixedHeight = true;
  945. progressBarBgStyle.height = 18;
  946. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  947. skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  948. GUIElementStyle progressBarFillStyle;
  949. progressBarFillStyle.fixedHeight = true;
  950. progressBarFillStyle.height = 12;
  951. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  952. skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  953. GUIElementStyle progressBarStyle;
  954. progressBarStyle.fixedHeight = true;
  955. progressBarStyle.height = 18;
  956. progressBarStyle.minWidth = 100;
  957. progressBarStyle.margins.top = 3;
  958. progressBarStyle.margins.bottom = 3;
  959. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  960. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  961. skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  962. /************************************************************************/
  963. /* COLOR PICKER SLIDER */
  964. /************************************************************************/
  965. GUIElementStyle colorPickerSliderHorzHandleStyle;
  966. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  967. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  968. colorPickerSliderHorzHandleStyle.height = 20;
  969. colorPickerSliderHorzHandleStyle.width = 7;
  970. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  971. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  972. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  973. skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  974. GUIElementStyle colorPickerSliderHorzStyle;
  975. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  976. colorPickerSliderHorzHandleStyle.height = 32;
  977. colorPickerSliderHorzHandleStyle.minWidth = 20;
  978. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  979. skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  980. GUIElementStyle colorPickerSliderVertHandleStyle;
  981. colorPickerSliderVertHandleStyle.fixedHeight = true;
  982. colorPickerSliderVertHandleStyle.fixedWidth = true;
  983. colorPickerSliderVertHandleStyle.height = 7;
  984. colorPickerSliderVertHandleStyle.width = 45;
  985. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  986. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  987. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  988. skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  989. GUIElementStyle colorPickerSliderVertStyle;
  990. colorPickerSliderVertStyle.fixedWidth = true;
  991. colorPickerSliderVertStyle.width = 30;
  992. colorPickerSliderVertStyle.minHeight = 20;
  993. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  994. skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  995. GUIElementStyle colorPickerSlider2DHandleStyle;
  996. colorPickerSlider2DHandleStyle.fixedHeight = true;
  997. colorPickerSlider2DHandleStyle.fixedWidth = true;
  998. colorPickerSlider2DHandleStyle.height = 8;
  999. colorPickerSlider2DHandleStyle.width = 8;
  1000. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  1001. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1002. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1003. skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  1004. /************************************************************************/
  1005. /* OTHER */
  1006. /************************************************************************/
  1007. // Right-aligned label
  1008. GUIElementStyle rightAlignedLabelStyle;
  1009. rightAlignedLabelStyle.font = font;
  1010. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  1011. rightAlignedLabelStyle.fixedWidth = false;
  1012. rightAlignedLabelStyle.fixedHeight = true;
  1013. rightAlignedLabelStyle.height = 11;
  1014. rightAlignedLabelStyle.minWidth = 10;
  1015. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  1016. skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  1017. return skin;
  1018. }
  1019. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1020. {
  1021. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1022. texturePath.append(EditorSkinFolder);
  1023. texturePath.append(L"sprite_" + name + L".asset");
  1024. return Resources::instance().load<SpriteTexture>(texturePath);
  1025. }
  1026. HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name)
  1027. {
  1028. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1029. texturePath.append(EditorIconFolder);
  1030. texturePath.append(L"sprite_" + name + L".asset");
  1031. return Resources::instance().load<SpriteTexture>(texturePath);
  1032. }
  1033. HShader BuiltinEditorResources::getShader(const WString& name)
  1034. {
  1035. Path programPath = EditorShaderFolder;
  1036. programPath.append(name + L".asset");
  1037. return gResources().load<Shader>(programPath);
  1038. }
  1039. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1040. {
  1041. return Material::create(mShaderDockOverlay);
  1042. }
  1043. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1044. {
  1045. return Material::create(mShaderSceneGrid);
  1046. }
  1047. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1048. {
  1049. UINT32 modeIdx = (UINT32)cullMode;
  1050. return Material::create(mShaderPicking[modeIdx]);
  1051. }
  1052. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1053. {
  1054. UINT32 modeIdx = (UINT32)cullMode;
  1055. return Material::create(mShaderPickingAlpha[modeIdx]);
  1056. }
  1057. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1058. {
  1059. return Material::create(mShaderGizmoWire);
  1060. }
  1061. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1062. {
  1063. return Material::create(mShaderGizmoSolid);
  1064. }
  1065. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1066. {
  1067. return Material::create(mShaderGizmoIcon);
  1068. }
  1069. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1070. {
  1071. return Material::create(mShaderGizmoPicking);
  1072. }
  1073. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1074. {
  1075. return Material::create(mShaderGizmoAlphaPicking);
  1076. }
  1077. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1078. {
  1079. return Material::create(mShaderHandleWire);
  1080. }
  1081. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1082. {
  1083. return Material::create(mShaderHandleSolid);
  1084. }
  1085. HMaterial BuiltinEditorResources::createSelectionMat() const
  1086. {
  1087. return Material::create(mShaderSelection);
  1088. }
  1089. HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon) const
  1090. {
  1091. switch (icon)
  1092. {
  1093. case ProjectIcon::Folder:
  1094. return getGUIIcon(FolderIconTex);
  1095. case ProjectIcon::Font:
  1096. return getGUIIcon(FontIconTex);
  1097. case ProjectIcon::Mesh:
  1098. return getGUIIcon(MeshIconTex);
  1099. case ProjectIcon::Texture:
  1100. return getGUIIcon(TextureIconTex);
  1101. }
  1102. return nullptr;
  1103. }
  1104. }