home *** CD-ROM | disk | FTP | other *** search
- unit STxtImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, DelC_TLB;
-
- type
- TStaticTextX = class(TActiveXControl, IStaticTextX)
- private
- { Private declarations }
- FDelphiControl: TStaticText;
- FEvents: IStaticTextXEvents;
- procedure ClickEvent(Sender: TObject);
- procedure DblClickEvent(Sender: TObject);
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_Alignment: TxAlignment; safecall;
- function Get_AutoSize: WordBool; safecall;
- function Get_BorderStyle: TxStaticBorderStyle; safecall;
- function Get_Caption: WideString; safecall;
- function Get_Color: TColor; 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_ShowAccelChar: WordBool; safecall;
- function Get_Visible: WordBool; safecall;
- procedure AboutBox; safecall;
- procedure Set_Alignment(Value: TxAlignment); safecall;
- procedure Set_AutoSize(Value: WordBool); safecall;
- procedure Set_BorderStyle(Value: TxStaticBorderStyle); safecall;
- procedure Set_Caption(const Value: WideString); safecall;
- procedure Set_Color(Value: TColor); 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_ShowAccelChar(Value: WordBool); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- end;
-
- implementation
-
- uses About28;
-
- { TStaticTextX }
-
- procedure TStaticTextX.InitializeControl;
- begin
- FDelphiControl := Control as TStaticText;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnDblClick := DblClickEvent;
- end;
-
- procedure TStaticTextX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as IStaticTextXEvents;
- end;
-
- procedure TStaticTextX.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_StaticTextXPage); }
- end;
-
- function TStaticTextX.Get_Alignment: TxAlignment;
- begin
- Result := Ord(FDelphiControl.Alignment);
- end;
-
- function TStaticTextX.Get_AutoSize: WordBool;
- begin
- Result := FDelphiControl.AutoSize;
- end;
-
- function TStaticTextX.Get_BorderStyle: TxStaticBorderStyle;
- begin
- Result := Ord(FDelphiControl.BorderStyle);
- end;
-
- function TStaticTextX.Get_Caption: WideString;
- begin
- Result := WideString(FDelphiControl.Caption);
- end;
-
- function TStaticTextX.Get_Color: TColor;
- begin
- Result := FDelphiControl.Color;
- end;
-
- function TStaticTextX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TStaticTextX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
-
- function TStaticTextX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
-
- function TStaticTextX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TStaticTextX.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TStaticTextX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
-
- function TStaticTextX.Get_ShowAccelChar: WordBool;
- begin
- Result := FDelphiControl.ShowAccelChar;
- end;
-
- function TStaticTextX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- procedure TStaticTextX.AboutBox;
- begin
- ShowStaticTextXAbout;
- end;
-
- procedure TStaticTextX.Set_Alignment(Value: TxAlignment);
- begin
- FDelphiControl.Alignment := TAlignment(Value);
- end;
-
- procedure TStaticTextX.Set_AutoSize(Value: WordBool);
- begin
- FDelphiControl.AutoSize := Value;
- end;
-
- procedure TStaticTextX.Set_BorderStyle(Value: TxStaticBorderStyle);
- begin
- FDelphiControl.BorderStyle := TStaticBorderStyle(Value);
- end;
-
- procedure TStaticTextX.Set_Caption(const Value: WideString);
- begin
- FDelphiControl.Caption := TCaption(Value);
- end;
-
- procedure TStaticTextX.Set_Color(Value: TColor);
- begin
- FDelphiControl.Color := Value;
- end;
-
- procedure TStaticTextX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TStaticTextX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
-
- procedure TStaticTextX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
-
- procedure TStaticTextX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TStaticTextX.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TStaticTextX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
-
- procedure TStaticTextX.Set_ShowAccelChar(Value: WordBool);
- begin
- FDelphiControl.ShowAccelChar := Value;
- end;
-
- procedure TStaticTextX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TStaticTextX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TStaticTextX.DblClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnDblClick;
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TStaticTextX,
- TStaticText,
- Class_StaticTextX,
- 28,
- '{FA7B8674-9ED7-11D0-AA40-444553540000}',
- 0);
- end.
-