mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 13:20:18 +02:00
fixed line endings
git-svn-id: trunk@30088 -
This commit is contained in:
parent
6b7a173ac3
commit
cbc70260b8
@ -1,86 +1,86 @@
|
||||
object frmTrayTest: TfrmTrayTest
|
||||
Left = 183
|
||||
Height = 238
|
||||
Top = 176
|
||||
Width = 311
|
||||
ActiveControl = btnShow
|
||||
Caption = 'TTrayIcon test application'
|
||||
ClientHeight = 238
|
||||
ClientWidth = 311
|
||||
OnCreate = FormCreate
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.25'
|
||||
object btnShow: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 32
|
||||
Width = 136
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Show'
|
||||
OnClick = btnShowClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnHide: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 88
|
||||
Width = 136
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Hide'
|
||||
OnClick = btnHideClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnDisplayMessage: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 144
|
||||
Width = 136
|
||||
Caption = 'Display Message'
|
||||
OnClick = HandleClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object chkOnPaintDrawing: TCheckBox
|
||||
Left = 32
|
||||
Height = 21
|
||||
Top = 200
|
||||
Width = 267
|
||||
Caption = 'Test drawing the icon in the Form''s OnPaint event'
|
||||
OnChange = chkOnPaintDrawingChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object PopupMenu: TPopupMenu
|
||||
left = 192
|
||||
top = 96
|
||||
object MenuItem1: TMenuItem
|
||||
Caption = 'New Item1'
|
||||
end
|
||||
object MenuItem3: TMenuItem
|
||||
Caption = 'New Item3'
|
||||
end
|
||||
object MenuItem2: TMenuItem
|
||||
Caption = 'New Item2'
|
||||
end
|
||||
end
|
||||
object SystrayIcon: TTrayIcon
|
||||
Icon.Data = {
|
||||
DE0100000000010001001616100001000400C801000016000000280000001600
|
||||
00002C0000000100040000000000000000000000000000000000000000000000
|
||||
000000000000FF2FA00000C6D200000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000002222222221111111111100002222222221111111111100002222222221
|
||||
1111111111000022222222211111111111000022222222211111111111000002
|
||||
2222221111111111110000002222211111111111110000022222111111111111
|
||||
1100000222221111111111111100000222211111111111111100000222211111
|
||||
1111111111000000022111111111111111000000022111111111111111000000
|
||||
0221111111111111110000000221111111111111110000000222221111111122
|
||||
2200000022222222222222222200000002222222222222222200000002222222
|
||||
2222222222000000022222222222222222000000002222222222222222000000
|
||||
0022222222222222220000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000
|
||||
}
|
||||
left = 237
|
||||
top = 96
|
||||
end
|
||||
end
|
||||
object frmTrayTest: TfrmTrayTest
|
||||
Left = 183
|
||||
Height = 238
|
||||
Top = 176
|
||||
Width = 311
|
||||
ActiveControl = btnShow
|
||||
Caption = 'TTrayIcon test application'
|
||||
ClientHeight = 238
|
||||
ClientWidth = 311
|
||||
OnCreate = FormCreate
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.25'
|
||||
object btnShow: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 32
|
||||
Width = 136
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Show'
|
||||
OnClick = btnShowClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnHide: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 88
|
||||
Width = 136
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Hide'
|
||||
OnClick = btnHideClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnDisplayMessage: TButton
|
||||
Left = 32
|
||||
Height = 33
|
||||
Top = 144
|
||||
Width = 136
|
||||
Caption = 'Display Message'
|
||||
OnClick = HandleClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object chkOnPaintDrawing: TCheckBox
|
||||
Left = 32
|
||||
Height = 21
|
||||
Top = 200
|
||||
Width = 267
|
||||
Caption = 'Test drawing the icon in the Form''s OnPaint event'
|
||||
OnChange = chkOnPaintDrawingChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object PopupMenu: TPopupMenu
|
||||
left = 192
|
||||
top = 96
|
||||
object MenuItem1: TMenuItem
|
||||
Caption = 'New Item1'
|
||||
end
|
||||
object MenuItem3: TMenuItem
|
||||
Caption = 'New Item3'
|
||||
end
|
||||
object MenuItem2: TMenuItem
|
||||
Caption = 'New Item2'
|
||||
end
|
||||
end
|
||||
object SystrayIcon: TTrayIcon
|
||||
Icon.Data = {
|
||||
DE0100000000010001001616100001000400C801000016000000280000001600
|
||||
00002C0000000100040000000000000000000000000000000000000000000000
|
||||
000000000000FF2FA00000C6D200000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000002222222221111111111100002222222221111111111100002222222221
|
||||
1111111111000022222222211111111111000022222222211111111111000002
|
||||
2222221111111111110000002222211111111111110000022222111111111111
|
||||
1100000222221111111111111100000222211111111111111100000222211111
|
||||
1111111111000000022111111111111111000000022111111111111111000000
|
||||
0221111111111111110000000221111111111111110000000222221111111122
|
||||
2200000022222222222222222200000002222222222222222200000002222222
|
||||
2222222222000000022222222222222222000000002222222222222222000000
|
||||
0022222222222222220000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000
|
||||
}
|
||||
left = 237
|
||||
top = 96
|
||||
end
|
||||
end
|
||||
|
@ -1,165 +1,165 @@
|
||||
{
|
||||
frmtest.dpr
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This demonstration program is public domain, which means no copyright, *
|
||||
* but also no warranty! *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Felipe Monteiro de Carvalho
|
||||
}
|
||||
unit frmtest;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{$ifdef fpc}
|
||||
LResources,
|
||||
{$endif}
|
||||
Forms, Controls, Graphics, Dialogs, Buttons, StdCtrls, Menus,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
TfrmTrayTest = class(TForm)
|
||||
btnShow: TButton;
|
||||
btnHide: TButton;
|
||||
btnDisplayMessage: TButton;
|
||||
chkOnPaintDrawing: TCheckBox;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
PopupMenu: TPopupMenu;
|
||||
SystrayIcon: TTrayIcon;
|
||||
procedure btnShowClick(Sender: TObject);
|
||||
procedure btnHideClick(Sender: TObject);
|
||||
procedure chkOnPaintDrawingChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
procedure HandleClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
pathMedia: string;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmTrayTest: TfrmTrayTest;
|
||||
|
||||
{$ifndef fpc}
|
||||
{$R frmtest.dfm}
|
||||
{$endif}
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef Windows}
|
||||
uses Windows;
|
||||
{$endif}
|
||||
{$IFDEF Darwin}
|
||||
uses
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll;
|
||||
{$else}
|
||||
MacOSAll;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
procedure TfrmTrayTest.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := True;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnHideClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := False;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.chkOnPaintDrawingChange(Sender: TObject);
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormCreate(Sender: TObject);
|
||||
const
|
||||
IDI_ICON1 = 101;
|
||||
IDI_ICON2 = 115;
|
||||
BundleResourceFolder = '/Contents/Resources/';
|
||||
{$IFDEF Darwin}
|
||||
var
|
||||
pathRef: CFURLRef;
|
||||
pathCFStr: CFStringRef;
|
||||
pathStr: shortstring;
|
||||
{$ENDIF}
|
||||
begin
|
||||
pathMedia := '';
|
||||
|
||||
// Under Mac OS X we need to get the location of the bundle
|
||||
{$IFDEF Darwin}
|
||||
pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
|
||||
CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
|
||||
CFRelease(pathRef);
|
||||
CFRelease(pathCFStr);
|
||||
|
||||
pathMedia := pathStr + BundleResourceFolder;
|
||||
{$ENDIF}
|
||||
|
||||
// Under Windows we get the path of the executable
|
||||
{$IFDEF Windows}
|
||||
pathMedia := ExtractFilePath(Application.ExeName);
|
||||
{$ENDIF}
|
||||
|
||||
IncludeTrailingBackslash(pathMedia);
|
||||
|
||||
SystrayIcon.Hint := 'my tool tip';
|
||||
|
||||
SystrayIcon.OnClick := HandleClick;
|
||||
|
||||
SystrayIcon.PopUpMenu := PopupMenu;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormPaint(Sender: TObject);
|
||||
var
|
||||
BaseImage: TIcon;
|
||||
begin
|
||||
if chkOnPaintDrawing.Checked then
|
||||
begin
|
||||
BaseImage := TIcon.Create;
|
||||
try
|
||||
// Loads the icon
|
||||
BaseImage.LoadFromFile(pathMedia + 'icon.ico');
|
||||
Canvas.Draw(0, 0, BaseImage);
|
||||
finally
|
||||
BaseImage.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.HandleClick(Sender: TObject);
|
||||
begin
|
||||
Application.MessageBox('Text', 'Caption', 0);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$ifdef fpc}
|
||||
{$I frmtest.lrs}
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
frmtest.dpr
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This demonstration program is public domain, which means no copyright, *
|
||||
* but also no warranty! *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Felipe Monteiro de Carvalho
|
||||
}
|
||||
unit frmtest;
|
||||
|
||||
{$ifdef fpc}
|
||||
{$mode delphi}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
{$ifdef fpc}
|
||||
LResources,
|
||||
{$endif}
|
||||
Forms, Controls, Graphics, Dialogs, Buttons, StdCtrls, Menus,
|
||||
ExtCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
TfrmTrayTest = class(TForm)
|
||||
btnShow: TButton;
|
||||
btnHide: TButton;
|
||||
btnDisplayMessage: TButton;
|
||||
chkOnPaintDrawing: TCheckBox;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
PopupMenu: TPopupMenu;
|
||||
SystrayIcon: TTrayIcon;
|
||||
procedure btnShowClick(Sender: TObject);
|
||||
procedure btnHideClick(Sender: TObject);
|
||||
procedure chkOnPaintDrawingChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
procedure HandleClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
pathMedia: string;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmTrayTest: TfrmTrayTest;
|
||||
|
||||
{$ifndef fpc}
|
||||
{$R frmtest.dfm}
|
||||
{$endif}
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef Windows}
|
||||
uses Windows;
|
||||
{$endif}
|
||||
{$IFDEF Darwin}
|
||||
uses
|
||||
{$ifdef ver2_2_0}
|
||||
FPCMacOSAll;
|
||||
{$else}
|
||||
MacOSAll;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
|
||||
{ TfrmTrayTest }
|
||||
|
||||
procedure TfrmTrayTest.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := True;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.btnHideClick(Sender: TObject);
|
||||
begin
|
||||
SystrayIcon.Visible := False;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.chkOnPaintDrawingChange(Sender: TObject);
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormCreate(Sender: TObject);
|
||||
const
|
||||
IDI_ICON1 = 101;
|
||||
IDI_ICON2 = 115;
|
||||
BundleResourceFolder = '/Contents/Resources/';
|
||||
{$IFDEF Darwin}
|
||||
var
|
||||
pathRef: CFURLRef;
|
||||
pathCFStr: CFStringRef;
|
||||
pathStr: shortstring;
|
||||
{$ENDIF}
|
||||
begin
|
||||
pathMedia := '';
|
||||
|
||||
// Under Mac OS X we need to get the location of the bundle
|
||||
{$IFDEF Darwin}
|
||||
pathRef := CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
pathCFStr := CFURLCopyFileSystemPath(pathRef, kCFURLPOSIXPathStyle);
|
||||
CFStringGetPascalString(pathCFStr, @pathStr, 255, CFStringGetSystemEncoding());
|
||||
CFRelease(pathRef);
|
||||
CFRelease(pathCFStr);
|
||||
|
||||
pathMedia := pathStr + BundleResourceFolder;
|
||||
{$ENDIF}
|
||||
|
||||
// Under Windows we get the path of the executable
|
||||
{$IFDEF Windows}
|
||||
pathMedia := ExtractFilePath(Application.ExeName);
|
||||
{$ENDIF}
|
||||
|
||||
IncludeTrailingBackslash(pathMedia);
|
||||
|
||||
SystrayIcon.Hint := 'my tool tip';
|
||||
|
||||
SystrayIcon.OnClick := HandleClick;
|
||||
|
||||
SystrayIcon.PopUpMenu := PopupMenu;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.FormPaint(Sender: TObject);
|
||||
var
|
||||
BaseImage: TIcon;
|
||||
begin
|
||||
if chkOnPaintDrawing.Checked then
|
||||
begin
|
||||
BaseImage := TIcon.Create;
|
||||
try
|
||||
// Loads the icon
|
||||
BaseImage.LoadFromFile(pathMedia + 'icon.ico');
|
||||
Canvas.Draw(0, 0, BaseImage);
|
||||
finally
|
||||
BaseImage.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmTrayTest.HandleClick(Sender: TObject);
|
||||
begin
|
||||
Application.MessageBox('Text', 'Caption', 0);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$ifdef fpc}
|
||||
{$I frmtest.lrs}
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user