Package Name: controls
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Types; use Types;
with Quickdraw; use Quickdraw;
with Menus; use Menus;
package Controls is
--
-- File: Controls.h
--
-- Contains: Control Manager interfaces
--
-- Version: Technology: System 7.5
-- Package: Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
--
-- Copyright: © 1984-1995 by Apple Computer, Inc.
-- All rights reserved.
--
STRICT_CONTROLS : constant := 0;
pushButProc : constant SInt16 := 0;
checkBoxProc : constant SInt16 := 1;
radioButProc : constant SInt16 := 2;
scrollBarProc : constant SInt16 := 16;
popupMenuProc : constant SInt16 := 1008;
subtype ControlPartCode is SInt16;
kControlNoPart : constant SInt16 := 0;
kControlLabelPart : constant SInt16 := 1;
kControlMenuPart : constant SInt16 := 2;
kControlTrianglePart : constant SInt16 := 4;
kControlButtonPart : constant SInt16 := 10;
kControlCheckBoxPart : constant SInt16 := 11;
kControlRadioButtonPart : constant SInt16 := 11;
kControlUpButtonPart : constant SInt16 := 20;
kControlDownButtonPart : constant SInt16 := 21;
kControlPageUpPart : constant SInt16 := 22;
kControlPageDownPart : constant SInt16 := 23;
kControlIndicatorPart : constant SInt16 := 129;
kControlDisabledPart : constant SInt16 := 254;
kControlInactivePart : constant SInt16 := 255;
kControlCheckboxUncheckedValue : constant SInt16 := 0;
kControlCheckboxCheckedValue : constant SInt16 := 1;
kControlCheckboxMixedValue : constant SInt16 := 2;
kControlRadioButtonUncheckedValue : constant SInt16 := 0;
kControlRadioButtonCheckedValue : constant SInt16 := 1;
kControlRadioButtonMixedValue : constant SInt16 := 2;
-- Variant codes for the System 7 pop-up menu
popupFixedWidth : constant UInt16 := 16#0001#;
popupVariableWidth : constant UInt16 := 16#0002#;
popupUseAddResMenu : constant UInt16 := 16#0004#;
popupUseWFont : constant UInt16 := 16#0008#;
-- Menu label styles for the System 7 pop-up menu
popupTitleBold : constant UInt16 := 16#0100#;
popupTitleItalic : constant UInt16 := 16#0200#;
popupTitleUnderline : constant UInt16 := 16#0400#;
popupTitleOutline : constant UInt16 := 16#0800#;
popupTitleShadow : constant UInt16 := 16#1000#;
popupTitleCondense : constant UInt16 := 16#2000#;
popupTitleExtend : constant UInt16 := 16#4000#;
popupTitleNoStyle : constant UInt16 := 16#8000#;
-- Menu label justifications for the System 7 pop-up menu
popupTitleLeftJust : constant UInt32 := 16#00000000#;
popupTitleCenterJust : constant UInt32 := 16#00000001#;
popupTitleRightJust : constant UInt32 := 16#000000FF#;
-- For DragGrayRgnUPP used in TrackControl()
noConstraint : constant := 0;
hAxisOnly : constant := 1;
vAxisOnly : constant := 2;
type ControlRecord;
type ControlPtr is Access ControlRecord;
type ControlHandle is Access ControlPtr;
subtype ControlRef is ControlHandle;
subtype ControlActionUPP is UniversalProcPtr;
type ControlRecord is
record
nextControl : ControlRef;
contrlOwner : WindowRef;
contrlRect : Rect;
contrlVis : UInt8;
contrlHilite : UInt8;
contrlValue : SInt16;
contrlMin : SInt16;
contrlMax : SInt16;
contrlDefProc : Handle;
contrlData : Handle;
contrlAction : ControlActionUPP;
contrlRfCon : SInt32;
contrlTitle : Str255;
end record;
type ControlActionProcPtr is Access procedure
(theControl : in ControlRef;
partCode : in ControlPartCode);
type CtlCTab is
record
ccSeed : SInt32;
ccRider : SInt16;
ctSize : SInt16;
ctTable : ColorSpec_Vec_4;
end record;
type CCTabPtr is Access CtlCTab;
type CCTabHandle is Access CCTabPtr;
type AuxCtlRec is
record
acNext : Handle;
acOwner : ControlRef;
acCTable : CCTabHandle;
acFlags : SInt16;
acReserved : SInt32;
acRefCon : SInt32;
end record;
type AuxCtlPtr is Access AuxCtlRec;
type AuxCtlHandle is Access AuxCtlPtr;
type PopupPrivateData is
record
mHandle : MenuHandle;
mID : SInt16;
end record;
type PopupPrivateDataPtr is Access PopupPrivateData;
type PopupPrivateDataHandle is Access PopupPrivateDataPtr;
uppControlActionProcInfo : constant := 16#000002C0#; -- PROCEDURE (4 byte param, 2 byte param);
function NewControl
(theWindow : in WindowRef;
boundsRect : access Rect;
title : access Str255;
visible : in Boolean;
value : in SInt16;
min : in SInt16;
max : in SInt16;
procID : in SInt16;
refCon : in SInt32)
return ControlRef;
pragma Import (C, NewControl, "NewControl", "NewControl");
function GetNewControl
(controlID : in SInt16;
owner : in WindowRef)
return ControlRef;
pragma Import (C, GetNewControl, "GetNewControl", "GetNewControl");
procedure DisposeControl
(theControl : in ControlRef);
pragma Import (C, DisposeControl, "DisposeControl", "DisposeControl");
procedure KillControls
(theWindow : in WindowRef);
pragma Import (C, KillControls, "KillControls", "KillControls");
procedure ShowControl
(theControl : in ControlRef);
pragma Import (C, ShowControl, "ShowControl", "ShowControl");
procedure HideControl
(theControl : in ControlRef);
pragma Import (C, HideControl, "HideControl", "HideControl");
procedure DrawControls
(theWindow : in WindowRef);
pragma Import (C, DrawControls, "DrawControls", "DrawControls");
procedure Draw1Control
(theControl : in ControlRef);
pragma Import (C, Draw1Control, "Draw1Control", "Draw1Control");
procedure UpdateControls
(theWindow : in WindowRef;
updateRgn : in RgnHandle);
pragma Import (C, UpdateControls, "UpdateControls", "UpdateControls");
procedure HiliteControl
(theControl : in ControlRef;
hiliteState : in ControlPartCode);
pragma Import (C, HiliteControl, "HiliteControl", "HiliteControl");
function TrackControl
(theControl : in ControlRef;
thePoint : in Point;
actionProc : in ControlActionUPP)
return ControlPartCode;
pragma Import (C, TrackControl, "TrackControl", "TrackControl");
procedure DragControl
(theControl : in ControlRef;
startPt : in Point;
limitRect : access Rect;
slopRect : access Rect;
axis : in DragConstraint);
pragma Import (C, DragControl, "DragControl", "DragControl");
function TestControl
(theControl : in ControlRef;
thePt : in Point)
return ControlPartCode;
pragma Import (C, TestControl, "TestControl", "TestControl");
function FindControl
(thePoint : in Point;
theWindow : in WindowRef;
theControl : access ControlRef)
return ControlPartCode;
pragma Import (C, FindControl, "FindControl", "FindControl");
procedure MoveControl
(theControl : in ControlRef;
h : in SInt16;
v : in SInt16);
pragma Import (C, MoveControl, "MoveControl", "MoveControl");
procedure SizeControl
(theControl : in ControlRef;
w : in SInt16;
h : in SInt16);
pragma Import (C, SizeControl, "SizeControl", "SizeControl");
procedure SetControlTitle
(theControl : in ControlRef;
title : access Str255);
pragma Import (C, SetControlTitle, "SetControlTitle", "SetControlTitle");
procedure GetControlTitle
(theControl : in ControlRef;
title : access Str255);
pragma Import (C, GetControlTitle, "GetControlTitle", "GetControlTitle");
function GetControlValue
(theControl : in ControlRef)
return SInt16;
pragma Import (C, GetControlValue, "GetControlValue", "GetControlValue");
procedure SetControlValue
(theControl : in ControlRef;
newValue : in SInt16);
pragma Import (C, SetControlValue, "SetControlValue", "SetControlValue");
function GetControlMinimum
(theControl : in ControlRef)
return SInt16;
pragma Import (C, GetControlMinimum, "GetControlMinimum", "GetControlMinimum");
procedure SetControlMinimum
(theControl : in ControlRef;
newMinimum : in SInt16);
pragma Import (C, SetControlMinimum, "SetControlMinimum", "SetControlMinimum");
function GetControlMaximum
(theControl : in ControlRef)
return SInt16;
pragma Import (C, GetControlMaximum, "GetControlMaximum", "GetControlMaximum");
procedure SetControlMaximum
(theControl : in ControlRef;
newMaximum : in SInt16);
pragma Import (C, SetControlMaximum, "SetControlMaximum", "SetControlMaximum");
function GetControlVariant
(theControl : in ControlRef)
return SInt16;
pragma Import (C, GetControlVariant, "GetControlVariant", "GetControlVariant");
procedure SetControlAction
(theControl : in ControlRef;
actionProc : in ControlActionUPP);
pragma Import (C, SetControlAction, "SetControlAction", "SetControlAction");
function GetControlAction
(theControl : in ControlRef)
return ControlActionUPP;
pragma Import (C, GetControlAction, "GetControlAction", "GetControlAction");
procedure SetControlReference
(theControl : in ControlRef;
data : in SInt32);
pragma Import (C, SetControlReference, "SetControlReference", "SetControlReference");
function GetControlReference
(theControl : in ControlRef)
return SInt32;
pragma Import (C, GetControlReference, "GetControlReference", "GetControlReference");
function GetAuxiliaryControlRecord
(theControl : in ControlRef;
acHndl : access AuxCtlHandle)
return Boolean;
pragma Import (C, GetAuxiliaryControlRecord, "GetAuxiliaryControlRecord", "GetAuxiliaryControlRecord");
procedure SetControlColor
(theControl : in ControlRef;
newColorTable : in CCTabHandle);
pragma Import (C, SetControlColor, "SetControlColor", "SetControlColor");
subtype ControlDefProcMessage is SInt16;
type ControlDefProcPtr is access function
(varCode : in SInt16;
theControl : in ControlRef;
message : in ControlDefProcMessage;
param : in SInt32)
return SInt32;
subtype ControlDefUPP is UniversalProcPtr;
type IndicatorDragConstraint is
record
limitRect : Rect;
slopRect : Rect;
axis : DragConstraint;
end record;
type IndicatorDragConstraintPtr is Access IndicatorDragConstraint;
type IndicatorDragConstraintHandle is Access IndicatorDragConstraintPtr;
function newcontrolC
(theWindow : in WindowRef;
boundsRect : access Rect;
title : in Chars_Ptr;
visible : in Boolean;
value : in Short_Integer;
min : in Short_Integer;
max : in Short_Integer;
procID : in Short_Integer;
refCon : in Long_Integer)
return ControlRef;
pragma Import (C, newcontrolC, "newcontrol", "newcontrol");
function newcontrol
(theWindow : in WindowRef;
boundsRect : access Rect;
title : in Chars_Ptr;
visible : in Boolean;
value : in Short_Integer;
min : in Short_Integer;
max : in Short_Integer;
procID : in Short_Integer;
refCon : in Long_Integer)
return ControlRef
renames newcontrolC;
function newcontrol
(theWindow : in WindowRef;
boundsRect : access Rect;
title : in String;
visible : in Boolean;
value : in Short_Integer;
min : in Short_Integer;
max : in Short_Integer;
procID : in Short_Integer;
refCon : in Long_Integer)
return ControlRef;
procedure getcontroltitleC
(theControl : in ControlRef;
title : in Chars_Ptr);
pragma Import (C, getcontroltitleC, "getcontroltitle", "getcontroltitle");
procedure getcontroltitle
(theControl : in ControlRef;
title : in Chars_Ptr)
renames getcontroltitleC;
procedure setcontroltitleC
(theControl : in ControlRef;
title : in Chars_Ptr);
pragma Import (C, setcontroltitleC, "setcontroltitle", "setcontroltitle");
procedure setcontroltitle
(theControl : in ControlRef;
title : in Chars_Ptr)
renames setcontroltitleC;
procedure setcontroltitle
(theControl : in ControlRef;
title : in String);
end Controls;