Documentation Set for Swarm 2.2
Prev | Reference VIII. Gui Library | Next

# Widget

## Name

Widget -- Widget base class.

## Description

All graphical widgets inherit from the Widget base class. Widget defines most of the behaviour needed: Widgets are created by the user with a particular parent, and then "pack"ed in order to draw them on the screen. All widgets have three essential things: a widget name used when running Tcl code, an Objective C name when sending messages from Tcl to those objects, and a parent.

## Protocols adopted by Widget

Create Drop

## Methods

### Phase: Creating

- - setWidgetNameFromParentName: (const char *)parentWidgetName
  Set the widget name using a hypothetical parent name.

- - setWidgetNameFromParent: (id <Widget>)parent
  Set the widget name using the parent as context.

- - (const char *)makeWidgetNameFor: widget
  Compute the widget name for a component widget.

- - setParent: parent
  Set the containing window of the widget.

- + createParent: parent
  When a widget is created it needs to be given a parent. The parent widget will be the widget's containing window. If no parent is given (ie, a parent of nil), then a toplevel Frame will be allocated automatically

### Phase: Using

- - (BOOL)getDestroyedFlag

- - (void)disableDestroyNotification
  Prevent calling the destroy notification method.

- - (void)enableDestroyNotification: notificationTarget notificationMethod: (SEL)destroyNotificationMethod
  Call a method if we are destroyed.

- - (void)setWindowGeometry: (const char *)s

- - (const char *)getWindowGeometry

- - (int)getY
  Get the Y position of the widget.

- - (int)getX
  Get the X position of the widget.

- - (unsigned)getWidth
  Get the widget the widget.

- - (unsigned)getHeight
  Get the height of the widget.

- - (const char *)getWidgetName
  Get the widget name.

- - getTopLevel
  Get top level frame

- - getParent
  Get the containing window of the widget.

- - (void)setWindowTitle: (const char *)title
  Set the title on the widget.

- - setX: (int)x Y: (int)y
  Set the position of the widget.

- - setWidth: (unsigned)width Height: (unsigned)height
  Set the width and height of the widget.

- - setHeight: (unsigned)height
  Set the height of the widget.

- - setWidth: (unsigned)width
  Set the width of the widget.

- - (void)setActiveFlag: (BOOL)activeFlag
  Enable or disable the widget.

- - (void)packForgetAndExpand

- - (void)packToRight: widget

- - (void)packFillLeft: (BOOL)expandFlag

- - (void)packBeforeAndFillLeft: widget expand: (BOOL)expandFlag

- - (void)packFill

- - (void)pack
  Roughly, packing a widget makes it draw on the screen. The Tk packer allows complicated options to control widget layout. See documentation on Tk to learn more about packing details.

Prev | Home | Next
VarProbeLabel | Up | WindowGeometryRecord