
372 Chapter 15: Creating a Custom iTool Widget Interface
Example: a Custom iTool Interface iTool Developer’s Guide
; iTool menubars are created using the CW_ITMENU compound
; widget. The following statements create the standard iTool
; menus, pointing at the standard iTool operations containers.
; Note that if the iTool to which this user interface is applied
; has registered new operations in these containers, those
; operations will show up automatically. Similarly, if the
; iTool has unregistered any operations in these containers,
; the operations will not appear. Our example tool unregisters
; several of the standard iTool menu items -- see the
; 'example2tool__define.pro' file for examples. Note that we
; don't want the standard Help menu in our example interface,
; so we don't include it here.
wFile = CW_ITMENU(wMenubar, oUI, 'Operations/File')
wEdit = CW_ITMENU(wMenubar, oUI, 'Operations/Edit')
wInsert = CW_ITMENU(wMenubar, oUI, 'Operations/Insert')
wOperations = CW_ITMENU(wMenubar, oUI, 'Operations/Operations')
wWindow = CW_ITMENU(wMenubar, oUI, 'Operations/Window')
; You can create additional (non-iTool) menus in the
; traditional way. The following lines would create an
; additional menu with two menu items. Note that you
; must explicitly handle events from non-iTool menus
; in your event handler.
;
; newMenu = WIDGET_BUTTON(wMenubar, VALUE='New Menu')
; newMenu1 = WIDGET_BUTTON(newMenu, VALUE='one')
; newMenu2 = WIDGET_BUTTON(newMenu, VALUE='two')
; Toolbars:
; iTool toolbars are created using the CW_ITTOOLBAR compound
; widget. The following statements create the standard iTool
; toolbars. Note that if the iTool to which this user interface
; is applied has registered new operations or manipulators in
; the referenced containers, those operations or manipulators
; will show up automatically. Similarly, if the iTool has
; unregistered any items in these containers, the items will
; not appear. Our example tool uses the standard operations
; and manipulators, but only displays three of the six standard
; toolbars.
wToolbar = WIDGET_BASE(wBase, /ROW, XPAD = 0, YPAD = 0, $
SPACE = 7)
wTool2 = CW_ITTOOLBAR(wToolbar, oUI, 'Toolbar/Edit')
wTool3 = CW_ITTOOLBAR(wToolbar, oUI, 'Manipulators', $
/EXCLUSIVE)
wTool6=CW_ITTOOLBAR(wToolbar, oUI, 'Manipulators/Annotation', $
/EXCLUSIVE)
; Widget Layout
; This section lays out the main portion of the widget