xref: /haiku/src/apps/mail/Header.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /*
2 Open Tracker License
3 
4 Terms and Conditions
5 
6 Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy of
9 this software and associated documentation files (the "Software"), to deal in
10 the Software without restriction, including without limitation the rights to
11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 of the Software, and to permit persons to whom the Software is furnished to do
13 so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice applies to all licensees
16 and shall be included in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 Except as contained in this notice, the name of Be Incorporated shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings in
27 this Software without prior written authorization from Be Incorporated.
28 
29 BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
30 of Be Incorporated in the United States and other countries. Other brand product
31 names are registered trademarks or trademarks of their respective holders.
32 All rights reserved.
33 */
34 #ifndef _HEADER_H
35 #define _HEADER_H
36 
37 
38 #include "ComboBox.h"
39 
40 #include <Box.h>
41 #include <NodeInfo.h>
42 #include <Point.h>
43 #include <Rect.h>
44 #include <TextControl.h>
45 #include <View.h>
46 #include <Window.h>
47 #include <fs_attr.h>
48 
49 
50 #define TO_TEXT				"To:"
51 #define FROM_TEXT			"From:"
52 #define ENCODING_TEXT		"Encoding:"
53 #define DECODING_TEXT		"Decoding:"
54 #define TO_FIELD_H			 39
55 #define FROM_FIELD_H		 31
56 #define TO_FIELD_V			  7
57 #define TO_FIELD_WIDTH		270
58 #define FROM_FIELD_WIDTH	280
59 
60 #define ACCOUNT_TEXT		"Account:"
61 #define ACCOUNT_FIELD_WIDTH	165
62 
63 #define SUBJECT_TEXT		"Subject:"
64 #define SUBJECT_FIELD_H		 18
65 #define SUBJECT_FIELD_V		 33
66 #define SUBJECT_FIELD_WIDTH	270
67 #define SUBJECT_FIELD_HEIGHT 16
68 
69 #define CC_TEXT				"CC:"
70 #define CC_FIELD_H			 40
71 #define CC_FIELD_V			 58
72 #define CC_FIELD_WIDTH		192
73 #define CC_FIELD_HEIGHT		 16
74 
75 #define BCC_TEXT			"BCC:"
76 #define BCC_FIELD_H			268
77 #define BCC_FIELD_V			 58
78 #define BCC_FIELD_WIDTH		197
79 #define BCC_FIELD_HEIGHT	 16
80 
81 class BFile;
82 class BMenuField;
83 class BMenuItem;
84 class BPopUpMenu;
85 class BStringView;
86 class QPopupMenu;
87 class TTextControl;
88 
89 
90 class THeaderView : public BBox {
91 	public:
92 		THeaderView(BRect, BRect, bool incoming, BEmailMessage *mail,
93 			bool resending, uint32 defaultCharacterSet, uint32 defaultChain);
94 
95 		virtual void	MessageReceived(BMessage *);
96 		virtual void	AttachedToWindow(void);
97 		status_t		LoadMessage(BEmailMessage *);
98 
99 		BPopUpMenu		*fAccountMenu;
100 		BPopUpMenu		*fEncodingMenu;
101 		int32			fChain;
102 		TTextControl	*fAccountTo;
103 		TTextControl	*fAccount;
104 		TTextControl	*fBcc;
105 		TTextControl	*fCc;
106 		TTextControl	*fSubject;
107 		TTextControl	*fTo;
108 		BStringView		*fDateLabel;
109 		BStringView		*fDate;
110 		bool			fIncoming;
111 		uint32			fCharacterSetUserSees;
112 
113 	private:
114 		void InitEmailCompletion();
115 		void InitGroupCompletion();
116 
117 		bool fResending;
118 		QPopupMenu *fBccMenu;
119 		QPopupMenu *fCcMenu;
120 		QPopupMenu *fToMenu;
121 		BDefaultChoiceList fEmailList;
122 };
123 
124 class TTextControl : public BComboBox {
125 	public:
126 		TTextControl(BRect, char*, BMessage*, bool, bool, int32 resizingMode = B_FOLLOW_NONE);
127 
128 		virtual void AttachedToWindow();
129 		virtual void MessageReceived(BMessage*);
130 
131 		// returns focus for the text view
132 		bool HasFocus();
133 
134 	private:
135 		bool fIncoming;
136 		bool fResending;
137 		char fLabel[100];
138 		BPopUpMenu *fRefDropMenu;
139 		int32 fCommand;
140 };
141 
142 #endif	/* _HEADER_H */
143