diff --git a/docs/develop/app/usecases/BDeskbarUseCases.html b/docs/develop/app/usecases/BDeskbarUseCases.html index b620bb14a9..cb4cddd65d 100644 --- a/docs/develop/app/usecases/BDeskbarUseCases.html +++ b/docs/develop/app/usecases/BDeskbarUseCases.html @@ -1,5 +1,5 @@ - +
Add Item 2:
Remove Item 1:
Remove Item 1: The RemoveItem() member function takes an integer id and removes it +from the deskbar shelf if it exists. The member returns B_OK at all times (unless the deskbar is +not running or some communication failure occurs). A B_OK result does not mean that an item was +actually removed.
Remove Item 2:
Remove Item 2: The RemoveItem() member function also takes a string name and removes +it from the deskbar shelf if it exists. The member returns B_OK at all times (unless the deskbar is +not running or some communication failure occurs). A B_OK result does not mean that an item was +actually removed.
Count Items:
Count Items: The CountItems() member function takes no arguments. It returns the +number of "items" in the deskbar shelf. For example, the small email icon often found in the +deskbar is one such item.
Has Item 1:
Has Item 1: The HasItem() member function takes a integer id and returns a true or +false value which indicates whether or not an item exists in the deskbar shelf on that id. For +example, the small email icon often found in the deskbar is one such item.
Has Item 2:
Has Item 2: The HasItem() member function also takes a string name parameter and +returns a true or false value which indicates whether or not an item by than name exists in +the deskbar shelf. For example, the small email icon often found in the deskbar is named +"mail".
Get Item Info 1:
Get Item Info 1: The GetItemInfo() member function takes an integer id and a pointer +to a const char * (ie a string). It checks to see if the id passed in exists in the deskbar and +sets the value of the const char * to point to a allocated buffer which contains the name of the +item which corresponds to this id and the function returns B_OK. Ownership of this allocated +buffer is assigned to the caller of this member function so it is up to the caller to free the +memory. If the id doesn't exist, then it still returns B_OK but the pointer to the string is set +to NULL. If the pointer to the string passed in is NULL, the function returns B_BAD_VALUE.
Get Item Info 2:
Get Item Info 2: The GetItemInfo() member also takes a string (const char *) name +and a pointer to an int. If the name matches an item in the deskbar shelf, the id of this +item is returned at the location pointed to by the integer pointer and the member returns B_OK. +If the name doesn't match an item in the deskbar shelf, the id is set to -1. If the pointer +passed in is NULL, the function returns B_BAD_VALUE.
Frame: The Frame() member function returns a BRect which describes the location and size of the deskbar on the screen.
The HasItem() member sends the following message to the deskbar:
+ ++BMessage theMsg; +theMsg.what = 'exst' +theMsg.AddInt32("id", theID); // This is the id to check for + // OR, only one of id or name should be in the message +theMsg.AddString("name", theName); // This is the name to check for ++ +
The deskbar responds with a message which looks like:
+ ++BMessage theMsg; +theMsg.AddBool("exists", IDorNameExists()); // This is a true/false value which indicates whether or not the name/id exists in the shelf ++ +
Note that the deskbar does not set the what code of the reply. Checking the source code +for +TBarWindow::ItemExists() +confirms this.
+ + +The GetItemInfo() member sends the following message to the deskbar:
+ ++BMessage theMsg; +theMsg.what = 'exst' +theMsg.AddInt32("id", theID); // This is the id to check for + // OR, only one of id or name should be in the message +theMsg.AddString("name", theName); // This is the name to check for ++ +
The deskbar responds with a message which looks like:
+ ++BMessage theMsg; +theMsg.AddString("name", theName); // This is the name corresponding to the id of the original request + // OR, only one of id or name should be in the response message depending on the request sent +theMsg.AddInt32("id", theID); // This is the id corresponding to the name of the original request ++ +
Note that the deskbar does not set the what code of the reply. Checking the source code +for +TBarWindow::ItemExists() +confirms this.
+ + +The CountItems() member sends the following message to the deskbar:
+ ++BMessage theMsg; +theMsg.what = 'cwnt' ++ +
The deskbar responds with a message which looks like:
+ ++BMessage theMsg; +theMsg.what = 'rply'; // This means reply +theMsg.AddInt32("count", ItemCount()); // This is the number of items in the deskbar shelf ++ + +
The RemoveItem() member sends the following message to the deskbar:
+ ++BMessage theMsg; +theMsg.what = 'exst' +theMsg.AddInt32("id", theID); // This is the id to remove + // OR, only one of id or name should be in the message +theMsg.AddString("name", theName); // This is the name to remove ++ +
The deskbar does not send a response.
+ +The Frame() member sends a standard scripting message to get the frame from the deskbar. It