xuitabsheet.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef __SCRIPTTABSHEET_H
  2. #define __SCRIPTTABSHEET_H
  3. #include <api/wnd/wndclass/typesheet.h>
  4. #include <api/script/objcontroller.h>
  5. #define SCRIPTTABSHEET_PARENT TypeSheet
  6. // -----------------------------------------------------------------------
  7. // Your wnd object class
  8. class ScriptTabSheet : public SCRIPTTABSHEET_PARENT {
  9. public:
  10. ScriptTabSheet();
  11. virtual ~ScriptTabSheet();
  12. // XuiObject automatically calls this back for all parameters registered using addParam
  13. // encountered in the xml source
  14. virtual int setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value);
  15. void setWindowType(const wchar_t *elementname);
  16. void setChildrenIds(const wchar_t *paramvalue);
  17. void setType(const wchar_t *element);
  18. virtual int onInit();
  19. void setContentMarginX(const wchar_t *value, int what);
  20. protected:
  21. void CreateXMLParameters(int master_handle);
  22. private:
  23. // a list of IDs for our xml attributes, we use them in addParam() in the constructor
  24. enum {
  25. SCRIPTTABSHEET_SETWINDOWTYPE = 0,
  26. SCRIPTTABSHEET_SETCHILDREN,
  27. SCRIPTTABSHEET_SETTYPE,
  28. SCRIPTTABSHEET_SETCONTENTMARGINLEFT,
  29. SCRIPTTABSHEET_SETCONTENTMARGINTOP,
  30. SCRIPTTABSHEET_SETCONTENTMARGINRIGHT,
  31. SCRIPTTABSHEET_SETCONTENTMARGINBOTTOM,
  32. };
  33. static XMLParamPair params[];
  34. int myxuihandle;
  35. PtrList<StringW> children_id;
  36. void reloadChildren();
  37. int type;
  38. StringW wndtype;
  39. int left_margin, right_margin, top_margin, bottom_margin;
  40. };
  41. // -----------------------------------------------------------------------
  42. // This defines the svc_xuiObject that exposes your wnd object
  43. extern const wchar_t ScriptTabSheetXuiObjectStr[];
  44. extern char ScriptTabSheetXuiSvcName[];
  45. class ScriptTabSheetXuiSvc : public XuiObjectSvc<ScriptTabSheet, ScriptTabSheetXuiObjectStr, ScriptTabSheetXuiSvcName> {};
  46. // -----------------------------------------------------------------------------------------------------
  47. class ScriptTabSheetController : public ScriptObjectControllerI {
  48. public:
  49. virtual const wchar_t *getClassName() { return L"TabSheet"; }
  50. virtual const wchar_t *getAncestorClassName() { return L"GuiObject"; }
  51. virtual ScriptObjectController *getAncestorController() { return WASABI_API_MAKI->maki_getController(guiObjectGuid); }
  52. virtual int getNumFunctions();
  53. virtual const function_descriptor_struct *getExportedFunctions();
  54. virtual GUID getClassGuid() { return tabsheetGuid; }
  55. virtual ScriptObject *instantiate();
  56. virtual void destroy(ScriptObject *o);
  57. virtual void *encapsulate(ScriptObject *o);
  58. virtual void deencapsulate(void *o);
  59. public:
  60. static scriptVar tabsheet_getCurPage(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  61. static scriptVar tabsheet_setCurPage(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar a);
  62. static scriptVar tabsheet_getNumPages(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  63. static scriptVar tabsheet_nextPage(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  64. static scriptVar tabsheet_previousPage(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  65. private:
  66. static function_descriptor_struct exportedFunction[];
  67. };
  68. extern ScriptTabSheetController *tabsheetController;
  69. #endif