xref: /haiku/headers/os/storage/NodeInfo.h (revision 97901ec593ec4dd50ac115c1c35a6d72f6e489a5)
1 /*
2  * Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _NODE_INFO_H
6 #define _NODE_INFO_H
7 
8 
9 #include <BeBuild.h>
10 #include <Entry.h>
11 #include <File.h>
12 #include <Message.h>
13 #include <Mime.h>
14 #include <SupportDefs.h>
15 
16 
17 class BBitmap;
18 class BResources;
19 
20 
21 /*!	\brief BNodeInfo provides file type information
22 	BNodeInfo provides a nice wrapper to all sorts of usefull meta data.
23 	Like it's mime type, the files icon and the application which will load
24 	the file.
25 */
26 class BNodeInfo {
27 public:
28 								BNodeInfo();
29 								BNodeInfo(BNode* node);
30 	virtual						~BNodeInfo();
31 
32 			status_t			SetTo(BNode* node);
33 
34 			status_t			InitCheck() const;
35 
36 	virtual status_t			GetType(char* type) const;
37 	virtual status_t			SetType(const char* type);
38 	virtual status_t			GetIcon(BBitmap* icon,
39 									icon_size size = B_LARGE_ICON) const;
40 	virtual status_t			SetIcon(const BBitmap* icon,
41 									icon_size size = B_LARGE_ICON);
42 			status_t			GetIcon(uint8** data, size_t* size,
43 									type_code* type) const;
44 			status_t			SetIcon(const uint8* data, size_t size);
45 
46 			status_t			GetPreferredApp(char* signature,
47 									app_verb verb = B_OPEN) const;
48 			status_t			SetPreferredApp(const char* signature,
49 									app_verb verb = B_OPEN);
50 			status_t			GetAppHint(entry_ref* ref) const;
51 			status_t			SetAppHint(const entry_ref* ref);
52 
53 			status_t			GetTrackerIcon(BBitmap* icon,
54 									icon_size size = B_LARGE_ICON) const;
55 	static	status_t			GetTrackerIcon(const entry_ref* ref,
56 									BBitmap* icon,
57 									icon_size size = B_LARGE_ICON);
58 private:
59 			friend class BAppFileInfo;
60 
61 	virtual void				_ReservedNodeInfo1();
62 	virtual void				_ReservedNodeInfo2();
63 	virtual void				_ReservedNodeInfo3();
64 
65 								BNodeInfo &operator=(const BNodeInfo& other);
66 								BNodeInfo(const BNodeInfo& other);
67 									// not implemented
68 
69 private:
70 			BNode*				fNode;
71 			uint32				_reserved[2];
72 			status_t			fCStatus;
73 };
74 
75 
76 #endif // _NODE_INFO_H
77