1
0
mirror of synced 2024-11-22 01:53:50 +00:00

Added: ItemDisabledColor (musikCube painter is still not configurable enough though)

This commit is contained in:
Mark van Renswoude 2010-03-17 11:20:40 +00:00
parent fe5574b9e9
commit 6b13daa2dc

View File

@ -83,6 +83,7 @@ type
FIndicatorColors: TX2MenuBarmCColors; FIndicatorColors: TX2MenuBarmCColors;
FItemColors: TX2MenuBarmCColors; FItemColors: TX2MenuBarmCColors;
FItemHeight: Integer; FItemHeight: Integer;
FItemDisabledColor: TColor;
procedure SetColor(const Value: TColor); procedure SetColor(const Value: TColor);
procedure SetGroupColors(const Value: TX2MenuBarmCColors); procedure SetGroupColors(const Value: TX2MenuBarmCColors);
@ -90,6 +91,7 @@ type
procedure SetIndicatorColors(const Value: TX2MenuBarmCColors); procedure SetIndicatorColors(const Value: TX2MenuBarmCColors);
procedure SetItemColors(const Value: TX2MenuBarmCColors); procedure SetItemColors(const Value: TX2MenuBarmCColors);
procedure SetItemHeight(const Value: Integer); procedure SetItemHeight(const Value: Integer);
procedure SetItemDisabledColor(const Value: TColor);
protected protected
procedure ColorChange(Sender: TObject); procedure ColorChange(Sender: TObject);
@ -108,12 +110,13 @@ type
procedure ResetColors; procedure ResetColors;
published published
property Color: TColor read FColor write SetColor stored False; property Color: TColor read FColor write SetColor stored False;
property GroupColors: TX2MenuBarmCColors read FGroupColors write SetGroupColors stored False; property GroupColors: TX2MenuBarmCColors read FGroupColors write SetGroupColors stored False;
property GroupHeight: Integer read FGroupHeight write SetGroupHeight stored False; property GroupHeight: Integer read FGroupHeight write SetGroupHeight stored False;
property IndicatorColors: TX2MenuBarmCColors read FIndicatorColors write SetIndicatorColors stored False; property IndicatorColors: TX2MenuBarmCColors read FIndicatorColors write SetIndicatorColors stored False;
property ItemColors: TX2MenuBarmCColors read FItemColors write SetItemColors stored False; property ItemColors: TX2MenuBarmCColors read FItemColors write SetItemColors stored False;
property ItemHeight: Integer read FItemHeight write SetItemHeight stored False; property ItemHeight: Integer read FItemHeight write SetItemHeight stored False;
property ItemDisabledColor: TColor read FItemDisabledColor write SetItemDisabledColor stored False;
end; end;
implementation implementation
@ -126,12 +129,13 @@ constructor TX2MenuBarmusikCubePainter.Create(AOwner: TComponent);
begin begin
inherited; inherited;
FColor := clBtnFace; FColor := clBtnFace;
FGroupColors := TX2MenuBarmCColors.Create; FItemDisabledColor := clGrayText;
FGroupHeight := 22; FGroupColors := TX2MenuBarmCColors.Create;
FIndicatorColors := TX2MenuBarmCColors.Create; FGroupHeight := 22;
FItemColors := TX2MenuBarmCColors.Create; FIndicatorColors := TX2MenuBarmCColors.Create;
FItemHeight := 22; FItemColors := TX2MenuBarmCColors.Create;
FItemHeight := 22;
FGroupColors.OnChange := ColorChange; FGroupColors.OnChange := ColorChange;
FIndicatorColors.OnChange := ColorChange; FIndicatorColors.OnChange := ColorChange;
@ -341,6 +345,11 @@ begin
Inc(textBounds.Left, imageList.Width + 4); Inc(textBounds.Left, imageList.Width + 4);
end; end;
if AItem.Enabled then
ACanvas.Font.Color := clWindowText
else
ACanvas.Font.Color := ItemDisabledColor;
if not AItem.Visible then if not AItem.Visible then
{ Design-time } { Design-time }
ACanvas.Font.Style := [fsItalic] ACanvas.Font.Style := [fsItalic]
@ -378,6 +387,15 @@ begin
end; end;
end; end;
procedure TX2MenuBarmusikCubePainter.SetItemDisabledColor(const Value: TColor);
begin
if Value <> FItemDisabledColor then
begin
FItemDisabledColor := Value;
NotifyObservers;
end;
end;
procedure TX2MenuBarmusikCubePainter.SetItemHeight(const Value: Integer); procedure TX2MenuBarmusikCubePainter.SetItemHeight(const Value: Integer);
begin begin
if Value <> FItemHeight then if Value <> FItemHeight then