home *** CD-ROM | disk | FTP | other *** search
- unit NbokImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, DelC_TLB, ExtCtrls;
-
- type
- TNotebookX = class(TActiveXControl, INotebookX)
- private
- { Private declarations }
- FDelphiControl: TNotebook;
- FEvents: INotebookXEvents;
- procedure ClickEvent(Sender: TObject);
- procedure DblClickEvent(Sender: TObject);
- procedure PageChangedEvent(Sender: TObject);
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_ActivePage: WideString; safecall;
- function Get_Color: TColor; safecall;
- function Get_Ctl3D: WordBool; safecall;
- function Get_Cursor: Smallint; safecall;
- function Get_DragCursor: Smallint; safecall;
- function Get_DragMode: TxDragMode; safecall;
- function Get_Enabled: WordBool; safecall;
- function Get_Font: Font; safecall;
- function Get_PageIndex: Integer; safecall;
- function Get_Pages: IStrings; safecall;
- function Get_ParentColor: WordBool; safecall;
- function Get_ParentCtl3D: WordBool; safecall;
- function Get_Visible: WordBool; safecall;
- procedure AboutBox; safecall;
- procedure Set_ActivePage(const Value: WideString); safecall;
- procedure Set_Color(Value: TColor); safecall;
- procedure Set_Ctl3D(Value: WordBool); safecall;
- procedure Set_Cursor(Value: Smallint); safecall;
- procedure Set_DragCursor(Value: Smallint); safecall;
- procedure Set_DragMode(Value: TxDragMode); safecall;
- procedure Set_Enabled(Value: WordBool); safecall;
- procedure Set_Font(const Value: Font); safecall;
- procedure Set_PageIndex(Value: Integer); safecall;
- procedure Set_Pages(const Value: IStrings); safecall;
- procedure Set_ParentColor(Value: WordBool); safecall;
- procedure Set_ParentCtl3D(Value: WordBool); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- end;
-
- implementation
-
- uses About17;
-
- { TNotebookX }
-
- procedure TNotebookX.InitializeControl;
- begin
- FDelphiControl := Control as TNotebook;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnDblClick := DblClickEvent;
- FDelphiControl.OnPageChanged := PageChangedEvent;
- end;
-
- procedure TNotebookX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as INotebookXEvents;
- end;
-
- procedure TNotebookX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- { Define property pages here. Property pages are defined by calling
- DefinePropertyPage with the class id of the page. For example,
- DefinePropertyPage(Class_NotebookXPage); }
- end;
-
- function TNotebookX.Get_ActivePage: WideString;
- begin
- Result := WideString(FDelphiControl.ActivePage);
- end;
-
- function TNotebookX.Get_Color: TColor;
- begin
- Result := FDelphiControl.Color;
- end;
-
- function TNotebookX.Get_Ctl3D: WordBool;
- begin
- Result := FDelphiControl.Ctl3D;
- end;
-
- function TNotebookX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TNotebookX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
-
- function TNotebookX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
-
- function TNotebookX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TNotebookX.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TNotebookX.Get_PageIndex: Integer;
- begin
- Result := FDelphiControl.PageIndex;
- end;
-
- function TNotebookX.Get_Pages: IStrings;
- begin
- GetOleStrings(FDelphiControl.Pages, Result);
- end;
-
- function TNotebookX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
-
- function TNotebookX.Get_ParentCtl3D: WordBool;
- begin
- Result := FDelphiControl.ParentCtl3D;
- end;
-
- function TNotebookX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- procedure TNotebookX.AboutBox;
- begin
- ShowNotebookXAbout;
- end;
-
- procedure TNotebookX.Set_ActivePage(const Value: WideString);
- begin
- FDelphiControl.ActivePage := String(Value);
- end;
-
- procedure TNotebookX.Set_Color(Value: TColor);
- begin
- FDelphiControl.Color := Value;
- end;
-
- procedure TNotebookX.Set_Ctl3D(Value: WordBool);
- begin
- FDelphiControl.Ctl3D := Value;
- end;
-
- procedure TNotebookX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TNotebookX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
-
- procedure TNotebookX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
-
- procedure TNotebookX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TNotebookX.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TNotebookX.Set_PageIndex(Value: Integer);
- begin
- FDelphiControl.PageIndex := Value;
- end;
-
- procedure TNotebookX.Set_Pages(const Value: IStrings);
- begin
- SetOleStrings(FDelphiControl.Pages, Value);
- end;
-
- procedure TNotebookX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
-
- procedure TNotebookX.Set_ParentCtl3D(Value: WordBool);
- begin
- FDelphiControl.ParentCtl3D := Value;
- end;
-
- procedure TNotebookX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TNotebookX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TNotebookX.DblClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnDblClick;
- end;
-
- procedure TNotebookX.PageChangedEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnPageChanged;
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TNotebookX,
- TNotebook,
- Class_NotebookX,
- 17,
- '{FA7B8453-9ED7-11D0-AA40-444553540000}',
- 0);
- end.
-