1
0

wa2songticker.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef NULLSOFT_GEN_FF_WA2SONGTICKER_H
  2. #define NULLSOFT_GEN_FF_WA2SONGTICKER_H
  3. //#include <api/wnd/wndclass/bufferpaintwnd.h>
  4. #include <api/skin/widgets/textbase.h>
  5. #include <api/syscb/callbacks/corecbi.h>
  6. #include <tataki/color/skinclr.h>
  7. #include <bfc/depend.h>
  8. #define SONGTICKER_PARENT TextBase
  9. class SongTicker
  10. : public SONGTICKER_PARENT, /* provides basic wasabi windowing functinoality */
  11. public CoreCallbackI, /* to get title change updates */
  12. public DependentViewerI /* for config callbacks*/
  13. {
  14. public:
  15. SongTicker();
  16. ~SongTicker();
  17. enum TickerMode
  18. {
  19. TICKER_OFF,
  20. TICKER_SCROLL,
  21. TICKER_BOUNCE,
  22. };
  23. int onAction(const wchar_t *action, const wchar_t *param, int x, int y, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source);
  24. protected:
  25. /* BaseWnd */
  26. virtual int onInit();
  27. virtual int onBufferPaint(BltCanvas *canvas, int w, int h); // draw the song ticker here
  28. /* TimerClient */
  29. virtual void timerCallback(int id); // scroll the song ticker every # seconds
  30. /* media core callbacks */
  31. /* TODO: benski> some thoughts... this differs from current behaviour but might be an interesting idea
  32. virtual int corecb_onStarted(); // start the ticker
  33. virtual int corecb_onStopped(); // go back to showing Winamp version string
  34. virtual int corecb_onPaused(); // pause the ticker
  35. virtual int corecb_onUnpaused(); // unpause the ticker
  36. // benski> currently unused in Winamp 5... might be worth implementing so we can draw text here
  37. virtual int corecb_onStatusMsg(const wchar_t *text);
  38. virtual int corecb_onWarningMsg(const wchar_t *text);
  39. virtual int corecb_onErrorMsg(const wchar_t *text);
  40. */
  41. virtual int corecb_onTitleChange(const wchar_t *title);
  42. // benski> not sure what the difference here is - virtual int corecb_onTitle2Change(const wchar_t *title2);
  43. virtual int corecb_onLengthChange(int newlength);
  44. void getBufferPaintSource(RECT *r);
  45. virtual void getBufferPaintSize(int *w, int *h);
  46. /* TextBase */
  47. void invalidateTextBuffer()
  48. {
  49. invalidateBuffer();
  50. }
  51. int viewer_onEvent(api_dependent *item, const GUID *classguid, int event, intptr_t param, void *ptr, size_t ptrlen);
  52. int onLeftButtonDown(int x, int y);
  53. int onMouseMove(int x, int y);
  54. int onLeftButtonUp(int x, int y);
  55. /*static */void CreateXMLParameters(int master_handle);
  56. virtual int onResize();
  57. private:
  58. int grab_x;
  59. /* Title */
  60. void BuildTitle();
  61. wchar_t song_title[1024];
  62. int song_length;
  63. int position;
  64. StringW display, rotatingDisplay;
  65. int width_of_str, width_of_str_padded;
  66. /* */
  67. int textW;
  68. bool buffer_hw_valid;
  69. /* scroll timer */
  70. TimerToken scroll_timer_id;
  71. int ticker_direction;
  72. TickerMode tickerMode;
  73. int skipTimers;
  74. uint32_t last_tick;
  75. /* XML Parameters */
  76. enum
  77. {
  78. SONGTICKER_TICKER,
  79. };
  80. static XMLParamPair params[];
  81. int xuihandle;
  82. int setXuiParam(int _xuihandle, int attrid, const wchar_t *name, const wchar_t *strval);
  83. };
  84. extern const wchar_t songtickerXuiObjectStr[];
  85. extern char songtickerXuiSvcName[];
  86. class SongTickerXuiSvc : public XuiObjectSvc<SongTicker, songtickerXuiObjectStr, songtickerXuiSvcName> {};
  87. #endif