OSDN Git Service

ad783e86e6bafe45cecaddc6a3b4cadb65cd4ddb
[peercast-im/PeerCastIM.git] / PeerCast.root / PeerCast / ui / win32 / simple / gui.h
1 // ------------------------------------------------
2 // File : gui.h
3 // Date: 4-apr-2002
4 // Author: giles
5 // 
6 // (c) 2002 peercast.org
7 // ------------------------------------------------
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 // ------------------------------------------------
18
19 #ifndef _GUI_H
20 #define _GUI_H
21
22 #include "sys.h"
23 #include "gdiplus.h"
24 #include "channel.h"
25
26 extern LRESULT CALLBACK GUIProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
27 extern void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type);
28
29 extern String iniFileName;
30 extern HWND guiWnd;
31 extern int logID;
32
33 enum 
34 {
35         WM_INITSETTINGS = WM_USER,
36         WM_GETPORTNUMBER,
37         WM_PLAYCHANNEL,
38         WM_TRAYICON,
39         WM_SHOWGUI,
40         WM_SHOWMENU,
41         WM_PROCURL,
42         WM_UPDATETRAFFIC
43 };
44
45 class IdData
46 {
47 private:
48         int channel_id;
49         int servent_id;
50         unsigned int ip_addr;
51
52 public:
53         IdData(int cid, int sid, unsigned int ip){
54                 channel_id = cid;
55                 servent_id = sid;
56                 ip_addr = ip;
57         }
58
59         int getChannelId(){return channel_id;};
60         int getServentId(){return servent_id;};
61         unsigned int getIpAddr(){return ip_addr;};
62 };
63
64 class ServentData
65 {
66 private:
67         int servent_id;
68         int type;
69 //      unsigned int tnum;
70         int status;
71 //      String agent;
72         Host host;
73         String hostname;
74 //      unsigned int syncpos;
75 //      char *typeStr;
76 //      char *statusStr;
77 //      bool infoFlg;
78 //      bool relay;
79 //      bool firewalled;
80         unsigned int totalRelays;
81         unsigned int totalListeners;
82 //      int vp_ver;
83 //      char ver_ex_prefix[2];
84 //      int ver_ex_number;
85
86         bool EnableFlg;
87         bool infoFlg;
88         ServentData *next;
89         ChanHit chanHit;
90         bool selected;
91         int posX;
92         int posY;
93         int     width;
94         int height;
95
96         unsigned int lastSkipTime;
97         unsigned int lastSkipCount;
98
99 public:
100         ServentData(){
101                 next = NULL;
102                 EnableFlg = false;
103                 infoFlg = false;
104
105                 posX = 0;
106                 posY = 0;
107                 width = 0;
108                 selected = false;
109
110         }
111         void setData(Servent *s, ChanHit *hit, unsigned int listeners, unsigned int relays, bool infoFlg);
112         bool getInfoFlg(){return infoFlg;}
113         ChanHit *getChanHit(){return &chanHit;};
114         int getStatus(){return status;};
115         Host getHost(){return host;};
116
117         int getServentId(){return servent_id;};
118
119         bool getEnableFlg(){return EnableFlg;};
120         void setEnableFlg(bool f){EnableFlg = f;};
121         ServentData *getNextData(){return next;};
122         void setNextData(ServentData *s){next = s;};
123         bool getSelected(){return selected;};
124         void setSelected(bool f){selected = f; if (!f){posX=0;posY=0;}};
125         int getWidth(){return width;};
126         void setWidth(int w){width = w;};
127         int getHeight(){return height;};
128         void setHeight(int h){height = h;};
129         String getName(){return hostname;};
130         void setName(String n){hostname = n;};
131
132         int drawServent(Gdiplus::Graphics *g, int x, int y);
133
134         bool checkDown(int x, int y);
135
136 };
137
138 class ChannelData {
139
140 private:
141         int channel_id;
142         char name[257];
143         int bitRate;
144         unsigned int lastPlayStart;
145         int status;
146         int totalListeners;
147         int totalRelays;
148         int localListeners;
149         int localRelays;
150         bool stayConnected;
151         ChanHit chDisp;
152         bool bTracker;
153         unsigned int lastSkipTime;
154         unsigned int skipCount;
155
156         bool EnableFlg;
157         ChannelData *next;
158
159         int posX;
160         int posY;
161         int width;
162         int height;
163         bool selected;
164         ServentData *serventDataTop;
165         bool openFlg;
166
167 public:
168         ChannelData(){
169                 EnableFlg = FALSE;
170                 next = NULL;
171                 posX = 0;
172                 posY = 0;
173                 width = 0;
174                 height = 0;
175                 selected = FALSE;
176                 serventDataTop = NULL;
177                 openFlg = FALSE;
178         }
179         int drawChannel(Gdiplus::Graphics *g, int x, int y);
180
181         void setData(Channel *);
182         int getChannelId(){return channel_id;};
183         char* getName(){return &(name[0]);};
184         int getBitRate(){return bitRate;};
185         bool isStayConnected(){return stayConnected;};
186         bool isTracker(){return bTracker;};
187         int getStatus(){return status;};
188         unsigned int getLastSkipTime(){return lastSkipTime;};
189
190         int getTotalListeners(){return totalListeners;};
191         int getTotalRelays(){return totalRelays;};
192         int getLocalListeners(){return localListeners;};
193         int getLocalRelays(){return localRelays;};
194
195         bool getEnableFlg(){return EnableFlg;};
196         void setEnableFlg(bool flg){EnableFlg = flg;};
197         ChannelData *getNextData(){return next;};
198         void setNextData(ChannelData* cd){next = cd;};
199
200         int getPosX(){return posX;};
201         void setPosX(int x){posX = x;}
202         int getPosY(){return posY;};
203         void setPosY(int y){posY = y;};
204         int getWidth(){return width;};
205         void setWidth(int w){width = w;};
206         int getHeight(){return height;};
207         void setHeight(int h){height = h;};
208         bool isSelected(){return selected;};
209         void setSelected(bool sel){selected = sel;};
210         bool getOpenFlg(){return openFlg;};
211         void setOpenFlg(bool b){openFlg = b;};
212
213         ServentData* getServentDataTop(){return serventDataTop;};
214         ServentData* findServentData(int servent_id);
215         void addServentData(ServentData *sd);
216         void deleteDisableServents();
217
218         bool setName(int servent_id, String name);
219         int getServentCount();
220
221         bool checkDown(int x, int y);
222 };
223
224
225
226 #endif