HELP WINDOW_FLAVOURS                           Mark Rubinstein  July 1986

    lib window_flavours;

This library (which is only available from within the flavours system)
loads a collection of flavours for manipulating windows and icons on a
screen when used with the POPLOG WINDOW MANAGER.   They must be used from
the pwmtool (see HELP * PWMWINDOWS).  For further details of the flavours
package see TEACH * FLAVOURS.

This package allows you to have an instance that represents and controls a
window (either text or graphics) on the screen, icons and rasters.  You
can also define pseudo windows (part windows) -- objects that behave like
windows in almost all respects but instead of representing windows on the
screen they represent areas of a window on a screen.  The 'hostwindow' of
these part windows can itself be a part window.

Partitioned windows will treat middle mouse button pushes to mean move the
part window under the mouse cursor to the position where the middle button
is released.  Left button pushes are passed on to the part windows at the
mouse cursor location if they have a method to respond to the message.

See also TEACH * FLAVOURS, HELP * PWMWINDOWS, *PWMGRAPHICS
    and HELP * INSTRUMENT_FLAVOURS

-- CONTENTS - (Use <ENTER> g to access sections) -----------------------

 -- Protocol for graphics_window_flavour
 -- Protocol for icon_flavour
 -- Protocol for part_graphics_window_flavour
 -- Protocol for part_window_flavour
 -- Protocol for partial_receiving_window_flavour
 -- Protocol for partitioned_window_flavour
 -- Protocol for partitioned_window_type_flavour
 -- Protocol for raster_flavour
 -- Protocol for receiving_window_flavour
 -- Protocol for text_window_flavour
 -- Protocol for window_flavour
 -- Protocol for window_type_flavour

-- Protocol for graphics_window_flavour --------------------------------

    Represents an actual graphics window on the screen.

Inherits from partial_receiving_window and vanilla
Instance variables are name, myicon (object representing icon),
    window_number (number used by PWM),
    operation (as used by -pwm_grafparams)
    and paint (likewise).

area_raster(left, top, width, height) -> raster;
raster -> area_raster(left, top)
raster-string -> area_raster(left, top, width, height)
    Returns a raster object representing the screen described by LEFT
    pixels from the left margin, TOP pixels from the top margin, WIDTH
    pixels wide and HEIGHT pixels deep. This message has an updater which
    will display the raster over the appropriate area.  If the updater is
    given a string (instead of a instance of raster q.v.) then you must
    specify the width and height.
drawline(<co-ordinate_list>)
drawline(<coordinates>, <number of co-ords>)
    Draws lines as specified by the argument (see HELP * PWMGRAPHICS).
grafselectself
    Select window for PWM graphics operations.
makeself(width, height)
    Makes the graphics window at the given co-ordinates.  A window will
    normally be sent the makeself message when it is sent the message
    initialise.
wipearea(left, top, width, height)
    Wipes the specified area using the windows operation and paint.
wipeself
    Wipes the whole window  using the windows operation and paint.
writetext(x, y, string)
    Writes the characters of string starting from location x,y.
pixel(x, y) -> 1-or-0
1-or-0 -> pixel(x, y)
    Returns a pixel (1=black, 0=white) for the given co-ordinates.  This
    message has an updater.

-- Protocol for icon_flavour -------------------------------------------

Inherits from named_object and vanilla.
Instance variables are name and mywindow.

name
    Updating this instance variable alters the name stripe of the icon.
position -> {x y}
{x y} -> position;
    Returns or alters the position of the icon on the screen.  This
    message has an updater.
selectself
    Selects the window of the icon for pwm operations.

There are after daemons on: (updaterof) name.

-- Protocol for part_graphics_window_flavour ---------------------------

    Flavour for a graphics window representing an area of a graphics
    window.

Inherits from part_window and vanilla
Instance variables are char_base, char_height, char_width, hostwindow,
    name, operation, paint, position and size.

area_raster(left, top, width, height) -> raster;
raster -> area_raster(left, top)
raster-string -> area_raster(left, top, width, height)
    Returns a raster object representing the screen described by LEFT
    pixels from the left margin, TOP pixels from the top margin, WIDTH
    pixels wide and HEIGHT pixels deep. This message has an updater which
    will display the raster over the appropriate area.  If the updater is
    given a string (instead of a instance of raster q.v.) then you must
    specify the width and height.
grafselectself
    Selects the window for graphics operations.
drawline(<co-ordinate_list>)
drawline(<coordinates>, <number of co-ords>)
    Draws lines as specified by the argument (see HELP * PWMGRAPHICS).
borderself
    Draws a border around the window area.
wipearea(left, top, width, height)
    Wipes the specified area using the windows operation and paint.
wipeself
    Wipes the whole window  using the windows operation and paint.
writetext(x, y, string)
    Writes the characters of string starting from location x,y.
pixel(x, y) -> 1-or-0
1-or-0 -> pixel(x, y)
    Returns a pixel (1=black, 0=white) for the given co-ordinates.  This
    message has an updater.

There are after daemons on: refreshself

-- Protocol for part_window_flavour ------------------------------------

    Flavour for windows objects that are actually areas of a 'hostwindow'

Inherits from window_type, ivalofinit and vanilla
Instance variables are char_base, char_height, char_width, hostwindow,
    name, operation, paint, position and size

apply_area(x, y, width, height, message)
    Sends the message to the hostwindow with the x and y co-ordinates
    adjusted for equivalent host co-ordinates.
check_xcoord(x)
    Checks that x is a legitimate x co-ordinate.  Mishaps if not.
check_ycoord(y)
    Checks that y is a legitimate y co-ordinate.  Mishaps if not.
copy_area(x1, y1, width, height, op, x2, y2);
    Copies the area described by x1, y1, width and height to the position
    x2 y2 applying the operation op to the source area.
host_equiv_x(x) -> host-x;
    Returns the host x co-ordinate which describes the same location as
    the local x co-ordinate.
host_equiv_y(y) -> host-y;
    Returns the host y co-ordinate which describes the same location as
    the local y co-ordinate.
killself
    Removes details of self from the host.  Does not affect the screen.
refreshself
    This method should be defined by a sub-class.

There are before daemons on: position
There are after daemons on: initialise

-- Protocol for partial_receiving_window_flavour -----------------------

    Flavours that inherit from this mixin will receive messages when mouse
    events occur in their window.  The messages are only sent if the
    instance has a method for handling it.  Possible messages about mouse
    events are.
        left_button_pushed(x, y)
        left_button_released(x, y)
        middle_button_pushed(x, y)
        middle_button_released(x, y)
        right_button_pushed(x, y)
        right_button_released(x, y)
        mouse_exited
        window_opened
        window_closed
        c -> nextchar()             (this is an update method)
        unrecognized_input          (handled by this mixin)
        quit_requested              (handled by this mixin)

A mixin
Inherits from window and vanilla
Instance variables are myicon, name, paint window_number, operation and
    paint

quit_requested
    Prompts the user if they really want to quit.  If they confirm then
    "killself" is sent to self.
unrecognized_input(input)
    mishaps.

There are after daemons on: makeself

-- Protocol for partitioned_window_flavour -----------------------------

    This is a screen window which has one or more part_windows on it.

Inherits from graphics_window, partitioned_window_type, receiving_window
    and vanilla
Instance variables are contents, myicon, name, operation, paint and
    window_number.

middle_button_pushed(x, y)
    If there is one or more part windows at this location notes that it is
    to be moved.  Changes the cursor icon.
middle_button_released(x, y)
    If a part window has been noted as in move state (as above) then sends
    the message:
        {x, y} -> moving_part_window <- position.
    in order to move it.  Restores the icon.  If the moving window
    overlapped with any other windows then send each of them the message
    "refreshself".
mouse_exited
    If a part window has been noted as in move state then de-notes it and
    restores the cursor icon.

-- Protocol for partitioned_window_type_flavour ------------------------

    This is the mixin for windows that have one or more part windows on
    them.  The window may be a screen window or itself a part window
    depending upon what flavours this mixin is mixed with.

A mixin.
Inherits from window_type, collection and vanilla.
Instance variables are contents name, operation, paint and

check_occupied(x, y)
    Mishaps if the position (x,y) is occupied by one of the part windows.
left_button_pushed(x, y)
    For each of the part windows at (x,y) sends the message with
    "left_button_pushed" with co-ordinates adjusted for the part_window to
    the windows iff they have a method to respond to the message with.
left_button_released(x, y)
    As for left_button_pushed above.
make_part(width, height, pfromleft, pfromtop) -> part_graphics_window
    Makes an instance of part_graphics_window of size {width height} to
    sit on self at position {pfromleft, pfromtop};
middle_button_released(x, y)
    As for left_button_pushed above.
middle_button_pushed(x, y)
    As for left_button_pushed above.
nextchar
    This message only has an updater.  -- Default method which does
    nothing.
parts_occupying(x, y) -> list
    Returns a list of part windows occupying the location (x, y)
refreshself
    Sends the message "refreshself" to each of the part windows that have
    a method to respond to the message.
report_mouse_event(x, y, event)
V -> report_mouse_event(x, y, event)
    For each of the parts that are occupying (x,y) send the message
    "event" with the argument of x and y suitably adjusted for the part
    iff the part has a method to respond to the message.  This message has
    an updater.
right_button_pushed(x, y)
    As for left_button_pushed above.
right_button_released(x, y)
    As for left_button_pushed above.
window_closed
    Default method which does nothing.
window_opened
    Default method which does nothing.
windows_overlapping(window) -> list;
    Returns a list of all the windows that overlap WINDOW.

There are before daemons on: killself

-- Protocol for raster_flavour -----------------------------------------

    A flavour for representing a raster (area of a window).

Inherits from vanilla
Instance variables are width, height and data_string

-- Protocol for receiving_window_flavour -------------------------------

    A mixin subclasses of which must be able to respond to all the mouse
    events messages.  No check will be made to see if they do respond
    which means that mouse-event messages will be sent faster.

A mixin
Inherits from window and vanilla
Instance variables are myicon, name, operation, paint and window_number.

Subclasses must respond to the following messages: left_button_pushed,
    left_button_released, middle_button_pushed, middle_button_released,
    mouse_exited, nextchar, right_button_pushed, right_button_released,
    window_closed and window_opened

There are after daemons on: makeself

-- Protocol for text_window_flavour ------------------------------------

    Class for text windows

Inherits from window and vanilla
Instance variables are myicon, name, operation, paint and window_number.

makeself(width, height)
    Makes the text window at the given co-ordinates.  A window will
    normally be sent the makeself message when it is sent the message
    initialise.
c -> nextchar()
    Displays the character c.
writestring(string);
    Displays the string.

-- Protocol for window_flavour -----------------------------------------

    A mixin for screen windows, either graphic or text.

A mixin
Inherits from window_type and vanilla
Instance variables are myicon, name, operation, paint and window_number.

copy_area(x1, y1, width, height, op, x2, y2);
    Copies the area described by x1, y1, width and height to the position
    x2 y2 applying the operation op to the source area.
expose
    Exposes the window (if hidden by other windows).
hide
    Hides the window (makes it bottom of the pile).
iconic -> BOOLEAN
BOOLEAN -> iconic
    Returns true iff the window is in its iconic form.  This message has
    an updater which will make the window open or closed appropriately.
killself
    Kills the screen window.  Sets window_number to be false.
makeself
    This message must be supplied by a sub-class.
move
    This causes a user-interactive move as if selected from the menu.
position -> {x, y}
{x, y} -> position
    Returns or updates the position of the window on the screen.  This
    message has an updater.
refresh
    Refreshes the window -- equivalent to selecting "refresh" from the
    menu.
resize
    Causes a user-interactive stretch as if selected from the menu.
selectself
    Selects the window for normal PWM operations.
size -> {x, y}
{x, y} -> size;
    Returns or updates the size of the window.  This message has an
    updater.

There are before daemons on: initialise
There are after daemons on: initialise and name

-- Protocol for window_type_flavour ------------------------------------

    This mixin represents features true of all kinds of windows including
    part windows.

A mixin
Inherits from named_object and vanilla
Instance variables are name, operation and paint

circle(xcentre, ycentre, radius)
    Draws a circle of the given size at the given location.
clearself
    Clears the whole window area (paintself(PWM_CLR)).
filled_circle(xcentre, ycentre, radius)
    Draws a filled circle of the given size at the given location.
filled_lower_hemisphere(xcentre, ycentre, radius)
    Draws a filled lower hemisphere of the given size at the given
    location.
filled_upper_hemisphere(xcentre, ycentre, radius)
    Draws a filled upper hemisphere of the given size at the given
    location.
lower_hemisphere(xcentre, ycentre, radius)
    Draws a lower hemisphere of the given size centered at the given
    location.
move_area(x1, y1, width, height, x2, y2);
    Moves the area described by x1, y1, width and height to the position
    at x2, y2.
paintarea(x, y, width, height, operation)
    Applies the given operation (wipes) to the area specified by x, y,
    width and height.
paintself
    Applies (wipes with) the given operation to the whole window.
printself
    For printing instances of window.
refreshself
    Default method -- does nothing (the before daemon will clearself).
upper_hemisphere(xcentre, ycentre, radius)
    Draws an upper hemisphere of the given size at the given location.
window_raster -> raster;
raster -> window_raster;
    Reads or dumps a raster for the whole window.  This message has an
    updater.

There are before daemons on: refreshself

--- C.pwm/help/window_flavours -----------------------------------------
--- Copyright University of Sussex 1987. All rights reserved. ----------
