Showing changes from revision #3 to #4:
Added | Removed | Changed
Windows consist of two separate areas:
system-area | Contains the title bar, scroll bar indicators, close icon etc. |
work-area | Contains all the application-specific data to be displayed to the user |
The system-area does not normally get updated by the application, except, perhaps, the Title Bar.
The work-area is where the application will display information to the user; you can think of it as a document where the words and pictures may be displayed.
The following table shows all the important co-ordinate-systems for dealing with a work-area.
work-area dimensions | Specify the minimum and maximum x and y co-ordinates of the entire work-area. This also referred to as the ‘extent’ of the window |
work-area visiblity | Specify the width and height of the work-area visible to the user |
work-area scroll offsets | Specify the co-ordinate offsets of the horizontal and vertical scroll bars. This determines which part of the work-area is to be displayed at the top left of the visible work-area |
screen position co-ordinates | Specify where the window should be displayed on the screen using x and y co-ordinates |
Note: All co-ordinates are provided in OS graphics units.
The following snippet of code specifies the size of the work-area. It does not, however, specify the size of the work-area that is to be shown.
In this example it would produce a work-area 2000 units high and 1000 units wide. The origin of x and y co-ordinates are from the top left, hence the height is a negative number.
work_area_x_min = 0 work_area_y_min = –2000 work_area_x_max = 1000 work_area_y_max = 0
The following snippet of code specifies the size of the work-area and the size of the work-area to be shown.
In this example it would produce a work-area 2000 units high and 1000 units wide, but displaying only a 200 high by 100 wide part of it.
work_area_x_min = 0 work_area_y_min = –2000 work_area_x_max = 1000 work_area_y_max = 0 visible_area_x_min = 0 visible_area_y_min = 0 visible_area_x_max = 100 visible_area_y_max = 200
The following snippet of code specifies the size of the work-area, the size of the work-area to be shown and which part of the work-area is to be shown.
In this example it would produce a work-area 2000 units high and 1000 units wide, but displaying only a 200 high by 100 wide from the x and y offsets of 20 and 100 respectively.
work_area_x_min = 0 work_area_y_min = –2000 work_area_x_max = 1000 work_area_y_max = 0 visible_area_x_min = 0 visible_area_y_min = 0 visible_area_x_max = 100 visible_area_y_max = 200 scroll_offset_x = 20 scroll_offset_y = –100
The following snippet of code specifies the size of the work-area, the size of the work-area to be shown, which part of the work-area is to be shown and where on the screen this work-area should be displayed.
In this example it would produce a work-area 2000 units high and 1000 units wide, display only 200 high by 100 wide from the x and y offsets of 20 and 100 respectively and display it on the screen at (300, 600). Please note: that the screen co-ordinates originate from the bottom left of the screen, as opposed to the top left for windows.
work_area_x_min = 0 work_area_y_min = –2000 work_area_x_max = 1000 work_area_y_max = 0 visible_area_x_min = 0 visible_area_y_min = 0 visible_area_x_max = 100 visible_area_y_max = 200 scroll_offset_x = 20 scroll_offset_y = –100 screen_x = 300 screen_y = 600
Although at first glance, the calculations may seem daunting, they do get easier the more you use them. A rule of thumb is that work-area co-ordinate origins are the top left of a window, where as the screen co-ordinates are from the bottom left of the screen.
A number of way of retrieving windows co-ordinates exist.
Note: The co-ordinates above are only a small subset of larger set of data required to create a window as per SWIs such as Wimp_CreateWindow.
Windows are able to overlap other windows, and in order to keep track of the order of overlapping windows, the wimp also maintains ‘depth’. This is called the window stack. The window at at the top of the stack is deemed to be the forefront window on the screen.
A window can change its window stack position by user intervention such as clicking on the Title Bar or the Back icon within the system area of a window.
A window can determine its own window stack value by specifying which window that it must appear behind. Another option is simply stating whether it should be ‘top’ or ‘bottom’ in the stack.
Many attributes of a window are defined by setting a series of flags in the window block; can it be moved, does it has a Title Bar, does it ignore mouse clicks etc? There are many other settings that can be changed in addition to these to provide a comprehensive set of window configurations.
In addition to the window definition, any initial icons belonging to a window are also defined.
For a complete view of a window’s Flags and all associated data, see Wimp_CreateWindow.