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

📄 spreg.pas

📁 一套及时通讯的原码
💻 PAS
字号:
{*******************************************************************}
{                                                                   }
{       Almediadev Visual Component Library                         }
{       DynamicSkinForm                                             }
{       Version 4.98                                                }
{                                                                   }
{       Copyright (c) 2000-2002 Almediadev                          }
{       ALL RIGHTS RESERVED                                         }
{                                                                   }
{       Home:  http://www.almdev.com                                }
{       Support: support@almdev.com                                 }
{                                                                   }
{*******************************************************************}

unit spreg;

{$P+,S-,W-,R-}
{$WARNINGS OFF}
{$HINTS OFF}

interface

uses Classes, Menus, Dialogs, Forms,
    {$IFDEF  VER140} DesignEditors, DesignIntf
    {$ELSE} {$IFDEF  VER150} DesignEditors, DesignIntf {$ELSE} DsgnIntf {$ENDIF} {$ENDIF};

type

  TspSkinPageControlEditor = class(TDefaultEditor)
  public
    procedure ExecuteVerb(Index: Integer); override;
    function GetVerb(Index: Integer): string; override;
    function GetVerbCount: Integer; override;
  end;

procedure Register;

implementation

uses
  SPUtils, SPEffBMP, DynamicSkinForm, SkinData, SkinCtrls, SkinHint, SkinGrids,
  SkinTabs, SysUtils, SkinBoxCtrls, SkinMenus, spTrayIcon, spMessages,
  spSkinZip, spSkinUnZip, spFileCtrl, spSkinShellCtrls, spNBPagesEditor,
  spCalendar;

  { TFilenameProperty }
type
  TspFilenameProperty = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

  TspSkinDataNameProperty = class(TStringProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure GetValueList(List: TStrings); virtual;
    procedure GetValues(Proc: TGetStrProc); override;
  end;

  TspButtonSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspGaugeSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspMenuButtonSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspPanelSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspListBoxSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspCheckListBoxSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  TspComboBoxSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;


  TspSplitterSkinDataNameProperty = class(TspSkinDataNameProperty)
  public
    procedure GetValueList(List: TStrings); override;
  end;

  procedure TspSkinDataNameProperty.GetValueList(List: TStrings);
  begin
  end;

  procedure TspSkinDataNameProperty.GetValues(Proc: TGetStrProc);
  var
    I: Integer;
    Values: TStringList;
  begin
    Values := TStringList.Create;
    try
      GetValueList(Values);
      for I := 0 to Values.Count - 1 do Proc(Values[I]);
    finally
      Values.Free;
    end;
  end;

  function TspSkinDataNameProperty.GetAttributes: TPropertyAttributes;
  begin
    Result := [paValueList];
  end;

  procedure TspButtonSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('button');
    List.Add('resizebutton');
    List.Add('toolbutton');
    List.Add('bigtoolbutton');
  end;

  procedure TspGaugeSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('gauge');
    List.Add('vgauge');
    List.Add('statusgauge');
  end;

  procedure TspMenuButtonSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('toolmenubutton');
    List.Add('bigtoolmenubutton');
    List.Add('toolmenutrackbutton');
    List.Add('bigtoolmenutrackbutton');
  end;

  procedure TspPanelSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('panel');
    List.Add('toolpanel');
    List.Add('bigtoolpanel');
    List.Add('statusbar');
    List.Add('groupbox');
  end;

  procedure TspListBoxSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('listbox');
    List.Add('captionlistbox');
  end;

  procedure TspCheckListBoxSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('checklistbox');
    List.Add('captionchecklistbox');
  end;

  procedure TspComboBoxSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('combobox');
    List.Add('captioncombobox');
  end;

  procedure TspSplitterSkinDataNameProperty.GetValueList(List: TStrings);
  begin
    List.Add('vsplitter');
    List.Add('hsplitter');
  end;

  procedure TspFilenameProperty.Edit;
  var
    FileOpen: TOpenDialog;
  begin
    FileOpen := TOpenDialog.Create(Application);
    try
      FileOpen.Filename := '';
      FileOpen.InitialDir := ExtractFilePath(FileOpen.Filename);
      FileOpen.Filter := '*.*|*.*';
      FileOpen.Options := FileOpen.Options + [ofHideReadOnly];
      if FileOpen.Execute then SetValue(FileOpen.Filename);
    finally
      FileOpen.Free;
    end;
  end;

  function TspFilenameProperty.GetAttributes: TPropertyAttributes;
  begin
    Result := [paDialog , paRevertable];
  end;

type
  TspSetPagesProperty = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure SetValue(const Value: string); override;
   end;

procedure TspSetPagesProperty.Edit;
var
  NB: TspSkinNoteBook;
begin
  try
    NB := TspSkinNoteBook(GetComponent(0));
    spNBPagesEditor.Execute(NB);
  finally
  end;
end;

function TspSetPagesProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

function TspSetPagesProperty.GetValue: string;
begin
  Result := '(Pages)';
end;

procedure TspSetPagesProperty.SetValue(const Value: string);
begin
  if Value = '' then SetOrdValue(0);
end;


{ Registration }

resourcestring
  sTABSHEET_DEFAULT_NAME = 'spSkinTabSheet';
  sNEW_PAGE              = 'New page';
  sDEL_PAGE              = 'Delete page';

procedure Register;
begin
  RegisterComponents('Skin Pack',  [TspDynamicSkinForm,
    TspSkinData, TspStoredSkin, TspCompressedStoredSkin, TspSkinMainMenuBar,
    TspSkinPopupMenu, TspSkinMainMenu, TspTrayIcon,
    TspSkinPanel, TspSkinGroupBox, TspSkinRadioGroup, TspSkinCheckGroup,
    TspSkinButton, TspSkinMenuButton,
    TspSkinSpeedButton, TspSkinMenuSpeedButton,
    TspSkinCheckRadioBox,
    TspSkinGauge, TspSkinTrackBar, TspSkinLabel,
    TspSkinFrameRegulator,
    TspSkinFrameGauge,
    TspSkinXFormButton,
    TspSkinHint, TspSkinDrawGrid, TspSkinStringGrid,
    TspSkinPageControl, TspSkinTabControl,
    TspSkinListBox, TspSkinComboBox, TspSkinEdit, TspSkinMaskEdit,
    TspSkinMemo, TspSkinMemo2,
    TspSkinScrollBar, TspSkinSpinEdit, TspSkinCheckListBox,
    TspSkinStdLabel, TspSkinBitLabel,
    TspSkinAnimate, TspSkinSwitch, TspSkinUpDown,
    TspSkinControlBar, TspSkinSplitter,
    TspSkinScrollBox, TspSkinColorComboBox, TspSkinFontComboBox,
    TspSkinListView, TspSkinTreeView, TspSkinStatusPanel,
    TspSkinRichEdit, TspSkinDateEdit, TspSkinTimeEdit,
    TspSkinMessage, TspSkinZip, TspSkinUnZip, TspSkinTextLabel,
    TspSkinFileListView, TspSkinDirTreeView, TspSkinShellDriveComboBox,
    TspSkinDriveComboBox, TspSkinFilterComboBox,
    TspSkinDirectoryListBox, TspSkinFileListBox,
    TspSkinSelectDirectoryDialog, TspSkinOpenDialog, TspSkinSaveDialog,
    TspSkinOpenPictureDialog, TspSkinSavePictureDialog, TspSkinFontDialog,
    TspSkinInputDialog, TspSkinPasswordDialog, TspSkinProgressDialog, TspSkinTextDialog,
    TspSkinDirectoryEdit, TspSkinFileEdit, TspSkinSaveFileEdit, TspSkinExPanel,
    TspSkinHeaderControl, TspSkinTrackEdit, TspSkinSlider,
    TspSkinLinkLabel, TspSkinLinkImage, TspSkinButtonLabel, TspSkinBevel,
    TspSkinButtonsBar, TspSkinNoteBook, TspSkinMonthCalendar]);

  RegisterClass(TspSkinTabSheet);

  RegisterPropertyEditor(TypeInfo(string), TspStoredSkin, 'FileName', TspFilenameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspCompressedStoredSkin, 'FileName', TspFilenameProperty);

  RegisterPropertyEditor(TypeInfo(string), TspSkinListView, 'HeaderSkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinOpenDialog, 'LVHeaderSkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinSaveDialog, 'LVHeaderSkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinOpenPictureDialog, 'LVHeaderSkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinSavePictureDialog, 'LVHeaderSkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinButton, 'SkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinHeaderControl, 'SkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinGauge, 'SkinDataName', TspGaugeSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinMenuButton, 'SkinDataName', TspMenuButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinSpeedButton, 'SkinDataName', TspButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinMenuSpeedButton, 'SkinDataName', TspMenuButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinPanel, 'SkinDataName', TspPanelSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinListBox, 'SkinDataName', TspListBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinCheckListBox, 'SkinDataName', TspCheckListBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinSplitter, 'SkinDataName', TspSplitterSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TspSkinComboBox, 'SkinDataName', TspComboBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(TStrings),  TspSkinNoteBook, 'Pages', TspSetPagesProperty);
  
  RegisterComponentEditor(TspSkinPageControl, TspSkinPageControlEditor);
  RegisterComponentEditor(TspSkinTabSheet, TspSkinPageControlEditor);
  
end;

function TspSkinPageControlEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0:  result := sNEW_PAGE;
    1:  result := sDEL_PAGE;
  end;
end;


procedure TspSkinPageControlEditor.ExecuteVerb(Index: Integer);
var
  NewPage: TspSkinCustomTabSheet;
  PControl : TspSkinPageControl;
begin
  if Component is TspSkinPageControl then
    PControl := TspSkinPageControl(Component)
  else PControl := TspSkinPageControl(TspSkinTabSheet(Component).PageControl);

  case Index of
    0:  begin  //  New Page
          NewPage := TspSkinTabSheet.Create(Designer.GetRoot);
          with NewPage do
          begin
            Parent      := PControl;
            PageControl := PControl;
            Caption     := sTABSHEET_DEFAULT_NAME + IntToStr(PControl.PageCount);
            Name        := Caption;
          end;
        end;
    1:  begin  //  Delete Page
          with PControl do
          begin
            NewPage := TspSkinCustomTabSheet(ActivePage);
            NewPage.PageControl := nil;
            NewPage.Free;
          end;
        end;
  end;
  if Designer <> nil then Designer.Modified;
end;

function TspSkinPageControlEditor.GetVerbCount: Integer;
begin
  result := 2;
end;


end.

⌨️ 快捷键说明

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