101
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
11. Creating the User Interface
As explained in chapter
4. User Interface Overview
, the user interface consists
of windows, menus, dialog boxes, fonts, and the status line. This chapter will
present more detail on windows, menus and dialog boxes along with common
structures shared by all three of these components. The resource compiler,
which converts resource files into object code, will also be discussed. Finally, a
detailed example of an application that uses windows, menus, and dialog boxes
will be presented.
11.1. Common Screen Components
Windows, menus, and dialog boxes all use several common components. These
components include the screen region and coordinate typedefs — SCR_RECT,
SCR_COORDS; the bitmap structure — BITMAP; and the icon structure —
ICON.
11.1.1. Screen/Window Regions and Coordinates
Although windows are based on window coordinates (signed short values —
WIN_COORDS), the screen is limited to only unsigned char coordinates —
SCR_COORDS. Because of this, there are two separate structures that define a
region on the screen: SCR_RECT and WIN_RECT. A region defines a
rectangular area. The x0, y0 coordinates of a region specify the upper left
coordinates; the x1, y1 coordinates specify the lower right coordinates. The
SCR_RECT structure is based on SCR_COORDS whereas the WIN_RECT
structure is based on WIN_COORDS. While the WINDOW structure uses
SCR_RECT regions internally, all calls to window routines use window region
and coordinates.
SCREEN WINDOW
typedef unsigned char
SCR_COORDS
; typedef signed short
WIN_COORDS
;
typedef union {
struct {
SCR_COORDS x0, y0;
SCR_COORDS x1, y1;
} xy;
unsigned long l;
} SCR_RECT;
typedef struct {
WIN_COORDS x0, y0;
WIN_COORDS x1, y1;
} WIN_RECT;
Table 11.1: Screen vs. Window Coordinates