home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 28
/
amigaformatcd28.iso
/
-websites-
/
5dsoftware
/
archives
/
visualpr.lha
/
VisualPrefs
/
DocsEnglish
/
VP-Developer.doc
< prev
next >
Wrap
Text File
|
1997-11-27
|
5KB
|
120 lines
Introducing
THE VISUALPREFS DEVELOPER INTERFACE
A work in progress
If you're a developer, you can take advantage of some features of VisualPrefs.
Although there's not a full developer API for VisualPrefs yet, it's already
possible to use the BOOPSI classes that VisualPrefs adds to the system.
The purpose of these classes is to give programmers an easy way to get the
"VisualPrefs look", without having to wait for me to implement a patch for
their applications in VisualPrefs. ;-)
Currently there's just one class:
"tbiclass" - the titlebar image class
This class provides the most commonly used images for gadgets added by
applications to the titlebar of their windows. Examples of this are the
ubiquitous "iconify" gadget or DirOpus 5's "padlock" gadget.
All programs using this class will automatically get the same look for their
titlebar images if VisualPrefs is running. This is probably better than
having myriads of different versions of the same image...
You can use "tbiclass" just like "sysiclass"; they're both sub-classes of
"imageclass". A "tbiclass" image can be created by calling NewObject() with
the following tags:
SYSIA_DrawInfo - This is absolutely mandatory. You MUST pass a DrawInfo
pointer to "tbiclass" or NewObject() will fail.
SYSIA_Which - To specify which image you want; currently there are six image
types:
POPUPIMAGE - A MUI "pop-up" titlebar gadget image
MUIIMAGE - A MUI "settings" titlebar gadget image
SNAPSHOTIMAGE - A MUI "snapshot" titlebar gadget image
ICONIFYIMAGE - An "iconify" titlebar gadget image
PADLOCKIMAGE - A DirOpus "padlock" titlebar gadget image
TBFRAMEIMAGE - A general-purpose empty titlebar gadget image
IA_Width, IA_Height - These are only recognized by the TBFRAMEIMAGE type;
the other image types ignore them and always have
the same size of the depth gadget image.
SYSIA_ReferenceFont - This is only recognized by the TBFRAMEIMAGE type;
the other image types ignore it and always have
the same height of the depth gadget image.
Of course, if NewObject() fails, you should provide a built-in fallback image
for your titlebar gadget. However, I plan to release soon a disk-based
freeware "tbiclass" image class which you will be able to include in the
distribution of your applications. This class will provide the needed images
and will be automatically replaced by the VisualPrefs one if it is present.
Therefore, you can keep your built-in images very simple. ;-)
It's important to note that all "tbiclass" image instances will have an
Image->LeftEdge value of -1. This shouldn't be modified, and you should
place your titlebar gadgets accordingly. The reason for this apparently
strange behavior is that Intuition titlebar gadget images, too, work this
way, and we should try to stay as compatible with Intuition as possible.
Also, make sure you adjust your gadget's size if necessary, to adapt it
to the returned image's size.
An example of all this could be:
...
/* Create the image */
if (!(iconifyimage = NewObject(NULL,"tbiclass",SYSIA_Which,ICONIFYIMAGE,
SYSIA_DrawInfo,dri,
TAG_END)))
{
iconifyimage = builtin_iconifyimage;
}
/* Use the image */
gad->GadgetRender = iconifyimage;
...
/* Free the image */
if (iconifyimage != builtin_iconifyimage) DisposeObject(iconifyimage);
...
That's all. For now I don't have a real include file, therefore, in order
to use "tbiclass" in your applications, please paste the following few lines
at the beginning of your source code. :-]
------- cut here -------8<------- cut here -------8<------- cut here -------
#define POPUPIMAGE (101)
#define MUIIMAGE (102)
#define SNAPSHOTIMAGE (103)
#define ICONIFYIMAGE (104)
#define PADLOCKIMAGE (105)
#define TBFRAMEIMAGE (106)
------- cut here -------8<------- cut here -------8<------- cut here -------
There's already an application using "tbiclass", ViNCEd by Thomas Richter.
I hope you will also support "tbiclass" and contribute this way to finally
give a consistent appearance to all titlebar gadgets used in applications!
Thank you,
Massimo Tantignone (tanti@intercom.it)