wa2pldirobj.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #pragma once
  2. #include <api/script/objects/rootobj.h>
  3. #include <api/script/objcontroller.h>
  4. #include <api/script/scriptobj.h>
  5. #include <bfc/depend.h>
  6. #include <api/service/svcs/svc_scriptobji.h>
  7. #include <api/wnd/wndclass/listwnd.h>
  8. #include "wa2playlist.h"
  9. #include <api/syscb/callbacks/playlistcb.h>
  10. #include <api/service/svcs/svc_scriptobji.h>
  11. class PlDirObject;
  12. extern ScriptObjectController *pldirController;
  13. // -----------------------------------------------------------------------------------------------------
  14. // ScriptObject Service
  15. class PlDirScriptObjectSvc : public svc_scriptObjectI {
  16. public:
  17. PlDirScriptObjectSvc() {};
  18. virtual ~PlDirScriptObjectSvc() {};
  19. static const char *getServiceName() { return "PlDir script object"; }
  20. virtual ScriptObjectController *getController(int n);
  21. };
  22. // -----------------------------------------------------------------------------------------------------
  23. // Script classe GUIDS
  24. // {61A7ABAD-7D79-41f6-B1D0-E1808603A4F4}
  25. static const GUID PLDIR_SCRIPTOBJECT_GUID =
  26. { 0x61a7abad, 0x7d79, 0x41f6, { 0xb1, 0xd0, 0xe1, 0x80, 0x86, 0x3, 0xa4, 0xf4 } };
  27. // -----------------------------------------------------------------------------------------------------
  28. // ScriptObject Interface
  29. // PlDir
  30. class PlDirObject : public ListWnd, public PlaylistCallbackI
  31. {
  32. public:
  33. PlDirObject();
  34. virtual ~PlDirObject();
  35. virtual int onInit();
  36. //virtual int onResize();
  37. virtual int wantResizeCols() { return 0; }
  38. virtual int wantHScroll() { return 0; }
  39. virtual void onDoubleClick(int itemnum);
  40. virtual Wa2Playlist *getPlaylist(int itemnum);
  41. /* PlaylistCallbackI method overrides */
  42. int playlistcb_added(size_t index);
  43. int playlistcb_saved(size_t index);
  44. int onDeferredCallback(intptr_t p1, intptr_t p2);
  45. void Populate();
  46. private:
  47. PtrList<Wa2Playlist> playlists;
  48. };
  49. // -----------------------------------------------------------------------------------------------------
  50. // ScriptObjectControllers for our script classes
  51. // PlDir
  52. class PlDirScriptObjectController : public ScriptObjectControllerI {
  53. public:
  54. virtual const wchar_t *getClassName() { return L"PlDir"; }
  55. virtual const wchar_t *getAncestorClassName() { return L"Object"; }
  56. virtual ScriptObjectController *getAncestorController() { return NULL; }
  57. virtual int getNumFunctions();
  58. virtual const function_descriptor_struct *getExportedFunctions() { return exportedFunction; }
  59. virtual GUID getClassGuid() { return PLDIR_SCRIPTOBJECT_GUID; }
  60. virtual int getInstantiable() { return 0; }
  61. virtual int getReferenceable() { return 0; }
  62. virtual ScriptObject *instantiate();
  63. virtual void destroy(ScriptObject *o);
  64. virtual void *encapsulate(ScriptObject *o);
  65. virtual void deencapsulate(void *o);
  66. virtual ~PlDirScriptObjectController();
  67. // Maki functions table
  68. static scriptVar pldir_showCurrentlyPlayingEntry(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  69. static scriptVar pldir_getNumItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  70. static scriptVar pldir_renameItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item, scriptVar name);
  71. static scriptVar pldir_getItemName(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item);
  72. static scriptVar pldir_playItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item);
  73. static scriptVar pldir_enqueueItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item);
  74. static scriptVar pldir_refresh(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  75. PtrList<PlDirObject> mylist;
  76. private:
  77. static function_descriptor_struct exportedFunction[];
  78. };
  79. extern const wchar_t plDirXuiObjectStr[];
  80. extern char plDirXuiSvcName[];
  81. class PlDirXuiSvc : public XuiObjectSvc<PlDirObject, plDirXuiObjectStr, plDirXuiSvcName> {};