You've already forked lazarus-ccr
tvplanit: Provide image list for the dayview icons.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6436 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -5,7 +5,7 @@ unit VpDayViewPainter;
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, LCLType, LCLIntf, Types, Classes, Graphics,
|
||||
SysUtils, LCLType, LCLIntf, Types, Classes, Graphics, ImgList,
|
||||
VpConst, VPBase, VpData, VpBasePainter, VpDayView;
|
||||
|
||||
type
|
||||
@ -83,6 +83,7 @@ type
|
||||
function CountOverlappingEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer;
|
||||
procedure CreateBitmaps;
|
||||
function DetermineIconRect(AEventRect: TRect): TRect;
|
||||
function GetImageList: TCustomImageList;
|
||||
function GetMaxOLEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer;
|
||||
procedure DrawAllDayEvents;
|
||||
procedure DrawBorders;
|
||||
@ -229,6 +230,15 @@ begin
|
||||
Result.Right := AEventRect.Right;
|
||||
end;
|
||||
|
||||
{ Returns the imagelist attached to the datastore of the dayview. }
|
||||
function TVpDayViewPainter.GetImageList: TCustomImageList;
|
||||
begin
|
||||
if (FDayView <> nil) and (FDayView.Datastore <> nil) then
|
||||
Result := FDayView.Datastore.Images
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
{ returns the maximum OLEvents value from all overlapping neighbors }
|
||||
function TVpDayViewPainter.GetMaxOLEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer;
|
||||
var
|
||||
@ -1564,20 +1574,29 @@ var
|
||||
R: TRect;
|
||||
isOverlayed: Boolean;
|
||||
grp: TVpResourceGroup;
|
||||
imgList: TCustomImageList;
|
||||
begin
|
||||
ShowAlarm := False;
|
||||
ShowRecurring := False;
|
||||
ShowCategory := False;
|
||||
ShowCustom := False;
|
||||
|
||||
imgList := GetImageList;
|
||||
|
||||
if Event.AlarmSet then begin
|
||||
dvBmpAlarm.Assign(FDayView.IconAttributes.AlarmBitmap);
|
||||
if (FDayView.IconAttributes.AlarmImageIndex > -1) and (imgList <> nil) then
|
||||
imgList.Getbitmap(FDayView.IconAttributes.AlarmImageIndex, dvBmpAlarm)
|
||||
else
|
||||
dvBmpAlarm.Assign(FDayView.IconAttributes.AlarmBitmap);
|
||||
ShowAlarm := (dvBmpAlarm.Width <> 0) and (dvBmpAlarm.Height <> 0);
|
||||
end;
|
||||
|
||||
if Event.RepeatCode <> rtNone then
|
||||
begin
|
||||
dvBmpRecurring.Assign(FDayView.IconAttributes.RecurringBitmap);
|
||||
if (FDayView.IconAttributes.RecurringImageIndex > -1) and (imgList <> nil) then
|
||||
imgList.GetBitmap(FDayview.IconAttributes.RecurringImageIndex, dvBmpRecurring)
|
||||
else
|
||||
dvBmpRecurring.Assign(FDayView.IconAttributes.RecurringBitmap);
|
||||
ShowRecurring := (dvBmpRecurring.Width <> 0) and (dvBmpRecurring.Height <> 0);
|
||||
end;
|
||||
|
||||
@ -1593,7 +1612,10 @@ begin
|
||||
if Event.Category < 10 then
|
||||
begin
|
||||
cat := FDayView.Datastore.CategoryColorMap.GetCategory(Event.Category);
|
||||
dvBmpCategory.Assign(cat.Bitmap);
|
||||
if (cat.ImageIndex > -1) and (imgList <> nil) then
|
||||
imgList.GetBitmap(cat.ImageIndex, dvBmpCategory)
|
||||
else
|
||||
dvBmpCategory.Assign(cat.Bitmap);
|
||||
{
|
||||
w := cat.Bitmap.Width;
|
||||
h := cat.Bitmap.Height;
|
||||
|
Reference in New Issue
Block a user