xref: /haiku/src/apps/mail/Signature.h (revision 579f1dbca962a2a03df54f69fdc6e9423f91f20e)
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 
35 //--------------------------------------------------------------------
36 //
37 //	Signature.h
38 //
39 //--------------------------------------------------------------------
40 
41 #ifndef _SIGNATURE_H
42 #define _SIGNATURE_H
43 
44 #include <Alert.h>
45 #include <Beep.h>
46 #include <Box.h>
47 #include <FindDirectory.h>
48 #include <Font.h>
49 #include <fs_index.h>
50 #include <Menu.h>
51 #include <MenuBar.h>
52 #include <MenuItem.h>
53 #include <Node.h>
54 #include <NodeInfo.h>
55 #include <Path.h>
56 #include <TextControl.h>
57 #include <Window.h>
58 
59 const float kSigHeight = 200;
60 const float kSigWidth = 457;
61 
62 
63 #define INDEX_SIGNATURE		"_signature"
64 
65 
66 class TMenu;
67 class TNameControl;
68 class TScrollView;
69 class TSignatureView;
70 class TSigTextView;
71 
72 //====================================================================
73 
74 class TSignatureWindow : public BWindow {
75 public:
76 	TSignatureWindow(BRect);
77 	~TSignatureWindow();
78 	virtual void MenusBeginning();
79 	virtual void MessageReceived(BMessage*);
80 	virtual bool QuitRequested();
81 	virtual void Show();
82 	void FrameResized(float width, float height);
83 	bool Clear();
84 	bool IsDirty();
85 	void Save();
86 
87 private:
88 	BMenuItem *fCut;
89 	BMenuItem *fCopy;
90 	BMenuItem *fDelete;
91 	BMenuItem *fNew;
92 	BMenuItem *fPaste;
93 	BMenuItem *fSave;
94 	BMenuItem *fUndo;
95 	BEntry fEntry;
96 	BFile *fFile;
97 	TMenu *fSignature;
98 	TSignatureView *fSigView;
99 };
100 
101 //--------------------------------------------------------------------
102 
103 class TSignatureView : public BBox {
104 public:
105 	TSignatureView(BRect);
106 	virtual	void AttachedToWindow();
107 
108 	TNameControl *fName;
109 	TSigTextView *fTextView;
110 
111 private:
112 	float fOffset;
113 };
114 
115 //====================================================================
116 
117 class TNameControl : public BTextControl {
118 public:
119 	TNameControl(BRect, const char*, BMessage*);
120 	virtual void AttachedToWindow();
121 	virtual void MessageReceived(BMessage*);
122 
123 private:
124 	char fLabel[100];
125 };
126 
127 //====================================================================
128 
129 class TSigTextView : public BTextView {
130 public:
131 	TSigTextView(BRect, BRect);
132 	void FrameResized(float width, float height);
133 
134 	virtual void DeleteText(int32, int32);
135 	virtual void KeyDown(const char*, int32);
136 	virtual void InsertText(const char*, int32, int32, const text_run_array*);
137 	virtual void MessageReceived(BMessage*);
138 
139 	bool fDirty;
140 
141 private:
142 	TSignatureView *fParent;
143 };
144 
145 #endif // #ifndef _SIGNATURE_H
146 
147