|
|
// ===========================================================================
// UAMDLOGUtils.h � 1997 Microsoft Corp. All rights reserved.
// ===========================================================================
#pragma once
#define textMargin 2
#define Abs(x) ((x) < 0 ? -(x) : (x))
#define HiShort(longNum) (short)(((longNum) >> 16) & 0xFFFF)
#define LoShort(longNum) (short)((longNum) & 0xFFFF)
#define Max(x, y) ((x) > (y) ? (x) : (y))
#define Min(x, y) ((x) < (y) ? (x) : (y))
#define UAM_DLOG(d) (*((UAMDialogRecP)d))
#define kMaxGatedItems 3
#define kMaxBulletItems 3
#define kPasswordBulletText '*'
//
//These item defines are needed because we can't navigate a list
//box using arrow keys because we can't call LGetSelect from a
//completion or callback routine.
//
#define DITEM_ListNavigationKey 20000
#define DITEM_ListMoveToKey 20001
#define UAMKey_Home 0x01
#define UAMKey_Enter 0x03
#define UAMKey_End 0x04
#define UAMKey_PageUp 0x0B
#define UAMKey_PageDown 0x0C
#define UAMKey_BackDel 0x08
#define UAMKey_Tab 0x09
#define UAMKey_Escape 0x1b
#define UAMKey_Left 0x1c
#define UAMKey_Right 0x1d
#define UAMKey_Up 0x1e
#define UAMKey_Down 0x1f
#define UAMKey_Return 0x0d
#define UAMKey_Space 0x20
#define UAMKey_FwdDel 0x7f
#define UAMKey_Period '.'
//
//Struct needed for maintaining gated dialog items.
//
typedef struct {
short controlID;
short textID;
short state;
}GatedItems;
//
//Struct needed to maintain bullet edit fields.
//
typedef struct {
short editID;
short maxLength;
TEHandle hTE;
}BulletEditRec;
//
//This is the main struct. It is made part of the actual dialog record and holds
//key private information for us to maintain a dialog which is capable of displaying
//several custom items such as lists, scrolling text, bullet edit fields, etc.
//
typedef struct {
//
//This is the standard dialog recrod, it must be first in our rec.
//
DialogRecord standardDialog;
//
//The following is used for scrolling text fields within a dialog.
//
Boolean hasScrollBar;
TEHandle dialogTE;
Rect dialogTERect;
ControlHandle scrollBar;
short deltaV;
short vOffset;
ControlActionUPP scrollActionProc;
//
//These are private items needed to maintain a list box in a dialog.
//
Boolean hasList;
short listID;
Boolean doubleClick;
ListHandle dialogList;
Rect listRect;
Rect dataBounds;
Point cSize;
Cell lastCell;
short listFont;
short listSize;
Boolean listHasScrollBar;
short lastKeyCode;
unsigned long lastKeyTime;
long modifiers;
//
//Fields for various other tasks with our dialog.
//
Boolean supportCmdKeys; //Support edit command keys?
ModalFilterUPP customFilter; //Custom filter provided by user
GatedItems gateItems[kMaxGatedItems]; //All gated controls
BulletEditRec bulletItems[kMaxBulletItems]; //All bullet fields
} UAMDialogRec, *UAMDialogRecP;
Rect UAM_GetScreenBounds ( void );
void UAM_DisposeDialog ( DialogPtr );
ControlHandle UAM_GetCHandle ( DialogPtr, short );
Rect UAM_GetItemRect ( DialogPtr, short );
void UAM_ToggleControl ( DialogPtr, short );
void UAM_GetText ( DialogPtr, short, Str255 * );
void UAM_SetText ( DialogPtr, short, Str255 );
void UAM_HiliteItem ( DialogPtr, short, short );
Boolean UAM_IsActive ( DialogPtr, short );
short UAM_GetCValue ( DialogPtr, short );
void UAM_SetCValue ( DialogPtr, short, short );
void UAM_PositionDialog ( ResType, short );
short UAM_GetItemType ( DialogPtr, short );
DialogPtr UAM_NewDialog ( short, Boolean );
void UAM_Update ( DialogPtr );
pascal Boolean UAM_DialogFilter ( DialogPtr, EventRecord *, short * );
void UAM_CheckGatedControls ( DialogPtr );
pascal void UAM_FrameItem ( DialogPtr, short );
Rect UAM_GetDRect ( short );
void UAM_SetupDialogUserItem ( DialogPtr, short, UserItemUPP, short );
void UAM_GateControl ( DialogPtr, short, short );
void UAM_StopGate ( DialogPtr, short );
void UAM_SetBulletItem ( D
|