A SERVICE OF

logo

364 Chapter 15: Creating a Custom iTool Widget Interface
Example: a Custom iTool Interface iTool Developer’s Guide
THEN BEGIN
CW_ITWINDOW_RESIZE, (*pState).wDraw, newVisW, newVisH
ENDIF
; Update the width of the toolbar base.
WIDGET_CONTROL, (*pState).wToolbar, $
SCR_XSIZE = toolbarGeom.scr_xsize+deltaW
; Update the status bar to be the same width as the toolbar.
CW_ITSTATUSBAR_RESIZE, (*pState).wStatus, $
toolbarGeom.scr_xsize+deltaW
; Turn UPDATE back on if we turned it off.
IF (isUpdate && ~WIDGET_INFO((*pState).wBase, /UPDATE)) THEN $
WIDGET_CONTROL, (*pState).wBase, /UPDATE
; Retrieve and store the new top-level base size.
IF (WIDGET_INFO((*pState).wBase, /REALIZED)) THEN BEGIN
WIDGET_CONTROL, (*pState).wBase, TLB_GET_SIZE = basesize
(*pState).basesize = basesize
ENDIF
END
Discussion
Our code resizes only three widgets when the size of the top-level base changes: the
iTool window, the toolbar, and the status bar. The toolbar and status bar are resized to
fit the new width of the top-level base, and the iTool window is made larger or
smaller by the same amount as the top-level base. This preserves the overall
arrangement of the interface elements, and does not change the width of the left-hand
base, which holds the “custom” interface elements.
Note the handling of the UPDATE keyword. This is necessary because UNIX and
Microsoft Windows behave differently as the top-level base is being resized.
Note also that we use the CW_ITWINDOW_RESIZE and
CW_ITSTATUSBAR_RESIZE procedures to resize the iTool window and status bar
widgets. These routines handle the details of internal resizing of the compound
widgets, and perform other necessary adjustments. The width of the toolbar is resized
in a more traditional way, by setting the SCR_XSIZE on the base widget that holds
the individual toolbars.
Finally, we store the new size of the top-level base in the basesize field of the widget
interface’s state structure. Storing this value in the state structure allows us to
calculate the change in size of the top-level base in when the WIDGET_BASE event
arrives in our event-handler routine.