From 6b13daa2dc31869b24a0f79ec73361f9680f8233 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Wed, 17 Mar 2010 11:20:40 +0000 Subject: [PATCH] Added: ItemDisabledColor (musikCube painter is still not configurable enough though) --- Source/X2CLmusikCubeMenuBarPainter.pas | 42 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/Source/X2CLmusikCubeMenuBarPainter.pas b/Source/X2CLmusikCubeMenuBarPainter.pas index 8c8f70b..e63ae7f 100644 --- a/Source/X2CLmusikCubeMenuBarPainter.pas +++ b/Source/X2CLmusikCubeMenuBarPainter.pas @@ -83,6 +83,7 @@ type FIndicatorColors: TX2MenuBarmCColors; FItemColors: TX2MenuBarmCColors; FItemHeight: Integer; + FItemDisabledColor: TColor; procedure SetColor(const Value: TColor); procedure SetGroupColors(const Value: TX2MenuBarmCColors); @@ -90,6 +91,7 @@ type procedure SetIndicatorColors(const Value: TX2MenuBarmCColors); procedure SetItemColors(const Value: TX2MenuBarmCColors); procedure SetItemHeight(const Value: Integer); + procedure SetItemDisabledColor(const Value: TColor); protected procedure ColorChange(Sender: TObject); @@ -108,12 +110,13 @@ type procedure ResetColors; published - property Color: TColor read FColor write SetColor stored False; - property GroupColors: TX2MenuBarmCColors read FGroupColors write SetGroupColors stored False; - property GroupHeight: Integer read FGroupHeight write SetGroupHeight stored False; - property IndicatorColors: TX2MenuBarmCColors read FIndicatorColors write SetIndicatorColors stored False; - property ItemColors: TX2MenuBarmCColors read FItemColors write SetItemColors stored False; - property ItemHeight: Integer read FItemHeight write SetItemHeight stored False; + property Color: TColor read FColor write SetColor stored False; + property GroupColors: TX2MenuBarmCColors read FGroupColors write SetGroupColors stored False; + property GroupHeight: Integer read FGroupHeight write SetGroupHeight stored False; + property IndicatorColors: TX2MenuBarmCColors read FIndicatorColors write SetIndicatorColors stored False; + property ItemColors: TX2MenuBarmCColors read FItemColors write SetItemColors stored False; + property ItemHeight: Integer read FItemHeight write SetItemHeight stored False; + property ItemDisabledColor: TColor read FItemDisabledColor write SetItemDisabledColor stored False; end; implementation @@ -126,12 +129,13 @@ constructor TX2MenuBarmusikCubePainter.Create(AOwner: TComponent); begin inherited; - FColor := clBtnFace; - FGroupColors := TX2MenuBarmCColors.Create; - FGroupHeight := 22; - FIndicatorColors := TX2MenuBarmCColors.Create; - FItemColors := TX2MenuBarmCColors.Create; - FItemHeight := 22; + FColor := clBtnFace; + FItemDisabledColor := clGrayText; + FGroupColors := TX2MenuBarmCColors.Create; + FGroupHeight := 22; + FIndicatorColors := TX2MenuBarmCColors.Create; + FItemColors := TX2MenuBarmCColors.Create; + FItemHeight := 22; FGroupColors.OnChange := ColorChange; FIndicatorColors.OnChange := ColorChange; @@ -341,6 +345,11 @@ begin Inc(textBounds.Left, imageList.Width + 4); end; + if AItem.Enabled then + ACanvas.Font.Color := clWindowText + else + ACanvas.Font.Color := ItemDisabledColor; + if not AItem.Visible then { Design-time } ACanvas.Font.Style := [fsItalic] @@ -378,6 +387,15 @@ begin 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); begin if Value <> FItemHeight then