⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lvctrl_tlb.pas

📁 《Delphi开发人员指南》配书原码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
end;

function  TListViewX.GetSearchString: WideString;
begin
  Result := DefaultInterface.GetSearchString;
end;

function  TListViewX.IsEditing: WordBool;
begin
  Result := DefaultInterface.IsEditing;
end;

procedure TListViewX.Scroll(DX: Integer; DY: Integer);
begin
  DefaultInterface.Scroll(DX, DY);
end;

function  TListViewX.StringWidth(const S: WideString): Integer;
begin
  Result := DefaultInterface.StringWidth(S);
end;

procedure TListViewX.UpdateItems(FirstIndex: Integer; LastIndex: Integer);
begin
  DefaultInterface.UpdateItems(FirstIndex, LastIndex);
end;

procedure TListViewX.FlipChildren(AllLevels: WordBool);
begin
  DefaultInterface.FlipChildren(AllLevels);
end;

function  TListViewX.DrawTextBiDiModeFlags(Flags: Integer): Integer;
begin
  Result := DefaultInterface.DrawTextBiDiModeFlags(Flags);
end;

function  TListViewX.DrawTextBiDiModeFlagsReadingOnly: Integer;
begin
  Result := DefaultInterface.DrawTextBiDiModeFlagsReadingOnly;
end;

function  TListViewX.GetControlsAlignment: TxAlignment;
begin
  Result := DefaultInterface.GetControlsAlignment;
end;

procedure TListViewX.InitiateAction;
begin
  DefaultInterface.InitiateAction;
end;

function  TListViewX.IsRightToLeft: WordBool;
begin
  Result := DefaultInterface.IsRightToLeft;
end;

function  TListViewX.UseRightToLeftAlignment: WordBool;
begin
  Result := DefaultInterface.UseRightToLeftAlignment;
end;

function  TListViewX.UseRightToLeftReading: WordBool;
begin
  Result := DefaultInterface.UseRightToLeftReading;
end;

function  TListViewX.UseRightToLeftScrollBar: WordBool;
begin
  Result := DefaultInterface.UseRightToLeftScrollBar;
end;

function  TListViewX.ClassNameIs(const Name: WideString): WordBool;
begin
  Result := DefaultInterface.ClassNameIs(Name);
end;

procedure TListViewX.AboutBox;
begin
  DefaultInterface.AboutBox;
end;

class function CoListItem.Create: IListItem;
begin
  Result := CreateComObject(CLASS_ListItem) as IListItem;
end;

class function CoListItem.CreateRemote(const MachineName: string): IListItem;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ListItem) as IListItem;
end;

procedure TListItem.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{1B5911E3-88A1-11D2-9261-00104B700B61}';
    IntfIID:   '{1B5911E1-88A1-11D2-9261-00104B700B61}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TListItem.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as IListItem;
  end;
end;

procedure TListItem.ConnectTo(svrIntf: IListItem);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TListItem.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TListItem.GetDefaultInterface: IListItem;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TListItem.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TListItemProperties.Create(Self);
{$ENDIF}
end;

destructor TListItem.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TListItem.GetServerProperties: TListItemProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TListItem.Get_Caption: WideString;
begin
  Result := DefaultInterface.Get_Caption;
end;

procedure TListItem.Set_Caption(const Value: WideString);
begin
  DefaultInterface.Set_Caption(Value);
end;

function  TListItem.Get_Index: Integer;
begin
  Result := DefaultInterface.Get_Index;
end;

function  TListItem.Get_Checked: WordBool;
begin
  Result := DefaultInterface.Get_Checked;
end;

procedure TListItem.Set_Checked(Value: WordBool);
begin
  DefaultInterface.Set_Checked(Value);
end;

function  TListItem.Get_SubItems: IStrings;
begin
  Result := DefaultInterface.Get_SubItems;
end;

procedure TListItem.Set_SubItems(const Value: IStrings);
begin
  DefaultInterface.Set_SubItems(Value);
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TListItemProperties.Create(AServer: TListItem);
begin
  inherited Create;
  FServer := AServer;
end;

function TListItemProperties.GetDefaultInterface: IListItem;
begin
  Result := FServer.DefaultInterface;
end;

function  TListItemProperties.Get_Caption: WideString;
begin
  Result := DefaultInterface.Get_Caption;
end;

procedure TListItemProperties.Set_Caption(const Value: WideString);
begin
  DefaultInterface.Set_Caption(Value);
end;

function  TListItemProperties.Get_Index: Integer;
begin
  Result := DefaultInterface.Get_Index;
end;

function  TListItemProperties.Get_Checked: WordBool;
begin
  Result := DefaultInterface.Get_Checked;
end;

procedure TListItemProperties.Set_Checked(Value: WordBool);
begin
  DefaultInterface.Set_Checked(Value);
end;

function  TListItemProperties.Get_SubItems: IStrings;
begin
  Result := DefaultInterface.Get_SubItems;
end;

procedure TListItemProperties.Set_SubItems(const Value: IStrings);
begin
  DefaultInterface.Set_SubItems(Value);
end;

{$ENDIF}

class function CoListItems.Create: IListItems;
begin
  Result := CreateComObject(CLASS_ListItems) as IListItems;
end;

class function CoListItems.CreateRemote(const MachineName: string): IListItems;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_ListItems) as IListItems;
end;

procedure TListItems.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{C6B36446-88B1-11D2-9261-00104B700B61}';
    IntfIID:   '{C6B36444-88B1-11D2-9261-00104B700B61}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TListItems.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as IListItems;
  end;
end;

procedure TListItems.ConnectTo(svrIntf: IListItems);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TListItems.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TListItems.GetDefaultInterface: IListItems;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TListItems.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TListItemsProperties.Create(Self);
{$ENDIF}
end;

destructor TListItems.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TListItems.GetServerProperties: TListItemsProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TListItems.Get_Item(Index: Integer): IListItem;
begin
  Result := DefaultInterface.Get_Item(Index);
end;

function  TListItems.Get_Count: Integer;
begin
  Result := DefaultInterface.Get_Count;
end;

function  TListItems.Add: IListItem;
begin
  Result := DefaultInterface.Add;
end;

procedure TListItems.Remove(Index: Integer);
begin
  DefaultInterface.Remove(Index);
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TListItemsProperties.Create(AServer: TListItems);
begin
  inherited Create;
  FServer := AServer;
end;

function TListItemsProperties.GetDefaultInterface: IListItems;
begin
  Result := FServer.DefaultInterface;
end;

function  TListItemsProperties.Get_Item(Index: Integer): IListItem;
begin
  Result := DefaultInterface.Get_Item(Index);
end;

function  TListItemsProperties.Get_Count: Integer;
begin
  Result := DefaultInterface.Get_Count;
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents('ActiveX',[TListViewX]);
  RegisterComponents('Servers',[TListItem, TListItems]);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -