1
0

wa2wndembed.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. #ifndef __WA2WNDEMBED_H
  2. #define __WA2WNDEMBED_H
  3. #include "../winamp/wa_ipc.h"
  4. #include <api/service/svcs/svc_wndcreate.h>
  5. #include <bfc/depview.h>
  6. #include <bfc/reentryfilter.h>
  7. #include <api/wndmgr/appcmds.h>
  8. #include <api/skin/widgets/xuioswndhost.h>
  9. #include <api/script/objects/c_script/h_layout.h>
  10. #include <api/syscb/callbacks/wndcb.h>
  11. #include "wa2pldirobj.h"
  12. class BucketItem;
  13. class XuiOSWndHost;
  14. class Wa2BucketItem;
  15. #define EMBED_STATE_EXTRA_LINK 0
  16. #define EMBED_STATE_EXTRA_ATTACHED 1
  17. #define EMBED_STATE_EXTRA_HOSTCOUNT 61
  18. #define EMBED_STATE_EXTRA_REPARENTING 62
  19. #define EMBED_STATE_EXTRA_FFROOTWND 63
  20. //-----------------------------------------------------------------------------------------------
  21. // {E6323F86-1724-4cd3-9D87-70591FC16E5E}
  22. static const GUID playerWndGuid =
  23. { 0xe6323f86, 0x1724, 0x4cd3, { 0x9d, 0x87, 0x70, 0x59, 0x1f, 0xc1, 0x6e, 0x5e } };
  24. // benski> don't use this in a windowholder, this is for <container primarycontent="guid:main"/>
  25. //-----------------------------------------------------------------------------------------------
  26. // {45F3F7C1-A6F3-4ee6-A15E-125E92FC3F8D}
  27. static const GUID pleditWndGuid =
  28. { 0x45f3f7c1, 0xa6f3, 0x4ee6, { 0xa1, 0x5e, 0x12, 0x5e, 0x92, 0xfc, 0x3f, 0x8d } };
  29. //-----------------------------------------------------------------------------------------------
  30. // {F0816D7B-FFFC-4343-80F2-E8199AA15CC3}
  31. static const GUID videoWndGuid =
  32. { 0xf0816d7b, 0xfffc, 0x4343, { 0x80, 0xf2, 0xe8, 0x19, 0x9a, 0xa1, 0x5c, 0xc3 } };
  33. #ifdef MINIBROWSER_SUPPORT
  34. //-----------------------------------------------------------------------------------------------
  35. // {CF477C3E-FDC8-44a2-9066-58D0184D47A8}
  36. static const GUID minibrowserWndGuid =
  37. { 0xcf477c3e, 0xfdc8, 0x44a2, { 0x90, 0x66, 0x58, 0xd0, 0x18, 0x4d, 0x47, 0xa8 } };
  38. #endif
  39. // scan
  40. static const GUID embedWndGuids =
  41. { 0x00000000, 0xf000, 0x44a2, { 0x90, 0x66, 0x58, 0xd0, 0x18, 0x4d, 0x47, 0xa8 } };
  42. // {A8533CEC-D05D-45b8-A617-E2B7F2C2CF82}
  43. static const GUID embeddedWndStateGuid =
  44. { 0xa8533cec, 0xd05d, 0x45b8, { 0xa6, 0x17, 0xe2, 0xb7, 0xf2, 0xc2, 0xcf, 0x82 } };
  45. // {6B0EDF80-C9A5-11d3-9F26-00C04F39FFC6}
  46. static const GUID library_guid =
  47. { 0x6b0edf80, 0xc9a5, 0x11d3, { 0x9f, 0x26, 0x0, 0xc0, 0x4f, 0x39, 0xff, 0xc6 } };
  48. // {B397A4CE-455A-4d62-8BF6-D0F91ACB70E6}
  49. static const GUID preferences_guid =
  50. { 0xb397a4ce, 0x455a, 0x4d62, { 0x8b, 0xf6, 0xd0, 0xf9, 0x1a, 0xcb, 0x70, 0xe6 } };
  51. // {0000000A-000C-0010-FF7B-01014263450C}
  52. static const GUID avs_guid =
  53. { 10, 12, 16, { 255, 123, 1, 1, 66, 99, 69, 12 } };
  54. // {8DDA9D48-B915-4320-A888-831A1D837516}
  55. static const GUID about_guid =
  56. { 0x8dda9d48, 0xb915, 0x4320, { 0xa8, 0x88, 0x83, 0x1a, 0x1d, 0x83, 0x75, 0x16 } };
  57. // {D6201408-476A-4308-BF1B-7BACA1124B12}
  58. static const GUID lightning_bolt_guid =
  59. { 0xd6201408, 0x476a, 0x4308, { 0xbf, 0x1b, 0x7b, 0xac, 0xa1, 0x12, 0x4b, 0x12 } };
  60. // {53DE6284-7E88-4c62-9F93-22ED68E6A024}
  61. static const GUID colorthemes_guid =
  62. { 0x53de6284, 0x7e88, 0x4c62, { 0x9f, 0x93, 0x22, 0xed, 0x68, 0xe6, 0xa0, 0x24 } };
  63. //-----------------------------------------------------------------------------------------------
  64. class WaOsWndHost : public XuiOSWndHost
  65. {
  66. public:
  67. WaOsWndHost() : transparencysafe(1), transfer(0) {}
  68. virtual void onBeforeReparent(int i);
  69. virtual void onAfterReparent(int i);
  70. virtual int wantHideOnUnhost() { return 1; }
  71. virtual int wantFocus();
  72. virtual int onGetFocus();
  73. virtual int handleTransparency() { return transparencysafe; }
  74. virtual void setNoTransparency() { transparencysafe = 0; }
  75. void setTransfering(int i) { transfer = i; }
  76. int isTransfering() { return transfer; }
  77. virtual int onMouseWheelUp(int click, int lines);
  78. virtual int onMouseWheelDown(int click, int lines);
  79. private:
  80. int transparencysafe;
  81. int transfer;
  82. };
  83. //-----------------------------------------------------------------------------------------------
  84. class VideoLayoutMonitor : public H_Layout
  85. {
  86. public:
  87. VideoLayoutMonitor(ScriptObject *o) : H_Layout(o) { }
  88. VideoLayoutMonitor() {}
  89. virtual void hook_onResize(int x, int y, int w, int h);
  90. virtual void hook_onMove();
  91. };
  92. //-----------------------------------------------------------------------------------------------
  93. class EmbedEntry
  94. {
  95. public:
  96. WaOsWndHost *host;
  97. ifc_dependent *dep;
  98. intptr_t whichwnd;
  99. AppCmds *cmds;
  100. VideoLayoutMonitor *monitor;
  101. GUID g;
  102. };
  103. class WndStatus
  104. {
  105. public:
  106. int wndcode; // or -1
  107. HWND wnd;
  108. int visible;
  109. RECT position;
  110. };
  111. //-----------------------------------------------------------------------------------------------
  112. class Wa2WndEmbed : public svc_windowCreateI, DependentViewerTPtr<ifc_window>, public WndCallbackI
  113. {
  114. public:
  115. Wa2WndEmbed();
  116. virtual ~Wa2WndEmbed();
  117. static const char *getServiceName() { return "Playlist Editor window creator"; }
  118. virtual int testGuid(GUID g);
  119. virtual ifc_window *createWindowByGuid(GUID g, ifc_window *parent);
  120. virtual int testType(const wchar_t *windowtype);
  121. virtual ifc_window *createWindowOfType(const wchar_t *windowtype, ifc_window *parent, int n);
  122. virtual int destroyWindow(ifc_window *w);
  123. virtual int viewer_onEvent(ifc_window *item, int event, intptr_t param, void *ptr, size_t ptrlen);
  124. static void rememberVisibleWindows();
  125. static void restoreVisibleWindows();
  126. static int hadRememberedWndVisible(HWND wnd);
  127. static int embedRememberProc(embedWindowState *p, embedEnumStruct *parms);
  128. virtual int onShowWindow(Container *c, GUID guid, const wchar_t *groupid);
  129. virtual int onHideWindow(Container *c, GUID guid, const wchar_t *groupid);
  130. PtrList<Wa2BucketItem> bucketitems;
  131. PtrList<EmbedEntry> wndhosts;
  132. PtrList<PlDirObject> pldirs;
  133. static PtrList<WndStatus> wa2wndstatus;
  134. static int switching_holder;
  135. };
  136. extern ReentryFilterObject wndMsgFilter;
  137. //-----------------------------------------------------------------------------------------------
  138. class PlaylistAppCmds : public AppCmdsI
  139. {
  140. public:
  141. PlaylistAppCmds();
  142. virtual ~PlaylistAppCmds() {}
  143. virtual void appcmds_onCommand(int id, const RECT *buttonRect, int which_button);
  144. enum {
  145. PL_ADD=0,
  146. PL_REM,
  147. PL_SEL,
  148. PL_MISC,
  149. PL_LIST,
  150. };
  151. protected:
  152. CmdRec addCmd, remCmd, selCmd, miscCmd, listCmd;
  153. };
  154. #ifdef MINIBROWSER_SUPPORT
  155. //-----------------------------------------------------------------------------------------------
  156. class MinibrowserAppCmds : public AppCmdsI {
  157. public:
  158. MinibrowserAppCmds();
  159. virtual ~MinibrowserAppCmds() {}
  160. virtual void appcmds_onCommand(int id, const RECT *buttonRect, int which_button);
  161. enum {
  162. MB_BACK=0,
  163. MB_FORWARD,
  164. MB_STOP,
  165. MB_RELOAD,
  166. MB_MISC,
  167. };
  168. };
  169. #endif
  170. //-----------------------------------------------------------------------------------------------
  171. class VideoAppCmds : public AppCmdsI {
  172. public:
  173. VideoAppCmds();
  174. virtual ~VideoAppCmds() {}
  175. virtual void appcmds_onCommand(int id, const RECT *buttonRect, int which_button);
  176. enum {
  177. VID_FULLSCREEN=0,
  178. VID_1X,
  179. VID_2X,
  180. VID_LIB,
  181. VID_MISC,
  182. };
  183. };
  184. #endif