You've already forked lazarus-ccr
* Implement system check images for gtk/Qt
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1057 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -5331,15 +5331,15 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure CreateSystemImageSet(BM: TBitmap; Flat: Boolean);
|
procedure CreateSystemImageSet(BM: TBitmap; Flat: Boolean; TreeColor: TColor);
|
||||||
|
|
||||||
// Creates a system check image set.
|
// Creates a system check image set.
|
||||||
// Note: some images are copied from DarkCheckImages and FlatImages
|
// Note: some images are copied from DarkCheckImages and FlatImages
|
||||||
|
|
||||||
const
|
const
|
||||||
MaskColor: TColor = clFuchsia;
|
|
||||||
FlatToCheckKind: array[Boolean] of TCheckImageKind = (ckDarkCheck,ckFlat);
|
FlatToCheckKind: array[Boolean] of TCheckImageKind = (ckDarkCheck,ckFlat);
|
||||||
|
|
||||||
|
|
||||||
//--------------- local functions -------------------------------------------
|
//--------------- local functions -------------------------------------------
|
||||||
|
|
||||||
procedure AddSystemImage(Index: Integer);
|
procedure AddSystemImage(Index: Integer);
|
||||||
@ -5378,29 +5378,48 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
I, Width, Height: Integer;
|
I, Width, Height: Integer;
|
||||||
|
MaskColor: TColor;
|
||||||
|
{$ifndef LCLWin32}
|
||||||
|
TmpBitmap: TBitmap;
|
||||||
|
R: TRect;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
|
{$ifdef LCLWin32}
|
||||||
//todo implement under gtk
|
//todo implement under gtk
|
||||||
{$ifdef Windows}
|
|
||||||
Width := GetSystemMetrics(SM_CXMENUCHECK) + 3;
|
Width := GetSystemMetrics(SM_CXMENUCHECK) + 3;
|
||||||
Height := GetSystemMetrics(SM_CYMENUCHECK) + 3;
|
Height := GetSystemMetrics(SM_CYMENUCHECK) + 3;
|
||||||
{$else}
|
MaskColor := clFuchsia;
|
||||||
Width := 16;
|
|
||||||
Height := 16;
|
|
||||||
{$endif}
|
|
||||||
// Use the 4 node images from the dark check set.
|
// Use the 4 node images from the dark check set.
|
||||||
BM.LoadFromLazarusResource(CheckImagesStrings[FlatToCheckKind[Flat]]);
|
BM.LoadFromLazarusResource(CheckImagesStrings[FlatToCheckKind[Flat]]);
|
||||||
//DrawFrameControl is not properly implemented in gtk
|
|
||||||
{$ifdef Windows}
|
|
||||||
BM.Canvas.Brush.Color := MaskColor;
|
BM.Canvas.Brush.Color := MaskColor;
|
||||||
//clear the first 21 images
|
// Clear the first 21 images
|
||||||
BM.Canvas.FillRect(Rect(0, 0, Width * 21, BM.Height));
|
BM.Canvas.FillRect(Rect(0, 0, Width * 21, BM.Height));
|
||||||
|
{$else}
|
||||||
|
// Workaround to avoid glitches in Gtk/Qt due to antialias
|
||||||
|
Width := 16;
|
||||||
|
Height := 16;
|
||||||
|
MaskColor := TreeColor;
|
||||||
|
// Use the 4 node images from the dark check set.
|
||||||
|
TmpBitmap := TBitmap.Create;
|
||||||
|
TmpBitmap.LoadFromLazarusResource(CheckImagesStrings[FlatToCheckKind[Flat]]);
|
||||||
|
TmpBitmap.TransparentColor := clFuchsia;
|
||||||
|
TmpBitmap.Transparent := True;
|
||||||
|
// Prepare the bitmap
|
||||||
|
BM.SetSize(TmpBitmap.Width, TmpBitmap.Height);
|
||||||
|
BM.Canvas.Brush.Color := MaskColor;
|
||||||
|
BM.Canvas.FillRect(Rect(0, 0, BM.Width, BM.Height));
|
||||||
|
// Copy the last 04 images
|
||||||
|
R := Rect(Width * 21 + 1, 0, BM.Width, BM.Height);
|
||||||
|
StretchMaskBlt(BM.Canvas.Handle, R.Left, R.Top, R.Right - R.Left , R.Bottom,
|
||||||
|
TmpBitmap.Canvas.Handle, R.Left, R.Top, R.Right - R.Left , R.Bottom,
|
||||||
|
TmpBitmap.MaskHandle, R.Left, R.Top, cmSrcCopy);
|
||||||
|
TmpBitmap.Destroy;
|
||||||
|
{$endif}
|
||||||
// Add the 20 system checkbox and radiobutton images.
|
// Add the 20 system checkbox and radiobutton images.
|
||||||
for I := 0 to 19 do
|
for I := 0 to 19 do
|
||||||
AddSystemImage(I);
|
AddSystemImage(I);
|
||||||
BM.TransparentColor := MaskColor;
|
BM.TransparentColor := MaskColor;
|
||||||
BM.Transparent := True;
|
BM.Transparent := True;
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -21001,9 +21020,9 @@ begin
|
|||||||
FCheckImages := TBitmap.Create;
|
FCheckImages := TBitmap.Create;
|
||||||
case FCheckImageKind of
|
case FCheckImageKind of
|
||||||
ckSystemDefault:
|
ckSystemDefault:
|
||||||
CreateSystemImageSet(FCheckImages, False);
|
CreateSystemImageSet(FCheckImages, False, Color);
|
||||||
ckSystemFlat:
|
ckSystemFlat:
|
||||||
CreateSystemImageSet(FCheckImages, True);
|
CreateSystemImageSet(FCheckImages, True, Color);
|
||||||
else
|
else
|
||||||
FCheckImages.TransparentColor := clDefault;
|
FCheckImages.TransparentColor := clDefault;
|
||||||
FCheckImages.LoadFromLazarusResource(CheckImagesStrings[FCheckImageKind]);
|
FCheckImages.LoadFromLazarusResource(CheckImagesStrings[FCheckImageKind]);
|
||||||
|
Reference in New Issue
Block a user