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