Window Styles

A window can have a combination of styles; an application can combine styles by using the bitwise inclusive OR operator. An application usually sets the window styles when it creates the window. The OS/2 operating system provides several standard window styles that apply to all windows. It also provides many styles for the predefined frame and control windows. The frame and control styles are unique to each predefined window class and can be used only for windows of the corresponding class.

Initially, the styles of the window class used to create the window determine the styles of the new window. For example, if the window class has the style CS_SYNCPAINT, all windows created using that class, by default, will have the window style WS_SYNCPAINT. The OS/2 operating system has the following standard window styles:

┌─────────────────────────┬─────────────────────────────────────────────┐
│Style Name               │Description                                  │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_CLIPCHILDREN          │Prevents a window from painting over its     │
│                         │child windows. This style increases the time │
│                         │necessary to calculate the visible region.   │
│                         │This style is usually not necessary because  │
│                         │if the parent and child windows overlap and  │
│                         │both are invalidated, the system draws the   │
│                         │parent window before drawing the child       │
│                         │window. If the child window is invalidated   │
│                         │independently of the parent window, the      │
│                         │system redraws only the child window. If the │
│                         │update region of the parent window does not  │
│                         │intersect the child window, drawing the      │
│                         │parent window causes the child window to be  │
│                         │redrawn. This style is useful to prevent a   │
│                         │child window that contains a complex graphic │
│                         │from being redrawn unnecessarily.            │
│                         │WS_CLIPCHILDREN is an absolute requirement if│
│                         │a window with children ever performs output  │
│                         │in response to any message other than        │
│                         │WM_PAINT. Only WM_PAINT processing is        │
│                         │synchronized such that the children will get │
│                         │their messages after the parent.             │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_CLIPSIBLINGS          │Prevents a window from painting over its     │
│                         │sibling windows. This style protects sibling │
│                         │windows but increases the time necessary to  │
│                         │calculate the visible region. This style is  │
│                         │appropriate for windows that overlap and that│
│                         │have the same parent window.                 │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_DISABLED              │Used by an application to disable a window.  │
│                         │It is up to the window to recognize this     │
│                         │style and reject input.                      │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_GROUP                 │Specifies the first control of a group of    │
│                         │controls in which the user can move from one │
│                         │control to the next by using the ARROW keys. │
│                         │All controls defined after the control with  │
│                         │the WS_GROUP style belong to the same group. │
│                         │The next control with the WS_GROUP style ends│
│                         │the first group and starts a new group.      │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_MAXIMIZED             │Enlarges a window to the maximum size.       │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_MINIMIZED             │Reduces a window to the size of an icon.     │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_PARENTCLIP            │Extends a window's visible region to include │
│                         │that of its parent window. This style        │
│                         │simplifies the calculation of the child      │
│                         │window's visible region but is potentially   │
│                         │dangerous because the parent window's visible│
│                         │region is usually larger than the child      │
│                         │window.                                      │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_SAVEBITS              │Saves the screen area under a window as a bit│
│                         │map. When the user hides or moves the window,│
│                         │the system restores the image by copying the │
│                         │bits; there is no need to add the area to the│
│                         │uncovered window's update region. The style  │
│                         │can improve system performance but also can  │
│                         │consume a great deal of memory. It is        │
│                         │recommended only for transient windows, such │
│                         │as menus and dialog windows, not for main    │
│                         │application windows.                         │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_SYNCPAINT             │Causes a window to receive WM_PAINT messages │
│                         │immediately after a part of the window       │
│                         │becomes invalid. Without this style, the     │
│                         │window receives WM_PAINT messages only if no │
│                         │other message is waiting to be processed.    │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_TABSTOP               │Specifies one of any number of controls      │
│                         │through which the user can move by tabbing.  │
│                         │Pressing the TAB key moves the keyboard focus│
│                         │to the next control that has the WS_TABSTOP  │
│                         │style.                                       │
├─────────────────────────┼─────────────────────────────────────────────┤
│WS_VISIBLE               │Makes a window visible. The operating system │
│                         │draws the window on the screen unless        │
│                         │overlapping windows completely obscure it.   │
│                         │Windows without this style are hidden. If    │
│                         │overlapping windows completely obscure the   │
│                         │window, the window is still considered       │
│                         │visible.  (Visibility means that the         │
│                         │operating system draws the window if it can.)│
└─────────────────────────┴─────────────────────────────────────────────┘


[Back: Private Window Classes]
[Next: Window Handles]