xref: /haiku/src/apps/people/PeopleApp.h (revision 4c07199d8201fcf267e90be0d24b76799d03cea6)
1 /*
2  * Copyright 2005-2010, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Robert Polic
7  *		Stephan Aßmus <superstippi@gmx.de>
8  *
9  * Copyright 1999, Be Incorporated.   All Rights Reserved.
10  * This file may be used under the terms of the Be Sample Code License.
11  */
12 #ifndef PEOPLE_APP_H
13 #define PEOPLE_APP_H
14 
15 
16 #include <Application.h>
17 #include <ObjectList.h>
18 #include <String.h>
19 
20 
21 #define	B_PERSON_MIMETYPE	"application/x-person"
22 #define APP_SIG				"application/x-vnd.Be-PEPL"
23 
24 
25 class BFile;
26 
27 enum {
28 	M_NEW					= 'newp',
29 	M_SAVE_AS				= 'svas',
30 	M_WINDOW_QUITS			= 'wndq',
31 	M_CONFIGURE_ATTRIBUTES	= 'catr',
32 };
33 
34 class PersonWindow;
35 
36 class TPeopleApp : public BApplication {
37 public:
38 								TPeopleApp();
39 		virtual 				~TPeopleApp();
40 
41 		virtual void			ArgvReceived(int32, char**);
42 		virtual void			MessageReceived(BMessage*);
43 		virtual void			RefsReceived(BMessage*);
44 		virtual void			ReadyToRun();
45 
46 private:
47 				PersonWindow*	_FindWindow(const entry_ref&) const;
48 				PersonWindow*	_NewWindow(entry_ref* = NULL, BMessage* = NULL);
49 				void			_AddAttributes(PersonWindow* window) const;
50 				void			_SavePreferences(BMessage* message) const;
51 
52 private:
53 				BFile*			fPrefs;
54 				uint32			fWindowCount;
55 				BRect			fPosition;
56 
57 				struct Attribute {
58 					BString		attribute;
59 					int32		width;
60 					BString		name;
61 				};
62 
63 				BObjectList<Attribute> fAttributes;
64 };
65 
66 #endif // PEOPLE_APP_H
67 
68