Added: ImagePosition property for MenuBar musikCube painter
This commit is contained in:
parent
b54cdd968e
commit
9437806b34
@ -74,6 +74,8 @@ type
|
||||
property Selected: TX2MenuBarmCColor read FSelected write SetSelected;
|
||||
end;
|
||||
|
||||
TImagePosition = (ipLeft, ipRight);
|
||||
|
||||
// #ToDo1 (MvR) 19-3-2006: Custom base class?
|
||||
TX2MenuBarmusikCubePainter = class(TX2CustomMenuBarPainter)
|
||||
private
|
||||
@ -84,6 +86,7 @@ type
|
||||
FItemColors: TX2MenuBarmCColors;
|
||||
FItemHeight: Integer;
|
||||
FItemDisabledColor: TColor;
|
||||
FImagePosition: TImagePosition;
|
||||
|
||||
procedure SetColor(const Value: TColor);
|
||||
procedure SetGroupColors(const Value: TX2MenuBarmCColors);
|
||||
@ -92,6 +95,7 @@ type
|
||||
procedure SetItemColors(const Value: TX2MenuBarmCColors);
|
||||
procedure SetItemHeight(const Value: Integer);
|
||||
procedure SetItemDisabledColor(const Value: TColor);
|
||||
procedure SetImagePosition(const Value: TImagePosition);
|
||||
protected
|
||||
procedure ColorChange(Sender: TObject);
|
||||
|
||||
@ -113,6 +117,7 @@ type
|
||||
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 ImagePosition: TImagePosition read FImagePosition write SetImagePosition default ipLeft;
|
||||
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;
|
||||
@ -133,6 +138,7 @@ begin
|
||||
FItemDisabledColor := clGrayText;
|
||||
FGroupColors := TX2MenuBarmCColors.Create;
|
||||
FGroupHeight := 22;
|
||||
FImagePosition := ipLeft;
|
||||
FIndicatorColors := TX2MenuBarmCColors.Create;
|
||||
FItemColors := TX2MenuBarmCColors.Create;
|
||||
FItemHeight := 22;
|
||||
@ -300,6 +306,7 @@ var
|
||||
indicatorColor: TX2MenuBarmCColor;
|
||||
textBounds: TRect;
|
||||
imageList: TCustomImageList;
|
||||
imgX: Integer;
|
||||
imgY: Integer;
|
||||
|
||||
begin
|
||||
@ -326,22 +333,32 @@ begin
|
||||
|
||||
textBounds := itemBounds;
|
||||
Inc(textBounds.Left, 4);
|
||||
Dec(textBounds.Right, 4);
|
||||
|
||||
imageList := MenuBar.Images;
|
||||
if Assigned(imageList) then
|
||||
begin
|
||||
if AItem.ImageIndex > -1 then
|
||||
begin
|
||||
if ImagePosition = ipRight then
|
||||
imgX := textBounds.Right - imageList.Width
|
||||
else
|
||||
imgX := textBounds.Left;
|
||||
|
||||
imgY := textBounds.Top + ((textBounds.Bottom - textBounds.Top -
|
||||
imageList.Height) div 2);
|
||||
|
||||
if (mdsHot in AState) or (mdsSelected in AState) then
|
||||
imageList.Draw(ACanvas, textBounds.Left, imgY, AItem.ImageIndex)
|
||||
imageList.Draw(ACanvas, imgX, imgY, AItem.ImageIndex)
|
||||
else
|
||||
DrawBlended(ACanvas, imageList, textBounds.Left, imgY,
|
||||
DrawBlended(ACanvas, imageList, imgX, imgY,
|
||||
AItem.ImageIndex, 128);
|
||||
|
||||
if ImagePosition = ipRight then
|
||||
Dec(textBounds.Right, imageList.Width + 4);
|
||||
end;
|
||||
|
||||
if ImagePosition = ipLeft then
|
||||
Inc(textBounds.Left, imageList.Width + 4);
|
||||
end;
|
||||
|
||||
@ -369,6 +386,15 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TX2MenuBarmusikCubePainter.SetImagePosition(const Value: TImagePosition);
|
||||
begin
|
||||
if Value <> FImagePosition then
|
||||
begin
|
||||
FImagePosition := Value;
|
||||
NotifyObservers;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TX2MenuBarmusikCubePainter.SetIndicatorColors(const Value: TX2MenuBarmCColors);
|
||||
begin
|
||||
if Value <> FIndicatorColors then
|
||||
|
@ -1,215 +1,3 @@
|
||||
{$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.
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user