tray icon: improved Delphi compatibility, started GetPosition (issue #7991)

git-svn-id: trunk@10342 -
This commit is contained in:
vincents 2006-12-18 09:02:45 +00:00
parent c6fcef4270
commit 3c5dd2a426
5 changed files with 57 additions and 16 deletions

View File

@ -31,8 +31,12 @@ unit TrayIcon;
interface
uses
Classes, SysUtils, WSTrayIcon, Menus, Graphics, Forms, Controls,
LResources, Dialogs;
{$ifdef fpc}
LResources,
{$else}
Windows,
{$endif}
Classes, SysUtils, WSTrayIcon, Menus, Graphics, Forms, Controls, Dialogs;
type
@ -60,6 +64,7 @@ type
function Hide: Boolean;
function Show: Boolean;
procedure UpdateWS;
function GetPosition: TPoint;
property Canvas: TCanvas read GetCanvas;
published
{ Published declarations }
@ -210,6 +215,23 @@ begin
vwsTrayIcon.InternalUpdate;
end;
{*******************************************************************
* TTrayIcon.GetPosition ()
*
* DESCRIPTION: Returns the position of the tray icon on the display.
* This function is utilized to show message boxes near
* the icon
*
* PARAMETERS: None
*
* RETURNS: Nothing
*
*******************************************************************}
function TTrayIcon.GetPosition: TPoint;
begin
Result := vwsTrayIcon.GetPosition;
end;
{*******************************************************************
* TTrayIcon.GetCanvas ()
*

View File

@ -1,12 +1,14 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="2">
<PathDelim Value="\"/>
<Name Value="TrayIconLaz"/>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="$(LazarusDir)/components/opengl/gtk2x11/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
<OtherUnitFiles Value="$(LazarusDir)\components\opengl\gtk2x11\"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\$(LCLWidgetType)"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
@ -16,11 +18,11 @@
</Other>
</CompilerOptions>
<Version Minor="2"/>
<Files Count="6">
<Files Count="7">
<Item1>
<Filename Value="wswin32trayicon.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="wswin32trayicon"/>
<UnitName Value="WSWin32TrayIcon"/>
</Item1>
<Item2>
<Filename Value="trayicon.pas"/>
@ -30,7 +32,7 @@
<Item3>
<Filename Value="wsgtk2trayicon.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="wsgtk2trayicon"/>
<UnitName Value="WSGtk2TrayIcon"/>
</Item3>
<Item4>
<Filename Value="wsgtktrayicon.pas"/>
@ -46,6 +48,10 @@
<AddToUsesPkgSection Value="False"/>
<UnitName Value="wsx11trayicon"/>
</Item6>
<Item7>
<Filename Value="wscommontrayicon.pas"/>
<UnitName Value="WSCommonTrayIcon"/>
</Item7>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">
@ -58,10 +64,11 @@
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
<UnitPath Value="$(PkgOutDir)\"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedpackage\"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>

View File

@ -7,7 +7,7 @@ unit TrayIconLaz;
interface
uses
TrayIcon, wstrayicon, LazarusPackageIntf;
TrayIcon, wstrayicon, WSCommonTrayIcon, LazarusPackageIntf;
implementation

View File

@ -23,9 +23,19 @@ unit WSCommonTrayIcon;
{$PACKRECORDS C}
{$endif}
{*******************************************************************
* Compatibility code for Delphi for Windows.
*******************************************************************}
{$ifndef FPC}
{$define Windows}
{$endif}
interface
uses
{$IFDEF Windows}
Windows,
{$ENDIF}
Graphics, Classes, SysUtils, Controls, Menus;
type

View File

@ -30,20 +30,22 @@ interface
* Compatibility code for Delphi for Windows.
*******************************************************************}
{$ifndef FPC}
{$define MSWindows}
{$define Windows}
{$endif}
uses
{$ifdef Win32}
{$ifdef Windows}
wswin32trayicon,
{$ifdef WinCE}
{$endif}
{$ifdef WinCE}
wswincetrayicon,
wswincetrayicon,
{$else}
wswin32trayicon,
{$endif}
{$endif}
{$ifdef UNIX}