Ignore:
Timestamp:
Nov 3, 2021, 11:22:02 AM (2 years ago)
Author:
chronos
Message:
  • Modified: Merged changes from trunk r404.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r378 r405  
    66
    77uses
    8   {$IFDEF WINDOWS}Windows, {$ENDIF}Classes, SysUtils, LCLProc, LResources, Forms, FormEditingIntf, ProjectIntf,
    9   Controls, StdCtrls, fgl, Graphics, ComCtrls, ExtCtrls, LCLType, GraphType,
    10   Types, CustApp, LMessages, LCLIntf, Menus, Math, UPixelPointer2;
     8  {$IFDEF WINDOWS}Windows, {$ENDIF}Classes, SysUtils, LCLProc, LResources, Forms,
     9  FormEditingIntf, ProjectIntf, Controls, StdCtrls, fgl, Graphics, ComCtrls,
     10  ExtCtrls, LCLType, GraphType, Types, CustApp, LMessages, LCLIntf, Menus, Math,
     11  UPixelPointer2, Grids, Spin;
    1112
    1213const
     
    102103    destructor Destroy; override;
    103104    procedure Assign(Source: TPersistent); override;
     105    procedure GetTextSize(Text: string; var w, h: Integer);
     106    function GetTextHeight(Text: string): Integer;
     107    function GetTextWidth(Text: string): Integer;
    104108  published
    105109    property CharSet: TFontCharSet read GetCharSet write SetCharSet default DEFAULT_CHARSET;
     
    158162    function GetAlign: TAlign;
    159163    function GetAnchors: TAnchors;
     164    function GetAutoSize: Boolean;
    160165    function GetBoundsRect: TRect;
    161166    function GetClientHeight: Integer;
     
    173178    procedure SetAlign(AValue: TAlign);
    174179    procedure SetAnchors(AValue: TAnchors);
     180    procedure SetAutoSize(AValue: Boolean);
    175181    procedure SetBorderSpacing(AValue: TDpiControlBorderSpacing);
    176182    procedure SetBoundsRect(AValue: TRect);
     
    239245    procedure Repaint;
    240246    procedure Update;
     247    procedure Refresh;
    241248    function IsParentOf(AControl: TDpiControl): boolean; virtual;
     249    function Scale96ToScreen(const ASize: Integer): Integer;
    242250    constructor Create(TheOwner: TComponent); override;
    243251    destructor Destroy; override;
     
    248256    property BorderSpacing: TDpiControlBorderSpacing read FBorderSpacing write SetBorderSpacing;
    249257  published
     258    property AutoSize: Boolean read GetAutoSize write SetAutoSize default False;
    250259    property ClientHeight: Integer read GetClientHeight write SetClientHeight;
    251260    property ClientWidth: Integer read GetClientWidth write SetClientWidth;
     
    341350    function GetNativeRasterImage: TRasterImage; virtual;
    342351  public
     352    procedure BeginUpdate(ACanvasOnly: Boolean = False);
     353    procedure EndUpdate(AStreamIsValid: Boolean = False);
    343354    property RawImage: TRawImage read GetRawImage;
    344355  end;
     
    403414    FNativeCanvasFree: Boolean;
    404415    function GetHandle: HDC;
    405     function GetHeight: Integer;
    406416    function GetPixel(X, Y: Integer): TColor;
    407     function GetWidth: Integer;
    408417    procedure SetBrush(AValue: TDpiBrush);
    409418    procedure SetFont(AValue: TDpiFont);
     
    413422    procedure SetNativeCanvas(AValue: TCanvas);
    414423  protected
     424    procedure SetHeight(AValue: Integer); virtual;
     425    procedure SetWidth(AValue: Integer); virtual;
     426    function GetWidth: Integer; virtual;
     427    function GetHeight: Integer; virtual;
    415428    function GetNativeCanvas: TCanvas; virtual;
    416429  public
     
    423436    function TextHeight(Text: string): Integer;
    424437    function TextExtent(Text: string): TSize;
    425     procedure TextOut(X, Y: Integer; Text: string);
     438    procedure TextOut(X, Y: Integer; const Text: string); virtual;
    426439    procedure TextRect(ARect: TRect; X, Y: Integer; Text: string);
    427440    procedure MoveTo(X, Y: Integer);
    428441    procedure LineTo(X, Y: Integer);
    429     procedure FillRect(ARect: TRect);
     442    procedure FillRect(const ARect: TRect); virtual;
    430443    procedure FillRect(X1, Y1, X2, Y2: Integer);
    431444    procedure Draw(X, Y: Integer; Source: TDpiGraphic);
     
    581594    function GetOnShow: TNotifyEvent;
    582595    function GetPosition: TPosition;
     596    function GetRestoredHeight: Integer;
     597    function GetRestoredLeft: Integer;
     598    function GetRestoredTop: Integer;
     599    function GetRestoredWidth: Integer;
    583600    function GetWindowState: TWindowState;
    584601    procedure SetBorderIcons(AValue: TBorderIcons);
     
    624641    destructor Destroy; override;
    625642  published
     643    property RestoredLeft: integer read GetRestoredLeft;
     644    property RestoredTop: integer read GetRestoredTop;
     645    property RestoredWidth: integer read GetRestoredWidth;
     646    property RestoredHeight: integer read GetRestoredHeight;
    626647    property DesignTimePPI: Integer read GetDesignTimePPI write SetDesignTimePPI; // Not used
    627648    property FormState: TFormState read GetFormState;
     
    698719    function GetItemIndex: Integer;
    699720    function GetItems: TStrings;
     721    function GetOnSelectionChange: TSelectionChangeEvent;
    700722    function GetParentFont: Boolean;
    701723    function GetScrollWidth: Integer;
     
    707729    procedure SetItemIndex(AValue: Integer);
    708730    procedure SetItems(AValue: TStrings);
     731    procedure SetOnSelectionChange(AValue: TSelectionChangeEvent);
    709732    procedure SetParentFont(AValue: Boolean);
    710733    procedure SetScrollWidth(AValue: Integer);
     
    729752    property Visible;
    730753    property Anchors;
     754    property OnSelectionChange: TSelectionChangeEvent read GetOnSelectionChange
     755                                                      write SetOnSelectionChange;
    731756  end;
    732757
     
    773798    function GetPixelFormat: TPixelFormat;
    774799    function GetScanLine(Row: Integer): Pointer;
     800    function GetTransparent: Boolean;
     801    function GetTransparentColor: TColor;
    775802    procedure SetPixelFormat(AValue: TPixelFormat);
     803    procedure SetTransparent(AValue: Boolean);
     804    procedure SetTransparentColor(AValue: TColor);
    776805  protected
    777806    function GetHeight: Integer; override;
     
    796825    property Width: Integer read GetWidth write SetWidth;
    797826    property Canvas: TDpiCanvas read GetCanvas;
     827    property TransparentColor: TColor read GetTransparentColor
     828                                      write SetTransparentColor default clDefault;
     829    property Transparent: Boolean read GetTransparent write SetTransparent default False;
    798830  end;
    799831
     
    841873  end;
    842874
     875  { TDpiListView }
     876
     877  TDpiListView = class(TDpiWinControl)
     878  private
     879    NativeListView: TListView;
     880    function GetColumns: TListColumns;
     881    function GetItems: TListItems;
     882    procedure SetColumns(AValue: TListColumns);
     883    procedure SetItems(AValue: TListItems);
     884  public
     885    function GetNativeListView: TListView;
     886    constructor Create(TheOwner: TComponent); override;
     887    destructor Destroy; override;
     888    property Columns: TListColumns read GetColumns write SetColumns;
     889    property Items: TListItems read GetItems write SetItems;
     890  published
     891  end;
     892
     893  { TDpiPanel }
     894
     895  TDpiPanel = class(TDpiWinControl)
     896  private
     897    NativePanel: TPanel;
     898  public
     899    function GetNativePanel: TPanel;
     900    constructor Create(TheOwner: TComponent); override;
     901    destructor Destroy; override;
     902  end;
     903
     904  { TDpiCustomDrawGrid }
     905
     906  TDpiCustomDrawGrid = class(TDpiWinControl)
     907  private
     908    NativeCustomDrawGrid: TCustomDrawGrid;
     909    function GetEditor: TDpiWinControl;
     910    procedure SetEditor(AValue: TDpiWinControl);
     911  public
     912    function GetNativeCustomDrawGrid: TCustomDrawGrid;
     913    constructor Create(TheOwner: TComponent); override;
     914    destructor Destroy; override;
     915    property Editor: TDpiWinControl read GetEditor write SetEditor;
     916  end;
     917
     918  { TDpiPageControl }
     919
     920  TDpiPageControl = class(TDpiWinControl)
     921  private
     922    NativePageControl: TPageControl;
     923    function GetPageCount: Integer;
     924    function GetTabSheet(Index: Integer): TTabSheet;
     925  public
     926    function GetNativePageControl: TPageControl;
     927    constructor Create(TheOwner: TComponent); override;
     928    destructor Destroy; override;
     929    property PageCount: Integer read GetPageCount;
     930    property Pages[Index: Integer]: TTabSheet read GetTabSheet;
     931  end;
     932
     933  { TDpiRadioButton }
     934
     935  TDpiRadioButton = class(TDpiWinControl)
     936  private
     937    NativeRadioButton: TRadioButton;
     938  public
     939    function GetNativeRadioButton: TRadioButton;
     940    constructor Create(TheOwner: TComponent); override;
     941    destructor Destroy; override;
     942  end;
     943
     944  { TDpiSpinEdit }
     945
     946  TDpiSpinEdit = class(TDpiWinControl)
     947  private
     948    NativeSpinEdit: TSpinEdit;
     949  public
     950    function GetNativeSpinEdit: TSpinEdit;
     951    constructor Create(TheOwner: TComponent); override;
     952    destructor Destroy; override;
     953  end;
     954
     955  { TDpiComboBox }
     956
     957  TDpiComboBox = class(TDpiWinControl)
     958  private
     959    NativeComboBox: TComboBox;
     960  public
     961    function GetNativeComboBox: TComboBox;
     962    constructor Create(TheOwner: TComponent); override;
     963    destructor Destroy; override;
     964  end;
     965
     966  { TDpiCheckBox }
     967
     968  TDpiCheckBox = class(TDpiWinControl)
     969  private
     970    NativeCheckBox: TCheckBox;
     971  public
     972    function GetNativeCheckBox: TCheckBox;
     973    constructor Create(TheOwner: TComponent); override;
     974    destructor Destroy; override;
     975  end;
     976
     977  { TDpiMemo }
     978
     979  TDpiMemo = class(TDpiWinControl)
     980  private
     981    NativeMemo: TMemo;
     982    function GetLines: TStrings;
     983    procedure SetLines(AValue: TStrings);
     984  public
     985    procedure Clear;
     986    function GetNativeMemo: TMemo;
     987    constructor Create(TheOwner: TComponent); override;
     988    destructor Destroy; override;
     989    property Lines: TStrings read GetLines write SetLines;
     990  end;
     991
     992  { TDpiToolBar }
     993
     994  TDpiToolBar = class(TDpiCustomControl)
     995  private
     996    NativeToolBar: TToolBar;
     997    function ButtonHeightIsStored: Boolean;
     998    function ButtonWidthIsStored: Boolean;
     999    function GetButtonHeight: Integer;
     1000    function GetButtonWidth: Integer;
     1001    procedure SetButtonHeight(AValue: Integer);
     1002    procedure SetButtonWidth(AValue: Integer);
     1003  public
     1004    function GetNativeToolBar: TToolBar;
     1005    constructor Create(TheOwner: TComponent); override;
     1006    destructor Destroy; override;
     1007    property ButtonHeight: Integer read GetButtonHeight write SetButtonHeight stored ButtonHeightIsStored;
     1008    property ButtonWidth: Integer read GetButtonWidth write SetButtonWidth stored ButtonWidthIsStored;
     1009  end;
     1010
     1011  { TDpiCoolBand }
     1012
     1013  TDpiCoolBand = class(TDpiCustomControl)
     1014  private
     1015    NativeCoolBand: TCoolBand;
     1016    function GetMinHeight: Integer;
     1017    function GetMinWidth: Integer;
     1018    procedure SetMinHeight(AValue: Integer);
     1019    procedure SetMinWidth(AValue: Integer);
     1020  protected const
     1021    cDefMinHeight = 25;
     1022    cDefMinWidth = 100;
     1023  public
     1024    function GetNativeCoolBand: TCoolBand;
     1025    constructor Create(TheOwner: TComponent); override;
     1026    destructor Destroy; override;
     1027    property MinHeight: Integer read GetMinHeight write SetMinHeight default cDefMinHeight;
     1028    property MinWidth: Integer read GetMinWidth write SetMinWidth default cDefMinWidth;
     1029  end;
     1030
     1031  { TDpiCoolBands }
     1032
     1033  TDpiCoolBands = class(TCollection)
     1034  private
     1035    procedure SetItem(Index: Integer; AValue: TDpiCoolBand);
     1036    function GetItem(Index: Integer): TDpiCoolBand;
     1037  public
     1038    property Items[Index: Integer]: TDpiCoolBand read GetItem write SetItem; default;
     1039  end;
     1040
     1041  { TDpiCoolBar }
     1042
     1043  TDpiCoolBar = class(TDpiCustomControl)
     1044  private
     1045    NativeCoolBar: TCoolBar;
     1046    function GetBands: TDpiCoolBands;
     1047    function GetThemed: Boolean;
     1048    procedure SetBands(AValue: TDpiCoolBands);
     1049    procedure SetThemed(AValue: Boolean);
     1050  public
     1051    procedure BeginUpdate;
     1052    procedure EndUpdate;
     1053    function GetNativeCoolBar: TCoolBar;
     1054    constructor Create(TheOwner: TComponent); override;
     1055    destructor Destroy; override;
     1056    property Bands: TDpiCoolBands read GetBands write SetBands;
     1057    property Themed: Boolean read GetThemed write SetThemed default True;
     1058  end;
     1059
     1060  { TDpiImageList }
     1061
     1062  TDpiImageList = class(TComponent)
     1063  private
     1064    NativeImageList: TImageList;
     1065    function GetCount: Integer;
     1066    function GetHeight: Integer;
     1067    function GetWidth: Integer;
     1068    procedure SetHeight(AValue: Integer);
     1069    procedure SetWidth(AValue: Integer);
     1070  public
     1071    function GetNativeImageList: TImageList;
     1072    procedure GetBitmap(Index: Integer; Image: TDpiBitmap);
     1073    procedure BeginUpdate;
     1074    procedure EndUpdate;
     1075    procedure Clear;
     1076    function Add(Image, Mask: TDpiBitmap): Integer;
     1077    constructor Create(TheOwner: TComponent); override;
     1078    destructor Destroy; override;
     1079    property Width: Integer read GetWidth write SetWidth default 16;
     1080    property Height: Integer read GetHeight write SetHeight default 16;
     1081    property Count: Integer read GetCount;
     1082  end;
     1083
     1084  { TDpiStringGrid }
     1085
     1086  TDpiStringGrid = class(TDpiWinControl)
     1087  private
     1088    NativeStringGrid: TStringGrid;
     1089    function DefaultRowHeightIsStored: Boolean;
     1090    function GetDefRowHeight: Integer;
     1091    procedure SetDefRowHeight(AValue: Integer);
     1092  public
     1093    function GetNativeStringGrid: TStringGrid;
     1094    constructor Create(TheOwner: TComponent); override;
     1095    destructor Destroy; override;
     1096  published
     1097    property DefaultRowHeight: Integer read GetDefRowHeight write SetDefRowHeight stored DefaultRowHeightIsStored;
     1098  end;
     1099
    8431100  { TDpiScreen }
    8441101
     
    8511108    FForms: TDpiForms;
    8521109    procedure AddForm(AForm: TDpiForm);
     1110    function GetDesktopHeight: Integer;
     1111    function GetDesktopLeft: Integer;
     1112    function GetDesktopTop: Integer;
     1113    function GetDesktopWidth: Integer;
    8531114    procedure RemoveForm(AForm: TDpiForm);
    8541115    function GetActiveForm: TDpiForm;
     
    8681129    procedure UpdateScreen;
    8691130    procedure UpdateActiveFormFromNativeScreen;
     1131    function DisableForms(SkipForm: TDpiForm; DisabledList: TList = nil): TList;
     1132    procedure EnableForms(var AFormList: TList);
    8701133    property FormCount: Integer read GetFormCount;
    8711134    property Forms[Index: Integer]: TDpiForm read GetForms;
     
    8781141    property Width: Integer read GetWidth;
    8791142    property Height: Integer read GetHeight;
     1143    property DesktopLeft: Integer read GetDesktopLeft;
     1144    property DesktopTop: Integer read GetDesktopTop;
     1145    property DesktopWidth: Integer read GetDesktopWidth;
     1146    property DesktopHeight: Integer read GetDesktopHeight;
    8801147  end;
    8811148
     
    9121179    FOldExitProc: Pointer;
    9131180    function GetActive: Boolean;
     1181    function GetExeName: string;
    9141182    function GetShowMainForm: Boolean;
    9151183    function GetTitle: string;
     
    9351203    property Title: string read GetTitle write SetTitle;
    9361204    property Active: Boolean read GetActive;
     1205    property ExeName: string read GetExeName;
    9371206  end;
    9381207
     
    9941263    property Items[Index: Integer]: TDpiMenuItem read GetItem; default;
    9951264    property Count: Integer read GetCount;
     1265    procedure Clear;
    9961266  published
    9971267    property RadioItem: Boolean read GetRadioItem write SetRadioItem default False;
     
    12311501      ScaleToNative(XSrc), ScaleToNative(YSrc), Rop);
    12321502  end else begin
    1233     Result := StretchBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
     1503    Result := BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
     1504      DstWidth, DstHeight, SrcDC,
     1505      ScaleToNative(XSrc), ScaleToNative(YSrc), Rop);
     1506{    Result := StretchBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
    12341507      DstWidth, DstHeight, SrcDC,
    12351508      ScaleToNative(XSrc), ScaleToNative(YSrc),
    12361509      SrcWidth, SrcHeight, Rop);
    1237   end;
     1510}  end;
    12381511
    12391512{  Result := BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
     
    12421515 }
    12431516  {$ENDIF}
     1517end;
     1518
     1519{ TDpiRadioButton }
     1520
     1521function TDpiRadioButton.GetNativeRadioButton: TRadioButton;
     1522begin
     1523  if not Assigned(NativeRadioButton) then NativeRadioButton := TRadioButton.Create(nil);
     1524    Result := NativeRadioButton;
     1525end;
     1526
     1527constructor TDpiRadioButton.Create(TheOwner: TComponent);
     1528begin
     1529  inherited Create(TheOwner);
     1530end;
     1531
     1532destructor TDpiRadioButton.Destroy;
     1533begin
     1534  FreeAndNil(NativeRadioButton);
     1535  inherited;
     1536end;
     1537
     1538{ TDpiPageControl }
     1539
     1540function TDpiPageControl.GetPageCount: Integer;
     1541begin
     1542  Result := GetNativePageControl.PageCount;
     1543end;
     1544
     1545function TDpiPageControl.GetTabSheet(Index: Integer): TTabSheet;
     1546begin
     1547  Result := GetNativePageControl.Pages[Index];
     1548end;
     1549
     1550function TDpiPageControl.GetNativePageControl: TPageControl;
     1551begin
     1552  if not Assigned(NativePageControl) then NativePageControl := TPageControl.Create(nil);
     1553    Result := NativePageControl;
     1554end;
     1555
     1556constructor TDpiPageControl.Create(TheOwner: TComponent);
     1557begin
     1558  inherited Create(TheOwner);
     1559end;
     1560
     1561destructor TDpiPageControl.Destroy;
     1562begin
     1563  FreeAndNil(NativePageControl);
     1564  inherited;
     1565end;
     1566
     1567{ TDpiCustomDrawGrid }
     1568
     1569function TDpiCustomDrawGrid.GetEditor: TDpiWinControl;
     1570begin
     1571  //Result := GetNativeCustomDrawGrid.Editor;
     1572end;
     1573
     1574procedure TDpiCustomDrawGrid.SetEditor(AValue: TDpiWinControl);
     1575begin
     1576  //GetNativeCustomDrawGrid.Editor := AValue
     1577end;
     1578
     1579function TDpiCustomDrawGrid.GetNativeCustomDrawGrid: TCustomDrawGrid;
     1580begin
     1581  if not Assigned(NativeCustomDrawGrid) then NativeCustomDrawGrid := TCustomDrawGrid.Create(nil);
     1582    Result := NativeCustomDrawGrid;
     1583end;
     1584
     1585constructor TDpiCustomDrawGrid.Create(TheOwner: TComponent);
     1586begin
     1587  inherited Create(TheOwner);
     1588end;
     1589
     1590destructor TDpiCustomDrawGrid.Destroy;
     1591begin
     1592  FreeAndNil(NativeCustomDrawGrid);
     1593  inherited;
     1594end;
     1595
     1596{ TDpiCheckBox }
     1597
     1598function TDpiCheckBox.GetNativeCheckBox: TCheckBox;
     1599begin
     1600  if not Assigned(NativeCheckBox) then NativeCheckBox := TCheckBox.Create(nil);
     1601    Result := NativeCheckBox;
     1602end;
     1603
     1604constructor TDpiCheckBox.Create(TheOwner: TComponent);
     1605begin
     1606  inherited Create(TheOwner);
     1607end;
     1608
     1609destructor TDpiCheckBox.Destroy;
     1610begin
     1611  FreeAndNil(NativeCheckBox);
     1612  inherited;
     1613end;
     1614
     1615{ TDpiComboBox }
     1616
     1617function TDpiComboBox.GetNativeComboBox: TComboBox;
     1618begin
     1619  if not Assigned(NativeComboBox) then NativeComboBox := TComboBox.Create(nil);
     1620    Result := NativeComboBox;
     1621end;
     1622
     1623constructor TDpiComboBox.Create(TheOwner: TComponent);
     1624begin
     1625  inherited Create(TheOwner);
     1626end;
     1627
     1628destructor TDpiComboBox.Destroy;
     1629begin
     1630  FreeAndNil(NativeComboBox);
     1631  inherited;
     1632end;
     1633
     1634{ TDpiSpinEdit }
     1635
     1636function TDpiSpinEdit.GetNativeSpinEdit: TSpinEdit;
     1637begin
     1638  if not Assigned(NativeSpinEdit) then NativeSpinEdit := TSpinEdit.Create(nil);
     1639    Result := NativeSpinEdit;
     1640end;
     1641
     1642constructor TDpiSpinEdit.Create(TheOwner: TComponent);
     1643begin
     1644  inherited Create(TheOwner);
     1645end;
     1646
     1647destructor TDpiSpinEdit.Destroy;
     1648begin
     1649  FreeAndNil(NativeSpinEdit);
     1650  inherited;
     1651end;
     1652
     1653{ TDpiMemo }
     1654
     1655function TDpiMemo.GetLines: TStrings;
     1656begin
     1657  Result := GetNativeMemo.Lines;
     1658end;
     1659
     1660procedure TDpiMemo.SetLines(AValue: TStrings);
     1661begin
     1662  GetNativeMemo.Lines := AValue;
     1663end;
     1664
     1665procedure TDpiMemo.Clear;
     1666begin
     1667  GetNativeMemo.Clear;
     1668end;
     1669
     1670function TDpiMemo.GetNativeMemo: TMemo;
     1671begin
     1672  if not Assigned(NativeMemo) then NativeMemo := TMemo.Create(nil);
     1673    Result := NativeMemo;
     1674end;
     1675
     1676constructor TDpiMemo.Create(TheOwner: TComponent);
     1677begin
     1678  inherited Create(TheOwner);
     1679end;
     1680
     1681destructor TDpiMemo.Destroy;
     1682begin
     1683  FreeAndNil(NativeMemo);
     1684  inherited;
     1685end;
     1686
     1687{ TDpiImageList }
     1688
     1689function TDpiImageList.GetHeight: Integer;
     1690begin
     1691
     1692end;
     1693
     1694function TDpiImageList.GetCount: Integer;
     1695begin
     1696
     1697end;
     1698
     1699function TDpiImageList.GetWidth: Integer;
     1700begin
     1701
     1702end;
     1703
     1704procedure TDpiImageList.SetHeight(AValue: Integer);
     1705begin
     1706
     1707end;
     1708
     1709procedure TDpiImageList.SetWidth(AValue: Integer);
     1710begin
     1711
     1712end;
     1713
     1714function TDpiImageList.GetNativeImageList: TImageList;
     1715begin
     1716  if not Assigned(NativeImageList) then NativeImageList := TImageList.Create(nil);
     1717    Result := NativeImageList;
     1718end;
     1719
     1720procedure TDpiImageList.GetBitmap(Index: Integer; Image: TDpiBitmap);
     1721begin
     1722
     1723end;
     1724
     1725procedure TDpiImageList.BeginUpdate;
     1726begin
     1727
     1728end;
     1729
     1730procedure TDpiImageList.EndUpdate;
     1731begin
     1732
     1733end;
     1734
     1735procedure TDpiImageList.Clear;
     1736begin
     1737
     1738end;
     1739
     1740function TDpiImageList.Add(Image, Mask: TDpiBitmap): Integer;
     1741begin
     1742
     1743end;
     1744
     1745constructor TDpiImageList.Create(TheOwner: TComponent);
     1746begin
     1747  inherited Create(TheOwner);
     1748end;
     1749
     1750destructor TDpiImageList.Destroy;
     1751begin
     1752  FreeAndNil(NativeImageList);
     1753  inherited Destroy;
     1754end;
     1755
     1756{ TDpiCoolBands }
     1757
     1758procedure TDpiCoolBands.SetItem(Index: Integer; AValue: TDpiCoolBand);
     1759begin
     1760
     1761end;
     1762
     1763function TDpiCoolBands.GetItem(Index: Integer): TDpiCoolBand;
     1764begin
     1765
     1766end;
     1767
     1768{ TDpiCoolBand }
     1769
     1770function TDpiCoolBand.GetMinWidth: Integer;
     1771begin
     1772
     1773end;
     1774
     1775function TDpiCoolBand.GetMinHeight: Integer;
     1776begin
     1777
     1778end;
     1779
     1780procedure TDpiCoolBand.SetMinHeight(AValue: Integer);
     1781begin
     1782
     1783end;
     1784
     1785procedure TDpiCoolBand.SetMinWidth(AValue: Integer);
     1786begin
     1787
     1788end;
     1789
     1790function TDpiCoolBand.GetNativeCoolBand: TCoolBand;
     1791begin
     1792
     1793end;
     1794
     1795constructor TDpiCoolBand.Create(TheOwner: TComponent);
     1796begin
     1797  inherited Create(TheOwner);
     1798end;
     1799
     1800destructor TDpiCoolBand.Destroy;
     1801begin
     1802  inherited Destroy;
     1803end;
     1804
     1805{ TDpiCoolBar }
     1806
     1807function TDpiCoolBar.GetBands: TDpiCoolBands;
     1808begin
     1809
     1810end;
     1811
     1812function TDpiCoolBar.GetThemed: Boolean;
     1813begin
     1814  Result := GetNativeCoolBar.Themed;
     1815end;
     1816
     1817procedure TDpiCoolBar.SetBands(AValue: TDpiCoolBands);
     1818begin
     1819
     1820end;
     1821
     1822procedure TDpiCoolBar.SetThemed(AValue: Boolean);
     1823begin
     1824  GetNativeCoolBar.Themed := AValue
     1825end;
     1826
     1827procedure TDpiCoolBar.BeginUpdate;
     1828begin
     1829  GetNativeCoolBar.BeginUpdate;
     1830end;
     1831
     1832procedure TDpiCoolBar.EndUpdate;
     1833begin
     1834  GetNativeCoolBar.EndUpdate;
     1835end;
     1836
     1837function TDpiCoolBar.GetNativeCoolBar: TCoolBar;
     1838begin
     1839  if not Assigned(NativeCoolBar) then NativeCoolBar := TCoolBar.Create(nil);
     1840    Result := NativeCoolBar;
     1841end;
     1842
     1843constructor TDpiCoolBar.Create(TheOwner: TComponent);
     1844begin
     1845  inherited Create(TheOwner);
     1846end;
     1847
     1848destructor TDpiCoolBar.Destroy;
     1849begin
     1850  FreeAndNil(NativeCoolBar);
     1851  inherited Destroy;
     1852end;
     1853
     1854{ TDpiToolBar }
     1855
     1856function TDpiToolBar.ButtonHeightIsStored: Boolean;
     1857begin
     1858
     1859end;
     1860
     1861function TDpiToolBar.ButtonWidthIsStored: Boolean;
     1862begin
     1863
     1864end;
     1865
     1866function TDpiToolBar.GetButtonHeight: Integer;
     1867begin
     1868  Result := ScaleFromNative(GetNativeToolBar.ButtonHeight);
     1869end;
     1870
     1871function TDpiToolBar.GetButtonWidth: Integer;
     1872begin
     1873  Result := ScaleFromNative(GetNativeToolBar.ButtonWidth);
     1874end;
     1875
     1876procedure TDpiToolBar.SetButtonHeight(AValue: Integer);
     1877begin
     1878  GetNativeToolBar.ButtonHeight := ScaleToNative(AValue);
     1879end;
     1880
     1881procedure TDpiToolBar.SetButtonWidth(AValue: Integer);
     1882begin
     1883  GetNativeToolBar.ButtonWidth := ScaleToNative(AValue);
     1884end;
     1885
     1886function TDpiToolBar.GetNativeToolBar: TToolBar;
     1887begin
     1888  if not Assigned(NativeToolBar) then NativeToolBar := TToolBar.Create(nil);
     1889    Result := NativeToolBar;
     1890end;
     1891
     1892constructor TDpiToolBar.Create(TheOwner: TComponent);
     1893begin
     1894  inherited Create(TheOwner);
     1895end;
     1896
     1897destructor TDpiToolBar.Destroy;
     1898begin
     1899  FreeAndNil(NativeToolBar);
     1900  inherited;
     1901end;
     1902
     1903{ TDpiPanel }
     1904
     1905function TDpiPanel.GetNativePanel: TPanel;
     1906begin
     1907  if not Assigned(NativePanel) then NativePanel := TPanel.Create(nil);
     1908    Result := NativePanel;
     1909end;
     1910
     1911constructor TDpiPanel.Create(TheOwner: TComponent);
     1912begin
     1913  inherited Create(TheOwner);
     1914end;
     1915
     1916destructor TDpiPanel.Destroy;
     1917begin
     1918  FreeAndNil(NativePanel);
     1919  inherited;
     1920end;
     1921
     1922{ TDpiStringGrid }
     1923
     1924function TDpiStringGrid.DefaultRowHeightIsStored: Boolean;
     1925begin
     1926  Result := GetDefRowHeight>=0;
     1927end;
     1928
     1929function TDpiStringGrid.GetDefRowHeight: Integer;
     1930begin
     1931  Result := GetNativeStringGrid.DefaultRowHeight;
     1932end;
     1933
     1934procedure TDpiStringGrid.SetDefRowHeight(AValue: Integer);
     1935begin
     1936  GetNativeStringGrid.DefaultRowHeight := AValue;
     1937end;
     1938
     1939function TDpiStringGrid.GetNativeStringGrid: TStringGrid;
     1940begin
     1941  if not Assigned(NativeStringGrid) then NativeStringGrid := TStringGrid.Create(nil);
     1942    Result := NativeStringGrid;
     1943end;
     1944
     1945constructor TDpiStringGrid.Create(TheOwner: TComponent);
     1946begin
     1947  inherited Create(TheOwner);
     1948end;
     1949
     1950destructor TDpiStringGrid.Destroy;
     1951begin
     1952  FreeAndNil(NativeStringGrid);
     1953  inherited;
     1954end;
     1955
     1956{ TDpiListView }
     1957
     1958function TDpiListView.GetItems: TListItems;
     1959begin
     1960  Result := GetNativeListView.Items;
     1961end;
     1962
     1963function TDpiListView.GetColumns: TListColumns;
     1964begin
     1965  Result := NativeListView.Columns;
     1966end;
     1967
     1968procedure TDpiListView.SetColumns(AValue: TListColumns);
     1969begin
     1970  NativeListView.Columns := AValue;
     1971end;
     1972
     1973procedure TDpiListView.SetItems(AValue: TListItems);
     1974begin
     1975  GetNativeListView.Items := AValue;
     1976end;
     1977
     1978function TDpiListView.GetNativeListView: TListView;
     1979begin
     1980  if not Assigned(NativeListView) then NativeListView := TListView.Create(nil);
     1981    Result := NativeListView;
     1982end;
     1983
     1984constructor TDpiListView.Create(TheOwner: TComponent);
     1985begin
     1986  inherited Create(TheOwner);
     1987end;
     1988
     1989destructor TDpiListView.Destroy;
     1990begin
     1991  FreeAndNil(NativeListView);
     1992  inherited;
    12441993end;
    12451994
     
    16712420    raise EMenuError.Create(SMenuNotFound);
    16722421  Delete(I);
     2422end;
     2423
     2424procedure TDpiMenuItem.Clear;
     2425begin
     2426  GetNativeMenuItem.Clear;
    16732427end;
    16742428
     
    18812635begin
    18822636  Result := Application.Active;
     2637end;
     2638
     2639function TDpiApplication.GetExeName: string;
     2640begin
     2641  Result := GetNativeApplication.ExeName;
    18832642end;
    18842643
     
    22102969begin
    22112970  Result := nil;
     2971end;
     2972
     2973procedure TDpiRasterImage.BeginUpdate(ACanvasOnly: Boolean);
     2974begin
     2975  GetNativeRasterImage.BeginUpdate(ACanvasOnly);
     2976end;
     2977
     2978procedure TDpiRasterImage.EndUpdate(AStreamIsValid: Boolean);
     2979begin
     2980  GetNativeRasterImage.EndUpdate(AStreamIsValid);
    22122981end;
    22132982
     
    23493118end;
    23503119
     3120function TDpiBitmap.GetTransparent: Boolean;
     3121begin
     3122  Result := GetNativeBitmap.Transparent;
     3123end;
     3124
     3125function TDpiBitmap.GetTransparentColor: TColor;
     3126begin
     3127  Result := GetNativeBitmap.TransparentColor;
     3128end;
     3129
    23513130function TDpiBitmap.GetWidth: Integer;
    23523131begin
     
    23633142begin
    23643143  GetNativeBitmap.PixelFormat := AValue;
     3144end;
     3145
     3146procedure TDpiBitmap.SetTransparent(AValue: Boolean);
     3147begin
     3148  GetNativeBitmap.Transparent := AValue;
     3149end;
     3150
     3151procedure TDpiBitmap.SetTransparentColor(AValue: TColor);
     3152begin
     3153  GetNativeBitmap.TransparentColor := AValue;
    23653154end;
    23663155
     
    24783267end;
    24793268
     3269function TDpiListBox.GetOnSelectionChange: TSelectionChangeEvent;
     3270begin
     3271  Result := GetNativeListBox.OnSelectionChange;
     3272end;
     3273
    24803274function TDpiListBox.GetParentFont: Boolean;
    24813275begin
     
    25213315begin
    25223316  GetNativeListBox.Items := AValue;
     3317end;
     3318
     3319procedure TDpiListBox.SetOnSelectionChange(AValue: TSelectionChangeEvent);
     3320begin
     3321  GetNativeListBox.OnSelectionChange := AValue;
    25233322end;
    25243323
     
    26313430begin
    26323431  GetNativeCanvas.Handle := AValue;
     3432end;
     3433
     3434procedure TDpiCanvas.SetHeight(AValue: Integer);
     3435begin
     3436  GetNativeCanvas.Height;
     3437end;
     3438
     3439procedure TDpiCanvas.SetWidth(AValue: Integer);
     3440begin
     3441
    26333442end;
    26343443
     
    27113520end;
    27123521
    2713 procedure TDpiCanvas.TextOut(X, Y: Integer; Text: string);
     3522procedure TDpiCanvas.TextOut(X, Y: Integer; const Text: string);
    27143523begin
    27153524  GetNativeCanvas.TextOut(ScaleToNative(X), ScaleToNative(Y), Text);
     
    27313540end;
    27323541
    2733 procedure TDpiCanvas.FillRect(ARect: TRect);
     3542procedure TDpiCanvas.FillRect(const ARect: TRect);
    27343543begin
    27353544  GetNativeCanvas.FillRect(ScaleRectToNative(ARect));
     
    30123821end;
    30133822
     3823procedure TDpiFont.GetTextSize(Text: string; var w, h: Integer);
     3824begin
     3825  W := GetTextWidth(Text);
     3826  H := GetTextHeight(Text);
     3827end;
     3828
     3829function TDpiFont.GetTextHeight(Text: string): Integer;
     3830begin
     3831  Result := ScaleFromNative(GetNativeFont.GetTextHeight(Text));
     3832end;
     3833
     3834function TDpiFont.GetTextWidth(Text: string): Integer;
     3835begin
     3836  Result := ScaleFromNative(GetNativeFont.GetTextWidth(Text));
     3837end;
     3838
    30143839{ TDpiWinControl }
    30153840
     
    31884013    //DpiApplication.UpdateVisible;
    31894014  end;
     4015end;
     4016
     4017function TDpiScreen.GetDesktopHeight: Integer;
     4018begin
     4019  Result := ScaleFromNative(Screen.DesktopHeight);
     4020end;
     4021
     4022function TDpiScreen.GetDesktopLeft: Integer;
     4023begin
     4024  Result := ScaleFromNative(Screen.DesktopLeft);
     4025end;
     4026
     4027function TDpiScreen.GetDesktopTop: Integer;
     4028begin
     4029  Result := ScaleFromNative(Screen.DesktopTop);
     4030end;
     4031
     4032function TDpiScreen.GetDesktopWidth: Integer;
     4033begin
     4034  Result := ScaleFromNative(Screen.DesktopWidth);
    31904035end;
    31914036
     
    32204065  for I := 0 to FForms.Count - 1 do
    32214066    FForms[I].ScreenChanged;
     4067end;
     4068
     4069function TDpiScreen.DisableForms(SkipForm: TDpiForm; DisabledList: TList
     4070  ): TList;
     4071begin
     4072  Result := Screen.DisableForms(SkipForm.GetNativeForm, DisabledList);
     4073end;
     4074
     4075procedure TDpiScreen.EnableForms(var AFormList: TList);
     4076begin
     4077  Screen.EnableForms(AFormList);
    32224078end;
    32234079
     
    34544310end;
    34554311
     4312procedure TDpiControl.Refresh;
     4313begin
     4314  GetNativeControl.Refresh;
     4315end;
     4316
    34564317function TDpiControl.IsParentOf(AControl: TDpiControl): boolean;
    34574318begin
     
    34634324      Exit(True);
    34644325  end;
     4326end;
     4327
     4328function TDpiControl.Scale96ToScreen(const ASize: Integer): Integer;
     4329begin
     4330  Result := MulDiv(ASize, Screen.PixelsPerInch, 96);
    34654331end;
    34664332
     
    35444410end;
    35454411
     4412function TDpiControl.GetAutoSize: Boolean;
     4413begin
     4414  Result := GetNativeControl.AutoSize;
     4415end;
     4416
    35464417function TDpiControl.GetClientHeight: Integer;
    35474418begin
     
    36174488begin
    36184489  GetNativeControl.Anchors := AValue;
     4490end;
     4491
     4492procedure TDpiControl.SetAutoSize(AValue: Boolean);
     4493begin
     4494  GetNativeControl.AutoSize := AValue;
    36194495end;
    36204496
     
    38464722begin
    38474723  Result := GetNativeForm.Position;
     4724end;
     4725
     4726function TDpiForm.GetRestoredHeight: Integer;
     4727begin
     4728  Result := ScaleFromNative(GetNativeForm.RestoredHeight);
     4729end;
     4730
     4731function TDpiForm.GetRestoredLeft: Integer;
     4732begin
     4733  Result := ScaleFromNative(GetNativeForm.RestoredLeft);
     4734end;
     4735
     4736function TDpiForm.GetRestoredTop: Integer;
     4737begin
     4738  Result := ScaleFromNative(GetNativeForm.RestoredTop);
     4739end;
     4740
     4741function TDpiForm.GetRestoredWidth: Integer;
     4742begin
     4743  Result := ScaleFromNative(GetNativeForm.RestoredWidth);
    38484744end;
    38494745
Note: See TracChangeset for help on using the changeset viewer.