[Top] [Prev] [Next]

wmlib - window manager toolkit

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.

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.

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:
exit

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

ok

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

help

The Help button was activated.

task

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

size

The Resize button was pressed.

In some cases the appropriate response is to 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.

exit

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

task

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 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.

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.

Files
/chan/wm

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

/chan/snarf

Interface with wm for the snarfget and snarfput functions.

See Also
context - graphics environment in Chapter 11

Tk -graphics toolkit in Chapter 13

tklib: tkquote, is_err, tkcmds, dialog, getstring, notice, mktabs, tabsctl - Tk user interface functions in Chapter 13



[Top] [Prev] [Next]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.