home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
OLECTRLS.INT
< prev
next >
Wrap
Text File
|
1997-02-28
|
11KB
|
248 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1996 Borland International }
{ }
{*******************************************************}
unit OleCtrls;
{$R-}
interface
uses Windows, Messages, Ole2, OleCtl, SysUtils, Classes, Controls, Forms,
Menus, Graphics, OleAuto;
type
TOleControl = class;
TOleClientSite = class(IOleClientSite)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function SaveObject: HResult; override;
function GetMoniker(dwAssign: Longint; dwWhichMoniker: Longint;
var mk: IMoniker): HResult; override;
function GetContainer(var container: IOleContainer): HResult; override;
function ShowObject: HResult; override;
function OnShowWindow(fShow: BOOL): HResult; override;
function RequestNewObjectLayout: HResult; override;
end;
TOleControlSite = class(IOleControlSite)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function OnControlInfoChanged: HResult; override;
function LockInPlaceActive(fLock: BOOL): HResult; override;
function GetExtendedControl(var disp: IDispatch): HResult; override;
function TransformCoords(var ptlHimetric: TPoint; var ptfContainer: TPointF;
flags: Longint): HResult; override;
function TranslateAccelerator(msg: PMsg; grfModifiers: Longint): HResult;
override;
function OnFocus(fGotFocus: BOOL): HResult; override;
function ShowPropertyFrame: HResult; override;
end;
TOleInPlaceSite = class(IOleInPlaceSite)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetWindow(var wnd: HWnd): HResult; override;
function ContextSensitiveHelp(fEnterMode: BOOL): HResult; override;
function CanInPlaceActivate: HResult; override;
function OnInPlaceActivate: HResult; override;
function OnUIActivate: HResult; override;
function GetWindowContext(var frame: IOleInPlaceFrame;
var doc: IOleInPlaceUIWindow; var rcPosRect: TRect;
var rcClipRect: TRect; var frameInfo: TOleInPlaceFrameInfo): HResult;
override;
function Scroll(const scrollExtent: TPoint): HResult; override;
function OnUIDeactivate(fUndoable: BOOL): HResult; override;
function OnInPlaceDeactivate: HResult; override;
function DiscardUndoState: HResult; override;
function DeactivateAndUndo: HResult; override;
function OnPosRectChange(const rcPosRect: TRect): HResult; override;
end;
TOleInPlaceFrame = class(IOleInPlaceFrame)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetWindow(var wnd: HWnd): HResult; override;
function ContextSensitiveHelp(fEnterMode: BOOL): HResult; override;
function GetBorder(var rectBorder: TRect): HResult; override;
function RequestBorderSpace(const borderwidths: TRect): HResult; override;
function SetBorderSpace(pborderwidths: PRect): HResult; override;
function SetActiveObject(activeObject: IOleInPlaceActiveObject;
pszObjName: POleStr): HResult; override;
function InsertMenus(hmenuShared: HMenu;
var menuWidths: TOleMenuGroupWidths): HResult; override;
function SetMenu(hmenuShared: HMenu; holemenu: HMenu;
hwndActiveObject: HWnd): HResult; override;
function RemoveMenus(hmenuShared: HMenu): HResult; override;
function SetStatusText(pszStatusText: POleStr): HResult; override;
function EnableModeless(fEnable: BOOL): HResult; override;
function TranslateAccelerator(var msg: TMsg; wID: Word): HResult; override;
end;
TAmbientDispatch = class(IDispatch)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetTypeInfoCount(var ctinfo: Integer): HResult; override;
function GetTypeInfo(itinfo: Integer; lcid: TLCID;
var tinfo: ITypeInfo): HResult; override;
function GetIDsOfNames(const iid: TIID; rgszNames: POleStrList;
cNames: Integer; lcid: TLCID; rgdispid: PDispIDList): HResult; override;
function Invoke(dispIDMember: TDispID; const iid: TIID; lcid: TLCID;
flags: Word; var dispParams: TDispParams; varResult: PVariant;
excepInfo: PExcepInfo; argErr: PInteger): HResult; override;
end;
TEventDispatch = class(IDispatch)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function GetTypeInfoCount(var ctinfo: Integer): HResult; override;
function GetTypeInfo(itinfo: Integer; lcid: TLCID;
var tinfo: ITypeInfo): HResult; override;
function GetIDsOfNames(const iid: TIID; rgszNames: POleStrList;
cNames: Integer; lcid: TLCID; rgdispid: PDispIDList): HResult; override;
function Invoke(dispIDMember: TDispID; const iid: TIID; lcid: TLCID;
flags: Word; var dispParams: TDispParams; varResult: PVariant;
excepInfo: PExcepInfo; argErr: PInteger): HResult; override;
end;
TPropertyNotifySink = class(IPropertyNotifySink)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function OnChanged(dispid: TDispID): HResult; override;
function OnRequestEdit(dispid: TDispID): HResult; override;
end;
TSimpleFrameSite = class(ISimpleFrameSite)
public
constructor Create(Control: TOleControl);
function QueryInterface(const iid: TIID; var obj): HResult; override;
function AddRef: Longint; override;
function Release: Longint; override;
function PreMessageFilter(wnd: HWnd; msg, wp, lp: Integer;
var res: Integer; var Cookie: Longint): HResult; override;
function PostMessageFilter(wnd: HWnd; msg, wp, lp: Integer;
var res: Integer; Cookie: Longint): HResult; override;
end;
TOleEnum = -32768..32767;
TEnumValue = record
Value: Longint;
Ident: string;
end;
PEnumValueList = ^TEnumValueList;
TEnumValueList = array[0..32767] of TEnumValue;
TEnumPropDesc = class
public
constructor Create(DispID, ValueCount: Integer; TypeInfo: ITypeInfo);
destructor Destroy; override;
procedure GetStrings(Proc: TGetStrProc);
function StringToValue(const S: string): Integer;
function ValueToString(V: Integer): string;
end;
PControlData = ^TControlData;
TControlData = record
ClassID: TCLSID;
EventIID: TIID;
EventCount: Longint;
EventDispIDs: Pointer;
LicenseKey: Pointer;
Flags: Integer;
InstanceCount: Integer;
EnumPropDescs: TList;
end;
TOleControl = class(TWinControl)
protected
FEvents: Integer;
procedure CreateWnd; override;
procedure DefaultHandler(var Message); override;
procedure DefineProperties(Filer: TFiler); override;
procedure DestroyWindowHandle; override;
function GetColorProp(Index: Integer): TColor;
function GetCurrencyProp(Index: Integer): TCurrency;
function GetDoubleProp(Index: Integer): Double;
function GetIntegerProp(Index: Integer): Integer;
function GetOleBoolProp(Index: Integer): TOleBool;
function GetOleDateProp(Index: Integer): TOleDate;
function GetOleEnumProp(Index: Integer): TOleEnum;
procedure GetProperty(Index: Integer; var Value: TVarData);
function GetSingleProp(Index: Integer): Single;
function GetSmallintProp(Index: Integer): Smallint;
function GetStringProp(Index: Integer): string;
function GetVariantProp(Index: Integer): Variant;
procedure InitControlData; virtual; abstract;
procedure InvokeMethod(var DispInfo; Result: Pointer);
function PaletteChanged(Foreground: Boolean): Boolean; override;
procedure SetColorProp(Index: Integer; Value: TColor);
procedure SetCurrencyProp(Index: Integer; Value: TCurrency);
procedure SetDoubleProp(Index: Integer; Value: Double);
procedure SetIntegerProp(Index: Integer; Value: Integer);
procedure SetName(const Value: TComponentName); override;
procedure SetOleBoolProp(Index: Integer; Value: TOleBool);
procedure SetOleDateProp(Index: Integer; Value: TOleDate);
procedure SetOleEnumProp(Index: Integer; Value: TOleEnum);
procedure SetProperty(Index: Integer; const Value: TVarData);
procedure SetSingleProp(Index: Integer; Value: Single);
procedure SetSmallintProp(Index: Integer; Value: Smallint);
procedure SetStringProp(Index: Integer; const Value: string);
procedure SetVariantProp(Index: Integer; const Value: Variant);
procedure WndProc(var Message: TMessage); override;
property ControlData: PControlData;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BrowseProperties;
procedure DoObjectVerb(Verb: Integer);
function GetEnumPropDesc(DispID: Integer): TEnumPropDesc;
function GetHelpContext(Member: string; var HelpCtx: Integer;
var HelpFile: string): Boolean;
procedure GetObjectVerbs(List: TStrings);
function GetPropDisplayString(DispID: Integer): string;
procedure GetPropDisplayStrings(DispID: Integer; List: TStrings);
function IsCustomProperty(DispID: Integer): Boolean;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
procedure SetPropDisplayString(DispID: Integer; const Value: string);
procedure ShowAboutBox;
property OleObject: Variant;
property TabStop default True;
end;
EOleCtrlError = class(Exception);
function FontToOleFont(Font: TFont): Variant;
procedure OleFontToFont(const OleFont: Variant; Font: TFont);
implementation