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

📄 spropeditors.pas

📁 Alpha Controls 5.40,delphi上的alpha开发源码控件包。没有密码。5.40版的最新版。
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  inherited;
  sm := TsSkinManager(Component);
  Application.CreateForm(TFormInternalSkins, FormInternalSkins);
//  SkinForm(FormInternalSkins);
  FormInternalSkins.ListBox1.Clear;
  FormInternalSkins.SkinManager := sm;
  for i := 0 to sm.InternalSkins.Count - 1 do begin
    FormInternalSkins.ListBox1.Items.Add(sm.InternalSkins.Items[i].Name);
  end;
  FormInternalSkins.ShowModal;
//  UnSkinForm(FormInternalSkins);
  if Assigned(FormInternalSkins) then FreeAndNil(FormInternalSkins);
  if Designer <> nil then Designer.Modified;
end;

function TsInternalSkinsEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0 : Result := '&Internal skins...';
    1 : Result := '-';
  end;
end;

function TsInternalSkinsEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

{$IFNDEF ALITE}
{ TsImageListEditor }

procedure TsImageListEditor.ExecuteVerb(Index: Integer);
var
  Form : TFormImgListEditor;
begin
  case Index of
    0:  begin
      Application.CreateForm(TFormImgListEditor, Form);
      Form.InitFromImgList(Component as TsImageList);
      Form.ShowModal;
      FreeAndNil(Form);
    end;
  end;
  if Designer <> nil then Designer.Modified;
end;

function TsImageListEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0:  result := '&ImageList editor...';
  end;
end;

function TsImageListEditor.GetVerbCount: Integer;
begin
  result := 1;
end;

{ TsTabSheetEditor }

procedure TsTabSheetEditor.ExecuteVerb(Index: Integer);
var
  NewPage: TsTabSheet;
begin
  case Index of
    0: begin
      NewPage := TsTabSheet.Create(Designer.GetRoot);
      NewPage.Parent := TsTabSheet(Component).PageControl;
      NewPage.PageControl := TsTabSheet(Component).PageControl;
      NewPage.Caption := Designer.UniqueName('sTabSheet');
      NewPage.Name := NewPage.Caption;
    end;
    1: begin
      NewPage := TsTabSheet(TsTabSheet(Component).PageControl.ActivePage);
      NewPage.Free;
    end;
    2: begin
      TsTabSheet(Component).PageControl.SelectNextPage(True);
    end;
    3: begin
      TsTabSheet(Component).PageControl.SelectNextPage(False);
    end;
  end;
  if Designer <> nil then Designer.Modified;
end;

function TsTabSheetEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0:  result := 'New Page';
    1:  result := 'Delete Page';
    2:  result := 'Next Page';
    3:  result := 'Previous Page';
  end;
end;

function TsTabSheetEditor.GetVerbCount: Integer;
begin
  result := 4;
end;


{ TsCtrlCollectionProperty }

procedure TsCtrlCollectionProperty.Edit;
begin
{  Application.CreateForm(TsAdapterEditForm, sAdapterEditForm);
  sAdapterEditForm.Adapter := TsCtrlAdapter(GetComponent(0));
  sAdapterEditForm.ShowModal;
  if Assigned(sAdapterEditForm) then FreeAndNil(sAdapterEditForm);
  inherited;}
end;

function TsCtrlCollectionProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paAutoUpdate];
end;

{ TsCtrlCollectionEditor }

procedure TsCtrlCollectionEditor.ExecuteVerb(Index: Integer);
begin
{  inherited;
  Application.CreateForm(TsAdapterEditForm, sAdapterEditForm);
  sAdapterEditForm.Adapter := TsCtrlAdapter(Component);
  sAdapterEditForm.ShowModal;
  if Assigned(sAdapterEditForm) then FreeAndNil(sAdapterEditForm);
  if Designer <> nil then Designer.Modified;}
end;

function TsCtrlCollectionEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0 : Result := '&Adapter editor...';
    1 : Result := '-';
  end;
end;

function TsCtrlCollectionEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

{ TsHintProperty }

procedure TsHintProperty.Edit;
var
  Temp: string;
  Comp: TPersistent;
  I, Cnt: Integer;
  sed : TStrEditDlg;
begin
  sed := TStrEditDlg.Create(Application);
  with sed do try
//    SkinForm(sed);
    Comp := GetComponent(0);
    if Comp is TComponent
      then Caption := TComponent(Comp).Name + '.' + GetName
      else Caption := GetName;
    Temp := GetStrValue;
    Cnt := WordCount(Temp, [#13, #10]);
    for I := 1 to Cnt do Memo.Lines.Add(ExtractWord(I, Temp, [#13, #10]));

    Memo.MaxLength := GetEditLimit;
    UpdateStatus(nil);
    if ShowModal = mrOk then begin
      Temp := Memo.Text;
      while (Length(Temp) > 0) and (Temp[Length(Temp)] < ' ') do System.Delete(Temp, Length(Temp), 1);

      SetStrValue(Temp);
      if Designer <> nil then Designer.Modified;
    end;
  finally
//    UnSkinForm(sed);
    Free;
  end;
end;

function TsHintProperty.GetAttributes: TPropertyAttributes;
begin
  Result := inherited GetAttributes + [paDialog, paAutoUpdate];
end;

function TsHintProperty.GetEditLimit: Integer;
begin
  if GetPropType^.Kind = tkString then Result := GetTypeData(GetPropType)^.MaxLength else Result := 1024;
end;

{ TsPathDlgEditor }

procedure TsPathDlgEditor.ExecuteVerb(Index: Integer);
begin
  inherited;
  TsPathDialog(Component).Execute;
end;

function TsPathDlgEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0 : Result := '&Test dialog...';
    1 : Result := '-';
  end;
end;

function TsPathDlgEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

{ TacSkinInfoProperty }

procedure TacSkinInfoProperty.Edit;
begin
//  GetComponent(0)
  if TsSkinManager(GetComponent(0)).SkinData.Active then begin
    SkinInfoForm := TSkinInfoForm.Create(Application);
//    SkinForm(SkinInfoForm);
    SkinInfoForm.sMemo1.Lines.Add('Name : ' + TsSkinManager(GetComponent(0)).SkinName);
    SkinInfoForm.sMemo1.Lines.Add('Version : ' + TsSkinManager(GetComponent(0)).SkinInfo);
    SkinInfoForm.sMemo1.Lines.Add('Author : ' + TsSkinManager(GetComponent(0)).SkinData.Author);
    SkinInfoForm.sMemo1.Lines.Add('Description : ' + TsSkinManager(GetComponent(0)).SkinData.Description);
    if TsSkinManager(GetComponent(0)).SkinData.Version < CompatibleSkinVersion then begin
      SkinInfoForm.Label1.Visible := True
    end;
    try
      SkinInfoForm.ShowModal;
    finally
//      UnSkinForm(SkinInfoForm);
      FreeAndNil(SkinInfoForm);
    end;
  end
  else MessageDlg('', mtInformation, [mbOK], 0);
end;

function TacSkinInfoProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly];
end;

{ TsFrameBarEditor }

procedure TsFrameBarEditor.ExecuteVerb(Index: Integer);
begin
  inherited;
  ShowCollectionEditor(Designer, Component, (Component as TsFrameBar).Items, 'Items');
end;

function TsFrameBarEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0 : Result := '&Items editor...';
    1 : Result := '-';
  end;
end;

function TsFrameBarEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

{$ENDIF}

{ TsSkinSectionProperty }

function TsSkinSectionProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paValueList, paSortList, paAutoUpdate, paMultiSelect];
end;

procedure TsSkinSectionProperty.GetValues(Proc: TGetStrProc);
var
  i, l : integer;
begin
  inherited;
  if Assigned(DefaultManager) and (Length(DefaultManager.gd) > 0) then begin
    l := Length(DefaultManager.gd);
    for i := 0 to l - 1 do if DefaultManager.gd[i].ClassName <> s_GlobalInfo then Proc(DefaultManager.gd[i].ClassName);
  end;
end;

{ TacImageIndexEditor }

function TacImageIndexEditor.GetAttributes: TPropertyAttributes;
begin
  Result := [paMultiSelect, paValueList, paRevertable];
end;

function TacImageIndexEditor.GetMyList: TCustomImageList;
begin
  Result := TCustomImageList(GetObjectProp(GetComponent(0), 'Images', TObject));
end;

procedure TacImageIndexEditor.GetValues(Proc: TGetStrProc);
var
  i: Integer;
  MyList: TCustomImageList;
begin
  MyList := GetMyList;
  if Assigned(MyList) then
  for i := 0 to MyList.Count-1 do Proc(IntToStr(i));
end;

procedure TacImageIndexEditor.ListDrawValue(const Value: string; ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
var
  MyLeft: Integer;
  MyList: TCustomImageList;
begin
  ACanvas.FillRect(ARect);
  MyList := GetMyList;
  MyLeft := ARect.Left + 2;
  if Assigned(MyList) then begin
    MyList.Draw(ACanvas,MyLeft, ARect.Top + 2, StrToInt(Value));
    Inc(MyLeft, MyList.Width);
  end;
  ACanvas.TextOut(MyLeft + 2, ARect.Top + 1,Value);
end;

procedure TacImageIndexEditor.ListMeasureHeight(const Value: string; ACanvas: TCanvas; var AHeight: Integer);
var
  MyList: TCustomImageList;
begin
  MyList := GetMyList;
  AHeight := ACanvas.TextHeight(Value) + 2;
  if Assigned(MyList) and (MyList.Height + 4 > AHeight) then AHeight := MyList.Height + 4;
end;

procedure TacImageIndexEditor.ListMeasureWidth(const Value: string; ACanvas: TCanvas; var AWidth: Integer);
var
  MyList: TCustomImageList;
begin
  MyList := GetMyList;
  AWidth := ACanvas.TextWidth(Value) + 4;
  if Assigned(MyList) then Inc(AWidth, MyList.Width);
end;

end.



⌨️ 快捷键说明

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