GUIElementStyle.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. public struct RectOffset
  6. {
  7. int left, right, top, bottom;
  8. };
  9. public enum GUIImagePosition
  10. {
  11. Left, Right
  12. };
  13. public enum TextHorzAlign
  14. {
  15. Left, Center, Right
  16. };
  17. public enum TextVertAlign
  18. {
  19. Top, Center, Bottom
  20. };
  21. public sealed class GUIElementStyle : ScriptObject
  22. {
  23. public GUIElementStyle()
  24. {
  25. Internal_CreateInstance(this);
  26. }
  27. public Font font
  28. {
  29. get { Font value; Internal_GetFont(mCachedPtr, out value); return value; }
  30. set { Internal_SetFont(mCachedPtr, value); }
  31. }
  32. public int fontSize
  33. {
  34. get { int value; Internal_GetFontSize(mCachedPtr, out value); return value; }
  35. set { Internal_SetFontSize(mCachedPtr, value); }
  36. }
  37. public TextHorzAlign textHorzAlign
  38. {
  39. get { TextHorzAlign value; Internal_GetTextHorzAlign(mCachedPtr, out value); return value; }
  40. set { Internal_SetTextHorzAlign(mCachedPtr, value); }
  41. }
  42. public TextVertAlign textVertAlign
  43. {
  44. get { TextVertAlign value; Internal_GetTextVertAlign(mCachedPtr, out value); return value; }
  45. set { Internal_SetTextVertAlign(mCachedPtr, value); }
  46. }
  47. public GUIImagePosition imagePosition
  48. {
  49. get { GUIImagePosition value; Internal_GetImagePosition(mCachedPtr, out value); return value; }
  50. set { Internal_SetImagePosition(mCachedPtr, value); }
  51. }
  52. public bool wordWrap
  53. {
  54. get { bool value; Internal_GetWordWrap(mCachedPtr, out value); return value; }
  55. set { Internal_SetWordWrap(mCachedPtr, value); }
  56. }
  57. public GUIElementStateStyle normal
  58. {
  59. get { GUIElementStateStyle value; Internal_GetNormal(mCachedPtr, out value); return value; }
  60. set { Internal_SetNormal(mCachedPtr, value); }
  61. }
  62. public GUIElementStateStyle hover
  63. {
  64. get { GUIElementStateStyle value; Internal_GetHover(mCachedPtr, out value); return value; }
  65. set { Internal_SetHover(mCachedPtr, value); }
  66. }
  67. public GUIElementStateStyle active
  68. {
  69. get { GUIElementStateStyle value; Internal_GetActive(mCachedPtr, out value); return value; }
  70. set { Internal_SetActive(mCachedPtr, value); }
  71. }
  72. public GUIElementStateStyle focused
  73. {
  74. get { GUIElementStateStyle value; Internal_GetFocused(mCachedPtr, out value); return value; }
  75. set { Internal_SetFocused(mCachedPtr, value); }
  76. }
  77. // For controls that can be turned on-off
  78. public GUIElementStateStyle normalOn
  79. {
  80. get { GUIElementStateStyle value; Internal_GetNormalOn(mCachedPtr, out value); return value; }
  81. set { Internal_SetNormalOn(mCachedPtr, value); }
  82. }
  83. public GUIElementStateStyle hoverOn
  84. {
  85. get { GUIElementStateStyle value; Internal_GetHoverOn(mCachedPtr, out value); return value; }
  86. set { Internal_SetHoverOn(mCachedPtr, value); }
  87. }
  88. public GUIElementStateStyle activeOn
  89. {
  90. get { GUIElementStateStyle value; Internal_GetActiveOn(mCachedPtr, out value); return value; }
  91. set { Internal_SetActiveOn(mCachedPtr, value); }
  92. }
  93. public GUIElementStateStyle focusedOn
  94. {
  95. get { GUIElementStateStyle value; Internal_GetFocusedOn(mCachedPtr, out value); return value; }
  96. set { Internal_SetFocusedOn(mCachedPtr, value); }
  97. }
  98. public RectOffset border // Determines how the element is scaled (using the typical Scale9Grid approach)
  99. {
  100. get { RectOffset value; Internal_GetBorder(mCachedPtr, out value); return value; }
  101. set { Internal_SetBorder(mCachedPtr, ref value); }
  102. }
  103. public RectOffset margins // Determines offset from the background graphics to the content. Input uses bounds offset by this value.
  104. {
  105. get { RectOffset value; Internal_GetMargins(mCachedPtr, out value); return value; }
  106. set { Internal_SetMargins(mCachedPtr, ref value); }
  107. }
  108. public RectOffset contentOffset // Additional offset to the content, that doesn't effect the bounds. Applied on top of the margins offsets.
  109. {
  110. get { RectOffset value; Internal_GetContentOffset(mCachedPtr, out value); return value; }
  111. set { Internal_SetContentOffset(mCachedPtr, ref value); }
  112. }
  113. public int width
  114. {
  115. get { int value; Internal_GetWidth(mCachedPtr, out value); return value; }
  116. set { Internal_SetWidth(mCachedPtr, value); }
  117. }
  118. public int height
  119. {
  120. get { int value; Internal_GetHeight(mCachedPtr, out value); return value; }
  121. set { Internal_SetHeight(mCachedPtr, value); }
  122. }
  123. public int minWidth
  124. {
  125. get { int value; Internal_GetMinWidth(mCachedPtr, out value); return value; }
  126. set { Internal_SetMinWidth(mCachedPtr, value); }
  127. }
  128. public int maxWidth
  129. {
  130. get { int value; Internal_GetMaxWidth(mCachedPtr, out value); return value; }
  131. set { Internal_SetMaxWidth(mCachedPtr, value); }
  132. }
  133. public int minHeight
  134. {
  135. get { int value; Internal_GetMinHeight(mCachedPtr, out value); return value; }
  136. set { Internal_SetMinHeight(mCachedPtr, value); }
  137. }
  138. public int maxHeight
  139. {
  140. get { int value; Internal_GetMaxHeight(mCachedPtr, out value); return value; }
  141. set { Internal_SetMaxHeight(mCachedPtr, value); }
  142. }
  143. public bool fixedWidth
  144. {
  145. get { bool value; Internal_GetFixedWidth(mCachedPtr, out value); return value; }
  146. set { Internal_SetFixedWidth(mCachedPtr, value); }
  147. }
  148. public bool fixedHeight
  149. {
  150. get { bool value; Internal_GetFixedHeight(mCachedPtr, out value); return value; }
  151. set { Internal_SetFixedHeight(mCachedPtr, value); }
  152. }
  153. [MethodImpl(MethodImplOptions.InternalCall)]
  154. private static extern void Internal_CreateInstance(GUIElementStyle instance);
  155. [MethodImpl(MethodImplOptions.InternalCall)]
  156. private static extern void Internal_GetFont(IntPtr nativeInstance, out Font value);
  157. [MethodImpl(MethodImplOptions.InternalCall)]
  158. private static extern void Internal_SetFont(IntPtr nativeInstance, Font value);
  159. [MethodImpl(MethodImplOptions.InternalCall)]
  160. private static extern void Internal_GetFontSize(IntPtr nativeInstance, out int value);
  161. [MethodImpl(MethodImplOptions.InternalCall)]
  162. private static extern void Internal_SetFontSize(IntPtr nativeInstance, int value);
  163. [MethodImpl(MethodImplOptions.InternalCall)]
  164. private static extern void Internal_GetTextHorzAlign(IntPtr nativeInstance, out TextHorzAlign value);
  165. [MethodImpl(MethodImplOptions.InternalCall)]
  166. private static extern void Internal_SetTextHorzAlign(IntPtr nativeInstance, TextHorzAlign value);
  167. [MethodImpl(MethodImplOptions.InternalCall)]
  168. private static extern void Internal_GetTextVertAlign(IntPtr nativeInstance, out TextVertAlign value);
  169. [MethodImpl(MethodImplOptions.InternalCall)]
  170. private static extern void Internal_SetTextVertAlign(IntPtr nativeInstance, TextVertAlign value);
  171. [MethodImpl(MethodImplOptions.InternalCall)]
  172. private static extern void Internal_GetImagePosition(IntPtr nativeInstance, out GUIImagePosition value);
  173. [MethodImpl(MethodImplOptions.InternalCall)]
  174. private static extern void Internal_SetImagePosition(IntPtr nativeInstance, GUIImagePosition value);
  175. [MethodImpl(MethodImplOptions.InternalCall)]
  176. private static extern void Internal_GetWordWrap(IntPtr nativeInstance, out bool value);
  177. [MethodImpl(MethodImplOptions.InternalCall)]
  178. private static extern void Internal_SetWordWrap(IntPtr nativeInstance, bool value);
  179. [MethodImpl(MethodImplOptions.InternalCall)]
  180. private static extern void Internal_GetNormal(IntPtr nativeInstance, out GUIElementStateStyle value);
  181. [MethodImpl(MethodImplOptions.InternalCall)]
  182. private static extern void Internal_SetNormal(IntPtr nativeInstance, GUIElementStateStyle value);
  183. [MethodImpl(MethodImplOptions.InternalCall)]
  184. private static extern void Internal_GetHover(IntPtr nativeInstance, out GUIElementStateStyle value);
  185. [MethodImpl(MethodImplOptions.InternalCall)]
  186. private static extern void Internal_SetHover(IntPtr nativeInstance, GUIElementStateStyle value);
  187. [MethodImpl(MethodImplOptions.InternalCall)]
  188. private static extern void Internal_GetActive(IntPtr nativeInstance, out GUIElementStateStyle value);
  189. [MethodImpl(MethodImplOptions.InternalCall)]
  190. private static extern void Internal_SetActive(IntPtr nativeInstance, GUIElementStateStyle value);
  191. [MethodImpl(MethodImplOptions.InternalCall)]
  192. private static extern void Internal_GetFocused(IntPtr nativeInstance, out GUIElementStateStyle value);
  193. [MethodImpl(MethodImplOptions.InternalCall)]
  194. private static extern void Internal_SetFocused(IntPtr nativeInstance, GUIElementStateStyle value);
  195. [MethodImpl(MethodImplOptions.InternalCall)]
  196. private static extern void Internal_GetNormalOn(IntPtr nativeInstance, out GUIElementStateStyle value);
  197. [MethodImpl(MethodImplOptions.InternalCall)]
  198. private static extern void Internal_SetNormalOn(IntPtr nativeInstance, GUIElementStateStyle value);
  199. [MethodImpl(MethodImplOptions.InternalCall)]
  200. private static extern void Internal_GetHoverOn(IntPtr nativeInstance, out GUIElementStateStyle value);
  201. [MethodImpl(MethodImplOptions.InternalCall)]
  202. private static extern void Internal_SetHoverOn(IntPtr nativeInstance, GUIElementStateStyle value);
  203. [MethodImpl(MethodImplOptions.InternalCall)]
  204. private static extern void Internal_GetActiveOn(IntPtr nativeInstance, out GUIElementStateStyle value);
  205. [MethodImpl(MethodImplOptions.InternalCall)]
  206. private static extern void Internal_SetActiveOn(IntPtr nativeInstance, GUIElementStateStyle value);
  207. [MethodImpl(MethodImplOptions.InternalCall)]
  208. private static extern void Internal_GetFocusedOn(IntPtr nativeInstance, out GUIElementStateStyle value);
  209. [MethodImpl(MethodImplOptions.InternalCall)]
  210. private static extern void Internal_SetFocusedOn(IntPtr nativeInstance, GUIElementStateStyle value);
  211. [MethodImpl(MethodImplOptions.InternalCall)]
  212. private static extern void Internal_GetBorder(IntPtr nativeInstance, out RectOffset value);
  213. [MethodImpl(MethodImplOptions.InternalCall)]
  214. private static extern void Internal_SetBorder(IntPtr nativeInstance, ref RectOffset value);
  215. [MethodImpl(MethodImplOptions.InternalCall)]
  216. private static extern void Internal_GetMargins(IntPtr nativeInstance, out RectOffset value);
  217. [MethodImpl(MethodImplOptions.InternalCall)]
  218. private static extern void Internal_SetMargins(IntPtr nativeInstance, ref RectOffset value);
  219. [MethodImpl(MethodImplOptions.InternalCall)]
  220. private static extern void Internal_GetContentOffset(IntPtr nativeInstance, out RectOffset value);
  221. [MethodImpl(MethodImplOptions.InternalCall)]
  222. private static extern void Internal_SetContentOffset(IntPtr nativeInstance, ref RectOffset value);
  223. [MethodImpl(MethodImplOptions.InternalCall)]
  224. private static extern void Internal_GetWidth(IntPtr nativeInstance, out int value);
  225. [MethodImpl(MethodImplOptions.InternalCall)]
  226. private static extern void Internal_SetWidth(IntPtr nativeInstance, int value);
  227. [MethodImpl(MethodImplOptions.InternalCall)]
  228. private static extern void Internal_GetHeight(IntPtr nativeInstance, out int value);
  229. [MethodImpl(MethodImplOptions.InternalCall)]
  230. private static extern void Internal_SetHeight(IntPtr nativeInstance, int value);
  231. [MethodImpl(MethodImplOptions.InternalCall)]
  232. private static extern void Internal_GetMinWidth(IntPtr nativeInstance, out int value);
  233. [MethodImpl(MethodImplOptions.InternalCall)]
  234. private static extern void Internal_SetMinWidth(IntPtr nativeInstance, int value);
  235. [MethodImpl(MethodImplOptions.InternalCall)]
  236. private static extern void Internal_GetMaxWidth(IntPtr nativeInstance, out int value);
  237. [MethodImpl(MethodImplOptions.InternalCall)]
  238. private static extern void Internal_SetMaxWidth(IntPtr nativeInstance, int value);
  239. [MethodImpl(MethodImplOptions.InternalCall)]
  240. private static extern void Internal_GetMinHeight(IntPtr nativeInstance, out int value);
  241. [MethodImpl(MethodImplOptions.InternalCall)]
  242. private static extern void Internal_SetMinHeight(IntPtr nativeInstance, int value);
  243. [MethodImpl(MethodImplOptions.InternalCall)]
  244. private static extern void Internal_GetMaxHeight(IntPtr nativeInstance, out int value);
  245. [MethodImpl(MethodImplOptions.InternalCall)]
  246. private static extern void Internal_SetMaxHeight(IntPtr nativeInstance, int value);
  247. [MethodImpl(MethodImplOptions.InternalCall)]
  248. private static extern void Internal_GetFixedWidth(IntPtr nativeInstance, out bool value);
  249. [MethodImpl(MethodImplOptions.InternalCall)]
  250. private static extern void Internal_SetFixedWidth(IntPtr nativeInstance, bool value);
  251. [MethodImpl(MethodImplOptions.InternalCall)]
  252. private static extern void Internal_GetFixedHeight(IntPtr nativeInstance, out bool value);
  253. [MethodImpl(MethodImplOptions.InternalCall)]
  254. private static extern void Internal_SetFixedHeight(IntPtr nativeInstance, bool value);
  255. }
  256. }