compbuck2.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //PORTABLE
  2. #ifndef _COMPBUCK_H
  3. #define _COMPBUCK_H
  4. #include <api/wnd/wndclass/clickwnd.h>
  5. #include <api/skin/widgets/text.h>
  6. #include <api/wnd/wndclass/guiobjwnd.h>
  7. #include <api/service/svc_enum.h>
  8. #include <api/script/objects/guiobj.h>
  9. #include <api/service/svcs/svc_wndcreate.h>
  10. // {97AA3E4D-F4D0-4fa8-817B-0AF22A454983}
  11. static const GUID cbucketGuid =
  12. { 0x97aa3e4d, 0xf4d0, 0x4fa8, { 0x81, 0x7b, 0xa, 0xf2, 0x2a, 0x45, 0x49, 0x83 } };
  13. #define COMPONENTBUCKET2_PARENT GuiObjectWnd
  14. #define COMPONENTBUCKET2_XMLPARENT GuiObjectWnd
  15. class CompBucketScriptController: public GuiObjectScriptController {
  16. public:
  17. virtual const wchar_t *getClassName();
  18. virtual const wchar_t *getAncestorClassName();
  19. virtual ScriptObjectController *getAncestorController() { return guiController; }
  20. virtual int getNumFunctions();
  21. virtual const function_descriptor_struct *getExportedFunctions();
  22. virtual GUID getClassGuid();
  23. virtual ScriptObject *instantiate();
  24. virtual void destroy(ScriptObject *o);
  25. virtual void *encapsulate(ScriptObject *o);
  26. virtual void deencapsulate(void *o);
  27. private:
  28. static function_descriptor_struct exportedFunction[];
  29. };
  30. extern CompBucketScriptController *cbucketController;
  31. class Layout;
  32. class ServiceWndHolder;
  33. class ComponentBucket2 : public COMPONENTBUCKET2_PARENT {
  34. public:
  35. ComponentBucket2();
  36. virtual ~ComponentBucket2();
  37. virtual int onInit();
  38. virtual int setXuiParam(int _xuihandle, int id, const wchar_t *name, const wchar_t *strval);
  39. /* virtual int getAutoHeight();
  40. virtual int getAutoWidth();*/
  41. virtual void timerCallback(int id);
  42. virtual int childNotify(ifc_window *child, int msg, intptr_t p1, intptr_t p2);
  43. virtual int onResize();
  44. virtual void setLMargin(int i);
  45. virtual void setRMargin(int i);
  46. virtual void setSpacing(int i);
  47. virtual int getLMargin(void);
  48. virtual int getRMargin(void);
  49. virtual int getSpacing(void);
  50. void next_page();
  51. void prev_page();
  52. void next_down();
  53. void next_up();
  54. void prev_down();
  55. void prev_up();
  56. static void next_down(Group *l); // next_down on all compbucks in this group
  57. static void next_up(Group *l); // next_up on all compbucks in this group
  58. static void prev_down(Group *l); // prev_down on all compbucks in this group
  59. static void prev_up(Group *l); // prev_up on all compbucks in this group
  60. static void prev_page(Group *l); // prev_down on all compbucks in this group
  61. static void next_page(Group *l); // prev_up on all compbucks in this group
  62. void setText(const wchar_t *txt);
  63. static void setText(ifc_window *cb , const wchar_t *txt); // set this text for this compbuck's rootwnd
  64. static void registerText(Text *t, const wchar_t *id=NULL); // id=NULL => register for all compbucks in this group
  65. static void unRegisterText(Text *t, const wchar_t *id=NULL); // id=NULL => unregister for all compbucks in this group
  66. static ComponentBucket2 *getComponentBucket(const wchar_t *cb);
  67. int getMaxWidth();
  68. int getMaxHeight();
  69. void setVertical(int v);
  70. void setScroll(int v);
  71. int getScroll();
  72. int getNumChildren();
  73. GuiObject *enumChildren(int i);
  74. protected:
  75. /*static */void CreateXMLParameters(int master_handle);
  76. enum {
  77. COMPBUCK_LEFTMARGIN=0,
  78. COMPBUCK_RIGHTMARGIN,
  79. COMPBUCK_SPACING,
  80. COMPBUCK_VERTICAL,
  81. COMPBUCK_WNDTYPE,
  82. };
  83. private:
  84. void load();
  85. void addItems(svc_windowCreate *wc);
  86. void doRegisterText(Text *t);
  87. void doUnregisterText(Text *t);
  88. int timeron;
  89. static PtrList<ComponentBucket2> cblist;
  90. PtrList<Text> txtlist;
  91. StringW id;
  92. PtrList<ServiceWndHolder> myclients;
  93. int lmargin;
  94. int rmargin;
  95. int spacing;
  96. int xscroll;
  97. int direction;
  98. int timerset;
  99. void startScrollTimer();
  100. void stopScrollTimer();
  101. uint32_t lastticcount;
  102. int vertical;
  103. int xuihandle;
  104. static XMLParamPair params[];
  105. StringW wndtype;
  106. uint32_t scrollpage_starttime;
  107. int scrollpage_timerset;
  108. int scrollpage_start;
  109. int scrollpage_target;
  110. int scrollpage_speed;
  111. public:
  112. static scriptVar script_vcpu_fake(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  113. static scriptVar script_vcpu_getMaxWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  114. static scriptVar script_vcpu_getMaxHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  115. static scriptVar script_vcpu_getScroll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  116. static scriptVar script_vcpu_setScroll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v);
  117. static scriptVar script_vcpu_getNumChildren(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  118. static scriptVar script_vcpu_enumChildren(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v);
  119. };
  120. extern const wchar_t componentBucketXuiObjectStr[];
  121. extern char componentBucketXuiSvcName[];
  122. class ComponentBucketXuiSvc : public XuiObjectSvc<ComponentBucket2, componentBucketXuiObjectStr, componentBucketXuiSvcName> {};
  123. #endif