X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgx%2Fgh_ui_common.pas;h=034321ae5f99f062fa36e10339351ab39dc961bf;hb=97ca06fae5cdf1d5ca6235d7c10b2635cbcb8382;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..034321a 100644 --- a/src/gx/gh_ui_common.pas +++ b/src/gx/gh_ui_common.pas @@ -1,4 +1,5 @@ -(* Copyright (C) DooM 2D:Forever Developers +(* coded by Ketmar // Invisible Vector + * Understanding is not required. Only obedience. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -11,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . *) {$INCLUDE ../shared/a_modes.inc} unit gh_ui_common; @@ -58,6 +59,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 +93,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.