home *** CD-ROM | disk | FTP | other *** search
- unit ChkBImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, DelC_TLB;
-
- type
- TCheckBoxX = class(TActiveXControl, ICheckBoxX)
- private
- { Private declarations }
- FDelphiControl: TCheckBox;
- FEvents: ICheckBoxXEvents;
- procedure ClickEvent(Sender: TObject);
- procedure KeyPressEvent(Sender: TObject; var Key: Char);
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_Alignment: TxLeftRight; safecall;
- function Get_AllowGrayed: WordBool; safecall;
- function Get_Caption: WideString; safecall;
- function Get_Checked: WordBool; 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_ParentColor: WordBool; safecall;
- function Get_ParentCtl3D: WordBool; safecall;
- function Get_State: TxCheckBoxState; safecall;
- function Get_Visible: WordBool; safecall;
- procedure AboutBox; safecall;
- procedure Set_Alignment(Value: TxLeftRight); safecall;
- procedure Set_AllowGrayed(Value: WordBool); safecall;
- procedure Set_Caption(const Value: WideString); safecall;
- procedure Set_Checked(Value: WordBool); 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_ParentColor(Value: WordBool); safecall;
- procedure Set_ParentCtl3D(Value: WordBool); safecall;
- procedure Set_State(Value: TxCheckBoxState); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- end;
-
- implementation
-
- uses About4;
-
- { TCheckBoxX }
-
- procedure TCheckBoxX.InitializeControl;
- begin
- FDelphiControl := Control as TCheckBox;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnKeyPress := KeyPressEvent;
- end;
-
- procedure TCheckBoxX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as ICheckBoxXEvents;
- end;
-
- procedure TCheckBoxX.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_CheckBoxXPage); }
- end;
-
- function TCheckBoxX.Get_Alignment: TxLeftRight;
- begin
- Result := Ord(FDelphiControl.Alignment);
- end;
-
- function TCheckBoxX.Get_AllowGrayed: WordBool;
- begin
- Result := FDelphiControl.AllowGrayed;
- end;
-
- function TCheckBoxX.Get_Caption: WideString;
- begin
- Result := WideString(FDelphiControl.Caption);
- end;
-
- function TCheckBoxX.Get_Checked: WordBool;
- begin
- Result := FDelphiControl.Checked;
- end;
-
- function TCheckBoxX.Get_Color: TColor;
- begin
- Result := FDelphiControl.Color;
- end;
-
- function TCheckBoxX.Get_Ctl3D: WordBool;
- begin
- Result := FDelphiControl.Ctl3D;
- end;
-
- function TCheckBoxX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TCheckBoxX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
-
- function TCheckBoxX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
-
- function TCheckBoxX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TCheckBoxX.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TCheckBoxX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
-
- function TCheckBoxX.Get_ParentCtl3D: WordBool;
- begin
- Result := FDelphiControl.ParentCtl3D;
- end;
-
- function TCheckBoxX.Get_State: TxCheckBoxState;
- begin
- Result := Ord(FDelphiControl.State);
- end;
-
- function TCheckBoxX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- procedure TCheckBoxX.AboutBox;
- begin
- ShowCheckBoxXAbout;
- end;
-
- procedure TCheckBoxX.Set_Alignment(Value: TxLeftRight);
- begin
- FDelphiControl.Alignment := TLeftRight(Value);
- end;
-
- procedure TCheckBoxX.Set_AllowGrayed(Value: WordBool);
- begin
- FDelphiControl.AllowGrayed := Value;
- end;
-
- procedure TCheckBoxX.Set_Caption(const Value: WideString);
- begin
- FDelphiControl.Caption := TCaption(Value);
- end;
-
- procedure TCheckBoxX.Set_Checked(Value: WordBool);
- begin
- FDelphiControl.Checked := Value;
- end;
-
- procedure TCheckBoxX.Set_Color(Value: TColor);
- begin
- FDelphiControl.Color := Value;
- end;
-
- procedure TCheckBoxX.Set_Ctl3D(Value: WordBool);
- begin
- FDelphiControl.Ctl3D := Value;
- end;
-
- procedure TCheckBoxX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TCheckBoxX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
-
- procedure TCheckBoxX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
-
- procedure TCheckBoxX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TCheckBoxX.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TCheckBoxX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
-
- procedure TCheckBoxX.Set_ParentCtl3D(Value: WordBool);
- begin
- FDelphiControl.ParentCtl3D := Value;
- end;
-
- procedure TCheckBoxX.Set_State(Value: TxCheckBoxState);
- begin
- FDelphiControl.State := TCheckBoxState(Value);
- end;
-
- procedure TCheckBoxX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TCheckBoxX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TCheckBoxX.KeyPressEvent(Sender: TObject; var Key: Char);
- var
- TempKey: Smallint;
- begin
- TempKey := Smallint(Key);
- if FEvents <> nil then FEvents.OnKeyPress(TempKey);
- Key := Char(TempKey);
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TCheckBoxX,
- TCheckBox,
- Class_CheckBoxX,
- 4,
- '{FA7B82FE-9ED7-11D0-AA40-444553540000}',
- 0);
- end.
-