windows-nt/Source/XPSP1/NT/net/sfm/uam/uam5src/uamsrc/uamdlogutils.c

1 line
21 KiB
C
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
// =========================================================================== // UAMDLOGUtils.c <09> 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" // --------------------------------------------------------------------------- // <09> 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); } // --------------------------------------------------------------------------- // <09> UAM_GetCHandle() // --------------------------------------------------------------------------- ControlHandle UAM_GetCHandle(DialogPtr inDialog, short item) { short itype; Rect irect; Handle ihan; GetDialogItem(inDialog, item, &itype, &ihan, &irect); return((ControlHandle)ihan); } // --------------------------------------------------------------------------- // <09> UAM_GetItemRect() // --------------------------------------------------------------------------- Rect UAM_GetItemRect(DialogPtr inDialog, short item) { short itype; Rect irect; Handle ihan; GetDialogItem(inDialog, item, &itype, &ihan, &irect); return(irect); } // --------------------------------------------------------------------------- // <09> UAM_ToggleControl() // --------------------------------------------------------------------------- void UAM_ToggleControl(DialogPtr inDialog, short item) { UAM_SetCValue(inDialog, item, UAM_GetCValue(inDialog, item) == 0); } // --------------------------------------------------------------------------- // <09> 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); } // --------------------------------------------------------------------------- // <09> 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); } // --------------------------------------------------------------------------- // <09> 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); } // --------------------------------------------------------------------------- // <09> UAM_IsActive() // --------------------------------------------------------------------------- Boolean UAM_IsActive(DialogPtr inDialog, short item) { ControlHandle theHandle; theHandle = UAM_GetCHandle(inDialog, item); if (theHandle) { return(((*theHandle)->contrlHilite != 255)); } return(false); } // --------------------------------------------------------------------------- // <09> UAM_GetCValue() // --------------------------------------------------------------------------- short UAM_GetCValue(DialogPtr