| Did you know ... | Search Documentation: |
| graphical->geometry |
->request_geometry,
which is, through
graphical->set,
invoked by all the methods that manipulate the geometry of graphical
objects. The parameters are the requested X-, Y-, W and H values for the
graphical. Values that need not be changed are passed as @default.
Sets the area and informs the graphical's device on the changed
geometry. The device will answer with a graphical->_redraw_area
when this is necessary.
This method is commonly refined, dealing with all possible resize and
move requests. If this method is refined if should always call
the
graphical->geometry
method of the super-class. It is allowed to change the parameters though
The example below defines a box fits on a 10x10 pixel grid.
:- pce_begin_class(grid_box, box).
geometry(B, X:[int], Y:[int], W:[int], H:[int]) :->
align_to_grid(X, NX),
align_to_grid(Y, NY),
align_to_grid(W, NW),
align_to_grid(H, NH),
send(B, send_super, geometry, NX, NY, NW, NH).
align_to_grid(@default, @default).
align_to_grid(Value, Aligned) :-
Aligned is ((Value + 4) // 10) * 10.
:- pce_end_class.
->set ->geometry