mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 13:19:20 +02:00
lcl: add TCustomForm.AlphaBlend, TCustomForm.AlphaBlendValue, change TWsCustomForm.SetAlphaBlend
git-svn-id: trunk@23565 -
This commit is contained in:
parent
bbf658b1c9
commit
3208c507b6
@ -390,6 +390,8 @@ type
|
|||||||
FActiveControl: TWinControl;
|
FActiveControl: TWinControl;
|
||||||
FActiveDefaultControl: TControl;
|
FActiveDefaultControl: TControl;
|
||||||
FAllowDropFiles: Boolean;
|
FAllowDropFiles: Boolean;
|
||||||
|
FAlphaBlend: Boolean;
|
||||||
|
FAlphaBlendValue: Byte;
|
||||||
FBorderIcons: TBorderIcons;
|
FBorderIcons: TBorderIcons;
|
||||||
FDefaultControl: TControl;
|
FDefaultControl: TControl;
|
||||||
FCancelControl: TControl;
|
FCancelControl: TControl;
|
||||||
@ -440,6 +442,8 @@ type
|
|||||||
procedure SetActiveControl(AWinControl: TWinControl);
|
procedure SetActiveControl(AWinControl: TWinControl);
|
||||||
procedure SetActiveDefaultControl(AControl: TControl);
|
procedure SetActiveDefaultControl(AControl: TControl);
|
||||||
procedure SetAllowDropFiles(const AValue: Boolean);
|
procedure SetAllowDropFiles(const AValue: Boolean);
|
||||||
|
procedure SetAlphaBlend(const AValue: Boolean);
|
||||||
|
procedure SetAlphaBlendValue(const AValue: Byte);
|
||||||
procedure SetBorderIcons(NewIcons: TBorderIcons);
|
procedure SetBorderIcons(NewIcons: TBorderIcons);
|
||||||
procedure SetFormBorderStyle(NewStyle: TFormBorderStyle);
|
procedure SetFormBorderStyle(NewStyle: TFormBorderStyle);
|
||||||
procedure SetCancelControl(NewControl: TControl);
|
procedure SetCancelControl(NewControl: TControl);
|
||||||
@ -582,6 +586,8 @@ type
|
|||||||
property ActiveControl: TWinControl read FActiveControl write SetActiveControl;
|
property ActiveControl: TWinControl read FActiveControl write SetActiveControl;
|
||||||
property ActiveDefaultControl: TControl read FActiveDefaultControl write SetActiveDefaultControl;
|
property ActiveDefaultControl: TControl read FActiveDefaultControl write SetActiveDefaultControl;
|
||||||
property AllowDropFiles: Boolean read FAllowDropFiles write SetAllowDropFiles default False;
|
property AllowDropFiles: Boolean read FAllowDropFiles write SetAllowDropFiles default False;
|
||||||
|
property AlphaBlend: Boolean read FAlphaBlend write SetAlphaBlend;
|
||||||
|
property AlphaBlendValue: Byte read FAlphaBlendValue write SetAlphaBlendValue;
|
||||||
property AutoScroll stored IsAutoScrollStored;
|
property AutoScroll stored IsAutoScrollStored;
|
||||||
property BorderIcons: TBorderIcons read FBorderIcons write SetBorderIcons
|
property BorderIcons: TBorderIcons read FBorderIcons write SetBorderIcons
|
||||||
default [biSystemMenu, biMinimize, biMaximize];
|
default [biSystemMenu, biMinimize, biMaximize];
|
||||||
@ -654,6 +660,8 @@ type
|
|||||||
property ActiveControl;
|
property ActiveControl;
|
||||||
property Align;
|
property Align;
|
||||||
property AllowDropFiles;
|
property AllowDropFiles;
|
||||||
|
property AlphaBlend default False;
|
||||||
|
property AlphaBlendValue default 255;
|
||||||
property AutoScroll;
|
property AutoScroll;
|
||||||
property AutoSize;
|
property AutoSize;
|
||||||
property BiDiMode;
|
property BiDiMode;
|
||||||
|
@ -1491,6 +1491,24 @@ begin
|
|||||||
TWSCustomFormClass(WidgetSetClass).SetAllowDropFiles(Self, AValue);
|
TWSCustomFormClass(WidgetSetClass).SetAllowDropFiles(Self, AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomForm.SetAlphaBlend(const AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FAlphaBlend = AValue then
|
||||||
|
Exit;
|
||||||
|
FAlphaBlend := AValue;
|
||||||
|
if not (csDesigning in ComponentState) and HandleAllocated then
|
||||||
|
TWSCustomFormClass(WidgetSetClass).SetAlphaBlend(Self, AlphaBlend, AlphaBlendValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomForm.SetAlphaBlendValue(const AValue: Byte);
|
||||||
|
begin
|
||||||
|
if FAlphaBlendValue = AValue then
|
||||||
|
Exit;
|
||||||
|
FAlphaBlendValue := AValue;
|
||||||
|
if not (csDesigning in ComponentState) and HandleAllocated then
|
||||||
|
TWSCustomFormClass(WidgetSetClass).SetAlphaBlend(Self, AlphaBlend, AlphaBlendValue);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomForm SetFormStyle
|
TCustomForm SetFormStyle
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -1592,6 +1610,8 @@ begin
|
|||||||
FBorderIcons := [biSystemMenu, biMinimize, biMaximize];
|
FBorderIcons := [biSystemMenu, biMinimize, biMaximize];
|
||||||
FDefaultMonitor := dmActiveForm;
|
FDefaultMonitor := dmActiveForm;
|
||||||
FShowInTaskbar := stDefault;
|
FShowInTaskbar := stDefault;
|
||||||
|
FAlphaBlend := False;
|
||||||
|
FAlphaBlendValue := 255;
|
||||||
// set border style before handle is allocated
|
// set border style before handle is allocated
|
||||||
if not (fsBorderStyleChanged in FFormState) then
|
if not (fsBorderStyleChanged in FFormState) then
|
||||||
FFormBorderStyle:= bsSizeable;
|
FFormBorderStyle:= bsSizeable;
|
||||||
|
@ -620,7 +620,7 @@ begin
|
|||||||
|
|
||||||
p := GetProcAddress(user32handle, 'SetLayeredWindowAttributes');
|
p := GetProcAddress(user32handle, 'SetLayeredWindowAttributes');
|
||||||
if p <> nil
|
if p <> nil
|
||||||
then Pointer(SetLayout) := p;
|
then Pointer(SetLayeredWindowAttributes) := p;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
|
@ -85,7 +85,8 @@ type
|
|||||||
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
|
class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override;
|
||||||
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
|
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); override;
|
||||||
class procedure ShowModal(const ACustomForm: TCustomForm); override;
|
class procedure ShowModal(const ACustomForm: TCustomForm); override;
|
||||||
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; Alpha: single); override;
|
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean;
|
||||||
|
const Alpha: Byte); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWin32WSForm }
|
{ TWin32WSForm }
|
||||||
@ -483,23 +484,26 @@ begin
|
|||||||
BringWindowToTop(ACustomForm.Handle);
|
BringWindowToTop(ACustomForm.Handle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm; Alpha: single);
|
class procedure TWin32WSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
|
||||||
|
const AlphaBlend: Boolean; const Alpha: Byte);
|
||||||
var
|
var
|
||||||
style : LongWord;
|
Style: DWord;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ACustomForm, 'SetAlphaBlend') then
|
if not WSCheckHandleAllocated(ACustomForm, 'SetAlphaBlend') then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if Alpha<0 then Alpha:=0
|
Style := GetWindowLong(ACustomForm.Handle, GWL_EXSTYLE);
|
||||||
else if Alpha>1 then Alpha:=1;
|
|
||||||
style:=GetWindowLong(ACustomForm.Handle,GWL_EXSTYLE);
|
if AlphaBlend then
|
||||||
if Alpha<1 then
|
|
||||||
begin
|
begin
|
||||||
if (style and WS_EX_LAYERED) = 0 then SetWindowLong(ACustomForm.Handle, GWL_EXSTYLE, style or WS_EX_LAYERED);
|
if (Style and WS_EX_LAYERED) = 0 then
|
||||||
Win32Extra.SetLayeredWindowAttributes(ACustomForm.Handle, 0, Round(Alpha*255), LWA_ALPHA);
|
SetWindowLong(ACustomForm.Handle, GWL_EXSTYLE, Style or WS_EX_LAYERED);
|
||||||
|
Win32Extra.SetLayeredWindowAttributes(ACustomForm.Handle, 0, Alpha, LWA_ALPHA);
|
||||||
end
|
end
|
||||||
else begin
|
else
|
||||||
SetWindowLong(ACustomForm.Handle, GWL_EXSTYLE, style and not WS_EX_LAYERED);
|
begin
|
||||||
|
if (Style and WS_EX_LAYERED) <> 0 then
|
||||||
|
SetWindowLong(ACustomForm.Handle, GWL_EXSTYLE, Style and not WS_EX_LAYERED);
|
||||||
RedrawWindow(ACustomForm.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME or RDW_ALLCHILDREN);
|
RedrawWindow(ACustomForm.Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME or RDW_ALLCHILDREN);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -91,7 +91,8 @@ type
|
|||||||
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); virtual;
|
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); virtual;
|
||||||
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual;
|
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual;
|
||||||
class procedure ShowModal(const ACustomForm: TCustomForm); virtual;
|
class procedure ShowModal(const ACustomForm: TCustomForm); virtual;
|
||||||
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; AlphaValue: single); virtual;
|
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean;
|
||||||
|
const Alpha: Byte); virtual;
|
||||||
end;
|
end;
|
||||||
TWSCustomFormClass = class of TWSCustomForm;
|
TWSCustomFormClass = class of TWSCustomForm;
|
||||||
|
|
||||||
@ -180,7 +181,8 @@ class procedure TWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm; AlphaValue: single);
|
class procedure TWSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
|
||||||
|
const AlphaBlend: Boolean; const Alpha: Byte);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user