|
|
// ===========================================================================
// UAMDLOGUtils.c � 1997 Microsoft Corp. All rights reserved.
// ===========================================================================
// General dialog utilities used by the Microsoft User Authentication Method.
//
// ===========================================================================
#include <Dialogs.h>
#include <Events.h>
#include <Controls.h>
#include <Sound.h>
#include <ControlDefinitions.h>
#include <ctype.h>
#include "UAMUtils.h"
#include "UAMListBox.h"
#include "UAMDLOGText.h"
#include "UAMDLOGUtils.h"
#include "UAMDebug.h"
// ---------------------------------------------------------------------------
// � UAM_GetScreenBounds()
// ---------------------------------------------------------------------------
Rect UAM_GetScreenBounds()
{
GrafPtr savePort,p;
Rect screenBounds;
GetPort(&savePort);
p = (GrafPtr)NewPtr(sizeof(GrafPort));
OpenPort(p);
screenBounds = p->portBits.bounds;
ClosePort(p);
DisposePtr((Ptr)p);
return(screenBounds);
}
// ---------------------------------------------------------------------------
// � UAM_GetCHandle()
// ---------------------------------------------------------------------------
ControlHandle UAM_GetCHandle(DialogPtr inDialog, short item)
{
short itype;
Rect irect;
Handle ihan;
GetDialogItem(inDialog, item, &itype, &ihan, &irect);
return((ControlHandle)ihan);
}
// ---------------------------------------------------------------------------
// � UAM_GetItemRect()
// ---------------------------------------------------------------------------
Rect UAM_GetItemRect(DialogPtr inDialog, short item)
{
short itype;
Rect irect;
Handle ihan;
GetDialogItem(inDialog, item, &itype, &ihan, &irect);
return(irect);
}
// ---------------------------------------------------------------------------
// � UAM_ToggleControl()
// ---------------------------------------------------------------------------
void UAM_ToggleControl(DialogPtr inDialog, short item)
{
UAM_SetCValue(inDialog, item, UAM_GetCValue(inDialog, item) == 0);
}
// ---------------------------------------------------------------------------
// � UAM_GetText()
// ---------------------------------------------------------------------------
void UAM_GetText(DialogPtr inDialog, short item, Str255 *theText)
{
short itype;
Handle ihan;
Rect irect;
GetDialogItem(inDialog, item, &itype, &ihan, &irect);
if ((itype == editText)||(itype == editText + itemDisable))
GetDialogItemText(ihan, *theText);
}
// ---------------------------------------------------------------------------
// � UAM_SetText()
// ---------------------------------------------------------------------------
void UAM_SetText(DialogPtr inDialog, short item, Str255 theText)
{
short itype;
Handle ihan;
Rect irect;
GetDialogItem(inDialog, item, &itype, &ihan, &irect);
if ((itype == editText)
||(itype == editText+itemDisable)
||(itype == statText)
||(itype == statText+itemDisable))
SetDialogItemText(ihan, theText);
}
// ---------------------------------------------------------------------------
// � UAM_HiliteItem()
// ---------------------------------------------------------------------------
void UAM_HiliteItem(DialogPtr inDialog, short item, short value)
{
short itype;
Handle ihan;
Rect irect;
GetDialogItem(inDialog, item, &itype, &ihan, &irect);
HiliteControl((ControlHandle)ihan, value);
}
// ---------------------------------------------------------------------------
// � UAM_IsActive()
// ---------------------------------------------------------------------------
Boolean UAM_IsActive(DialogPtr inDialog, short item)
{
ControlHandle theHandle;
theHandle = UAM_GetCHandle(inDialog, item);
if (theHandle)
{
return(((*theHandle)->contrlHilite != 255));
}
return(false);
}
// ---------------------------------------------------------------------------
// � UAM_GetCValue()
// ---------------------------------------------------------------------------
short UAM_GetCValue(DialogPtr
|