Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ resize(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtConfigureWidget(1)

Core(3)

 

Name

resize — Core method called when a widget is resized. 

Synopsis

typedef void (∗XtWidgetProc)(Widget);

    Widget w;

Arguments

wSpecifies the widget. 

Description

The resize method recalculates the layout of graphics or of child widgets, modifying internal data as needed.  The x, y, width, height and border_width fields of the widget contain the new values. 

If a widget always draws itself according to the size placed in the Core height and width instance variables, it does not need a resize method.  If this is the case, the widget can specify NULL for the resize field in its class record. 

Other widgets, however, need to know when they have changed size so that they can change the layout of their displayed data to match the new size.  (For example, a widget may choose a new smaller font if its size has decreased.) 

The widget must treat resize as a command, not as a request.  A widget must neither resize itself larger from its resize method, nor appeal by issuing an XtMakeGeometryRequest or XtMakeResizeRequest. 

When a parent widget is resized, it should reconfigure its children.  When a parent resizes a child, it updates the geometry fields in the widget, configures the window if the widget is realized, and calls the child’s resize method to notify the child. 

Examples

The following is the resize method of the BitmapEdit widget class:

/∗ ARGSUSED ∗/
static void
Resize(w)
Widget w;
{
    BitmapEditWidget cw = (BitmapEditWidget) w;
    /∗ resize does nothing unless new size is bigger than entire pixmap ∗/
    if ((cw->core.width > cw->bitmapEdit.pixmap_width_in_pixels) &&
            (cw->core.height > cw->bitmapEdit.pixmap_height_in_pixels)) {
        /∗
         ∗ Calculate the maximum cell size that will allow the
         ∗ entire bitmap to be displayed.
         ∗/
        Dimension w_temp_cell_size_in_pixels, h_temp_cell_size_in_pixels;
        Dimension new_cell_size_in_pixels;
         w_temp_cell_size_in_pixels = cw->core.width /
                cw->bitmapEdit.pixmap_width_in_cells;
        h_temp_cell_size_in_pixels = cw->core.height /
                cw->bitmapEdit.pixmap_height_in_cells;
         if (w_temp_cell_size_in_pixels < h_temp_cell_size_in_pixels)
            new_cell_size_in_pixels = w_temp_cell_size_in_pixels;
        else
            new_cell_size_in_pixels = h_temp_cell_size_in_pixels;
         /∗ if size change mandates a new pixmap, make one ∗/
        if (new_cell_size_in_pixels != cw->bitmapEdit.cell_size_in_pixels)
            ChangeCellSize(cw, new_cell_size_in_pixels);
    }
}

See Also

XtConfigureWidget(1),
Core(3). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026