xref: /haiku/src/servers/mail/DeskbarView.h (revision 20a1f87af20dc8a33c97b1d8015bb0e15d3e8260)
1 /* DeskbarView - mail_daemon's deskbar menu and view
2  *
3  * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
4  */
5 #ifndef DESKBAR_VIEW_H
6 #define DESKBAR_VIEW_H
7 
8 
9 #include <View.h>
10 
11 #include "NavMenu.h"
12 
13 
14 enum {
15 	kStatusNoMail = 0,
16 	kStatusNewMail,
17 	kStatusCount
18 };
19 
20 enum MDDeskbarMessages {
21 	MD_CHECK_SEND_NOW = 'MDra',
22 	MD_CHECK_FOR_MAILS,
23 	MD_SEND_MAILS,
24 	MD_OPEN_NEW,
25 	MD_OPEN_PREFS,
26 	MD_REFRESH_QUERY
27 };
28 
29 class BPopUpMenu;
30 class BQuery;
31 class BDirectory;
32 class BEntry;
33 class BPath;
34 
35 class _EXPORT DeskbarView : public BView {
36 public:
37 						DeskbarView(BRect frame);
38 						DeskbarView(BMessage* data);
39 	virtual				~DeskbarView();
40 
41 	virtual void		Draw(BRect updateRect);
42 	virtual void		AttachedToWindow();
43 	static DeskbarView*	Instantiate(BMessage* data);
44 	virtual	status_t	Archive(BMessage* data, bool deep = true) const;
45 	virtual void	 	MouseDown(BPoint);
46 	virtual void	 	MouseUp(BPoint);
47 	virtual void		MessageReceived(BMessage* message);
48 	virtual void		Pulse();
49 
50 private:
51 	bool				_EntryInTrash(const entry_ref*);
52 	void				_RefreshMailQuery();
53 	bool				_CreateMenuLinks(BDirectory&, BPath&);
54 	void				_CreateNewMailQuery(BEntry&);
55 	BPopUpMenu*			_BuildMenu();
56 	void				_InitBitmaps();
57 	status_t			_GetNewQueryRef(entry_ref& ref);
58 
59 	BBitmap*			fBitmaps[kStatusCount];
60 	int32				fStatus;
61 
62 	BList				fNewMailQueries;
63 	int32				fNewMessages;
64 
65 	int32				fLastButtons;
66 };
67 
68 #endif	/* DESKBAR_VIEW_H */
69