Flexible Windows

version 13/130803 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter 3 - I6 and Glulx Calls

    Section - I6 for making a window

    Constructing something is an activity.

    The pending g-window is a g-window that varies.

    To g-make (g - a g-window):
        now g is g-present;
        now the pending g-window is g;
        begin the constructing activity with the pending g-window;
        let p1 be the pos-val for g of the position of g + method-val of the scale method of g;
        if the scale method of g is g-using-minimum, let p2 be the minimum size of g;
        otherwise let p2 be the measurement of g;
        let p3 be the kind-val of the type of g;
        let p0 be the ref-number of the direct parent of g;
        now the ref-number of g is the reference created from p0 with p1 and p2 and p3 and rock value rock-value of g;
        end the constructing activity with the pending g-window;

    To decide which number is the reference created from (p0 - a number) with (p1 - a number) and (p2 - a number) and (p3 - a number) and rock value (rock - a number):
    (- (glk_window_open({p0},{p1}, {p2}, {p3}, {rock}))
    -)

    To decide which number is the pos-val for (g - a g-window) of (N - a g-window-position): (- (GetPos({N}, {g})) -).
    To decide which number is the method-val of (N - a g-window-type): (- (GetMethod({N})) -).
    To decide which number is the kind-val of (N - a g-window-kind): (- (GetKind({N})) -).

    Include (-

    [ GetKind kind;
        switch(kind)
        {
            (+g-text-buffer+): return wintype_textbuffer;
            (+g-text-grid+): return wintype_textgrid;
            (+g-graphics+): return wintype_graphics;
        }
    ];

    [ GetMethod type;
        switch(type)
        {
            (+g-proportional+): return winmethod_Proportional;
            default: return winmethod_Fixed;
        }
    ];

    [ GetPos pos win;
        switch(pos)
        {
            (+g-placeabove+): return winmethod_Above;
            (+g-placebelow+): return winmethod_Below;
            (+g-placeleft+): return winmethod_Left;
            (+g-placeright+): return winmethod_Right;
        }

    ];

    -)