xuiframe.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef __XUIFRAME_H
  2. #define __XUIFRAME_H
  3. #include <api/wnd/wndclass/framewnd.h>
  4. #include <api/script/objects/guiobj.h>
  5. #define SCRIPTFRAME_PARENT FrameWnd
  6. /* --------- Script Object for ScriptFrame --------- */
  7. class FrameScriptController : public GuiObjectScriptController
  8. {
  9. public:
  10. virtual const wchar_t *getClassName();
  11. virtual const wchar_t *getAncestorClassName();
  12. virtual ScriptObjectController *getAncestorController() { return guiController; }
  13. virtual int getNumFunctions();
  14. virtual const function_descriptor_struct *getExportedFunctions();
  15. virtual GUID getClassGuid();
  16. virtual ScriptObject *instantiate();
  17. virtual void destroy(ScriptObject *o);
  18. virtual void *encapsulate(ScriptObject *o);
  19. virtual void deencapsulate(void *o);
  20. private:
  21. static function_descriptor_struct exportedFunction[];
  22. };
  23. extern FrameScriptController *frameController;
  24. // -----------------------------------------------------------------------
  25. // Your wnd object class
  26. class ScriptFrame : public SCRIPTFRAME_PARENT {
  27. public:
  28. ScriptFrame();
  29. virtual ~ScriptFrame();
  30. virtual int onInit();
  31. virtual int setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value);
  32. void setOrientation(const wchar_t *elementname);
  33. void setLeft(const wchar_t *groupname);
  34. void setRight(const wchar_t *groupname);
  35. void setFrom(const wchar_t *from);
  36. void setWidth(const wchar_t *w);
  37. void setResize(const wchar_t *r);
  38. virtual int wantRenderBaseTexture() { return 0; }
  39. void onResizeChildren(RECT leftr, RECT rightr);
  40. virtual const wchar_t *vcpu_getClassName();
  41. virtual ScriptObjectController *vcpu_getController() { return frameController; }
  42. protected:
  43. /*static */void CreateXMLParameters(int master_handle);
  44. private:
  45. // a list of IDs for our xml attributes, we use them in addParam() in the constructor
  46. enum {
  47. SCRIPTFRAME_SETORIENTATION = 0,
  48. SCRIPTFRAME_SETLEFT,
  49. SCRIPTFRAME_SETRIGHT,
  50. SCRIPTFRAME_SETFROM,
  51. SCRIPTFRAME_SETWIDTH,
  52. SCRIPTFRAME_SETRESIZEABLE,
  53. SCRIPTFRAME_SETMAXWIDTH,
  54. SCRIPTFRAME_SETMINWIDTH,
  55. SCRIPTFRAME_SETSNAP,
  56. SCRIPTFRAME_SETV_BITMAP,
  57. SCRIPTFRAME_SETV_GRABBER,
  58. };
  59. static XMLParamPair params[];
  60. int myxuihandle;
  61. StringW left, right;
  62. ifc_window *rootwndleft, *rootwndright;
  63. int from, orientation, resizable;
  64. int width;
  65. public:
  66. static scriptVar script_vcpu_setPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar t);
  67. static scriptVar script_vcpu_getPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  68. };
  69. // -----------------------------------------------------------------------
  70. // This defines the svc_xuiObject that exposes your wnd object
  71. extern const wchar_t ScriptFrameXuiObjectStr[];
  72. extern char ScriptFrameXuiSvcName[];
  73. class FrameXuiSvc : public XuiObjectSvc<ScriptFrame, ScriptFrameXuiObjectStr, ScriptFrameXuiSvcName> {};
  74. #endif