World(3I)

NAME
World - control a display

SYNOPSIS
#include <InterViews/world.h>

DESCRIPTION
A world was an application's connection to a particular display. It is currently provided for backward compatibility.

PUBLIC OPERATIONS

World(

const char* classname, int& argc, char** argv

OptionDesc* = nil, PropertyData* = nil

)
    Construct the world object for a display. The world's instance name comes from the -name option if it was given; otherwise the instance name comes from the environment variable RESOURCE_NAME if it is nonnil. If the name has still not been defined, then argv[0] with all leading directories stripped is used. The following arguments are interpreted automatically and are removed from argv:

    -background	next argument sets the background color
    -bg	same as -background
    -display	next argument specifies the target workstation display
    -foreground	next argument sets the foreground color
    -fg	same as -foreground
    -fn	same as -font
    -font	next argument sets the text font
    -geometry	next argument sets the first top-level interactor's position and size
    -iconic	starts up the first top-level interactor in iconic form
    -name	next argument sets the instance name of all top-level interactors
    	that don't have their own instance names
    -reverse	swaps default foreground and background colors
    -rv	same as -reverse
    -synchronous	force synchronous operation with the window system
    -title	next argument sets the first top-level interactor's title bar name
    -xrm	next argument sets an ``attribute: value'' property
The geometry specification has the form ``=WxH+XOFF+YOFF''. A negative XOFF (YOFF) specifies the offset of the interactor's right (bottom) edge from the right (bottom) side of the screen. The constructor sets argc to the number of uninterpreted arguments that remain.

If non-nil, the OptionDesc* parameter is an array of option descriptors used to parse application-specific attributes. OptionDesc contains four fields: a name used on the command line, a path specifying the attribute, a style specifying where the value is, and a default value. Valid styles are OptionPropertyNext (use next argument as an attribute:value pair, not just the value), OptionValueNext (use next argument as value), OptionValueImplicit (use default value), OptionValueIsArg (use argument as value), and OptionValueAfter (use remainder of argument as value). If non-nil, the PropertyData* parameter is an array of structures that each contain three string fields: a path specifying the attribute, a value specifying the value, and a type specifying the type name. Attributes are entered in the following order: first any application defaults (specified by the PropertyData array), then application defaults from /usr/lib/X11/app-defaults/classname, then user defaults (usually in $HOME/.Xdefaults), and finally command-line arguments. Thus, command-line arguments override user defaults, and both override application defaults.

const char* name()
    Return the instance name associated with the world.

const char* classname()
    Return the class name associated with the world.

int argc()
    Return the number of arguments passed to the world (not counting those that were interpreted by the constructor).

char** argv()
    Return the argument vector passed to the world.

Font* font()
    Return the default font associated with the display. If a value for ``font'' is defined at the top-level of the property sheet, then it is used. Otherwise, a system default is used.

Color* foreground()
    Return the default foreground color associated with the display. If a value for ``foreground'' is defined at the top-level of the property sheet, then it is used. Otherwise, a system default is used.

Color* background()
    Return the default background color associated with the display. If a value for ``background'' is defined at the top-level of the property sheet, then it is used. Otherwise, a system default is used.

boolean shaped_windows()
    Return whether the display supports non-rectangular windows.

boolean double_buffered()
    Return whether windows on the display should by default be double-buffered.

virtual void flush()
    Repair all damaged windows on the display and then send any pending requests to the window system.

virtual void sync()
    Repair all damaged windows on the display, send any pending requests to the window system, and wait for an acknowledgement from the window system.

Coord width()
    Return the width in coordinates of the current screen associated with the display.

Coord height()
    Return the height in coordinates of the current screen associated with the display.

virtual void run()
    Read events from the display, handling them as they arrive, and stopping when quit is called.

virtual void quit()
    Terminate the run loop.

virtual boolean pending()
    Return whether any events are waiting to be read.

virtual void read(Event&)
    Read the next event from the world associated with the event.

virtual boolean read(long sec, long usec, Event&)
    Read the next event from the world associated with the event, but do not wait more than sec seconds and usec microseconds. Return whether an event was found in the given time.

virtual void unread(Event&)
    Put the event back on the input queue for the world associated with the event.

virtual void poll(Event&)
    Set the event to an artificial motion event based on the current pointer position and the state of the buttons and meta-keys. virtual void SetScreen(int s) Set the current screen to s.

static World* current()
    Return the current world. The current world is set when a world is created or an event is received for the display associated with a world.