Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
File:
1 edited

Legend:

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

    r244 r246  
    7777  protected
    7878    procedure ScreenChanged;
    79     function GetVclFont: TFont; virtual;
     79    function GetNativeFont: TFont; virtual;
    8080  public
    81     VclFont: TFont;
     81    NativeFont: TFont;
    8282    constructor Create;
    8383    destructor Destroy; override;
     
    162162    procedure SetOnResize(AValue: TNotifyEvent);
    163163    procedure SetShowHint(AValue: Boolean);
    164     procedure VclFormResize(Sender: TObject);
    165     procedure VclChangeBounds(Sender: TObject);
     164    procedure NativeFormResize(Sender: TObject);
     165    procedure NativeChangeBounds(Sender: TObject);
    166166    procedure DoFormResize;
    167167    procedure DoChangeBounds;
     
    186186    procedure SetVisible(AValue: Boolean); virtual;
    187187    procedure SetWidth(AValue: Integer); virtual;
    188     function GetVclControl: TControl; virtual;
    189     procedure UpdateVclControl; virtual;
     188    function GetNativeControl: TControl; virtual;
     189    procedure UpdateNativeControl; virtual;
    190190    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
    191191      X, Y: Integer); virtual;
     
    247247  protected
    248248    FDpi: Integer;
    249     function GetVclGraphic: TGraphic; virtual;
     249    function GetNativeGraphic: TGraphic; virtual;
    250250    function GetWidth: Integer; virtual; abstract;
    251251    function GetHeight: Integer; virtual; abstract;
     
    256256    function GetDpi: Integer; virtual;
    257257  public
    258     VclGraphicClass: TGraphicClass;
     258    NativeGraphicClass: TGraphicClass;
    259259    constructor Create; virtual;
    260260    procedure LoadFromFile(const Filename: string); virtual;
     
    271271    function GetRawImage: TRawImage;
    272272  protected
    273     function GetVclGraphic: TGraphic; override;
    274     function GetVclRasterImage: TRasterImage; virtual;
     273    function GetNativeGraphic: TGraphic; override;
     274    function GetNativeRasterImage: TRasterImage; virtual;
    275275  public
    276276    property RawImage: TRawImage read GetRawImage;
     
    282282  private
    283283    FFont: TDpiFont;
    284     FVclCanvas: TCanvas;
     284    FNativeCanvas: TCanvas;
    285285    function GetBrush: TBrush;
    286286    function GetHandle: HDC;
     
    294294    procedure SetPen(AValue: TPen);
    295295    procedure SetPixel(X, Y: Integer; AValue: TColor);
    296     procedure SetVclCanvas(AValue: TCanvas);
     296    procedure SetNativeCanvas(AValue: TCanvas);
    297297  protected
    298     function GetVclCanvas: TCanvas; virtual;
     298    function GetNativeCanvas: TCanvas; virtual;
    299299  public
    300     property VclCanvas: TCanvas read FVclCanvas write SetVclCanvas;
     300    property NativeCanvas: TCanvas read FNativeCanvas write SetNativeCanvas;
    301301    procedure StretchDraw(const DestRect: TRect; SrcGraphic: TDpiGraphic); virtual;
    302302    procedure FrameRect(Rect: TRect);
     
    331331  private
    332332    FOnPaint: TNotifyEvent;
    333     VclGraphicControl: TGraphicControl;
     333    NativeGraphicControl: TGraphicControl;
    334334    FCanvas: TDpiCanvas;
    335335    function GetOnPaint: TNotifyEvent;
     
    339339  protected
    340340    procedure Paint; virtual;
    341     function GetVclControl: TControl; override;
    342     function GetVclGraphicControl: TGraphicControl; virtual;
    343     procedure UpdateVclControl; override;
     341    function GetNativeControl: TControl; override;
     342    function GetNativeGraphicControl: TGraphicControl; virtual;
     343    procedure UpdateNativeControl; override;
    344344    property OnPaint: TNotifyEvent read GetOnPaint write SetOnPaint;
    345345  public
     
    367367    procedure SetTabStop(AValue: Boolean);
    368368  protected
    369     function GetVclControl: TControl; override;
    370     function GetVclWinControl: TWinControl; virtual;
     369    function GetNativeControl: TControl; override;
     370    function GetNativeWinControl: TWinControl; virtual;
    371371  public
    372372    Controls: TDpiControls;
     
    395395    procedure SetPixelsPerInch(AValue: Integer);
    396396  protected
    397     function GetVclWinControl: TWinControl; override;
    398     function GetVclCustomControl: TCustomControl; virtual;
     397    function GetNativeWinControl: TWinControl; override;
     398    function GetNativeCustomControl: TCustomControl; virtual;
    399399  public
    400400    property Canvas: TDpiCanvas read GetCanvas;
     
    421421    FVertScrollBar: TDpiControlScrollBar;
    422422  protected
    423     function GetVclCustomControl: TCustomControl; override;
    424     function GetVclScrollingWinControl: TScrollingWinControl; virtual;
     423    function GetNativeCustomControl: TCustomControl; override;
     424    function GetNativeScrollingWinControl: TScrollingWinControl; virtual;
    425425  public
    426426    constructor Create(TheOwner: TComponent); override;
     
    480480    procedure CreateParams(var p: TCreateParams); virtual;
    481481    procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
    482     function GetVclScrollingWinControl: TScrollingWinControl; override;
    483     function GetVclForm: TForm; virtual;
    484     procedure UpdateVclControl; override;
     482    function GetNativeScrollingWinControl: TScrollingWinControl; override;
     483    function GetNativeForm: TForm; virtual;
     484    procedure UpdateNativeControl; override;
    485485  public
    486     VclForm: TForm;
     486    NativeForm: TForm;
    487487    procedure AfterConstruction; override;
    488488    property ModalResult: TModalResult read GetModalResult write SetModalResult;
     
    527527  private
    528528  protected
    529     function GetVclControl: TControl; override;
     529    function GetNativeControl: TControl; override;
    530530  public
    531     VclButton: TButton;
     531    NativeButton: TButton;
    532532    destructor Destroy; override;
    533533  published
     
    559559    procedure SetTopIndex(AValue: Integer);
    560560  protected
    561     function GetVclWinControl: TWinControl; override;
    562     function GetVclListBox: TListBox; virtual;
     561    function GetNativeWinControl: TWinControl; override;
     562    function GetNativeListBox: TListBox; virtual;
    563563  public
    564     VclListBox: TListBox;
     564    NativeListBox: TListBox;
    565565    destructor Destroy; override;
    566566    property ItemIndex: Integer read GetItemIndex write SetItemIndex;
     
    598598    procedure SetPosition(AValue: Integer);
    599599  protected
    600     function GetVclControl: TControl; override;
     600    function GetNativeControl: TControl; override;
    601601  public
    602     VclScrollBar: TScrollBar;
     602    NativeScrollBar: TScrollBar;
    603603    destructor Destroy; override;
    604604  published
     
    627627    function GetHeight: Integer; override;
    628628    function GetWidth: Integer; override;
    629     function GetVclBitmap: TCustomBitmap; virtual;
    630     function GetVclRasterImage: TRasterImage; override;
     629    function GetNativeBitmap: TCustomBitmap; virtual;
     630    function GetNativeRasterImage: TRasterImage; override;
    631631    procedure SetHeight(AValue: Integer); override;
    632632    procedure SetWidth(AValue: Integer); override;
    633633    procedure ScreenChanged; override;
    634634  public
    635     VclBitmap: TBitmap;
     635    NativeBitmap: TBitmap;
    636636    procedure BeginUpdate;
    637637    procedure EndUpdate;
     
    669669  protected
    670670  public
    671     VclImage: TImage;
    672     function GetVclControl: TControl; override;
     671    NativeImage: TImage;
     672    function GetNativeControl: TControl; override;
    673673    destructor Destroy; override;
    674674  published
     
    682682  TDpiPaintBox = class(TDpiGraphicControl)
    683683  public
    684     VclPaintBox: TPaintBox;
    685     function GetVclGraphicControl: TGraphicControl; override;
     684    NativePaintBox: TPaintBox;
     685    function GetNativeGraphicControl: TGraphicControl; override;
    686686    constructor Create(TheOwner: TComponent); override;
    687687    destructor Destroy; override;
     
    718718    destructor Destroy; override;
    719719    procedure UpdateScreen;
    720     procedure UpdateActiveFormFromVclScreen;
     720    procedure UpdateActiveFormFromNativeScreen;
    721721    property FormCount: Integer read GetFormCount;
    722722    property Forms[Index: Integer]: TDpiForm read GetForms;
     
    735735  TDpiJpegImage = class(TDpiBitmap)
    736736  protected
    737     function GetVclBitmap: TCustomBitmap; override;
    738     function GetVclJpeg: TJPEGImage; virtual;
     737    function GetNativeBitmap: TCustomBitmap; override;
     738    function GetNativeJpeg: TJPEGImage; virtual;
    739739  public
    740     VclJpeg: TJPEGImage;
     740    NativeJpeg: TJPEGImage;
    741741    constructor Create; override;
    742742  end;
     
    746746  TDpiPortableNetworkGraphic = class(TDpiBitmap)
    747747  protected
    748     function GetVclBitmap: TCustomBitmap; override;
    749     function GetVclPng: TPortableNetworkGraphic; virtual;
     748    function GetNativeBitmap: TCustomBitmap; override;
     749    function GetNativePng: TPortableNetworkGraphic; virtual;
    750750  public
    751     VclPng: TPortableNetworkGraphic;
     751    NativePng: TPortableNetworkGraphic;
    752752    constructor Create; override;
    753753  end;
     
    767767    procedure SetTitle(AValue: string);
    768768  protected
    769     function GetVclApplication: TApplication; virtual;
     769    function GetNativeApplication: TApplication; virtual;
    770770  public
    771771    constructor Create(AOwner: TComponent); override;
     
    828828    procedure OnClickHandler(Sender: TObject);
    829829  protected
    830     function GetVclMenuItem: TMenuItem; virtual;
     830    function GetNativeMenuItem: TMenuItem; virtual;
    831831    procedure SetParentComponent(AValue: TComponent); override;
    832832  public
    833     VclMenuItem: TMenuItem;
     833    NativeMenuItem: TMenuItem;
    834834    constructor Create(AOwner: TComponent); override;
    835835    destructor Destroy; override;
     
    861861    FItems: TDpiMenuItem;
    862862  protected
    863     function GetVclMenu: TMenu; virtual;
     863    function GetNativeMenu: TMenu; virtual;
    864864  public
    865865    property Items: TDpiMenuItem read FItems;
     
    875875    procedure SetAutoPopup(AValue: Boolean);
    876876  protected
    877     function GetVclMenu: TMenu; override;
    878     function GetVclPopupMenu: TPopupMenu; virtual;
     877    function GetNativeMenu: TMenu; override;
     878    function GetNativePopupMenu: TPopupMenu; virtual;
    879879  public
    880     VclPopupMenu: TPopupMenu;
     880    NativePopupMenu: TPopupMenu;
    881881    procedure PopUp;
    882882    procedure PopUp(X, Y: Integer); virtual;
     
    897897function DpiBitBltCanvas(Dest: TDpiCanvas; X, Y, Width, Height: Integer; Src: TDpiCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    898898function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
    899 function ScaleToVcl(Value: Integer): Integer;
    900 function ScaleFromVcl(Value: Integer): Integer;
    901 function ScalePointToVcl(Value: TPoint): TPoint;
    902 function ScalePointFromVcl(Value: TPoint): TPoint;
    903 function ScaleSizeToVcl(Value: TSize): TSize;
    904 function ScaleSizeFromVcl(Value: TSize): TSize;
    905 function ScaleRectToVcl(Value: TRect): TRect;
    906 function ScaleRectFromVcl(Value: TRect): TRect;
     899function ScaleToNative(Value: Integer): Integer;
     900function ScaleFromNative(Value: Integer): Integer;
     901function ScalePointToNative(Value: TPoint): TPoint;
     902function ScalePointFromNative(Value: TPoint): TPoint;
     903function ScaleSizeToNative(Value: TSize): TSize;
     904function ScaleSizeFromNative(Value: TSize): TSize;
     905function ScaleRectToNative(Value: TRect): TRect;
     906function ScaleRectFromNative(Value: TRect): TRect;
    907907
    908908
     
    933933function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
    934934begin
    935   Result := CreateRectRgn(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2),
    936     ScaleToVcl(Y2));
    937 end;
    938 
    939 function ScaleToVcl(Value: Integer): Integer;
     935  Result := CreateRectRgn(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2),
     936    ScaleToNative(Y2));
     937end;
     938
     939function ScaleToNative(Value: Integer): Integer;
    940940begin
    941941  Result := Round(Value * DpiScreen.Dpi / 96);
    942942end;
    943943
    944 function ScaleFromVcl(Value: Integer): Integer;
     944function ScaleFromNative(Value: Integer): Integer;
    945945begin
    946946  Result := Round(Value * 96 / DpiScreen.Dpi);
    947947end;
    948948
    949 function ScalePointToVcl(Value: TPoint): TPoint;
    950 begin
    951   Result.X := ScaleToVcl(Value.X);
    952   Result.Y := ScaleToVcl(Value.Y);
    953 end;
    954 
    955 function ScalePointFromVcl(Value: TPoint): TPoint;
    956 begin
    957   Result.X := ScaleFromVcl(Value.X);
    958   Result.Y := ScaleFromVcl(Value.Y);
    959 end;
    960 
    961 function ScaleSizeToVcl(Value: TSize): TSize;
    962 begin
    963   Result.Width := ScaleToVcl(Value.Width);
    964   Result.Height := ScaleToVcl(Value.Height);
    965 end;
    966 
    967 function ScaleSizeFromVcl(Value: TSize): TSize;
    968 begin
    969   Result.Width := ScaleFromVcl(Value.Width);
    970   Result.Height := ScaleFromVcl(Value.Height);
    971 end;
    972 
    973 function ScaleRectToVcl(Value: TRect): TRect;
    974 begin
    975   Result.Left := ScaleToVcl(Value.Left);
    976   Result.Top := ScaleToVcl(Value.Top);
    977   Result.Right := ScaleToVcl(Value.Right);
    978   Result.Bottom := ScaleToVcl(Value.Bottom);
    979 end;
    980 
    981 function ScaleRectFromVcl(Value: TRect): TRect;
    982 begin
    983   Result.Left := ScaleFromVcl(Value.Left);
    984   Result.Top := ScaleFromVcl(Value.Top);
    985   Result.Right := ScaleFromVcl(Value.Right);
    986   Result.Bottom := ScaleFromVcl(Value.Bottom);
     949function ScalePointToNative(Value: TPoint): TPoint;
     950begin
     951  Result.X := ScaleToNative(Value.X);
     952  Result.Y := ScaleToNative(Value.Y);
     953end;
     954
     955function ScalePointFromNative(Value: TPoint): TPoint;
     956begin
     957  Result.X := ScaleFromNative(Value.X);
     958  Result.Y := ScaleFromNative(Value.Y);
     959end;
     960
     961function ScaleSizeToNative(Value: TSize): TSize;
     962begin
     963  Result.Width := ScaleToNative(Value.Width);
     964  Result.Height := ScaleToNative(Value.Height);
     965end;
     966
     967function ScaleSizeFromNative(Value: TSize): TSize;
     968begin
     969  Result.Width := ScaleFromNative(Value.Width);
     970  Result.Height := ScaleFromNative(Value.Height);
     971end;
     972
     973function ScaleRectToNative(Value: TRect): TRect;
     974begin
     975  Result.Left := ScaleToNative(Value.Left);
     976  Result.Top := ScaleToNative(Value.Top);
     977  Result.Right := ScaleToNative(Value.Right);
     978  Result.Bottom := ScaleToNative(Value.Bottom);
     979end;
     980
     981function ScaleRectFromNative(Value: TRect): TRect;
     982begin
     983  Result.Left := ScaleFromNative(Value.Left);
     984  Result.Top := ScaleFromNative(Value.Top);
     985  Result.Right := ScaleFromNative(Value.Right);
     986  Result.Bottom := ScaleFromNative(Value.Bottom);
    987987end;
    988988
     
    990990  YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean;
    991991begin
    992   Result := BitBlt(DestDC, ScaleToVcl(X), ScaleToVcl(Y), ScaleToVcl(Width),
    993     ScaleToVcl(Height), SrcDC, ScaleToVcl(XSrc), ScaleToVcl(YSrc), Rop);
     992  Result := BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y), ScaleToNative(Width),
     993    ScaleToNative(Height), SrcDC, ScaleToNative(XSrc), ScaleToNative(YSrc), Rop);
    994994end;
    995995
    996996{ TDpiMenu }
    997997
    998 function TDpiMenu.GetVclMenu: TMenu;
     998function TDpiMenu.GetNativeMenu: TMenu;
    999999begin
    10001000  Result := nil;
     
    10171017function TDpiMenuItem.GetCaption: TTranslateString;
    10181018begin
    1019   Result := GetVclMenuItem.Caption;
     1019  Result := GetNativeMenuItem.Caption;
    10201020end;
    10211021
    10221022function TDpiMenuItem.GetChecked: Boolean;
    10231023begin
    1024   Result := GetVclMenuItem.Checked;
     1024  Result := GetNativeMenuItem.Checked;
    10251025end;
    10261026
     
    10321032function TDpiMenuItem.GetEnabled: Boolean;
    10331033begin
    1034   Result := GetVclMenuItem.Enabled;
     1034  Result := GetNativeMenuItem.Enabled;
    10351035end;
    10361036
    10371037function TDpiMenuItem.GetGroupIndex: Byte;
    10381038begin
    1039   Result := GetVclMenuItem.GroupIndex;
     1039  Result := GetNativeMenuItem.GroupIndex;
    10401040end;
    10411041
     
    10521052function TDpiMenuItem.GetRadioItem: Boolean;
    10531053begin
    1054   Result := GetVclMenuItem.RadioItem;
     1054  Result := GetNativeMenuItem.RadioItem;
    10551055end;
    10561056
    10571057function TDpiMenuItem.GetShortCut: TShortCut;
    10581058begin
    1059   Result := GetVclMenuItem.ShortCut;
     1059  Result := GetNativeMenuItem.ShortCut;
    10601060end;
    10611061
    10621062function TDpiMenuItem.GetVisible: Boolean;
    10631063begin
    1064   Result := GetVclMenuItem.Visible;
     1064  Result := GetNativeMenuItem.Visible;
    10651065end;
    10661066
     
    10921092procedure TDpiMenuItem.SetCaption(AValue: TTranslateString);
    10931093begin
    1094   GetVclMenuItem.Caption := AValue;
     1094  GetNativeMenuItem.Caption := AValue;
    10951095end;
    10961096
    10971097procedure TDpiMenuItem.SetChecked(AValue: Boolean);
    10981098begin
    1099   GetVclMenuItem.Checked := AValue;
     1099  GetNativeMenuItem.Checked := AValue;
    11001100end;
    11011101
    11021102procedure TDpiMenuItem.SetEnabled(AValue: Boolean);
    11031103begin
    1104   GetVclMenuItem.Enabled := AValue;
     1104  GetNativeMenuItem.Enabled := AValue;
    11051105end;
    11061106
    11071107procedure TDpiMenuItem.SetGroupIndex(AValue: Byte);
    11081108begin
    1109   GetVclMenuItem.GroupIndex := AValue;
     1109  GetNativeMenuItem.GroupIndex := AValue;
    11101110end;
    11111111
     
    11171117procedure TDpiMenuItem.SetRadioItem(AValue: Boolean);
    11181118begin
    1119   GetVclMenuItem.RadioItem := AValue;
     1119  GetNativeMenuItem.RadioItem := AValue;
    11201120end;
    11211121
    11221122procedure TDpiMenuItem.SetShortCut(AValue: TShortCut);
    11231123begin
    1124   GetVclMenuItem.ShortCut := AValue;
     1124  GetNativeMenuItem.ShortCut := AValue;
    11251125end;
    11261126
    11271127procedure TDpiMenuItem.SetVisible(AValue: Boolean);
    11281128begin
    1129   GetVclMenuItem.Visible := AValue;
     1129  GetNativeMenuItem.Visible := AValue;
    11301130end;
    11311131
     
    11391139begin
    11401140  FItems.Delete(Index);
    1141   GetVclMenuItem.Delete(Index);
     1141  GetNativeMenuItem.Delete(Index);
    11421142end;
    11431143
     
    11501150begin
    11511151  FItems.Insert(Index, Item);
    1152   GetVclMenuItem.Insert(Index, Item.GetVclMenuItem);
     1152  GetNativeMenuItem.Insert(Index, Item.GetNativeMenuItem);
    11531153end;
    11541154
     
    11711171end;
    11721172
    1173 function TDpiMenuItem.GetVclMenuItem: TMenuItem;
    1174 begin
    1175   if not Assigned(VclMenuItem) then begin
    1176     VclMenuItem := TMenuItem.Create(nil);
    1177     VclMenuItem.Name := 'Vcl' + Name;
    1178     VclMenuItem.OnClick := @OnClickHandler;
    1179   end;
    1180   Result := VclMenuItem;
     1173function TDpiMenuItem.GetNativeMenuItem: TMenuItem;
     1174begin
     1175  if not Assigned(NativeMenuItem) then begin
     1176    NativeMenuItem := TMenuItem.Create(nil);
     1177    NativeMenuItem.Name := 'Native' + Name;
     1178    NativeMenuItem.OnClick := @OnClickHandler;
     1179  end;
     1180  Result := NativeMenuItem;
    11811181end;
    11821182
     
    12201220procedure TDpiPopupMenu.PopUp(X, Y: Integer);
    12211221begin
    1222   GetVclPopupMenu.PopUp(ScaleToVcl(X), ScaleToVcl(Y));
     1222  GetNativePopupMenu.PopUp(ScaleToNative(X), ScaleToNative(Y));
    12231223end;
    12241224
     
    12261226begin
    12271227  inherited;
    1228   GetVclPopupMenu;
     1228  GetNativePopupMenu;
    12291229end;
    12301230
    12311231function TDpiPopupMenu.GetAutoPopup: Boolean;
    12321232begin
    1233   Result := GetVclPopupMenu.AutoPopup;
     1233  Result := GetNativePopupMenu.AutoPopup;
    12341234end;
    12351235
    12361236procedure TDpiPopupMenu.SetAutoPopup(AValue: Boolean);
    12371237begin
    1238   GetVclPopupMenu.AutoPopup := AValue;
    1239 end;
    1240 
    1241 function TDpiPopupMenu.GetVclMenu: TMenu;
    1242 begin
    1243   Result := GetVclPopupMenu;
    1244 end;
    1245 
    1246 function TDpiPopupMenu.GetVclPopupMenu: TPopupMenu;
    1247 begin
    1248   if not Assigned(VclPopupMenu) then begin
    1249     VclPopupMenu := TPopupMenu.Create(nil);
    1250     if Assigned(Items.VclMenuItem) then Items.VclMenuItem.Free;
    1251     Items.VclMenuItem := VclPopupMenu.Items;
    1252   end;
    1253   Result := VclPopupMenu;
     1238  GetNativePopupMenu.AutoPopup := AValue;
     1239end;
     1240
     1241function TDpiPopupMenu.GetNativeMenu: TMenu;
     1242begin
     1243  Result := GetNativePopupMenu;
     1244end;
     1245
     1246function TDpiPopupMenu.GetNativePopupMenu: TPopupMenu;
     1247begin
     1248  if not Assigned(NativePopupMenu) then begin
     1249    NativePopupMenu := TPopupMenu.Create(nil);
     1250    if Assigned(Items.NativeMenuItem) then Items.NativeMenuItem.Free;
     1251    Items.NativeMenuItem := NativePopupMenu.Items;
     1252  end;
     1253  Result := NativePopupMenu;
    12541254end;
    12551255
    12561256destructor TDpiPopupMenu.Destroy;
    12571257begin
    1258   if Assigned(VclPopupMenu) then FreeAndNil(VclPopupMenu);
     1258  if Assigned(NativePopupMenu) then FreeAndNil(NativePopupMenu);
    12591259  inherited Destroy;
    12601260end;
     
    12641264function TDpiMouse.GetCursorPos: TPoint;
    12651265begin
    1266   Result := ScalePointFromVcl(Mouse.CursorPos);
     1266  Result := ScalePointFromNative(Mouse.CursorPos);
    12671267end;
    12681268
    12691269procedure TDpiMouse.SetCursorPos(AValue: TPoint);
    12701270begin
    1271   Mouse.CursorPos := ScalePointToVcl(AValue);
     1271  Mouse.CursorPos := ScalePointToNative(AValue);
    12721272end;
    12731273
     
    13051305{ TDpiScrollingWinControl }
    13061306
    1307 function TDpiScrollingWinControl.GetVclCustomControl: TCustomControl;
    1308 begin
    1309   Result := GetVclScrollingWinControl;
    1310 end;
    1311 
    1312 function TDpiScrollingWinControl.GetVclScrollingWinControl: TScrollingWinControl;
     1307function TDpiScrollingWinControl.GetNativeCustomControl: TCustomControl;
     1308begin
     1309  Result := GetNativeScrollingWinControl;
     1310end;
     1311
     1312function TDpiScrollingWinControl.GetNativeScrollingWinControl: TScrollingWinControl;
    13131313begin
    13141314  Result := nil;
     
    13661366function TDpiApplication.GetTitle: string;
    13671367begin
    1368   Result := GetVclApplication.Title;
     1368  Result := GetNativeApplication.Title;
    13691369end;
    13701370
    13711371function TDpiApplication.GetShowMainForm: Boolean;
    13721372begin
    1373   Result := GetVclApplication.ShowMainForm;
     1373  Result := GetNativeApplication.ShowMainForm;
    13741374end;
    13751375
     
    13861386procedure TDpiApplication.SetShowMainForm(AValue: Boolean);
    13871387begin
    1388   GetVclApplication.ShowMainForm := AValue;
     1388  GetNativeApplication.ShowMainForm := AValue;
    13891389end;
    13901390
    13911391procedure TDpiApplication.SetTitle(AValue: string);
    13921392begin
    1393   GetVclApplication.Title := AValue;
    1394 end;
    1395 
    1396 function TDpiApplication.GetVclApplication: TApplication;
     1393  GetNativeApplication.Title := AValue;
     1394end;
     1395
     1396function TDpiApplication.GetNativeApplication: TApplication;
    13971397begin
    13981398  Result := Application;
     
    14191419begin
    14201420  if (FMainForm <> nil) and GetShowMainForm then FMainForm.Show;
    1421   GetVclApplication.Run;
     1421  GetNativeApplication.Run;
    14221422end;
    14231423
    14241424procedure TDpiApplication.Initialize;
    14251425begin
    1426   GetVclApplication.Initialize;
     1426  GetNativeApplication.Initialize;
    14271427  DpiScreen.UpdateScreen;
    14281428end;
     
    14351435procedure TDpiApplication.ProcessMessages;
    14361436begin
    1437   GetVclApplication.ProcessMessages;
     1437  GetNativeApplication.ProcessMessages;
    14381438end;
    14391439
     
    14461446  then
    14471447    FMainForm := AForm;
    1448   GetVclApplication.UpdateMainForm(AForm.GetVclForm);
     1448  GetNativeApplication.UpdateMainForm(AForm.GetNativeForm);
    14491449end;
    14501450
     
    14791479    AForm := TDpiForm(Instance);
    14801480    UpdateMainForm(AForm);
    1481     if FMainForm = AForm then AForm.GetVclForm.HandleNeeded;
     1481    if FMainForm = AForm then AForm.GetNativeForm.HandleNeeded;
    14821482    if AForm.FormStyle = fsSplash then begin
    14831483      // show the splash form and handle the paint message
     
    14971497{ TDpiJpegImage }
    14981498
    1499 function TDpiJpegImage.GetVclBitmap: TCustomBitmap;
    1500 begin
    1501   Result := GetVclJpeg;
    1502 end;
    1503 
    1504 function TDpiJpegImage.GetVclJpeg: TJPEGImage;
    1505 begin
    1506   if not Assigned(VclJpeg) then VclJpeg := TJPEGImage.Create;
    1507   Result := VclJpeg;
     1499function TDpiJpegImage.GetNativeBitmap: TCustomBitmap;
     1500begin
     1501  Result := GetNativeJpeg;
     1502end;
     1503
     1504function TDpiJpegImage.GetNativeJpeg: TJPEGImage;
     1505begin
     1506  if not Assigned(NativeJpeg) then NativeJpeg := TJPEGImage.Create;
     1507  Result := NativeJpeg;
    15081508end;
    15091509
     
    15111511begin
    15121512  inherited;
    1513   VclGraphicClass := TJPEGImage;
     1513  NativeGraphicClass := TJPEGImage;
    15141514end;
    15151515
    15161516{ TDpiPortableNetworkGraphic }
    15171517
    1518 function TDpiPortableNetworkGraphic.GetVclBitmap: TCustomBitmap;
    1519 begin
    1520   Result := GetVclPng;
    1521 end;
    1522 
    1523 function TDpiPortableNetworkGraphic.GetVclPng: TPortableNetworkGraphic;
    1524 begin
    1525   if not Assigned(VclPng) then VclPng := TPortableNetworkGraphic.Create;
    1526   Result := VclPng;
     1518function TDpiPortableNetworkGraphic.GetNativeBitmap: TCustomBitmap;
     1519begin
     1520  Result := GetNativePng;
     1521end;
     1522
     1523function TDpiPortableNetworkGraphic.GetNativePng: TPortableNetworkGraphic;
     1524begin
     1525  if not Assigned(NativePng) then NativePng := TPortableNetworkGraphic.Create;
     1526  Result := NativePng;
    15271527end;
    15281528
     
    15301530begin
    15311531  inherited;
    1532   VclGraphicClass := TPortableNetworkGraphic;
     1532  NativeGraphicClass := TPortableNetworkGraphic;
    15331533end;
    15341534
     
    15371537function TDpiCustomControl.GetOnPaint: TNotifyEvent;
    15381538begin
    1539   Result := GetVclCustomControl.OnPaint;
     1539  Result := GetNativeCustomControl.OnPaint;
    15401540end;
    15411541
    15421542function TDpiCustomControl.GetPixelsPerInch: Integer;
    15431543begin
    1544 //  Result := GetVclCustomControl.P;
     1544//  Result := GetNativeCustomControl.P;
    15451545end;
    15461546
     
    15491549  if not Assigned(FCanvas) then begin
    15501550    FCanvas := TDpiCanvas.Create;
    1551     FCanvas.VclCanvas := GetVclCustomControl.Canvas;
     1551    FCanvas.NativeCanvas := GetNativeCustomControl.Canvas;
    15521552  end;
    15531553  Result := FCanvas;
     
    15561556procedure TDpiCustomControl.SetOnPaint(AValue: TNotifyEvent);
    15571557begin
    1558   GetVclCustomControl.OnPaint := AValue;
     1558  GetNativeCustomControl.OnPaint := AValue;
    15591559end;
    15601560
     
    15641564end;
    15651565
    1566 function TDpiCustomControl.GetVclWinControl: TWinControl;
    1567 begin
    1568   Result := GetVclCustomControl;
    1569 end;
    1570 
    1571 function TDpiCustomControl.GetVclCustomControl: TCustomControl;
     1566function TDpiCustomControl.GetNativeWinControl: TWinControl;
     1567begin
     1568  Result := GetNativeCustomControl;
     1569end;
     1570
     1571function TDpiCustomControl.GetNativeCustomControl: TCustomControl;
    15721572begin
    15731573  Result := nil;
     
    15781578function TDpiScrollBar.GetBorderSpacing: TControlBorderSpacing;
    15791579begin
    1580   Result := VclScrollBar.BorderSpacing;
     1580  Result := NativeScrollBar.BorderSpacing;
    15811581end;
    15821582
    15831583function TDpiScrollBar.GetKind: TScrollBarKind;
    15841584begin
    1585   Result := VclScrollBar.Kind;
     1585  Result := NativeScrollBar.Kind;
    15861586end;
    15871587
    15881588function TDpiScrollBar.GetMax: Integer;
    15891589begin
    1590   Result := VclScrollBar.Max;
     1590  Result := NativeScrollBar.Max;
    15911591end;
    15921592
    15931593function TDpiScrollBar.GetMin: Integer;
    15941594begin
    1595   Result := VclScrollBar.Min;
     1595  Result := NativeScrollBar.Min;
    15961596end;
    15971597
    15981598function TDpiScrollBar.GetOnChange: TNotifyEvent;
    15991599begin
    1600   Result := VclScrollBar.OnChange;
     1600  Result := NativeScrollBar.OnChange;
    16011601end;
    16021602
    16031603function TDpiScrollBar.GetPageSize: Integer;
    16041604begin
    1605   Result := VclScrollBar.PageSize;
     1605  Result := NativeScrollBar.PageSize;
    16061606end;
    16071607
    16081608function TDpiScrollBar.GetPosition: Integer;
    16091609begin
    1610   Result := VclScrollBar.Position;
     1610  Result := NativeScrollBar.Position;
    16111611end;
    16121612
    16131613procedure TDpiScrollBar.SetBorderSpacing(AValue: TControlBorderSpacing);
    16141614begin
    1615   VclScrollBar.BorderSpacing := AValue;
     1615  NativeScrollBar.BorderSpacing := AValue;
    16161616end;
    16171617
    16181618procedure TDpiScrollBar.SetKind(AValue: TScrollBarKind);
    16191619begin
    1620   VclScrollBar.Kind := AValue;
     1620  NativeScrollBar.Kind := AValue;
    16211621end;
    16221622
    16231623procedure TDpiScrollBar.SetMax(AValue: Integer);
    16241624begin
    1625   VclScrollBar.Max := AValue;
     1625  NativeScrollBar.Max := AValue;
    16261626end;
    16271627
    16281628procedure TDpiScrollBar.SetMin(AValue: Integer);
    16291629begin
    1630   VclScrollBar.Min := Avalue;
     1630  NativeScrollBar.Min := Avalue;
    16311631end;
    16321632
    16331633procedure TDpiScrollBar.SetOnChange(AValue: TNotifyEvent);
    16341634begin
    1635   VclScrollBar.OnChange := AValue;
     1635  NativeScrollBar.OnChange := AValue;
    16361636end;
    16371637
    16381638procedure TDpiScrollBar.SetPageSize(AValue: Integer);
    16391639begin
    1640   VclScrollBar.PageSize := AValue;
     1640  NativeScrollBar.PageSize := AValue;
    16411641end;
    16421642
    16431643procedure TDpiScrollBar.SetPosition(AValue: Integer);
    16441644begin
    1645   VclScrollBar.Position := AValue;
    1646 end;
    1647 
    1648 function TDpiScrollBar.GetVclControl: TControl;
    1649 begin
    1650   if not Assigned(VclScrollBar) then VclScrollBar := TScrollBar.Create(nil);
    1651   Result := VclScrollBar;
     1645  NativeScrollBar.Position := AValue;
     1646end;
     1647
     1648function TDpiScrollBar.GetNativeControl: TControl;
     1649begin
     1650  if not Assigned(NativeScrollBar) then NativeScrollBar := TScrollBar.Create(nil);
     1651  Result := NativeScrollBar;
    16521652end;
    16531653
    16541654destructor TDpiScrollBar.Destroy;
    16551655begin
    1656   FreeAndNil(VclScrollBar);
     1656  FreeAndNil(NativeScrollBar);
    16571657  inherited Destroy;
    16581658end;
     
    16621662function TDpiRasterImage.GetRawImage: TRawImage;
    16631663begin
    1664   Result := GetVclRasterImage.RawImage;
    1665 end;
    1666 
    1667 function TDpiRasterImage.GetVclRasterImage: TRasterImage;
    1668 begin
    1669   Result := GetVclRasterImage;
    1670 end;
    1671 
    1672 function TDpiRasterImage.GetVclGraphic: TGraphic;
    1673 begin
    1674   Result := GetVclRasterImage;
     1664  Result := GetNativeRasterImage.RawImage;
     1665end;
     1666
     1667function TDpiRasterImage.GetNativeRasterImage: TRasterImage;
     1668begin
     1669  Result := GetNativeRasterImage;
     1670end;
     1671
     1672function TDpiRasterImage.GetNativeGraphic: TGraphic;
     1673begin
     1674  Result := GetNativeRasterImage;
    16751675end;
    16761676
    16771677{ TDpiGraphic }
    16781678
    1679 function TDpiGraphic.GetVclGraphic: TGraphic;
     1679function TDpiGraphic.GetNativeGraphic: TGraphic;
    16801680begin
    16811681  Result := nil;
     
    17061706  Bitmap: TGraphic;
    17071707begin
    1708   Bitmap := VclGraphicClass.Create;
     1708  Bitmap := NativeGraphicClass.Create;
    17091709  Bitmap.LoadFromFile(FileName);
    17101710  Width := Bitmap.Width;
    17111711  Height := Bitmap.Height;
    17121712  if Self is TDpiBitmap then
    1713     TBitmap(GetVclGraphic).Canvas.StretchDraw(Bounds(0, 0,
    1714     TBitmap(GetVclGraphic).Width, TBitmap(GetVclGraphic).Height), Bitmap)
     1713    TBitmap(GetNativeGraphic).Canvas.StretchDraw(Bounds(0, 0,
     1714    TBitmap(GetNativeGraphic).Width, TBitmap(GetNativeGraphic).Height), Bitmap)
    17151715    else raise Exception.Create('Unsupported class ' + Self.ClassName);
    17161716  Bitmap.Free;
     
    17211721  Bitmap: TGraphic;
    17221722begin
    1723   Bitmap := VclGraphicClass.Create;
     1723  Bitmap := NativeGraphicClass.Create;
    17241724  Bitmap.Width := Width;
    17251725  Bitmap.Height := Height;
    17261726  if Self is TDpiBitmap then begin
    17271727    if Bitmap is TRasterImage then
    1728       (Bitmap as TRasterImage).Canvas.StretchDraw(Bounds(0, 0, Bitmap.Width, Bitmap.Height), TBitmap(GetVclGraphic))
     1728      (Bitmap as TRasterImage).Canvas.StretchDraw(Bounds(0, 0, Bitmap.Width, Bitmap.Height), TBitmap(GetNativeGraphic))
    17291729      else raise Exception.Create('Expected TRasterImage but got ' + Bitmap.ClassName);
    17301730  end else raise Exception.Create('Unsupported class ' + Self.ClassName);
     
    17441744  if not Assigned(FCanvas) then begin
    17451745    FCanvas := TDpiCanvas.Create;
    1746     FCanvas.VclCanvas := GetVclBitmap.Canvas;
     1746    FCanvas.NativeCanvas := GetNativeBitmap.Canvas;
    17471747  end;
    17481748  Result := FCanvas;
     
    17511751function TDpiBitmap.GetPixelFormat: TPixelFormat;
    17521752begin
    1753   Result := GetVclBitmap.PixelFormat;
     1753  Result := GetNativeBitmap.PixelFormat;
    17541754end;
    17551755
    17561756function TDpiBitmap.GetScanLine(Row: Integer): Pointer;
    17571757begin
    1758   Result := GetVclBitmap.ScanLine[Row];
     1758  Result := GetNativeBitmap.ScanLine[Row];
    17591759end;
    17601760
     
    17671767begin
    17681768  FHeight := AValue;
    1769   GetVclBitmap.Height := ScaleToVcl(AValue);
     1769  GetNativeBitmap.Height := ScaleToNative(AValue);
    17701770end;
    17711771
    17721772procedure TDpiBitmap.SetPixelFormat(AValue: TPixelFormat);
    17731773begin
    1774   GetVclBitmap.PixelFormat := AValue;
     1774  GetNativeBitmap.PixelFormat := AValue;
    17751775end;
    17761776
     
    17781778begin
    17791779  FWidth := AValue;
    1780   GetVclBitmap.Width := ScaleToVcl(AValue);
     1780  GetNativeBitmap.Width := ScaleToNative(AValue);
    17811781end;
    17821782
     
    17871787  NewHeight: Integer;
    17881788begin
    1789   NewWidth := ScaleToVcl(Width);
    1790   NewHeight := ScaleToVcl(Height);
    1791   if Assigned(VclBitmap) and ((NewWidth <> VclBitmap.Width) or (NewHeight <> VclBitmap.Height)) then begin
     1789  NewWidth := ScaleToNative(Width);
     1790  NewHeight := ScaleToNative(Height);
     1791  if Assigned(NativeBitmap) and ((NewWidth <> NativeBitmap.Width) or (NewHeight <> NativeBitmap.Height)) then begin
    17921792    // Rescale bitmap to new size
    17931793    Bitmap := TBitmap.Create;
    17941794    Bitmap.SetSize(NewWidth, NewHeight);
    1795     Bitmap.PixelFormat := VclBitmap.PixelFormat;
    1796     Bitmap.Canvas.StretchDraw(Bounds(0, 0, NewWidth, NewHeight), VclBitmap);
    1797     VclBitmap.Free;
    1798     VclBitmap := Bitmap;
    1799     Canvas.VclCanvas := VclBitmap.Canvas;
    1800   end;
    1801 end;
    1802 
    1803 function TDpiBitmap.GetVclBitmap: TCustomBitmap;
    1804 begin
    1805   if not Assigned(VclBitmap) then begin
    1806     VclBitmap := TBitmap.Create;
    1807     Canvas.VclCanvas := VclBitmap.Canvas;
    1808   end;
    1809   Result := VclBitmap;
     1795    Bitmap.PixelFormat := NativeBitmap.PixelFormat;
     1796    Bitmap.Canvas.StretchDraw(Bounds(0, 0, NewWidth, NewHeight), NativeBitmap);
     1797    NativeBitmap.Free;
     1798    NativeBitmap := Bitmap;
     1799    Canvas.NativeCanvas := NativeBitmap.Canvas;
     1800  end;
     1801end;
     1802
     1803function TDpiBitmap.GetNativeBitmap: TCustomBitmap;
     1804begin
     1805  if not Assigned(NativeBitmap) then begin
     1806    NativeBitmap := TBitmap.Create;
     1807    Canvas.NativeCanvas := NativeBitmap.Canvas;
     1808  end;
     1809  Result := NativeBitmap;
    18101810end;
    18111811
    18121812procedure TDpiBitmap.BeginUpdate;
    18131813begin
    1814   GetVclBitmap.BeginUpdate;
     1814  GetNativeBitmap.BeginUpdate;
    18151815end;
    18161816
    18171817procedure TDpiBitmap.EndUpdate;
    18181818begin
    1819   GetVclBitmap.EndUpdate;
     1819  GetNativeBitmap.EndUpdate;
    18201820end;
    18211821
     
    18241824  FWidth := AWidth;
    18251825  FHeight := AHeight;
    1826   GetVclBitmap.SetSize(ScaleToVcl(AWidth), ScaleToVcl(AHeight));
     1826  GetNativeBitmap.SetSize(ScaleToNative(AWidth), ScaleToNative(AHeight));
    18271827end;
    18281828
     
    18301830begin
    18311831  inherited;
    1832   VclGraphicClass := TBitmap;
     1832  NativeGraphicClass := TBitmap;
    18331833end;
    18341834
     
    18361836begin
    18371837  FreeAndNil(FCanvas);
    1838   FreeAndNil(VclBitmap);
     1838  FreeAndNil(NativeBitmap);
    18391839  inherited;
    18401840end;
     
    18431843begin
    18441844  if Source is TDpiBitmap then begin
    1845     GetVclBitmap.Assign((Source as TDpiBitmap).GetVclBitmap);
     1845    GetNativeBitmap.Assign((Source as TDpiBitmap).GetNativeBitmap);
    18461846  end else inherited;
    18471847end;
    18481848
    1849 function TDpiBitmap.GetVclRasterImage: TRasterImage;
    1850 begin
    1851   Result := GetVclBitmap;
     1849function TDpiBitmap.GetNativeRasterImage: TRasterImage;
     1850begin
     1851  Result := GetNativeBitmap;
    18521852end;
    18531853
     
    18561856function TDpiListBox.GetBorderStyle: TBorderStyle;
    18571857begin
    1858   Result := GetVclListBox.BorderStyle;
     1858  Result := GetNativeListBox.BorderStyle;
    18591859end;
    18601860
    18611861function TDpiListBox.GetCount: Integer;
    18621862begin
    1863   Result := GetVclListBox.Count;
     1863  Result := GetNativeListBox.Count;
    18641864end;
    18651865
    18661866function TDpiListBox.GetExtendedSelect: Boolean;
    18671867begin
    1868   Result := GetVclListBox.ExtendedSelect;
     1868  Result := GetNativeListBox.ExtendedSelect;
    18691869end;
    18701870
    18711871function TDpiListBox.GetIntegralHeight: Boolean;
    18721872begin
    1873   Result := GetVclListBox.IntegralHeight;
     1873  Result := GetNativeListBox.IntegralHeight;
    18741874end;
    18751875
    18761876function TDpiListBox.GetItemHeight: Integer;
    18771877begin
    1878   Result := GetVclListBox.ItemHeight;
     1878  Result := GetNativeListBox.ItemHeight;
    18791879end;
    18801880
    18811881function TDpiListBox.GetItemIndex: Integer;
    18821882begin
    1883   Result := GetVclListBox.ItemIndex;
     1883  Result := GetNativeListBox.ItemIndex;
    18841884end;
    18851885
    18861886function TDpiListBox.GetItems: TStrings;
    18871887begin
    1888   Result := GetVclListBox.Items;
     1888  Result := GetNativeListBox.Items;
    18891889end;
    18901890
    18911891function TDpiListBox.GetParentFont: Boolean;
    18921892begin
    1893   Result := GetVclListBox.ParentFont;
     1893  Result := GetNativeListBox.ParentFont;
    18941894end;
    18951895
    18961896function TDpiListBox.GetScrollWidth: Integer;
    18971897begin
    1898   Result := GetVclListBox.ScrollWidth;
     1898  Result := GetNativeListBox.ScrollWidth;
    18991899end;
    19001900
    19011901function TDpiListBox.GetTopIndex: Integer;
    19021902begin
    1903   Result := GetVclListBox.TopIndex;
     1903  Result := GetNativeListBox.TopIndex;
    19041904end;
    19051905
    19061906procedure TDpiListBox.SetBorderStyle(AValue: TBorderStyle);
    19071907begin
    1908   GetVclListBox.BorderStyle := AValue;
     1908  GetNativeListBox.BorderStyle := AValue;
    19091909end;
    19101910
    19111911procedure TDpiListBox.SetExtendedSelect(AValue: Boolean);
    19121912begin
    1913   GetVclListBox.ExtendedSelect := AValue;
     1913  GetNativeListBox.ExtendedSelect := AValue;
    19141914end;
    19151915
    19161916procedure TDpiListBox.SetIntegralHeight(AValue: Boolean);
    19171917begin
    1918   GetVclListBox.IntegralHeight := AValue;
     1918  GetNativeListBox.IntegralHeight := AValue;
    19191919end;
    19201920
    19211921procedure TDpiListBox.SetItemHeight(AValue: Integer);
    19221922begin
    1923   GetVclListBox.ItemHeight := AValue;
     1923  GetNativeListBox.ItemHeight := AValue;
    19241924end;
    19251925
    19261926procedure TDpiListBox.SetItemIndex(AValue: Integer);
    19271927begin
    1928   GetVclListBox.ItemIndex := AValue;
     1928  GetNativeListBox.ItemIndex := AValue;
    19291929end;
    19301930
    19311931procedure TDpiListBox.SetItems(AValue: TStrings);
    19321932begin
    1933   GetVclListBox.Items := AValue;
     1933  GetNativeListBox.Items := AValue;
    19341934end;
    19351935
    19361936procedure TDpiListBox.SetParentFont(AValue: Boolean);
    19371937begin
    1938   GetVclListBox.ParentFont := AValue;
     1938  GetNativeListBox.ParentFont := AValue;
    19391939end;
    19401940
    19411941procedure TDpiListBox.SetScrollWidth(AValue: Integer);
    19421942begin
    1943   GetVclListBox.ScrollWidth := AValue;
     1943  GetNativeListBox.ScrollWidth := AValue;
    19441944end;
    19451945
    19461946procedure TDpiListBox.SetTopIndex(AValue: Integer);
    19471947begin
    1948   GetVclListBox.TopIndex := AValue;
    1949 end;
    1950 
    1951 function TDpiListBox.GetVclWinControl: TWinControl;
    1952 begin
    1953   Result := GetVclListBox;
    1954 end;
    1955 
    1956 function TDpiListBox.GetVclListBox: TListBox;
    1957 begin
    1958   if not Assigned(VclListBox) then VclListBox := TListBox.Create(nil);
    1959   Result := VclListBox;
     1948  GetNativeListBox.TopIndex := AValue;
     1949end;
     1950
     1951function TDpiListBox.GetNativeWinControl: TWinControl;
     1952begin
     1953  Result := GetNativeListBox;
     1954end;
     1955
     1956function TDpiListBox.GetNativeListBox: TListBox;
     1957begin
     1958  if not Assigned(NativeListBox) then NativeListBox := TListBox.Create(nil);
     1959  Result := NativeListBox;
    19601960end;
    19611961
    19621962destructor TDpiListBox.Destroy;
    19631963begin
    1964   FreeAndNil(VclListBox);
     1964  FreeAndNil(NativeListBox);
    19651965  inherited Destroy;
    19661966end;
     
    19681968{ TDpiPaintBox }
    19691969
    1970 function TDpiPaintBox.GetVclGraphicControl: TGraphicControl;
    1971 begin
    1972   if not Assigned(VclPaintBox) then VclPaintBox := TPaintBox.Create(nil);
    1973   Result := VclPaintBox;
     1970function TDpiPaintBox.GetNativeGraphicControl: TGraphicControl;
     1971begin
     1972  if not Assigned(NativePaintBox) then NativePaintBox := TPaintBox.Create(nil);
     1973  Result := NativePaintBox;
    19741974end;
    19751975
     
    19781978  inherited;
    19791979  Canvas := TDpiCanvas.Create;
    1980   Canvas.VclCanvas := VclPaintBox.Canvas;
    1981   Canvas.Font.VclFont := VclPaintBox.Canvas.Font;
    1982   UpdateVclControl;
     1980  Canvas.NativeCanvas := NativePaintBox.Canvas;
     1981  Canvas.Font.NativeFont := NativePaintBox.Canvas.Font;
     1982  UpdateNativeControl;
    19831983  ScreenChanged;
    19841984end;
     
    19861986destructor TDpiPaintBox.Destroy;
    19871987begin
    1988   FreeAndNil(VclPaintBox);
     1988  FreeAndNil(NativePaintBox);
    19891989  inherited;
    19901990end;
     
    20062006function TDpiCanvas.GetBrush: TBrush;
    20072007begin
    2008   Result := GetVclCanvas.Brush;
     2008  Result := GetNativeCanvas.Brush;
    20092009end;
    20102010
    20112011function TDpiCanvas.GetHandle: HDC;
    20122012begin
    2013   Result := GetVclCanvas.Handle;
     2013  Result := GetNativeCanvas.Handle;
    20142014end;
    20152015
    20162016function TDpiCanvas.GetHeight: Integer;
    20172017begin
    2018   Result := ScaleFromVcl(GetVclCanvas.Height);
     2018  Result := ScaleFromNative(GetNativeCanvas.Height);
    20192019end;
    20202020
    20212021function TDpiCanvas.GetPen: TPen;
    20222022begin
    2023   Result := GetVclCanvas.Pen;
     2023  Result := GetNativeCanvas.Pen;
    20242024end;
    20252025
    20262026function TDpiCanvas.GetPixel(X, Y: Integer): TColor;
    20272027begin
    2028   Result := GetVclCanvas.Pixels[ScaleToVcl(X), ScaleToVcl(Y)];
     2028  Result := GetNativeCanvas.Pixels[ScaleToNative(X), ScaleToNative(Y)];
    20292029end;
    20302030
    20312031function TDpiCanvas.GetWidth: Integer;
    20322032begin
    2033   Result := ScaleFromVcl(GetVclCanvas.Width);
     2033  Result := ScaleFromNative(GetNativeCanvas.Width);
    20342034end;
    20352035
    20362036procedure TDpiCanvas.SetBrush(AValue: TBrush);
    20372037begin
    2038   GetVclCanvas.Brush := AValue;
     2038  GetNativeCanvas.Brush := AValue;
    20392039end;
    20402040
     
    20472047procedure TDpiCanvas.SetHandle(AValue: HDC);
    20482048begin
    2049   GetVclCanvas.Handle := AValue;
     2049  GetNativeCanvas.Handle := AValue;
    20502050end;
    20512051
    20522052procedure TDpiCanvas.SetPen(AValue: TPen);
    20532053begin
    2054   GetVclCanvas.Pen := AValue;
     2054  GetNativeCanvas.Pen := AValue;
    20552055end;
    20562056
     
    20602060  BrushColor: TColor;
    20612061begin
    2062  { BrushStyle := GetVclCanvas.Brush.Style;
    2063   BrushColor := GetVclCanvas.Brush.Color;
    2064   GetVclCanvas.Brush.Color := AValue;
    2065   GetVclCanvas.Brush.Style := bsClear;
    2066   GetVclCanvas.FillRect(ScaleToVcl(X), ScaleToVcl(Y), ScaleToVcl(X + 1) - 1, ScaleToVcl(Y + 1) - 1);
    2067   GetVclCanvas.Brush.Style := BrushStyle;
    2068   GetVclCanvas.Brush.Color := BrushColor;
     2062 { BrushStyle := GetNativeCanvas.Brush.Style;
     2063  BrushColor := GetNativeCanvas.Brush.Color;
     2064  GetNativeCanvas.Brush.Color := AValue;
     2065  GetNativeCanvas.Brush.Style := bsClear;
     2066  GetNativeCanvas.FillRect(ScaleToNative(X), ScaleToNative(Y), ScaleToNative(X + 1) - 1, ScaleToNative(Y + 1) - 1);
     2067  GetNativeCanvas.Brush.Style := BrushStyle;
     2068  GetNativeCanvas.Brush.Color := BrushColor;
    20692069  }
    2070   GetVclCanvas.Pixels[ScaleToVcl(X), ScaleToVcl(Y)] := AValue;
    2071 end;
    2072 
    2073 procedure TDpiCanvas.SetVclCanvas(AValue: TCanvas);
    2074 begin
    2075   if FVclCanvas = AValue then Exit;
    2076   FVclCanvas := AValue;
    2077   FFont.VclFont := FVclCanvas.Font;
    2078 end;
    2079 
    2080 function TDpiCanvas.GetVclCanvas: TCanvas;
    2081 begin
    2082   //if not Assigned(VclCanvas) then VclCanvas := TCanvas.Create;
    2083   Result := VclCanvas;
     2070  GetNativeCanvas.Pixels[ScaleToNative(X), ScaleToNative(Y)] := AValue;
     2071end;
     2072
     2073procedure TDpiCanvas.SetNativeCanvas(AValue: TCanvas);
     2074begin
     2075  if FNativeCanvas = AValue then Exit;
     2076  FNativeCanvas := AValue;
     2077  FFont.NativeFont := FNativeCanvas.Font;
     2078end;
     2079
     2080function TDpiCanvas.GetNativeCanvas: TCanvas;
     2081begin
     2082  //if not Assigned(NativeCanvas) then NativeCanvas := TCanvas.Create;
     2083  Result := NativeCanvas;
    20842084end;
    20852085
     
    20872087  );
    20882088begin
    2089   GetVclCanvas.StretchDraw(ScaleRectToVcl(DestRect), SrcGraphic.GetVclGraphic);
     2089  GetNativeCanvas.StretchDraw(ScaleRectToNative(DestRect), SrcGraphic.GetNativeGraphic);
    20902090end;
    20912091
    20922092procedure TDpiCanvas.FrameRect(Rect: TRect);
    20932093begin
    2094   GetVclCanvas.FrameRect(ScaleRectToVcl(Rect));
     2094  GetNativeCanvas.FrameRect(ScaleRectToNative(Rect));
    20952095end;
    20962096
    20972097procedure TDpiCanvas.Rectangle(X1, Y1, X2, Y2: Integer);
    20982098begin
    2099   GetVclCanvas.Rectangle(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2), ScaleToVcl(Y2));
     2099  GetNativeCanvas.Rectangle(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2), ScaleToNative(Y2));
    21002100end;
    21012101
     
    21072107function TDpiCanvas.TextWidth(Text: string): Integer;
    21082108begin
    2109   Result := ScaleFromVcl(GetVclCanvas.TextWidth(Text));
     2109  Result := ScaleFromNative(GetNativeCanvas.TextWidth(Text));
    21102110end;
    21112111
    21122112function TDpiCanvas.TextHeight(Text: string): Integer;
    21132113begin
    2114   Result := ScaleFromVcl(GetVclCanvas.TextHeight(Text));
     2114  Result := ScaleFromNative(GetNativeCanvas.TextHeight(Text));
    21152115end;
    21162116
    21172117function TDpiCanvas.TextExtent(Text: string): TSize;
    21182118begin
    2119   Result := ScaleSizeFromVcl(GetVclCanvas.TextExtent(Text));
     2119  Result := ScaleSizeFromNative(GetNativeCanvas.TextExtent(Text));
    21202120end;
    21212121
    21222122procedure TDpiCanvas.TextOut(X, Y: Integer; Text: string);
    21232123begin
    2124   GetVclCanvas.TextOut(ScaleToVcl(X), ScaleToVcl(Y), Text);
     2124  GetNativeCanvas.TextOut(ScaleToNative(X), ScaleToNative(Y), Text);
    21252125end;
    21262126
    21272127procedure TDpiCanvas.TextRect(ARect: TRect; X, Y: Integer; Text: string);
    21282128begin
    2129   GetVclCanvas.TextRect(ARect, ScaleToVcl(X), ScaleToVcl(Y), Text);
     2129  GetNativeCanvas.TextRect(ARect, ScaleToNative(X), ScaleToNative(Y), Text);
    21302130end;
    21312131
    21322132procedure TDpiCanvas.MoveTo(X, Y: Integer);
    21332133begin
    2134   GetVclCanvas.MoveTo(ScaleToVcl(X), ScaleToVcl(Y));
     2134  GetNativeCanvas.MoveTo(ScaleToNative(X), ScaleToNative(Y));
    21352135end;
    21362136
    21372137procedure TDpiCanvas.LineTo(X, Y: Integer);
    21382138begin
    2139   GetVclCanvas.LineTo(ScaleToVcl(X), ScaleToVcl(Y));
     2139  GetNativeCanvas.LineTo(ScaleToNative(X), ScaleToNative(Y));
    21402140end;
    21412141
    21422142procedure TDpiCanvas.FillRect(ARect: TRect);
    21432143begin
    2144   GetVclCanvas.FillRect(ScaleRectToVcl(ARect));
     2144  GetNativeCanvas.FillRect(ScaleRectToNative(ARect));
    21452145end;
    21462146
    21472147procedure TDpiCanvas.FillRect(X1, Y1, X2, Y2: Integer);
    21482148begin
    2149   GetVclCanvas.FillRect(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2), ScaleToVcl(Y2));
     2149  GetNativeCanvas.FillRect(ScaleToNative(X1), ScaleToNative(Y1), ScaleToNative(X2), ScaleToNative(Y2));
    21502150end;
    21512151
    21522152procedure TDpiCanvas.Draw(X, Y: Integer; Source: TDpiGraphic);
    21532153begin
    2154   GetVclCanvas.Draw(ScaleToVcl(X), ScaleToVcl(Y), Source.GetVclGraphic);
     2154  GetNativeCanvas.Draw(ScaleToNative(X), ScaleToNative(Y), Source.GetNativeGraphic);
    21552155end;
    21562156
     
    21582158  Source: TRect);
    21592159begin
    2160   GetVclCanvas.CopyRect(Dest, SrcCanvas.VclCanvas, ScaleRectToVcl(Source));
     2160  GetNativeCanvas.CopyRect(Dest, SrcCanvas.NativeCanvas, ScaleRectToNative(Source));
    21612161end;
    21622162
     
    21912191end;
    21922192
    2193 function TDpiGraphicControl.GetVclControl: TControl;
    2194 begin
    2195   Result := GetVclGraphicControl;
    2196 end;
    2197 
    2198 function TDpiGraphicControl.GetVclGraphicControl: TGraphicControl;
    2199 begin
    2200   if not Assigned(VclGraphicControl) then begin
    2201     VclGraphicControl := TGraphicControl.Create(nil);
    2202   end;
    2203   Result := VclGraphicControl;
    2204 end;
    2205 
    2206 procedure TDpiGraphicControl.UpdateVclControl;
     2193function TDpiGraphicControl.GetNativeControl: TControl;
     2194begin
     2195  Result := GetNativeGraphicControl;
     2196end;
     2197
     2198function TDpiGraphicControl.GetNativeGraphicControl: TGraphicControl;
     2199begin
     2200  if not Assigned(NativeGraphicControl) then begin
     2201    NativeGraphicControl := TGraphicControl.Create(nil);
     2202  end;
     2203  Result := NativeGraphicControl;
     2204end;
     2205
     2206procedure TDpiGraphicControl.UpdateNativeControl;
    22072207begin
    22082208  inherited;
    2209   TGraphicControlEx(GetVclGraphicControl).OnPaint := @PaintHandler;
     2209  TGraphicControlEx(GetNativeGraphicControl).OnPaint := @PaintHandler;
    22102210end;
    22112211
     
    22242224  inherited;
    22252225  FCanvas := TDpiCanvas.Create;
    2226   FCanvas.VclCanvas := GetVclGraphicControl.Canvas;
     2226  FCanvas.NativeCanvas := GetNativeGraphicControl.Canvas;
    22272227end;
    22282228
     
    22402240  if FStretch = AValue then Exit;
    22412241  FStretch := AValue;
    2242   VclImage.Stretch := AValue;
     2242  NativeImage.Stretch := AValue;
    22432243end;
    22442244
     
    22492249end;
    22502250
    2251 function TDpiImage.GetVclControl: TControl;
    2252 begin
    2253   if not Assigned(VclImage) then VclImage := TImage.Create(nil);
    2254   Result := VclImage;
     2251function TDpiImage.GetNativeControl: TControl;
     2252begin
     2253  if not Assigned(NativeImage) then NativeImage := TImage.Create(nil);
     2254  Result := NativeImage;
    22552255end;
    22562256
    22572257destructor TDpiImage.Destroy;
    22582258begin
    2259   FreeAndNil(VclImage);
     2259  FreeAndNil(NativeImage);
    22602260  inherited Destroy;
    22612261end;
     
    22672267  if FSize = AValue then Exit;
    22682268  FSize := AValue;
    2269   GetVclFont.Size := AValue;
     2269  GetNativeFont.Size := AValue;
    22702270  DoChange;
    22712271end;
     
    22782278procedure TDpiFont.SetStyle(AValue: TFontStyles);
    22792279begin
    2280   GetVclFont.Style := AValue;
     2280  GetNativeFont.Style := AValue;
    22812281end;
    22822282
     
    22862286end;
    22872287
    2288 function TDpiFont.GetVclFont: TFont;
    2289 begin
    2290   if not Assigned(VclFont) then VclFont := TFont.Create;
    2291   Result := VclFont;
     2288function TDpiFont.GetNativeFont: TFont;
     2289begin
     2290  if not Assigned(NativeFont) then NativeFont := TFont.Create;
     2291  Result := NativeFont;
    22922292end;
    22932293
     
    23002300procedure TDpiFont.SetPixelsPerInch(AValue: Integer);
    23012301begin
    2302   GetVclFont.PixelsPerInch := PixelsPerInch;
     2302  GetNativeFont.PixelsPerInch := PixelsPerInch;
    23032303end;
    23042304
    23052305function TDpiFont.GetName: string;
    23062306begin
    2307   Result := GetVclFont.Name;
     2307  Result := GetNativeFont.Name;
    23082308end;
    23092309
    23102310function TDpiFont.GetColor: TColor;
    23112311begin
    2312   Result := GetVclFont.Color;
     2312  Result := GetNativeFont.Color;
    23132313end;
    23142314
    23152315function TDpiFont.GetCharSet: TFontCharSet;
    23162316begin
    2317   Result := GetVclFont.CharSet;
     2317  Result := GetNativeFont.CharSet;
    23182318end;
    23192319
    23202320function TDpiFont.GetHeight: Integer;
    23212321begin
    2322   Result := GetVclFont.Height;
     2322  Result := GetNativeFont.Height;
    23232323end;
    23242324
    23252325function TDpiFont.GetPixelsPerInch: Integer;
    23262326begin
    2327   Result := GetVclFont.PixelsPerInch;
     2327  Result := GetNativeFont.PixelsPerInch;
    23282328end;
    23292329
    23302330function TDpiFont.GetStyle: TFontStyles;
    23312331begin
    2332   Result := GetVclFont.Style;
     2332  Result := GetNativeFont.Style;
    23332333end;
    23342334
    23352335function TDpiFont.IsNameStored: Boolean;
    23362336begin
    2337   Result := GetVclFont.Name <> 'default';
     2337  Result := GetNativeFont.Name <> 'default';
    23382338end;
    23392339
    23402340procedure TDpiFont.SetCharSet(AValue: TFontCharSet);
    23412341begin
    2342   GetVclFont.CharSet := AValue;
     2342  GetNativeFont.CharSet := AValue;
    23432343end;
    23442344
    23452345procedure TDpiFont.SetColor(AValue: TColor);
    23462346begin
    2347   GetVclFont.Color := AValue;
     2347  GetNativeFont.Color := AValue;
    23482348end;
    23492349
    23502350procedure TDpiFont.SetHeight(AValue: Integer);
    23512351begin
    2352   GetVclFont.Height := AValue;
     2352  GetNativeFont.Height := AValue;
    23532353end;
    23542354
    23552355procedure TDpiFont.SetName(AValue: string);
    23562356begin
    2357   GetVclFont.Name := AValue;
     2357  GetNativeFont.Name := AValue;
    23582358end;
    23592359
     
    23712371begin
    23722372  if Source is TDpiFont then begin
    2373     GetVclFont.Assign((Source as TDpiFont).GetVclFont);
     2373    GetNativeFont.Assign((Source as TDpiFont).GetNativeFont);
    23742374    Size := (Source as TDpiFont).Size;
    23752375    FOnChange := (Source as TDpiFont).FOnChange;
     
    23812381function TDpiWinControl.GetHandle: HWND;
    23822382begin
    2383   Result := GetVclWinControl.Handle;
     2383  Result := GetNativeWinControl.Handle;
    23842384end;
    23852385
    23862386function TDpiWinControl.GetOnKeyDown: TKeyEvent;
    23872387begin
    2388   Result := GetVclWinControl.OnKeyDown;
     2388  Result := GetNativeWinControl.OnKeyDown;
    23892389end;
    23902390
    23912391function TDpiWinControl.GetOnKeyPress: TKeyPressEvent;
    23922392begin
    2393   Result := GetVclWinControl.OnKeyPress;
     2393  Result := GetNativeWinControl.OnKeyPress;
    23942394end;
    23952395
    23962396function TDpiWinControl.GetOnKeyUp: TKeyEvent;
    23972397begin
    2398   Result := GetVclWinControl.OnKeyUp;
     2398  Result := GetNativeWinControl.OnKeyUp;
    23992399end;
    24002400
    24012401function TDpiWinControl.GetTabOrder: TTabOrder;
    24022402begin
    2403   Result := GetVclWinControl.TabOrder;
     2403  Result := GetNativeWinControl.TabOrder;
    24042404end;
    24052405
    24062406function TDpiWinControl.GetTabStop: Boolean;
    24072407begin
    2408   Result := GetVclWinControl.TabStop;
     2408  Result := GetNativeWinControl.TabStop;
    24092409end;
    24102410
    24112411procedure TDpiWinControl.SetHandle(AValue: HWND);
    24122412begin
    2413   GetVclWinControl.Handle := AValue;
     2413  GetNativeWinControl.Handle := AValue;
    24142414end;
    24152415
    24162416procedure TDpiWinControl.SetOnKeyDown(AValue: TKeyEvent);
    24172417begin
    2418   GetVclWinControl.OnKeyDown := AValue;
     2418  GetNativeWinControl.OnKeyDown := AValue;
    24192419end;
    24202420
    24212421procedure TDpiWinControl.SetOnKeyPress(AValue: TKeyPressEvent);
    24222422begin
    2423   GetVclWinControl.OnKeyPress := AValue;
     2423  GetNativeWinControl.OnKeyPress := AValue;
    24242424end;
    24252425
    24262426procedure TDpiWinControl.SetOnKeyUp(AValue: TKeyEvent);
    24272427begin
    2428   GetVclWinControl.OnKeyUp := AValue;
     2428  GetNativeWinControl.OnKeyUp := AValue;
    24292429end;
    24302430
    24312431procedure TDpiWinControl.SetTabOrder(AValue: TTabOrder);
    24322432begin
    2433   GetVclWinControl.TabOrder := AValue;
     2433  GetNativeWinControl.TabOrder := AValue;
    24342434end;
    24352435
    24362436procedure TDpiWinControl.SetTabStop(AValue: Boolean);
    24372437begin
    2438   GetVclWinControl.TabStop := AValue;
    2439 end;
    2440 
    2441 function TDpiWinControl.GetVclControl: TControl;
    2442 begin
    2443   Result := GetVclWinControl;
    2444 end;
    2445 
    2446 function TDpiWinControl.GetVclWinControl: TWinControl;
     2438  GetNativeWinControl.TabStop := AValue;
     2439end;
     2440
     2441function TDpiWinControl.GetNativeControl: TControl;
     2442begin
     2443  Result := GetNativeWinControl;
     2444end;
     2445
     2446function TDpiWinControl.GetNativeWinControl: TWinControl;
    24472447begin
    24482448  Result := nil;
     
    24872487function TDpiScreen.GetWidth: Integer;
    24882488begin
    2489   Result := ScaleFromVcl(Screen.Width);
     2489  Result := ScaleFromNative(Screen.Width);
    24902490end;
    24912491
     
    25022502function TDpiScreen.GetHeight: Integer;
    25032503begin
    2504   Result := ScaleFromVcl(Screen.Height);
     2504  Result := ScaleFromNative(Screen.Height);
    25052505end;
    25062506
     
    25782578end;
    25792579
    2580 procedure TDpiScreen.UpdateActiveFormFromVclScreen;
     2580procedure TDpiScreen.UpdateActiveFormFromNativeScreen;
    25812581var
    25822582  I: Integer;
     
    25872587    for I := 0 to FormCount - 1 do begin
    25882588      F := Forms[I];
    2589       if F.GetVclForm = Screen.ActiveForm then begin
     2589      if F.GetNativeForm = Screen.ActiveForm then begin
    25902590        FActiveForm := F;
    25912591        Break;
     
    25972597{ TDpiButton }
    25982598
    2599 function TDpiButton.GetVclControl: TControl;
    2600 begin
    2601   if not Assigned(VclButton) then VclButton := TButton.Create(nil);
    2602   Result := VclButton;
     2599function TDpiButton.GetNativeControl: TControl;
     2600begin
     2601  if not Assigned(NativeButton) then NativeButton := TButton.Create(nil);
     2602  Result := NativeButton;
    26032603end;
    26042604
    26052605destructor TDpiButton.Destroy;
    26062606begin
    2607   FreeAndNil(VclButton);
     2607  FreeAndNil(NativeButton);
    26082608  inherited;
    26092609end;
     
    26202620procedure TDpiControl.SetVisible(AValue: Boolean);
    26212621begin
    2622   GetVclControl.Visible := AValue;
     2622  GetNativeControl.Visible := AValue;
    26232623end;
    26242624
     
    26302630end;
    26312631
    2632 function TDpiControl.GetVclControl: TControl;
     2632function TDpiControl.GetNativeControl: TControl;
    26332633begin
    26342634  Result := nil;
    26352635end;
    26362636
    2637 procedure TDpiControl.UpdateVclControl;
    2638 begin
    2639   Font.VclFont := GetVclControl.Font;
    2640   GetVclControl.OnResize := @VclFormResize;
    2641   GetVclControl.OnChangeBounds := @VclChangeBounds;
    2642   TControlEx(GetVclControl).OnMouseDown := @MouseDownHandler;
    2643   TControlEx(GetVclControl).OnMouseUp := @MouseUpHandler;
    2644   TControlEx(GetVclControl).OnMouseMove := @MouseMoveHandler;
    2645   TControlEx(GetVclControl).OnMouseEnter := @MouseEnterHandler;
    2646   TControlEx(GetVclControl).OnMouseLeave := @MouseLeaveHandler;
    2647   TControlEx(GetVclControl).OnMouseWheel := @MouseWheelHandler;
     2637procedure TDpiControl.UpdateNativeControl;
     2638begin
     2639  Font.NativeFont := GetNativeControl.Font;
     2640  GetNativeControl.OnResize := @NativeFormResize;
     2641  GetNativeControl.OnChangeBounds := @NativeChangeBounds;
     2642  TControlEx(GetNativeControl).OnMouseDown := @MouseDownHandler;
     2643  TControlEx(GetNativeControl).OnMouseUp := @MouseUpHandler;
     2644  TControlEx(GetNativeControl).OnMouseMove := @MouseMoveHandler;
     2645  TControlEx(GetNativeControl).OnMouseEnter := @MouseEnterHandler;
     2646  TControlEx(GetNativeControl).OnMouseLeave := @MouseLeaveHandler;
     2647  TControlEx(GetNativeControl).OnMouseWheel := @MouseWheelHandler;
    26482648end;
    26492649
     
    26512651  Shift: TShiftState; X, Y: Integer);
    26522652begin
    2653   MouseDown(Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2654   if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2653  MouseDown(Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2654  if Assigned(FOnMouseDown) then FOnMouseDown(Self, Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26552655end;
    26562656
     
    26582658  Shift: TShiftState; X, Y: Integer);
    26592659begin
    2660   MouseUp(Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2661   if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2660  MouseUp(Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2661  if Assigned(FOnMouseUp) then FOnMouseUp(Self, Button, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26622662end;
    26632663
     
    26652665  Y: Integer);
    26662666begin
    2667   MouseMove(Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
    2668   if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, ScaleFromVcl(X), ScaleFromVcl(Y));
     2667  MouseMove(Shift, ScaleFromNative(X), ScaleFromNative(Y));
     2668  if Assigned(FOnMouseMove) then FOnMouseMove(Self, Shift, ScaleFromNative(X), ScaleFromNative(Y));
    26692669end;
    26702670
     
    26732673begin
    26742674  if Assigned(FOnMouseWheel) then FOnMouseWheel(Self, Shift, WheelDelta,
    2675     ScalePointFromVcl(MousePos), Handled);
     2675    ScalePointFromNative(MousePos), Handled);
    26762676end;
    26772677
     
    27122712function TDpiControl.ScreenToClient(const APoint: TPoint): TPoint;
    27132713begin
    2714   Result := ScalePointFromVcl(GetVclControl.ScreenToClient(ScalePointToVcl(APoint)));
     2714  Result := ScalePointFromNative(GetNativeControl.ScreenToClient(ScalePointToNative(APoint)));
    27152715end;
    27162716
    27172717function TDpiControl.ClientToScreen(const APoint: TPoint): TPoint;
    27182718begin
    2719   Result := ScalePointFromVcl(GetVclControl.ClientToScreen(ScalePointToVcl(APoint)));
     2719  Result := ScalePointFromNative(GetNativeControl.ClientToScreen(ScalePointToNative(APoint)));
    27202720end;
    27212721
     
    27232723  const OnVisibleChangedEvent: TNotifyEvent; AsFirst: boolean);
    27242724begin
    2725   GetVclControl.AddHandlerOnVisibleChanged(OnVisibleChangedEvent, AsFirst);
     2725  GetNativeControl.AddHandlerOnVisibleChanged(OnVisibleChangedEvent, AsFirst);
    27262726end;
    27272727
     
    27292729  const OnVisibleChangedEvent: TNotifyEvent);
    27302730begin
    2731   GetVclControl.RemoveHandlerOnVisibleChanged(OnVisibleChangedEvent);
     2731  GetNativeControl.RemoveHandlerOnVisibleChanged(OnVisibleChangedEvent);
    27322732end;
    27332733
     
    27592759procedure TDpiControl.Invalidate;
    27602760begin
    2761   GetVclControl.Invalidate;
     2761  GetNativeControl.Invalidate;
    27622762end;
    27632763
    27642764procedure TDpiControl.Repaint;
    27652765begin
    2766   GetVclControl.Repaint;
     2766  GetNativeControl.Repaint;
    27672767end;
    27682768
    27692769procedure TDpiControl.Update;
    27702770begin
    2771   GetVclControl.Update;
     2771  GetNativeControl.Update;
    27722772end;
    27732773
     
    27912791  if Assigned(TheOwner) and (TheOwner is TDpiWinControl) then
    27922792    Parent := TDpiWinControl(TheOwner);
    2793   GetVclControl;
    2794   UpdateVclControl;
     2793  GetNativeControl;
     2794  UpdateNativeControl;
    27952795  ScreenChanged;
    27962796end;
     
    28122812procedure TDpiControl.SetCaption(AValue: string);
    28132813begin
    2814   GetVclControl.Caption := AValue;
     2814  GetNativeControl.Caption := AValue;
    28152815end;
    28162816
     
    28212821    FParent.Controls.Remove(Self);
    28222822    if Assigned(FParent) and (FParent is TDpiWinControl) then
    2823       GetVclControl.Parent := nil;
     2823      GetNativeControl.Parent := nil;
    28242824  end;
    28252825  FParent := AValue;
     
    28272827    FParent.Controls.Add(Self);
    28282828    if Assigned(FParent) and (FParent is TDpiWinControl) then
    2829       GetVclControl.Parent := TDpiWinControl(FParent).GetVclWinControl;
     2829      GetNativeControl.Parent := TDpiWinControl(FParent).GetNativeWinControl;
    28302830  end;
    28312831end;
     
    28392839procedure TDpiControl.SetHint(AValue: string);
    28402840begin
    2841   GetVclControl.Hint := AValue;
     2841  GetNativeControl.Hint := AValue;
    28422842end;
    28432843
     
    28522852function TDpiControl.GetAlign: TAlign;
    28532853begin
    2854   Result := GetVclControl.Align;
     2854  Result := GetNativeControl.Align;
    28552855end;
    28562856
    28572857function TDpiControl.GetAnchors: TAnchors;
    28582858begin
    2859   Result := GetVclControl.Anchors;
     2859  Result := GetNativeControl.Anchors;
    28602860end;
    28612861
    28622862function TDpiControl.GetClientHeight: Integer;
    28632863begin
    2864   Result := ScaleFromVcl(GetVclControl.ClientHeight);
     2864  Result := ScaleFromNative(GetNativeControl.ClientHeight);
    28652865end;
    28662866
    28672867function TDpiControl.GetClientWidth: Integer;
    28682868begin
    2869   Result := ScaleFromVcl(GetVclControl.ClientWidth);
     2869  Result := ScaleFromNative(GetNativeControl.ClientWidth);
    28702870end;
    28712871
    28722872function TDpiControl.GetColor: TColor;
    28732873begin
    2874   Result := GetVclControl.Color;
     2874  Result := GetNativeControl.Color;
    28752875end;
    28762876
    28772877function TDpiControl.GetCursor: TCursor;
    28782878begin
    2879   Result := GetVclControl.Cursor;
     2879  Result := GetNativeControl.Cursor;
    28802880end;
    28812881
    28822882function TDpiControl.GetEnabled: Boolean;
    28832883begin
    2884   Result := GetVclControl.Enabled;
     2884  Result := GetNativeControl.Enabled;
    28852885end;
    28862886
    28872887function TDpiControl.GetHint: string;
    28882888begin
    2889   Result := GetVclControl.Hint;
     2889  Result := GetNativeControl.Hint;
    28902890end;
    28912891
    28922892function TDpiControl.GetOnClick: TNotifyEvent;
    28932893begin
    2894   Result := GetVclControl.OnClick;
     2894  Result := GetNativeControl.OnClick;
    28952895end;
    28962896
    28972897function TDpiControl.GetShowHint: Boolean;
    28982898begin
    2899   Result := GetVclControl.ShowHint;
     2899  Result := GetNativeControl.ShowHint;
    29002900end;
    29012901
    29022902function TDpiControl.GetVisible: Boolean;
    29032903begin
    2904   Result := GetVclControl.Visible;
     2904  Result := GetNativeControl.Visible;
    29052905end;
    29062906
     
    29122912procedure TDpiControl.SetAlign(AValue: TAlign);
    29132913begin
    2914   GetVclControl.Align := AValue;
     2914  GetNativeControl.Align := AValue;
    29152915end;
    29162916
    29172917procedure TDpiControl.SetAnchors(AValue: TAnchors);
    29182918begin
    2919   GetVclControl.Anchors := AValue;
     2919  GetNativeControl.Anchors := AValue;
    29202920end;
    29212921
     
    29272927procedure TDpiControl.SetClientHeight(AValue: Integer);
    29282928begin
    2929   GetVclControl.ClientHeight := ScaletoVcl(AValue);
     2929  GetNativeControl.ClientHeight := ScaleToNative(AValue);
    29302930end;
    29312931
    29322932procedure TDpiControl.SetClientWidth(AValue: Integer);
    29332933begin
    2934   GetVclControl.ClientWidth := ScaletoVcl(AValue);
     2934  GetNativeControl.ClientWidth := ScaleToNative(AValue);
    29352935end;
    29362936
    29372937procedure TDpiControl.SetColor(AValue: TColor);
    29382938begin
    2939   GetVclControl.Color := AValue;
     2939  GetNativeControl.Color := AValue;
    29402940end;
    29412941
    29422942procedure TDpiControl.SetCursor(AValue: TCursor);
    29432943begin
    2944   GetVclControl.Cursor := AValue;
     2944  GetNativeControl.Cursor := AValue;
    29452945end;
    29462946
    29472947procedure TDpiControl.SetEnabled(AValue: Boolean);
    29482948begin
    2949   GetVclControl.Enabled := AValue;
     2949  GetNativeControl.Enabled := AValue;
    29502950end;
    29512951
     
    29582958procedure TDpiControl.SetOnClick(AValue: TNotifyEvent);
    29592959begin
    2960   GetVclControl.OnClick := AValue;
     2960  GetNativeControl.OnClick := AValue;
    29612961end;
    29622962
     
    29692969procedure TDpiControl.SetShowHint(AValue: Boolean);
    29702970begin
    2971   GetVclControl.ShowHint := AValue;
    2972 end;
    2973 
    2974 procedure TDpiControl.VclFormResize(Sender: TObject);
    2975 begin
    2976   BoundsRect := ScaleRectFromVcl(GetVclControl.BoundsRect);
     2971  GetNativeControl.ShowHint := AValue;
     2972end;
     2973
     2974procedure TDpiControl.NativeFormResize(Sender: TObject);
     2975begin
     2976  BoundsRect := ScaleRectFromNative(GetNativeControl.BoundsRect);
    29772977  DoFormResize;
    29782978end;
    29792979
    2980 procedure TDpiControl.VclChangeBounds(Sender: TObject);
     2980procedure TDpiControl.NativeChangeBounds(Sender: TObject);
    29812981var
    29822982  NewBounds: TRect;
    29832983begin
    2984   NewBounds := ScaleRectFromVcl(GetVclControl.BoundsRect);
     2984  NewBounds := ScaleRectFromNative(GetNativeControl.BoundsRect);
    29852985  if NewBounds <> BoundsRect then begin
    29862986    BoundsRect := NewBounds;
     
    30013001function TDpiControl.GetCaption: string;
    30023002begin
    3003   Result := GetVclControl.Caption;
     3003  Result := GetNativeControl.Caption;
    30043004end;
    30053005
    30063006procedure TDpiControl.FontChanged(Sender: TObject);
    30073007begin
    3008   GetVclControl.Font.Size := ScaleToVcl(Font.Size);
     3008  GetNativeControl.Font.Size := ScaleToNative(Font.Size);
    30093009end;
    30103010
    30113011procedure TDpiControl.UpdateBounds;
    30123012begin
    3013   GetVclControl.BoundsRect := ScaleRectToVcl(BoundsRect);
     3013  GetNativeControl.BoundsRect := ScaleRectToNative(BoundsRect);
    30143014end;
    30153015
     
    30513051function TDpiForm.GetBorderIcons: TBorderIcons;
    30523052begin
    3053   Result := GetVclForm.BorderIcons;
     3053  Result := GetNativeForm.BorderIcons;
    30543054end;
    30553055
    30563056function TDpiForm.GetBorderStyle: TFormBorderStyle;
    30573057begin
    3058   Result := GetVclForm.BorderStyle;
     3058  Result := GetNativeForm.BorderStyle;
    30593059end;
    30603060
    30613061function TDpiForm.GetDesignTimePPI: Integer;
    30623062begin
    3063   Result := GetVclForm.DesignTimePPI;
     3063  Result := GetNativeForm.DesignTimePPI;
    30643064end;
    30653065
    30663066function TDpiForm.GetFormState: TFormState;
    30673067begin
    3068   Result := GetVclForm.FormState;
     3068  Result := GetNativeForm.FormState;
    30693069end;
    30703070
    30713071function TDpiForm.GetFormStyle: TFormStyle;
    30723072begin
    3073   Result := GetVclForm.FormStyle;
     3073  Result := GetNativeForm.FormStyle;
    30743074end;
    30753075
    30763076function TDpiForm.GetKeyPreview: Boolean;
    30773077begin
    3078   Result := GetVclForm.KeyPreview;
     3078  Result := GetNativeForm.KeyPreview;
    30793079end;
    30803080
    30813081function TDpiForm.GetLCLVersion: string;
    30823082begin
    3083   Result := GetVclForm.LCLVersion;
     3083  Result := GetNativeForm.LCLVersion;
    30843084end;
    30853085
    30863086function TDpiForm.GetModalResult: TModalResult;
    30873087begin
    3088   Result := GetVclForm.ModalResult;
     3088  Result := GetNativeForm.ModalResult;
    30893089end;
    30903090
    30913091function TDpiForm.GetOnCloseQuery: TCloseQueryEvent;
    30923092begin
    3093   Result := GetVclForm.OnCloseQuery;
     3093  Result := GetNativeForm.OnCloseQuery;
    30943094end;
    30953095
    30963096function TDpiForm.GetOnCreate: TNotifyEvent;
    30973097begin
    3098   Result := GetVclForm.OnCreate;
     3098  Result := GetNativeForm.OnCreate;
    30993099end;
    31003100
    31013101function TDpiForm.GetOnDeactivate: TNotifyEvent;
    31023102begin
    3103   Result := GetVclForm.OnDeactivate;
     3103  Result := GetNativeForm.OnDeactivate;
    31043104end;
    31053105
    31063106function TDpiForm.GetOnDestroy: TNotifyEvent;
    31073107begin
    3108   Result := GetVclForm.OnDestroy;
     3108  Result := GetNativeForm.OnDestroy;
    31093109end;
    31103110
    31113111function TDpiForm.GetOnHide: TNotifyEvent;
    31123112begin
    3113   Result := GetVclForm.OnHide;
     3113  Result := GetNativeForm.OnHide;
    31143114end;
    31153115
    31163116function TDpiForm.GetOnShow: TNotifyEvent;
    31173117begin
    3118   Result := GetVclForm.OnShow;
     3118  Result := GetNativeForm.OnShow;
    31193119end;
    31203120
    31213121function TDpiForm.GetPosition: TPosition;
    31223122begin
    3123   Result := GetVclForm.Position;
     3123  Result := GetNativeForm.Position;
    31243124end;
    31253125
    31263126function TDpiForm.GetWindowState: TWindowState;
    31273127begin
    3128   Result := GetVclForm.WindowState;
     3128  Result := GetNativeForm.WindowState;
    31293129end;
    31303130
    31313131procedure TDpiForm.SetBorderIcons(AValue: TBorderIcons);
    31323132begin
    3133   GetVclForm.BorderIcons := AValue;
     3133  GetNativeForm.BorderIcons := AValue;
    31343134end;
    31353135
    31363136procedure TDpiForm.SetBorderStyle(AValue: TFormBorderStyle);
    31373137begin
    3138   GetVclForm.BorderStyle := AValue;
     3138  GetNativeForm.BorderStyle := AValue;
    31393139end;
    31403140
    31413141procedure TDpiForm.SetDesignTimePPI(AValue: Integer);
    31423142begin
    3143   GetVclForm.DesignTimePPI := AValue;
     3143  GetNativeForm.DesignTimePPI := AValue;
    31443144end;
    31453145
    31463146procedure TDpiForm.SetFormStyle(AValue: TFormStyle);
    31473147begin
    3148   GetVclForm.FormStyle := AValue;
     3148  GetNativeForm.FormStyle := AValue;
    31493149end;
    31503150
    31513151procedure TDpiForm.SetKeyPreview(AValue: Boolean);
    31523152begin
    3153   GetVclForm.KeyPreview := AValue;
     3153  GetNativeForm.KeyPreview := AValue;
    31543154end;
    31553155
    31563156procedure TDpiForm.SetLCLVersion(AValue: string);
    31573157begin
    3158   GetVclForm.LCLVersion := AValue;
     3158  GetNativeForm.LCLVersion := AValue;
    31593159end;
    31603160
    31613161procedure TDpiForm.SetModalResult(AValue: TModalResult);
    31623162begin
    3163   GetVclForm.ModalResult := AValue;
     3163  GetNativeForm.ModalResult := AValue;
    31643164end;
    31653165
    31663166procedure TDpiForm.SetOnCloseQuery(AValue: TCloseQueryEvent);
    31673167begin
    3168   GetVclForm.OnCloseQuery := AValue;
     3168  GetNativeForm.OnCloseQuery := AValue;
    31693169end;
    31703170
    31713171procedure TDpiForm.SetOnCreate(AValue: TNotifyEvent);
    31723172begin
    3173   GetVclForm.OnCreate := AValue;
     3173  GetNativeForm.OnCreate := AValue;
    31743174end;
    31753175
    31763176procedure TDpiForm.SetOnDeactivate(AValue: TNotifyEvent);
    31773177begin
    3178   GetVclForm.OnDeactivate := AValue;
     3178  GetNativeForm.OnDeactivate := AValue;
    31793179end;
    31803180
    31813181procedure TDpiForm.SetOnDestroy(AValue: TNotifyEvent);
    31823182begin
    3183   GetVclForm.OnDestroy := AValue;
     3183  GetNativeForm.OnDestroy := AValue;
    31843184end;
    31853185
    31863186procedure TDpiForm.SetOnHide(AValue: TNotifyEvent);
    31873187begin
    3188   GetVclForm.OnHide := AValue;
     3188  GetNativeForm.OnHide := AValue;
    31893189end;
    31903190
    31913191procedure TDpiForm.SetOnShow(AValue: TNotifyEvent);
    31923192begin
    3193   GetVclForm.OnShow := AValue;
     3193  GetNativeForm.OnShow := AValue;
    31943194end;
    31953195
    31963196procedure TDpiForm.DoOnCreate;
    31973197begin
    3198   if Assigned(GetVclForm.OnCreate) then
    3199     GetVclForm.OnCreate(Self);
     3198  if Assigned(GetNativeForm.OnCreate) then
     3199    GetNativeForm.OnCreate(Self);
    32003200end;
    32013201
     
    32073207procedure TDpiForm.SetPosition(AValue: TPosition);
    32083208begin
    3209   GetVclForm.Position := AValue;
     3209  GetNativeForm.Position := AValue;
    32103210end;
    32113211
    32123212procedure TDpiForm.SetWindowState(AValue: TWindowState);
    32133213begin
    3214   GetVclForm.WindowState := AValue;
     3214  GetNativeForm.WindowState := AValue;
    32153215end;
    32163216
     
    32253225begin
    32263226  DpiScreen.FActiveForm := DpiScreen.FActiveFormPrev;
    3227   //DpiScreen.UpdateActiveFormFromVclScreen;
     3227  //DpiScreen.UpdateActiveFormFromNativeScreen;
    32283228  if Assigned(FOnDeactivate) then FOnDeactivate(Sender);
    32293229end;
     
    32463246procedure TDpiForm.CreateParams(var p: TCreateParams);
    32473247begin
    3248   // TODO: VclForm.CreateParams(P);
     3248  // TODO: NativeForm.CreateParams(P);
    32493249end;
    32503250
     
    32653265end;
    32663266
    3267 function TDpiForm.GetVclScrollingWinControl: TScrollingWinControl;
    3268 begin
    3269   Result := GetVclForm;
    3270 end;
    3271 
    3272 function TDpiForm.GetVclForm: TForm;
    3273 begin
    3274   if not Assigned(VclForm) then begin
    3275     VclForm := TFormEx.CreateNew(nil);
    3276     (VclForm as TFormEx).OnMessage := @FormMessageHandler;
    3277     //VclForm := TForm.Create(nil);
    3278   end;
    3279   Result := VclForm;
    3280 end;
    3281 
    3282 procedure TDpiForm.UpdateVclControl;
     3267function TDpiForm.GetNativeScrollingWinControl: TScrollingWinControl;
     3268begin
     3269  Result := GetNativeForm;
     3270end;
     3271
     3272function TDpiForm.GetNativeForm: TForm;
     3273begin
     3274  if not Assigned(NativeForm) then begin
     3275    NativeForm := TFormEx.CreateNew(nil);
     3276    (NativeForm as TFormEx).OnMessage := @FormMessageHandler;
     3277    //NativeForm := TForm.Create(nil);
     3278  end;
     3279  Result := NativeForm;
     3280end;
     3281
     3282procedure TDpiForm.UpdateNativeControl;
    32833283begin
    32843284  inherited;
    3285   GetVclForm.OnActivate := @ActivateHandler;
    3286   GetVclForm.OnDeactivate := @DeactivateHandler;
    3287   GetVclForm.OnClose := @CloseHandler;
    3288   GetVclForm.OnCloseQuery := @CloseQueryHandler;
    3289   GetVclForm.Name := Name + 'Vcl';
     3285  GetNativeForm.OnActivate := @ActivateHandler;
     3286  GetNativeForm.OnDeactivate := @DeactivateHandler;
     3287  GetNativeForm.OnClose := @CloseHandler;
     3288  GetNativeForm.OnCloseQuery := @CloseQueryHandler;
     3289  GetNativeForm.Name := Name + 'Native';
    32903290end;
    32913291
     
    32983298function TDpiForm.ShowModal: Integer;
    32993299begin
    3300   Result := GetVclForm.ShowModal;
     3300  Result := GetNativeForm.ShowModal;
    33013301end;
    33023302
     
    33583358procedure TDpiForm.BringToFront;
    33593359begin
    3360   GetVclForm.BringToFront;
     3360  GetNativeForm.BringToFront;
    33613361end;
    33623362
     
    33833383  end;
    33843384  ScreenChanged;
    3385   UpdateVclControl;
     3385  UpdateNativeControl;
    33863386end;
    33873387
     
    33953395begin
    33963396  // TODO: Can't destroy directly?
    3397   //FreeAndNil(VclForm);
     3397  //FreeAndNil(NativeForm);
    33983398  DpiScreen.RemoveForm(Self);
    33993399end;
     
    34013401initialization
    34023402
    3403 RegisterPropertyToSkip(TDpiForm, 'OldCreateOrder', 'VCL compatibility property', '');
    3404 RegisterPropertyToSkip(TDpiForm, 'TextHeight', 'VCL compatibility property', '');
    3405 RegisterPropertyToSkip(TDpiForm, 'Scaled', 'VCL compatibility property', '');
    3406 RegisterPropertyToSkip(TDpiForm, 'TransparentColorValue', 'VCL compatibility property', '');
     3403RegisterPropertyToSkip(TDpiForm, 'OldCreateOrder', 'Native compatibility property', '');
     3404RegisterPropertyToSkip(TDpiForm, 'TextHeight', 'Native compatibility property', '');
     3405RegisterPropertyToSkip(TDpiForm, 'Scaled', 'Native compatibility property', '');
     3406RegisterPropertyToSkip(TDpiForm, 'TransparentColorValue', 'Native compatibility property', '');
    34073407DpiScreen := TDpiScreen.Create;
    34083408DpiApplication := TDpiApplication.Create(nil);
Note: See TracChangeset for help on using the changeset viewer.