BNodeInfo¶
Constructor and Destructor¶
BNodeInfo()
BNodeInfo::BNodeInfo()
BNodeInfo::BNodeInfo(BNode *node)
The default constructor creates a new, uninitialized BNodeInfo
object. To initialize you have to follow this construction with a call to
SetTo()
.
The BNode
version intializes the BNodeInfo by
passing the argument to SetTo()
; see
SetTo()
for details (and error codes).
~BNodeInfo()
BNodeInfo::~BNodeInfo()
Destroys the object. The BNode
object that was used to
initialize the object isn’t touched.
Member Functions¶
GetAppHint(), SetAppHint()
status_t BNodeInfo::GetAppHint(entry_ref *app_ref) const
status_t BNodeInfo::SetAppHint(const entry_ref app_ref)
These functions get and set the “app hint” for the node. The app hint is an entry_ref that identifies the executable that should be used when launching the node. Of course, the entry_ref may not point to an application, or it might point to an application with the wrong signature (and so on)—that’s why this is merely a hint.
GetAppHint() function initializes the entry_ref to the hint recorded in the “BEOS:PPATH” attribute of the node; the argument must be allocated before it’s passed in.
SetAppHint() stores the path corresponding to the entry_ref in the “BEOS:PPATH” attribute of the node. Since the path to the application is stored instead of its entry_ref, the hint will break if the application is subsequently moved.
Return Code |
Description |
---|---|
|
The ref was successfully retrieved or set. |
|
The attribute “BEOS:PPATH” doesn’t exist. (Get) |
|
The node is on a read-only volume. (Set) |
See Also: BMimeType::GetAppHint()
GetIcon(), SetIcon(), GetTrackerIcon()
virtual status_t BNodeInfo::GetIcon(BBitmap *icon, icon_size which = B_LARGE_ICON) const
virtual status_t BNodeInfo::SetIcon(const BBitmap *icon, icon_size which = B_LARGE_ICON)
status_t BNodeInfo::GetTrackerIcon(BBitmap *icon, icon_size which = B_LARGE_ICON)
static status_t BNodeInfo::GetTrackerIcon(entry_ref *ref, BBitmap *icon, icon_size which = B_LARGE_ICON)
GetIcon() and SetIcon() get and set the icon data
that’s stored in the node’s attributes. You specify which icon you want
(large or small) by passing B_LARGE_ICON
or
B_MINI_ICON
as the which argument. The icon is
passed in or returned through the icon argument. The icon data is
copied out of or into the BBitmap
object.
The bitmap (if you’re calling SetIcon()) or icon (for GetIcon() and GetTrackerIcon()) must be the proper size: 32x32 for the large icon, 16x16 for the small one.
If you want to erase the node’s icon, pass NULL as the icon argument to SetIcon().
Note
The icon attributes are stored as “BEOS: L:STD_ICON” (large icon) and “BEOS: M:STD_ICON” (small, or “mini” icon).
GetTrackerIcon() finds the icon that the Tracker uses to display
the node. The static
version lets you identify the node as an
entry_ref. Both versions follow the same ordered path in trying to
find the icon:
First, it looks in the node’s attributes. If the attribute doesn’t exist, it…
…gets the node’s preferred app (as a signature), and asks the File Type database if that signature declares an icon for this node’s file type. If the node doesn’t have a preferred app, or if the app doesn’t designate an icon for the node’s type, the function…
…asks the File Type database for the icon based on the node’s file type. If still empty-handed, the function…
…asks the File Type database for the preferred app based on the node’s file type, and then asks that app for the icon it uses to display this node’s file type. If still nothing, we…
…quit.
The function doesn’t tell you which branch of the path it found the icon in.
Return Code |
Description |
---|---|
|
The icon was found or set. |
|
The BNodeInfo is uninitialized. |
|
The bitmap or icon wasn’t the proper size. |
Attribute errors. |
See the error codes for |
GetPreferredApp(), SetPreferredApp()
status_t BNodeInfo::GetPreferredApp(char *signature, app_verb verb = B_OPEN) const
status_t BNodeInfo::SetPreferredApp(const char *signature, app_verb verb = B_OPEN)
These functions get and set the node’s “preferred app.” This is the application that’s used to access the node when, for example, the user double-clicks the node in a Tracker window.
The preferred app is identified by signature, a MIME string.
The app_verb argument specifies the type of access; currently, the only app_verb is
B_OPEN
.
If a node doesn’t have a preferred app, the Tracker looks in the File Type database for an app that can open the node’s file type.
Note
The attribute that stores the preferred app is named “BEOS:PREF_APP”.
Return Code |
Description |
---|---|
|
The preferred app was found or set. |
|
The BNodeInfo is uninitialized. |
|
(Set…() only). The signature argument is too long
(greater than |
Attribute errors. |
See the error codes for |
GetType(), SetType()
virtual status_t BNodeInfo::GetType(char *type) const
virtual status_t BNodeInfo::SetType(const char *type)
These functions get and set the node’s file type. The file type, passed in or returned through type, is a MIME string.
Note
The attribute that stores the file type is named “BEOS:TYPE”.
Return Code |
Description |
---|---|
|
The type was found or set. |
|
The BNodeInfo is uninitialized. |
Attribute errors. |
See the error codes for |
InitCheck()
status_t BNodeInfo::InitCheck() const
Returns the status of the most recent initialization.
Return Code |
Description |
---|---|
|
The object was successfully initialized. |
|
The BNodeInfo is uninitialized. |
See SetTo()
for more error codes.
SetTo()
status_t BNodeInfo::SetTo(BNode *node)
Initializes the BNodeInfo object by pointing it to
node, which must be a valid (initialized) BNode
object. The BNodeInfo maintains its own BNode
pointer: You shouldn’t delete node while the BNodeInfo
is accessing it; other changes to the BNode
are permitted, but
you may want to avoid such antics. Re-initializing a BNodeInfo
doesn’t affect the previous BNode
object.
Return Code |
Description |
---|---|
|
The object was successfully initialized. |
|
node is uninitialized. |