UI.pkg 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. $#include "UI/UI.h"
  2. class UI : public Object
  3. {
  4. void SetCursor(Cursor* cursor);
  5. void SetFocusElement(UIElement* element, bool byKey = false);
  6. bool SetModalElement(UIElement* modalElement, bool enable);
  7. void Clear();
  8. void DebugDraw(UIElement* element);
  9. tolua_outside UIElement* UILoadLayout @ LoadLayout(File* source, XMLFile* styleFile = 0);
  10. tolua_outside UIElement* UILoadLayout @ LoadLayout(const String fileName, XMLFile* styleFile = 0);
  11. tolua_outside UIElement* UILoadLayout @ LoadLayout(XMLFile* file, XMLFile* styleFile = 0);
  12. bool SaveLayout(Serializer& dest, UIElement* element);
  13. void SetClipboardText(const String text);
  14. void SetDoubleClickInterval(float interval);
  15. void SetDragBeginInterval(float interval);
  16. void SetDragBeginDistance(int pixels);
  17. void SetDefaultToolTipDelay(float delay);
  18. void SetMaxFontTextureSize(int size);
  19. void SetNonFocusedMouseWheel(bool nonFocusedMouseWheel);
  20. void SetUseSystemClipboard(bool enable);
  21. void SetUseScreenKeyboard(bool enable);
  22. void SetUseMutableGlyphs(bool enable);
  23. void SetForceAutoHint(bool enable);
  24. void SetScale(float scale);
  25. void SetWidth(float width);
  26. void SetHeight(float height);
  27. void SetCustomSize(const IntVector2& size);
  28. void SetCustomSize(int width, int height);
  29. UIElement* GetRoot() const;
  30. UIElement* GetRootModalElement() const;
  31. Cursor* GetCursor() const;
  32. IntVector2 GetCursorPosition() const;
  33. UIElement* GetElementAt(const IntVector2& position, bool enabledOnly = true);
  34. UIElement* GetElementAt(int x, int y, bool enabledOnly = true);
  35. UIElement* GetFocusElement() const;
  36. UIElement* GetFrontElement() const;
  37. UIElement* GetDragElement(unsigned index);
  38. const String GetClipboardText() const;
  39. float GetDoubleClickInterval() const;
  40. float GetDragBeginInterval() const;
  41. int GetDragBeginDistance() const;
  42. float GetDefaultToolTipDelay() const;
  43. int GetMaxFontTextureSize() const;
  44. bool IsNonFocusedMouseWheel() const;
  45. bool GetUseSystemClipboard() const;
  46. bool GetUseScreenKeyboard() const;
  47. bool GetUseMutableGlyphs() const;
  48. bool GetForceAutoHint() const;
  49. bool HasModalElement() const;
  50. bool IsDragging() const;
  51. float GetScale() const;
  52. const IntVector2& GetCustomSize() const;
  53. tolua_readonly tolua_property__get_set UIElement* root;
  54. tolua_readonly tolua_property__get_set UIElement* rootModalElement;
  55. tolua_property__get_set Cursor* cursor;
  56. tolua_readonly tolua_property__get_set IntVector2 cursorPosition;
  57. tolua_readonly tolua_property__get_set UIElement* focusElement;
  58. tolua_readonly tolua_property__get_set UIElement* frontElement;
  59. tolua_property__get_set String clipboardText;
  60. tolua_property__get_set float doubleClickInterval;
  61. tolua_property__get_set float dragBeginInterval;
  62. tolua_property__get_set int dragBeginDistance;
  63. tolua_property__get_set float defaultToolTipDelay;
  64. tolua_property__get_set int maxFontTextureSize;
  65. tolua_property__is_set bool nonFocusedMouseWheel;
  66. tolua_property__get_set bool useSystemClipboard;
  67. tolua_property__get_set bool useScreenKeyboard;
  68. tolua_property__get_set bool useMutableGlyphs;
  69. tolua_property__get_set bool forceAutoHint;
  70. tolua_readonly tolua_property__has_set bool modalElement;
  71. tolua_property__get_set float scale;
  72. tolua_property__get_set IntVector2& customSize;
  73. };
  74. UI* GetUI();
  75. tolua_readonly tolua_property__get_set UI* ui;
  76. ${
  77. static UIElement* UILoadLayout(UI* ui, File* source, XMLFile* styleFile)
  78. {
  79. if (!source)
  80. return 0;
  81. return ui->LoadLayout(*source, styleFile).Detach();
  82. }
  83. static UIElement* UILoadLayout(UI* ui, const String& fileName, XMLFile* styleFile)
  84. {
  85. File file(ui->GetContext(), fileName, FILE_READ);
  86. if (!file.IsOpen())
  87. return 0;
  88. return ui->LoadLayout(file, styleFile).Detach();
  89. }
  90. static UIElement* UILoadLayout(UI* ui, XMLFile* source, XMLFile* styleFile)
  91. {
  92. if (!source)
  93. return 0;
  94. return ui->LoadLayout(source, styleFile).Detach();
  95. }
  96. #define TOLUA_DISABLE_tolua_UILuaAPI_GetUI00
  97. static int tolua_UILuaAPI_GetUI00(lua_State* tolua_S)
  98. {
  99. return ToluaGetSubsystem<UI>(tolua_S);
  100. }
  101. #define TOLUA_DISABLE_tolua_get_ui_ptr
  102. #define tolua_get_ui_ptr tolua_UILuaAPI_GetUI00
  103. $}