[gme-users] handling ports in a decorator

Peter Volgyesi peter.volgyesi at vanderbilt.edu
Fri Jun 11 10:42:02 CDT 2004


Hi,

> 1. Are ports drawn when their container is drawn or
>    as separate steps?
Ports and their container are drawn by the the decorator in s ingle step.

 
> 2. The answer to 1 is only for me to know whether
>    I should enter the decorator DLL name in the
>    attribute panel for the port type or the container type.
>    If container type, then I need some way to get the
>    ports when in the decorator for the container, and if
>    port type, then I need to know when I am in the decorator
>    for the type as port and not for the type's occurrence
>    in the editor or part browser.
Since the ports are drawn by the container's decorator, GME does not use the
"decorator setting" of an object, when it is drawn as a port. GME will use
that attribute when the object itself will be drawn.
As you guessed, the decorator code has to find the ports and display them.

> 
> 3. If I supply an icon in the decorator to be drawn for
>    the port, do I have to size it down myself, or will
>    it happen automatically as it does if no port icon
>    is specified in the metamodel?
The default decorator will stretch your bitmap automatically for container
(model and model reference) objects. (Although it might look awfull in some
cases). For atoms, sets and non-model references GME will use the size of
the bitmap as the object's size.

 
> 4. In the decorator, how can I tell if the port will be
>    drawn on the left or right side of its container?
>    There must be a x-pixel boundary number in GME somewhere.
The GetPortLocation() method in the decorator is called by GME to get the
position of a port. In the default decorator we arranged the ports on the
left and right sides, but it is not obligatory in your custom decorator.
(In the default decorator the "x-pixel" boundary is 100).

--
peter



More information about the gme-users mailing list