BsScriptGUIElementStyle.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include "BsScriptEnginePrerequisites.h"
  3. #include "BsScriptObject.h"
  4. #include "BsGUIElementStyle.h"
  5. #include "BsScriptMacros.h"
  6. #include "BsMonoClass.h"
  7. #include "BsScriptGUIElementStateStyle.h"
  8. #include "BsScriptFont.h"
  9. namespace BansheeEngine
  10. {
  11. template<class ParentType, class Type>
  12. class script_getset_value
  13. {
  14. private:
  15. static void internal_get(ParentType* nativeInstance, Type* value);
  16. static void internal_set(ParentType* nativeInstance, Type value);
  17. };
  18. class BS_SCR_BE_EXPORT ScriptGUIElementStyle : public ScriptObject<ScriptGUIElementStyle>
  19. {
  20. public:
  21. SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElementStyle")
  22. ~ScriptGUIElementStyle();
  23. GUIElementStyle* getInternalValue() const { return mElementStyle; }
  24. private:
  25. static void internal_createInstance(MonoObject* instance, MonoString* name);
  26. static void internal_createInstanceExternal(MonoObject* instance, MonoString* name, GUIElementStyle* externalStyle);
  27. static void internal_addSubStyle(ScriptGUIElementStyle* nativeInstance, MonoString* guiType, MonoString* styleName);
  28. static void internal_GetFont(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
  29. static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
  30. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, FontSize, mElementStyle->fontSize);
  31. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, TextHorzAlign, TextHorzAlign, mElementStyle->textHorzAlign);
  32. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, TextVertAlign, TextVertAlign, mElementStyle->textVertAlign);
  33. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, GUIImagePosition, ImagePosition, mElementStyle->imagePosition);
  34. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, WordWrap, mElementStyle->wordWrap);
  35. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Normal, mElementStyle->normal, mNormal);
  36. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Hover, mElementStyle->hover, mHover);
  37. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Active, mElementStyle->active, mActive);
  38. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Focused, mElementStyle->focused, mFocused);
  39. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, NormalOn, mElementStyle->normalOn, mNormalOn);
  40. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, HoverOn, mElementStyle->hoverOn, mHoverOn);
  41. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, ActiveOn, mElementStyle->activeOn, mActiveOn);
  42. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, FocusedOn, mElementStyle->focusedOn, mFocusedOn);
  43. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, Border, mElementStyle->border);
  44. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, Margins, mElementStyle->margins);
  45. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, ContentOffset, mElementStyle->contentOffset);
  46. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, Width, mElementStyle->width);
  47. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, Height, mElementStyle->height);
  48. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MinWidth, mElementStyle->minWidth);
  49. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MaxWidth, mElementStyle->maxWidth);
  50. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MinHeight, mElementStyle->minHeight);
  51. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MaxHeight, mElementStyle->maxHeight);
  52. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, FixedWidth, mElementStyle->fixedWidth);
  53. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, FixedHeight, mElementStyle->fixedHeight);
  54. ScriptGUIElementStyle(MonoObject* instance, const String& name);
  55. ScriptGUIElementStyle(MonoObject* instance, const String& name, GUIElementStyle* externalStyle);
  56. String mName;
  57. GUIElementStyle* mElementStyle;
  58. bool mOwnsStyle;
  59. ScriptFont* mFont;
  60. ScriptGUIElementStateStyle* mNormal;
  61. ScriptGUIElementStateStyle* mHover;
  62. ScriptGUIElementStateStyle* mActive;
  63. ScriptGUIElementStateStyle* mFocused;
  64. ScriptGUIElementStateStyle* mNormalOn;
  65. ScriptGUIElementStateStyle* mHoverOn;
  66. ScriptGUIElementStateStyle* mActiveOn;
  67. ScriptGUIElementStateStyle* mFocusedOn;
  68. };
  69. }