/* TEACH GO_BITMAP                           Ben Rabau, 27th Aug 1993

This file shows a few examples of groups which can be dragged around
without losing their go_components. Other go_components can be added.

For more general detailed information see

HELP * GO
REF * GO

 */

;;; Requires the following files to be loaded:
uses go;
uses go_group;
uses go_bitmap;

;;; It also requires the GO window to be active (see TEACH * GO_PANE and
;;; TEACH * GO_RC_WINDOW):
go_init_rc();

/*
-- Example ------------------------------------------------------------
 */
vars a_bitmap = newgo_bitmap();
go_add_to( a_bitmap , go_default_pane );

;;; You can go_drag it around (see TEACH * GO_DRAG)

/*
-- Example with groups ------------------------------------------------
 */
;;; Create a go_group which go_contains an go_bitmap:

;;; First we define a go_group which has already two elements:
;;; one go_bitmap and one go_oblong.
;;; - The two objects are offset from the origin of the object
;;;   as descibed in the go_local_coords slot: the go_bitmap
;;;   will be above (in the positive rc_yscale sense) and aligned (in
;;;   the positive rc_xscale sense) from the go_oblong.
;;;   E.g.: 1 -> go_scale( go_default_pane );
;;; - The total object has a size of 100x100

define :class icon_group;
    isa go_group;

    slot go_components          == [% go_bitmap_key, go_oblong_key %];
    slot stored_go_local_coords == [ 0 0  0 45 ];
enddefine;


;;; ---------------------------------------------------------
vars icon1;

;;; Then we can create a go_group and go_add_to it on the screen:
newicon_group() -> icon1;
go_add_to( icon1 , go_default_pane );

;;; You can also change the bitmap.
vars the_bitmap = the_go_components(icon1)(1);

'orange' -> go_bgcolour( the_bitmap );
'blue'   -> go_fgcolour( the_bitmap );
'$usepop/pop/x/ved/bitmaps/teach_64.xbm' -> go_iconname( the_bitmap );

;;; NOTE:
;;; The size of the icons are not adapted automatically to the
;;; size of the bitmaps they load.
;;; However when the bitmap is scaled down the area shown will be
;;; reduced by clipping.

;;; eof

--- C.all/lib/proto/go/teach/go_bitmap
--- Copyright University of Sussex 1993. All rights reserved.
