mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 21:00:07 +02:00
lcl: use message CM_PARENTFONTCHANGED to notify of parent font change. This is Delphi compatible, fixes the order of the font change events and is consistent with the other parent properties notifications: Color, ShowHint, BidiMode
git-svn-id: trunk@23246 -
This commit is contained in:
parent
55d2de062f
commit
442c987512
@ -1113,6 +1113,7 @@ type
|
|||||||
procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW;
|
procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW;
|
||||||
procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
|
procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
|
||||||
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
|
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
|
||||||
|
procedure CMParentFontChanged(var Message: TLMessage); message CM_PARENTFONTCHANGED;
|
||||||
procedure CMParentShowHintChanged(var Message: TLMessage); message CM_PARENTSHOWHINTCHANGED;
|
procedure CMParentShowHintChanged(var Message: TLMessage); message CM_PARENTSHOWHINTCHANGED;
|
||||||
procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED;
|
procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED;
|
||||||
procedure CMTextChanged(var Message: TLMessage); message CM_TEXTCHANGED;
|
procedure CMTextChanged(var Message: TLMessage); message CM_TEXTCHANGED;
|
||||||
|
@ -281,11 +281,7 @@ end;
|
|||||||
|
|
||||||
procedure TControl.ParentFontChanged;
|
procedure TControl.ParentFontChanged;
|
||||||
begin
|
begin
|
||||||
if csLoading in ComponentState then exit;
|
//kept for compatibility. The real work is done in CMParentFontChanged
|
||||||
|
|
||||||
if FParentFont then
|
|
||||||
Font := FParent.Font;
|
|
||||||
Perform(CM_PARENTFONTCHANGED, 0, 0);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.SetAction(Value: TBasicAction);
|
procedure TControl.SetAction(Value: TBasicAction);
|
||||||
@ -762,6 +758,21 @@ begin
|
|||||||
Color := FParent.Color;
|
Color := FParent.Color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
TControl.CMParentFontChanged
|
||||||
|
|
||||||
|
assumes: FParent <> nil
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TControl.CMParentFontChanged(var Message: TLMessage);
|
||||||
|
begin
|
||||||
|
if csLoading in ComponentState then exit;
|
||||||
|
|
||||||
|
if FParentFont then
|
||||||
|
Font := FParent.Font;
|
||||||
|
//call here for compatibility with older LCL code
|
||||||
|
ParentFontChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TControl.CMShowHintChanged
|
TControl.CMShowHintChanged
|
||||||
|
|
||||||
@ -3522,7 +3533,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FParentFont := Value;
|
FParentFont := Value;
|
||||||
if Assigned(FParent) and not (csReading in ComponentState) then
|
if Assigned(FParent) and not (csReading in ComponentState) then
|
||||||
ParentFontChanged;
|
Perform(CM_PARENTFONTCHANGED, 0, 0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -4546,7 +4546,7 @@ begin
|
|||||||
Include(FWinControlFlags, wcfFontChanged);
|
Include(FWinControlFlags, wcfFontChanged);
|
||||||
inherited;
|
inherited;
|
||||||
for i := 0 to ControlCount - 1 do
|
for i := 0 to ControlCount - 1 do
|
||||||
Controls[i].ParentFontChanged;
|
Controls[i].Perform(CM_PARENTFONTCHANGED, 0, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWinControl.SetColor(Value: TColor);
|
procedure TWinControl.SetColor(Value: TColor);
|
||||||
@ -5989,7 +5989,7 @@ begin
|
|||||||
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
||||||
AControl.Perform(CM_PARENTSHOWHINTCHANGED, 0, 0);
|
AControl.Perform(CM_PARENTSHOWHINTCHANGED, 0, 0);
|
||||||
AControl.Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
|
AControl.Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
|
||||||
AControl.ParentFontChanged;
|
AControl.Perform(CM_PARENTFONTCHANGED, 0, 0);
|
||||||
if AControl is TWinControl then
|
if AControl is TWinControl then
|
||||||
TWinControl(AControl).UpdateControlState
|
TWinControl(AControl).UpdateControlState
|
||||||
else
|
else
|
||||||
@ -7273,7 +7273,7 @@ begin
|
|||||||
TWSWinControlClass(WidgetSetClass).SetFont(Self,Font);
|
TWSWinControlClass(WidgetSetClass).SetFont(Self,Font);
|
||||||
NotifyControls(CM_PARENTCOLORCHANGED);
|
NotifyControls(CM_PARENTCOLORCHANGED);
|
||||||
for i := 0 to ControlCount - 1 do
|
for i := 0 to ControlCount - 1 do
|
||||||
Controls[i].ParentFontChanged;
|
Controls[i].Perform(CM_PARENTFONTCHANGED, 0, 0);
|
||||||
FWinControlFlags:=FWinControlFlags-[wcfFontChanged];
|
FWinControlFlags:=FWinControlFlags-[wcfFontChanged];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user