1
0
mirror of synced 2024-11-21 17:43:51 +00:00

Added: support for a background image in the UnameIT menubar painter

This commit is contained in:
Mark van Renswoude 2009-04-22 14:22:01 +00:00
parent a9c1bcc0d6
commit 57ba59dc96
8 changed files with 852 additions and 415 deletions

View File

@ -31,9 +31,9 @@
-M
-$M16384,1048576
-K$00400000
-N"P:\algemeen\lib"
-LE"P:\algemeen\bin"
-LN"P:\algemeen\lib"
-N"P:\algemeen\lib\D7"
-LE"P:\algemeen\bin\D7"
-LN"P:\algemeen\lib\D7"
-Z
-w-UNSAFE_TYPE
-w-UNSAFE_CODE

View File

@ -105,10 +105,6 @@ HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=C:\Program Files\Borland\Delphi7\Bin\
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
@ -154,6 +150,7 @@ Item0=$(DELPHIBIN)
Item1=..\..\Lib\D7
Item2=Lib\D7
[HistoryLists\hlDCPOutput]
Count=2
Item0=$(DELPHILIB)
Item1=..\..\Lib\D7
Count=3
Item0=$(DELPHIBIN)
Item1=$(DELPHILIB)
Item2=..\..\Lib\D7

View File

@ -130,8 +130,6 @@ OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[Excluded Packages]
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

File diff suppressed because it is too large Load Diff

View File

@ -25,18 +25,18 @@ type
public
constructor Create(AMenuBar: TX2CustomMenuBar; AGroup: TX2MenuBarGroup;
AAnimator: TX2CustomMenuBarAnimator);
destructor Destroy(); override;
destructor Destroy; override;
procedure Start(); override;
procedure Start; override;
procedure BeforePaint(); override;
procedure BeforePaint; override;
procedure GetItemHeight(AItem: TX2CustomMenuBarItem; var AHeight: Integer;
var AHandled: Boolean); override;
procedure DrawMenuItem(ACanvas: TCanvas; APainter: TX2CustomMenuBarPainter;
AItem: TX2CustomMenuBarItem; const AMenuBounds: TRect;
const AItemBounds: TRect; AState: TX2MenuBarDrawStates;
var AHandled: Boolean); override;
procedure AfterPaint(); override;
procedure AfterPaint; override;
end;
@ -49,26 +49,26 @@ type
private
FAnimateActions: TObjectList;
function GetCount(): Integer;
function GetCount: Integer;
protected
function GetAnimateAction(AIndex: Integer): TX2MenuBarAnimateAction;
function GetTerminated(): Boolean; override;
function GetTerminated: Boolean; override;
property AnimateActions: TObjectList read FAnimateActions;
public
constructor Create(AMenuBar: TX2CustomMenuBar);
destructor Destroy(); override;
destructor Destroy; override;
procedure Add(AAction: TX2MenuBarAnimateAction);
procedure BeforePaint(); override;
procedure BeforePaint; override;
procedure GetItemHeight(AItem: TX2CustomMenuBarItem; var AHeight: Integer;
var AHandled: Boolean); override;
procedure DrawMenuItem(ACanvas: TCanvas; APainter: TX2CustomMenuBarPainter;
AItem: TX2CustomMenuBarItem; const AMenuBounds: TRect;
const AItemBounds: TRect; AState: TX2MenuBarDrawStates;
var AHandled: Boolean); override;
procedure AfterPaint(); override;
procedure AfterPaint; override;
property Count: Integer read GetCount;
end;
@ -88,7 +88,7 @@ type
constructor Create(AMenuBar: TX2CustomMenuBar; AGroup: TX2MenuBarGroup;
AExpanding: Boolean);
procedure Start(); override;
procedure Start; override;
end;
@ -104,7 +104,7 @@ type
public
constructor Create(AMenuBar: TX2CustomMenuBar; AItem: TX2CustomMenuBarItem);
procedure Start(); override;
procedure Start; override;
end;
@ -131,7 +131,7 @@ begin
end;
destructor TX2MenuBarAnimateAction.Destroy();
destructor TX2MenuBarAnimateAction.Destroy;
begin
FreeAndNil(FAnimator);
@ -139,21 +139,21 @@ begin
end;
procedure TX2MenuBarAnimateAction.Start();
procedure TX2MenuBarAnimateAction.Start;
begin
inherited;
Animator.ResetStartTime();
Animator.ResetStartTime;
end;
procedure TX2MenuBarAnimateAction.BeforePaint();
procedure TX2MenuBarAnimateAction.BeforePaint;
begin
inherited;
Animator.Update();
Animator.Update;
if Animator.Terminated then
Terminate();
Terminate;
end;
@ -196,7 +196,7 @@ begin
end;
procedure TX2MenuBarAnimateAction.AfterPaint();
procedure TX2MenuBarAnimateAction.AfterPaint;
begin
inherited;
@ -205,8 +205,8 @@ begin
{ Prevent 100% CPU usage }
Sleep(5);
TProtectedX2CustomMenuBar(MenuBar).TestMousePos();
MenuBar.Invalidate();
TProtectedX2CustomMenuBar(MenuBar).TestMousePos;
MenuBar.Invalidate;
end;
end;
@ -220,7 +220,7 @@ begin
end;
destructor TX2MenuBarAnimateMultipleAction.Destroy();
destructor TX2MenuBarAnimateMultipleAction.Destroy;
begin
FreeAndNil(FAnimateActions);
@ -234,7 +234,7 @@ begin
end;
procedure TX2MenuBarAnimateMultipleAction.BeforePaint();
procedure TX2MenuBarAnimateMultipleAction.BeforePaint;
var
actionIndex: Integer;
@ -242,7 +242,7 @@ begin
inherited;
for actionIndex := 0 to Pred(AnimateActions.Count) do
GetAnimateAction(actionIndex).BeforePaint();
GetAnimateAction(actionIndex).BeforePaint;
end;
@ -289,7 +289,7 @@ begin
end;
procedure TX2MenuBarAnimateMultipleAction.AfterPaint();
procedure TX2MenuBarAnimateMultipleAction.AfterPaint;
var
actionIndex: Integer;
@ -297,7 +297,7 @@ begin
inherited;
for actionIndex := 0 to Pred(AnimateActions.Count) do
GetAnimateAction(actionIndex).AfterPaint();
GetAnimateAction(actionIndex).AfterPaint;
end;
@ -307,18 +307,18 @@ begin
end;
function TX2MenuBarAnimateMultipleAction.GetCount(): Integer;
function TX2MenuBarAnimateMultipleAction.GetCount: Integer;
begin
Result := FAnimateActions.Count;
end;
function TX2MenuBarAnimateMultipleAction.GetTerminated(): Boolean;
function TX2MenuBarAnimateMultipleAction.GetTerminated: Boolean;
var
actionIndex: Integer;
begin
Result := inherited GetTerminated();
Result := inherited GetTerminated;
if not Result then
begin
@ -344,12 +344,12 @@ begin
end;
procedure TX2MenuBarExpandAction.Start();
procedure TX2MenuBarExpandAction.Start;
begin
inherited;
TProtectedX2CustomMenuBar(MenuBar).InternalSetExpanded(FGroup, FExpanding);
Terminate();
Terminate;
end;
@ -363,13 +363,12 @@ begin
end;
procedure TX2MenuBarSelectAction.Start();
procedure TX2MenuBarSelectAction.Start;
begin
inherited;
TProtectedX2CustomMenuBar(MenuBar).InternalSetSelected(FItem);
Terminate();
Terminate;
end;
end.

View File

@ -27,9 +27,9 @@ type
private
FSlideHeight: Integer;
protected
function GetHeight(): Integer; override;
function GetHeight: Integer; override;
public
procedure Update(); override;
procedure Update; override;
procedure Draw(ACanvas: TCanvas; const ABounds: TRect); override;
end;
@ -47,10 +47,10 @@ type
property ItemsState: Graphics.TBitmap read FItemsState;
property Mask: Graphics.TBitmap read FMask;
public
constructor Create(AItemsBuffer: Graphics.TBitmap); override;
destructor Destroy(); override;
constructor Create(AItemsBuffer: TX2CustomMenuBarAnimatorBuffer); override;
destructor Destroy; override;
procedure Update(); override;
procedure Update; override;
procedure Draw(ACanvas: TCanvas; const ABounds: TRect); override;
end;
@ -61,9 +61,7 @@ type
private
FAlpha: Byte;
public
constructor Create(AItemsBuffer: Graphics.TBitmap); override;
procedure Update(); override;
procedure Update; override;
procedure Draw(ACanvas: TCanvas; const ABounds: TRect); override;
end;
@ -74,9 +72,9 @@ type
private
FSlideHeight: Integer;
protected
function GetHeight(): Integer; override;
function GetHeight: Integer; override;
public
procedure Update(); override;
procedure Update; override;
end;
implementation
@ -87,12 +85,12 @@ uses
{ TX2MenuBarSlideAnimator }
function TX2MenuBarSlideAnimator.GetHeight(): Integer;
function TX2MenuBarSlideAnimator.GetHeight: Integer;
begin
Result := FSlideHeight;
end;
procedure TX2MenuBarSlideAnimator.Update();
procedure TX2MenuBarSlideAnimator.Update;
var
elapsed: Cardinal;
@ -108,7 +106,7 @@ begin
FSlideHeight := 0;
if elapsed >= AnimationTime then
Terminate();
Terminate;
end;
procedure TX2MenuBarSlideAnimator.Draw(ACanvas: TCanvas; const ABounds: TRect);
@ -121,12 +119,12 @@ begin
destRect := ABounds;
destRect.Bottom := destRect.Top + FSlideHeight;
ACanvas.CopyRect(destRect, ItemsBuffer.Canvas, sourceRect);
ACanvas.CopyRect(destRect, ItemsBuffer.Bitmap.Canvas, sourceRect);
end;
{ TX2MenuBarDissolveAnimator }
constructor TX2MenuBarDissolveAnimator.Create(AItemsBuffer: Graphics.TBitmap);
constructor TX2MenuBarDissolveAnimator.Create(AItemsBuffer: TX2CustomMenuBarAnimatorBuffer);
var
pixelIndex: Integer;
pixelPos: Integer;
@ -138,20 +136,20 @@ begin
{ The bitmaps need to be 32-bits since we'll be accessing the scanlines as
one big array, not by using Scanline on each row. In 24-bit mode, the
scanlines are still aligned on a 32-bits boundary, thus causing problems. }
ItemsBuffer.PixelFormat := pf32bit;
ItemsBuffer.Bitmap.PixelFormat := pf32bit;
FMask := Graphics.TBitmap.Create();
FMask := Graphics.TBitmap.Create;
FMask.PixelFormat := pf32bit;
FMask.Width := AItemsBuffer.Width;
FMask.Height := AItemsBuffer.Height;
FItemsState := Graphics.TBitmap.Create();
FItemsState := Graphics.TBitmap.Create;
FItemsState.PixelFormat := pf32bit;
FItemsState.Width := AItemsBuffer.Width;
FItemsState.Height := AItemsBuffer.Height;
if RandSeed = 0 then
Randomize();
Randomize;
{ Prepare an array of pixel indices which will be used to pick random
unique pixels in the Update method.
@ -160,7 +158,7 @@ begin
be randomly picked and deleted in Update. Now we pre-shuffle the list,
then Delete only from the end, which does not reallocate or move any
memory (TList.Count decreases, Capacity stays the same), a LOT faster. }
FPixels := TList.Create();
FPixels := TList.Create;
FPixels.Count := AItemsBuffer.Width * AItemsBuffer.Height;
for pixelIndex := Pred(FPixels.Count) downto 0 do
@ -178,7 +176,7 @@ begin
end;
end;
destructor TX2MenuBarDissolveAnimator.Destroy();
destructor TX2MenuBarDissolveAnimator.Destroy;
begin
FreeAndNil(FItemsState);
FreeAndNil(FMask);
@ -187,7 +185,7 @@ begin
end;
procedure TX2MenuBarDissolveAnimator.Update();
procedure TX2MenuBarDissolveAnimator.Update;
const
RGBBlack: TRGBQuad = (rgbBlue: 0;
rgbGreen: 0;
@ -225,7 +223,7 @@ begin
itemsPixels := nil;
if Expanding then
itemsPixels := GetScanlinePointer(ItemsBuffer);
itemsPixels := GetScanlinePointer(ItemsBuffer.Bitmap);
for pixel := Pred(FPixels.Count - pixelsRemaining) downto 0 do
begin
@ -248,7 +246,7 @@ begin
end;
if elapsed >= AnimationTime then
Terminate();
Terminate;
end;
procedure TX2MenuBarDissolveAnimator.Draw(ACanvas: TCanvas; const ABounds: TRect);
@ -290,7 +288,7 @@ begin
begin
{ Start with a visible group }
FMask.Canvas.Brush.Color := clBlack;
FItemsState.Canvas.Draw(0, 0, ItemsBuffer);
FItemsState.Canvas.Draw(0, 0, ItemsBuffer.Bitmap);
end;
FMask.Canvas.FillRect(Rect(0, 0, FMask.Width, FMask.Height));
@ -300,15 +298,7 @@ end;
{ TX2MenuBarFadeAnimator }
constructor TX2MenuBarFadeAnimator.Create(AItemsBuffer: Graphics.TBitmap);
begin
inherited;
ItemsBuffer.PixelFormat := pf32bit;
end;
procedure TX2MenuBarFadeAnimator.Update();
procedure TX2MenuBarFadeAnimator.Update;
var
elapsed: Cardinal;
newAlpha: Integer;
@ -326,7 +316,7 @@ begin
FAlpha := newAlpha;
if elapsed >= AnimationTime then
Terminate();
Terminate;
end;
procedure TX2MenuBarFadeAnimator.Draw(ACanvas: TCanvas; const ABounds: TRect);
@ -339,20 +329,21 @@ begin
if ABounds.Bottom - ABounds.Top <= 0 then
exit;
backBuffer := Graphics.TBitmap.Create();
backBuffer := Graphics.TBitmap.Create;
try
backBuffer.PixelFormat := pf32bit;
backBuffer.Width := ItemsBuffer.Width;
backBuffer.Height := ItemsBuffer.Height;
destRect := Rect(0, 0, backBuffer.Width, backBuffer.Height);
destRect := Rect(0, 0, backBuffer.Width, ABounds.Bottom - ABounds.Top);
backBuffer.Canvas.CopyRect(destRect, ACanvas, ABounds);
X2CLGraphics.DrawBlended(backBuffer, ItemsBuffer, FAlpha);
X2CLGraphics.DrawBlended(backBuffer, ItemsBuffer.Bitmap, FAlpha);
sourceRect := Rect(0, 0, ItemsBuffer.Width, Self.Height);
destRect := ABounds;
destRect.Bottom := destRect.Top + Self.Height;
ACanvas.CopyRect(destRect, backBuffer.Canvas, sourceRect);
finally
FreeAndNil(backBuffer);
@ -361,12 +352,12 @@ end;
{ TX2MenuBarSlideFadeAnimator }
function TX2MenuBarSlideFadeAnimator.GetHeight(): Integer;
function TX2MenuBarSlideFadeAnimator.GetHeight: Integer;
begin
Result := FSlideHeight;
end;
procedure TX2MenuBarSlideFadeAnimator.Update();
procedure TX2MenuBarSlideFadeAnimator.Update;
var
elapsed: Cardinal;

View File

@ -31,10 +31,10 @@ type
procedure SetBorder(const Value: TX2Color32);
procedure SetFill(const Value: TX2Color32);
function IsBorderStored(): Boolean;
function IsFillStored(): Boolean;
function IsBorderStored: Boolean;
function IsFillStored: Boolean;
protected
procedure DoChange();
procedure DoChange;
procedure SetDefaultColors(ABorder, AFill: TX2Color32);
@ -59,13 +59,13 @@ type
procedure SetNormal(const Value: TX2MenuBarmCColor);
procedure SetSelected(const Value: TX2MenuBarmCColor);
protected
procedure DoChange();
procedure DoChange;
procedure ColorChange(Sender: TObject);
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create();
destructor Destroy(); override;
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
@ -99,14 +99,14 @@ type
function GetGroupHeaderHeight(AGroup: TX2MenuBarGroup): Integer; override;
function GetItemHeight(AItem: TX2MenuBarItem): Integer; override;
procedure DrawBackground(ACanvas: TCanvas; const ABounds: TRect); override;
procedure DrawBackground(ACanvas: TCanvas; const ABounds: TRect; const AOffset: TPoint); override;
procedure DrawGroupHeader(ACanvas: TCanvas; AGroup: TX2MenuBarGroup; const ABounds: TRect; AState: TX2MenuBarDrawStates); override;
procedure DrawItem(ACanvas: TCanvas; AItem: TX2MenuBarItem; const ABounds: TRect; AState: TX2MenuBarDrawStates); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
destructor Destroy; override;
procedure ResetColors();
procedure ResetColors;
published
property Color: TColor read FColor write SetColor stored False;
property GroupColors: TX2MenuBarmCColors read FGroupColors write SetGroupColors stored False;
@ -127,20 +127,20 @@ begin
inherited;
FColor := clBtnFace;
FGroupColors := TX2MenuBarmCColors.Create();
FGroupColors := TX2MenuBarmCColors.Create;
FGroupHeight := 22;
FIndicatorColors := TX2MenuBarmCColors.Create();
FItemColors := TX2MenuBarmCColors.Create();
FIndicatorColors := TX2MenuBarmCColors.Create;
FItemColors := TX2MenuBarmCColors.Create;
FItemHeight := 22;
FGroupColors.OnChange := ColorChange;
FIndicatorColors.OnChange := ColorChange;
FItemColors.OnChange := ColorChange;
ResetColors();
ResetColors;
end;
destructor TX2MenuBarmusikCubePainter.Destroy();
destructor TX2MenuBarmusikCubePainter.Destroy;
begin
FreeAndNil(FItemColors);
FreeAndNil(FIndicatorColors);
@ -150,7 +150,7 @@ begin
end;
procedure TX2MenuBarmusikCubePainter.ResetColors();
procedure TX2MenuBarmusikCubePainter.ResetColors;
begin
{ Group buttons }
GroupColors.Hot.SetDefaultColors( Color32(clBtnShadow),
@ -200,7 +200,7 @@ var
destRect: TRect;
begin
backBuffer := Graphics.TBitmap.Create();
backBuffer := Graphics.TBitmap.Create;
try
backBuffer.PixelFormat := pf32bit;
backBuffer.Width := AImageList.Width;
@ -211,7 +211,7 @@ begin
OffsetRect(sourceRect, AX, AY);
backBuffer.Canvas.CopyRect(destRect, ACanvas, sourceRect);
iconBuffer := Graphics.TBitmap.Create();
iconBuffer := Graphics.TBitmap.Create;
try
iconBuffer.Assign(backBuffer);
AImageList.Draw(iconBuffer.Canvas, 0, 0, AImageIndex);
@ -240,7 +240,8 @@ end;
procedure TX2MenuBarmusikCubePainter.DrawBackground(ACanvas: TCanvas;
const ABounds: TRect);
const ABounds: TRect;
const AOffset: TPoint);
begin
with ACanvas do
begin
@ -355,7 +356,7 @@ end;
procedure TX2MenuBarmusikCubePainter.ColorChange(Sender: TObject);
begin
NotifyObservers();
NotifyObservers;
end;
@ -364,7 +365,7 @@ begin
if Value <> FIndicatorColors then
begin
FIndicatorColors.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -373,7 +374,7 @@ begin
if Value <> FItemColors then
begin
FItemColors.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -382,7 +383,7 @@ begin
if Value <> FItemHeight then
begin
FItemHeight := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -391,7 +392,7 @@ begin
if Value <> FColor then
begin
FColor := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -400,7 +401,7 @@ begin
if Value <> FGroupColors then
begin
FGroupColors.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -409,7 +410,7 @@ begin
if Value <> FGroupHeight then
begin
FGroupHeight := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -430,7 +431,7 @@ begin
end;
procedure TX2MenuBarmCColor.DoChange();
procedure TX2MenuBarmCColor.DoChange;
begin
if Assigned(FOnChange) then
FOnChange(Self);
@ -445,12 +446,12 @@ begin
end;
function TX2MenuBarmCColor.IsBorderStored(): Boolean;
function TX2MenuBarmCColor.IsBorderStored: Boolean;
begin
Result := (FBorder <> FDefaultBorder);
end;
function TX2MenuBarmCColor.IsFillStored(): Boolean;
function TX2MenuBarmCColor.IsFillStored: Boolean;
begin
Result := (FFill <> FDefaultFill);
end;
@ -460,7 +461,7 @@ begin
if Value <> FBorder then
begin
FBorder := Value;
DoChange();
DoChange;
end;
end;
@ -469,26 +470,26 @@ begin
if Value <> FFill then
begin
FFill := Value;
DoChange();
DoChange;
end;
end;
{ TX2MenuBarmCColors }
constructor TX2MenuBarmCColors.Create();
constructor TX2MenuBarmCColors.Create;
begin
inherited;
FHot := TX2MenuBarmCColor.Create();
FNormal := TX2MenuBarmCColor.Create();
FSelected := TX2MenuBarmCColor.Create();
FHot := TX2MenuBarmCColor.Create;
FNormal := TX2MenuBarmCColor.Create;
FSelected := TX2MenuBarmCColor.Create;
FHot.OnChange := ColorChange;
FNormal.OnChange := ColorChange;
FSelected.OnChange := ColorChange;
end;
destructor TX2MenuBarmCColors.Destroy();
destructor TX2MenuBarmCColors.Destroy;
begin
FreeAndNil(FSelected);
FreeAndNil(FNormal);
@ -511,7 +512,7 @@ begin
end;
procedure TX2MenuBarmCColors.DoChange();
procedure TX2MenuBarmCColors.DoChange;
begin
if Assigned(FOnChange) then
FOnChange(Self);
@ -519,7 +520,7 @@ end;
procedure TX2MenuBarmCColors.ColorChange(Sender: TObject);
begin
DoChange();
DoChange;
end;
@ -528,7 +529,7 @@ begin
if FHot <> Value then
begin
FHot.Assign(Value);
DoChange();
DoChange;
end;
end;
@ -537,7 +538,7 @@ begin
if FNormal <> Value then
begin
FNormal.Assign(Value);
DoChange();
DoChange;
end;
end;
@ -546,7 +547,7 @@ begin
if FNormal <> Value then
begin
FSelected.Assign(Value);
DoChange();
DoChange;
end;
end;

View File

@ -1,3 +1,215 @@
{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
{$WARN SYMBOL_DEPRECATED ON}
{$WARN SYMBOL_LIBRARY ON}
{$WARN SYMBOL_PLATFORM ON}
{$WARN UNIT_LIBRARY ON}
{$WARN UNIT_PLATFORM ON}
{$WARN UNIT_DEPRECATED ON}
{$WARN HRESULT_COMPAT ON}
{$WARN HIDING_MEMBER ON}
{$WARN HIDDEN_VIRTUAL ON}
{$WARN GARBAGE ON}
{$WARN BOUNDS_ERROR ON}
{$WARN ZERO_NIL_COMPAT ON}
{$WARN STRING_CONST_TRUNCED ON}
{$WARN FOR_LOOP_VAR_VARPAR ON}
{$WARN TYPED_CONST_VARPAR ON}
{$WARN ASG_TO_TYPED_CONST ON}
{$WARN CASE_LABEL_RANGE ON}
{$WARN FOR_VARIABLE ON}
{$WARN CONSTRUCTING_ABSTRACT ON}
{$WARN COMPARISON_FALSE ON}
{$WARN COMPARISON_TRUE ON}
{$WARN COMPARING_SIGNED_UNSIGNED ON}
{$WARN COMBINING_SIGNED_UNSIGNED ON}
{$WARN UNSUPPORTED_CONSTRUCT ON}
{$WARN FILE_OPEN ON}
{$WARN FILE_OPEN_UNITSRC ON}
{$WARN BAD_GLOBAL_SYMBOL ON}
{$WARN DUPLICATE_CTOR_DTOR ON}
{$WARN INVALID_DIRECTIVE ON}
{$WARN PACKAGE_NO_LINK ON}
{$WARN PACKAGED_THREADVAR ON}
{$WARN IMPLICIT_IMPORT ON}
{$WARN HPPEMIT_IGNORED ON}
{$WARN NO_RETVAL ON}
{$WARN USE_BEFORE_DEF ON}
{$WARN FOR_LOOP_VAR_UNDEF ON}
{$WARN UNIT_NAME_MISMATCH ON}
{$WARN NO_CFG_FILE_FOUND ON}
{$WARN MESSAGE_DIRECTIVE ON}
{$WARN IMPLICIT_VARIANTS ON}
{$WARN UNICODE_TO_LOCALE ON}
{$WARN LOCALE_TO_UNICODE ON}
{$WARN IMAGEBASE_MULTIPLE ON}
{$WARN SUSPICIOUS_TYPECAST ON}
{$WARN PRIVATE_PROPACCESSOR ON}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
{$WARN SYMBOL_DEPRECATED ON}
{$WARN SYMBOL_LIBRARY ON}
{$WARN SYMBOL_PLATFORM ON}
{$WARN UNIT_LIBRARY ON}
{$WARN UNIT_PLATFORM ON}
{$WARN UNIT_DEPRECATED ON}
{$WARN HRESULT_COMPAT ON}
{$WARN HIDING_MEMBER ON}
{$WARN HIDDEN_VIRTUAL ON}
{$WARN GARBAGE ON}
{$WARN BOUNDS_ERROR ON}
{$WARN ZERO_NIL_COMPAT ON}
{$WARN STRING_CONST_TRUNCED ON}
{$WARN FOR_LOOP_VAR_VARPAR ON}
{$WARN TYPED_CONST_VARPAR ON}
{$WARN ASG_TO_TYPED_CONST ON}
{$WARN CASE_LABEL_RANGE ON}
{$WARN FOR_VARIABLE ON}
{$WARN CONSTRUCTING_ABSTRACT ON}
{$WARN COMPARISON_FALSE ON}
{$WARN COMPARISON_TRUE ON}
{$WARN COMPARING_SIGNED_UNSIGNED ON}
{$WARN COMBINING_SIGNED_UNSIGNED ON}
{$WARN UNSUPPORTED_CONSTRUCT ON}
{$WARN FILE_OPEN ON}
{$WARN FILE_OPEN_UNITSRC ON}
{$WARN BAD_GLOBAL_SYMBOL ON}
{$WARN DUPLICATE_CTOR_DTOR ON}
{$WARN INVALID_DIRECTIVE ON}
{$WARN PACKAGE_NO_LINK ON}
{$WARN PACKAGED_THREADVAR ON}
{$WARN IMPLICIT_IMPORT ON}
{$WARN HPPEMIT_IGNORED ON}
{$WARN NO_RETVAL ON}
{$WARN USE_BEFORE_DEF ON}
{$WARN FOR_LOOP_VAR_UNDEF ON}
{$WARN UNIT_NAME_MISMATCH ON}
{$WARN NO_CFG_FILE_FOUND ON}
{$WARN MESSAGE_DIRECTIVE ON}
{$WARN IMPLICIT_VARIANTS ON}
{$WARN UNICODE_TO_LOCALE ON}
{$WARN LOCALE_TO_UNICODE ON}
{$WARN IMAGEBASE_MULTIPLE ON}
{$WARN SUSPICIOUS_TYPECAST ON}
{$WARN PRIVATE_PROPACCESSOR ON}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
{$WARN SYMBOL_DEPRECATED ON}
{$WARN SYMBOL_LIBRARY ON}
{$WARN SYMBOL_PLATFORM ON}
{$WARN UNIT_LIBRARY ON}
{$WARN UNIT_PLATFORM ON}
{$WARN UNIT_DEPRECATED ON}
{$WARN HRESULT_COMPAT ON}
{$WARN HIDING_MEMBER ON}
{$WARN HIDDEN_VIRTUAL ON}
{$WARN GARBAGE ON}
{$WARN BOUNDS_ERROR ON}
{$WARN ZERO_NIL_COMPAT ON}
{$WARN STRING_CONST_TRUNCED ON}
{$WARN FOR_LOOP_VAR_VARPAR ON}
{$WARN TYPED_CONST_VARPAR ON}
{$WARN ASG_TO_TYPED_CONST ON}
{$WARN CASE_LABEL_RANGE ON}
{$WARN FOR_VARIABLE ON}
{$WARN CONSTRUCTING_ABSTRACT ON}
{$WARN COMPARISON_FALSE ON}
{$WARN COMPARISON_TRUE ON}
{$WARN COMPARING_SIGNED_UNSIGNED ON}
{$WARN COMBINING_SIGNED_UNSIGNED ON}
{$WARN UNSUPPORTED_CONSTRUCT ON}
{$WARN FILE_OPEN ON}
{$WARN FILE_OPEN_UNITSRC ON}
{$WARN BAD_GLOBAL_SYMBOL ON}
{$WARN DUPLICATE_CTOR_DTOR ON}
{$WARN INVALID_DIRECTIVE ON}
{$WARN PACKAGE_NO_LINK ON}
{$WARN PACKAGED_THREADVAR ON}
{$WARN IMPLICIT_IMPORT ON}
{$WARN HPPEMIT_IGNORED ON}
{$WARN NO_RETVAL ON}
{$WARN USE_BEFORE_DEF ON}
{$WARN FOR_LOOP_VAR_UNDEF ON}
{$WARN UNIT_NAME_MISMATCH ON}
{$WARN NO_CFG_FILE_FOUND ON}
{$WARN MESSAGE_DIRECTIVE ON}
{$WARN IMPLICIT_VARIANTS ON}
{$WARN UNICODE_TO_LOCALE ON}
{$WARN LOCALE_TO_UNICODE ON}
{$WARN IMAGEBASE_MULTIPLE ON}
{$WARN SUSPICIOUS_TYPECAST ON}
{$WARN PRIVATE_PROPACCESSOR ON}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
{$WARN SYMBOL_DEPRECATED ON}
{$WARN SYMBOL_LIBRARY ON}
{$WARN SYMBOL_PLATFORM ON}
{$WARN UNIT_LIBRARY ON}
{$WARN UNIT_PLATFORM ON}
{$WARN UNIT_DEPRECATED ON}
{$WARN HRESULT_COMPAT ON}
{$WARN HIDING_MEMBER ON}
{$WARN HIDDEN_VIRTUAL ON}
{$WARN GARBAGE ON}
{$WARN BOUNDS_ERROR ON}
{$WARN ZERO_NIL_COMPAT ON}
{$WARN STRING_CONST_TRUNCED ON}
{$WARN FOR_LOOP_VAR_VARPAR ON}
{$WARN TYPED_CONST_VARPAR ON}
{$WARN ASG_TO_TYPED_CONST ON}
{$WARN CASE_LABEL_RANGE ON}
{$WARN FOR_VARIABLE ON}
{$WARN CONSTRUCTING_ABSTRACT ON}
{$WARN COMPARISON_FALSE ON}
{$WARN COMPARISON_TRUE ON}
{$WARN COMPARING_SIGNED_UNSIGNED ON}
{$WARN COMBINING_SIGNED_UNSIGNED ON}
{$WARN UNSUPPORTED_CONSTRUCT ON}
{$WARN FILE_OPEN ON}
{$WARN FILE_OPEN_UNITSRC ON}
{$WARN BAD_GLOBAL_SYMBOL ON}
{$WARN DUPLICATE_CTOR_DTOR ON}
{$WARN INVALID_DIRECTIVE ON}
{$WARN PACKAGE_NO_LINK ON}
{$WARN PACKAGED_THREADVAR ON}
{$WARN IMPLICIT_IMPORT ON}
{$WARN HPPEMIT_IGNORED ON}
{$WARN NO_RETVAL ON}
{$WARN USE_BEFORE_DEF ON}
{$WARN FOR_LOOP_VAR_UNDEF ON}
{$WARN UNIT_NAME_MISMATCH ON}
{$WARN NO_CFG_FILE_FOUND ON}
{$WARN MESSAGE_DIRECTIVE ON}
{$WARN IMPLICIT_VARIANTS ON}
{$WARN UNICODE_TO_LOCALE ON}
{$WARN LOCALE_TO_UNICODE ON}
{$WARN IMAGEBASE_MULTIPLE ON}
{$WARN SUSPICIOUS_TYPECAST ON}
{$WARN PRIVATE_PROPACCESSOR ON}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{
:: Implements a Uname-IT-style painter for the X2MenuBar.
::
@ -24,7 +236,7 @@ type
private
FOnChange: TNotifyEvent;
protected
procedure Changed();
procedure Changed;
public
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
@ -41,10 +253,10 @@ type
FNormal: TColor;
FSelected: TColor;
function IsDisabledStored(): Boolean;
function IsHotStored(): Boolean;
function IsNormalStored(): Boolean;
function IsSelectedStored(): Boolean;
function IsDisabledStored: Boolean;
function IsHotStored: Boolean;
function IsNormalStored: Boolean;
function IsSelectedStored: Boolean;
procedure SetDisabled(const Value: TColor);
procedure SetHot(const Value: TColor);
procedure SetNormal(const Value: TColor);
@ -78,7 +290,7 @@ type
protected
procedure ColorChange(Sender: TObject);
public
constructor Create();
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
@ -115,7 +327,7 @@ type
procedure SetImageOffsetX(const Value: Integer);
procedure SetImageOffsetY(const Value: Integer);
public
constructor Create();
constructor Create;
procedure Assign(Source: TPersistent); override;
published
@ -133,19 +345,26 @@ type
end;
THorzAlignment = (haLeft, haCenter, haRight);
TVertAlignment = (vaTop, vaCenter, vaBottom);
TX2MenuBarunaPainter = class(TX2CustomMenuBarPainter)
private
FArrowColor: TColor;
FBlurShadow: Boolean;
FColor: TColor;
FGroupColors: TX2MenuBarunaGroupColors;
FItemColors: TX2MenuBarunaColor;
FMetrics: TX2MenuBarunaMetrics;
FShadowColor: TColor;
FShadowOffset: Integer;
FGroupGradient: Integer;
FArrowImages: TCustomImageList;
FArrowImageIndex: TImageIndex;
FArrowColor: TColor;
FBlurShadow: Boolean;
FColor: TColor;
FGroupColors: TX2MenuBarunaGroupColors;
FItemColors: TX2MenuBarunaColor;
FMetrics: TX2MenuBarunaMetrics;
FShadowColor: TColor;
FShadowOffset: Integer;
FGroupGradient: Integer;
FArrowImages: TCustomImageList;
FArrowImageIndex: TImageIndex;
FBackground: TPicture;
FBackgroundHorzAlignment: THorzAlignment;
FBackgroundVertAlignment: TVertAlignment;
procedure SetBlurShadow(const Value: Boolean);
procedure SetGroupColors(const Value: TX2MenuBarunaGroupColors);
@ -156,17 +375,22 @@ type
procedure SetGroupGradient(const Value: Integer);
procedure SetArrowImageIndex(const Value: TImageIndex);
procedure SetArrowImages(const Value: TCustomImageList);
procedure SetBackground(const Value: TPicture);
procedure SetBackgroundHorzAlignment(const Value: THorzAlignment);
procedure SetBackgroundVertAlignment(const Value: TVertAlignment);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function HasArrowImage(): Boolean;
function HasArrowImage: Boolean;
function ApplyMargins(const ABounds: TRect): TRect; override;
function UndoMargins(const ABounds: TRect): TRect; override;
function GetSpacing(AElement: TX2MenuBarSpacingElement): Integer; override;
function GetGroupHeaderHeight(AGroup: TX2MenuBarGroup): Integer; override;
function GetItemHeight(AItem: TX2MenuBarItem): Integer; override;
procedure DrawBackground(ACanvas: TCanvas; const ABounds: TRect); override;
procedure DrawBackground(ACanvas: TCanvas; const ABounds: TRect; const AOffset: TPoint); override;
procedure DrawGroupHeader(ACanvas: TCanvas; AGroup: TX2MenuBarGroup; const ABounds: TRect; AState: TX2MenuBarDrawStates); override;
procedure DrawItem(ACanvas: TCanvas; AItem: TX2MenuBarItem; const ABounds: TRect; AState: TX2MenuBarDrawStates); override;
procedure DrawArrow(ACanvas: TCanvas; ABounds: TRect);
@ -174,21 +398,24 @@ type
procedure ColorChange(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
destructor Destroy; override;
procedure ResetColors();
procedure ResetColors;
published
property ArrowImageIndex: TImageIndex read FArrowImageIndex write SetArrowImageIndex default -1;
property ArrowImages: TCustomImageList read FArrowImages write SetArrowImages;
property ArrowColor: TColor read FArrowColor write FArrowColor default clBlue;
property BlurShadow: Boolean read FBlurShadow write SetBlurShadow default True;
property Color: TColor read FColor write FColor default clWindow;
property GroupColors: TX2MenuBarunaGroupColors read FGroupColors write SetGroupColors;
property ItemColors: TX2MenuBarunaColor read FItemColors write SetItemColors;
property Metrics: TX2MenuBarunaMetrics read FMetrics write SetMetrics;
property ShadowColor: TColor read FShadowColor write SetShadowColor default clBtnShadow;
property ShadowOffset: Integer read FShadowOffset write SetShadowOffset default 2;
property GroupGradient: Integer read FGroupGradient write SetGroupGradient default 0;
property ArrowColor: TColor read FArrowColor write FArrowColor default clBlue;
property ArrowImageIndex: TImageIndex read FArrowImageIndex write SetArrowImageIndex default -1;
property ArrowImages: TCustomImageList read FArrowImages write SetArrowImages;
property Background: TPicture read FBackground write SetBackground;
property BackgroundHorzAlignment: THorzAlignment read FBackgroundHorzAlignment write SetBackgroundHorzAlignment default haLeft;
property BackgroundVertAlignment: TVertAlignment read FBackgroundVertAlignment write SetBackgroundVertAlignment default vaTop;
property BlurShadow: Boolean read FBlurShadow write SetBlurShadow default True;
property Color: TColor read FColor write FColor default clWindow;
property GroupColors: TX2MenuBarunaGroupColors read FGroupColors write SetGroupColors;
property GroupGradient: Integer read FGroupGradient write SetGroupGradient default 0;
property ItemColors: TX2MenuBarunaColor read FItemColors write SetItemColors;
property Metrics: TX2MenuBarunaMetrics read FMetrics write SetMetrics;
property ShadowColor: TColor read FShadowColor write SetShadowColor default clBtnShadow;
property ShadowOffset: Integer read FShadowOffset write SetShadowOffset default 2;
end;
implementation
@ -221,7 +448,7 @@ var
begin
ASource.PixelFormat := pf32bit;
refBitmap := Graphics.TBitmap.Create();
refBitmap := Graphics.TBitmap.Create;
try
refBitmap.Assign(ASource);
@ -297,7 +524,7 @@ end;
{ TX2MenuBarunaMetrics }
constructor TX2MenuBarunaMetrics.Create();
constructor TX2MenuBarunaMetrics.Create;
begin
inherited;
@ -338,7 +565,7 @@ begin
if Value <> FAfterGroupHeader then
begin
FAfterGroupHeader := Value;
Changed();
Changed;
end;
end;
@ -347,7 +574,7 @@ begin
if Value <> FAfterItem then
begin
FAfterItem := Value;
Changed();
Changed;
end;
end;
@ -356,7 +583,7 @@ begin
if Value <> FAfterLastItem then
begin
FAfterLastItem := Value;
Changed();
Changed;
end;
end;
@ -365,7 +592,7 @@ begin
if Value <> FBeforeFirstItem then
begin
FBeforeFirstItem := Value;
Changed();
Changed;
end;
end;
@ -374,7 +601,7 @@ begin
if Value <> FBeforeGroupHeader then
begin
FBeforeGroupHeader := Value;
Changed();
Changed;
end;
end;
@ -383,7 +610,7 @@ begin
if Value <> FBeforeItem then
begin
FBeforeItem := Value;
Changed();
Changed;
end;
end;
@ -392,7 +619,7 @@ begin
if Value <> FGroupHeight then
begin
FGroupHeight := Value;
Changed();
Changed;
end;
end;
@ -401,7 +628,7 @@ begin
if Value <> FItemHeight then
begin
FItemHeight := Value;
Changed();
Changed;
end;
end;
@ -410,7 +637,7 @@ begin
if Value <> FMargin then
begin
FMargin := Value;
Changed();
Changed;
end;
end;
@ -420,7 +647,7 @@ begin
if Value <> FImageOffsetX then
begin
FImageOffsetX := Value;
Changed();
Changed;
end;
end;
@ -430,7 +657,7 @@ begin
if Value <> FImageOffsetY then
begin
FImageOffsetY := Value;
Changed();
Changed;
end;
end;
@ -442,21 +669,26 @@ begin
FArrowImageIndex := -1;
FBlurShadow := True;
FGroupColors := TX2MenuBarunaGroupColors.Create();
FItemColors := TX2MenuBarunaColor.Create();
FMetrics := TX2MenuBarunaMetrics.Create();
FGroupColors := TX2MenuBarunaGroupColors.Create;
FItemColors := TX2MenuBarunaColor.Create;
FMetrics := TX2MenuBarunaMetrics.Create;
FShadowOffset := 2;
FBackground := TPicture.Create;
FBackgroundHorzAlignment := haLeft;
FBackgroundVertAlignment := vaTop;
FGroupColors.OnChange := ColorChange;
FItemColors.OnChange := ColorChange;
FMetrics.OnChange := ColorChange;
ResetColors();
ResetColors;
end;
destructor TX2MenuBarunaPainter.Destroy();
destructor TX2MenuBarunaPainter.Destroy;
begin
SetArrowImages(nil);
FreeAndNil(FBackground);
FreeAndNil(FMetrics);
FreeAndNil(FItemColors);
FreeAndNil(FGroupColors);
@ -465,7 +697,7 @@ begin
end;
procedure TX2MenuBarunaPainter.ResetColors();
procedure TX2MenuBarunaPainter.ResetColors;
const
PurpleBlue = $00BE6363;
@ -497,7 +729,7 @@ begin
if Value <> FBlurShadow then
begin
FBlurShadow := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -508,6 +740,14 @@ begin
InflateRect(Result, -Metrics.Margin, -Metrics.Margin);
end;
function TX2MenuBarunaPainter.UndoMargins(const ABounds: TRect): TRect;
begin
Result := inherited UndoMargins(ABounds);
InflateRect(Result, Metrics.Margin, Metrics.Margin);
end;
function TX2MenuBarunaPainter.GetSpacing(AElement: TX2MenuBarSpacingElement): Integer;
begin
Result := inherited GetSpacing(AElement);
@ -534,12 +774,38 @@ end;
procedure TX2MenuBarunaPainter.DrawBackground(ACanvas: TCanvas;
const ABounds: TRect);
const ABounds: TRect;
const AOffset: TPoint);
var
pos: TPoint;
begin
ACanvas.Brush.Color := Self.Color;
ACanvas.FillRect(ABounds);
if (Background.Width > 0) and
(Background.Height > 0) then
begin
case BackgroundHorzAlignment of
haLeft: pos.X := 0;
haCenter: pos.X := (MenuBar.ClientWidth - Background.Width) div 2;
haRight: pos.X := ABounds.Right - Background.Width;
end;
case BackgroundVertAlignment of
vaTop: pos.Y := 0;
vaCenter: pos.Y := (MenuBar.ClientHeight - Background.Height) div 2;
vaBottom: pos.Y := MenuBar.ClientHeight - Background.Height;
end;
Dec(pos.X, AOffset.X);
Dec(pos.Y, AOffset.Y);
ACanvas.Draw(pos.X, pos.Y, Background.Graphic);
end;
end;
procedure TX2MenuBarunaPainter.DrawGroupHeader(ACanvas: TCanvas;
AGroup: TX2MenuBarGroup;
const ABounds: TRect;
@ -579,6 +845,7 @@ var
clipRegion: HRGN;
startColor: TColor;
endColor: TColor;
groupOffset: TPoint;
begin
if not ((mdsSelected in AState) or (mdsGroupSelected in AState)) then
@ -586,14 +853,16 @@ begin
{ Shadow }
if BlurShadow then
begin
shadowBitmap := Graphics.TBitmap.Create();
shadowBitmap := Graphics.TBitmap.Create;
try
shadowBitmap.PixelFormat := pf32bit;
shadowBitmap.Width := (ABounds.Right - ABounds.Left + (ShadowMargin * 2));
shadowBitmap.Height := (ABounds.Bottom - ABounds.Top + (ShadowMargin * 2));
DrawBackground(shadowBitmap.Canvas, Rect(0, 0, shadowBitmap.Width,
shadowBitmap.Height));
shadowBounds := Rect(0, 0, shadowBitmap.Width, shadowBitmap.Height);
groupOffset := ABounds.TopLeft;
DrawBackground(shadowBitmap.Canvas, shadowBounds, groupOffset);
DrawShadowOutline(shadowBitmap.Canvas, Rect(0, 0, shadowBitmap.Width - (ShadowMargin * 2),
shadowBitmap.Height - (ShadowMargin * 2)));
@ -690,7 +959,7 @@ var
begin
focusBounds := ABounds;
if HasArrowImage() then
if HasArrowImage then
Dec(focusBounds.Right, ArrowImages.Width + ArrowMargin)
else
Dec(focusBounds.Right, ArrowWidth + ArrowMargin);
@ -727,7 +996,7 @@ var
arrowPoints: array[0..2] of TPoint;
begin
if HasArrowImage() then
if HasArrowImage then
begin
arrowX := ABounds.Right - ArrowImages.Width;
arrowY := ABounds.Top + ((ABounds.Bottom - ABounds.Top - ArrowImages.Height) div 2);
@ -750,11 +1019,11 @@ end;
procedure TX2MenuBarunaPainter.ColorChange(Sender: TObject);
begin
NotifyObservers();
NotifyObservers;
end;
function TX2MenuBarunaPainter.HasArrowImage(): Boolean;
function TX2MenuBarunaPainter.HasArrowImage: Boolean;
begin
Result := Assigned(ArrowImages) and (ArrowImageIndex > -1);
end;
@ -774,7 +1043,7 @@ begin
if Value <> FGroupColors then
begin
FGroupColors.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -783,7 +1052,7 @@ begin
if Value <> FItemColors then
begin
FItemColors.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -792,7 +1061,7 @@ begin
if Value <> FMetrics then
begin
FMetrics.Assign(Value);
NotifyObservers();
NotifyObservers;
end;
end;
@ -801,7 +1070,7 @@ begin
if Value <> FShadowColor then
begin
FShadowColor := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -810,7 +1079,7 @@ begin
if Value <> FShadowOffset then
begin
FShadowOffset := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -820,7 +1089,7 @@ begin
if Value <> FGroupGradient then
begin
FGroupGradient := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -830,7 +1099,7 @@ begin
if Value <> FArrowImageIndex then
begin
FArrowImageIndex := Value;
NotifyObservers();
NotifyObservers;
end;
end;
@ -847,13 +1116,40 @@ begin
if Assigned(FArrowImages) then
FArrowImages.FreeNotification(Self);
NotifyObservers();
NotifyObservers;
end;
end;
procedure TX2MenuBarunaPainter.SetBackground(const Value: TPicture);
begin
FBackground.Assign(Value);
NotifyObservers;
end;
procedure TX2MenuBarunaPainter.SetBackgroundHorzAlignment(const Value: THorzAlignment);
begin
if Value <> FBackgroundHorzAlignment then
begin
FBackgroundHorzAlignment := Value;
NotifyObservers;
end;
end;
procedure TX2MenuBarunaPainter.SetBackgroundVertAlignment(const Value: TVertAlignment);
begin
if Value <> FBackgroundVertAlignment then
begin
FBackgroundVertAlignment := Value;
NotifyObservers;
end;
end;
{ TX2MenuBarunaProperty }
procedure TX2MenuBarunaProperty.Changed();
procedure TX2MenuBarunaProperty.Changed;
begin
if Assigned(FOnChange) then
FOnChange(Self);
@ -879,22 +1175,22 @@ begin
inherited;
end;
function TX2MenuBarunaColor.IsDisabledStored(): Boolean;
function TX2MenuBarunaColor.IsDisabledStored: Boolean;
begin
Result := (FDisabled <> FDefaultDisabled);
end;
function TX2MenuBarunaColor.IsHotStored(): Boolean;
function TX2MenuBarunaColor.IsHotStored: Boolean;
begin
Result := (FHot <> FDefaultHot);
end;
function TX2MenuBarunaColor.IsNormalStored(): Boolean;
function TX2MenuBarunaColor.IsNormalStored: Boolean;
begin
Result := (FNormal <> FDefaultNormal);
end;
function TX2MenuBarunaColor.IsSelectedStored(): Boolean;
function TX2MenuBarunaColor.IsSelectedStored: Boolean;
begin
Result := (FSelected <> FDefaultSelected);
end;
@ -916,7 +1212,7 @@ begin
if Value <> FDisabled then
begin
FDisabled := Value;
Changed();
Changed;
end;
end;
@ -925,7 +1221,7 @@ begin
if Value <> FHot then
begin
FHot := Value;
Changed();
Changed;
end;
end;
@ -934,7 +1230,7 @@ begin
if Value <> FNormal then
begin
FNormal := Value;
Changed();
Changed;
end;
end;
@ -943,26 +1239,26 @@ begin
if Value <> FSelected then
begin
FSelected := Value;
Changed();
Changed;
end;
end;
{ TX2MenuBarunaGroupColors }
constructor TX2MenuBarunaGroupColors.Create();
constructor TX2MenuBarunaGroupColors.Create;
begin
inherited;
FBorder := TX2MenuBarunaColor.Create();
FFill := TX2MenuBarunaColor.Create();
FText := TX2MenuBarunaColor.Create();
FBorder := TX2MenuBarunaColor.Create;
FFill := TX2MenuBarunaColor.Create;
FText := TX2MenuBarunaColor.Create;
FBorder.OnChange := ColorChange;
FFill.OnChange := ColorChange;
FText.OnChange := ColorChange;
end;
destructor TX2MenuBarunaGroupColors.Destroy();
destructor TX2MenuBarunaGroupColors.Destroy;
begin
FreeAndNil(FText);
FreeAndNil(FFill);
@ -988,7 +1284,7 @@ end;
procedure TX2MenuBarunaGroupColors.ColorChange(Sender: TObject);
begin
Changed();
Changed;
end;
@ -997,7 +1293,7 @@ begin
if Value <> FBorder then
begin
FBorder.Assign(Value);
Changed();
Changed;
end;
end;
@ -1006,7 +1302,7 @@ begin
if Value <> FFill then
begin
FFill.Assign(Value);
Changed();
Changed;
end;
end;
@ -1015,7 +1311,7 @@ begin
if Value <> FText then
begin
FText.Assign(Value);
Changed();
Changed;
end;
end;