X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgx%2Fgh_ui_common.pas;h=15118ae259162d25cf0da9cd9994fa95c47ed247;hb=fe568f37c781a2433440cd0033f557fd499d1e93;hp=7143501e947dc2e78f7e8463a6aa380c59e92e93;hpb=9bca9a6ab02b578db654863d557691e3edbcf0ca;p=d2df-sdl.git diff --git a/src/gx/gh_ui_common.pas b/src/gx/gh_ui_common.pas index 7143501..15118ae 100644 --- a/src/gx/gh_ui_common.pas +++ b/src/gx/gh_ui_common.pas @@ -58,6 +58,20 @@ type property item[idx: Integer]: Integer read getIdx write setIdx; default; end; + TLayMargins = record + public + top, right, bottom, left: Integer; + + public + constructor Create (atop, aright, abottom, aleft: Integer); + + function toString (): AnsiString; + + function horiz (): Integer; inline; + function vert (): Integer; inline; + end; + + implementation @@ -78,5 +92,20 @@ procedure TLayPos.setIdx (idx, v: Integer); inline; begin if (idx = 0) then x := function TLayPos.toString (): AnsiString; begin result := formatstrf('(%d,%d)', [x, y]); end; function TLayPos.equals (constref a: TLayPos): Boolean; inline; begin result := (x = a.x) and (y = a.y); end; +constructor TLayMargins.Create (atop, aright, abottom, aleft: Integer); +begin + if (atop < 0) then atop := 0; + if (aright < 0) then aright := 0; + if (abottom < 0) then abottom := 0; + if (aleft < 0) then aleft := 0; + left := aleft; + right := aright; + top := atop; + bottom := abottom; +end; +function TLayMargins.toString (): AnsiString; begin result := formatstrf('(%s,%s,%s,%s)', [top, right, bottom, left]); end; +function TLayMargins.horiz (): Integer; inline; begin result := left+right; end; +function TLayMargins.vert (): Integer; inline; begin result := top+bottom; end; + end.