BsBuiltinEditorResources.cpp 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  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. // Label
  245. GUIElementStyle labelStyle;
  246. labelStyle.font = font;
  247. labelStyle.fontSize = DefaultFontSize;
  248. labelStyle.fixedWidth = false;
  249. labelStyle.fixedHeight = true;
  250. labelStyle.height = 11;
  251. labelStyle.minWidth = 10;
  252. skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
  253. // Multi-line label
  254. GUIElementStyle multiLinelabelStyle;
  255. multiLinelabelStyle.font = font;
  256. multiLinelabelStyle.fontSize = DefaultFontSize;
  257. multiLinelabelStyle.fixedWidth = false;
  258. multiLinelabelStyle.fixedHeight = true;
  259. multiLinelabelStyle.height = 11;
  260. multiLinelabelStyle.minWidth = 10;
  261. multiLinelabelStyle.wordWrap = true;
  262. skin->setStyle("MultiLineLabel", multiLinelabelStyle);
  263. // Window frame
  264. GUIElementStyle windowFrameStyle;
  265. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  266. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  267. windowFrameStyle.border.left = 1;
  268. windowFrameStyle.border.right = 1;
  269. windowFrameStyle.border.top = 1;
  270. windowFrameStyle.border.bottom = 1;
  271. skin->setStyle("WindowFrame", windowFrameStyle);
  272. // Button
  273. GUIElementStyle buttonStyle;
  274. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  275. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  276. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  277. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  278. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  279. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  280. buttonStyle.border.left = 6;
  281. buttonStyle.border.right = 6;
  282. buttonStyle.border.top = 6;
  283. buttonStyle.border.bottom = 6;
  284. buttonStyle.contentOffset.left = 3;
  285. buttonStyle.contentOffset.right = 3;
  286. buttonStyle.fixedHeight = true;
  287. buttonStyle.height = 15;
  288. buttonStyle.minWidth = 50;
  289. buttonStyle.font = font;
  290. buttonStyle.fontSize = DefaultFontSize;
  291. buttonStyle.textHorzAlign = THA_Center;
  292. buttonStyle.textVertAlign = TVA_Center;
  293. skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
  294. // Toggle
  295. GUIElementStyle toggleStyle;
  296. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  297. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  298. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  299. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  300. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  301. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  302. toggleStyle.fixedHeight = true;
  303. toggleStyle.fixedWidth = true;
  304. toggleStyle.height = 15;
  305. toggleStyle.width = 15;
  306. skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  307. // Color
  308. GUIElementStyle colorStyle;
  309. colorStyle.margins.left = 2;
  310. colorStyle.margins.right = 2;
  311. colorStyle.margins.top = 2;
  312. colorStyle.margins.bottom = 2;
  313. colorStyle.fixedHeight = true;
  314. colorStyle.height = 10;
  315. colorStyle.minWidth = 10;
  316. skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
  317. // Window background texture
  318. GUIElementStyle windowBgStyle;
  319. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  320. skin->setStyle("WindowBackground", windowBgStyle);
  321. // Window title bar background
  322. GUIElementStyle titleBarBgStyle;
  323. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  324. titleBarBgStyle.fixedHeight = true;
  325. titleBarBgStyle.height = 13;
  326. skin->setStyle("TitleBarBackground", titleBarBgStyle);
  327. // Tabbed title bar tab button
  328. GUIElementStyle tabbedBarButton;
  329. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  330. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  331. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  332. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  333. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  334. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  335. tabbedBarButton.fixedHeight = true;
  336. tabbedBarButton.height = 13;
  337. tabbedBarButton.minWidth = 10;
  338. tabbedBarButton.maxWidth = 110;
  339. tabbedBarButton.font = font;
  340. tabbedBarButton.fontSize = DefaultFontSize;
  341. tabbedBarButton.textHorzAlign = THA_Center;
  342. tabbedBarButton.textVertAlign = TVA_Center;
  343. skin->setStyle("TabbedBarBtn", tabbedBarButton);
  344. // Tabbed title bar drag/drop button
  345. GUIElementStyle tabbedBarDropButton;
  346. tabbedBarDropButton.fixedHeight = true;
  347. tabbedBarDropButton.fixedWidth = true;
  348. tabbedBarDropButton.height = 13;
  349. tabbedBarDropButton.width = 6;
  350. skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
  351. // Window minimize button
  352. GUIElementStyle winMinButtonStyle;
  353. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  354. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  355. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  356. winMinButtonStyle.fixedHeight = true;
  357. winMinButtonStyle.fixedWidth = true;
  358. winMinButtonStyle.height = 7;
  359. winMinButtonStyle.width = 8;
  360. skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
  361. // Window maximize button
  362. GUIElementStyle winMaxButtonStyle;
  363. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  364. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  365. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  366. winMaxButtonStyle.fixedHeight = true;
  367. winMaxButtonStyle.fixedWidth = true;
  368. winMaxButtonStyle.height = 8;
  369. winMaxButtonStyle.width = 8;
  370. skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
  371. // Window close button
  372. GUIElementStyle winCloseButtonStyle;
  373. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  374. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  375. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  376. winCloseButtonStyle.fixedHeight = true;
  377. winCloseButtonStyle.fixedWidth = true;
  378. winCloseButtonStyle.height = 7;
  379. winCloseButtonStyle.width = 8;
  380. skin->setStyle("WinCloseBtn", winCloseButtonStyle);
  381. // Input box
  382. GUIElementStyle inputBoxStyle;
  383. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  384. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  385. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  386. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  387. inputBoxStyle.border.left = 1;
  388. inputBoxStyle.border.right = 1;
  389. inputBoxStyle.border.top = 1;
  390. inputBoxStyle.border.bottom = 1;
  391. inputBoxStyle.contentOffset.left = 3;
  392. inputBoxStyle.contentOffset.right = 3;
  393. inputBoxStyle.contentOffset.top = 2;
  394. inputBoxStyle.contentOffset.bottom = 2;
  395. inputBoxStyle.fixedHeight = true;
  396. inputBoxStyle.height = 15;
  397. inputBoxStyle.minWidth = 10;
  398. inputBoxStyle.font = font;
  399. inputBoxStyle.fontSize = DefaultFontSize;
  400. inputBoxStyle.textHorzAlign = THA_Left;
  401. inputBoxStyle.textVertAlign = TVA_Top;
  402. skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  403. /************************************************************************/
  404. /* SCROLL BAR */
  405. /************************************************************************/
  406. // Up button
  407. GUIElementStyle scrollUpBtnStyle;
  408. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  409. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  410. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  411. scrollUpBtnStyle.fixedHeight = true;
  412. scrollUpBtnStyle.fixedWidth = true;
  413. scrollUpBtnStyle.height = 4;
  414. scrollUpBtnStyle.width = 8;
  415. skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
  416. // Down button
  417. GUIElementStyle scrollDownBtnStyle;
  418. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  419. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  420. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  421. scrollDownBtnStyle.fixedHeight = true;
  422. scrollDownBtnStyle.fixedWidth = true;
  423. scrollDownBtnStyle.height = 4;
  424. scrollDownBtnStyle.width = 8;
  425. skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
  426. // Left button
  427. GUIElementStyle scrollLeftBtnStyle;
  428. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  429. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  430. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  431. scrollLeftBtnStyle.fixedHeight = true;
  432. scrollLeftBtnStyle.fixedWidth = true;
  433. scrollLeftBtnStyle.height = 8;
  434. scrollLeftBtnStyle.width = 4;
  435. skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  436. // Right button
  437. GUIElementStyle scrollRightBtnStyle;
  438. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  439. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  440. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  441. scrollRightBtnStyle.fixedHeight = true;
  442. scrollRightBtnStyle.fixedWidth = true;
  443. scrollRightBtnStyle.height = 8;
  444. scrollRightBtnStyle.width = 4;
  445. skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
  446. // Horizontal handle
  447. GUIElementStyle scrollBarHorzBtnStyle;
  448. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  449. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  450. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  451. scrollBarHorzBtnStyle.fixedHeight = true;
  452. scrollBarHorzBtnStyle.fixedWidth = true;
  453. scrollBarHorzBtnStyle.height = 6;
  454. scrollBarHorzBtnStyle.width = 4;
  455. skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  456. // Vertical handle
  457. GUIElementStyle scrollBarVertBtnStyle;
  458. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  459. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  460. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  461. scrollBarVertBtnStyle.fixedHeight = true;
  462. scrollBarVertBtnStyle.fixedWidth = true;
  463. scrollBarVertBtnStyle.height = 4;
  464. scrollBarVertBtnStyle.width = 6;
  465. skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  466. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  467. // Vertical scroll bar
  468. GUIElementStyle vertScrollBarStyle;
  469. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  470. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  471. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  472. vertScrollBarStyle.fixedHeight = false;
  473. vertScrollBarStyle.fixedWidth = true;
  474. vertScrollBarStyle.minHeight = 16;
  475. vertScrollBarStyle.width = 8;
  476. skin->setStyle("ScrollBarVert", vertScrollBarStyle);
  477. // Horizontal scroll bar
  478. GUIElementStyle horzScrollBarStyle;
  479. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  480. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  481. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  482. horzScrollBarStyle.fixedHeight = true;
  483. horzScrollBarStyle.fixedWidth = false;
  484. horzScrollBarStyle.minWidth = 16;
  485. horzScrollBarStyle.height = 8;
  486. skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
  487. /************************************************************************/
  488. /* DROP DOWN BOX */
  489. /************************************************************************/
  490. // ListBox button
  491. GUIElementStyle dropDownListStyle;
  492. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  493. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  494. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  495. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  496. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  497. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  498. dropDownListStyle.fixedHeight = true;
  499. dropDownListStyle.fixedWidth = false;
  500. dropDownListStyle.height = 13;
  501. dropDownListStyle.width = 30;
  502. dropDownListStyle.contentOffset.left = 3;
  503. dropDownListStyle.contentOffset.right = 11;
  504. dropDownListStyle.contentOffset.top = 1;
  505. dropDownListStyle.contentOffset.bottom = 1;
  506. dropDownListStyle.border.left = 1;
  507. dropDownListStyle.border.right = 10;
  508. dropDownListStyle.border.top = 1;
  509. dropDownListStyle.border.bottom = 1;
  510. dropDownListStyle.font = font;
  511. dropDownListStyle.fontSize = DefaultFontSize;
  512. dropDownListStyle.textHorzAlign = THA_Left;
  513. dropDownListStyle.textVertAlign = TVA_Top;
  514. skin->setStyle("ListBox", dropDownListStyle);
  515. // DropDown scroll up button arrow
  516. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  517. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  518. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  519. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  520. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  521. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  522. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  523. dropDownScrollUpBtnArrowStyle.height = 7;
  524. dropDownScrollUpBtnArrowStyle.width = 30;
  525. dropDownScrollUpBtnArrowStyle.border.left = 1;
  526. dropDownScrollUpBtnArrowStyle.border.right = 1;
  527. dropDownScrollUpBtnArrowStyle.border.top = 1;
  528. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  529. skin->setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  530. skin->setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  531. skin->setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  532. // DropDown scroll up button
  533. GUIElementStyle dropDownScrollUpBtnStyle;
  534. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  535. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  536. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  537. dropDownScrollUpBtnStyle.fixedHeight = true;
  538. dropDownScrollUpBtnStyle.fixedWidth = false;
  539. dropDownScrollUpBtnStyle.height = 7;
  540. dropDownScrollUpBtnStyle.width = 30;
  541. dropDownScrollUpBtnStyle.border.left = 1;
  542. dropDownScrollUpBtnStyle.border.right = 1;
  543. dropDownScrollUpBtnStyle.border.top = 1;
  544. dropDownScrollUpBtnStyle.border.bottom = 1;
  545. skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  546. skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  547. skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  548. // DropDown scroll down button arrow
  549. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  550. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  551. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  552. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  553. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  554. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  555. dropDownScrollDownBtnArrowStyle.height = 7;
  556. dropDownScrollDownBtnArrowStyle.width = 30;
  557. dropDownScrollDownBtnArrowStyle.border.left = 1;
  558. dropDownScrollDownBtnArrowStyle.border.right = 1;
  559. dropDownScrollDownBtnArrowStyle.border.top = 1;
  560. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  561. skin->setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  562. skin->setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  563. skin->setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  564. // DropDown scroll down button
  565. GUIElementStyle dropDownScrollDownBtnStyle;
  566. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  567. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  568. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  569. dropDownScrollDownBtnStyle.fixedHeight = true;
  570. dropDownScrollDownBtnStyle.fixedWidth = false;
  571. dropDownScrollDownBtnStyle.height = 7;
  572. dropDownScrollDownBtnStyle.width = 30;
  573. dropDownScrollDownBtnStyle.border.left = 1;
  574. dropDownScrollDownBtnStyle.border.right = 1;
  575. dropDownScrollDownBtnStyle.border.top = 1;
  576. dropDownScrollDownBtnStyle.border.bottom = 1;
  577. skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  578. skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  579. skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  580. // DropDown entry button
  581. GUIElementStyle dropDownEntryBtnStyle;
  582. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  583. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  584. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  585. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  586. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  587. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  588. dropDownEntryBtnStyle.fixedHeight = true;
  589. dropDownEntryBtnStyle.fixedWidth = false;
  590. dropDownEntryBtnStyle.height = 14;
  591. dropDownEntryBtnStyle.width = 30;
  592. dropDownEntryBtnStyle.border.left = 1;
  593. dropDownEntryBtnStyle.border.right = 1;
  594. dropDownEntryBtnStyle.border.top = 1;
  595. dropDownEntryBtnStyle.border.bottom = 1;
  596. dropDownEntryBtnStyle.font = font;
  597. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  598. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  599. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  600. skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  601. // DropDown entry button with expand
  602. GUIElementStyle dropDownEntryExpBtnStyle;
  603. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  604. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  605. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  606. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  607. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  608. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  609. dropDownEntryExpBtnStyle.fixedHeight = true;
  610. dropDownEntryExpBtnStyle.fixedWidth = false;
  611. dropDownEntryExpBtnStyle.height = 14;
  612. dropDownEntryExpBtnStyle.width = 30;
  613. dropDownEntryExpBtnStyle.border.left = 1;
  614. dropDownEntryExpBtnStyle.border.right = 6;
  615. dropDownEntryExpBtnStyle.border.top = 1;
  616. dropDownEntryExpBtnStyle.border.bottom = 1;
  617. dropDownEntryExpBtnStyle.font = font;
  618. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  619. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  620. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  621. skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  622. // Drop down separator
  623. GUIElementStyle dropDownSeparatorStyle;
  624. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  625. dropDownSeparatorStyle.fixedHeight = true;
  626. dropDownSeparatorStyle.fixedWidth = false;
  627. dropDownSeparatorStyle.height = 3;
  628. dropDownSeparatorStyle.width = 30;
  629. dropDownSeparatorStyle.border.left = 1;
  630. dropDownSeparatorStyle.border.right = 1;
  631. dropDownSeparatorStyle.border.top = 1;
  632. dropDownSeparatorStyle.border.bottom = 1;
  633. skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  634. // Drop down content
  635. GUIElementStyle dropDownContentStyle;
  636. dropDownContentStyle.minWidth = 50;
  637. dropDownContentStyle.minHeight = 20;
  638. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  639. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  640. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  641. skin->setStyle("ListBoxContent", dropDownContentStyle);
  642. skin->setStyle("MenuBarContent", dropDownContentStyle);
  643. skin->setStyle("ContextMenuContent", dropDownContentStyle);
  644. // DropDown box frame
  645. GUIElementStyle dropDownBoxStyle;
  646. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  647. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  648. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  649. dropDownBoxStyle.fixedHeight = false;
  650. dropDownBoxStyle.fixedWidth = false;
  651. dropDownBoxStyle.border.left = 1;
  652. dropDownBoxStyle.border.right = 1;
  653. dropDownBoxStyle.border.top = 1;
  654. dropDownBoxStyle.border.bottom = 1;
  655. dropDownBoxStyle.margins.left = 1;
  656. dropDownBoxStyle.margins.right = 1;
  657. dropDownBoxStyle.margins.top = 1;
  658. dropDownBoxStyle.margins.bottom = 1;
  659. skin->setStyle("ListBoxFrame", dropDownBoxStyle);
  660. skin->setStyle("MenuBarFrame", dropDownBoxStyle);
  661. skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
  662. /************************************************************************/
  663. /* MENU BAR */
  664. /************************************************************************/
  665. // MenuBar background
  666. GUIElementStyle menuBarBgStyle;
  667. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  668. menuBarBgStyle.fixedHeight = false;
  669. menuBarBgStyle.fixedWidth = false;
  670. menuBarBgStyle.height = 4;
  671. menuBarBgStyle.width = 4;
  672. skin->setStyle("MenuBarBg", menuBarBgStyle);
  673. // MenuBar Banshee logo
  674. GUIElementStyle menuBarBansheeLogoStyle;
  675. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  676. menuBarBansheeLogoStyle.fixedHeight = true;
  677. menuBarBansheeLogoStyle.fixedWidth = true;
  678. menuBarBansheeLogoStyle.height = 7;
  679. menuBarBansheeLogoStyle.width = 51;
  680. skin->setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  681. // MenuBar button
  682. GUIElementStyle menuBarBtnStyle;
  683. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  684. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  685. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  686. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  687. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  688. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  689. menuBarBtnStyle.fixedHeight = true;
  690. menuBarBtnStyle.fixedWidth = false;
  691. menuBarBtnStyle.height = 15;
  692. menuBarBtnStyle.width = 4;
  693. menuBarBtnStyle.margins.left = 2;
  694. menuBarBtnStyle.margins.right = 2;
  695. menuBarBtnStyle.margins.top = 2;
  696. menuBarBtnStyle.margins.bottom = 2;
  697. menuBarBtnStyle.font = font;
  698. menuBarBtnStyle.fontSize = DefaultFontSize;
  699. menuBarBtnStyle.textHorzAlign = THA_Left;
  700. menuBarBtnStyle.textVertAlign = TVA_Top;
  701. skin->setStyle("MenuBarBtn", menuBarBtnStyle);
  702. /************************************************************************/
  703. /* DOCK SLIDER */
  704. /************************************************************************/
  705. GUIElementStyle dockSliderBtnStyle;
  706. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  707. dockSliderBtnStyle.fixedHeight = false;
  708. dockSliderBtnStyle.fixedWidth = false;
  709. dockSliderBtnStyle.height = 2;
  710. dockSliderBtnStyle.width = 2;
  711. skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
  712. /************************************************************************/
  713. /* TREE VIEW */
  714. /************************************************************************/
  715. // Expand button
  716. GUIElementStyle treeViewExpandButtonStyle;
  717. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  718. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  719. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  720. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  721. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  722. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  723. treeViewExpandButtonStyle.margins.left = 4;
  724. treeViewExpandButtonStyle.margins.right = 4;
  725. treeViewExpandButtonStyle.margins.top = 5;
  726. treeViewExpandButtonStyle.margins.bottom = 4;
  727. treeViewExpandButtonStyle.fixedHeight = true;
  728. treeViewExpandButtonStyle.fixedWidth = true;
  729. treeViewExpandButtonStyle.height = 16;
  730. treeViewExpandButtonStyle.width = 16;
  731. skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  732. // Entry
  733. GUIElementStyle treeViewEntryStyle;
  734. treeViewEntryStyle.font = font;
  735. treeViewEntryStyle.fontSize = DefaultFontSize;
  736. treeViewEntryStyle.fixedWidth = false;
  737. treeViewEntryStyle.fixedHeight = true;
  738. treeViewEntryStyle.height = 16;
  739. treeViewEntryStyle.minWidth = 10;
  740. skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
  741. // Selection background
  742. GUIElementStyle treeViewSelBackgroundStyle;
  743. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  744. treeViewSelBackgroundStyle.fixedHeight = false;
  745. treeViewSelBackgroundStyle.fixedWidth = false;
  746. treeViewSelBackgroundStyle.height = 2;
  747. treeViewSelBackgroundStyle.width = 2;
  748. skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  749. // Edit box
  750. GUIElementStyle treeViewEditBox;
  751. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  752. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  753. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  754. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  755. treeViewEditBox.border.left = 1;
  756. treeViewEditBox.border.right = 1;
  757. treeViewEditBox.border.top = 1;
  758. treeViewEditBox.border.bottom = 1;
  759. treeViewEditBox.margins.left = 1;
  760. treeViewEditBox.margins.right = 1;
  761. treeViewEditBox.margins.top = 1;
  762. treeViewEditBox.margins.bottom = 1;
  763. treeViewEditBox.fixedHeight = true;
  764. treeViewEditBox.height = 13;
  765. treeViewEditBox.minWidth = 10;
  766. treeViewEditBox.font = font;
  767. treeViewEditBox.fontSize = DefaultFontSize;
  768. treeViewEditBox.textHorzAlign = THA_Left;
  769. treeViewEditBox.textVertAlign = TVA_Top;
  770. skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  771. // Element highlight
  772. GUIElementStyle treeViewElementHighlight;
  773. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  774. treeViewElementHighlight.border.left = 1;
  775. treeViewElementHighlight.border.right = 1;
  776. treeViewElementHighlight.border.top = 1;
  777. treeViewElementHighlight.border.bottom = 1;
  778. skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  779. // Element separator highlight
  780. GUIElementStyle treeViewElementSepHighlight;
  781. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  782. treeViewElementSepHighlight.border.left = 1;
  783. treeViewElementSepHighlight.border.right = 1;
  784. treeViewElementSepHighlight.border.top = 1;
  785. treeViewElementSepHighlight.border.bottom = 1;
  786. skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  787. /************************************************************************/
  788. /* OBJECT DROP FIELD */
  789. /************************************************************************/
  790. GUIElementStyle objectDropStyle;
  791. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  792. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  793. objectDropStyle.fixedHeight = true;
  794. objectDropStyle.height = 15;
  795. objectDropStyle.minWidth = 50;
  796. objectDropStyle.font = font;
  797. objectDropStyle.fontSize = DefaultFontSize;
  798. objectDropStyle.textHorzAlign = THA_Center;
  799. objectDropStyle.textVertAlign = TVA_Center;
  800. skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  801. GUIElementStyle objectClearBtnStyle;
  802. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  803. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  804. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  805. objectClearBtnStyle.fixedHeight = true;
  806. objectClearBtnStyle.fixedWidth = true;
  807. objectClearBtnStyle.height = 15;
  808. objectClearBtnStyle.width = 13;
  809. skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  810. GUIElementStyle editorObjectFieldStyle;
  811. editorObjectFieldStyle.fixedHeight = true;
  812. editorObjectFieldStyle.height = 15;
  813. editorObjectFieldStyle.minWidth = 30;
  814. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  815. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  816. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  817. skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  818. /************************************************************************/
  819. /* EDITOR FIELDS */
  820. /************************************************************************/
  821. GUIElementStyle editorFieldLabelStyle;
  822. editorFieldLabelStyle.font = font;
  823. editorFieldLabelStyle.fontSize = DefaultFontSize;
  824. editorFieldLabelStyle.fixedWidth = false;
  825. editorFieldLabelStyle.fixedHeight = true;
  826. editorFieldLabelStyle.height = 11;
  827. editorFieldLabelStyle.minWidth = 10;
  828. editorFieldLabelStyle.textHorzAlign = THA_Left;
  829. skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  830. GUIElementStyle editorIntFieldStyle;
  831. editorIntFieldStyle.fixedHeight = true;
  832. editorIntFieldStyle.height = 15;
  833. editorIntFieldStyle.minWidth = 30;
  834. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  835. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  836. skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  837. GUIElementStyle editorFloatFieldStyle;
  838. editorFloatFieldStyle.fixedHeight = true;
  839. editorFloatFieldStyle.height = 15;
  840. editorFloatFieldStyle.minWidth = 30;
  841. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  842. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  843. skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  844. GUIElementStyle editorTextFieldStyle;
  845. editorTextFieldStyle.fixedHeight = true;
  846. editorTextFieldStyle.height = 15;
  847. editorTextFieldStyle.minWidth = 30;
  848. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  849. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  850. skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  851. GUIElementStyle editorColorFieldStyle;
  852. editorColorFieldStyle.fixedHeight = true;
  853. editorColorFieldStyle.height = 15;
  854. editorColorFieldStyle.minWidth = 30;
  855. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  856. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  857. skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  858. GUIElementStyle editorToggleFieldStyle;
  859. editorToggleFieldStyle.fixedHeight = true;
  860. editorToggleFieldStyle.height = 15;
  861. editorToggleFieldStyle.minWidth = 30;
  862. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  863. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  864. skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  865. GUIElementStyle editorVector2FieldStyle;
  866. editorVector2FieldStyle.fixedHeight = true;
  867. editorVector2FieldStyle.height = 30;
  868. editorVector2FieldStyle.minWidth = 30;
  869. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  870. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  871. skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  872. GUIElementStyle editorVector3FieldStyle;
  873. editorVector3FieldStyle.fixedHeight = true;
  874. editorVector3FieldStyle.height = 30;
  875. editorVector3FieldStyle.minWidth = 30;
  876. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  877. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  878. skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  879. GUIElementStyle editorVector4FieldStyle;
  880. editorVector4FieldStyle.fixedHeight = true;
  881. editorVector4FieldStyle.height = 30;
  882. editorVector4FieldStyle.minWidth = 30;
  883. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  884. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  885. skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  886. /************************************************************************/
  887. /* COMPONENT FOLDOUT */
  888. /************************************************************************/
  889. GUIElementStyle cmpFoldoutBtnStyle;
  890. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  891. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  892. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  893. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  894. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  895. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  896. cmpFoldoutBtnStyle.fixedHeight = true;
  897. cmpFoldoutBtnStyle.fixedWidth = false;
  898. cmpFoldoutBtnStyle.height = 10;
  899. cmpFoldoutBtnStyle.minWidth = 10;
  900. cmpFoldoutBtnStyle.font = font;
  901. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  902. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  903. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  904. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  905. cmpFoldoutBtnStyle.border.left = 8;
  906. skin->setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  907. GUIElementStyle cmpFoldoutStyle;
  908. cmpFoldoutStyle.fixedHeight = true;
  909. cmpFoldoutStyle.height = 12;
  910. cmpFoldoutStyle.minWidth = 30;
  911. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  912. skin->setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  913. /************************************************************************/
  914. /* FOLDOUT */
  915. /************************************************************************/
  916. GUIElementStyle foldoutBtnStyle;
  917. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  918. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  919. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  920. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  921. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  922. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  923. foldoutBtnStyle.fixedHeight = true;
  924. foldoutBtnStyle.fixedWidth = true;
  925. foldoutBtnStyle.height = 10;
  926. foldoutBtnStyle.width = 8;
  927. skin->setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  928. GUIElementStyle foldoutStyle;
  929. foldoutStyle.fixedHeight = true;
  930. foldoutStyle.height = 12;
  931. foldoutStyle.minWidth = 30;
  932. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  933. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  934. skin->setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  935. /************************************************************************/
  936. /* PROGRESS BAR */
  937. /************************************************************************/
  938. GUIElementStyle progressBarBgStyle;
  939. progressBarBgStyle.fixedHeight = true;
  940. progressBarBgStyle.height = 18;
  941. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  942. skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  943. GUIElementStyle progressBarFillStyle;
  944. progressBarFillStyle.fixedHeight = true;
  945. progressBarFillStyle.height = 12;
  946. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  947. skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  948. GUIElementStyle progressBarStyle;
  949. progressBarStyle.fixedHeight = true;
  950. progressBarStyle.height = 18;
  951. progressBarStyle.minWidth = 100;
  952. progressBarStyle.margins.top = 3;
  953. progressBarStyle.margins.bottom = 3;
  954. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  955. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  956. skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  957. /************************************************************************/
  958. /* COLOR PICKER SLIDER */
  959. /************************************************************************/
  960. GUIElementStyle colorPickerSliderHorzHandleStyle;
  961. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  962. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  963. colorPickerSliderHorzHandleStyle.height = 20;
  964. colorPickerSliderHorzHandleStyle.width = 7;
  965. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  966. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  967. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  968. skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  969. GUIElementStyle colorPickerSliderHorzStyle;
  970. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  971. colorPickerSliderHorzHandleStyle.height = 32;
  972. colorPickerSliderHorzHandleStyle.minWidth = 20;
  973. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  974. skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  975. GUIElementStyle colorPickerSliderVertHandleStyle;
  976. colorPickerSliderVertHandleStyle.fixedHeight = true;
  977. colorPickerSliderVertHandleStyle.fixedWidth = true;
  978. colorPickerSliderVertHandleStyle.height = 7;
  979. colorPickerSliderVertHandleStyle.width = 45;
  980. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  981. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  982. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  983. skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  984. GUIElementStyle colorPickerSliderVertStyle;
  985. colorPickerSliderVertStyle.fixedWidth = true;
  986. colorPickerSliderVertStyle.width = 30;
  987. colorPickerSliderVertStyle.minHeight = 20;
  988. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  989. skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  990. GUIElementStyle colorPickerSlider2DHandleStyle;
  991. colorPickerSlider2DHandleStyle.fixedHeight = true;
  992. colorPickerSlider2DHandleStyle.fixedWidth = true;
  993. colorPickerSlider2DHandleStyle.height = 8;
  994. colorPickerSlider2DHandleStyle.width = 8;
  995. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  996. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  997. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  998. skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  999. /************************************************************************/
  1000. /* OTHER */
  1001. /************************************************************************/
  1002. // Right-aligned label
  1003. GUIElementStyle rightAlignedLabelStyle;
  1004. rightAlignedLabelStyle.font = font;
  1005. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  1006. rightAlignedLabelStyle.fixedWidth = false;
  1007. rightAlignedLabelStyle.fixedHeight = true;
  1008. rightAlignedLabelStyle.height = 11;
  1009. rightAlignedLabelStyle.minWidth = 10;
  1010. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  1011. skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  1012. return skin;
  1013. }
  1014. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1015. {
  1016. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1017. texturePath.append(EditorSkinFolder);
  1018. texturePath.append(L"sprite_" + name + L".asset");
  1019. return Resources::instance().load<SpriteTexture>(texturePath);
  1020. }
  1021. HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name)
  1022. {
  1023. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1024. texturePath.append(EditorIconFolder);
  1025. texturePath.append(L"sprite_" + name + L".asset");
  1026. return Resources::instance().load<SpriteTexture>(texturePath);
  1027. }
  1028. HShader BuiltinEditorResources::getShader(const WString& name)
  1029. {
  1030. Path programPath = EditorShaderFolder;
  1031. programPath.append(name + L".asset");
  1032. return gResources().load<Shader>(programPath);
  1033. }
  1034. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1035. {
  1036. return Material::create(mShaderDockOverlay);
  1037. }
  1038. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1039. {
  1040. return Material::create(mShaderSceneGrid);
  1041. }
  1042. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1043. {
  1044. UINT32 modeIdx = (UINT32)cullMode;
  1045. return Material::create(mShaderPicking[modeIdx]);
  1046. }
  1047. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1048. {
  1049. UINT32 modeIdx = (UINT32)cullMode;
  1050. return Material::create(mShaderPickingAlpha[modeIdx]);
  1051. }
  1052. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1053. {
  1054. return Material::create(mShaderGizmoWire);
  1055. }
  1056. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1057. {
  1058. return Material::create(mShaderGizmoSolid);
  1059. }
  1060. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1061. {
  1062. return Material::create(mShaderGizmoIcon);
  1063. }
  1064. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1065. {
  1066. return Material::create(mShaderGizmoPicking);
  1067. }
  1068. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1069. {
  1070. return Material::create(mShaderGizmoAlphaPicking);
  1071. }
  1072. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1073. {
  1074. return Material::create(mShaderHandleWire);
  1075. }
  1076. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1077. {
  1078. return Material::create(mShaderHandleSolid);
  1079. }
  1080. HMaterial BuiltinEditorResources::createSelectionMat() const
  1081. {
  1082. return Material::create(mShaderSelection);
  1083. }
  1084. HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon) const
  1085. {
  1086. switch (icon)
  1087. {
  1088. case ProjectIcon::Folder:
  1089. return getGUIIcon(FolderIconTex);
  1090. case ProjectIcon::Font:
  1091. return getGUIIcon(FontIconTex);
  1092. case ProjectIcon::Mesh:
  1093. return getGUIIcon(MeshIconTex);
  1094. case ProjectIcon::Texture:
  1095. return getGUIIcon(TextureIconTex);
  1096. }
  1097. return nullptr;
  1098. }
  1099. }