(index ("initialize" 0) ("redraw" 287) ("width" 439) ("height" 516) ("get-char" 596) ("<win>" 749) ("win-left" 1120) ("win-right" 1120) ("win-top" 1120) ("win-bottom" 1120) ("win-pointer" 1120) ("make-win" 1416) ("key-up" 3315) ("key-down" 3315) ("key-left" 3315) ("key-right" 3315))
(def (sig (procedure "(initialize #!key terminal)" (id initialize))) (p "Initializes " (tt "terminal") " for ncurses operation. By default this is the terminal connected to " (tt "(current-output-port)") ". Usually this procedure has to be called once before the program's main loop."))
(def (sig (procedure "(redraw)" (id redraw))) (p "Draws all Mojo windows. This should usually be called at the beginning of the program's main loop."))
(def (sig (parameter "width" (id width))) (p "The current terminal width."))
(def (sig (parameter "height" (id height))) (p "The current terminal height."))
(def (sig (procedure "(get-char)" (id get-char))) (p "Reads a character using ncurses' " (tt "getch") " and implicitly handles " (tt "KEY_RESIZE") "."))
(def (sig (class "<win>" (id <win>))) (p "This is the class that represents a Mojo window. It has the following public slots:") (dl (dt "left") (dd "the distance from the left") (dt "right") (dd "the distance from the right") (dt "top") (dd "the distance from the top") (dt "bottom") (dd "the distance from the bottom") (dt "pointer") (dd "the ncurses window pointer")))
(def (sig (procedure "(win-left win)" (id win-left)) (procedure "(win-right win)" (id win-right)) (procedure "(win-top win)" (id win-top)) (procedure "(win-bottom win)" (id win-bottom)) (procedure "(win-pointer win)" (id win-pointer))) (p "Accessors for the respective " (tt "<win>") " slots."))
(def (sig (procedure "(make-win #!key width height left right top bottom left-of right-of below above box background)" (id make-win))) (p "Convenience constructor function so you don't have to " (tt "(use coops)") " in your program to create window objects.") (p (tt "box") " is a boolean indicating whether to draw a border box around the window. The default is " (tt "#t") ".") (p (tt "background") " is a boolean indicating whether to fill the window's background with the foreground color. It does not work very well. The default is " (tt "#f") ".") (p "All other arguments are used for specifying dimension, position and relation of the window. In the simplest case, a " (tt "width") " and a " (tt "height") " is given as well as absolute " (tt "top") "/" (tt "bottom") " and " (tt "left") "/" (tt "right") " positions:") (highlight scheme "(make-win width: 10 height: 5 left: 2 top: 2)") (p "However, almost all combinations are possible, e.g. one could leave out the " (tt "width") " and only specify the positions from the " (tt "left") " and " (tt "right") " borders of the terminal. This will result in a variable width window that is resized when the terminal is resized, maintaining its distance from the left and right borders:") (highlight scheme "(make-win height: 5 top: 2 left: 2 right: 2)") (p "The " (tt "left-of") ", " (tt "right-of") ", " (tt "above") " and " (tt "below") " arguments can take other windows as values. All positions and distances are then relative to the outer borders of that window. For example:") (highlight scheme "(define foo (make-win width: 2 height: 1 left: 2 top: 2))\n(define bar (make-win right-of: foo width: 2 height: 1 left 1))") (p "This will draw " (tt "bar") " on the right of " (tt "foo") " with 1 unit distance between them. Since no vertical positioning of " (tt "bar") " is given its upper border will align with that of " (tt "foo") "."))
(def (sig (constant "key-up" (id key-up)) (constant "key-down" (id key-down)) (constant "key-left" (id key-left)) (constant "key-right" (id key-right))) (p "Character values of arrow keys as returned by " (tt "get-char") "."))
