|
|
// ===========================================================================
// UAMDLOGUtils.c � 1997-2001 Microsoft Corp. All rights reserved.
// ===========================================================================
// General dialog utilities used by the Microsoft User Authentication Method.
//
// ===========================================================================
#include <Carbon/Carbon.h>
#include <ctype.h>
#include "UAMUtils.h"
#include "UAMDLOGUtils.h"
#include "UAMDebug.h"
// ---------------------------------------------------------------------------
// � UAM_MakeEditItemFocus()
// ---------------------------------------------------------------------------
void UAM_MakeEditItemFocus(DialogRef inDialog, SInt16 inEditItem)
{
OSErr theError;
ControlRef theControl = NULL;
theError = GetDialogItemAsControl(inDialog, inEditItem, &theControl);
if (theError == noErr)
{
SetKeyboardFocus(GetDialogWindow(inDialog), theControl, kControlEditTextPart);
}
}
// ---------------------------------------------------------------------------
// � UAM_GetDialogItemRect()
// ---------------------------------------------------------------------------
Rect UAM_GetDialogItemRect(DialogRef inDialog, SInt16 inItem)
{
SInt16 itype;
Rect irect;
Handle ihan;
GetDialogItem(inDialog, inItem, &itype, &ihan, &irect);
return(irect);
}
// ---------------------------------------------------------------------------
// � UAM_ToggleControl()
// ---------------------------------------------------------------------------
void UAM_ToggleDialogControl(DialogRef inDialog, SInt16 inItem)
{
OSErr theError;
ControlRef theControl = NULL;
theError = GetDialogItemAsControl(inDialog, inItem, &theControl);
if (theError == noErr)
{
SetControlValue(
theControl,
(SInt16)GetControlValue(theControl) == 0);
}
}
// ---------------------------------------------------------------------------
// � UAM_GetDialogEditText()
// ---------------------------------------------------------------------------
void UAM_GetDialogEditText(DialogRef inDialog, short item, Str255 theText)
{
OSErr theError;
Size theActualLength;
ControlRef theControl = NULL;
theError = GetDialogItemAsControl(inDialog, item, &theControl);
if (theError == noErr)
{
GetControlData(
theControl,
kControlNoPart,
kControlEditTextTextTag,
sizeof(Str255),
(char*)&theText[1],
&theActualLength);
theText[0] = (UInt8)theActualLength;
}
}
// ---------------------------------------------------------------------------
// � UAM_SetDialogEditText()
// ---------------------------------------------------------------------------
void UAM_SetDialogEditText(DialogRef inDialog, short item, Str255 theText)
{
OSErr theError;
ControlRef theControl = NULL;
theError = GetDialogItemAsControl(inDialog, item, &theControl);
if (theError == noErr)
{
SetControlData(
theControl,
kControlEditTextPart,
kControlStaticTextTextTag,
theText[0],
(void*)&theText[1]);
}
}
// ---------------------------------------------------------------------------
// � UAM_HiliteDialogControlItem()
// ---------------------------------------------------------------------------
void UAM_HiliteDialogControlItem(DialogRef inDialog, SInt16 inItem, SInt16 inValue)
{
OSErr theError;
ControlRef theControl = NULL;
theError = GetDialogItemAsControl(inDialog, inItem, &theControl);
if (theError == noErr)
{
HiliteControl(theControl, inValue);
}
}
// ---------------------------------------------------------------------------
// � UAM_IsDialogControlActive()
// ---------------------------------------------------------------------------
Boolean UAM_IsDialogControlActive(DialogRef inDialo
|