BsScriptGUIElementStyle.h 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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(BansheeEngineAssemblyName, "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. BS_SCRIPT_GETSET_OBJECT_SHRDPTR(ScriptGUIElementStyle, ScriptFont, Font, mElementStyle->font, mFont);
  29. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, FontSize, mElementStyle->fontSize);
  30. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, TextHorzAlign, TextHorzAlign, mElementStyle->textHorzAlign);
  31. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, TextVertAlign, TextVertAlign, mElementStyle->textVertAlign);
  32. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, GUIImagePosition, ImagePosition, mElementStyle->imagePosition);
  33. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, WordWrap, mElementStyle->wordWrap);
  34. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Normal, mElementStyle->normal, mNormal);
  35. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Hover, mElementStyle->hover, mHover);
  36. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Active, mElementStyle->active, mActive);
  37. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, Focused, mElementStyle->focused, mFocused);
  38. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, NormalOn, mElementStyle->normalOn, mNormalOn);
  39. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, HoverOn, mElementStyle->hoverOn, mHoverOn);
  40. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, ActiveOn, mElementStyle->activeOn, mActiveOn);
  41. BS_SCRIPT_GETSET_OBJECT(ScriptGUIElementStyle, ScriptGUIElementStateStyle, FocusedOn, mElementStyle->focusedOn, mFocusedOn);
  42. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, Border, mElementStyle->border);
  43. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, Margins, mElementStyle->margins);
  44. BS_SCRIPT_GETSET_VALUE_REF(ScriptGUIElementStyle, RectOffset, ContentOffset, mElementStyle->contentOffset);
  45. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, Width, mElementStyle->width);
  46. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, Height, mElementStyle->height);
  47. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MinWidth, mElementStyle->minWidth);
  48. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MaxWidth, mElementStyle->maxWidth);
  49. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MinHeight, mElementStyle->minHeight);
  50. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, UINT32, MaxHeight, mElementStyle->maxHeight);
  51. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, FixedWidth, mElementStyle->fixedWidth);
  52. BS_SCRIPT_GETSET_VALUE(ScriptGUIElementStyle, bool, FixedHeight, mElementStyle->fixedHeight);
  53. ScriptGUIElementStyle(MonoObject* instance, const String& name);
  54. ScriptGUIElementStyle(MonoObject* instance, const String& name, GUIElementStyle* externalStyle);
  55. String mName;
  56. GUIElementStyle* mElementStyle;
  57. bool mOwnsStyle;
  58. ScriptFont* mFont;
  59. ScriptGUIElementStateStyle* mNormal;
  60. ScriptGUIElementStateStyle* mHover;
  61. ScriptGUIElementStateStyle* mActive;
  62. ScriptGUIElementStateStyle* mFocused;
  63. ScriptGUIElementStateStyle* mNormalOn;
  64. ScriptGUIElementStateStyle* mHoverOn;
  65. ScriptGUIElementStateStyle* mActiveOn;
  66. ScriptGUIElementStateStyle* mFocusedOn;
  67. };
  68. }