pslider.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef _PSLIDER_H
  2. #define _PSLIDER_H
  3. #include <api/wnd/wndclass/slider.h>
  4. #include <api/script/objects/guiobj.h>
  5. #include <api/skin/widgets.h>
  6. #define PSLIDER_PARENT SliderWnd
  7. class SliderScriptController : public GuiObjectScriptController {
  8. public:
  9. virtual const wchar_t *getClassName();
  10. virtual const wchar_t *getAncestorClassName();
  11. virtual ScriptObjectController *getAncestorController() { return guiController; }
  12. virtual int getNumFunctions();
  13. virtual const function_descriptor_struct *getExportedFunctions();
  14. virtual GUID getClassGuid();
  15. virtual ScriptObject *instantiate();
  16. virtual void destroy(ScriptObject *o);
  17. virtual void *encapsulate(ScriptObject *o);
  18. virtual void deencapsulate(void *o);
  19. private:
  20. static function_descriptor_struct exportedFunction[];
  21. };
  22. extern SliderScriptController *sliderController;
  23. class PSliderWnd : public PSLIDER_PARENT {
  24. public:
  25. PSliderWnd();
  26. virtual ~PSliderWnd();
  27. virtual int onSetPosition();
  28. virtual int onSetFinalPosition();
  29. virtual int onPostedPosition(int p);
  30. virtual void lock();
  31. virtual void unlock();
  32. virtual int setXuiParam(int _xuihandle, int attribid, const wchar_t *paramname, const wchar_t *strvalue);
  33. virtual const wchar_t *vcpu_getClassName();
  34. virtual ScriptObjectController *vcpu_getController() { return sliderController; }
  35. /* virtual int getAutoHeight();
  36. virtual int getAutoWidth();*/
  37. virtual int onInit();
  38. #ifdef WASABI_COMPILE_CONFIG
  39. virtual int onReloadConfig();
  40. void reloadConfig();
  41. #endif
  42. virtual int scriptDivisor() { return 1; }
  43. enum {
  44. PSLIDER_SETBARLEFT=0,
  45. PSLIDER_SETBARMIDDLE,
  46. PSLIDER_SETBARRIGHT,
  47. PSLIDER_SETTHUMB,
  48. PSLIDER_SETDOWNTHUMB,
  49. PSLIDER_SETHOVERTHUMB,
  50. PSLIDER_SETORIENTATION,
  51. PSLIDER_SETLOW,
  52. PSLIDER_SETHIGH,
  53. PSLIDER_SETHOTPOS,
  54. PSLIDER_SETHOTRANGE,
  55. PSLIDER_SETSTRETCHTHUMB,
  56. PSLIDER_NUMPARAMS,
  57. };
  58. protected:
  59. /*static */void CreateXMLParameters(int master_handle);
  60. public:
  61. static scriptVar script_setPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v);
  62. static scriptVar script_getPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  63. static scriptVar script_onSetPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar p);
  64. static scriptVar script_onPostedPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar p);
  65. static scriptVar script_onSetFinalPosition(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar p);
  66. static scriptVar script_lock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  67. static scriptVar script_unlock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  68. private:
  69. int xuihandle;
  70. static XMLParamPair params[];
  71. };
  72. class SliderXuiSvc : public svc_xuiObjectI {
  73. public:
  74. SliderXuiSvc() {};
  75. virtual ~SliderXuiSvc() {};
  76. static const char *getServiceName() { return "Slider xui object"; }
  77. static const wchar_t *xuisvc_getXmlTag() { return L"Slider"; }
  78. virtual int testTag(const wchar_t *xmltag) { return !WCSICMP(xmltag, L"Slider"); }
  79. virtual GuiObject *instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params=NULL);
  80. virtual void destroy(GuiObject *g);
  81. };
  82. #endif