RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

WindowManager Layout Of Windows

WindowManager
» Technical Details
» Layout of Windows

Coordinate System

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.

Work-area

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.

Work-area Example 1

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

Work area Example 2

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

Work area Example 3

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

Work area Example 4

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

Co-ordinate Calculations

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.

  • They may be made available via the Wimp_Poll routine
  • They can be retrieved by calling one of numerous Wimp SWIs such as Wimp_GetWindowState

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.

Window Stacks

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.

Window Flags

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.

Revised on December 4, 2013 13:31:05 by Jeffrey Lee (213) (195.72.173.131)
Edit | Back in time (3 revisions) | See changes | History | Views: Print | Source | Linked from: WindowManager Technical Details

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys