xref: /haiku/src/preferences/mail/ConfigViews.h (revision f75a7bf508f3156d63a14f8fd77c5e0ca4d08c42)
1 /* ConfigViews - config views for the account, protocols, and filters
2  *
3  * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
4  */
5 #ifndef CONFIG_VIEWS_H
6 #define CONFIG_VIEWS_H
7 
8 
9 #include <Box.h>
10 #include <image.h>
11 
12 class BTextControl;
13 class BListView;
14 class BMailChain;
15 class BMenuField;
16 class BButton;
17 struct entry_ref;
18 
19 class Account;
20 class ProtocolsConfigView;
21 class FiltersConfigView;
22 
23 
24 class AccountConfigView : public BBox {
25 	public:
26 		AccountConfigView(BRect rect,Account *account);
27 
28 		virtual void DetachedFromWindow();
29 		virtual void AttachedToWindow();
30 		virtual void MessageReceived(BMessage *msg);
31 
32 		void UpdateViews();
33 
34 	private:
35 		BTextControl	*fNameControl, *fRealNameControl, *fReturnAddressControl;
36 		BMenuField		*fTypeField;
37 		Account			*fAccount;
38 };
39 
40 class FilterConfigView : public BBox {
41 	public:
42 		FilterConfigView(BMailChain *chain, int32 index, BMessage *msg,
43 			entry_ref *ref);
44 		~FilterConfigView();
45 
46 		status_t InitCheck();
47 
48 		virtual void DetachedFromWindow();
49 		virtual void AttachedToWindow();
50 
51 	protected:
52 		friend class FiltersConfigView;
53 
54 		void		Load(BMessage *msg, entry_ref *ref);
55 		void		Remove(bool deleteMessage = true);
56 
57 		BView		*fConfigView;
58 
59 		BMailChain *fChain;
60 		int32		fIndex;
61 		BMessage	*fMessage;
62 		entry_ref	*fEntryRef;
63 		image_id	fImage;
64 };
65 
66 class ProtocolsConfigView : public FilterConfigView {
67 	public:
68 		ProtocolsConfigView(BMailChain *chain, int32 index, BMessage *msg,
69 			entry_ref *ref);
70 
71 		void AttachedToWindow();
72 		void MessageReceived(BMessage *msg);
73 
74 	private:
75 		BMenuField	*fProtocolsMenuField;
76 };
77 
78 class FiltersConfigView : public BBox {
79 	public:
80 		FiltersConfigView(BRect rect,Account *account);
81 		~FiltersConfigView();
82 
83 		virtual void	AttachedToWindow();
84 //		virtual void	DetachedFromWindow();
85 		virtual void	MessageReceived(BMessage *msg);
86 
87 	private:
88 		void			SelectFilter(int32 index);
89 		void			SetTo(BMailChain *chain);
90 
91 		Account				*fAccount;
92 		BMailChain			*fChain;
93 		int32				fFirst, fLast;
94 
95 		BMenuField			*fChainsField;
96 		BListView			*fListView;
97 		BMenuField			*fAddField;
98 		BButton				*fRemoveButton;
99 		FilterConfigView	*fFilterView;
100 };
101 
102 #endif	/* CONFIG_VIEWS_H */
103