Deskbar: Resizable tray

* Adds max width and height arguments to
  instantiate_deskbar_(item|entry).
* Old applications just stay with a 16x16 scaled icon, though.
* All used apps within the repository are converted to the new call
  besides the input_server input method icon (that will need further
  API changes in the input_server).

Change-Id: I29cc439396917be2c24135888459d31364997dff
Reviewed-on: https://review.haiku-os.org/656
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Axel Dörfler
2018-11-04 19:00:49 +00:00
committed by waddlesplash
parent 1ad1c1c87b
commit efafab643c
20 changed files with 196 additions and 90 deletions
@@ -40,20 +40,20 @@ persists.</P></LI>
<LI><P><B>Add Item 1:</B> The AddItem() member function can be used to take a passed in pointer to
a BView and send it to the deskbar for inclusion in its shelf. This BView must be archivable
and must be exported by the application (for details on how to do this,
and must be exported by the application (for details on how to do this,
<A HREF="http://bedriven.be-in.org/articles/replicant/III_027-stepping%20up%20to%20the%20deskbar.html">this article</A>
may help). The item will be added and the id of the new item will be passed back to the caller
through a pointer to an int32.</P></LI>
<LI><P><B>Add Item 2:</B> The AddItem() member function can be used to add an item to the deskbar
shelf by passing a pointer to an entry_ref. The file pointed to by this entry_ref should be
an addon that exports the symbol "BView *instantiate_deskbar_item()". This entry point is used to
an addon that exports the symbol "BView *instantiate_deskbar_item(float, float)". This entry point is used to
get a BView which it can display in the shelf. More information on this mechanism can be found in
the <A HREF="file:///boot/beos/documentation/Be%20Book/Release%20Notes/Deskbar.html">Deskbar Release Notes</A>
but not in the Be Book proper. The item id of the added item is passed back in an int32 pointer
provided by the caller. NOTE: The source code for the deskbar found in
provided by the caller. NOTE: The source code for the deskbar found in
<A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/StatusView.cpp?rev=1.5&content-type=text/vnd.viewcvs-markup">TReplicantTray::LoadAddon()</A>
indicates that it also looks for a symbol called "BView *instantiate_deskbar_entry(image_id, entry_ref *)"
indicates that it also looks for a symbol called "BView *instantiate_deskbar_entry(image_id, entry_ref*, float, float)"
first, but there is no documentation on this.</P></LI>
<LI><P><B>Remove Item 1:</B> The RemoveItem() member function takes an integer id and removes it
@@ -76,12 +76,12 @@ example, the small email icon often found in the deskbar is one such item.</P></
<LI><P><B>Has Item 2:</B> 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
the deskbar shelf. For example, the small email icon often found in the deskbar is named
"mail".</P></LI>
<LI><P><B>Get Item Info 1:</B> 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
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
@@ -122,7 +122,7 @@ when in left or right top position.</P></LI>
<A NAME="implement"></A><H2>BDeskbar Implementation:</H2>
<P>Internally, the BDeskbar uses a BMessenger to communicate with the deskbar itself.
<P>Internally, the BDeskbar uses a BMessenger to communicate with the deskbar itself.
The source code from the OpenTracker project will be used as a reference for this effort.
You can find the deskbar source code here:</P>
@@ -137,7 +137,7 @@ here:</P>
<A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/BarWindow.cpp?rev=1.2&content-type=text/vnd.viewcvs-markup">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/BarWindow.cpp?rev=1.2&amp;content-type=text/vnd.viewcvs-markup</A>
</BLOCKQUOTE>
<P>The following describes the messages used to communicate between BDeskbar and the deskbar
<P>The following describes the messages used to communicate between BDeskbar and the deskbar
itself.</P>
@@ -155,7 +155,7 @@ theMsg.AddMessage("view", &amp;viewMsg); // This puts the archived view in th
</PRE>
<P>Or, the AddItem() member sends the following message to the deskbar to add an item from a file
that exports the "BView *instantiate_deskbar_item(void)" function:</P>
that exports the "BView *instantiate_deskbar_item(float, float)" function:</P>
<PRE>
BMessage theMsg;
@@ -174,9 +174,9 @@ theMsg.AddInt32("id", theID); // This is the id of the new item
</PRE>
<P>Note that in both cases, the deskbar does not set the what code of the reply. Checking the
source code for
source code for
<A href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/BarWindow.cpp?rev=1.2&content-type=text/vnd.viewcvs-markup">TBarWindow::AddItem()</A>
confirms this.
confirms this.
<H3>HasItem:</H3>
@@ -199,7 +199,7 @@ theMsg.AddBool("exists", IDorNameExists()); // This is a true/false value whi
</PRE>
<P>Note that the deskbar does not set the what code of the reply. Checking the source code
for
for
<A href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/BarWindow.cpp?rev=1.2&content-type=text/vnd.viewcvs-markup">TBarWindow::ItemExists()</A>
confirms this.</P>
@@ -226,7 +226,7 @@ theMsg.AddInt32("id", theID); // This is the id corresponding to the nam
</PRE>
<P>Note that the deskbar does not set the what code of the reply. Checking the source code
for
for
<A href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/opentracker/opentracker/deskbar/BarWindow.cpp?rev=1.2&content-type=text/vnd.viewcvs-markup">TBarWindow::ItemInfo()</A>
confirms this.</P>