OSDN Git Service

239f7d0e20bb68223891609dabf20b0fc11ed4b2
[peercast-im/PeerCastIM.git] / c: / 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 };
43
44 class IdData
45 {
46 private:
47         int channel_id;
48         int servent_id;
49         unsigned int ip_addr;
50
51 public:
52         IdData(int cid, int sid, unsigned int ip){
53                 channel_id = cid;
54                 servent_id = sid;
55                 ip_addr = ip;
56         }
57
58         int getChannelId(){return channel_id;};
59         int getServentId(){return servent_id;};
60         unsigned int getIpAddr(){return ip_addr;};
61 };
62
63 class ServentData
64 {
65 private:
66         int servent_id;
67         int type;
68 //      unsigned int tnum;
69         int status;
70 //      String agent;
71         Host host;
72         String hostname;
73 //      unsigned int syncpos;
74 //      char *typeStr;
75 //      char *statusStr;
76 //      bool infoFlg;
77 //      bool relay;
78 //      bool firewalled;
79         unsigned int totalRelays;
80         unsigned int totalListeners;
81 //      int vp_ver;
82 //      char ver_ex_prefix[2];
83 //      int ver_ex_number;
84
85         bool EnableFlg;
86         bool infoFlg;
87         ServentData *next;
88         ChanHit chanHit;
89         bool selected;
90         int posX;
91         int posY;
92         int     width;
93         int height;
94
95         unsigned int lastSkipTime;
96         unsigned int lastSkipCount;
97
98 public:
99         ServentData(){
100                 next = NULL;
101                 EnableFlg = false;
102                 infoFlg = false;
103
104                 posX = 0;
105                 posY = 0;
106                 width = 0;
107                 selected = false;
108
109         }
110         void setData(Servent *s, ChanHit *hit, unsigned int listeners, unsigned int relays, bool infoFlg);
111         bool getInfoFlg(){return infoFlg;}
112         ChanHit *getChanHit(){return &chanHit;};
113         int getStatus(){return status;};
114         Host getHost(){return host;};
115
116         int getServentId(){return servent_id;};
117
118         bool getEnableFlg(){return EnableFlg;};
119         void setEnableFlg(bool f){EnableFlg = f;};
120         ServentData *getNextData(){return next;};
121         void setNextData(ServentData *s){next = s;};
122         bool getSelected(){return selected;};
123         void setSelected(bool f){selected = f; if (!f){posX=0;posY=0;}};
124         int getWidth(){return width;};
125         void setWidth(int w){width = w;};
126         int getHeight(){return height;};
127         void setHeight(int h){height = h;};
128         String getName(){return hostname;};
129         void setName(String n){hostname = n;};
130
131         int drawServent(Gdiplus::Graphics *g, int x, int y);
132
133         bool checkDown(int x, int y);
134
135 };
136
137 class ChannelData {
138
139 private:
140         int channel_id;
141         char name[257];
142         int bitRate;
143         unsigned int lastPlayStart;
144         int status;
145         int totalListeners;
146         int totalRelays;
147         int localListeners;
148         int localRelays;
149         bool stayConnected;
150         ChanHit chDisp;
151         bool bTracker;
152         unsigned int lastSkipTime;
153         unsigned int skipCount;
154
155         bool EnableFlg;
156         ChannelData *next;
157
158         int posX;
159         int posY;
160         int width;
161         int height;
162         bool selected;
163         ServentData *serventDataTop;
164         bool openFlg;
165
166 public:
167         ChannelData(){
168                 EnableFlg = FALSE;
169                 next = NULL;
170                 posX = 0;
171                 posY = 0;
172                 width = 0;
173                 height = 0;
174                 selected = FALSE;
175                 serventDataTop = NULL;
176                 openFlg = FALSE;
177         }
178         int drawChannel(Gdiplus::Graphics *g, int x, int y);
179
180         void setData(Channel *);
181         int getChannelId(){return channel_id;};
182         char* getName(){return &(name[0]);};
183         int getBitRate(){return bitRate;};
184         bool isStayConnected(){return stayConnected;};
185         bool isTracker(){return bTracker;};
186         int getStatus(){return status;};
187         unsigned int getLastSkipTime(){return lastSkipTime;};
188
189         int getTotalListeners(){return totalListeners;};
190         int getTotalRelays(){return totalRelays;};
191         int getLocalListeners(){return localListeners;};
192         int getLocalRelays(){return localRelays;};
193
194         bool getEnableFlg(){return EnableFlg;};
195         void setEnableFlg(bool flg){EnableFlg = flg;};
196         ChannelData *getNextData(){return next;};
197         void setNextData(ChannelData* cd){next = cd;};
198
199         int getPosX(){return posX;};
200         void setPosX(int x){posX = x;}
201         int getPosY(){return posY;};
202         void setPosY(int y){posY = y;};
203         int getWidth(){return width;};
204         void setWidth(int w){width = w;};
205         int getHeight(){return height;};
206         void setHeight(int h){height = h;};
207         bool isSelected(){return selected;};
208         void setSelected(bool sel){selected = sel;};
209         bool getOpenFlg(){return openFlg;};
210         void setOpenFlg(bool b){openFlg = b;};
211
212         ServentData* getServentDataTop(){return serventDataTop;};
213         ServentData* findServentData(int servent_id);
214         void addServentData(ServentData *sd);
215         void deleteDisableServents();
216
217         bool setName(int servent_id, String name);
218         int getServentCount();
219
220         bool checkDown(int x, int y);
221 };
222
223
224
225 #endif