1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
{
*****************************************************************************
* QtWSGrids.pp *
* ------------ *
* *
* *
*****************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
unit QtWSGrids;
{$mode objfpc}{$H+}
interface
{$I qtdefines.inc}
uses
Controls, Types, Graphics, Grids,
// Widgetset
WSGrids, WSLCLClasses;
type
{ TQtWSCustomGrid }
TQtWSCustomGrid = class(TWSCustomGrid)
published
class function GetEditorBoundsFromCellRect(ACanvas: TCanvas;
const ACellRect: TRect; const AColumnLayout: TTextLayout): TRect; override;
end;
implementation
{ TQtWSCustomGrid }
class function TQtWSCustomGrid.GetEditorBoundsFromCellRect(ACanvas: TCanvas;
const ACellRect: TRect; const AColumnLayout: TTextLayout): TRect;
var
EditorTop: LongInt;
TextHeight: Integer;
begin
Result:=ACellRect;
Inc(Result.Right);
Dec(Result.Bottom);
TextHeight := ACanvas.TextHeight(' ');
case AColumnLayout of
tlTop: EditorTop:=Result.Top+constCellPadding;
tlCenter: EditorTop:=Result.Top+Round((Result.Bottom-Result.Top-TextHeight+1) div 2);
tlBottom: EditorTop:=Result.Bottom-constCellPadding-TextHeight+1;
end;
if EditorTop>Result.Top then Result.Top:=EditorTop;
Result.Bottom:=Result.Top+TextHeight;
end;
end.
|