BsBuiltinEditorResources.cpp 59 KB

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