From 5600446d97bded103e7abe02cb12b993d2958b5f Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 7 Apr 2009 02:52:51 +0000 Subject: [PATCH] lcl: add TScreen.PrimaryMonitor git-svn-id: trunk@19262 - --- lcl/forms.pp | 4 +++- lcl/include/screen.inc | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lcl/forms.pp b/lcl/forms.pp index 09015b9d5d..093756a90f 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -850,6 +850,7 @@ type function GetHeight : Integer; function GetMonitor(Index: Integer): TMonitor; function GetMonitorCount: Integer; + function GetPrimaryMonitor: TMonitor; function GetWidth : Integer; procedure AddForm(AForm: TCustomForm); procedure RemoveForm(AForm: TCustomForm); @@ -925,12 +926,13 @@ type property HintFont: TFont read GetHintFont; property MonitorCount: Integer read GetMonitorCount; property Monitors[Index: Integer]: TMonitor read GetMonitor; + property PixelsPerInch: integer read FPixelsPerInch; + property PrimaryMonitor: TMonitor read GetPrimaryMonitor; property Width: Integer read GetWidth; property OnActiveControlChange: TNotifyEvent read FOnActiveControlChange write FOnActiveControlChange; property OnActiveFormChange: TNotifyEvent read FOnActiveFormChange write FOnActiveFormChange; - property PixelsPerInch: integer read FPixelsPerInch; end; diff --git a/lcl/include/screen.inc b/lcl/include/screen.inc index 43faabb799..526038a74e 100644 --- a/lcl/include/screen.inc +++ b/lcl/include/screen.inc @@ -551,6 +551,16 @@ begin Result := FMonitors.Count; end; +function TScreen.GetPrimaryMonitor: TMonitor; +var + i: integer; +begin + for i := 0 to MonitorCount - 1 do + if Monitors[i].Primary then + Exit(Monitors[i]); + Result := nil; +end; + function TScreen.GetHintFont: TFont; begin if (FHintFont=nil) then