| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- unit RealICQImageOleImpl1;
- {$WARN SYMBOL_PLATFORM OFF}
- interface
- uses
- jpeg,
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, ImageX_TLB,
- ImagePanelForActiveX, ExtCtrls;
- type
- TRealICQImageOleX = class(TActiveXControl, IRealICQImageOleX)
- private
- { Private declarations }
- FDelphiControl: TImagePanelForActiveX;
- FEvents: IRealICQImageOleXEvents;
- procedure CanResizeEvent(Sender: TObject; var NewWidth, NewHeight: Integer;
- var Resize: Boolean);
- procedure ClickEvent(Sender: TObject);
- procedure ConstrainedResizeEvent(Sender: TObject; var MinWidth, MinHeight,
- MaxWidth, MaxHeight: Integer);
- procedure DblClickEvent(Sender: TObject);
- procedure ResizeEvent(Sender: TObject);
- protected
- { Protected declarations }
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure InitializeControl; override;
- function DrawTextBiDiModeFlagsReadingOnly: Integer; safecall;
- function Get_AlignDisabled: WordBool; safecall;
- function Get_Alignment: TxAlignment; safecall;
- function Get_AutoSize: WordBool; safecall;
- function Get_BevelInner: TxBevelCut; safecall;
- function Get_BevelOuter: TxBevelCut; safecall;
- function Get_BorderStyle: TxBorderStyle; safecall;
- function Get_Caption: WideString; safecall;
- function Get_Color: OLE_COLOR; safecall;
- function Get_Ctl3D: WordBool; safecall;
- function Get_DockSite: WordBool; safecall;
- function Get_DoubleBuffered: WordBool; safecall;
- function Get_DragCursor: Smallint; safecall;
- function Get_DragMode: TxDragMode; safecall;
- function Get_Enabled: WordBool; safecall;
- function Get_Font: IFontDisp; safecall;
- function Get_FullRepaint: WordBool; safecall;
- function Get_Locked: WordBool; safecall;
- function Get_ParentBackground: WordBool; safecall;
- function Get_ParentColor: WordBool; safecall;
- function Get_ParentCtl3D: WordBool; safecall;
- function Get_Picture: IPictureDisp; safecall;
- function Get_UseDockManager: WordBool; safecall;
- function Get_Visible: WordBool; safecall;
- function Get_VisibleDockClientCount: Integer; safecall;
- function IsRightToLeft: WordBool; safecall;
- function UseRightToLeftReading: WordBool; safecall;
- function UseRightToLeftScrollBar: WordBool; safecall;
- procedure _Set_Font(var Value: IFontDisp); safecall;
- procedure InitiateAction; safecall;
- procedure LoadFromFile(const AFileName: WideString); safecall;
- procedure Set_Alignment(Value: TxAlignment); safecall;
- procedure Set_AutoSize(Value: WordBool); safecall;
- procedure Set_BevelInner(Value: TxBevelCut); safecall;
- procedure Set_BevelOuter(Value: TxBevelCut); safecall;
- procedure Set_BorderStyle(Value: TxBorderStyle); safecall;
- procedure Set_Caption(const Value: WideString); safecall;
- procedure Set_Color(Value: OLE_COLOR); safecall;
- procedure Set_Ctl3D(Value: WordBool); safecall;
- procedure Set_DockSite(Value: WordBool); safecall;
- procedure Set_DoubleBuffered(Value: WordBool); safecall;
- procedure Set_DragCursor(Value: Smallint); safecall;
- procedure Set_DragMode(Value: TxDragMode); safecall;
- procedure Set_Enabled(Value: WordBool); safecall;
- procedure Set_Font(const Value: IFontDisp); safecall;
- procedure Set_FullRepaint(Value: WordBool); safecall;
- procedure Set_Locked(Value: WordBool); safecall;
- procedure Set_ParentBackground(Value: WordBool); safecall;
- procedure Set_ParentColor(Value: WordBool); safecall;
- procedure Set_ParentCtl3D(Value: WordBool); safecall;
- procedure Set_Picture(const Value: IPictureDisp); safecall;
- procedure Set_UseDockManager(Value: WordBool); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- procedure SetSubComponent(IsSubComponent: WordBool); safecall;
- end;
- implementation
- uses ComObj;
- { TRealICQImageOleX }
- procedure TRealICQImageOleX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- {TODO: Define property pages here. Property pages are defined by calling
- DefinePropertyPage with the class id of the page. For example,
- DefinePropertyPage(Class_RealICQImageOleXPage); }
- end;
- procedure TRealICQImageOleX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as IRealICQImageOleXEvents;
- end;
- procedure TRealICQImageOleX.InitializeControl;
- begin
- FDelphiControl := Control as TImagePanelForActiveX;
- FDelphiControl.OnCanResize := CanResizeEvent;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnConstrainedResize := ConstrainedResizeEvent;
- FDelphiControl.OnDblClick := DblClickEvent;
- FDelphiControl.OnResize := ResizeEvent;
- end;
- function TRealICQImageOleX.DrawTextBiDiModeFlagsReadingOnly: Integer;
- begin
- Result := FDelphiControl.DrawTextBiDiModeFlagsReadingOnly;
- end;
- function TRealICQImageOleX.Get_AlignDisabled: WordBool;
- begin
- Result := FDelphiControl.AlignDisabled;
- end;
- function TRealICQImageOleX.Get_Alignment: TxAlignment;
- begin
- Result := Ord(FDelphiControl.Alignment);
- end;
- function TRealICQImageOleX.Get_AutoSize: WordBool;
- begin
- Result := FDelphiControl.AutoSize;
- end;
- function TRealICQImageOleX.Get_BevelInner: TxBevelCut;
- begin
- Result := Ord(FDelphiControl.BevelInner);
- end;
- function TRealICQImageOleX.Get_BevelOuter: TxBevelCut;
- begin
- Result := Ord(FDelphiControl.BevelOuter);
- end;
- function TRealICQImageOleX.Get_BorderStyle: TxBorderStyle;
- begin
- Result := Ord(FDelphiControl.BorderStyle);
- end;
- function TRealICQImageOleX.Get_Caption: WideString;
- begin
- Result := WideString(FDelphiControl.Caption);
- end;
- function TRealICQImageOleX.Get_Color: OLE_COLOR;
- begin
- Result := OLE_COLOR(FDelphiControl.Color);
- end;
- function TRealICQImageOleX.Get_Ctl3D: WordBool;
- begin
- Result := FDelphiControl.Ctl3D;
- end;
- function TRealICQImageOleX.Get_DockSite: WordBool;
- begin
- Result := FDelphiControl.DockSite;
- end;
- function TRealICQImageOleX.Get_DoubleBuffered: WordBool;
- begin
- Result := FDelphiControl.DoubleBuffered;
- end;
- function TRealICQImageOleX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
- function TRealICQImageOleX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
- function TRealICQImageOleX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
- function TRealICQImageOleX.Get_Font: IFontDisp;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
- function TRealICQImageOleX.Get_FullRepaint: WordBool;
- begin
- Result := FDelphiControl.FullRepaint;
- end;
- function TRealICQImageOleX.Get_Locked: WordBool;
- begin
- Result := FDelphiControl.Locked;
- end;
- function TRealICQImageOleX.Get_ParentBackground: WordBool;
- begin
- Result := FDelphiControl.ParentBackground;
- end;
- function TRealICQImageOleX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
- function TRealICQImageOleX.Get_ParentCtl3D: WordBool;
- begin
- Result := FDelphiControl.ParentCtl3D;
- end;
- function TRealICQImageOleX.Get_Picture: IPictureDisp;
- begin
- GetOlePicture(FDelphiControl.Picture, Result);
- end;
- function TRealICQImageOleX.Get_UseDockManager: WordBool;
- begin
- Result := FDelphiControl.UseDockManager;
- end;
- function TRealICQImageOleX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
- function TRealICQImageOleX.Get_VisibleDockClientCount: Integer;
- begin
- Result := FDelphiControl.VisibleDockClientCount;
- end;
- function TRealICQImageOleX.IsRightToLeft: WordBool;
- begin
- Result := FDelphiControl.IsRightToLeft;
- end;
- function TRealICQImageOleX.UseRightToLeftReading: WordBool;
- begin
- Result := FDelphiControl.UseRightToLeftReading;
- end;
- function TRealICQImageOleX.UseRightToLeftScrollBar: WordBool;
- begin
- Result := FDelphiControl.UseRightToLeftScrollBar;
- end;
- procedure TRealICQImageOleX._Set_Font(var Value: IFontDisp);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
- procedure TRealICQImageOleX.CanResizeEvent(Sender: TObject; var NewWidth,
- NewHeight: Integer; var Resize: Boolean);
- var
- TempNewWidth: Integer;
- TempNewHeight: Integer;
- TempResize: WordBool;
- begin
- TempNewWidth := Integer(NewWidth);
- TempNewHeight := Integer(NewHeight);
- TempResize := WordBool(Resize);
- if FEvents <> nil then FEvents.OnCanResize(TempNewWidth, TempNewHeight, TempResize);
- NewWidth := Integer(TempNewWidth);
- NewHeight := Integer(TempNewHeight);
- Resize := Boolean(TempResize);
- end;
- procedure TRealICQImageOleX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
- procedure TRealICQImageOleX.ConstrainedResizeEvent(Sender: TObject;
- var MinWidth, MinHeight, MaxWidth, MaxHeight: Integer);
- var
- TempMinWidth: Integer;
- TempMinHeight: Integer;
- TempMaxWidth: Integer;
- TempMaxHeight: Integer;
- begin
- TempMinWidth := Integer(MinWidth);
- TempMinHeight := Integer(MinHeight);
- TempMaxWidth := Integer(MaxWidth);
- TempMaxHeight := Integer(MaxHeight);
- if FEvents <> nil then FEvents.OnConstrainedResize(TempMinWidth, TempMinHeight, TempMaxWidth, TempMaxHeight);
- MinWidth := Integer(TempMinWidth);
- MinHeight := Integer(TempMinHeight);
- MaxWidth := Integer(TempMaxWidth);
- MaxHeight := Integer(TempMaxHeight);
- end;
- procedure TRealICQImageOleX.DblClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnDblClick;
- end;
- procedure TRealICQImageOleX.InitiateAction;
- begin
- FDelphiControl.InitiateAction;
- end;
- procedure TRealICQImageOleX.LoadFromFile(const AFileName: WideString);
- begin
- FDelphiControl.LoadFromFile(AFileName);
- end;
- procedure TRealICQImageOleX.ResizeEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnResize;
- end;
- procedure TRealICQImageOleX.Set_Alignment(Value: TxAlignment);
- begin
- FDelphiControl.Alignment := TAlignment(Value);
- end;
- procedure TRealICQImageOleX.Set_AutoSize(Value: WordBool);
- begin
- FDelphiControl.AutoSize := Value;
- end;
- procedure TRealICQImageOleX.Set_BevelInner(Value: TxBevelCut);
- begin
- FDelphiControl.BevelInner := TBevelCut(Value);
- end;
- procedure TRealICQImageOleX.Set_BevelOuter(Value: TxBevelCut);
- begin
- FDelphiControl.BevelOuter := TBevelCut(Value);
- end;
- procedure TRealICQImageOleX.Set_BorderStyle(Value: TxBorderStyle);
- begin
- FDelphiControl.BorderStyle := TBorderStyle(Value);
- end;
- procedure TRealICQImageOleX.Set_Caption(const Value: WideString);
- begin
- FDelphiControl.Caption := TCaption(Value);
- end;
- procedure TRealICQImageOleX.Set_Color(Value: OLE_COLOR);
- begin
- FDelphiControl.Color := TColor(Value);
- end;
- procedure TRealICQImageOleX.Set_Ctl3D(Value: WordBool);
- begin
- FDelphiControl.Ctl3D := Value;
- end;
- procedure TRealICQImageOleX.Set_DockSite(Value: WordBool);
- begin
- FDelphiControl.DockSite := Value;
- end;
- procedure TRealICQImageOleX.Set_DoubleBuffered(Value: WordBool);
- begin
- FDelphiControl.DoubleBuffered := Value;
- end;
- procedure TRealICQImageOleX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
- procedure TRealICQImageOleX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
- procedure TRealICQImageOleX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
- procedure TRealICQImageOleX.Set_Font(const Value: IFontDisp);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
- procedure TRealICQImageOleX.Set_FullRepaint(Value: WordBool);
- begin
- FDelphiControl.FullRepaint := Value;
- end;
- procedure TRealICQImageOleX.Set_Locked(Value: WordBool);
- begin
- FDelphiControl.Locked := Value;
- end;
- procedure TRealICQImageOleX.Set_ParentBackground(Value: WordBool);
- begin
- FDelphiControl.ParentBackground := Value;
- end;
- procedure TRealICQImageOleX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
- procedure TRealICQImageOleX.Set_ParentCtl3D(Value: WordBool);
- begin
- FDelphiControl.ParentCtl3D := Value;
- end;
- procedure TRealICQImageOleX.Set_Picture(const Value: IPictureDisp);
- begin
- SetOlePicture(FDelphiControl.Picture, Value);
- end;
- procedure TRealICQImageOleX.Set_UseDockManager(Value: WordBool);
- begin
- FDelphiControl.UseDockManager := Value;
- end;
- procedure TRealICQImageOleX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
- procedure TRealICQImageOleX.SetSubComponent(IsSubComponent: WordBool);
- begin
- FDelphiControl.SetSubComponent(IsSubComponent);
- end;
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TRealICQImageOleX,
- TImagePanelForActiveX,
- Class_RealICQImageOleX,
- 1,
- '{4CA28EC4-830F-4D3C-9A27-D76E515AFF3C}',
- OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
- tmApartment);
- end.
|