git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.DevExpressVCL@8 05c56307-c608-d34a-929d-697000501d7a
303 lines
10 KiB
ObjectPascal
303 lines
10 KiB
ObjectPascal
{*******************************************************************}
|
|
{ }
|
|
{ Developer Express Visual Component Library }
|
|
{ ExpressBars components }
|
|
{ }
|
|
{ Copyright (c) 1998-2007 Developer Express Inc. }
|
|
{ ALL RIGHTS RESERVED }
|
|
{ }
|
|
{ The entire contents of this file is protected by U.S. and }
|
|
{ International Copyright Laws. Unauthorized reproduction, }
|
|
{ reverse-engineering, and distribution of all or any portion of }
|
|
{ the code contained in this file is strictly prohibited and may }
|
|
{ result in severe civil and criminal penalties and will be }
|
|
{ prosecuted to the maximum extent possible under the law. }
|
|
{ }
|
|
{ RESTRICTIONS }
|
|
{ }
|
|
{ THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES }
|
|
{ (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE }
|
|
{ SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS }
|
|
{ LICENSED TO DISTRIBUTE THE EXPRESSBARS AND ALL ACCOMPANYING VCL }
|
|
{ CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY. }
|
|
{ }
|
|
{ THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED }
|
|
{ FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE }
|
|
{ COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE }
|
|
{ AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT }
|
|
{ AND PERMISSION FROM DEVELOPER EXPRESS INC. }
|
|
{ }
|
|
{ CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON }
|
|
{ ADDITIONAL RESTRICTIONS. }
|
|
{ }
|
|
{*******************************************************************}
|
|
|
|
unit dxRibbonReg;
|
|
|
|
{$I cxVer.inc}
|
|
|
|
interface
|
|
|
|
procedure Register;
|
|
|
|
implementation
|
|
|
|
uses
|
|
ColnEdit,
|
|
{$IFDEF DELPHI6}
|
|
DesignEditors, DesignIntf,
|
|
{$ELSE}
|
|
DsgnIntf,
|
|
{$ENDIF}
|
|
Classes, Graphics, cxLibraryReg, dxBarReg, dxRibbon, ComCtrls, cxClasses,
|
|
cxDesignWindows, dxBarSkin, dxRibbonSkins, dxStatusBar, dxRibbonStatusBar,
|
|
TypInfo, dxBar, cxComponentCollectionEditor;
|
|
|
|
type
|
|
{ TdxRibbonDesignEditor }
|
|
|
|
TdxRibbonDesignEditor = class(TComponentEditor)
|
|
private
|
|
function GetRibbon: TdxCustomRibbon;
|
|
public
|
|
procedure ExecuteVerb(Index: Integer); override;
|
|
function GetVerb(Index: Integer): string; override;
|
|
function GetVerbCount: Integer; override;
|
|
property Ribbon: TdxCustomRibbon read GetRibbon;
|
|
end;
|
|
|
|
{ TdxRibbonColorSchemeNameProperty }
|
|
|
|
TdxRibbonColorSchemeNameProperty = class(TStringProperty)
|
|
protected
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
procedure GetValues(Proc: TGetStrProc); override;
|
|
procedure SetValue(const Value: string); override;
|
|
end;
|
|
|
|
{ TdxRibbonQuickAccessGroupButtonToolbarProperty }
|
|
|
|
TdxRibbonQuickAccessGroupButtonToolbarProperty = class(TComponentProperty)
|
|
private
|
|
function GetRibbon: TdxCustomRibbon;
|
|
public
|
|
function GetAttributes: TPropertyAttributes; override;
|
|
procedure GetValues(Proc: TGetStrProc); override;
|
|
end;
|
|
|
|
{ TdxRibbonStatusBarEditor }
|
|
|
|
TdxRibbonStatusBarEditor = class(TComponentEditor)
|
|
public
|
|
procedure ExecuteVerb(Index: Integer); override;
|
|
function GetVerb(Index: Integer): string; override;
|
|
function GetVerbCount: Integer; override;
|
|
end;
|
|
|
|
{$IFDEF DELPHI6}
|
|
TdxRibbonStatusBarSelectionEditor = class(TSelectionEditor)
|
|
public
|
|
procedure RequiresUnits(Proc: TGetStrProc); override;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{ TdxBarProperty }
|
|
|
|
TdxBarProperty = class(TComponentProperty)
|
|
private
|
|
FProc: TGetPropProc;
|
|
procedure GetPropProc({$IFNDEF DELPHI6}Prop: TPropertyEditor{$ELSE}const Prop: IProperty{$ENDIF});
|
|
public
|
|
procedure GetProperties(Proc: TGetPropProc); override;
|
|
end;
|
|
|
|
procedure Register;
|
|
begin
|
|
{$IFDEF DELPHI9}
|
|
ForceDemandLoadState(dlDisable);
|
|
{$ENDIF}
|
|
RegisterComponents('ExpressBars', [TdxRibbon, TdxRibbonPopupMenu, TdxRibbonStatusBar]);
|
|
RegisterNoIcon([TdxRibbonGroupsDockControl, TdxRibbonQuickAccessGroupButton, TdxRibbonTab]);
|
|
RegisterComponentEditor(TdxCustomRibbon, TdxRibbonDesignEditor);
|
|
RegisterComponentEditor(TdxRibbonStatusBar, TdxRibbonStatusBarEditor);
|
|
RegisterPropertyEditor(TypeInfo(string), TdxCustomRibbon, 'ColorSchemeName',
|
|
TdxRibbonColorSchemeNameProperty);
|
|
RegisterPropertyEditor(TypeInfo(TdxBar), TdxRibbonQuickAccessGroupButton, 'Toolbar',
|
|
TdxRibbonQuickAccessGroupButtonToolbarProperty);
|
|
RegisterPropertyEditor(TypeInfo(TBitmap), TdxRibbonApplicationButton, 'Glyph', TcxBitmapProperty);
|
|
RegisterPropertyEditor(TypeInfo(TdxBar), nil, '', TdxBarProperty);
|
|
|
|
HideClassProperties(TdxRibbonQuickAccessGroupButton, ['Action', 'Align',
|
|
'Caption', 'Category', 'Description', 'Hint', 'MergeKind', 'MergeOrder',
|
|
'Style']);
|
|
end;
|
|
|
|
{ TdxRibbonColorSchemeNameProperty }
|
|
|
|
function TdxRibbonColorSchemeNameProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
Result := inherited GetAttributes + [{paReadOnly,} paValueList, paRevertable]
|
|
-[paReadOnly];
|
|
end;
|
|
|
|
procedure TdxRibbonColorSchemeNameProperty.GetValues(Proc: TGetStrProc);
|
|
var
|
|
I: Integer;
|
|
begin
|
|
for I := 0 to SkinManager.SkinCount - 1 do
|
|
if SkinManager[I] is TdxCustomRibbonSkin then
|
|
Proc(SkinManager[I].Name);
|
|
end;
|
|
|
|
procedure TdxRibbonColorSchemeNameProperty.SetValue(const Value: string);
|
|
var
|
|
I: Integer;
|
|
begin
|
|
for I := 0 to PropCount - 1 do
|
|
begin
|
|
TdxCustomRibbon(GetComponent(I)).ColorSchemeName := Value;
|
|
end;
|
|
end;
|
|
|
|
{ TdxRibbonDesignEditor }
|
|
|
|
procedure TdxRibbonDesignEditor.ExecuteVerb(Index: Integer);
|
|
begin
|
|
case Index of
|
|
0: ShowFormEditorClass(Designer, Component, Ribbon.Tabs, 'Tabs', TfrmComponentCollectionEditor);
|
|
3: OpenWebPage('http://www.devexpress.com');
|
|
end;
|
|
end;
|
|
|
|
function TdxRibbonDesignEditor.GetRibbon: TdxCustomRibbon;
|
|
begin
|
|
Result := Component as TdxCustomRibbon;
|
|
end;
|
|
|
|
function TdxRibbonDesignEditor.GetVerb(Index: Integer): string;
|
|
begin
|
|
Result := '';
|
|
case Index of
|
|
0: Result := 'Tabs Editor...';
|
|
1: Result := '-';
|
|
2: Result := 'ExpressBars ' + dxBarVersion;
|
|
3: Result := dxCompanyName;
|
|
end;
|
|
end;
|
|
|
|
function TdxRibbonDesignEditor.GetVerbCount: Integer;
|
|
begin
|
|
Result := 4;
|
|
end;
|
|
|
|
{ TdxRibbonQuickAccessGroupButtonToolbarProperty }
|
|
|
|
function TdxRibbonQuickAccessGroupButtonToolbarProperty.GetAttributes: TPropertyAttributes;
|
|
begin
|
|
Result := inherited GetAttributes - [paMultiSelect];
|
|
end;
|
|
|
|
procedure TdxRibbonQuickAccessGroupButtonToolbarProperty.GetValues(Proc: TGetStrProc);
|
|
var
|
|
AGroupButton: TdxRibbonQuickAccessGroupButton;
|
|
AList: TStringList;
|
|
ARibbon: TdxCustomRibbon;
|
|
AToolbar: TdxBar;
|
|
I, J: Integer;
|
|
begin
|
|
ARibbon := GetRibbon;
|
|
if ARibbon = nil then
|
|
Exit;
|
|
AGroupButton := TdxRibbonQuickAccessGroupButton(GetComponent(0));
|
|
AList := TStringList.Create;
|
|
try
|
|
for I := 0 to ARibbon.TabCount - 1 do
|
|
for J := 0 to ARibbon.Tabs[I].Groups.Count - 1 do
|
|
begin
|
|
AToolbar := ARibbon.Tabs[I].Groups[J].Toolbar;
|
|
if (AToolbar <> nil) and (AList.IndexOf(AToolbar.Name) = -1) and AGroupButton.IsToolbarAcceptable(AToolbar) then
|
|
AList.Add(AToolbar.Name);
|
|
end;
|
|
if (AGroupButton.Toolbar <> nil) and (AList.IndexOf(AGroupButton.Toolbar.Name) = -1) then
|
|
AList.Add(AGroupButton.Toolbar.Name);
|
|
for I := 0 to AList.Count - 1 do
|
|
Proc(AList[I]);
|
|
finally
|
|
AList.Free;
|
|
end;
|
|
end;
|
|
|
|
function TdxRibbonQuickAccessGroupButtonToolbarProperty.GetRibbon: TdxCustomRibbon;
|
|
var
|
|
AGroupButton: TdxRibbonQuickAccessGroupButton;
|
|
begin
|
|
AGroupButton := TdxRibbonQuickAccessGroupButton(GetComponent(0));
|
|
if AGroupButton.LinkCount = 0 then
|
|
Result := nil
|
|
else
|
|
Result := TdxRibbonQuickAccessBarControl(AGroupButton.Links[0].BarControl).Ribbon;
|
|
end;
|
|
|
|
procedure TdxRibbonStatusBarEditor.ExecuteVerb(Index: Integer);
|
|
begin
|
|
case Index of
|
|
0: ShowCollectionEditor(Designer, Component, (Component as TdxRibbonStatusBar).Panels, 'Panels');
|
|
end;
|
|
end;
|
|
|
|
function TdxRibbonStatusBarEditor.GetVerb(Index: Integer): string;
|
|
begin
|
|
case Index of
|
|
0: Result := 'Panels Editor...';
|
|
1: Result := '-';
|
|
2: Result := 'ExpressBars ' + dxBarVersion;
|
|
3: Result := dxCompanyName;
|
|
end;
|
|
end;
|
|
|
|
function TdxRibbonStatusBarEditor.GetVerbCount: Integer;
|
|
begin
|
|
Result := 4;
|
|
end;
|
|
|
|
{$IFDEF DELPHI6}
|
|
procedure TdxRibbonStatusBarSelectionEditor.RequiresUnits(Proc: TGetStrProc);
|
|
begin
|
|
Proc('cxGraphics');
|
|
Proc('dxRibbon');
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{ TdxBarProperty }
|
|
|
|
procedure TdxBarProperty.GetProperties(Proc: TGetPropProc);
|
|
begin
|
|
FProc := Proc;
|
|
inherited GetProperties(GetPropProc);
|
|
end;
|
|
|
|
procedure TdxBarProperty.GetPropProc(
|
|
{$IFNDEF DELPHI6}Prop: TPropertyEditor{$ELSE}const Prop: IProperty{$ENDIF});
|
|
const
|
|
PropertiesToHide =
|
|
' AllowClose AllowCustomizing AllowQuickCustomizing AllowReset ' +
|
|
'BorderStyle Color DockControl DockedDockControl DockedDockingStyle ' +
|
|
'DockedLeft DockedTop DockingStyle FloatLeft FloatTop FloatClientWidth ' +
|
|
'FloatClientHeight Font Hidden IsMainMenu MultiLine NotDocking OldName ' +
|
|
'OneOnRow RotateWhenVertical Row ShowMark SizeGrip UseOwnFont ' +
|
|
'UseRecentItems UseRestSpace WholeRow BackgroundBitmap AlphaBlendValue ';
|
|
var
|
|
I: Integer;
|
|
begin
|
|
if (GetComponent(0) is TdxRibbonQuickAccessToolbar) or
|
|
(GetComponent(0) is TdxStatusBarToolbarPanelStyle) or
|
|
(GetComponent(0) is TdxRibbonTabGroup) then
|
|
begin
|
|
for I := 0 to PropCount - 1 do
|
|
if Pos(' ' + Prop.GetName + ' ', PropertiesToHide) > 0 then Exit;
|
|
end;
|
|
FProc(Prop);
|
|
end;
|
|
|
|
end.
|