[Top] [Prev] [Next]


Wmlib - window manager toolkit


include	 "wmlib.m";
wmlib:= load Wmlib Wmlib->PATH;
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;


The Wmlib module provides routines for making and updating windows controlled by wm.

init ( )

The init function must be called once to initialize the internal state of wmlib.

titlebar (t, title, buts)

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.

A channel is returned by titlebar by which the application is informed of Tk events (See tk). Messages received on it should be processed by the application. The messages that may arrive on the returned channel are:

The Exit button was activated. The window should be closed.


The OK button was activated. The window should be closed.


The Help button was activated.


The Hide button was activated. The window can be 'hidden' by sending a "task" request via the titlectl function.


The Resize button was pressed.

In some cases the appropriate response is make the received message

the request argument to the titlectl function.

titlectl (t, request)

The titlectl function performs a variety of operations according to the string passed in argument request. The supported requests are:
"move" and "size"

The titlectl function communicates with wm to obtain new position (size) parameters and relays the new configuration to Tk.


The titlectl function terminates the current process and all members of its process group.


The titlectl function unmaps the Toplevel, make an entry in the task bar, and suspend the current process. Later, selecting the task bar entry will remap the Toplevel and allow the process to resume.

taskbar (t, name)

The taskbar function changes the name displayed in the title bar and the window's name when it is in the task bar.

getfilename (screen, parent, title, pat, dir)

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 on lib-filepat.

The returned string is the name of the selected file, or the empty string if no file was selected.

geom (t)

The geom function returns a string with the coordinates for a child window.

snarfget ( ) and snarfput (buf)

The snarfget and snarfput functions retrieve and replace the contents of the window manager's snarf buffer.


Interface with wm for the titlectl function's handling of "move" and "size" requests.


Interface with wm for the snarfget and snarfput functions.

See Also

context, tk, and tklib

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.