File: bbmail.hh

package info (click to toggle)
bbmail 0.8.3-7
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 784 kB
  • sloc: cpp: 7,307; sh: 3,506; makefile: 83; perl: 26
file content (220 lines) | stat: -rw-r--r-- 3,936 bytes parent folder | download | duplicates (5)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// bbmail.hh for bbmail - an tool to display new mail in X11.
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// (See the included file COPYING / GPL-2.0)
//


#ifndef __MAIN_HH
#define __MAIN_HH

#include "Image.hh"
#include "Basewindow.hh"
#include "mailboxmenu.hh"
#include "resource.hh"
#include "Timer.hh"

#define LEFT_BUTTON 1
#define MIDDLE_BUTTON 2
#define RIGHT_BUTTON 3

class Resource;
class Mailboxmenu;
class Basemenu;
class BaseResource;
class Basewindow;
class ToolWindow;

struct PIXMAP
{
	Pixmap 	frame;
	Pixmap	label;
	Pixmap	envelope;
	Pixmap	envelope_pressed;
};

struct PIXMAPLIST
{
	Pixmap	envelope_newmail;
	Pixmap	envelope_newmail_pressed;
};

struct LABELSIZE
{
	int width0;
	int width1;
	int width2;
	int width3;
	int width;
	int height;
};

struct FRAMESIZE
{
	int x;
	int y;
	int height;
	int width;
};

struct ENVELOPESIZE
{
	int height;
	int width;
};

struct LOCALSPOOLFILE
{
	time_t last_mtime;
	off_t last_size;
	int newmail;
	int totalmail;
};

class Checkmail : public TimeoutHandler
{
public:
	Checkmail(ToolWindow *);
	virtual ~Checkmail(void);
	void Reconfigure(void);
	int getNewmail(void)
	{
		return(newmail);
	}
	int getLastTotalmail(void)
	{
		return(last_totalmail);
	}
	bool getBroken(void)
	{
		return(broken);
	}
	int getNewMailbox(void)
	{
		return(new_mailbox);
	}
	void forceCheck(void);
private:
	bool CheckOther(int,bool);
	bool CheckMbox(int);
	bool CheckMaildir(int);
	int ReadPipe(FILE *,int *,int);
	bool checkStatusFlag(char *,int);
	bool getChar(char *,int *);
	void timeout(void);

	struct LOCALSPOOLFILE *spoolfile;
	ToolWindow *bbtool;
	BTimer *timer;
	int new_mailbox;
	int last_totalmail;
	int last_newmail;
	int newmail;
	bool broken;
	unsigned int number_of_checks;
};

class ToolWindow : public Basewindow
{
public:
	ToolWindow(int argc,char **argv,struct CMDOPTIONS *);
	~ToolWindow(void);

	Window framewin;
	Window labelwin;
	Window envelopewin;

	struct FRAMESIZE Frame(void)
	{
		return frame;
	}
	void EnvelopePushed(bool pushed)
	{
		envelopePushed=pushed;
	}
	void CreateWindow(void);
	void MakeWindow(bool);
	void EventLoop(void);
	void reconfigure(void);
	//void CheckConfig(void);
	void Redraw(bool);

	bool raised;
	char *spooldir;

	GC getMenuTitleGC(void)
	{
		return NULL;/*menuTitleGC;*/
	}
	GC getMenuHiBGGC(void)
	{
		return menuHiBGGC;
	}
	GC getMenuHiGC(void)
	{
		return menuHiGC;
	}
	GC getMenuFrameGC(void)
	{
		return menuFrameGC;
	}
	void saveMenuSearch(Window,Basemenu *);
	void removeMenuSearch(Window window);
	Resource *getResource(void);

	enum { AlignDontCare = 1, AlignTop, AlignBottom };
	enum { Right = 1, Left };
	enum { Empty = 0, Round, Square, Triangle, Diamond };

	Mailboxmenu *mbmenu;

protected:
	virtual void process_event(XEvent *);

private:

	Checkmail *checkmail;
	Window menuwin;
	Basemenu* basemenu;
	int server_grabs;

	BColor bckColor;
	XGCValues gcv;
	GC frameGC;
	GC labelGC;
	struct LABELSIZE label;
	struct FRAMESIZE frame;
	struct ENVELOPESIZE envelope;
	//	struct LOCALSPOOLFILE *spoolfile;

	bool close_app;
	bool mapped;
	bool envelopePushed;
	XPoint points[11];
	struct PIXMAP pixmap;
	struct PIXMAPLIST *pixmaplist;

	Resource *resource;
	int max_value;

	GC menuGC;
	GC menuHiBGGC;
	GC menuHiGC;
	GC menuFrameGC;

};

#endif /* __MAIN_HH */