include "wmlib.m";
wmlib:= load Wmlib Wmlib->PATH;
Resize,
Hide,
Help,
OK: con 1 << iota;
Appl: con Resize | Hide;
init: fn();
titlebar: fn(t: ref Tk->Toplevel,title: string, buts: int)
: chan of string;
titlectl: fn(t: ref Tk->Toplevel, request: string);
taskbar: fn(t: ref Tk->Toplevel, name: string)
: string;
getfilename: fn(screen: ref Draw->Screen,
parent: ref Tk->Toplevel,
title, pat, dir: string) : string;
geom: fn(t: ref Tk->Toplevel) : string;
snarfput: fn(buf: string);
snarfget: fn(): string;
Description
The Wmlib module provides routines for making and updating windows controlled by wm.
The init function must be called once to initialize the internal state of wmlib.
The titlebar function creates a collection of widgets, rooted at .Wm_t, which can be packed in the Toplevel t to create a managed title bar. The title bar consists of a label, .Wm_t.title, and the buttons specified by the bit mask buts. The .Wm_t.title label is initialized with the string title, and can be reconfigured to change the title of the window. An exit button is always created in the title bar; the buttons defined by the constants Resize, Hide, Help, and OK are optional. Most applications should use the buttons defined by the constant Appl, which is Resize|Hide.
An application is informed of Tk events by a channel that is returned by titlebar. (See Tk -graphics toolkit in Chapter 13). Messages received on it should be processed by the application. The messages that may arrive on the returned channel are:
In some cases the appropriate response is to make the received message the request argument to the titlectl function.
The titlectl function performs a variety of operations according to the string passed in argument request. The supported requests are:
The taskbar function changes the name displayed in the title bar and the window's name when it is in the task bar.
The getfilename function makes a dialog box for selecting a file. It is displayed on screen near parent. The dir argument gives the directory where the file search should begin. Only files that match pattern pat are displayed. The rules for defining match patters are described in filepat: expand, match - file pattern matching.
The returned string is the name of the selected file, or the empty string if no file was selected.
The geom function returns a string with the coordinates for a child window.
The snarfget and snarfput functions retrieve and replace the contents of the window manager's snarf buffer.
See Also
infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights
reserved.