The ICoordinateSystem class maintains the settings information used to implement window coordinate mapping between the application coordinate system and the coordinate system used by the underlying GUI. Window coordinate mapping is needed because GUIs vary in their definition of the origin point of window coordinates. For example, Presentation Manager defines the 0,0 point of the screen to be the lower-left corner, and positive changes in the Y-coordinate move up the screen. Conversely, Motif and Windows define the 0,0 point to be the upper-left corner of the screen, and positive changes in the Y-coordinate move down the screen.
This class is used extensively by the Open Class Library implementation to map the coordinates used in an application to those required by the GUI toolkit. If you are writing application code that does not use native system calls, your primary use of this class will be to use ICoordinateSystem::setApplicationOrientation to specify your application's coordinate system. If you do not call this function, the default value of originUpperLeft is used.
If you are extending the library by writing classes for custom controls or providing other reusable classes based on Open Class Library, then consider using this class to provide coordinate-mapping for your users. Coordinate conversion is needed when you make calls to system routines that accept points or rectangles. You also may need it if you rely on a specific orientation to perform layout of windows or graphics.
Conversion is the process of mapping a point or rectangle expressed in one orientation to one expressed in another orientation. To perform the conversion, a reference size is required. The reference size is the size of the coordinate space in which the point or rectangle to be converted is expressed. For example, the reference size of a top-level window positioned with respect to the screen size would be the screen size.
![]() |
Converts a point or rectangle from the native coordinate orientation to the application orientation.
public:
static IRectangle convertToApplication( const IRectangle& nativeRectangle, const ISize& referenceSize )
Returns a rectangle in application coordinates. The rectangle is computed from a rectangle expressed in native orientation and a reference size. referenceSize should be the size of the coordinate space in which the native point coordinate is expressed.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
static IPoint convertToApplication( const IPoint& nativePoint, const ISize& referenceSize )
Returns a point in application coordinates. The point is computed from a point expressed in native orientation and a reference size. referenceSize should be the size of the coordinate space in which the native point coordinate is expressed.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Converts a point or rectangle from the application coordinate orientation to the native orientation.
public:
static IRectangle convertToNative( const IRectangle& applicationRectangle, const ISize& referenceSize )
Returns a rectangle in native coordinates. The rectangle is computed from a rectangle expressed in application orientation and a reference size. referenceSize should be the size of the coordinate space in which the application point is expressed.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
static IPoint convertToNative( const IPoint& applicationPoint, const ISize& referenceSize )
Returns a point in native coordinates. The point is computed from a point expressed in application orientation and a reference size. referenceSize should be the size of the coordinate space in which the application point is expressed.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static bool isConversionNeeded()
Returns true if the native and application orientations are different. Otherwise, false is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
The orientation describes the reference point (0,0) used when a location in a window or screen is described.
![]() |
public:
static EOrientation applicationOrientation()
Returns the currently set orientation to be used by the Open Class Library interface. Unless otherwise noted, all IRectangle and IPoint objects passed across the Open Class Library interface are in this orientation. The default application orientation is originUpperLeft.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static EOrientation nativeOrientation()
Returns the orientation that is used natively on the current platform.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
This function returns originLowerLeft.
This function returns originUpperLeft.
![]() |
public:
static EOrientation setApplicationOrientation( EOrientation coordsystem = kOriginUpperLeft )
Sets the orientation to be used for the Open Class Library interface.
If you want to change this value, you must
call this function before any
IWindow
objects are created.
Note:
This function does not affect the processing of dialog templates loaded from resource files. The coordinates in resource files are always interpreted in native system coordinates when the dialog is being loaded.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
enum EOrientation { kOriginUpperLeft, kOriginLowerLeft, originUpperLeft=kOriginUpperLeft, originLowerLeft=kOriginLowerLeft }
EOrientation is an enumeration describing the coordinate systems supported by Open Class Library. The kOriginUpperLeft orientation has the origin located in the upper-left corner of the reference coordinate space. This is the orientation used by the native Windows and Motif toolkits. The kOriginLowerLeft orientation has the origin located in the lower-left corner of the reference coordinate space. This is the coordinate system used by the Presentation Manager in OS/2.
originUpperLeft and originLowerLeft, which were used in prior releases of the Open Class Library are mapped to kOriginUpperLeft and kOriginLowerLeft, respectively, to maintain backward compatability.
Windows | OS/2 | AIX |
Yes | Yes | Yes |