mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 23:29:50 +02:00
* removed CM_PARENTFONTCHANGED
* implemented ParentFont property (issue #1268) git-svn-id: trunk@8540 -
This commit is contained in:
parent
7d0a2cfe64
commit
1f51beb255
@ -861,6 +861,7 @@ type
|
||||
procedure SetMouseCapture(Value: Boolean);
|
||||
procedure SetParentShowHint(Value: Boolean);
|
||||
procedure SetParentColor(Value: Boolean);
|
||||
procedure SetParentFont(Value: Boolean);
|
||||
procedure SetPopupMenu(Value: TPopupMenu);
|
||||
procedure SetShowHint(Value: Boolean);
|
||||
procedure SetText(const Value: TCaption);
|
||||
@ -982,6 +983,7 @@ type
|
||||
procedure InvalidateControl(CtrlIsVisible, CtrlIsOpaque: Boolean);
|
||||
procedure InvalidateControl(CtrlIsVisible, CtrlIsOpaque, IgnoreWinControls: Boolean);
|
||||
procedure FontChanged(Sender: TObject); virtual;
|
||||
procedure ParentFontChanged; virtual;
|
||||
function GetAction: TBasicAction; virtual;
|
||||
function RealGetText: TCaption; virtual;
|
||||
procedure RealSetText(const Value: TCaption); virtual;
|
||||
@ -1023,8 +1025,8 @@ type
|
||||
property DragKind: TDragKind read FDragKind write FDragKind default dkDrag;
|
||||
property DragMode: TDragMode read fDragMode write SetDragMode default dmManual;
|
||||
property MouseCapture: Boolean read GetMouseCapture write SetMouseCapture;
|
||||
property ParentFont: Boolean read FParentFont write FParentFont;
|
||||
property ParentColor: Boolean read FParentColor write SetParentColor default true;
|
||||
property ParentFont: Boolean read FParentFont write SetParentFont;
|
||||
property ParentShowHint: Boolean read FParentShowHint write SetParentShowHint default True;
|
||||
property SessionProperties: string read FSessionProperties write FSessionProperties;
|
||||
property Text: TCaption read GetText write SetText;
|
||||
|
@ -1353,7 +1353,6 @@ begin
|
||||
CM_CONTROLLISTCHANGE: Result := 'CM_CONTROLLISTCHANGE';
|
||||
|
||||
CM_PARENTCOLORCHANGED: Result := 'CM_PARENTCOLORCHANGED';
|
||||
CM_PARENTFONTCHANGED: Result := 'CM_PARENTFONTCHANGED';
|
||||
CM_PARENTSHOWHINTCHANGED: Result := 'CM_PARENTSHOWHINTCHANGED';
|
||||
CM_PARENTBIDIMODECHANGED: Result := 'CM_PARENTBIDIMODECHANGED';
|
||||
CM_CONTROLCHANGE: Result := 'CM_CONTROLCHANGE';
|
||||
|
@ -276,9 +276,21 @@ end;
|
||||
|
||||
procedure TControl.FontChanged(Sender: TObject);
|
||||
begin
|
||||
ParentFont := False;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TControl.ParentFontChanged;
|
||||
begin
|
||||
if csLoading in ComponentState then exit;
|
||||
|
||||
if FParentFont then
|
||||
begin
|
||||
Font := FParent.Font;
|
||||
FParentFont := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TControl.SetAction(Value: TBasicAction);
|
||||
begin
|
||||
if (Value=Action) then exit;
|
||||
@ -2114,6 +2126,7 @@ end;
|
||||
procedure TControl.SetFont(Value: TFont);
|
||||
begin
|
||||
FFont.Assign(Value);
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -2419,9 +2432,16 @@ begin
|
||||
' CH=',DbgS(cfClientHeightLoaded in FControlFlags),'=',DbgS(FLoadedClientSize.Y),
|
||||
'');}
|
||||
|
||||
if Assigned(Parent) and ParentColor then begin
|
||||
Color := Parent.Color;
|
||||
ParentColor := true;
|
||||
if Assigned(Parent) then begin
|
||||
if ParentColor then begin
|
||||
Color := Parent.Color;
|
||||
ParentColor := true;
|
||||
end;
|
||||
|
||||
if ParentFont then begin
|
||||
Font := Parent.Font;
|
||||
ParentFont := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
UpdateBaseBounds(true,true,true);
|
||||
@ -2765,6 +2785,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TControl.SetParentFont(Value: Boolean);
|
||||
begin
|
||||
if FParentFont <> Value then
|
||||
begin
|
||||
FParentFont := Value;
|
||||
if Assigned(FParent) and not (csReading in ComponentState) then
|
||||
ParentFontChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl SetParentShowHint
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -2531,12 +2531,17 @@ begin
|
||||
end;
|
||||
|
||||
procedure TWinControl.FontChanged(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
ParentFont := False;
|
||||
if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
|
||||
begin
|
||||
TWSWinControlClass(WidgetSetClass).SetFont(Self, Font);
|
||||
Exclude(FWinControlFlags,wcfFontChanged);
|
||||
Invalidate;
|
||||
for i := 0 to ControlCount - 1 do
|
||||
Controls[i].ParentFontChanged;
|
||||
end else
|
||||
Include(FWinControlFlags,wcfFontChanged);
|
||||
end;
|
||||
@ -3914,9 +3919,9 @@ begin
|
||||
if not (csReadingState in AControl.ControlState) then
|
||||
begin
|
||||
AControl.Perform(CM_PARENTCOLORCHANGED, 0, 0);
|
||||
AControl.Perform(CM_PARENTFONTCHANGED, 0, 0);
|
||||
AControl.Perform(CM_PARENTSHOWHINTCHANGED, 0, 0);
|
||||
AControl.Perform(CM_PARENTBIDIMODECHANGED, 0, 0);
|
||||
AControl.ParentFontChanged;
|
||||
if AControl is TWinControl then
|
||||
begin
|
||||
AControl.Perform(CM_PARENTCTL3DCHANGED, 0, 0);
|
||||
@ -4961,6 +4966,7 @@ end;
|
||||
procedure TWinControl.Loaded;
|
||||
var
|
||||
CachedText: string;
|
||||
i: Integer;
|
||||
begin
|
||||
if HandleAllocated then begin
|
||||
// Set cached caption
|
||||
@ -4971,6 +4977,8 @@ begin
|
||||
if [wcfColorChanged,wcfFontChanged]*FWinControlFlags<>[] then begin
|
||||
TWSWinControlClass(WidgetSetClass).SetColor(Self);
|
||||
NotifyControls(CM_PARENTCOLORCHANGED);
|
||||
for i := 0 to ControlCount - 1 do
|
||||
Controls[i].ParentFontChanged;
|
||||
FWinControlFlags:=FWinControlFlags-[wcfColorChanged,wcfFontChanged];
|
||||
end;
|
||||
end;
|
||||
|
@ -252,7 +252,7 @@ const
|
||||
CM_DIALOGKEY = CM_BASE + 5;
|
||||
CM_DIALOGCHAR = CM_BASE + 6;
|
||||
CM_FOCUSCHANGED = CM_BASE + 7;
|
||||
CM_PARENTFONTCHANGED = CM_BASE + 8;
|
||||
//CM_PARENTFONTCHANGED = CM_BASE + 8; // LCL doesn't send or receive
|
||||
CM_PARENTCOLORCHANGED = CM_BASE + 9;
|
||||
CM_HITTEST = CM_BASE + 10;
|
||||
CM_VISIBLECHANGED = CM_BASE + 11;
|
||||
|
Loading…
Reference in New Issue
Block a user