aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/widgets/xuidownloadslist.h
blob: 88458462cc15ba110c83eb1c2dbc33e9afcf7437 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __THEMESLIST_H
#define __THEMESLIST_H

#include "api/wnd/wndclass/listwnd.h"
#include "main.h"
//#include "../Components/wac_downloads/wac_downloads_download_manager.h"
#include "../../../../Components/wac_network/wac_network_http_receiver_api.h"
#include "../nu/AutoWide.h"
#include "api/script/objects/systemobj.h"

#define DOWNLOADSLIST_PARENT ListWnd

// -----------------------------------------------------------------------
class DownloadsList : public DOWNLOADSLIST_PARENT
{
  
  public:

    DownloadsList();
    virtual ~DownloadsList();

    virtual int onInit();
    virtual void onDoubleClick(int itemnum);
    virtual int onPaint(Canvas *canvas);
    virtual int onRightClick(int itemnum);
	virtual int onColumnDblClick(int col, int x, int y);
	virtual int onColumnLabelClick(int col, int x, int y);

    virtual 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);
    virtual int onResize();
    virtual int wantResizeCols() { return 0; }
    virtual int setXuiParam(int _xuihandle, int xmlattrid, const wchar_t *name, const wchar_t *value);
    virtual int wantHScroll() { return !nohscroll; }

 //   virtual int getTextBold(LPARAM lParam);
    virtual void onSetVisible(int show);

	// Callbacks from MediaDownloader
	static void onDownloadStart(const char *url, DownloadToken token);
	static void onDownloadTick(DownloadToken token);
	static void onDownloadEnd(DownloadToken token, const wchar_t * filename);
	static void onDownloadError(DownloadToken token, int code);
	static void onDownloadCancel(DownloadToken token);

    enum {
      CTLIST_NOHSCROLL = 0,
    };

protected:
	/*static */void CreateXMLParameters(int master_handle);
  private:
    static XMLParamPair params[];
    int xuihandle;
    int nohscroll;
    int ensure_on_paint;

	void newItem(int status, DownloadToken token);

	static PtrList<void> activeDownloads;
	static PtrList<DownloadsList> skinObjects;

	enum DOWNLOAD_STATUS
	{
		STATUS_WAITING      = 0,
		STATUS_TRANSFERRING = 1,
		STATUS_FINISHED     = 2,
		STATUS_ERROR        = -1,
		STATUS_CANCEL       = -2,
	};
};

// -----------------------------------------------------------------------
extern const wchar_t DownloadsListXuiObjectStr[];
extern char DownloadsListXuiSvcName[];
class DownloadsListXuiSvc : public XuiObjectSvc<DownloadsList, DownloadsListXuiObjectStr, DownloadsListXuiSvcName> {};

#endif