PreviousUpNext

15.3.724  src/lib/x-kit/widget/old/text/text-widget.api

## text-widget.api
#
#        "The text widget is a low-level widget for managing a window of text.
#         It provides limited highlighting, and a single font."
#
#            -- p34, Gansner+Reppy's 1993 eXene widget manual,
#               http://mythryl.org/pub/exene/1993-widgets.ps

# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib


# A simple text widget: currently this only supports one fixed-width font (8x13).



###              "The art of programming is the art of organising complexity,
###               of mastering the multitude and avoiding its bastard chaos
###               as effectively as possible."
###
###                                                -- E J Dijkstra


# This api is implemented in:
#
#     src/lib/x-kit/widget/old/text/text-widget.pkg

stipulate
    package wg =  widget;                       # widget        is from   src/lib/x-kit/widget/old/basic/widget.pkg
    package g2d=  geometry2d;                   # geometry2d    is from   src/lib/std/2d/geometry2d.pkg
herein

    api Text_Widget {
        #
        Text_Widget;

        Char_Point
            =
            CHAR_POINT  { col:  Int,
                          row:  Int
                        };

        make_text_widget:       wg::Root_Window  ->  { rows:  Int, cols:  Int }  ->  Text_Widget;

        as_widget:              Text_Widget -> wg::Widget;
        char_size_of:           Text_Widget -> { rows:  Int, cols:  Int };
        size_of:                Text_Widget -> g2d::Size;

        point_to_coordinate:    Text_Widget -> g2d::Point -> Char_Point;
        coordinate_to_box:      Text_Widget -> Char_Point -> g2d::Box;

        scroll_up:              Text_Widget -> { from:  Int, nlines:  Int } -> Void;
        scroll_down:            Text_Widget -> { from:  Int, nlines:  Int } -> Void;

        write_text:             Text_Widget -> { at: Char_Point, text:  String } -> Void;
        highlight_text:         Text_Widget -> { at: Char_Point, text:  String } -> Void;

        insert_line:            Text_Widget -> { lnum:  Int, text:  String } -> Void;
        insert_text:            Text_Widget -> { at: Char_Point, text:  String } -> Void;
        insert_highlight_text:  Text_Widget -> { at: Char_Point, text:  String } -> Void;

        delete_line:            Text_Widget -> Int -> Void;
        delete_lines:           Text_Widget -> { lnum:  Int, nlines:  Int } -> Void;
        delete_chars:           Text_Widget -> { at: Char_Point, count:  Int } -> Void;

        clear_to_eol:           Text_Widget -> Char_Point -> Void;
        clear_to_eos:           Text_Widget -> Char_Point -> Void;
        clear:                  Text_Widget -> Void;

        move_cursor:            Text_Widget -> Char_Point -> Void;
        get_cursor_point:       Text_Widget -> Char_Point;
        cursor_on:              Text_Widget -> Void;
        cursor_off:             Text_Widget -> Void;

    };

end;


## COPYRIGHT (c) 1991 by AT&T Bell Laboratories.  See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext