mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 04:40:54 +02:00
Added initial implementation for BallonHints on the tray, and updated example.
git-svn-id: trunk@12809 -
This commit is contained in:
parent
329a78831a
commit
579e90adec
@ -40,6 +40,14 @@ object Form1: TForm1
|
||||
OnClick = Button3Click
|
||||
TabOrder = 2
|
||||
end
|
||||
object Button4: TButton
|
||||
Left = 56
|
||||
Height = 32
|
||||
Top = 168
|
||||
Width = 94
|
||||
Caption = 'Display Message'
|
||||
TabOrder = 3
|
||||
end
|
||||
object PopupMenu: TPopupMenu
|
||||
left = 180
|
||||
top = 260
|
||||
|
@ -11,9 +11,11 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
||||
+#2'^'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#4'Hide'#7'OnClick'#7#12
|
||||
+'Button2Click'#8'TabOrder'#2#1#0#0#7'TButton'#7'Button3'#4'Left'#3#224#0#6'H'
|
||||
+'eight'#2'!'#3'Top'#2'8'#5'Width'#2'^'#25'BorderSpacing.InnerBorder'#2#4#7'C'
|
||||
+'aption'#6#10'Paint Test'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#2#0#0
|
||||
+#10'TPopupMenu'#9'PopupMenu'#4'left'#3#180#0#3'top'#3#4#1#0#9'TMenuItem'#9'M'
|
||||
+'enuItem1'#7'Caption'#6#9'New Item1'#0#0#9'TMenuItem'#9'MenuItem3'#7'Caption'
|
||||
+#6#9'New Item3'#0#0#9'TMenuItem'#9'MenuItem2'#7'Caption'#6#9'New Item2'#0#0#0
|
||||
+#9'TTrayIcon'#11'SystrayIcon'#4'left'#3#221#0#3'top'#3#145#0#0#0#0
|
||||
+'aption'#6#10'Paint Test'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#2#0#0#7
|
||||
+'TButton'#7'Button4'#4'Left'#2'8'#6'Height'#2' '#3'Top'#3#168#0#5'Width'#2'^'
|
||||
+#7'Caption'#6#15'Display Message'#8'TabOrder'#2#3#0#0#10'TPopupMenu'#9'Popup'
|
||||
+'Menu'#4'left'#3#180#0#3'top'#3#4#1#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6
|
||||
+#9'New Item1'#0#0#9'TMenuItem'#9'MenuItem3'#7'Caption'#6#9'New Item3'#0#0#9
|
||||
+'TMenuItem'#9'MenuItem2'#7'Caption'#6#9'New Item2'#0#0#0#9'TTrayIcon'#11'Sys'
|
||||
+'trayIcon'#4'left'#3#221#0#3'top'#3#145#0#0#0#0
|
||||
]);
|
||||
|
@ -38,6 +38,7 @@ type
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
Button4: TButton;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<Version Value="6"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveClosedFiles Value="False"/>
|
||||
|
@ -2,13 +2,13 @@
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<Version Value="6"/>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="wndtray.dpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wndtray"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="23"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="frmtest.pas"/>
|
||||
@ -17,17 +17,17 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="frmtest.lrs"/>
|
||||
<UnitName Value="frmtest"/>
|
||||
<CursorPos X="1" Y="138"/>
|
||||
<TopLine Value="128"/>
|
||||
<CursorPos X="7" Y="51"/>
|
||||
<TopLine Value="60"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="wscommontrayicon.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wscommontrayicon"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="23"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<General>
|
||||
|
@ -1073,8 +1073,14 @@ type
|
||||
|
||||
{ TCustomTrayIcon }
|
||||
|
||||
TBallonFlags = (bfNone, bfInfo, bfWarning, bfError);
|
||||
|
||||
TCustomTrayIcon = class(TLCLComponent)
|
||||
private
|
||||
FBalloonFlags: TBallonFlags;
|
||||
FBalloonHint: string;
|
||||
FBalloonTimeout: Integer;
|
||||
FBalloonTitle: string;
|
||||
FPopUpMenu: TPopupMenu;
|
||||
FIcon: TIcon;
|
||||
FHint: string;
|
||||
@ -1091,13 +1097,20 @@ type
|
||||
function Hide: Boolean;
|
||||
function Show: Boolean;
|
||||
procedure InternalUpdate;
|
||||
procedure ShowBalloonHint;
|
||||
function GetPosition: TPoint;
|
||||
{ Properties }
|
||||
property BalloonFlags: TBallonFlags read FBalloonFlags write FBalloonFlags;
|
||||
property BalloonHint: string read FBalloonHint write FBalloonHint;
|
||||
property BalloonTimeout: Integer read FBalloonTimeout write FBalloonTimeout default 3000;
|
||||
property BalloonTitle: string read FBalloonTitle write FBalloonTitle;
|
||||
property Canvas: TCanvas read GetCanvas;
|
||||
property PopUpMenu: TPopupMenu read FPopUpMenu write FPopUpMenu;
|
||||
property Icon: TIcon read FIcon write FIcon;
|
||||
property Hint: string read FHint write FHint;
|
||||
property ShowIcon: Boolean read FShowIcon write FShowIcon;
|
||||
property Visible: Boolean read FVisible write SetVisible;
|
||||
{ Events }
|
||||
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
||||
property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;
|
||||
property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
|
||||
@ -1110,6 +1123,10 @@ type
|
||||
|
||||
TTrayIcon = class(TCustomTrayIcon)
|
||||
published
|
||||
property BalloonFlags;
|
||||
property BalloonHint;
|
||||
property BalloonTimeout;
|
||||
property BalloonTitle;
|
||||
property PopUpMenu;
|
||||
property Icon;
|
||||
property Hint;
|
||||
|
@ -137,6 +137,21 @@ begin
|
||||
TWSCustomTrayIconClass(WidgetSetClass).InternalUpdate(Self);
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCustomTrayIcon.ShowBalloonHint ()
|
||||
*
|
||||
* DESCRIPTION: Shows a small message balloon near the tray icon
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
procedure TCustomTrayIcon.ShowBalloonHint;
|
||||
begin
|
||||
TWSCustomTrayIconClass(WidgetSetClass).ShowBalloonHint(Self);
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCustomTrayIcon.GetPosition ()
|
||||
*
|
||||
|
@ -199,16 +199,23 @@ end;
|
||||
* DESCRIPTION: Makes modifications to the Icon while running
|
||||
* i.e. without hiding it and showing again
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
class procedure TWin32WSCustomTrayIcon.InternalUpdate(const ATrayIcon: TCustomTrayIcon);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TWin32WSCustomTrayIcon.ShowBalloonHint ()
|
||||
*
|
||||
* DESCRIPTION: Shows a small message balloon near the tray icon
|
||||
*
|
||||
*******************************************************************}
|
||||
class procedure TWin32WSCustomTrayIcon.ShowBalloonHint(const ATrayIcon: TCustomTrayIcon);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TWin32WSCustomTrayIcon.GetPosition ()
|
||||
*
|
||||
@ -216,10 +223,6 @@ end;
|
||||
* This function is utilized to show message boxes near
|
||||
* the icon
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURNS: Nothing
|
||||
*
|
||||
*******************************************************************}
|
||||
class function TWin32WSCustomTrayIcon.GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint;
|
||||
begin
|
||||
|
@ -225,6 +225,7 @@ type
|
||||
class function Hide(const ATrayIcon: TCustomTrayIcon): Boolean; override;
|
||||
class function Show(const ATrayIcon: TCustomTrayIcon): Boolean; override;
|
||||
class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); override;
|
||||
class procedure ShowBalloonHint(const ATrayIcon: TCustomTrayIcon); override;
|
||||
class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; override;
|
||||
end;
|
||||
|
||||
|
@ -170,6 +170,7 @@ type
|
||||
class function Hide(const ATrayIcon: TCustomTrayIcon): Boolean; virtual;
|
||||
class function Show(const ATrayIcon: TCustomTrayIcon): Boolean; virtual;
|
||||
class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); virtual;
|
||||
class procedure ShowBalloonHint(const ATrayIcon: TCustomTrayIcon); virtual;
|
||||
class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; virtual;
|
||||
class function GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas; virtual;
|
||||
end;
|
||||
@ -298,57 +299,32 @@ end;
|
||||
|
||||
{ TWSCustomTrayIcon }
|
||||
|
||||
{*******************************************************************
|
||||
* TWSCustomTrayIcon.Hide ()
|
||||
*
|
||||
* DESCRIPTION: Hides the Icon
|
||||
*
|
||||
* RETURNS: If successfull
|
||||
*
|
||||
*******************************************************************}
|
||||
class function TWSCustomTrayIcon.Hide(const ATrayIcon: TCustomTrayIcon): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TWSCustomTrayIcon.Show ()
|
||||
*
|
||||
* DESCRIPTION: Shows the Icon
|
||||
*
|
||||
* RETURNS: If successfull
|
||||
*
|
||||
*******************************************************************}
|
||||
class function TWSCustomTrayIcon.Show(const ATrayIcon: TCustomTrayIcon): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TWSCustomTrayIcon.InternalUpdate ()
|
||||
*
|
||||
* DESCRIPTION: Makes modifications to the Icon while running
|
||||
* i.e. without hiding it and showing again
|
||||
*******************************************************************}
|
||||
class procedure TWSCustomTrayIcon.InternalUpdate(const ATrayIcon: TCustomTrayIcon);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TWSCustomTrayIcon.GetPosition ()
|
||||
*
|
||||
* DESCRIPTION: Returns the position of the tray icon on the display.
|
||||
* This function is utilized to show message boxes near
|
||||
* the icon
|
||||
*******************************************************************}
|
||||
class procedure TWSCustomTrayIcon.ShowBalloonHint(const ATrayIcon: TCustomTrayIcon);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
class function TWSCustomTrayIcon.GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint;
|
||||
begin
|
||||
Result := Point(0, 0);
|
||||
end;
|
||||
|
||||
class function TWSCustomTrayIcon.GetCanvas(const ATrayIcon: TCustomTrayIcon
|
||||
): TCanvas;
|
||||
class function TWSCustomTrayIcon.GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas;
|
||||
begin
|
||||
Result := ATrayIcon.Icon.Canvas;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user