BsBuiltinEditorResources.cpp 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "Utility/BsBuiltinEditorResources.h"
  4. #include "Resources/BsBuiltinResources.h"
  5. #include "GUI/BsGUIElementStyle.h"
  6. #include "GUI/BsGUILabel.h"
  7. #include "GUI/BsGUITexture.h"
  8. #include "GUI/BsGUIButton.h"
  9. #include "GUI/BsGUIInputBox.h"
  10. #include "GUI/BsGUIToggle.h"
  11. #include "GUI/BsGUIColor.h"
  12. #include "2D/BsTextSprite.h"
  13. #include "2D/BsSpriteTexture.h"
  14. #include "GUI/BsGUITreeViewEditBox.h"
  15. #include "GUI/BsGUIIntField.h"
  16. #include "GUI/BsGUIFloatField.h"
  17. #include "GUI/BsGUIColorField.h"
  18. #include "GUI/BsGUITextField.h"
  19. #include "GUI/BsGUIToggleField.h"
  20. #include "GUI/BsGUIVector2Field.h"
  21. #include "GUI/BsGUIVector3Field.h"
  22. #include "GUI/BsGUIVector4Field.h"
  23. #include "GUI/BsGUIListBoxField.h"
  24. #include "GUI/BsGUISliderField.h"
  25. #include "GUI/BsGUIProgressBar.h"
  26. #include "GUI/BsGUISlider.h"
  27. #include "GUI/BsGUIDropDownContent.h"
  28. #include "GUI/BsGUIStatusBar.h"
  29. #include "GUI/BsGUIMenuBar.h"
  30. #include "GUI/BsGUIListBox.h"
  31. #include "GUI/BsGUIScrollBar.h"
  32. #include "CoreThread/BsCoreThread.h"
  33. #include "Text/BsFont.h"
  34. #include "Image/BsTexture.h"
  35. #include "Material/BsShader.h"
  36. #include "Material/BsMaterial.h"
  37. #include "Resources/BsResources.h"
  38. #include "FileSystem/BsFileSystem.h"
  39. #include "Resources/BsResourceManifest.h"
  40. #include "FileSystem/BsDataStream.h"
  41. #include "GUI/BsGUITooltip.h"
  42. #include "Resources/BsBuiltinResourcesHelper.h"
  43. #include "Importer/BsImporter.h"
  44. #include "Importer/BsTextureImportOptions.h"
  45. #include "Serialization/BsFileSerializer.h"
  46. #include "BsEditorApplication.h"
  47. using json = nlohmann::json;
  48. namespace bs
  49. {
  50. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  51. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  52. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  53. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  54. const String BuiltinEditorResources::TextureFieldStyleName = "GUITextureField";
  55. const String BuiltinEditorResources::TextureFieldLabelStyleName = "TextureFieldLabel";
  56. const String BuiltinEditorResources::TextureFieldDropStyleName = "TextureDrop";
  57. const String BuiltinEditorResources::TextureFieldClearBtnStyleName = "TextureClearButton";
  58. const String BuiltinEditorResources::DefaultFontFilename = "arial.ttf";
  59. const String BuiltinEditorResources::DefaultAAFontFilename = "arialAA.ttf";
  60. const UINT32 BuiltinEditorResources::DefaultFontSize = 8;
  61. const UINT32 BuiltinEditorResources::TitleFontSize = 16;
  62. const Color BuiltinEditorResources::TextNormalColor = Color(0.7f, 0.7f, 0.7f);
  63. const Color BuiltinEditorResources::TextActiveColor = Color(0.0f, 0.0f, 0.0f);
  64. const String BuiltinEditorResources::GUISkinFile = "GUISkin";
  65. const char* BuiltinEditorResources::DataListFile = "DataList.json";
  66. const char* BuiltinEditorResources::ShaderFolder = "Shaders/";
  67. const char* BuiltinEditorResources::SkinFolder = "Skin/";
  68. const char* BuiltinEditorResources::IconFolder = "Icons/";
  69. const char* BuiltinEditorResources::ShaderIncludeFolder = "Shaders/Includes/";
  70. const char* BuiltinEditorResources::SpriteSubFolder = "Sprites/";
  71. const String BuiltinEditorResources::FolderIconTex = u8"FolderIcon.psd";
  72. const String BuiltinEditorResources::MeshIconTex = u8"MeshIcon.psd";
  73. const String BuiltinEditorResources::TextureIconTex = u8"TextureIcon.psd";
  74. const String BuiltinEditorResources::FontIconTex = u8"FontIcon.psd";
  75. const String BuiltinEditorResources::PlainTextIconTex = u8"TextIcon.psd";
  76. const String BuiltinEditorResources::ScriptCodeIconTex = u8"CSharpIcon.psd";
  77. const String BuiltinEditorResources::ShaderIconTex = u8"ShaderIcon.psd";
  78. const String BuiltinEditorResources::ShaderIncludeIconTex = u8"ShaderIncludeIcon.psd";
  79. const String BuiltinEditorResources::MaterialIconTex = u8"MaterialIcon.psd";
  80. const String BuiltinEditorResources::SpriteTextureIconTex = u8"SpriteIcon.psd";
  81. const String BuiltinEditorResources::PrefabIconTex = u8"PrefabIcon.psd";
  82. const String BuiltinEditorResources::GUISkinIconTex = u8"GUISkinIcon.psd";
  83. const String BuiltinEditorResources::PhysicsMaterialIconTex = u8"PhysicsMaterialIcon.psd";
  84. const String BuiltinEditorResources::PhysicsMeshIconTex = u8"PhysicsMeshIcon.psd";
  85. const String BuiltinEditorResources::AudioClipIconTex = u8"AudioClipIcon.psd";
  86. const String BuiltinEditorResources::AnimationClipIconTex = u8"AnimationClipIcon.psd";
  87. const String BuiltinEditorResources::ButtonNormalTex = u8"ButtonNormal.png";
  88. const String BuiltinEditorResources::ButtonHoverTex = u8"ButtonHover.png";
  89. const String BuiltinEditorResources::ButtonActiveTex = u8"ButtonActive.png";
  90. const String BuiltinEditorResources::ButtonLeftNormalTex = u8"ButtonLeftNormal.png";
  91. const String BuiltinEditorResources::ButtonLeftHoverTex = u8"ButtonLeftHover.png";
  92. const String BuiltinEditorResources::ButtonLeftActiveTex = u8"ButtonLeftActive.png";
  93. const String BuiltinEditorResources::ButtonRightNormalTex = u8"ButtonRightNormal.png";
  94. const String BuiltinEditorResources::ButtonRightHoverTex = u8"ButtonRightHover.png";
  95. const String BuiltinEditorResources::ButtonRightActiveTex = u8"ButtonRightActive.png";
  96. const String BuiltinEditorResources::ToggleNormalTex = u8"ToggleNormal.png";
  97. const String BuiltinEditorResources::ToggleHoverTex = u8"ToggleHover.png";
  98. const String BuiltinEditorResources::ToggleNormalOnTex = u8"ToggleNormalOn.png";
  99. const String BuiltinEditorResources::ToggleHoverOnTex = u8"ToggleHoverOn.png";
  100. const String BuiltinEditorResources::InputBoxNormalTex = u8"InputBoxNormal.png";
  101. const String BuiltinEditorResources::InputBoxHoverTex = u8"InputBoxHover.png";
  102. const String BuiltinEditorResources::InputBoxFocusedTex = u8"InputBoxActive.png";
  103. const String BuiltinEditorResources::ObjectDropBtnNormalTex = u8"ObjectDropNormal.png";
  104. const String BuiltinEditorResources::ObjectDropBtnNormalOnTex = u8"ObjectDropNormalOn.png";
  105. const String BuiltinEditorResources::ObjectClearBtnNormalTex = u8"ObjectDropClearNormal.png";
  106. const String BuiltinEditorResources::ObjectClearBtnHoverTex = u8"ObjectDropClearHover.png";
  107. const String BuiltinEditorResources::ObjectClearBtnActiveTex = u8"ObjectDropClearActive.png";
  108. const String BuiltinEditorResources::DropDownBtnNormalTex = u8"DropDownButtonNormal.png";
  109. const String BuiltinEditorResources::DropDownBtnHoverTex = u8"DropDownButtonHover.png";
  110. const String BuiltinEditorResources::DropDownBtnActiveTex = u8"DropDownButtonActive.png";
  111. const String BuiltinEditorResources::SliderHBackgroundTex = u8"SliderHBackground.png";
  112. const String BuiltinEditorResources::SliderHFillTex = u8"SliderHFill.png";
  113. const String BuiltinEditorResources::SliderVBackgroundTex = u8"SliderVBackground.png";
  114. const String BuiltinEditorResources::SliderVFillTex = u8"SliderVFill.png";
  115. const String BuiltinEditorResources::SliderHandleNormalTex = u8"SliderHandleNormal.png";
  116. const String BuiltinEditorResources::SliderHandleHoverTex = u8"SliderHandleHover.png";
  117. const String BuiltinEditorResources::SliderHandleActiveTex = u8"SliderHandleActive.png";
  118. const String BuiltinEditorResources::FoldoutOpenNormalTex = u8"FoldoutNormalOn.png";
  119. const String BuiltinEditorResources::FoldoutOpenHoverTex = u8"FoldoutHoverOn.png";
  120. const String BuiltinEditorResources::FoldoutOpenActiveTex = u8"FoldoutHoverOn.png";
  121. const String BuiltinEditorResources::FoldoutClosedNormalTex = u8"FoldoutNormalOff.png";
  122. const String BuiltinEditorResources::FoldoutClosedHoverTex = u8"FoldoutHoverOff.png";
  123. const String BuiltinEditorResources::FoldoutClosedActiveTex = u8"FoldoutHoverOff.png";
  124. const String BuiltinEditorResources::WindowBackgroundTex = u8"WindowBackground.png";
  125. const String BuiltinEditorResources::WindowFrameNormal = u8"WindowFrameNormal.png";
  126. const String BuiltinEditorResources::WindowFrameFocused = u8"WindowFrameFocused.png";
  127. const String BuiltinEditorResources::CloseButtonNormalTex = u8"CloseButtonNormal.png";
  128. const String BuiltinEditorResources::CloseButtonHoverTex = u8"CloseButtonHover.png";
  129. const String BuiltinEditorResources::CloseButtonActiveTex = u8"CloseButtonActive.png";
  130. const String BuiltinEditorResources::MinButtonNormalTex = u8"MinimizeButtonNormal.png";
  131. const String BuiltinEditorResources::MinButtonHoverTex = u8"MinimizeButtonHover.png";
  132. const String BuiltinEditorResources::MinButtonActiveTex = u8"MinimizeButtonActive.png";
  133. const String BuiltinEditorResources::MaxButtonNormalTex = u8"MaximizeButtonNormal.png";
  134. const String BuiltinEditorResources::MaxButtonHoverTex = u8"MaximizeButtonHover.png";
  135. const String BuiltinEditorResources::MaxButtonActiveTex = u8"MaximizeButtonActive.png";
  136. const String BuiltinEditorResources::TabBarBackgroundTex = u8"TabBarBackground.png";
  137. const String BuiltinEditorResources::TitleBarBackgroundTex = u8"TitleBarBackground.png";
  138. const String BuiltinEditorResources::TabButtonNormalTex = u8"TabButtonNormal.png";
  139. const String BuiltinEditorResources::TabButtonFocusedTex = u8"TabButtonFocused.png";
  140. const String BuiltinEditorResources::ScrollBarUpNormalTex = u8"ScrollArrowUpNormal.png";
  141. const String BuiltinEditorResources::ScrollBarUpHoverTex = u8"ScrollArrowUpHover.png";
  142. const String BuiltinEditorResources::ScrollBarUpActiveTex = u8"ScrollArrowUpActive.png";
  143. const String BuiltinEditorResources::ScrollBarDownNormalTex = u8"ScrollArrowDownNormal.png";
  144. const String BuiltinEditorResources::ScrollBarDownHoverTex = u8"ScrollArrowDownHover.png";
  145. const String BuiltinEditorResources::ScrollBarDownActiveTex = u8"ScrollArrowDownActive.png";
  146. const String BuiltinEditorResources::ScrollBarLeftNormalTex = u8"ScrollArrowLeftNormal.png";
  147. const String BuiltinEditorResources::ScrollBarLeftHoverTex = u8"ScrollArrowLeftHover.png";
  148. const String BuiltinEditorResources::ScrollBarLeftActiveTex = u8"ScrollArrowLeftActive.png";
  149. const String BuiltinEditorResources::ScrollBarRightNormalTex = u8"ScrollArrowRightNormal.png";
  150. const String BuiltinEditorResources::ScrollBarRightHoverTex = u8"ScrollArrowRightHover.png";
  151. const String BuiltinEditorResources::ScrollBarRightActiveTex = u8"ScrollArrowRightActive.png";
  152. const String BuiltinEditorResources::ScrollBarHandleHorzNormalTex = u8"ScrollBarHHandleNormal.png";
  153. const String BuiltinEditorResources::ScrollBarHandleHorzHoverTex = u8"ScrollBarHHandleHover.png";
  154. const String BuiltinEditorResources::ScrollBarHandleHorzActiveTex = u8"ScrollBarHHandleActive.png";
  155. const String BuiltinEditorResources::ScrollBarHandleVertNormalTex = u8"ScrollBarVHandleNormal.png";
  156. const String BuiltinEditorResources::ScrollBarHandleVertHoverTex = u8"ScrollBarVHandleHover.png";
  157. const String BuiltinEditorResources::ScrollBarHandleVertActiveTex = u8"ScrollBarVHandleActive.png";
  158. const String BuiltinEditorResources::ScrollBarResizeableHandleHorzNormalTex = u8"ScrollBarHHandleResizeableNormal.png";
  159. const String BuiltinEditorResources::ScrollBarResizeableHandleHorzHoverTex = u8"ScrollBarHHandleResizeableHover.png";
  160. const String BuiltinEditorResources::ScrollBarResizeableHandleHorzActiveTex = u8"ScrollBarHHandleResizeableActive.png";
  161. const String BuiltinEditorResources::ScrollBarResizeableHandleVertNormalTex = u8"ScrollBarVHandleResizeableNormal.png";
  162. const String BuiltinEditorResources::ScrollBarResizeableHandleVertHoverTex = u8"ScrollBarVHandleResizeableHover.png";
  163. const String BuiltinEditorResources::ScrollBarResizeableHandleVertActiveTex = u8"ScrollBarVHandleResizeableActive.png";
  164. const String BuiltinEditorResources::ScrollBarHBgTex = u8"ScrollBarHBackground.png";
  165. const String BuiltinEditorResources::ScrollBarVBgTex = u8"ScrollBarVBackground.png";
  166. const String BuiltinEditorResources::DropDownBoxBgTex = u8"DropDownBoxBg.png";
  167. const String BuiltinEditorResources::DropDownBoxSideBgTex = u8"DropDownBoxSideBg.png";
  168. const String BuiltinEditorResources::DropDownBoxHandleTex = u8"DropDownBoxScrollHandle.png";
  169. const String BuiltinEditorResources::DropDownBoxEntryNormalTex = u8"DropDownBoxEntryNormal.png";
  170. const String BuiltinEditorResources::DropDownBoxEntryHoverTex = u8"DropDownBoxEntryHover.png";
  171. const String BuiltinEditorResources::DropDownBoxEntryToggleNormalTex = u8"DropDownBoxEntryToggleNormal.png";
  172. const String BuiltinEditorResources::DropDownBoxEntryToggleHoverTex = u8"DropDownBoxEntryToggleHover.png";
  173. const String BuiltinEditorResources::DropDownBoxEntryToggleNormalOnTex = u8"DropDownBoxEntryToggleNormalOn.png";
  174. const String BuiltinEditorResources::DropDownBoxEntryToggleHoverOnTex = u8"DropDownBoxEntryToggleHoverOn.png";
  175. const String BuiltinEditorResources::DropDownBoxBtnUpNormalTex = u8"DropDownBoxArrowUpNormal.png";
  176. const String BuiltinEditorResources::DropDownBoxBtnUpHoverTex = u8"DropDownBoxArrowUpHover.png";
  177. const String BuiltinEditorResources::DropDownBoxBtnDownNormalTex = u8"DropDownBoxArrowDownNormal.png";
  178. const String BuiltinEditorResources::DropDownBoxBtnDownHoverTex = u8"DropDownBoxArrowDownHover.png";
  179. const String BuiltinEditorResources::DropDownBoxEntryExpNormalTex = u8"DropDownBoxExpandBtnNormal.png";
  180. const String BuiltinEditorResources::DropDownBoxEntryExpHoverTex = u8"DropDownBoxExpandBtnHover.png";
  181. const String BuiltinEditorResources::DropDownSeparatorTex = u8"DropDownBoxSeparator.png";
  182. const String BuiltinEditorResources::MenuBarBgTex = u8"MenuBarBackground.png";
  183. const String BuiltinEditorResources::MenuBarBansheeLogoTex = u8"MenuBarLog.png";
  184. const String BuiltinEditorResources::MenuBarBtnNormalTex = u8"MenuBarButtonNormal.png";
  185. const String BuiltinEditorResources::MenuBarBtnActiveTex = u8"MenuBarButtonActive.png";
  186. const String BuiltinEditorResources::MenuBarBtnHoverTex = u8"MenuBarButtonHover.png";
  187. const String BuiltinEditorResources::MenuBarLineNormalTex = u8"MenuBarLineNormal.png";
  188. const String BuiltinEditorResources::MenuBarLineActiveTex = u8"MenuBarLineActive.png";
  189. const String BuiltinEditorResources::ToolBarBtnNormalTex = u8"ToolBarButtonNormal.png";
  190. const String BuiltinEditorResources::ToolBarBtnHoverTex = u8"ToolBarButtonHover.png";
  191. const String BuiltinEditorResources::ToolBarBtnActiveTex = u8"ToolBarButtonActive.png";
  192. const String BuiltinEditorResources::ToolBarSeparatorTex = u8"ToolBarSeparator.png";
  193. const String BuiltinEditorResources::TreeViewExpandButtonOffNormal = u8"ExpandArrowNormalOff.png";
  194. const String BuiltinEditorResources::TreeViewExpandButtonOffHover = u8"ExpandArrowHoverOff.png";
  195. const String BuiltinEditorResources::TreeViewExpandButtonOnNormal = u8"ExpandArrowNormalOn.png";
  196. const String BuiltinEditorResources::TreeViewExpandButtonOnHover = u8"ExpandArrowHoverOn.png";
  197. const String BuiltinEditorResources::TreeViewHighlightBackground = u8"TreeViewHighlightBackground.psd";
  198. const String BuiltinEditorResources::TreeViewEditBox = u8"TreeViewEditBox.psd";
  199. const String BuiltinEditorResources::TreeViewElementHighlight = u8"TreeViewElementHighlight.psd";
  200. const String BuiltinEditorResources::TreeViewElementSepHighlight = u8"TreeViewElementSepHighlight.psd";
  201. const String BuiltinEditorResources::ColorPickerSliderHorzHandleTex = u8"ColorPickerSliderHorzHandle.psd";
  202. const String BuiltinEditorResources::ColorPickerSliderVertHandleTex = u8"ColorPickerSliderVertHandle.psd";
  203. const String BuiltinEditorResources::ColorPickerSlider2DHandleTex = u8"ColorPicker2DHandle.psd";
  204. const String BuiltinEditorResources::ProgressBarFillTex = u8"ProgressBarFill.png";
  205. const String BuiltinEditorResources::ProgressBarBgTex = u8"ProgressBarBg.png";
  206. const String BuiltinEditorResources::SelectionAreaTex = u8"SelectionHighlight.png";
  207. const String BuiltinEditorResources::SelectionBgTex = u8"SelectionBg.psd";
  208. const String BuiltinEditorResources::TextureDropTex = u8"TextureDrop.png";
  209. const String BuiltinEditorResources::TextureDropOnTex = u8"TextureDropHover.png";
  210. const String BuiltinEditorResources::XButtonNormalTex = u8"XBtnNormal.png";
  211. const String BuiltinEditorResources::XButtonHoverTex = u8"XBtnHover.png";
  212. const String BuiltinEditorResources::XButtonActiveTex = u8"XBtnActive.png";
  213. const String BuiltinEditorResources::StatusBarBgTex = u8"StatusBarBackground.png";
  214. const String BuiltinEditorResources::ScrollAreaBgTex = u8"ScrollAreaBg.png";
  215. const String BuiltinEditorResources::InspectorTitleBgTex = u8"InspectorTitleBg.png";
  216. const String BuiltinEditorResources::InspectorContentBgTex = u8"InspectorContentBg.png";
  217. const String BuiltinEditorResources::InspectorContentBgAlternateTex = u8"InspectorContentBgAlternate.png";
  218. const String BuiltinEditorResources::LibraryEntryFirstBgTex = u8"LibraryEntryFirstBg.png";
  219. const String BuiltinEditorResources::LibraryEntryBgTex = u8"LibraryEntryBg.png";
  220. const String BuiltinEditorResources::LibraryEntryLastBgTex = u8"LibraryEntryLastBg.png";
  221. const String BuiltinEditorResources::LibraryEntryVertFirstBgTex = u8"LibraryEntryVertFirstBg.png";
  222. const String BuiltinEditorResources::LibraryEntryVertBgTex = u8"LibraryEntryVertBg.png";
  223. const String BuiltinEditorResources::LibraryEntryVertLastBgTex = u8"LibraryEntryVertLastBg.png";
  224. const char* BuiltinEditorResources::SplashScreenName = u8"SplashScreen.png";
  225. /************************************************************************/
  226. /* SHADERS */
  227. /************************************************************************/
  228. const String BuiltinEditorResources::ShaderDockOverlayFile = u8"DockDropOverlay.bsl";
  229. const String BuiltinEditorResources::ShaderSceneGridFile = u8"SceneGrid.bsl";
  230. const String BuiltinEditorResources::ShaderPickingCullNoneFile = u8"PickingCullNone.bsl";
  231. const String BuiltinEditorResources::ShaderPickingCullCWFile = u8"PickingCullCW.bsl";
  232. const String BuiltinEditorResources::ShaderPickingCullCCWFile = u8"PickingCullCCW.bsl";
  233. const String BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = u8"PickingAlphaCullNone.bsl";
  234. const String BuiltinEditorResources::ShaderPickingAlphaCullCWFile = u8"PickingAlphaCullCW.bsl";
  235. const String BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = u8"PickingAlphaCullCCW.bsl";
  236. const String BuiltinEditorResources::ShaderLineGizmoFile = u8"LineGizmo.bsl";
  237. const String BuiltinEditorResources::ShaderWireGizmoFile = u8"WireGizmo.bsl";
  238. const String BuiltinEditorResources::ShaderSolidGizmoFile = u8"SolidGizmo.bsl";
  239. const String BuiltinEditorResources::ShaderLineHandleFile = u8"LineHandle.bsl";
  240. const String BuiltinEditorResources::ShaderSolidHandleFile = u8"SolidHandle.bsl";
  241. const String BuiltinEditorResources::ShaderHandleClearAlphaFile = u8"ClearHandleAlpha.bsl";
  242. const String BuiltinEditorResources::ShaderIconGizmoFile = u8"IconGizmo.bsl";
  243. const String BuiltinEditorResources::ShaderGizmoPickingFile = u8"GizmoPicking.bsl";
  244. const String BuiltinEditorResources::ShaderGizmoPickingAlphaFile = u8"GizmoPickingAlpha.bsl";
  245. const String BuiltinEditorResources::ShaderTextGizmoFile = u8"TextGizmo.bsl";
  246. const String BuiltinEditorResources::ShaderSelectionFile = u8"Selection.bsl";
  247. /************************************************************************/
  248. /* OTHER */
  249. /************************************************************************/
  250. const String BuiltinEditorResources::EmptyShaderCodeFile = u8"EmptyShaderText.txt";
  251. const String BuiltinEditorResources::EmptyCSScriptCodeFile = u8"EmptyCSScriptText.txt";
  252. BuiltinEditorResources::BuiltinEditorResources()
  253. {
  254. // Set up paths
  255. BuiltinRawDataFolder = gEditorApplication().getDataPath() + "Raw/";
  256. EditorRawSkinFolder = BuiltinRawDataFolder + SkinFolder;
  257. EditorRawIconsFolder = BuiltinRawDataFolder + IconFolder;
  258. EditorRawShaderFolder = BuiltinRawDataFolder + ShaderFolder;
  259. EditorRawShaderIncludeFolder = BuiltinRawDataFolder + ShaderIncludeFolder;
  260. BuiltinDataFolder = gEditorApplication().getDataPath();
  261. EditorSkinFolder = BuiltinDataFolder + SkinFolder;
  262. EditorSkinSpritesFolder = EditorSkinFolder + SpriteSubFolder;
  263. EditorIconFolder = BuiltinDataFolder + IconFolder;
  264. EditorIconSpritesFolder = EditorIconFolder + SpriteSubFolder;
  265. EditorShaderFolder = BuiltinDataFolder + ShaderFolder;
  266. EditorShaderIncludeFolder = BuiltinDataFolder + ShaderIncludeFolder;
  267. ResourceManifestPath = BuiltinDataFolder + "ResourceManifest.asset";
  268. // Update from raw assets if needed
  269. if (FileSystem::exists(BuiltinRawDataFolder))
  270. {
  271. time_t lastUpdateTime;
  272. UINT32 modifications = BuiltinResourcesHelper::checkForModifications(BuiltinRawDataFolder,
  273. BuiltinDataFolder + "Timestamp.asset", lastUpdateTime);
  274. // Check if manifest needs to be rebuilt
  275. if (modifications == 0 && !FileSystem::exists(ResourceManifestPath))
  276. modifications = 1;
  277. if (modifications > 0)
  278. {
  279. bool forceReimport = modifications == 2;
  280. SPtr<ResourceManifest> oldResourceManifest;
  281. if (!forceReimport && FileSystem::exists(ResourceManifestPath))
  282. {
  283. oldResourceManifest = ResourceManifest::load(ResourceManifestPath, BuiltinDataFolder);
  284. if (oldResourceManifest != nullptr)
  285. gResources().registerResourceManifest(oldResourceManifest);
  286. }
  287. if (oldResourceManifest)
  288. mResourceManifest = oldResourceManifest;
  289. else
  290. {
  291. mResourceManifest = ResourceManifest::create("BuiltinResources");
  292. gResources().registerResourceManifest(mResourceManifest);
  293. }
  294. preprocess(modifications == 2, lastUpdateTime);
  295. BuiltinResourcesHelper::writeTimestamp(BuiltinDataFolder + "Timestamp.asset");
  296. ResourceManifest::save(mResourceManifest, ResourceManifestPath, BuiltinDataFolder);
  297. }
  298. }
  299. // Load manifest
  300. if (mResourceManifest == nullptr)
  301. {
  302. if (FileSystem::exists(ResourceManifestPath))
  303. mResourceManifest = ResourceManifest::load(ResourceManifestPath, BuiltinDataFolder);
  304. if (mResourceManifest == nullptr)
  305. mResourceManifest = ResourceManifest::create("BuiltinResources");
  306. gResources().registerResourceManifest(mResourceManifest);
  307. }
  308. // Load basic resources
  309. mShaderDockOverlay = getShader(ShaderDockOverlayFile);
  310. mShaderSceneGrid = getShader(ShaderSceneGridFile);
  311. mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
  312. mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
  313. mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
  314. mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
  315. mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
  316. mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
  317. mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
  318. mShaderGizmoLine = getShader(ShaderLineGizmoFile);
  319. mShaderGizmoWire = getShader(ShaderWireGizmoFile);
  320. mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
  321. mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
  322. mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
  323. mShaderGizmoText = getShader(ShaderTextGizmoFile);
  324. mShaderHandleSolid = getShader(ShaderSolidHandleFile);
  325. mShaderHandleClearAlpha = getShader(ShaderHandleClearAlphaFile);
  326. mShaderHandleLine = getShader(ShaderLineHandleFile);
  327. mShaderSelection = getShader(ShaderSelectionFile);
  328. mDefaultFont = gResources().load<Font>(BuiltinDataFolder + (DefaultFontFilename + ".asset"));
  329. mDefaultAAFont = gResources().load<Font>(BuiltinDataFolder + (DefaultAAFontFilename + ".asset"));
  330. mSkin = gResources().load<GUISkin>(BuiltinDataFolder + (GUISkinFile + ".asset"));
  331. }
  332. BuiltinEditorResources::~BuiltinEditorResources()
  333. { }
  334. void BuiltinEditorResources::preprocess(bool forceImport, time_t lastUpdateTime)
  335. {
  336. Resources::instance().unloadAllUnused();
  337. Path dataListsFilePath = BuiltinRawDataFolder + DataListFile;
  338. SPtr<DataStream> dataListStream = FileSystem::openFile(dataListsFilePath);
  339. json dataListJSON = json::parse(dataListStream->getAsString().c_str());
  340. json skinJSON = dataListJSON["Skin"];
  341. json iconsJSON = dataListJSON["Icons"];
  342. json includesJSON = dataListJSON["Includes"];
  343. json shadersJSON = dataListJSON["Shaders"];
  344. // Update DataList.json if needed
  345. bool updatedDataLists = false;
  346. updatedDataLists |= BuiltinResourcesHelper::updateJSON(
  347. EditorRawIconsFolder,
  348. BuiltinResourcesHelper::AssetType::Sprite,
  349. iconsJSON);
  350. updatedDataLists |= BuiltinResourcesHelper::updateJSON(
  351. EditorRawShaderIncludeFolder,
  352. BuiltinResourcesHelper::AssetType::Normal,
  353. includesJSON);
  354. updatedDataLists |= BuiltinResourcesHelper::updateJSON(
  355. EditorRawShaderFolder,
  356. BuiltinResourcesHelper::AssetType::Normal,
  357. shadersJSON);
  358. updatedDataLists |= BuiltinResourcesHelper::updateJSON(
  359. EditorRawSkinFolder,
  360. BuiltinResourcesHelper::AssetType::Sprite,
  361. skinJSON);
  362. dataListStream->close();
  363. if (updatedDataLists)
  364. {
  365. FileSystem::remove(dataListsFilePath);
  366. dataListJSON["Skin"] = skinJSON;
  367. dataListJSON["Icons"] = iconsJSON;
  368. dataListJSON["Includes"] = includesJSON;
  369. dataListJSON["Shaders"] = shadersJSON;
  370. String jsonString = dataListJSON.dump(4).c_str();
  371. dataListStream = FileSystem::createAndOpenFile(dataListsFilePath);
  372. dataListStream->writeString(jsonString);
  373. dataListStream->close();
  374. }
  375. // If forcing import, clear all data folders since everything will be recreated anyway
  376. Path shaderDependenciesFile = BuiltinDataFolder + "ShaderDependencies.json";
  377. if(forceImport)
  378. {
  379. FileSystem::remove(EditorIconFolder);
  380. FileSystem::remove(EditorShaderIncludeFolder);
  381. FileSystem::remove(EditorShaderFolder);
  382. FileSystem::remove(EditorSkinFolder);
  383. FileSystem::remove(shaderDependenciesFile);
  384. }
  385. // Read shader dependencies JSON
  386. json shaderDependenciesJSON;
  387. if(FileSystem::exists(shaderDependenciesFile))
  388. {
  389. SPtr<DataStream> stream = FileSystem::openFile(shaderDependenciesFile);
  390. shaderDependenciesJSON = json::parse(stream->getAsString().c_str());
  391. stream->close();
  392. }
  393. // Import icons
  394. {
  395. BuiltinResourcesHelper::updateManifest(
  396. EditorIconFolder,
  397. iconsJSON,
  398. mResourceManifest,
  399. BuiltinResourcesHelper::AssetType::Sprite);
  400. Vector<bool> importFlags = BuiltinResourcesHelper::generateImportFlags(
  401. iconsJSON,
  402. EditorRawIconsFolder,
  403. lastUpdateTime,
  404. forceImport);
  405. BuiltinResourcesHelper::importAssets(
  406. iconsJSON,
  407. importFlags,
  408. EditorRawIconsFolder,
  409. EditorIconFolder,
  410. mResourceManifest,
  411. BuiltinResourcesHelper::AssetType::Sprite);
  412. }
  413. // Import shaders
  414. {
  415. BuiltinResourcesHelper::updateManifest(
  416. EditorShaderIncludeFolder,
  417. includesJSON,
  418. mResourceManifest,
  419. BuiltinResourcesHelper::AssetType::Normal);
  420. BuiltinResourcesHelper::updateManifest(
  421. EditorShaderFolder,
  422. shadersJSON,
  423. mResourceManifest,
  424. BuiltinResourcesHelper::AssetType::Normal);
  425. Vector<bool> includeImportFlags = BuiltinResourcesHelper::generateImportFlags(
  426. includesJSON,
  427. EditorRawShaderIncludeFolder,
  428. lastUpdateTime,
  429. forceImport);
  430. Vector<bool> shaderImportFlags = BuiltinResourcesHelper::generateImportFlags(
  431. shadersJSON,
  432. EditorRawShaderFolder,
  433. lastUpdateTime,
  434. forceImport,
  435. &shaderDependenciesJSON,
  436. EditorRawShaderIncludeFolder);
  437. // Hidden dependency: Includes must be imported before shaders, but import flags for shaders must be generated
  438. // before includes are imported, since the process checks if imports changed
  439. BuiltinResourcesHelper::importAssets(
  440. includesJSON,
  441. includeImportFlags,
  442. EditorRawShaderIncludeFolder,
  443. EditorShaderIncludeFolder,
  444. mResourceManifest,
  445. BuiltinResourcesHelper::AssetType::Normal);
  446. BuiltinResourcesHelper::importAssets(
  447. shadersJSON,
  448. shaderImportFlags,
  449. EditorRawShaderFolder,
  450. EditorShaderFolder,
  451. mResourceManifest,
  452. BuiltinResourcesHelper::AssetType::Normal,
  453. &shaderDependenciesJSON);
  454. }
  455. // Import GUI sprites
  456. {
  457. BuiltinResourcesHelper::updateManifest(
  458. EditorSkinFolder,
  459. skinJSON,
  460. mResourceManifest,
  461. BuiltinResourcesHelper::AssetType::Sprite);
  462. Vector<bool> includeImportFlags = BuiltinResourcesHelper::generateImportFlags(
  463. skinJSON,
  464. EditorRawSkinFolder,
  465. lastUpdateTime,
  466. forceImport);
  467. BuiltinResourcesHelper::importAssets(
  468. skinJSON,
  469. includeImportFlags,
  470. EditorRawSkinFolder,
  471. EditorSkinFolder,
  472. mResourceManifest,
  473. BuiltinResourcesHelper::AssetType::Sprite);
  474. }
  475. // Update shader dependencies JSON
  476. {
  477. String jsonString = shaderDependenciesJSON.dump(4).c_str();
  478. dataListStream = FileSystem::createAndOpenFile(shaderDependenciesFile);
  479. dataListStream->writeString(jsonString);
  480. dataListStream->close();
  481. }
  482. // Import fonts
  483. BuiltinResourcesHelper::importFont(
  484. BuiltinRawDataFolder + DefaultFontFilename,
  485. DefaultFontFilename,
  486. BuiltinDataFolder,
  487. { DefaultFontSize },
  488. true,
  489. UUID("6ce69053-00d7-4c60-a229-249b8d8fd60e"),
  490. mResourceManifest);
  491. BuiltinResourcesHelper::importFont(
  492. BuiltinRawDataFolder + DefaultFontFilename,
  493. DefaultAAFontFilename,
  494. BuiltinDataFolder,
  495. { TitleFontSize },
  496. true,
  497. UUID("10999b74-d976-4116-9f72-21e489a7a8e4"),
  498. mResourceManifest);
  499. // Import splash screen
  500. {
  501. Path inputPath = BuiltinRawDataFolder + String(SplashScreenName);
  502. Path outputPath = BuiltinDataFolder + (String(SplashScreenName) + ".asset");
  503. auto textureIO = gImporter().createImportOptions<TextureImportOptions>(inputPath);
  504. textureIO->setCPUCached(true);
  505. textureIO->setGenerateMipmaps(false);
  506. HTexture splashTexture = gImporter().import<Texture>(inputPath, textureIO);
  507. SPtr<PixelData> splashPixelData = splashTexture->getProperties().allocBuffer(0, 0);
  508. splashTexture->readCachedData(*splashPixelData);
  509. FileEncoder fe(outputPath);
  510. fe.encode(splashPixelData.get());
  511. }
  512. // Generate & save GUI skin
  513. {
  514. SPtr<GUISkin> skin = generateGUISkin();
  515. Path outputPath = BuiltinDataFolder + (GUISkinFile + ".asset");
  516. HResource skinResource = gResources()._createResourceHandle(skin, UUID("ec0ea68d-efa5-4a3b-a6fc-b15aaec9689f"));
  517. gResources().save(skinResource, outputPath, true);
  518. mResourceManifest->registerResource(skinResource.getUUID(), outputPath);
  519. }
  520. Resources::instance().unloadAllUnused();
  521. }
  522. SPtr<GUISkin> BuiltinEditorResources::generateGUISkin()
  523. {
  524. SPtr<GUISkin> skin = GUISkin::_createPtr();
  525. Path defaultFontPath = BuiltinDataFolder;
  526. defaultFontPath.append(DefaultFontFilename + ".asset");
  527. HFont defaultFont = gResources().load<Font>(defaultFontPath);
  528. Path defaultAAFontPath = BuiltinDataFolder;
  529. defaultAAFontPath.append(DefaultAAFontFilename + ".asset");
  530. HFont defaultAAFont = gResources().load<Font>(defaultAAFontPath);
  531. // Blank entry
  532. GUIElementStyle blankStyle;
  533. skin->setStyle("Blank", blankStyle);
  534. skin->setStyle(GUITexture::getGUITypeName(), blankStyle);
  535. // Label
  536. GUIElementStyle labelStyle;
  537. labelStyle.font = defaultFont;
  538. labelStyle.fontSize = DefaultFontSize;
  539. labelStyle.fixedWidth = false;
  540. labelStyle.fixedHeight = true;
  541. labelStyle.height = 14;
  542. labelStyle.minWidth = 10;
  543. labelStyle.normal.textColor = TextNormalColor;
  544. skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
  545. // Window frame
  546. GUIElementStyle windowFrameStyle;
  547. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  548. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  549. windowFrameStyle.border.left = 1;
  550. windowFrameStyle.border.right = 1;
  551. windowFrameStyle.border.top = 1;
  552. windowFrameStyle.border.bottom = 1;
  553. skin->setStyle("WindowFrame", windowFrameStyle);
  554. // Button
  555. GUIElementStyle buttonStyle;
  556. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  557. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  558. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  559. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  560. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  561. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  562. buttonStyle.normal.textColor = TextNormalColor;
  563. buttonStyle.hover.textColor = TextNormalColor;
  564. buttonStyle.active.textColor = TextActiveColor;
  565. buttonStyle.normalOn.textColor = TextActiveColor;
  566. buttonStyle.hoverOn.textColor = TextActiveColor;
  567. buttonStyle.activeOn.textColor = TextActiveColor;
  568. buttonStyle.border.left = 2;
  569. buttonStyle.border.right = 2;
  570. buttonStyle.border.top = 2;
  571. buttonStyle.border.bottom = 4;
  572. buttonStyle.contentOffset.top = 2;
  573. buttonStyle.contentOffset.left = 3;
  574. buttonStyle.contentOffset.right = 3;
  575. buttonStyle.margins.bottom = 2;
  576. buttonStyle.fixedHeight = true;
  577. buttonStyle.height = 21;
  578. buttonStyle.minWidth = 20;
  579. buttonStyle.font = defaultFont;
  580. buttonStyle.fontSize = DefaultFontSize;
  581. buttonStyle.textHorzAlign = THA_Center;
  582. buttonStyle.textVertAlign = TVA_Center;
  583. skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
  584. // Left edge button
  585. GUIElementStyle leftButtonStyle;
  586. leftButtonStyle.normal.texture = getGUITexture(ButtonLeftNormalTex);
  587. leftButtonStyle.hover.texture = getGUITexture(ButtonLeftHoverTex);
  588. leftButtonStyle.active.texture = getGUITexture(ButtonLeftActiveTex);
  589. leftButtonStyle.normalOn.texture = getGUITexture(ButtonLeftActiveTex);
  590. leftButtonStyle.hoverOn.texture = getGUITexture(ButtonLeftActiveTex);
  591. leftButtonStyle.activeOn.texture = getGUITexture(ButtonLeftActiveTex);
  592. leftButtonStyle.normal.textColor = TextNormalColor;
  593. leftButtonStyle.hover.textColor = TextNormalColor;
  594. leftButtonStyle.active.textColor = TextActiveColor;
  595. leftButtonStyle.normalOn.textColor = TextActiveColor;
  596. leftButtonStyle.hoverOn.textColor = TextActiveColor;
  597. leftButtonStyle.activeOn.textColor = TextActiveColor;
  598. leftButtonStyle.border.left = 7;
  599. leftButtonStyle.border.right = 2;
  600. leftButtonStyle.border.top = 2;
  601. leftButtonStyle.border.bottom = 4;
  602. leftButtonStyle.contentOffset.top = 2;
  603. leftButtonStyle.contentOffset.left = 7;
  604. leftButtonStyle.contentOffset.right = 3;
  605. leftButtonStyle.margins.bottom = 2;
  606. leftButtonStyle.fixedHeight = true;
  607. leftButtonStyle.height = 21;
  608. leftButtonStyle.minWidth = 20;
  609. leftButtonStyle.font = defaultFont;
  610. leftButtonStyle.fontSize = DefaultFontSize;
  611. leftButtonStyle.textHorzAlign = THA_Center;
  612. leftButtonStyle.textVertAlign = TVA_Center;
  613. skin->setStyle("ButtonLeft", leftButtonStyle);
  614. // Right edge button
  615. GUIElementStyle rightButtonStyle;
  616. rightButtonStyle.normal.texture = getGUITexture(ButtonRightNormalTex);
  617. rightButtonStyle.hover.texture = getGUITexture(ButtonRightHoverTex);
  618. rightButtonStyle.active.texture = getGUITexture(ButtonRightActiveTex);
  619. rightButtonStyle.normalOn.texture = getGUITexture(ButtonRightActiveTex);
  620. rightButtonStyle.hoverOn.texture = getGUITexture(ButtonRightActiveTex);
  621. rightButtonStyle.activeOn.texture = getGUITexture(ButtonRightActiveTex);
  622. rightButtonStyle.normal.textColor = TextNormalColor;
  623. rightButtonStyle.hover.textColor = TextNormalColor;
  624. rightButtonStyle.active.textColor = TextActiveColor;
  625. rightButtonStyle.normalOn.textColor = TextActiveColor;
  626. rightButtonStyle.hoverOn.textColor = TextActiveColor;
  627. rightButtonStyle.activeOn.textColor = TextActiveColor;
  628. rightButtonStyle.border.left = 2;
  629. rightButtonStyle.border.right = 7;
  630. rightButtonStyle.border.top = 2;
  631. rightButtonStyle.border.bottom = 4;
  632. rightButtonStyle.contentOffset.top = 2;
  633. rightButtonStyle.contentOffset.left = 3;
  634. rightButtonStyle.contentOffset.right = 7;
  635. rightButtonStyle.margins.bottom = 2;
  636. rightButtonStyle.fixedHeight = true;
  637. rightButtonStyle.height = 21;
  638. rightButtonStyle.minWidth = 20;
  639. rightButtonStyle.font = defaultFont;
  640. rightButtonStyle.fontSize = DefaultFontSize;
  641. rightButtonStyle.textHorzAlign = THA_Center;
  642. rightButtonStyle.textVertAlign = TVA_Center;
  643. skin->setStyle("ButtonRight", rightButtonStyle);
  644. // Toggle
  645. GUIElementStyle toggleStyle;
  646. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  647. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  648. toggleStyle.active.texture = toggleStyle.hover.texture;
  649. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  650. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  651. toggleStyle.activeOn.texture = toggleStyle.hoverOn.texture;
  652. toggleStyle.fixedHeight = true;
  653. toggleStyle.fixedWidth = true;
  654. toggleStyle.margins.bottom = 2;
  655. toggleStyle.height = 15;
  656. toggleStyle.width = 13;
  657. skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  658. // Color
  659. GUIElementStyle colorStyle;
  660. colorStyle.margins.left = 2;
  661. colorStyle.margins.right = 2;
  662. colorStyle.margins.top = 2;
  663. colorStyle.margins.bottom = 2;
  664. colorStyle.fixedHeight = true;
  665. colorStyle.height = 15;
  666. colorStyle.minWidth = 10;
  667. skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
  668. // Window background texture
  669. GUIElementStyle windowBgStyle;
  670. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTex);
  671. skin->setStyle("WindowBackground", windowBgStyle);
  672. // Window tab bar background
  673. GUIElementStyle tabBarBgStyle;
  674. tabBarBgStyle.normal.texture = getGUITexture(TabBarBackgroundTex);
  675. tabBarBgStyle.fixedHeight = true;
  676. tabBarBgStyle.height = 16;
  677. skin->setStyle("TabBarBackground", tabBarBgStyle);
  678. // Tabbed title bar tab button
  679. GUIElementStyle tabbedBarButton;
  680. tabbedBarButton.normal.texture = getGUITexture(TabButtonNormalTex);
  681. tabbedBarButton.hover.texture = tabbedBarButton.normal.texture;
  682. tabbedBarButton.active.texture = getGUITexture(TabButtonFocusedTex);
  683. tabbedBarButton.normalOn.texture = tabbedBarButton.active.texture;
  684. tabbedBarButton.hoverOn.texture = tabbedBarButton.active.texture;
  685. tabbedBarButton.activeOn.texture = tabbedBarButton.active.texture;
  686. tabbedBarButton.normal.textColor = TextNormalColor;
  687. tabbedBarButton.hover.textColor = TextNormalColor;
  688. tabbedBarButton.active.textColor = TextActiveColor;
  689. tabbedBarButton.normalOn.textColor = TextActiveColor;
  690. tabbedBarButton.hoverOn.textColor = TextActiveColor;
  691. tabbedBarButton.activeOn.textColor = TextActiveColor;
  692. tabbedBarButton.border.left = 12;
  693. tabbedBarButton.border.right = 12;
  694. tabbedBarButton.margins.left = 5;
  695. tabbedBarButton.margins.right = 5;
  696. tabbedBarButton.contentOffset.top = 3;
  697. tabbedBarButton.contentOffset.left = 6;
  698. tabbedBarButton.contentOffset.right = 6;
  699. tabbedBarButton.fixedHeight = true;
  700. tabbedBarButton.height = 15;
  701. tabbedBarButton.minWidth = 24;
  702. tabbedBarButton.maxWidth = 110;
  703. tabbedBarButton.font = defaultFont;
  704. tabbedBarButton.fontSize = DefaultFontSize;
  705. tabbedBarButton.textHorzAlign = THA_Center;
  706. tabbedBarButton.textVertAlign = TVA_Center;
  707. skin->setStyle("TabbedBarBtn", tabbedBarButton);
  708. // Tabbed title bar drag/drop button
  709. GUIElementStyle tabbedBarDropButton;
  710. tabbedBarDropButton.fixedHeight = true;
  711. tabbedBarDropButton.fixedWidth = true;
  712. tabbedBarDropButton.height = 13;
  713. tabbedBarDropButton.width = 6;
  714. skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
  715. // Window title bar background
  716. GUIElementStyle titleBarBgStyle;
  717. titleBarBgStyle.normal.texture = getGUITexture(TitleBarBackgroundTex);
  718. titleBarBgStyle.fixedHeight = true;
  719. titleBarBgStyle.height = 17;
  720. skin->setStyle("TitleBarBackground", titleBarBgStyle);
  721. // Window minimize button
  722. GUIElementStyle winMinButtonStyle;
  723. winMinButtonStyle.normal.texture = getGUITexture(MinButtonNormalTex);
  724. winMinButtonStyle.hover.texture = getGUITexture(MinButtonHoverTex);
  725. winMinButtonStyle.active.texture = getGUITexture(MinButtonActiveTex);
  726. winMinButtonStyle.fixedHeight = true;
  727. winMinButtonStyle.fixedWidth = true;
  728. winMinButtonStyle.height = 14;
  729. winMinButtonStyle.width = 14;
  730. skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
  731. // Window maximize button
  732. GUIElementStyle winMaxButtonStyle;
  733. winMaxButtonStyle.normal.texture = getGUITexture(MaxButtonNormalTex);
  734. winMaxButtonStyle.hover.texture = getGUITexture(MaxButtonHoverTex);
  735. winMaxButtonStyle.active.texture = getGUITexture(MaxButtonActiveTex);
  736. winMaxButtonStyle.fixedHeight = true;
  737. winMaxButtonStyle.fixedWidth = true;
  738. winMaxButtonStyle.height = 14;
  739. winMaxButtonStyle.width = 14;
  740. skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
  741. // Window close button
  742. GUIElementStyle winCloseButtonStyle;
  743. winCloseButtonStyle.normal.texture = getGUITexture(CloseButtonNormalTex);
  744. winCloseButtonStyle.hover.texture = getGUITexture(CloseButtonHoverTex);
  745. winCloseButtonStyle.active.texture = getGUITexture(CloseButtonActiveTex);
  746. winCloseButtonStyle.fixedHeight = true;
  747. winCloseButtonStyle.fixedWidth = true;
  748. winCloseButtonStyle.height = 14;
  749. winCloseButtonStyle.width = 14;
  750. skin->setStyle("WinCloseBtn", winCloseButtonStyle);
  751. // Input box
  752. GUIElementStyle inputBoxStyle;
  753. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  754. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  755. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  756. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  757. inputBoxStyle.normal.textColor = TextNormalColor;
  758. inputBoxStyle.hover.textColor = TextNormalColor;
  759. inputBoxStyle.focused.textColor = TextNormalColor;
  760. inputBoxStyle.active.textColor = TextNormalColor;
  761. inputBoxStyle.border.left = 1;
  762. inputBoxStyle.border.right = 3;
  763. inputBoxStyle.border.top = 4;
  764. inputBoxStyle.border.bottom = 1;
  765. inputBoxStyle.contentOffset.left = 4;
  766. inputBoxStyle.contentOffset.right = 4;
  767. inputBoxStyle.contentOffset.top = 4;
  768. inputBoxStyle.contentOffset.bottom = 4;
  769. inputBoxStyle.fixedHeight = true;
  770. inputBoxStyle.height = 19;
  771. inputBoxStyle.minWidth = 10;
  772. inputBoxStyle.font = defaultFont;
  773. inputBoxStyle.fontSize = DefaultFontSize;
  774. inputBoxStyle.textHorzAlign = THA_Left;
  775. inputBoxStyle.textVertAlign = TVA_Top;
  776. skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  777. /************************************************************************/
  778. /* SCROLL BAR */
  779. /************************************************************************/
  780. // Up button
  781. GUIElementStyle scrollUpBtnStyle;
  782. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  783. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  784. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  785. scrollUpBtnStyle.fixedHeight = true;
  786. scrollUpBtnStyle.fixedWidth = true;
  787. scrollUpBtnStyle.height = 11;
  788. scrollUpBtnStyle.width = 13;
  789. skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
  790. // Down button
  791. GUIElementStyle scrollDownBtnStyle;
  792. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  793. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  794. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  795. scrollDownBtnStyle.fixedHeight = true;
  796. scrollDownBtnStyle.fixedWidth = true;
  797. scrollDownBtnStyle.height = 11;
  798. scrollDownBtnStyle.width = 13;
  799. skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
  800. // Left button
  801. GUIElementStyle scrollLeftBtnStyle;
  802. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  803. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  804. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  805. scrollLeftBtnStyle.fixedHeight = true;
  806. scrollLeftBtnStyle.fixedWidth = true;
  807. scrollLeftBtnStyle.height = 13;
  808. scrollLeftBtnStyle.width = 11;
  809. skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  810. // Right button
  811. GUIElementStyle scrollRightBtnStyle;
  812. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  813. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  814. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  815. scrollRightBtnStyle.fixedHeight = true;
  816. scrollRightBtnStyle.fixedWidth = true;
  817. scrollRightBtnStyle.height = 13;
  818. scrollRightBtnStyle.width = 11;
  819. skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
  820. // Horizontal handle
  821. GUIElementStyle scrollBarHorzBtnStyle;
  822. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  823. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  824. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  825. scrollBarHorzBtnStyle.fixedHeight = true;
  826. scrollBarHorzBtnStyle.fixedWidth = false;
  827. scrollBarHorzBtnStyle.minWidth = 10;
  828. scrollBarHorzBtnStyle.height = 13;
  829. scrollBarHorzBtnStyle.border.left = 4;
  830. scrollBarHorzBtnStyle.border.right = 4;
  831. skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  832. // Vertical handle
  833. GUIElementStyle scrollBarVertBtnStyle;
  834. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  835. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  836. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  837. scrollBarVertBtnStyle.fixedHeight = false;
  838. scrollBarVertBtnStyle.fixedWidth = true;
  839. scrollBarVertBtnStyle.width = 13;
  840. scrollBarVertBtnStyle.minHeight = 10;
  841. scrollBarVertBtnStyle.border.top = 4;
  842. scrollBarVertBtnStyle.border.bottom = 4;
  843. skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  844. // Vertical scroll bar
  845. GUIElementStyle vertScrollBarStyle;
  846. vertScrollBarStyle.normal.texture = getGUITexture(ScrollBarVBgTex);
  847. vertScrollBarStyle.hover.texture = vertScrollBarStyle.normal.texture;
  848. vertScrollBarStyle.active.texture = vertScrollBarStyle.normal.texture;
  849. vertScrollBarStyle.fixedHeight = false;
  850. vertScrollBarStyle.fixedWidth = true;
  851. vertScrollBarStyle.minHeight = 8;
  852. vertScrollBarStyle.width = 16;
  853. vertScrollBarStyle.subStyles[GUIScrollBar::getVScrollHandleType()] = "ScrollBarVertBtn";
  854. vertScrollBarStyle.subStyles[GUIScrollBar::getHScrollHandleType()] = "ScrollBarHorzBtn";
  855. skin->setStyle("ScrollBarVert", vertScrollBarStyle);
  856. // Horizontal scroll bar
  857. GUIElementStyle horzScrollBarStyle;
  858. horzScrollBarStyle.normal.texture = getGUITexture(ScrollBarHBgTex);
  859. horzScrollBarStyle.hover.texture = horzScrollBarStyle.normal.texture;
  860. horzScrollBarStyle.active.texture = horzScrollBarStyle.normal.texture;
  861. horzScrollBarStyle.fixedHeight = true;
  862. horzScrollBarStyle.fixedWidth = false;
  863. horzScrollBarStyle.minWidth = 8;
  864. horzScrollBarStyle.height = 16;
  865. horzScrollBarStyle.subStyles[GUIScrollBar::getVScrollHandleType()] = "ScrollBarVertBtn";
  866. horzScrollBarStyle.subStyles[GUIScrollBar::getHScrollHandleType()] = "ScrollBarHorzBtn";
  867. skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
  868. // Horizontal resizeable handle
  869. GUIElementStyle scrollBarHorzResizeableBtnStyle;
  870. scrollBarHorzResizeableBtnStyle.normal.texture = getGUITexture(ScrollBarResizeableHandleHorzNormalTex);
  871. scrollBarHorzResizeableBtnStyle.hover.texture = getGUITexture(ScrollBarResizeableHandleHorzHoverTex);
  872. scrollBarHorzResizeableBtnStyle.active.texture = getGUITexture(ScrollBarResizeableHandleHorzActiveTex);
  873. scrollBarHorzResizeableBtnStyle.fixedHeight = true;
  874. scrollBarHorzResizeableBtnStyle.fixedWidth = false;
  875. scrollBarHorzResizeableBtnStyle.minWidth = 15;
  876. scrollBarHorzResizeableBtnStyle.height = 13;
  877. scrollBarHorzResizeableBtnStyle.border.left = 7;
  878. scrollBarHorzResizeableBtnStyle.border.right = 7;
  879. skin->setStyle("ScrollBarResizeableHorzBtn", scrollBarHorzResizeableBtnStyle);
  880. // Vertical resizeable handle
  881. GUIElementStyle scrollBarVertResizeableBtnStyle;
  882. scrollBarVertResizeableBtnStyle.normal.texture = getGUITexture(ScrollBarResizeableHandleVertNormalTex);
  883. scrollBarVertResizeableBtnStyle.hover.texture = getGUITexture(ScrollBarResizeableHandleVertHoverTex);
  884. scrollBarVertResizeableBtnStyle.active.texture = getGUITexture(ScrollBarResizeableHandleVertActiveTex);
  885. scrollBarVertResizeableBtnStyle.fixedHeight = false;
  886. scrollBarVertResizeableBtnStyle.fixedWidth = true;
  887. scrollBarVertResizeableBtnStyle.width = 13;
  888. scrollBarVertResizeableBtnStyle.minHeight = 15;
  889. scrollBarVertResizeableBtnStyle.border.top = 7;
  890. scrollBarVertResizeableBtnStyle.border.bottom = 7;
  891. skin->setStyle("ScrollBarResizeableVertBtn", scrollBarVertResizeableBtnStyle);
  892. // Vertical resizeable scroll bar
  893. GUIElementStyle vertResizeableScrollBarStyle;
  894. vertResizeableScrollBarStyle.normal.texture = getGUITexture(ScrollBarVBgTex);
  895. vertResizeableScrollBarStyle.hover.texture = vertResizeableScrollBarStyle.normal.texture;
  896. vertResizeableScrollBarStyle.active.texture = vertResizeableScrollBarStyle.normal.texture;
  897. vertResizeableScrollBarStyle.fixedHeight = false;
  898. vertResizeableScrollBarStyle.fixedWidth = true;
  899. vertResizeableScrollBarStyle.minHeight = 15;
  900. vertResizeableScrollBarStyle.width = 16;
  901. vertResizeableScrollBarStyle.subStyles[GUIScrollBar::getVScrollHandleType()] = "ScrollBarResizeableVertBtn";
  902. vertResizeableScrollBarStyle.subStyles[GUIScrollBar::getHScrollHandleType()] = "ScrollBarResizeableHorzBtn";
  903. skin->setStyle("ResizeableScrollBarVert", vertResizeableScrollBarStyle);
  904. // Horizontal resizeable scroll bar
  905. GUIElementStyle horzResizeableScrollBarStyle;
  906. horzResizeableScrollBarStyle.normal.texture = getGUITexture(ScrollBarHBgTex);
  907. horzResizeableScrollBarStyle.hover.texture = horzResizeableScrollBarStyle.normal.texture;
  908. horzResizeableScrollBarStyle.active.texture = horzResizeableScrollBarStyle.normal.texture;
  909. horzResizeableScrollBarStyle.fixedHeight = true;
  910. horzResizeableScrollBarStyle.fixedWidth = false;
  911. horzResizeableScrollBarStyle.minWidth = 15;
  912. horzResizeableScrollBarStyle.height = 16;
  913. horzResizeableScrollBarStyle.subStyles[GUIScrollBar::getVScrollHandleType()] = "ScrollBarResizeableVertBtn";
  914. horzResizeableScrollBarStyle.subStyles[GUIScrollBar::getHScrollHandleType()] = "ScrollBarResizeableHorzBtn";
  915. skin->setStyle("ResizeableScrollBarHorz", horzResizeableScrollBarStyle);
  916. /************************************************************************/
  917. /* DROP DOWN BOX */
  918. /************************************************************************/
  919. // ListBox button
  920. GUIElementStyle dropDownListStyle;
  921. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  922. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  923. dropDownListStyle.active.texture = getGUITexture(DropDownBtnActiveTex);
  924. dropDownListStyle.normalOn.texture = dropDownListStyle.active.texture;
  925. dropDownListStyle.hoverOn.texture = dropDownListStyle.active.texture;
  926. dropDownListStyle.activeOn.texture = dropDownListStyle.active.texture;
  927. dropDownListStyle.normal.textColor = TextNormalColor;
  928. dropDownListStyle.hover.textColor = TextNormalColor;
  929. dropDownListStyle.active.textColor = TextNormalColor;
  930. dropDownListStyle.normalOn.textColor = TextNormalColor;
  931. dropDownListStyle.hoverOn.textColor = TextNormalColor;
  932. dropDownListStyle.activeOn.textColor = TextNormalColor;
  933. dropDownListStyle.fixedHeight = true;
  934. dropDownListStyle.fixedWidth = false;
  935. dropDownListStyle.height = 21;
  936. dropDownListStyle.minWidth = 20;
  937. dropDownListStyle.contentOffset.left = 3;
  938. dropDownListStyle.contentOffset.right = 18;
  939. dropDownListStyle.contentOffset.top = 2;
  940. dropDownListStyle.contentOffset.bottom = 2;
  941. dropDownListStyle.border.left = 2;
  942. dropDownListStyle.border.right = 16;
  943. dropDownListStyle.border.top = 2;
  944. dropDownListStyle.border.bottom = 4;
  945. dropDownListStyle.margins.bottom = 2;
  946. dropDownListStyle.font = defaultFont;
  947. dropDownListStyle.fontSize = DefaultFontSize;
  948. dropDownListStyle.textHorzAlign = THA_Left;
  949. dropDownListStyle.textVertAlign = TVA_Center;
  950. skin->setStyle(GUIListBox::getGUITypeName(), dropDownListStyle);
  951. // DropDown scroll up button
  952. GUIElementStyle dropDownScrollUpBtnStyle;
  953. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  954. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  955. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  956. dropDownScrollUpBtnStyle.fixedHeight = true;
  957. dropDownScrollUpBtnStyle.fixedWidth = true;
  958. dropDownScrollUpBtnStyle.width = 8;
  959. dropDownScrollUpBtnStyle.height = 12;
  960. skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  961. skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  962. skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  963. // DropDown scroll down button
  964. GUIElementStyle dropDownScrollDownBtnStyle;
  965. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  966. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  967. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  968. dropDownScrollDownBtnStyle.fixedHeight = true;
  969. dropDownScrollDownBtnStyle.fixedWidth = true;
  970. dropDownScrollDownBtnStyle.width = 8;
  971. dropDownScrollDownBtnStyle.height = 12;
  972. skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  973. skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  974. skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  975. // DropDown handle
  976. GUIElementStyle dropDownScrollHandleStyle;
  977. dropDownScrollHandleStyle.normal.texture = getGUITexture(DropDownBoxHandleTex);
  978. dropDownScrollHandleStyle.fixedHeight = false;
  979. dropDownScrollHandleStyle.fixedWidth = true;
  980. dropDownScrollHandleStyle.height = 8;
  981. dropDownScrollHandleStyle.width = 8;
  982. skin->setStyle("ListBoxHandle", dropDownScrollHandleStyle);
  983. skin->setStyle("MenuBarHandle", dropDownScrollHandleStyle);
  984. skin->setStyle("ContextMenuHandle", dropDownScrollHandleStyle);
  985. // DropDown sidebar background
  986. GUIElementStyle dropDownSidebarBg;
  987. dropDownSidebarBg.normal.texture = getGUITexture(DropDownBoxSideBgTex);
  988. dropDownSidebarBg.fixedHeight = false;
  989. dropDownSidebarBg.fixedWidth = true;
  990. dropDownSidebarBg.height = 8;
  991. dropDownSidebarBg.width = 9;
  992. dropDownSidebarBg.border.left = 1;
  993. dropDownSidebarBg.border.top = 1;
  994. dropDownSidebarBg.border.bottom = 1;
  995. skin->setStyle("ListBoxSidebarBg", dropDownSidebarBg);
  996. skin->setStyle("MenuBarSidebarBg", dropDownSidebarBg);
  997. skin->setStyle("ContextMenuSidebarBg", dropDownSidebarBg);
  998. // DropDown entry button
  999. GUIElementStyle dropDownEntryBtnStyle;
  1000. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  1001. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  1002. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  1003. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  1004. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  1005. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  1006. dropDownEntryBtnStyle.normal.textColor = TextNormalColor;
  1007. dropDownEntryBtnStyle.hover.textColor = TextNormalColor;
  1008. dropDownEntryBtnStyle.active.textColor = TextNormalColor;
  1009. dropDownEntryBtnStyle.normalOn.textColor = TextNormalColor;
  1010. dropDownEntryBtnStyle.hoverOn.textColor = TextNormalColor;
  1011. dropDownEntryBtnStyle.activeOn.textColor = TextNormalColor;
  1012. dropDownEntryBtnStyle.fixedHeight = true;
  1013. dropDownEntryBtnStyle.fixedWidth = false;
  1014. dropDownEntryBtnStyle.height = 16;
  1015. dropDownEntryBtnStyle.width = 30;
  1016. dropDownEntryBtnStyle.font = defaultFont;
  1017. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  1018. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  1019. dropDownEntryBtnStyle.textVertAlign = TVA_Center;
  1020. skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  1021. // DropDown toggle entry button
  1022. GUIElementStyle dropDownToggleEntryBtnStyle;
  1023. dropDownToggleEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryToggleNormalTex);
  1024. dropDownToggleEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryToggleHoverTex);
  1025. dropDownToggleEntryBtnStyle.active.texture = dropDownToggleEntryBtnStyle.hover.texture;
  1026. dropDownToggleEntryBtnStyle.normalOn.texture = getGUITexture(DropDownBoxEntryToggleNormalOnTex);
  1027. dropDownToggleEntryBtnStyle.hoverOn.texture = getGUITexture(DropDownBoxEntryToggleHoverOnTex);
  1028. dropDownToggleEntryBtnStyle.activeOn.texture = dropDownToggleEntryBtnStyle.hoverOn.texture;
  1029. dropDownToggleEntryBtnStyle.normal.textColor = TextNormalColor;
  1030. dropDownToggleEntryBtnStyle.hover.textColor = TextNormalColor;
  1031. dropDownToggleEntryBtnStyle.active.textColor = TextNormalColor;
  1032. dropDownToggleEntryBtnStyle.normalOn.textColor = TextNormalColor;
  1033. dropDownToggleEntryBtnStyle.hoverOn.textColor = TextNormalColor;
  1034. dropDownToggleEntryBtnStyle.activeOn.textColor = TextNormalColor;
  1035. dropDownToggleEntryBtnStyle.fixedHeight = true;
  1036. dropDownToggleEntryBtnStyle.fixedWidth = false;
  1037. dropDownToggleEntryBtnStyle.height = 18;
  1038. dropDownToggleEntryBtnStyle.width = 30;
  1039. dropDownToggleEntryBtnStyle.border.left = 17;
  1040. dropDownToggleEntryBtnStyle.contentOffset.left = 17;
  1041. dropDownToggleEntryBtnStyle.font = defaultFont;
  1042. dropDownToggleEntryBtnStyle.fontSize = DefaultFontSize;
  1043. dropDownToggleEntryBtnStyle.textHorzAlign = THA_Left;
  1044. dropDownToggleEntryBtnStyle.textVertAlign = TVA_Center;
  1045. skin->setStyle(GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE, dropDownToggleEntryBtnStyle);
  1046. // DropDown entry button with expand
  1047. GUIElementStyle dropDownEntryExpBtnStyle;
  1048. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  1049. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  1050. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  1051. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  1052. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  1053. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  1054. dropDownEntryExpBtnStyle.normal.textColor = TextNormalColor;
  1055. dropDownEntryExpBtnStyle.hover.textColor = TextNormalColor;
  1056. dropDownEntryExpBtnStyle.active.textColor = TextNormalColor;
  1057. dropDownEntryExpBtnStyle.normalOn.textColor = TextNormalColor;
  1058. dropDownEntryExpBtnStyle.hoverOn.textColor = TextNormalColor;
  1059. dropDownEntryExpBtnStyle.activeOn.textColor = TextNormalColor;
  1060. dropDownEntryExpBtnStyle.fixedHeight = true;
  1061. dropDownEntryExpBtnStyle.fixedWidth = false;
  1062. dropDownEntryExpBtnStyle.height = 16;
  1063. dropDownEntryExpBtnStyle.width = 30;
  1064. dropDownEntryExpBtnStyle.border.right = 13;
  1065. dropDownEntryExpBtnStyle.font = defaultFont;
  1066. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  1067. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  1068. dropDownEntryExpBtnStyle.textVertAlign = TVA_Center;
  1069. skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  1070. // Drop down separator
  1071. GUIElementStyle dropDownSeparatorStyle;
  1072. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  1073. dropDownSeparatorStyle.fixedHeight = true;
  1074. dropDownSeparatorStyle.fixedWidth = false;
  1075. dropDownSeparatorStyle.height = 3;
  1076. dropDownSeparatorStyle.width = 30;
  1077. skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  1078. // Drop down content
  1079. GUIElementStyle dropDownContentStyle;
  1080. dropDownContentStyle.minWidth = 50;
  1081. dropDownContentStyle.minHeight = 20;
  1082. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE] = GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE;
  1083. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  1084. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  1085. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  1086. skin->setStyle("ListBoxContent", dropDownContentStyle);
  1087. skin->setStyle("MenuBarContent", dropDownContentStyle);
  1088. skin->setStyle("ContextMenuContent", dropDownContentStyle);
  1089. // DropDown box frame
  1090. GUIElementStyle dropDownBoxStyle;
  1091. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  1092. dropDownBoxStyle.hover.texture = dropDownBoxStyle.normal.texture;
  1093. dropDownBoxStyle.active.texture = dropDownBoxStyle.hover.texture;
  1094. dropDownBoxStyle.fixedHeight = false;
  1095. dropDownBoxStyle.fixedWidth = false;
  1096. dropDownBoxStyle.border.left = 2;
  1097. dropDownBoxStyle.border.right = 2;
  1098. dropDownBoxStyle.border.top = 2;
  1099. dropDownBoxStyle.border.bottom = 4;
  1100. dropDownBoxStyle.margins.left = 6;
  1101. dropDownBoxStyle.margins.right = 6;
  1102. dropDownBoxStyle.margins.top = 4;
  1103. dropDownBoxStyle.margins.bottom = 6;
  1104. skin->setStyle("ListBoxFrame", dropDownBoxStyle);
  1105. skin->setStyle("MenuBarFrame", dropDownBoxStyle);
  1106. skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
  1107. /************************************************************************/
  1108. /* TOOLTIP */
  1109. /************************************************************************/
  1110. GUIElementStyle tooltipFrameStyle;
  1111. tooltipFrameStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  1112. tooltipFrameStyle.hover.texture = tooltipFrameStyle.normal.texture;
  1113. tooltipFrameStyle.active.texture = tooltipFrameStyle.hover.texture;
  1114. tooltipFrameStyle.fixedHeight = false;
  1115. tooltipFrameStyle.fixedWidth = false;
  1116. tooltipFrameStyle.border.left = 2;
  1117. tooltipFrameStyle.border.right = 2;
  1118. tooltipFrameStyle.border.top = 2;
  1119. tooltipFrameStyle.border.bottom = 4;
  1120. tooltipFrameStyle.margins.left = 6;
  1121. tooltipFrameStyle.margins.right = 6;
  1122. tooltipFrameStyle.margins.top = 4;
  1123. tooltipFrameStyle.margins.bottom = 6;
  1124. skin->setStyle(GUITooltip::getFrameStyleName(), tooltipFrameStyle);
  1125. /************************************************************************/
  1126. /* MENU BAR */
  1127. /************************************************************************/
  1128. // MenuBar background
  1129. GUIElementStyle menuBarBgStyle;
  1130. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  1131. menuBarBgStyle.height = 14;
  1132. menuBarBgStyle.width = 2;
  1133. menuBarBgStyle.border.bottom = 2;
  1134. skin->setStyle(GUIMenuBar::getBackgroundStyleType(), menuBarBgStyle);
  1135. // MenuBar separator line
  1136. GUIElementStyle menuBarLineStyle;
  1137. menuBarLineStyle.normal.texture = getGUITexture(MenuBarLineNormalTex);
  1138. menuBarLineStyle.normalOn.texture = getGUITexture(MenuBarLineActiveTex);
  1139. menuBarLineStyle.fixedHeight = true;
  1140. menuBarLineStyle.height = 1;
  1141. skin->setStyle(GUIMenuBar::getLineStyleType(), menuBarLineStyle);
  1142. // MenuBar Banshee logo
  1143. GUIElementStyle menuBarBansheeLogoStyle;
  1144. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  1145. menuBarBansheeLogoStyle.fixedHeight = true;
  1146. menuBarBansheeLogoStyle.fixedWidth = true;
  1147. menuBarBansheeLogoStyle.height = 46;
  1148. menuBarBansheeLogoStyle.width = 46;
  1149. skin->setStyle(GUIMenuBar::getLogoStyleType(), menuBarBansheeLogoStyle);
  1150. // MenuBar button
  1151. GUIElementStyle menuBarBtnStyle;
  1152. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  1153. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  1154. menuBarBtnStyle.active.texture = getGUITexture(MenuBarBtnActiveTex);
  1155. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.active.texture;
  1156. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.active.texture;
  1157. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.active.texture;
  1158. menuBarBtnStyle.normal.textColor = TextNormalColor;
  1159. menuBarBtnStyle.hover.textColor = TextNormalColor;
  1160. menuBarBtnStyle.active.textColor = TextActiveColor;
  1161. menuBarBtnStyle.normalOn.textColor = TextActiveColor;
  1162. menuBarBtnStyle.hoverOn.textColor = TextActiveColor;
  1163. menuBarBtnStyle.activeOn.textColor = TextActiveColor;
  1164. menuBarBtnStyle.fixedHeight = true;
  1165. menuBarBtnStyle.fixedWidth = false;
  1166. menuBarBtnStyle.height = 14;
  1167. menuBarBtnStyle.width = 4;
  1168. menuBarBtnStyle.margins.left = 2;
  1169. menuBarBtnStyle.margins.right = 2;
  1170. menuBarBtnStyle.margins.top = 2;
  1171. menuBarBtnStyle.margins.bottom = 2;
  1172. menuBarBtnStyle.font = defaultFont;
  1173. menuBarBtnStyle.fontSize = DefaultFontSize;
  1174. menuBarBtnStyle.textHorzAlign = THA_Left;
  1175. menuBarBtnStyle.textVertAlign = TVA_Top;
  1176. skin->setStyle(GUIMenuBar::getMenuItemButtonStyleType(), menuBarBtnStyle);
  1177. // ToolBar separator
  1178. GUIElementStyle toolBarSeparator;
  1179. toolBarSeparator.normal.texture = getGUITexture(ToolBarSeparatorTex);
  1180. toolBarSeparator.fixedWidth = true;
  1181. toolBarSeparator.width = 3;
  1182. toolBarSeparator.height = 32;
  1183. skin->setStyle(GUIMenuBar::getToolBarSeparatorStyleType(), toolBarSeparator);
  1184. // ToolBar button
  1185. GUIElementStyle toolBarBtnStyle;
  1186. toolBarBtnStyle.normal.texture = getGUITexture(ToolBarBtnNormalTex);
  1187. toolBarBtnStyle.hover.texture = getGUITexture(ToolBarBtnHoverTex);
  1188. toolBarBtnStyle.active.texture = getGUITexture(ToolBarBtnActiveTex);
  1189. toolBarBtnStyle.normalOn.texture = getGUITexture(ToolBarBtnActiveTex);
  1190. toolBarBtnStyle.hoverOn.texture = getGUITexture(ToolBarBtnActiveTex);
  1191. toolBarBtnStyle.activeOn.texture = getGUITexture(ToolBarBtnActiveTex);
  1192. toolBarBtnStyle.normal.textColor = TextNormalColor;
  1193. toolBarBtnStyle.hover.textColor = TextNormalColor;
  1194. toolBarBtnStyle.active.textColor = TextActiveColor;
  1195. toolBarBtnStyle.normalOn.textColor = TextNormalColor;
  1196. toolBarBtnStyle.hoverOn.textColor = TextNormalColor;
  1197. toolBarBtnStyle.activeOn.textColor = TextActiveColor;
  1198. toolBarBtnStyle.fixedHeight = true;
  1199. toolBarBtnStyle.fixedWidth = true;
  1200. toolBarBtnStyle.height = 32;
  1201. toolBarBtnStyle.width = 32;
  1202. skin->setStyle(GUIMenuBar::getToolBarButtonStyleType(), toolBarBtnStyle);
  1203. /************************************************************************/
  1204. /* SEPARATOR */
  1205. /************************************************************************/
  1206. GUIElementStyle separator;
  1207. separator.normal.texture = getGUITexture("Separator.png");
  1208. separator.hover.texture = separator.normal.texture;
  1209. separator.active.texture = separator.normal.texture;
  1210. separator.fixedHeight = false;
  1211. separator.fixedWidth = false;
  1212. separator.height = 2;
  1213. separator.width = 2;
  1214. skin->setStyle("Separator", separator);
  1215. /************************************************************************/
  1216. /* HEADER */
  1217. /************************************************************************/
  1218. GUIElementStyle headerBackground;
  1219. headerBackground.normal.texture = getGUITexture("HeaderBg.png");
  1220. skin->setStyle("HeaderBackground", headerBackground);
  1221. GUIElementStyle header;
  1222. header.normal.texture = getGUITexture("Header.png");
  1223. header.normal.textColor = TextNormalColor;
  1224. header.border.bottom = 2;
  1225. header.fixedHeight = true;
  1226. header.height = 21;
  1227. header.minWidth = 4;
  1228. header.minHeight = 4;
  1229. header.font = defaultFont;
  1230. header.fontSize = DefaultFontSize;
  1231. header.textHorzAlign = THA_Center;
  1232. header.textVertAlign = TVA_Center;
  1233. skin->setStyle("Header", header);
  1234. /************************************************************************/
  1235. /* TREE VIEW */
  1236. /************************************************************************/
  1237. // Expand button
  1238. GUIElementStyle expandButtonStyle;
  1239. expandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  1240. expandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  1241. expandButtonStyle.active.texture = expandButtonStyle.hover.texture;
  1242. expandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  1243. expandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  1244. expandButtonStyle.activeOn.texture = expandButtonStyle.hoverOn.texture;
  1245. expandButtonStyle.fixedHeight = true;
  1246. expandButtonStyle.fixedWidth = true;
  1247. expandButtonStyle.height = 10;
  1248. expandButtonStyle.width = 11;
  1249. expandButtonStyle.normal.textColor = TextNormalColor;
  1250. expandButtonStyle.hover.textColor = TextNormalColor;
  1251. expandButtonStyle.active.textColor = TextNormalColor;
  1252. expandButtonStyle.normalOn.textColor = TextNormalColor;
  1253. expandButtonStyle.hoverOn.textColor = TextNormalColor;
  1254. expandButtonStyle.activeOn.textColor = TextNormalColor;
  1255. expandButtonStyle.font = defaultFont;
  1256. expandButtonStyle.fontSize = DefaultFontSize;
  1257. expandButtonStyle.textHorzAlign = THA_Left;
  1258. expandButtonStyle.textVertAlign = TVA_Center;
  1259. expandButtonStyle.contentOffset = RectOffset(16, 0, 0, 0);
  1260. expandButtonStyle.border.left = 10;
  1261. skin->setStyle("Expand", expandButtonStyle);
  1262. // Entry
  1263. GUIElementStyle treeViewEntryStyle;
  1264. treeViewEntryStyle.font = defaultFont;
  1265. treeViewEntryStyle.fontSize = DefaultFontSize;
  1266. treeViewEntryStyle.fixedWidth = false;
  1267. treeViewEntryStyle.fixedHeight = true;
  1268. treeViewEntryStyle.height = 16;
  1269. treeViewEntryStyle.minWidth = 10;
  1270. treeViewEntryStyle.normal.textColor = TextNormalColor;
  1271. skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
  1272. // Background
  1273. GUIElementStyle treeViewBackgroundStyle;
  1274. skin->setStyle("TreeViewBackground", treeViewBackgroundStyle);
  1275. // Selection background
  1276. GUIElementStyle treeViewSelBackgroundStyle;
  1277. treeViewSelBackgroundStyle.normal.texture = getGUITexture(SelectionBgTex);
  1278. treeViewSelBackgroundStyle.fixedHeight = false;
  1279. treeViewSelBackgroundStyle.fixedWidth = false;
  1280. treeViewSelBackgroundStyle.height = 2;
  1281. treeViewSelBackgroundStyle.width = 2;
  1282. skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  1283. // Highlight background
  1284. GUIElementStyle treeViewHLBackgroundStyle;
  1285. treeViewHLBackgroundStyle.normal.texture = getGUITexture(TreeViewHighlightBackground);
  1286. treeViewHLBackgroundStyle.fixedHeight = false;
  1287. treeViewHLBackgroundStyle.fixedWidth = false;
  1288. treeViewHLBackgroundStyle.height = 2;
  1289. treeViewHLBackgroundStyle.width = 2;
  1290. skin->setStyle("TreeViewHighlightBackground", treeViewHLBackgroundStyle);
  1291. // Edit box
  1292. GUIElementStyle treeViewEditBox;
  1293. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  1294. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  1295. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  1296. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  1297. treeViewEditBox.normal.textColor = TextNormalColor;
  1298. treeViewEditBox.hover.textColor = TextNormalColor;
  1299. treeViewEditBox.focused.textColor = TextNormalColor;
  1300. treeViewEditBox.active.textColor = TextNormalColor;
  1301. treeViewEditBox.border.left = 1;
  1302. treeViewEditBox.border.right = 1;
  1303. treeViewEditBox.border.top = 1;
  1304. treeViewEditBox.border.bottom = 1;
  1305. treeViewEditBox.margins.left = 1;
  1306. treeViewEditBox.margins.right = 1;
  1307. treeViewEditBox.margins.top = 1;
  1308. treeViewEditBox.margins.bottom = 1;
  1309. treeViewEditBox.fixedHeight = true;
  1310. treeViewEditBox.height = 13;
  1311. treeViewEditBox.minWidth = 10;
  1312. treeViewEditBox.font = defaultFont;
  1313. treeViewEditBox.fontSize = DefaultFontSize;
  1314. treeViewEditBox.textHorzAlign = THA_Left;
  1315. treeViewEditBox.textVertAlign = TVA_Top;
  1316. skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  1317. // Element highlight
  1318. GUIElementStyle treeViewElementHighlight;
  1319. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  1320. treeViewElementHighlight.border.left = 1;
  1321. treeViewElementHighlight.border.right = 1;
  1322. treeViewElementHighlight.border.top = 1;
  1323. treeViewElementHighlight.border.bottom = 1;
  1324. skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  1325. // Element separator highlight
  1326. GUIElementStyle treeViewElementSepHighlight;
  1327. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  1328. treeViewElementSepHighlight.border.left = 1;
  1329. treeViewElementSepHighlight.border.right = 1;
  1330. treeViewElementSepHighlight.border.top = 1;
  1331. treeViewElementSepHighlight.border.bottom = 1;
  1332. skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  1333. /************************************************************************/
  1334. /* OBJECT DROP FIELD */
  1335. /************************************************************************/
  1336. GUIElementStyle objectDropStyle;
  1337. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  1338. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  1339. objectDropStyle.hover.texture = objectDropStyle.normal.texture;
  1340. objectDropStyle.hoverOn.texture = objectDropStyle.normalOn.texture;
  1341. objectDropStyle.active.texture = objectDropStyle.normal.texture;
  1342. objectDropStyle.activeOn.texture = objectDropStyle.normalOn.texture;
  1343. objectDropStyle.normal.textColor = TextNormalColor;
  1344. objectDropStyle.hover.textColor = TextNormalColor;
  1345. objectDropStyle.active.textColor = TextNormalColor;
  1346. objectDropStyle.normalOn.textColor = TextNormalColor;
  1347. objectDropStyle.hoverOn.textColor = TextNormalColor;
  1348. objectDropStyle.activeOn.textColor = TextNormalColor;
  1349. objectDropStyle.border.left = 2;
  1350. objectDropStyle.border.top = 2;
  1351. objectDropStyle.border.bottom = 4;
  1352. objectDropStyle.contentOffset.left = 3;
  1353. objectDropStyle.contentOffset.right = 1;
  1354. objectDropStyle.margins.bottom = 2;
  1355. objectDropStyle.fixedHeight = true;
  1356. objectDropStyle.height = 21;
  1357. objectDropStyle.minWidth = 20;
  1358. objectDropStyle.font = defaultFont;
  1359. objectDropStyle.fontSize = DefaultFontSize;
  1360. objectDropStyle.textHorzAlign = THA_Center;
  1361. objectDropStyle.textVertAlign = TVA_Center;
  1362. skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  1363. GUIElementStyle objectClearBtnStyle;
  1364. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  1365. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  1366. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  1367. objectClearBtnStyle.fixedHeight = true;
  1368. objectClearBtnStyle.fixedWidth = true;
  1369. objectClearBtnStyle.height = 21;
  1370. objectClearBtnStyle.width = 16;
  1371. objectClearBtnStyle.margins.bottom = 2;
  1372. skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  1373. GUIElementStyle editorObjectFieldStyle;
  1374. editorObjectFieldStyle.fixedHeight = true;
  1375. editorObjectFieldStyle.height = 21;
  1376. editorObjectFieldStyle.minWidth = 30;
  1377. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  1378. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  1379. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  1380. skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  1381. /************************************************************************/
  1382. /* TEXTURE DROP FIELD */
  1383. /************************************************************************/
  1384. GUIElementStyle textureFieldStyle;
  1385. textureFieldStyle.minHeight = 15;
  1386. textureFieldStyle.minWidth = 15;
  1387. textureFieldStyle.subStyles[TextureFieldDropStyleName] = TextureFieldDropStyleName;
  1388. textureFieldStyle.subStyles[TextureFieldClearBtnStyleName] = TextureFieldClearBtnStyleName;
  1389. textureFieldStyle.subStyles[TextureFieldLabelStyleName] = GUITextField::getLabelStyleType();
  1390. skin->setStyle(TextureFieldStyleName, textureFieldStyle);
  1391. GUIElementStyle textureDropStyle;
  1392. textureDropStyle.font = defaultFont;
  1393. textureDropStyle.fontSize = DefaultFontSize;
  1394. textureDropStyle.textHorzAlign = THA_Center;
  1395. textureDropStyle.textVertAlign = TVA_Center;
  1396. textureDropStyle.normal.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
  1397. textureDropStyle.normal.texture = getGUITexture(TextureDropTex);
  1398. textureDropStyle.hover.textColor = textureDropStyle.normal.textColor;
  1399. textureDropStyle.hover.texture = textureDropStyle.normal.texture;
  1400. textureDropStyle.active.textColor = textureDropStyle.normal.textColor;
  1401. textureDropStyle.active.texture = textureDropStyle.normal.texture;
  1402. textureDropStyle.normalOn.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
  1403. textureDropStyle.normalOn.texture = getGUITexture(TextureDropOnTex);
  1404. textureDropStyle.hoverOn.textColor = textureDropStyle.normalOn.textColor;
  1405. textureDropStyle.hoverOn.texture = textureDropStyle.normalOn.texture;
  1406. textureDropStyle.activeOn.textColor = textureDropStyle.normalOn.textColor;
  1407. textureDropStyle.activeOn.texture = textureDropStyle.normalOn.texture;
  1408. textureDropStyle.height = 84;
  1409. textureDropStyle.width = 82;
  1410. textureDropStyle.fixedHeight = true;
  1411. textureDropStyle.fixedWidth = true;
  1412. textureDropStyle.border.left = 2;
  1413. textureDropStyle.border.right = 2;
  1414. textureDropStyle.border.top = 2;
  1415. textureDropStyle.border.bottom = 4;
  1416. textureDropStyle.contentOffset.left = 4;
  1417. textureDropStyle.contentOffset.right = 4;
  1418. textureDropStyle.contentOffset.top = 4;
  1419. textureDropStyle.contentOffset.bottom = 4;
  1420. skin->setStyle(TextureFieldDropStyleName, textureDropStyle);
  1421. GUIElementStyle textureDropClearStyle;
  1422. textureDropClearStyle.normal.texture = getGUITexture(XButtonNormalTex);
  1423. textureDropClearStyle.hover.texture = getGUITexture(XButtonHoverTex);
  1424. textureDropClearStyle.active.texture = getGUITexture(XButtonActiveTex);
  1425. textureDropClearStyle.fixedWidth = true;
  1426. textureDropClearStyle.fixedHeight = true;
  1427. textureDropClearStyle.height = 10;
  1428. textureDropClearStyle.width = 10;
  1429. skin->setStyle(TextureFieldClearBtnStyleName, textureDropClearStyle);
  1430. /************************************************************************/
  1431. /* EDITOR FIELDS */
  1432. /************************************************************************/
  1433. GUIElementStyle editorFieldLabelStyle;
  1434. editorFieldLabelStyle.font = defaultFont;
  1435. editorFieldLabelStyle.fontSize = DefaultFontSize;
  1436. editorFieldLabelStyle.normal.textColor = TextNormalColor;
  1437. editorFieldLabelStyle.fixedWidth = false;
  1438. editorFieldLabelStyle.fixedHeight = true;
  1439. editorFieldLabelStyle.height = 14;
  1440. editorFieldLabelStyle.minWidth = 10;
  1441. editorFieldLabelStyle.textHorzAlign = THA_Left;
  1442. skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  1443. GUIElementStyle editorIntFieldStyle;
  1444. editorIntFieldStyle.fixedHeight = true;
  1445. editorIntFieldStyle.height = 21;
  1446. editorIntFieldStyle.minWidth = 30;
  1447. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1448. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  1449. skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  1450. GUIElementStyle editorFloatFieldStyle;
  1451. editorFloatFieldStyle.fixedHeight = true;
  1452. editorFloatFieldStyle.height = 21;
  1453. editorFloatFieldStyle.minWidth = 30;
  1454. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1455. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  1456. skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  1457. GUIElementStyle editorTextFieldStyle;
  1458. editorTextFieldStyle.fixedHeight = true;
  1459. editorTextFieldStyle.height = 21;
  1460. editorTextFieldStyle.minWidth = 30;
  1461. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1462. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  1463. skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  1464. GUIElementStyle editorColorFieldStyle;
  1465. editorColorFieldStyle.fixedHeight = true;
  1466. editorColorFieldStyle.height = 21;
  1467. editorColorFieldStyle.minWidth = 30;
  1468. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1469. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  1470. skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  1471. GUIElementStyle editorToggleFieldStyle;
  1472. editorToggleFieldStyle.fixedHeight = true;
  1473. editorToggleFieldStyle.height = 15;
  1474. editorToggleFieldStyle.minWidth = 30;
  1475. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1476. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  1477. skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  1478. GUIElementStyle editorVector2FieldStyle;
  1479. editorVector2FieldStyle.fixedHeight = true;
  1480. editorVector2FieldStyle.height = 35;
  1481. editorVector2FieldStyle.minWidth = 30;
  1482. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1483. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  1484. skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  1485. GUIElementStyle editorVector3FieldStyle;
  1486. editorVector3FieldStyle.fixedHeight = true;
  1487. editorVector3FieldStyle.height = 35;
  1488. editorVector3FieldStyle.minWidth = 30;
  1489. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1490. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  1491. skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  1492. GUIElementStyle editorVector4FieldStyle;
  1493. editorVector4FieldStyle.fixedHeight = true;
  1494. editorVector4FieldStyle.height = 35;
  1495. editorVector4FieldStyle.minWidth = 30;
  1496. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  1497. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  1498. skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  1499. GUIElementStyle editorListBoxFieldStyle;
  1500. editorListBoxFieldStyle.fixedHeight = true;
  1501. editorListBoxFieldStyle.height = 21;
  1502. editorListBoxFieldStyle.minWidth = 30;
  1503. editorListBoxFieldStyle.subStyles[GUIListBoxField::getLabelStyleType()] = GUIListBoxField::getLabelStyleType();
  1504. editorListBoxFieldStyle.subStyles[GUIListBoxField::getListBoxStyleType()] = GUIListBox::getGUITypeName();
  1505. skin->setStyle(GUIListBoxField::getGUITypeName(), editorListBoxFieldStyle);
  1506. GUIElementStyle editorSliderFieldStyle;
  1507. editorSliderFieldStyle.fixedHeight = true;
  1508. editorSliderFieldStyle.height = 21;
  1509. editorSliderFieldStyle.minWidth = 30;
  1510. editorSliderFieldStyle.subStyles[GUISliderField::getLabelStyleType()] = GUISliderField::getLabelStyleType();
  1511. editorSliderFieldStyle.subStyles[GUISliderField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  1512. editorSliderFieldStyle.subStyles[GUISliderField::getSliderStyleType()] = GUISliderHorz::getGUITypeName();
  1513. skin->setStyle(GUISliderField::getGUITypeName(), editorSliderFieldStyle);
  1514. /************************************************************************/
  1515. /* FOLDOUT */
  1516. /************************************************************************/
  1517. GUIElementStyle foldoutStyle;
  1518. foldoutStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  1519. foldoutStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  1520. foldoutStyle.active.texture = getGUITexture(FoldoutOpenActiveTex);
  1521. foldoutStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  1522. foldoutStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  1523. foldoutStyle.activeOn.texture = getGUITexture(FoldoutOpenActiveTex);
  1524. foldoutStyle.normal.textColor = TextNormalColor;
  1525. foldoutStyle.hover.textColor = TextNormalColor;
  1526. foldoutStyle.active.textColor = TextNormalColor;
  1527. foldoutStyle.normalOn.textColor = TextNormalColor;
  1528. foldoutStyle.hoverOn.textColor = TextNormalColor;
  1529. foldoutStyle.activeOn.textColor = TextNormalColor;
  1530. foldoutStyle.fixedHeight = true;
  1531. foldoutStyle.fixedWidth = false;
  1532. foldoutStyle.height = 21;
  1533. foldoutStyle.minWidth = 17;
  1534. foldoutStyle.font = defaultFont;
  1535. foldoutStyle.fontSize = DefaultFontSize;
  1536. foldoutStyle.textHorzAlign = THA_Left;
  1537. foldoutStyle.textVertAlign = TVA_Center;
  1538. foldoutStyle.contentOffset = RectOffset(16, 0, 0, 0);
  1539. foldoutStyle.border.left = 15;
  1540. foldoutStyle.border.right = 2;
  1541. foldoutStyle.border.top = 2;
  1542. foldoutStyle.border.bottom = 4;
  1543. skin->setStyle("Foldout", foldoutStyle);
  1544. /************************************************************************/
  1545. /* PROGRESS BAR */
  1546. /************************************************************************/
  1547. GUIElementStyle progressBarBgStyle;
  1548. progressBarBgStyle.fixedHeight = true;
  1549. progressBarBgStyle.height = 17;
  1550. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  1551. progressBarBgStyle.border.left = 8;
  1552. progressBarBgStyle.border.right = 8;
  1553. skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  1554. GUIElementStyle progressBarFillStyle;
  1555. progressBarFillStyle.fixedHeight = true;
  1556. progressBarFillStyle.height = 16;
  1557. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  1558. progressBarFillStyle.border.left = 9;
  1559. progressBarFillStyle.border.right = 10;
  1560. skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  1561. GUIElementStyle progressBarStyle;
  1562. progressBarStyle.fixedHeight = true;
  1563. progressBarStyle.height = 17;
  1564. progressBarStyle.minWidth = 100;
  1565. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  1566. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  1567. skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  1568. /************************************************************************/
  1569. /* SLIDER */
  1570. /************************************************************************/
  1571. GUIElementStyle sliderHandleStyle;
  1572. sliderHandleStyle.fixedHeight = true;
  1573. sliderHandleStyle.fixedWidth = true;
  1574. sliderHandleStyle.width = 12;
  1575. sliderHandleStyle.height = 13;
  1576. sliderHandleStyle.normal.texture = getGUITexture(SliderHandleNormalTex);
  1577. sliderHandleStyle.hover.texture = getGUITexture(SliderHandleHoverTex);
  1578. sliderHandleStyle.active.texture = getGUITexture(SliderHandleActiveTex);
  1579. skin->setStyle(GUISlider::getHandleStyleType(), sliderHandleStyle);
  1580. GUIElementStyle sliderHorizontalBgStyle;
  1581. sliderHorizontalBgStyle.fixedHeight = true;
  1582. sliderHorizontalBgStyle.height = 10;
  1583. sliderHorizontalBgStyle.normal.texture = getGUITexture(SliderHBackgroundTex);
  1584. sliderHorizontalBgStyle.border.left = 4;
  1585. sliderHorizontalBgStyle.border.right = 4;
  1586. skin->setStyle("SliderHorzBg", sliderHorizontalBgStyle);
  1587. GUIElementStyle sliderHorizontalFillStyle;
  1588. sliderHorizontalFillStyle.fixedHeight = true;
  1589. sliderHorizontalFillStyle.height = 10;
  1590. sliderHorizontalFillStyle.normal.texture = getGUITexture(SliderHFillTex);
  1591. sliderHorizontalFillStyle.border.left = 6;
  1592. sliderHorizontalFillStyle.border.right = 4;
  1593. skin->setStyle("SliderHorzFill", sliderHorizontalFillStyle);
  1594. GUIElementStyle sliderHorizontalStyle;
  1595. sliderHorizontalStyle.fixedHeight = true;
  1596. sliderHorizontalStyle.height = 13;
  1597. sliderHorizontalStyle.width = 150;
  1598. sliderHorizontalStyle.minWidth = 10;
  1599. sliderHorizontalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
  1600. sliderHorizontalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderHorzBg";
  1601. sliderHorizontalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderHorzFill";
  1602. skin->setStyle(GUISliderHorz::getGUITypeName(), sliderHorizontalStyle);
  1603. GUIElementStyle sliderVerticalBgStyle;
  1604. sliderVerticalBgStyle.fixedWidth = true;
  1605. sliderVerticalBgStyle.width = 10;
  1606. sliderVerticalBgStyle.normal.texture = getGUITexture(SliderVBackgroundTex);
  1607. sliderVerticalBgStyle.border.top = 4;
  1608. sliderVerticalBgStyle.border.bottom = 4;
  1609. skin->setStyle("SliderVertBg", sliderVerticalBgStyle);
  1610. GUIElementStyle sliderVerticalFillStyle;
  1611. sliderVerticalFillStyle.fixedWidth = true;
  1612. sliderVerticalFillStyle.width = 10;
  1613. sliderVerticalFillStyle.normal.texture = getGUITexture(SliderVFillTex);
  1614. sliderVerticalFillStyle.border.top = 6;
  1615. sliderVerticalFillStyle.border.bottom = 4;
  1616. skin->setStyle("SliderVertFill", sliderVerticalFillStyle);
  1617. GUIElementStyle sliderVerticalStyle;
  1618. sliderVerticalStyle.fixedWidth = true;
  1619. sliderVerticalStyle.width = 13;
  1620. sliderVerticalStyle.height = 150;
  1621. sliderVerticalStyle.minHeight = 10;
  1622. sliderVerticalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
  1623. sliderVerticalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderVertBg";
  1624. sliderVerticalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderVertFill";
  1625. skin->setStyle(GUISliderVert::getGUITypeName(), sliderVerticalStyle);
  1626. /************************************************************************/
  1627. /* COLOR PICKER SLIDER */
  1628. /************************************************************************/
  1629. GUIElementStyle colorPickerSliderHorzHandleStyle;
  1630. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  1631. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  1632. colorPickerSliderHorzHandleStyle.height = 20;
  1633. colorPickerSliderHorzHandleStyle.width = 7;
  1634. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  1635. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  1636. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  1637. skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  1638. GUIElementStyle colorPickerSliderHorzStyle;
  1639. colorPickerSliderHorzStyle.fixedHeight = true;
  1640. colorPickerSliderHorzStyle.height = 32;
  1641. colorPickerSliderHorzStyle.minWidth = 20;
  1642. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  1643. skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  1644. GUIElementStyle colorPickerSliderVertHandleStyle;
  1645. colorPickerSliderVertHandleStyle.fixedHeight = true;
  1646. colorPickerSliderVertHandleStyle.fixedWidth = true;
  1647. colorPickerSliderVertHandleStyle.height = 7;
  1648. colorPickerSliderVertHandleStyle.width = 45;
  1649. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  1650. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  1651. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  1652. skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  1653. GUIElementStyle colorPickerSliderVertStyle;
  1654. colorPickerSliderVertStyle.fixedWidth = true;
  1655. colorPickerSliderVertStyle.width = 30;
  1656. colorPickerSliderVertStyle.minHeight = 20;
  1657. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  1658. skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  1659. GUIElementStyle colorPickerSlider2DHandleStyle;
  1660. colorPickerSlider2DHandleStyle.fixedHeight = true;
  1661. colorPickerSlider2DHandleStyle.fixedWidth = true;
  1662. colorPickerSlider2DHandleStyle.height = 7;
  1663. colorPickerSlider2DHandleStyle.width = 7;
  1664. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  1665. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1666. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1667. skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  1668. /************************************************************************/
  1669. /* STATUS BAR */
  1670. /************************************************************************/
  1671. GUIElementStyle statusBarBgStyle;
  1672. statusBarBgStyle.height = 16;
  1673. statusBarBgStyle.border.top = 2;
  1674. statusBarBgStyle.normal.texture = getGUITexture(StatusBarBgTex);
  1675. skin->setStyle(GUIStatusBar::getGUIBackgroundTypeName(), statusBarBgStyle);
  1676. GUIElementStyle statusBarMessageBtnStyle;
  1677. statusBarMessageBtnStyle.font = defaultFont;
  1678. statusBarMessageBtnStyle.fontSize = DefaultFontSize;
  1679. statusBarMessageBtnStyle.fixedHeight = true;
  1680. statusBarMessageBtnStyle.height = 16;
  1681. statusBarMessageBtnStyle.minWidth = 10;
  1682. statusBarMessageBtnStyle.textHorzAlign = THA_Left;
  1683. statusBarMessageBtnStyle.textVertAlign = TVA_Center;
  1684. statusBarMessageBtnStyle.imagePosition = GUIImagePosition::Left;
  1685. skin->setStyle(GUIStatusBar::getGUIMessageTypeName(), statusBarMessageBtnStyle);
  1686. GUIElementStyle statusBarStyle;
  1687. statusBarStyle.height = 16;
  1688. statusBarStyle.subStyles[GUIStatusBar::getGUIBackgroundTypeName()] = GUIStatusBar::getGUIBackgroundTypeName();
  1689. statusBarStyle.subStyles[GUIStatusBar::getGUIMessageTypeName()] = GUIStatusBar::getGUIMessageTypeName();
  1690. skin->setStyle(GUIStatusBar::getGUITypeName(), statusBarStyle);
  1691. /************************************************************************/
  1692. /* OTHER */
  1693. /************************************************************************/
  1694. // Centered label
  1695. GUIElementStyle centeredLabelStyle;
  1696. centeredLabelStyle.font = defaultFont;
  1697. centeredLabelStyle.fontSize = DefaultFontSize;
  1698. centeredLabelStyle.fixedWidth = false;
  1699. centeredLabelStyle.fixedHeight = true;
  1700. centeredLabelStyle.height = 11;
  1701. centeredLabelStyle.minWidth = 10;
  1702. centeredLabelStyle.textHorzAlign = THA_Center;
  1703. centeredLabelStyle.normal.textColor = TextNormalColor;
  1704. skin->setStyle("LabelCentered", centeredLabelStyle);
  1705. // Right-aligned label
  1706. GUIElementStyle rightAlignedLabelStyle;
  1707. rightAlignedLabelStyle.font = defaultFont;
  1708. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  1709. rightAlignedLabelStyle.fixedWidth = false;
  1710. rightAlignedLabelStyle.fixedHeight = true;
  1711. rightAlignedLabelStyle.height = 11;
  1712. rightAlignedLabelStyle.minWidth = 10;
  1713. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  1714. rightAlignedLabelStyle.normal.textColor = TextNormalColor;
  1715. skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  1716. // Multi-line label
  1717. GUIElementStyle multiLinelabelStyle;
  1718. multiLinelabelStyle.font = defaultFont;
  1719. multiLinelabelStyle.fontSize = DefaultFontSize;
  1720. multiLinelabelStyle.fixedWidth = false;
  1721. multiLinelabelStyle.fixedHeight = true;
  1722. multiLinelabelStyle.height = 11;
  1723. multiLinelabelStyle.minWidth = 10;
  1724. multiLinelabelStyle.wordWrap = true;
  1725. multiLinelabelStyle.normal.textColor = TextNormalColor;
  1726. skin->setStyle(BuiltinResources::MultiLineLabelStyle, multiLinelabelStyle);
  1727. // Multi-line centered label
  1728. GUIElementStyle multiLineCenteredLabelStyle;
  1729. multiLineCenteredLabelStyle.font = defaultFont;
  1730. multiLineCenteredLabelStyle.fontSize = DefaultFontSize;
  1731. multiLineCenteredLabelStyle.fixedWidth = false;
  1732. multiLineCenteredLabelStyle.fixedHeight = true;
  1733. multiLineCenteredLabelStyle.height = 11;
  1734. multiLineCenteredLabelStyle.minWidth = 10;
  1735. multiLineCenteredLabelStyle.wordWrap = true;
  1736. multiLineCenteredLabelStyle.textHorzAlign = THA_Center;
  1737. multiLineCenteredLabelStyle.normal.textColor = TextNormalColor;
  1738. skin->setStyle("MultiLineLabelCentered", multiLineCenteredLabelStyle);
  1739. // Title label
  1740. GUIElementStyle titleLabel;
  1741. titleLabel.font = defaultAAFont;
  1742. titleLabel.fontSize = TitleFontSize;
  1743. titleLabel.fixedWidth = false;
  1744. titleLabel.fixedHeight = true;
  1745. titleLabel.height = 20;
  1746. titleLabel.minWidth = 10;
  1747. titleLabel.wordWrap = true;
  1748. titleLabel.textHorzAlign = THA_Center;
  1749. titleLabel.normal.textColor = TextNormalColor;
  1750. skin->setStyle("TitleLabel", titleLabel);
  1751. // Selection area
  1752. GUIElementStyle selectionAreaStyle;
  1753. selectionAreaStyle.normal.texture = getGUITexture(SelectionAreaTex);
  1754. selectionAreaStyle.border.left = 1;
  1755. selectionAreaStyle.border.right = 1;
  1756. selectionAreaStyle.border.top = 1;
  1757. selectionAreaStyle.border.bottom = 1;
  1758. skin->setStyle("SelectionArea", selectionAreaStyle);
  1759. // Selectable label
  1760. GUIElementStyle selectableLabelStyle;
  1761. selectableLabelStyle.normalOn.texture = getGUITexture(SelectionBgTex);
  1762. selectableLabelStyle.hoverOn.texture = selectableLabelStyle.normalOn.texture;
  1763. selectableLabelStyle.activeOn.texture = selectableLabelStyle.normalOn.texture;
  1764. selectableLabelStyle.fixedHeight = true;
  1765. selectableLabelStyle.height = 11;
  1766. selectableLabelStyle.minWidth = 10;
  1767. selectableLabelStyle.font = defaultFont;
  1768. selectableLabelStyle.fontSize = DefaultFontSize;
  1769. selectableLabelStyle.textHorzAlign = THA_Left;
  1770. selectableLabelStyle.normal.textColor = TextNormalColor;
  1771. skin->setStyle("SelectableLabel", selectableLabelStyle);
  1772. // Scroll area background
  1773. GUIElementStyle scrollAreaBg;
  1774. scrollAreaBg.normal.texture = getGUITexture(ScrollAreaBgTex);
  1775. scrollAreaBg.minHeight = 6;
  1776. scrollAreaBg.minWidth = 4;
  1777. scrollAreaBg.border.left = 2;
  1778. scrollAreaBg.border.right = 2;
  1779. scrollAreaBg.border.top = 2;
  1780. scrollAreaBg.border.bottom = 4;
  1781. skin->setStyle("ScrollAreaBg", scrollAreaBg);
  1782. // Inspector title area background
  1783. GUIElementStyle inspectorTitleBg;
  1784. inspectorTitleBg.normal.texture = getGUITexture(InspectorTitleBgTex);
  1785. inspectorTitleBg.minHeight = 4;
  1786. inspectorTitleBg.border.bottom = 2;
  1787. skin->setStyle("InspectorTitleBg", inspectorTitleBg);
  1788. // Inspector content background
  1789. GUIElementStyle inspectorContentBg;
  1790. inspectorContentBg.normal.texture = getGUITexture(InspectorContentBgTex);
  1791. inspectorContentBg.minWidth = 4;
  1792. inspectorContentBg.minHeight = 6;
  1793. inspectorContentBg.border.left = 2;
  1794. inspectorContentBg.border.right = 2;
  1795. inspectorContentBg.border.top = 2;
  1796. inspectorContentBg.border.bottom = 4;
  1797. skin->setStyle("InspectorContentBg", inspectorContentBg);
  1798. // Inspector content alternate background
  1799. GUIElementStyle inspectorContentBgAlternate;
  1800. inspectorContentBgAlternate.normal.texture = getGUITexture(InspectorContentBgAlternateTex);
  1801. inspectorContentBgAlternate.minWidth = 4;
  1802. inspectorContentBgAlternate.minHeight = 6;
  1803. inspectorContentBgAlternate.border.left = 2;
  1804. inspectorContentBgAlternate.border.right = 2;
  1805. inspectorContentBgAlternate.border.top = 2;
  1806. inspectorContentBgAlternate.border.bottom = 4;
  1807. skin->setStyle("InspectorContentBgAlternate", inspectorContentBgAlternate);
  1808. // Background for multi-element resource entries in the library window
  1809. GUIElementStyle libraryEntryFirstBg;
  1810. libraryEntryFirstBg.normal.texture = getGUITexture(LibraryEntryFirstBgTex);
  1811. libraryEntryFirstBg.minHeight = 7;
  1812. libraryEntryFirstBg.minWidth = 4;
  1813. libraryEntryFirstBg.border.top = 5;
  1814. libraryEntryFirstBg.border.bottom = 2;
  1815. libraryEntryFirstBg.border.left = 2;
  1816. skin->setStyle("LibraryEntryFirstBg", libraryEntryFirstBg);
  1817. GUIElementStyle libraryEntryBg;
  1818. libraryEntryBg.normal.texture = getGUITexture(LibraryEntryBgTex);
  1819. libraryEntryBg.minHeight = 7;
  1820. libraryEntryBg.minWidth = 4;
  1821. libraryEntryBg.border.top = 5;
  1822. libraryEntryBg.border.bottom = 2;
  1823. skin->setStyle("LibraryEntryBg", libraryEntryBg);
  1824. GUIElementStyle libraryEntryLastBg;
  1825. libraryEntryLastBg.normal.texture = getGUITexture(LibraryEntryLastBgTex);
  1826. libraryEntryLastBg.minHeight = 7;
  1827. libraryEntryFirstBg.minWidth = 4;
  1828. libraryEntryLastBg.border.top = 5;
  1829. libraryEntryLastBg.border.bottom = 2;
  1830. libraryEntryLastBg.border.right = 2;
  1831. skin->setStyle("LibraryEntryLastBg", libraryEntryLastBg);
  1832. GUIElementStyle libraryEntryVertFirstBg;
  1833. libraryEntryVertFirstBg.normal.texture = getGUITexture(LibraryEntryVertFirstBgTex);
  1834. libraryEntryVertFirstBg.minHeight = 5;
  1835. libraryEntryVertFirstBg.minWidth = 6;
  1836. libraryEntryVertFirstBg.border.top = 4;
  1837. libraryEntryVertFirstBg.border.left = 2;
  1838. libraryEntryVertFirstBg.border.right = 4;
  1839. skin->setStyle("LibraryEntryVertFirstBg", libraryEntryVertFirstBg);
  1840. GUIElementStyle libraryEntryVertBg;
  1841. libraryEntryVertBg.normal.texture = getGUITexture(LibraryEntryVertBgTex);
  1842. libraryEntryVertBg.minHeight = 4;
  1843. libraryEntryVertBg.minWidth = 6;
  1844. libraryEntryVertBg.border.left = 2;
  1845. libraryEntryVertBg.border.right = 4;
  1846. skin->setStyle("LibraryEntryVertBg", libraryEntryVertBg);
  1847. GUIElementStyle libraryEntryVertLastBg;
  1848. libraryEntryVertLastBg.normal.texture = getGUITexture(LibraryEntryVertLastBgTex);
  1849. libraryEntryVertLastBg.minHeight = 4;
  1850. libraryEntryVertLastBg.minWidth = 6;
  1851. libraryEntryVertLastBg.border.bottom = 2;
  1852. libraryEntryVertLastBg.border.left = 2;
  1853. libraryEntryVertLastBg.border.right = 4;
  1854. skin->setStyle("LibraryEntryVertLastBg", libraryEntryVertLastBg);
  1855. GUIElementStyle canvas;
  1856. skin->setStyle("Canvas", canvas);
  1857. return skin;
  1858. }
  1859. HSpriteTexture BuiltinEditorResources::getGUITexture(const String& name) const
  1860. {
  1861. Path texturePath = EditorSkinSpritesFolder;
  1862. texturePath.append("sprite_" + name + ".asset");
  1863. return gResources().load<SpriteTexture>(texturePath);
  1864. }
  1865. HSpriteTexture BuiltinEditorResources::getGUIIcon(const String& name) const
  1866. {
  1867. Path texturePath = EditorIconSpritesFolder;
  1868. texturePath.append("sprite_" + name + ".asset");
  1869. return gResources().load<SpriteTexture>(texturePath);
  1870. }
  1871. HShader BuiltinEditorResources::getShader(const String& name) const
  1872. {
  1873. Path programPath = EditorShaderFolder;
  1874. programPath.append(name + ".asset");
  1875. HShader shader = gResources().load<Shader>(programPath);
  1876. #if BS_DEBUG_MODE
  1877. BuiltinResourcesHelper::verifyAndReportShader(shader);
  1878. #endif
  1879. return shader;
  1880. }
  1881. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1882. {
  1883. return Material::create(mShaderDockOverlay);
  1884. }
  1885. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1886. {
  1887. return Material::create(mShaderSceneGrid);
  1888. }
  1889. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1890. {
  1891. UINT32 modeIdx = (UINT32)cullMode;
  1892. return Material::create(mShaderPicking[modeIdx]);
  1893. }
  1894. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1895. {
  1896. UINT32 modeIdx = (UINT32)cullMode;
  1897. return Material::create(mShaderPickingAlpha[modeIdx]);
  1898. }
  1899. HMaterial BuiltinEditorResources::createLineGizmoMat() const
  1900. {
  1901. return Material::create(mShaderGizmoLine);
  1902. }
  1903. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1904. {
  1905. return Material::create(mShaderGizmoSolid);
  1906. }
  1907. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1908. {
  1909. return Material::create(mShaderGizmoWire);
  1910. }
  1911. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1912. {
  1913. return Material::create(mShaderGizmoIcon);
  1914. }
  1915. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1916. {
  1917. return Material::create(mShaderGizmoPicking);
  1918. }
  1919. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1920. {
  1921. return Material::create(mShaderGizmoAlphaPicking);
  1922. }
  1923. HMaterial BuiltinEditorResources::createLineHandleMat() const
  1924. {
  1925. return Material::create(mShaderHandleLine);
  1926. }
  1927. HMaterial BuiltinEditorResources::createTextGizmoMat() const
  1928. {
  1929. return Material::create(mShaderGizmoText);
  1930. }
  1931. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1932. {
  1933. return Material::create(mShaderHandleSolid);
  1934. }
  1935. HMaterial BuiltinEditorResources::createHandleClearAlphaMat() const
  1936. {
  1937. return Material::create(mShaderHandleClearAlpha);
  1938. }
  1939. HMaterial BuiltinEditorResources::createSelectionMat() const
  1940. {
  1941. return Material::create(mShaderSelection);
  1942. }
  1943. HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon, int size) const
  1944. {
  1945. String iconName;
  1946. switch (icon)
  1947. {
  1948. case ProjectIcon::Folder:
  1949. iconName = FolderIconTex;
  1950. break;
  1951. case ProjectIcon::Font:
  1952. iconName = FontIconTex;
  1953. break;
  1954. case ProjectIcon::Mesh:
  1955. iconName = MeshIconTex;
  1956. break;
  1957. case ProjectIcon::Texture:
  1958. iconName = TextureIconTex;
  1959. break;
  1960. case ProjectIcon::PlainText:
  1961. iconName = PlainTextIconTex;
  1962. break;
  1963. case ProjectIcon::ScriptCode:
  1964. iconName = ScriptCodeIconTex;
  1965. break;
  1966. case ProjectIcon::Shader:
  1967. iconName = ShaderIconTex;
  1968. break;
  1969. case ProjectIcon::ShaderInclude:
  1970. iconName = ShaderIncludeIconTex;
  1971. break;
  1972. case ProjectIcon::Material:
  1973. iconName = MaterialIconTex;
  1974. break;
  1975. case ProjectIcon::SpriteTexture:
  1976. iconName = SpriteTextureIconTex;
  1977. break;
  1978. case ProjectIcon::Prefab:
  1979. iconName = PrefabIconTex;
  1980. break;
  1981. case ProjectIcon::GUISkin:
  1982. iconName = GUISkinIconTex;
  1983. break;
  1984. case ProjectIcon::PhysicsMaterial:
  1985. iconName = PhysicsMaterialIconTex;
  1986. break;
  1987. case ProjectIcon::PhysicsMesh:
  1988. iconName = PhysicsMeshIconTex;
  1989. break;
  1990. case ProjectIcon::AudioClip:
  1991. iconName = AudioClipIconTex;
  1992. break;
  1993. case ProjectIcon::AnimationClip:
  1994. iconName = AnimationClipIconTex;
  1995. break;
  1996. }
  1997. if (iconName.empty())
  1998. return HSpriteTexture();
  1999. if (size <= 16)
  2000. iconName += "16";
  2001. else if (size <= 32)
  2002. iconName += "32";
  2003. else if (size <= 48)
  2004. iconName += "48";
  2005. return getGUIIcon(iconName);
  2006. }
  2007. HSpriteTexture BuiltinEditorResources::getToolbarIcon(ToolbarIcon icon) const
  2008. {
  2009. switch (icon)
  2010. {
  2011. case ToolbarIcon::NewCamera:
  2012. return getGUIIcon("ToolbarNewCameraIcon.png");
  2013. case ToolbarIcon::NewRenderable:
  2014. return getGUIIcon("ToolbarNewRenderableIcon.png");
  2015. case ToolbarIcon::NewPointLight:
  2016. return getGUIIcon("ToolbarNewPointLightIcon.png");
  2017. case ToolbarIcon::NewDirLight:
  2018. return getGUIIcon("ToolbarNewDirectionalLightIcon.png");
  2019. case ToolbarIcon::NewSpotLight:
  2020. return getGUIIcon("ToolbarNewSpotLightIcon.png");
  2021. case ToolbarIcon::NewSceneObject:
  2022. return getGUIIcon("ToolbarNewSceneObjectIcon.png");
  2023. case ToolbarIcon::NewCube:
  2024. return getGUIIcon("ToolbarNewCubeIcon.png");
  2025. case ToolbarIcon::NewSphere:
  2026. return getGUIIcon("ToolbarNewSphereIcon.png");
  2027. case ToolbarIcon::NewCone:
  2028. return getGUIIcon("ToolbarNewConeIcon.png");
  2029. case ToolbarIcon::NewQuad:
  2030. return getGUIIcon("ToolbarNewQuadIcon.png");
  2031. case ToolbarIcon::NewMat:
  2032. return getGUIIcon("ToolbarNewMaterialIcon.png");
  2033. case ToolbarIcon::NewCSScript:
  2034. return getGUIIcon("ToolbarNewCSScriptIcon.png");
  2035. case ToolbarIcon::NewShader:
  2036. return getGUIIcon("ToolbarNewShaderIcon.png");
  2037. case ToolbarIcon::NewSpriteTex:
  2038. return getGUIIcon("ToolbarNewSpriteTextureIcon.png");
  2039. case ToolbarIcon::Pause:
  2040. return getGUIIcon("ToolbarPauseIcon.png");
  2041. case ToolbarIcon::Play:
  2042. return getGUIIcon("ToolbarPlayIcon.png");
  2043. case ToolbarIcon::Step:
  2044. return getGUIIcon("ToolbarStepIcon.png");
  2045. case ToolbarIcon::Undo:
  2046. return getGUIIcon("ToolbarUndoIcon.png");
  2047. case ToolbarIcon::Redo:
  2048. return getGUIIcon("ToolbarRedoIcon.png");
  2049. case ToolbarIcon::OpenProject:
  2050. return getGUIIcon("ToolbarOpenProjectIcon.png");
  2051. case ToolbarIcon::SaveProject:
  2052. return getGUIIcon("ToolbarSaveProjectIcon.png");
  2053. case ToolbarIcon::SaveScene:
  2054. return getGUIIcon("ToolbarSaveSceneIcon.png");
  2055. }
  2056. return HSpriteTexture();
  2057. }
  2058. GUIContentImages BuiltinEditorResources::getSceneWindowIcon(SceneWindowIcon icon) const
  2059. {
  2060. HSpriteTexture off;
  2061. HSpriteTexture on;
  2062. switch (icon)
  2063. {
  2064. case SceneWindowIcon::View:
  2065. off = getGUIIcon("SceneViewIcon.png");
  2066. on = getGUIIcon("SceneViewIconOn.png");
  2067. break;
  2068. case SceneWindowIcon::Move:
  2069. off = getGUIIcon("SceneMoveIcon.png");
  2070. on = getGUIIcon("SceneMoveIconOn.png");
  2071. break;
  2072. case SceneWindowIcon::Rotate:
  2073. off = getGUIIcon("SceneRotateIcon.png");
  2074. on = getGUIIcon("SceneRotateIconOn.png");
  2075. break;
  2076. case SceneWindowIcon::Scale:
  2077. off = getGUIIcon("SceneScaleIcon.png");
  2078. on = getGUIIcon("SceneScaleIconOn.png");
  2079. break;
  2080. case SceneWindowIcon::Pivot:
  2081. off = getGUIIcon("ScenePivotIcon.png");
  2082. on = getGUIIcon("ScenePivotIconOn.png");
  2083. break;
  2084. case SceneWindowIcon::Center:
  2085. off = getGUIIcon("SceneCenterIcon.png");
  2086. on = getGUIIcon("SceneCenterIconOn.png");
  2087. break;
  2088. case SceneWindowIcon::Local:
  2089. off = getGUIIcon("SceneLocalIcon.png");
  2090. on = getGUIIcon("SceneLocalIconOn.png");
  2091. break;
  2092. case SceneWindowIcon::World:
  2093. off = getGUIIcon("SceneWorldIcon.png");
  2094. on = getGUIIcon("SceneWorldIconOn.png");
  2095. break;
  2096. case SceneWindowIcon::MoveSnap:
  2097. off = getGUIIcon("SceneMoveSnapIcon.png");
  2098. on = getGUIIcon("SceneMoveSnapIconOn.png");
  2099. break;
  2100. case SceneWindowIcon::RotateSnap:
  2101. off = getGUIIcon("SceneRotateSnapIcon.png");
  2102. on = getGUIIcon("SceneRotateSnapIconOn.png");
  2103. break;
  2104. }
  2105. GUIContentImages output;
  2106. output.normal = off;
  2107. output.hover = off;
  2108. output.active = on;
  2109. output.focused = off;
  2110. output.normalOn = on;
  2111. output.hoverOn = on;
  2112. output.activeOn = on;
  2113. output.focusedOn = on;
  2114. return output;
  2115. }
  2116. HSpriteTexture BuiltinEditorResources::getLibraryWindowIcon(LibraryWindowIcon icon) const
  2117. {
  2118. switch (icon)
  2119. {
  2120. case LibraryWindowIcon::Home:
  2121. return getGUIIcon("LibraryHomeIcon.png");
  2122. case LibraryWindowIcon::Up:
  2123. return getGUIIcon("LibraryUpIcon.png");
  2124. case LibraryWindowIcon::Clear:
  2125. return getGUIIcon("LibraryClearSearchIcon.png");
  2126. case LibraryWindowIcon::Options:
  2127. return getGUIIcon("LibraryOptionsIcon.png");
  2128. }
  2129. return HSpriteTexture();
  2130. }
  2131. HSpriteTexture BuiltinEditorResources::getInspectorWindowIcon(InspectorWindowIcon icon) const
  2132. {
  2133. switch (icon)
  2134. {
  2135. case InspectorWindowIcon::Create:
  2136. return getGUIIcon("InspectorCreateIcon.png");
  2137. case InspectorWindowIcon::Clone:
  2138. return getGUIIcon("InspectorCloneIcon.png");
  2139. case InspectorWindowIcon::Clear:
  2140. return getGUIIcon("InspectorClearIcon.png");
  2141. case InspectorWindowIcon::Resize:
  2142. return getGUIIcon("InspectorResizeIcon.png");
  2143. case InspectorWindowIcon::Delete:
  2144. return getGUIIcon("InspectorDeleteIcon.png");
  2145. case InspectorWindowIcon::MoveUp:
  2146. return getGUIIcon("InspectorMoveUpIcon.png");
  2147. case InspectorWindowIcon::MoveDown:
  2148. return getGUIIcon("InspectorMoveDownIcon.png");
  2149. case InspectorWindowIcon::Edit:
  2150. return getGUIIcon("InspectorEditIcon.png");
  2151. case InspectorWindowIcon::Apply:
  2152. return getGUIIcon("InspectorApplyIcon.png");
  2153. case InspectorWindowIcon::Add:
  2154. return getGUIIcon("InspectorAddIcon.png");
  2155. case InspectorWindowIcon::Cancel:
  2156. return getGUIIcon("InspectorCancelIcon.png");
  2157. }
  2158. return HSpriteTexture();
  2159. }
  2160. GUIContentImages BuiltinEditorResources::getAnimationWindowIcon(AnimationWindowIcon icon) const
  2161. {
  2162. HSpriteTexture off;
  2163. HSpriteTexture on;
  2164. switch (icon)
  2165. {
  2166. case AnimationWindowIcon::Play:
  2167. off = getGUIIcon("AnimationPlayIcon.png");
  2168. on = getGUIIcon("AnimationPlayIconOn.png");
  2169. break;
  2170. case AnimationWindowIcon::Record:
  2171. off = getGUIIcon("AnimationRecordIcon.png");
  2172. on = getGUIIcon("AnimationRecordIconOn.png");
  2173. break;
  2174. case AnimationWindowIcon::FrameForward:
  2175. off = getGUIIcon("AnimationFrameForwardIcon.png");
  2176. on = getGUIIcon("AnimationFrameForwardIconOn.png");
  2177. break;
  2178. case AnimationWindowIcon::FrameBack:
  2179. off = getGUIIcon("AnimationFrameBackIcon.png");
  2180. on = getGUIIcon("AnimationFrameBackIconOn.png");
  2181. break;
  2182. case AnimationWindowIcon::AddEvent:
  2183. off = getGUIIcon("AnimationAddEventIcon.png");
  2184. on = getGUIIcon("AnimationAddEventIconOn.png");
  2185. break;
  2186. case AnimationWindowIcon::AddKeyframe:
  2187. off = getGUIIcon("AnimationAddKeyframeIcon.png");
  2188. on = getGUIIcon("AnimationAddKeyframeIconOn.png");
  2189. break;
  2190. case AnimationWindowIcon::Event:
  2191. off = getGUIIcon("AnimationEventIcon.png");
  2192. on = off;
  2193. break;
  2194. case AnimationWindowIcon::Keyframe:
  2195. off = getGUIIcon("AnimationKeyframeIcon.png");
  2196. on = off;
  2197. break;
  2198. }
  2199. GUIContentImages output;
  2200. output.normal = off;
  2201. output.hover = off;
  2202. output.active = on;
  2203. output.focused = off;
  2204. output.normalOn = on;
  2205. output.hoverOn = on;
  2206. output.activeOn = on;
  2207. output.focusedOn = on;
  2208. return output;
  2209. }
  2210. HSpriteTexture BuiltinEditorResources::getIcon(EditorIcon icon) const
  2211. {
  2212. switch (icon)
  2213. {
  2214. case EditorIcon::X:
  2215. return getGUIIcon(XButtonNormalTex);
  2216. case EditorIcon::Component:
  2217. return getGUIIcon("IconComponent.png");
  2218. case EditorIcon::SceneObject:
  2219. return getGUIIcon("IconSceneObject.png");
  2220. }
  2221. return HSpriteTexture();
  2222. }
  2223. HSpriteTexture BuiltinEditorResources::getLogMessageIcon(LogMessageIcon icon, UINT32 size, bool dark) const
  2224. {
  2225. if (size < 24) // Round to 16
  2226. {
  2227. if (dark)
  2228. {
  2229. switch (icon)
  2230. {
  2231. case LogMessageIcon::Info:
  2232. return getGUIIcon("IconInfoDark.png");
  2233. case LogMessageIcon::Warning:
  2234. return getGUIIcon("IconWarningDark.png");
  2235. case LogMessageIcon::Error:
  2236. return getGUIIcon("IconErrorDark.png");
  2237. }
  2238. }
  2239. else
  2240. {
  2241. switch (icon)
  2242. {
  2243. case LogMessageIcon::Info:
  2244. return getGUIIcon("IconInfo.png");
  2245. case LogMessageIcon::Warning:
  2246. return getGUIIcon("IconWarning.png");
  2247. case LogMessageIcon::Error:
  2248. return getGUIIcon("IconError.png");
  2249. }
  2250. }
  2251. }
  2252. else // Round to 32
  2253. {
  2254. switch (icon)
  2255. {
  2256. case LogMessageIcon::Info:
  2257. return getGUIIcon("IconInfo32.png");
  2258. case LogMessageIcon::Warning:
  2259. return getGUIIcon("IconWarning32.png");
  2260. case LogMessageIcon::Error:
  2261. return getGUIIcon("IconError32.png");
  2262. }
  2263. }
  2264. return HSpriteTexture();
  2265. }
  2266. SPtr<PixelData> BuiltinEditorResources::getSplashScreen()
  2267. {
  2268. Path splashScreenPath = gEditorApplication().getDataPath() + (String(SplashScreenName) + ".asset");
  2269. FileDecoder fd(splashScreenPath);
  2270. return std::static_pointer_cast<PixelData>(fd.decode());
  2271. }
  2272. String BuiltinEditorResources::getEmptyShaderCode() const
  2273. {
  2274. Path filePath = BuiltinDataFolder;
  2275. filePath.append(EmptyShaderCodeFile);
  2276. SPtr<DataStream> fileStream = FileSystem::openFile(filePath);
  2277. if (fileStream != nullptr)
  2278. return fileStream->getAsString();
  2279. return StringUtil::BLANK;
  2280. }
  2281. String BuiltinEditorResources::getEmptyCSScriptCode() const
  2282. {
  2283. Path filePath = BuiltinDataFolder;
  2284. filePath.append(EmptyCSScriptCodeFile);
  2285. SPtr<DataStream> fileStream = FileSystem::openFile(filePath);
  2286. if (fileStream != nullptr)
  2287. return fileStream->getAsString();
  2288. return StringUtil::BLANK;
  2289. }
  2290. Path BuiltinEditorResources::getShaderIncludeFolder()
  2291. {
  2292. return gEditorApplication().getDataPath() + ShaderIncludeFolder;
  2293. }
  2294. Path BuiltinEditorResources::getDefaultWidgetLayoutPath()
  2295. {
  2296. return gEditorApplication().getDataPath() + "Layout.asset";
  2297. }
  2298. }