summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: adaeb9b)
raw | patch | inline | side by side (parent: adaeb9b)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 24 Sep 2017 20:13:51 +0000 (23:13 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 24 Sep 2017 21:19:36 +0000 (00:19 +0300) |
src/gx/gh_flexlay.pas | patch | blob | history | |
src/gx/gh_ui_common.pas | patch | blob | history |
diff --git a/src/gx/gh_flexlay.pas b/src/gx/gh_flexlay.pas
index 3eed2e410e14dd7b1f8c94026aabc540518be32c..f9487028524e56367082f0211caa8a5805af6d98 100644 (file)
--- a/src/gx/gh_flexlay.pas
+++ b/src/gx/gh_flexlay.pas
function lineStart (): Boolean; inline;
function canWrap (): Boolean; inline;
function inGroup (): Boolean; inline;
- function expand (): Boolean; inline;
function firstInLine (): Boolean; inline;
+ function getExpand (): Boolean; inline;
+ procedure setExpand (v: Boolean); inline;
+
public
property didWrap: Boolean read getDidWrap write setDidWrap;
+ property expand: Boolean read getExpand write setExpand;
end;
PLayGroup = ^TLayGroup;
@@ -236,12 +239,14 @@ function TFlexLayouterBase.TLayControl.horizBox (): Boolean; inline; begin resul
function TFlexLayouterBase.TLayControl.lineStart (): Boolean; inline; begin result := ((flags and FlagLineStart) <> 0); end;
function TFlexLayouterBase.TLayControl.canWrap (): Boolean; inline; begin result := ((flags and FlagLineCanWrap) <> 0); end;
function TFlexLayouterBase.TLayControl.inGroup (): Boolean; inline; begin result := ((flags and FlagInGroup) <> 0); end;
-function TFlexLayouterBase.TLayControl.expand (): Boolean; inline; begin result := ((flags and FlagExpand) <> 0); end;
function TFlexLayouterBase.TLayControl.firstInLine (): Boolean; inline; begin result := ((flags and FlagLineFirst) <> 0); end;
function TFlexLayouterBase.TLayControl.getDidWrap (): Boolean; inline; begin result := ((flags and FlagLineDidWrap) <> 0); end;
procedure TFlexLayouterBase.TLayControl.setDidWrap (v: Boolean); inline; begin if (v) then flags := flags or FlagLineDidWrap else flags := flags and (not FlagLineDidWrap); end;
+function TFlexLayouterBase.TLayControl.getExpand (): Boolean; inline; begin result := ((flags and FlagExpand) <> 0); end;
+procedure TFlexLayouterBase.TLayControl.setExpand (v: Boolean); inline; begin if (v) then flags := flags or FlagExpand else flags := flags and (not FlagExpand); end;
+
// ////////////////////////////////////////////////////////////////////////// //
constructor TFlexLayouterBase.TChildrenEnumerator.Create (constref actls: TLayCtlArray; acur: Integer);
grp: PLayGroup;
f, c: Integer;
cidx: LayControlIdx;
+ ct: PLayControl;
begin
while true do
begin
for c := 0 to High(grp.ctls) do
begin
cidx := grp.ctls[c];
- if (maxsz < ctlist[cidx].startsize[gtype]) then maxsz := ctlist[cidx].startsize[gtype];
+ ct := @ctlist[cidx];
+ ct.expand := false; // don't expand grouped controls anymore
+ if (maxsz < ct.startsize[gtype]) then maxsz := ct.startsize[gtype];
end;
for c := 0 to High(grp.ctls) do
begin
cidx := grp.ctls[c];
- ctlist[cidx].startsize[gtype] := maxsz;
- ctlist[cidx].desiredsize[gtype] := maxsz;
- ctlist[cidx].tempFlex := 0; // don't change control size anymore
+ ct := @ctlist[cidx];
+ ct.startsize[gtype] := maxsz;
+ ct.desiredsize[gtype] := maxsz;
+ ct.tempFlex := 0; // don't change control size anymore
end;
end;
end;
begin
for f := 0 to High(ctlist) do
begin
+ ct := @ctlist[f];
+ if (ct.inGroup) then
+ begin
+ ct.expand := false; // don't expand grouped controls anymore
+ ct.tempFlex := 0; // don't change control size anymore
+ end;
for c := 0 to 1 do
begin
- if (ctlist[f].maxsize[c] <= 0) then continue;
- if (ctlist[f].desiredsize[c] > ctlist[f].maxsize[c]) then
+ if (ct.maxsize[c] <= 0) then continue;
+ if (ct.desiredsize[c] > ct.maxsize[c]) then
begin
//writeln('ctl #', f, '; dimension #', c, ': desired=', ctlist[f].desiredsize[c], '; max=', ctlist[f].maxsize[c]);
- ctlist[f].startsize[c] := ctlist[f].maxsize[c];
- ctlist[f].desiredsize[c] := ctlist[f].maxsize[c];
- ctlist[f].tempFlex := 0; // don't change control size anymore
+ ct.startsize[c] := ct.maxsize[c];
+ ct.desiredsize[c] := ct.maxsize[c];
+ ct.tempFlex := 0; // don't change control size anymore
secondAgain := true;
end;
end;
index 0c1aa7596868bfbe5aee5b11704379f74be8ffbc..15118ae259162d25cf0da9cd9994fa95c47ed247 100644 (file)
--- a/src/gx/gh_ui_common.pas
+++ b/src/gx/gh_ui_common.pas
function vert (): Integer; inline;
end;
+
+
implementation
uses