!MultiPane has a single window that is opened when SELECT is clicked with the mouse pointer over the !MultiPane icon on the icon bar. The window is called main and is defined in the Templates file. The main window, info box and a standard bar menu (consisting of the three standard items of Info, Help and Quit) are loaded and created automatically.
The application opens the main window in the centre of the screen. The window has three pane windows attached to it. The windows and panes are defined in a templates file.
This example shows that it is easy with DrwimpC to implement one or more toolbars or similar panes attached to a window. All that is required is to open the panes when the main window is opened - i.e. when an open window event is received for the window and drw_u_openwindow is called, and open them in a predetermined window stack order, relative to each other and the main window, with the bottom most pane being linked with the main window when the DrWimpC C library inquires if the window has any panes by calling drw_u_pane. Finally, the panes should be closed when the main window is closed.
This function loads the panes from the templates file, storing their handles in the pane handles for use in drwUopenW. The function used to load the windows is drw_wimp_loadwindow() which equivalent to the BASIC DrWimp function of the same name.
void drw_u_openwindow(wimp_w whan, int x, int y, wimp_w stack)
This function is called whenever the DrwimpC C library receives a window open event for a window in your application. In this example, when it is the bar window, its panes must also be opened in their correct positions, visibly and with regard to the stack, relatiive to the bar window and each other. The stack order chosen is for pane3 to be the top pane, then pane2, then pane1. Finally the bar window is opened behind pane1. The input stack value is the window that the bar window would have been opened behind if there were no panes present, so pane3 is opened behind that window. The x and y parameters represent the top left point of the bar window visible area. So, pane3 is opened on the left edge of the bar window with its right edge adjacent to the left edge of the bar window. pane1 is opened with its top left visible point coincident with the top leftvisible edge of the bar window, and pane2 is opened underneath the visible area of the bar window.
This function is called whenever the DrwimpC C library receives a window open event for a window in your application to request the bottom most pane for the window whose handle is passed o the funciton in the whan parameter. It is important to return the correct pane handle in order for the panes to be opened correctly, and in their correct positions relative to each other, and the main window (whan). The bottom most pane is the one which is opened at the bottom most stack position of the panes as opened in drw_u_openwindow.
This function is called when the DrWimpC library receives a close window event for a window in your application so you can take any action consequent to the closing of the window. You don't need to close the window itself. In this example, when the window is the bar window, a flag indicating that the window is open is unset, and each pane associated with the window is closed.