Managing UI Geometry: 3 Positioning and Sizing Windows

Up: GEOS SDK TechDocs | Up | Down | Prev: 2 Arranging Your Generic Objects | Next: 3.1 Window Positioning

A generic object that appears as a window, such as an independently-displayable GenInteraction or a GenPrimary, has special needs for positioning and sizing itself, especially when appearing initially. Specific user interfaces may differ in how windows appear on the screen. In Motif, for instance, windows initially appear in one of several staggered positions. Primary and display objects extend by default to the right edge of the screen and to the top edge of the icon area at the bottom of the screen. Other windows are usually only as large as required by their children.

The SpecSizeWinPair structure is often used when specifying window sizes and positions. There are several hints which signal that a window should be positioned or sized depending on the position or size of another window, the size of the screen, or other conditions. The SpecSizeWinSpec structure allows you to specify an offset from another window, either by a number of points (remember that there are 72 points per inch), or by means of a ratio.

typedef struct {
	SpecWinSizeSpec			SWSP_x;
	SpecWinSizeSpec			SWSP_y;
} SpecWinSizePair;
typedef WordFlags SpecWinSizeSpec;
#define SWSS_RATIO 				0x8000
#define SWSS_SIGN 				0x4000
#define SWSS_MANTISSA 				0x3c00
#define SWSS_FRACTION 				0x03ff

The SpecSizeWinPair structure allows you to set up separate parameters for the x and y coordinates. For each coordinate, use the SWSS_RATIO flag to signal whether you are giving coordinates by means of a ratio instead of a constant. If you are using a ratio, use the SWSS_FRACTION, SWSS_MANTISSA, and SWSS_SIGN fields to specify the value of the ratio or use one of the following pre-defined constants to specify a ratio between zero and one:

#define PCT_0			0x000
#define PCT_5			0x033
#define PCT_10			0x066
#define PCT_15			0x099
#define PCT_20 			0x0cc
#define PCT_25 			0x100
#define PCT_30 			0x133
#define PCT_35 			0x166
#define PCT_40 			0x199
#define PCT_45 			0x1cc
#define PCT_50 			0x200
#define PCT_55 			0x233
#define PCT_60 			0x266
#define PCT_65 			0x299
#define PCT_70 			0x2cc
#define PCT_75 			0x300
#define PCT_80 			0x333
#define PCT_85 			0x366
#define PCT_90 			0x399
#define PCT_95 			0x3cc
#define PCT_100			0x3ff

To specify a constant offset, just use that offset, not setting the SWSS_RATIO flag. Not all windows will use the SpecWinSizePair structure.


Up: GEOS SDK TechDocs | Up | Down | Prev: 2 Arranging Your Generic Objects | Next: 3.1 Window Positioning