bsReg.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:15k
- {*******************************************************************}
- { }
- { Almediadev Visual Component Library }
- { BusinessSkinForm }
- { Version 1.98 }
- { }
- { Copyright (c) 2000-2003 Almediadev }
- { ALL RIGHTS RESERVED }
- { }
- { Home: http://www.almdev.com }
- { Support: support@almdev.com }
- { }
- {*******************************************************************}
- unit bsreg;
- {$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
- TbsSkinPageControlEditor = class(TDefaultEditor)
- public
- procedure ExecuteVerb(Index: Integer); override;
- function GetVerb(Index: Integer): string; override;
- function GetVerbCount: Integer; override;
- end;
- procedure Register;
- implementation
- uses
- bsUtils, BusinessSkinForm, bsSkinData, bsSkinCtrls, bsSkinHint, bsSkinGrids,
- bsSkinTabs, SysUtils, bsSkinBoxCtrls, bsSkinMenus, bsTrayIcon,
- bsDBGrids, bsDBCtrls, DB, bsCalc, bsMessages, bsSkinZip, bsSkinUnZip,
- bsFileCtrl, bsSkinShellCtrls, NBPagesEditor, bsCalendar;
- { TColumnDataFieldEditor }
- type
- { TFilenameProperty }
- TbsFilenameProperty = class(TStringProperty)
- public
- procedure Edit; override;
- function GetAttributes: TPropertyAttributes; override;
- end;
- TbsDBStringProperty = class(TStringProperty)
- public
- function GetAttributes: TPropertyAttributes; override;
- procedure GetValueList(List: TStrings); virtual;
- procedure GetValues(Proc: TGetStrProc); override;
- end;
- TbsSkinDataNameProperty = class(TStringProperty)
- public
- function GetAttributes: TPropertyAttributes; override;
- procedure GetValueList(List: TStrings); virtual;
- procedure GetValues(Proc: TGetStrProc); override;
- end;
- TbsButtonSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsGaugeSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsMenuButtonSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsPanelSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsListBoxSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsComboBoxSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsCheckListBoxSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- TbsSplitterSkinDataNameProperty = class(TbsSkinDataNameProperty)
- public
- procedure GetValueList(List: TStrings); override;
- end;
- procedure TbsSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- end;
- procedure TbsSkinDataNameProperty.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 TbsSkinDataNameProperty.GetAttributes: TPropertyAttributes;
- begin
- Result := [paValueList];
- end;
- procedure TbsButtonSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('button');
- List.Add('resizebutton');
- List.Add('toolbutton');
- List.Add('bigtoolbutton');
- end;
- procedure TbsGaugeSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('gauge');
- List.Add('vgauge');
- List.Add('statusgauge');
- end;
- procedure TbsMenuButtonSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('toolmenubutton');
- List.Add('bigtoolmenubutton');
- List.Add('toolmenutrackbutton');
- List.Add('bigtoolmenutrackbutton');
- end;
- procedure TbsPanelSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('panel');
- List.Add('toolpanel');
- List.Add('bigtoolpanel');
- List.Add('statusbar');
- List.Add('groupbox');
- end;
- procedure TbsListBoxSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('listbox');
- List.Add('captionlistbox');
- end;
- procedure TbsComboBoxSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('combobox');
- List.Add('captioncombobox');
- end;
- procedure TbsCheckListBoxSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('checklistbox');
- List.Add('captionchecklistbox');
- end;
- procedure TbsSplitterSkinDataNameProperty.GetValueList(List: TStrings);
- begin
- List.Add('vsplitter');
- List.Add('hsplitter');
- end;
- procedure TbsFilenameProperty.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 TbsFilenameProperty.GetAttributes: TPropertyAttributes;
- begin
- Result := [paDialog , paRevertable];
- end;
- function TbsDBStringProperty.GetAttributes: TPropertyAttributes;
- begin
- Result := [paValueList, paSortList, paMultiSelect];
- end;
- procedure TbsDBStringProperty.GetValueList(List: TStrings);
- begin
- end;
- procedure TbsDBStringProperty.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;
- type
- TbsColumnDataFieldProperty = class(TbsDBStringProperty)
- procedure GetValueList(List: TStrings); override;
- end;
- procedure TbsColumnDataFieldProperty.GetValueList(List: TStrings);
- var
- Grid: TbsSkinCustomDBGrid;
- DataSource: TDataSource;
- begin
- Grid := (GetComponent(0) as TbsColumn).Grid;
- if (Grid = nil) then Exit;
- DataSource := Grid.DataSource;
- if (DataSource <> nil) and (DataSource.DataSet <> nil) then
- DataSource.DataSet.GetFieldNames(List);
- end;
- type
- TbsSkinDBLookUpListBoxFieldProperty = class(TbsDBStringProperty)
- procedure GetValueList(List: TStrings); override;
- end;
- procedure TbsSkinDBLookUpListBoxFieldProperty.GetValueList(List: TStrings);
- var
- DataSource: TDataSource;
- LookUpControl: TbsDBLookUpControl;
- begin
- DataSource := (GetComponent(0) as TbsSkinDBLookUpListBox).ListSource;
- if (DataSource <> nil) and (DataSource.DataSet <> nil) then
- DataSource.DataSet.GetFieldNames(List);
- end;
- type
- TbsSkinDBLookUpComboBoxFieldProperty = class(TbsDBStringProperty)
- procedure GetValueList(List: TStrings); override;
- end;
- procedure TbsSkinDBLookUpComboBoxFieldProperty.GetValueList(List: TStrings);
- var
- DataSource: TDataSource;
- LookUpControl: TbsDBLookUpControl;
- begin
- DataSource := (GetComponent(0) as TbsSkinDBLookUpComboBox).ListSource;
- if (DataSource <> nil) and (DataSource.DataSet <> nil) then
- DataSource.DataSet.GetFieldNames(List);
- end;
- type
- TbsSetPagesProperty = class(TPropertyEditor)
- public
- procedure Edit; override;
- function GetAttributes: TPropertyAttributes; override;
- function GetValue: string; override;
- procedure SetValue(const Value: string); override;
- end;
- procedure TbsSetPagesProperty.Edit;
- var
- NB: TbsSkinNoteBook;
- begin
- try
- NB := TbsSkinNoteBook(GetComponent(0));
- NBPagesEditor.Execute(NB);
- finally
- end;
- end;
- function TbsSetPagesProperty.GetAttributes: TPropertyAttributes;
- begin
- Result := [paDialog];
- end;
- function TbsSetPagesProperty.GetValue: string;
- begin
- Result := '(Pages)';
- end;
- procedure TbsSetPagesProperty.SetValue(const Value: string);
- begin
- if Value = '' then SetOrdValue(0);
- end;
- { Registration }
- resourcestring
- sTABSHEET_DEFAULT_NAME = 'bsSkinTabSheet';
- sNEW_PAGE = 'New page';
- sDEL_PAGE = 'Delete page';
- procedure Register;
- begin
- RegisterComponents('BusinessSkinForm VCL', [TbsBusinessSkinForm,
- TbsSkinData, TbsCompressedStoredSkin, TbsStoredSkin, TbsSkinMainMenuBar,
- TbsSkinPopupMenu, TbsSkinMainMenu, TbsTrayIcon,
- TbsSkinPanel, TbsSkinGroupBox, TbsSkinRadioGroup, TbsSkinCheckGroup,
- TbsSkinSpeedButton, TbsSkinMenuSpeedButton,
- TbsSkinButton, TbsSkinCheckRadioBox,
- TbsSkinGauge, TbsSkinTrackBar, TbsSkinLabel,
- TbsSkinHint, TbsSkinDrawGrid, TbsSkinStringGrid,
- TbsSkinPageControl, TbsSkinTabControl,
- TbsSkinListBox, TbsSkinComboBox, TbsSkinEdit, TbsSkinMaskEdit,
- TbsSkinMemo, TbsSkinMemo2,
- TbsSkinScrollBar, TbsSkinSpinEdit, TbsSkinCheckListBox,
- TbsSkinStdLabel, TbsSkinUpDown,
- TbsSkinControlBar, TbsSkinSplitter, TbsSkinMenuButton,
- TbsSkinScrollBox, TbsSkinColorComboBox, TbsSkinFontComboBox,
- TbsSkinTreeView, TbsSkinListView, TbsSkinStatusPanel,
- TbsSkinRichEdit, TbsSkinDateEdit, TbsSkinCalculator, TbsSkinCalcEdit,
- TbsSkinMessage, TbsSkinZip, TbsSkinUnZip, TbsSkinTextLabel,
- TbsSkinFileListBox, TbsSkinDirectoryListBox, TbsSkinDriveComboBox,
- TbsSkinFilterComboBox, TbsSkinFileListView, TbsSkinDirTreeView,
- TbsSkinShellDriveComboBox,
- TbsSkinSelectDirectoryDialog, TbsSkinOpenDialog, TbsSkinSaveDialog,
- TbsSkinOpenPictureDialog, TbsSkinSavePictureDialog,
- TbsSkinInputDialog, TbsSkinPasswordDialog, TbsSkinTextDialog,
- TbsSkinDirectoryEdit, TbsSkinFileEdit, TbsSkinSaveFileEdit,
- TbsSkinExPanel, TbsSkinFontDialog, TbsSkinProgressDialog,
- TbsSkinTrackEdit, TbsSkinHeaderControl, TbsSkinLinkLabel, TbsSkinLinkImage,
- TbsSkinButtonLabel, TbsSkinSlider, TbsSkinTimeEdit,
- TbsSkinBevel, TbsSkinButtonsBar, TbsSkinNoteBook, TbsSkinMonthCalendar,
- TbsSkinXFormButton]);
- RegisterComponents('BusinessSkinForm DB VCL',
- [TbsSkinDBGrid, TbsSkinDBText,
- TbsSkinDBEdit, TbsSkinDBMemo, TbsSkinDBMemo2,
- TbsSkinDBCheckRadioBox, TbsSkinDBListBox, TbsSkinDBComboBox,
- TbsSkinDBNavigator, TbsSkinDBImage, TbsSkinDBRadioGroup,
- TbsSkinDBSpinEdit, TbsSkinDBRichEdit,
- TbsSkinDBLookUpListBox, TbsSkinDBLookUpComboBox,
- TbsSkinDBCalcEdit, TbsSkinDBDateEdit, TbsSkinDBTimeEdit]);
- RegisterClass(TbsSkinTabSheet);
- RegisterComponentEditor(TbsSkinPageControl, TbsSkinPageControlEditor);
- RegisterComponentEditor(TbsSkinTabSheet, TbsSkinPageControlEditor);
- RegisterPropertyEditor(TypeInfo(string), TbsColumn, 'FieldName', TbsColumnDataFieldProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsStoredSkin, 'FileName', TbsFilenameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsCompressedStoredSkin, 'FileName', TbsFilenameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpListBox, 'KeyField', TbsSkinDBLookUpListBoxFieldProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpListBox, 'ListField', TbsSkinDBLookUpListBoxFieldProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpComboBox, 'KeyField', TbsSkinDBLookUpComboBoxFieldProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpComboBox, 'ListField', TbsSkinDBLookUpComboBoxFieldProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinButton, 'SkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinHeaderControl, 'SkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinListView, 'HeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinFileEdit, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinSaveFileEdit, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinOpenDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinOpenPictureDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinSaveDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinSavePictureDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinGauge, 'SkinDataName', TbsGaugeSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinMenuButton, 'SkinDataName', TbsMenuButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinSpeedButton, 'SkinDataName', TbsButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinMenuSpeedButton, 'SkinDataName', TbsMenuButtonSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinPanel, 'SkinDataName', TbsPanelSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinComboBox, 'SkinDataName', TbsComboBoxSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinListBox, 'SkinDataName', TbsListBoxSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinCheckListBox, 'SkinDataName', TbsCheckListBoxSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(string), TbsSkinSplitter, 'SkinDataName', TbsSplitterSkinDataNameProperty);
- RegisterPropertyEditor(TypeInfo(TStrings), TbsSkinNoteBook, 'Pages', TbsSetPagesProperty);
- end;
- function TbsSkinPageControlEditor.GetVerb(Index: Integer): string;
- begin
- case Index of
- 0: result := sNEW_PAGE;
- 1: result := sDEL_PAGE;
- end;
- end;
- procedure TbsSkinPageControlEditor.ExecuteVerb(Index: Integer);
- var
- NewPage: TbsSkinCustomTabSheet;
- PControl : TbsSkinPageControl;
- begin
- if Component is TbsSkinPageControl then
- PControl := TbsSkinPageControl(Component)
- else PControl := TbsSkinPageControl(TbsSkinTabSheet(Component).PageControl);
- case Index of
- 0: begin // New Page
- NewPage := TbsSkinTabSheet.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 := TbsSkinCustomTabSheet(ActivePage);
- NewPage.PageControl := nil;
- NewPage.Free;
- end;
- end;
- end;
- if Designer <> nil then Designer.Modified;
- end;
- function TbsSkinPageControlEditor.GetVerbCount: Integer;
- begin
- result := 4;
- end;
- end.