> <\body> The graphical toolkit used by Edit has two main components: an abstract window interface, which is very similar to X Window, and the actual toolkit. At this moment an abstract window interface for X Window has been implemented, but others might be added in the future. The abstract window interface consists of two main classes: and . The class is responsible for <\itemize> The connection with the (X-)server. Managing server resources such as colors and fonts. Inter-window communication (i.e. selections and so). Redirection of input/output (pointer and keyboard grabs). The class is responsible for <\itemize> The part of the layout of a window, which is negotiated with the window manager. Providing a basic set of postscript-compatible graphical routines. Implementation of some clipping and region translation routines. Delegation of events to the widget associated to the window. In particular, the -class inherits from the -class, which is responsible for providing the basic set of postscript-compatible graphical routines. Hence, user applications will draw their graphics on a , since this will both allow them to visualize them in a window or on a printer. The graphical toolkit built on top of the abstract window interface is widget oriented. A large number of widget classes are implemented, which all inherit from the abstract class. Widgets may have a finite number of children and they are responsible for <\itemize> Their, and their children, sizes and positioning in the window. Reaction on events, which are either redraw requests, keyboard or pointer events or other miscellaneous events. Other functionalities, which depend on the particular widget class. Later a special widget-style manager will be implemented, which will be able to present widgets according to different \Pstyles\Q. In order to create a window \PTest\Q with the text \PHello world\Q in it, one first opens the display, then create the widget with the text and finally the window, with the widget attached to it\ <\verbatim> \ \ \ \ display dis= open_display (); \ \ \ widget \ wid= text_widget ("Hello world"); \ \ \ window \ win= plain_window (wid, dis, "Test"); Technically speaking, the window creation amounts to several actions: <\itemize> The widget is questioned for an appropriate size for it (actually, only minimal, default and maximal size hints are computed). The window is created. The widget is \Pattached\Q to the window. The subwidgets are \Ppositioned\Q at their appropriate places and they are given appropriate sizes within their parents. The next step is to make the window visible by\ <\verbatim> \ \ \ \ win-\map (); At this points repaint request events are generated, which are handled when starting the event loop by\ <\verbatim> \ \ \ \ dis-\event_loop (); Eventually, the window will be destroyed using\ <\verbatim> \ \ \ \ delete win; At this point, control is handled back by the event loop and we close and destroy the display by\ <\verbatim> \ \ \ \ close_display (dis) \ \ \ delete dis; The user only has to bother about destroying window and displays; widgets are automatically destroyed if they are no longer being referenced to. From the implementation point of view, widgets are pointers to instances of the abstract widget representation class . Moreover, the widget class supports reference counting. The class contains information about the window it is attached to and its location within this window, its size, the position of the origin of its local coordinates (, , etc.) and its children. The class also provides a virtual event handler . This handler returns true if the event could be handled. The implemented widget representation classes are organized in a hierarchy, which contains both concrete and abstract classes. The abstract classes reimplement the virtual event handler in such a way that if the event is recognized, then the event is dispatched to a more particular virtual event handler, possibly after some processing. For example, instances of the class can handle the most common events, such as keyboard, mouse, repaint events and so on. If a key is pressed, then the virtual function is called with an argument of type . The default implementation of this virtual function does nothing. The user can also create his own events, which he can pass to any widget. For instance in order to invalidate a region for redrawing, one creates an invalidate event using and sends it to the appropriate widget using the operator \>. Notice that the user is responsible for sending events to widgets which can handle them. Bad matches are only discovered at run time, in which case an error is generated by \>. Suppose that we want to make a widget, which tracks keyboard events and which displays them. Such a widget must have a construction routine and keyboard and repaint handlers:\ <\verbatim> \ \ \ \ class track_widget_rep: basic_widget_rep { \ \ \ \ \ string last_key; \ \ \ \ \ track_widget_rep (); \ \ \ \ \ void handle_keypress (keypress_event ev); \ \ \ \ \ void handle_repaint (repaint_event ev); \ \ \ }; The constructor is taken to be empty and places the origin at the center of the widget\ <\verbatim> \ \ \ \ track_widget_rep::track_widget_rep (): basic_widget (center) {} In particular is initialized by the empty string. We also define the function\ <\verbatim> \ \ \ \ void \ \ \ track_widget () { \ \ \ \ \ return new track_widget_rep (); \ \ \ } in order to create an instance of a . The event handler for keyboard events should just reset the string and invalidate the entire widget region.\ <\verbatim> \ \ \ \ void \ \ \ track_widget_rep::handle_keypress (keypress_event ev) { \ \ \ \ \ last_key= ev-\key; \ \ \ \ \ this \\ emit_invalidate_all (); \ \ \ } The event handler for repainting first determines the string to be repainted as a function of , computes its extents and repaints it at the center.\ <\verbatim> \ \ \ \ void \ \ \ track_widget_rep::handle_repaint (repaint_event ev) { \ \ \ \ \ string s= (last_key == ""? "No key pressed": "Pressed " * last_key); \ \ \ \ \ SI x1, y1, x2, y2; \ \ \ \ \ win-\get_extents (s, x1, y1, x2, y2); // CHECK THIS \ \ \ \ \ win-\set_color (black); \ \ \ \ \ win-\fill (ev-\x1, ev-\y1, ev-\x2, ev-\y2); \ \ \ \ \ win-\set_color (white); \ \ \ \ \ win-\draw_string (s, -(x1+x2)\\1, -(y1+y2)\\1); \ \ \ } \; Widgets are pointers to instances of the abstract widget representation class . Widgets support reference counting, so that a widget is automatically destroyed if it is not used any more (except in the case of circular referencing; see below). As a general rule, the user does not have to worry about the creation and destruction of widgets. The definition of the class goes as follows:\ <\verbatim> \ \ \ \ struct widget_rep: rep_struct { \ \ \ \ \ window \ \ \ \ \ \ \ win; \ \ \ \ \ \ \ \ \ \ // underlying window \ \ \ \ \ SI \ \ \ \ \ \ \ \ \ \ \ ox, oy; \ \ \ \ \ \ \ // origin of widget in window \ \ \ \ \ SI \ \ \ \ \ \ \ \ \ \ \ w, h; \ \ \ \ \ \ \ \ \ // width and height of widget \ \ \ \ \ gravity \ \ \ \ \ \ grav; \ \ \ \ \ \ \ \ \ // position of the origin in the widget \ \ \ \ \ array\widget\ a; \ \ \ \ \ \ \ \ \ \ \ \ // children of widget \ \ \ \ \ array\string\ name; \ \ \ \ \ \ \ \ \ // names for the children \ \ \ \ \ widget_rep (array\widget\ a, array\string\ name, gravity grav); \ \ \ \ \ virtual ~widget_rep (); \ \ \ \ \ virtual operator tree () = 0; \ \ \ \ \ virtual bool handle (event ev) = 0; \ \ \ \ \ SI \ \ \ \ \ \ x1 (); SI y1 (); // lower left window coordinates of widget \ \ \ \ \ SI \ \ \ \ \ \ x2 (); SI y2 (); // upper right window coordinates of widget \ \ \ \ \ bool \ \ \ \ attached (); \ \ \ \ // tests whether (win != NULL) \ \ \ \ \ volatile void fatal_error (string mess, string rout="", string fname=""); \ \ \ \ \ \ \ \ friend class widget; \ \ \ }; \; The field specifies the window to which the widget is attached (, by default). The origin of the widget is specified with respect to the windows origin. Next come the width and the height of the widget. The gravity determines where the origin of the widget is located (, , etc.). The array specifies the children of the widget. The array gives names to the children of the widget. This is useful for addressing children by comprehensible names; the names are also useful for designing menu widgets. The virtual type casting operator for trees is used for debugging purposes; mainly in order to print widgets. The virtual member function processes an event which is send to the widget and returns if the event could be handled and if not. The definition of the class goes as follows:\ <\verbatim> \ \ \ \ struct widget { \ \ \ #import null_indirect_h (widget, widget_rep) \ \ \ \ \ inline widget (widget_rep* rep2): rep (rep2) { \ \ \ \ \ \ \ if (rep!=NULL) rep-\ref_count++; } \ \ \ \ \ inline widget operator [] (int i) { return rep-\a[i]; } \ \ \ \ \ \ \ \ \ \ \ \ widget operator [] (string s); \ \ \ \ \ inline operator tree () { return (tree) (*rep); } \ \ \ \ \ inline bool operator == (widget w) { return rep == w.rep; } \ \ \ \ \ inline bool operator != (widget w) { return rep != w.rep; } \ \ \ }; \; Widgets may be constructed in two ways. First, we may construct a symbolic \Pnil\Q widget by . The function is provided in order to test whether a widget is \Pnil\Q. Secondly, we may construct a widget from a pointer of type . The reference counting mechanism ensures widgets to be destroyed when they are no longer pointed to. An important exception is when two widgets point one to each other, which fools the reference counter (for instance a scrollbar and the widget which is scrolled need to point one to each other). In order to deal with such \Pcircular dependencies\Q, one works directly with pointers if one does not want to the pointer to be taken into account in the reference counter. Child widgets can again be accessed to in two ways. First, we have the direct way, using its index in the array . Secondly, we can access to a child via its name. Actually, when using this method, a event is generated. In the basic widget class, the default action for this event is to search in the name array for the child. However, the user may override this default action and provide another child searching method. Events are pointers to instances of the abstract class, which supports reference counting. Actually, concrete event representation classes just contain some information. Hence, events actually provide a safe and generic way to store and communicate information. The definition of the structure is as follows:\ <\verbatim> \ \ \ \ struct event_rep: public rep_struct { \ \ \ \ \ int \ \ \ type; \ // the event type \ \ \ \ \ inline event_rep (int type2): rep_struct (0), type (type2) {} \ \ \ \ \ inline virtual ~event_rep () {} \ \ \ \ \ virtual operator tree () = 0; \ \ // for displaying events (debugging) \ \ \ }; \; The field gives the type of the event. A complete list of the event types if given in the file\ <\verbatim> \ \ \ \ Window/Event/event_codes.hpp For each project which uses new event types, an analogue file should be made and the numbers of the event types should all be different. Unfortunately, there is no safe way in order to let this job be done by the compiler. The structure is defined by\ <\verbatim> \ \ \ \ struct event { \ \ \ #import indirect_h (event, event_rep) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ inline event (event_rep* rep2): rep (rep2) { \ \ \ \ \ \ \ if (rep!=NULL) rep-\ref_count++; } \ \ \ \ \ inline operator tree () { return (tree) (*rep); } \ \ \ }; \ \ \ #import indirect_cc (event, event_rep) \; Concrete event classes again come into two parts: the class itself and its representation class. For instance, the representation class for events is defined by\ <\verbatim> \ \ \ \ struct get_widget_event_rep: public event_rep { \ \ \ \ \ string which; widget& w; \ \ \ \ \ get_widget_event_rep (string which, widget& w); \ \ \ \ \ operator tree (); \ \ \ }; The corresponding class is defined by\ <\verbatim> \ \ \ \ #import event (get_widget_event, get_widget_event_rep) \; The module with two parameters is defined by\ <\verbatim> \ \ \ \ #module event (T, R) \ \ \ struct T { \ \ \ \ \ R* rep; \ \ \ \ \ T (T& ev); \ \ \ \ \ ~T (); \ \ \ \ \ T (event& ev); \ \ \ \ \ operator event (); \ \ \ \ \ R* operator -\ (); \ \ \ \ \ T& operator = (T ev); \ \ \ }; \ \ \ #endmodule // event (T, R) The important thing to notice is that we have converters from and to the generic class. Moreover, the generic class and the specific class are compatible from the reference counting point of view. The implementation of the class is as follows:\ <\verbatim> \ \ \ \ get_widget_event_rep::get_widget_event_rep (string ww, widget& w2): \ \ \ \ \ event_rep (GET_WIDGET_EVENT), which (ww), w (w2) {} \ \ \ get_widget_event_rep::operator tree () { \ \ \ \ \ return tree ("get_widget_event", which); } \ \ \ #import code_event (get_widget_event, get_widget_event_rep) The actual events are created by\ <\verbatim> \ \ \ \ event get_widget (string which, widget& w) { \ \ \ \ \ return new get_widget_event_rep (which, w); } \; Implementations of the generic event handler usually do the following <\itemize> Determine the event type. Perform some action, depending on the event type and the widget. Dispatch the event to a concrete or abstract specific event handler or to the generic event handler of some other widget representation class. For instance, the event handler for composite widgets is as follows:\ <\verbatim> \ \ \ \ bool \ \ \ composite_widget_rep::handle (event ev) { \ \ \ \ \ switch (ev-\type) { \ \ \ \ \ case CLEAN_EVENT: \ \ \ \ \ \ \ handle_clean (ev); \ \ \ \ \ \ \ return TRUE; \ \ \ \ \ case INSERT_EVENT: \ \ \ \ \ \ \ handle_insert (ev); \ \ \ \ \ \ \ return TRUE; \ \ \ \ \ case REMOVE_EVENT: \ \ \ \ \ \ \ handle_remove (ev); \ \ \ \ \ \ \ return TRUE; \ \ \ \ \ } \ \ \ \ \ return basic_widget_rep::handle (ev); \ \ \ } The member function is implemented as follows:\ <\verbatim> \ \ \ \ void \ \ \ composite_widget_rep::handle_insert (insert_event ev) { \ \ \ \ \ a \\ ev-\w; \ \ \ \ \ name \\ ev-\s; \ \ \ } In particular, we can retrieve the fields and from from the in the member function. Summarizing, in order to add your own new event classes, you have to take care of the following steps: <\itemize> Add a new event type to some file. Declare and implement the event type and its representation type. Declare and implement the event creation functions. Reimplement the generic event handler in the abstract or concrete widget representation class, where you want to use your new event class. The main event loop does the following <\itemize> As long as the application did not destroy all its windows, wait for a new event to occur. If an event occurs, handle all events on the queue, by creating the appropriate events and sending them to the appropriate widgets (job of the window interface implementation). If there are no events left, send an to each window. This is useful for complex applications, where regions of the window may be invalidated during this phase. Indeed, the event handling phase may consist of many complex actions, so that the regions to invalidate may be determined easier . Requests are emitted in order to repaint the regions which have been invalidated during the event processing stages. All coordinates and sizes are represented by instances of type , which is nothing but another name for . The constant , which is a power of two \ PIXEL_SHIFT> denotes the size of a pixel on the screen. Since 1>, coordinates and sizes are not necessarily integer multiples of the pixel size. However, the coordinates of the origin and the size of a widget should always be such multiples. In order to achieve this, some rounding functions are provided. The function rounds the argument to an integer multiple of . Furthermore, the member functions\ <\verbatim> \ \ \ \ void inner_round (SI& x1, SI& y1, SI& x2, SI& y2); \ \ \ void outer_round (SI& x1, SI& y1, SI& x2, SI& y2); transform a rectangle into a new one with integer multiple of coordinates, which is enclosed encloses the original rectangle. Each widget has an origin with respect to the window to which it has been attached. This is the origin of the \Plocal coordinates\Q. The origin of the \Pglobal coordinates\Q is the origin of the window. The location of the local origin in the widget is determined by the widget's gravity, which is either one of , , , , , , , or . As a general rule, events are transmitted in global coordinates. Nevertheless, in widgets which are derived from the abstract basic widget class, by default, all computations are done with respect to local coordinates. This is due to two reasons <\itemize> When an event has to be processed, the abstract widget event handler translates global into local coordinates and calls the appropriate virtual event handler using local coordinates. When an event has to be emitted, the abstract widget provides event construction routines w.r.t. local coordinates, which override the global event construction routines w.r.t global coordinates. For some very particular purposes, such as popping up windows, one has to perform computations with respect to the screen coordinates. Given a point in the coordinates of some window , the screen coordinates of are obtained by adding the windows origin, which is obtained by calling get_position (ox,oy)>. When a widget is created, the field of its representation is set to , since it is not yet attached to a window. In order to attach a widget to a window , one emits an :\ <\verbatim> \ \ \ \ w \\ emit_attach_window (win); Notice that taking results in detaching the widget. Notice also that a widget may be attached to at most one window: attempts to reattach a widget, which is already attached, to another window, result in a fatal error. Some events can be handled by widgets which are not yet attached to a window, such as: <\itemize> \Pget size\Q events, which determine the default, minimal and maximal size of a widget. Such an event is generated before the creation of the window to which the widget will be attached in order to determine the size of the window. \Pattach window\Q events, in order to attach (or detach) a window. Events for setting (and getting) attributes: after the creation of a widget some attributes of the widget may be given some default value. In order to change them, one might wish to set them to other values before attaching the widget to a window. Events for modifying the composite structure of a widget: these events are used for instance in order to construct menus. For some of these events, such as attribute changes, it may be necessary to emit invalidate events in case when the widget had been attached to some window. In order to test this one uses the member function\ <\verbatim> \ \ \ \ bool widget_rep::attached (); \; When an appropriate size has been determined for a widget (using \Pget size\Q events) and when a widget has been attached to some window, the widget is positioned in the main window. By default, all children are recursively positioned at the top left of the window at sizes . But for complex widgets with children, a specific positioning routine usually has to be implemented. Such a routine involves positioning of the children within the parent. This is done by emitting position events to the children. For instance,\ <\verbatim> \ \ \ \ a[i] \\ emit_position (x[i], y[i], w[i], h[i], center); positions the -th child, such that the origin of is at position w.r.t. the local coordinates of and such that the origin is situated in the center of . The width and height of are set to . During execution, it may happen that a particular widget has changed, so that it obtains a different size and/or position. In this case, one emits an to the closest ancestor, whose position and size did not change. For instance, consider the case of a footer , which consists of a left footer , followed by some glue and a right footer . When the left footer changes:\ <\verbatim> \ \ \ \ footer \\ set_widget ("left", text_widget ("new text")); the size of changes, and the size and position of the glue should also be changed. Nevertheless, the size and position of remain unaltered, whence we update :\ <\verbatim> \ \ \ \ footer \\ emit_update (); \; Updating an attached widget results in three actions to take place: <\itemize> The widget is reattached to its own window. Indeed, some children of the widget might need be attached. The widget is repositioned at its current position and size. Again this will actually affect the children. The widget is invalidated, so that it will be repainted. Each window on the screen determines a main widget w> which is attached to it and a descendant kbd_focus> of this widget, which handles the keyboard input directed to the window. This latter widget kbd_focus>, which is set to w> by default, is said to have keyboard focus, if the window has keyboard focus (i.e. if all keyboard events are sent to this window). Consequently, the widget which has keyboard focus receives all keyboard events. When the keyboard focus of a window changes, a is sent to kbd_focus>. The field flag> of this event is if the window got the focus, and if the window lost focus. The keyboard focus widget kbd_focus> associated to a window can be changed by calling the member function\ <\verbatim> \ \ \ \ void window_rep::set_keyboard_focus (widget); Setting the input focus to another widget than w> is useful, for instance, if a particular text input field of some form needs keyboard focus after a mouse click on it. When a widget has the keyboard focus, and a key is pressed, it receives a . The class contains a field , which contains a comprehensible string corresponding to the key which was pressed. More precisely, is either a one character string, or a symbolic name like return\">, right\">, del\">, etc. or a composed name like shift-F1\">, ctrl-esc\"> or meta-x\">. The complete list of keys is as follows:\ <\verbatim> \ \ \ \ "\F1\", "\F2\", "\F3\", "\F4\", "\F5\", "\F6\", \ \ \ "\F7\", "\F8\", "\F9\", "\F10\", "\F11\", "\F12\", \ \ \ "\esc\", "\tab\", "\less\", "\gtr\", "\del\", "\return\", \ \ \ "\ins\", "\home\", "\end\", "\page-down\", "\page-up\", \ \ \ "\left\", "\up\", "\down\", "\right\" The keys less\"> and gtr\"> correspond to "> and ">. The allowed modifiers are , and or combinations of these. A mouse event occurs on a button change or a mouse movement. The type> field contains the type of the event and x> and y> the corresponding coordinates of the mouse. Finally, the states of the mouse buttons can be questioned using the routine pressed (string)>. The possible values of type> on button change events are the following:\ <\verbatim> \ \ \ \ "press-left", "press-middle", "press-right", \ \ \ "release-left", "release-middle", "release-right" The possible values for mouse movement events are\ <\verbatim> \ \ \ \ "move", "enter", "leave" The and events occur when the mouse enters leaves the widget. Finally, the states of the left, middle and right mouse buttons can respectively be obtained using the calls\ <\verbatim> \ \ \ \ ev-\pressed ("left") \ \ \ ev-\pressed ("middle") \ \ \ ev-\pressed ("right")\ For some applications such as popup menus or scrollbars, it is useful to direct all mouse events to a particular widget . This is done by grabbing the mouse by emitting the event\ <\verbatim> \ \ \ \ w \\ emit_grab_mouse (TRUE) After such a grab, all mouse events are directed to , even those events which occurred before the grab (contrary to X Window). The mouse grab is released by\ <\verbatim> \ \ \ \ w \\ emit_grab_mouse (FALSE) \; Actually, the display keeps track of a list of widgets for which a mouse grab occurred: if the mouse is grabbed by widgets next , and again ungrabbed by , then all mouse events are again sent to . This feature is useful for successive grabs by recursive popup menus. When a widget grabs the mouse, and a previous mouse grab on a widget is still active, then a event is sent to and an event to . Similarly, if releases the grab, then a event is sent to and an event to . Each window keeps track of a list of rectangles to be repainted (moreover, redundant rectangles are eliminated automatically and adjacent rectangles are transformed in larger rectangles). During the repaint stage in the event loop, the widget is requested to repaint these rectangles. The repaint handler takes on input a , which determines the rectangle to be repainted. Moreover, contains a boolean field , which can be set in order to indicate that the repaint process was stopped somewhere in the middle. Indeed, for widgets which take a long time to be repainted, it may be useful to abort repainting if a key is pressed. The arrival of an event which aborts repainting can be checked directly on the postscript device :\ <\verbatim> \ \ \ \ if (dev-\check_event (EVENT_STATUS)) { ... } // CHECK THIS In the case of a window, such an event may signify that a key has been pressed; in the case of a printer, it might suggest the printer being turned off. If the application decides to abort repainting, it sets stop> to . The rectangle which was being repainted is put back on the invalid rectangles list in the event loop; it will be processed again during the next pass through the repaint phase. When window is mapped on the screen or when a region is exposed, the window interface automatically invalidates the corresponding rectangle. The user may also invalidate a rectangle by using either one of the routines\ <\verbatim> \ \ \ \ event emit_invalidate_all (); \ \ \ event emit_invalidate (SI x1, SI y1, SI x2, SI y2); The first routine creates an event to invalidate the entire widget area; the other routine invalidates a specified region. Many widgets from the toolkit are derived from some other standard abstract widget classes, which can handle some other special events. These widgets allow to add or remove children to or from a widget. This makes them particularly useful for menu widgets. They respond to , and events. These widgets allow to set window attributes of some common types such as integers, strings, commands, points, etc. They can be used for instance to retrieve an input string or in order to set the scroll position in a canvas widget. Glue widgets are created by\ <\verbatim> \ \ \ \ widget glue_widget (bool hext=TRUE, bool vext=TRUE, SI w=0, SI h=0); The first two arguments determine whether the widget is extensible horizontally vertically. The last two elements determine the default and minimal size of the widget. Text widgets are created using\ <\verbatim> \ \ \ \ widget text_widget (string s); They just display the text . Two types of buttons have been implemented. First, command buttons are created using\ <\verbatim> \ \ \ \ widget command_button (string s, command cmd); They display the text and execute the command when pressed. Secondly, we implemented popup buttons, which popup some window when pressed. Popup buttons are created by one of\ <\verbatim> \ \ \ \ widget pulldown_button (string s, widget m); \ \ \ widget pullright_button (string s, widget m); depending on where the popup window should popup. The main widget attached to the popup window should be created using\ <\verbatim> \ \ \ \ widget popup_widget (widget w, gravity quit); The argument specifies that the popup window should disappear as soon as the pointer leaves the widget in the direction. Horizontal and vertical menus are created using\ <\verbatim> \ \ \ \ widget horizontal_menu (); \ \ \ widget vertical_menu (); By default, they are empty. Subsequently, they can be modified as composite widgets. Canvas widgets are created using\ <\verbatim> \ \ \ \ widget canvas_widget (widget w); Canvas widget consist of a portion of the widget and scrollbars, which enable to scroll . The events\ <\verbatim> \ \ \ \ event set_scrollable (widget w); \ \ \ event set_extents \ \ \ (SI ew, SI ey); \ \ \ event set_scroll_pos (SI x, SI y); \ \ \ event get_extents \ \ \ (SI& ew, SI& eh); \ \ \ event get_visible \ \ \ (SI& x1, SI& y1, SI& x2, SI& y2); enable to change , to set the extents of , to set the scroll position, to get the extents of and to get the rectangle of , which is currently visible. Input widgets enable to type a string and to retrieve it when finished. They are created using\ <\verbatim> \ \ \ \ widget input_text_widget (command call_back); Some initial text can be put in it using\ <\verbatim> \ \ \ \ event set_input_string (string s); The command is executed when typing has been finished or aborted (by typing return, escape or ctrl-c). The typed string can then be retrieved using\ <\verbatim> \ \ \ \ event get_input_string (string& s); Usually, the returned is a string enclosed between quotes. If typing was aborted, contains the string . >