|
From: Peter T. <pe...@us...> - 2003-08-23 23:20:33
|
Update of /cvsroot/jvcl/dev/JVCL3/examples/JvTrayIcon
In directory sc8-pr-cvs1:/tmp/cvs-serv5637/JVCL3/examples/JvTrayIcon
Added Files:
JvTrayIconDemo.dof JvTrayIconDemo.dpr JvTrayIconDemo.res
MainFrm.dfm MainFrm.pas
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: JvTrayIconDemo.dof ---
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Dcu
SearchPath=..\..\Source;..\..\Common
--- NEW FILE: JvTrayIconDemo.dpr ---
program JvTrayIconDemo;
uses
Forms,
MainFrm in 'MainFrm.pas' {frmMain};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
--- NEW FILE: JvTrayIconDemo.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: MainFrm.dfm ---
object frmMain: TfrmMain
Left = 548
Top = 124
Width = 410
Height = 454
BorderIcons = [biSystemMenu, biMinimize]
Caption = 'JvTrayIcon Demo'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
OldCreateOrder = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object GroupBox1: TGroupBox
Left = 8
Top = 8
Width = 385
Height = 361
Anchors = [akLeft, akTop, akRight]
Caption = ' Tray Icon Options '
TabOrder = 0
object Label1: TLabel
Left = 16
Top = 56
Width = 23
Height = 13
Caption = 'Hint:'
end
object chkActive: TCheckBox
Left = 16
Top = 32
Width = 170
Height = 17
Caption = 'Active'
TabOrder = 0
OnClick = chkActiveClick
end
object edHint: TEdit
Left = 16
Top = 72
Width = 353
Height = 21
TabOrder = 1
Text = 'JvTrayIcon Demo'
end
object chkSnap: TCheckBox
Left = 16
Top = 112
Width = 170
Height = 17
Caption = 'Snap'
TabOrder = 2
end
object chkTaskBar: TCheckBox
Left = 16
Top = 136
Width = 170
Height = 17
Caption = 'Show in taskbar'
Checked = True
State = cbChecked
TabOrder = 3
end
object chkTaskList: TCheckBox
Left = 16
Top = 160
Width = 170
Height = 17
Caption = 'Show in task list'
Checked = True
State = cbChecked
TabOrder = 4
end
object chkAutoHide: TCheckBox
Left = 16
Top = 184
Width = 170
Height = 17
Caption = 'Auto hide'
Checked = True
State = cbChecked
TabOrder = 5
end
object chkRestoreClick: TCheckBox
Left = 16
Top = 208
Width = 170
Height = 17
Caption = 'Restore on click'
TabOrder = 6
OnClick = chkRestoreClickClick
end
object chkRestoreDblClick: TCheckBox
Left = 16
Top = 232
Width = 170
Height = 17
Caption = 'Restore on double-click'
TabOrder = 7
OnClick = chkRestoreDblClickClick
end
object chkMinClick: TCheckBox
Left = 16
Top = 256
Width = 170
Height = 17
Caption = 'Minimize on click'
TabOrder = 8
OnClick = chkMinClickClick
end
object chkMinDblClick: TCheckBox
Left = 16
Top = 280
Width = 170
Height = 17
Caption = 'Minimize on double-click'
TabOrder = 9
OnClick = chkMinDblClickClick
end
object chkPopUp: TCheckBox
Left = 16
Top = 304
Width = 170
Height = 17
Caption = 'Menu on right click'
Checked = True
State = cbChecked
TabOrder = 10
end
object btnUpdate: TButton
Left = 288
Top = 320
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = '&Update'
TabOrder = 12
OnClick = btnUpdateClick
end
object chkDropDown: TCheckBox
Left = 16
Top = 328
Width = 170
Height = 17
Caption = 'Menu on left click'
TabOrder = 11
end
object GroupBox2: TGroupBox
Left = 152
Top = 112
Width = 217
Height = 193
Caption = ' Balloon Hint: '
TabOrder = 13
object Label2: TLabel
Left = 8
Top = 24
Width = 24
Height = 13
Caption = 'Title:'
end
object Label3: TLabel
Left = 8
Top = 64
Width = 26
Height = 13
Caption = 'Text:'
end
object Label4: TLabel
Left = 8
Top = 112
Width = 25
Height = 13
Caption = 'Icon:'
end
object edBalloonTitle: TEdit
Left = 8
Top = 40
Width = 201
Height = 21
TabOrder = 0
Text = 'Sample Title'
end
object edBalloonText: TEdit
Left = 8
Top = 80
Width = 201
Height = 21
TabOrder = 1
Text = 'Sample Text'
end
object btnBalloon: TButton
Left = 128
Top = 160
Width = 75
Height = 25
Caption = 'Sho&w'
Enabled = False
TabOrder = 2
OnClick = btnBalloonClick
end
object cbBalloonType: TComboBox
Left = 8
Top = 128
Width = 201
Height = 21
Style = csDropDownList
ItemHeight = 13
TabOrder = 3
Items.Strings = (
'(none)'
'Error'
'Info'
'Warning')
end
end
end
object chkAutoRestore: TCheckBox
Left = 18
Top = 390
Width = 283
Height = 17
Caption = 'Do NOT restore automatically after 15 seconds'
TabOrder = 1
OnClick = chkAutoRestoreClick
end
object JvTrayIcon1: TJvTrayIcon
Icon.Data = {
0000010001002020040000000000E80200001600000028000000200000004000
0000010004000000000000020000000000000000000000000000000000000000
0000000080000080000000808000800000008000800080800000C0C0C0008080
80000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
000000000000000000000000000000000007FFFFFFFFFF778800000000000000
8FFF77777777777777880000000000008FFFFF77777777777788000000000000
088777F77777777778800000000000000008888F777777888800000000000000
0000008F77777800000000000000000000000000000000000000000000000888
888888888888888888888880000008F7777777777777777777777788000008F7
FFFFFFFFFFFFFFFFFFFFF788800008F744444444444444444444F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F70CCCCCCCCCCCCCCCCCC4F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F70CCCCCCCCCCCCCCCCCC4F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F70CCCCCCCCCCCCCCCCCC4F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F70CCCCCCCCCCCCCCCCCC4F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F70CCECCCCCCCCCCCCCCC4F788800008F7
0CCECCCCCCCCCCCCCCC4F788800008F70CCECCCCCCCCCCCCCCC4F788800008F7
0CCCCCCCCCCCCCCCCCC4F788800008F700000000000000000004F788800008F7
88888888888888888888F788800008F77777777777777777777777888000008F
FFFFFFFFFFFFFFFFFFFFFF88800000087777777777777777777777F880000000
87777777777777777777777F800000000888888888888888888888888000FE00
03FFF80000FFF000007FF000007FF80000FFFE0003FFFFC01FFFC000001F8000
000F800000078000000380000003800000038000000380000003800000038000
0003800000038000000380000003800000038000000380000003800000038000
0003800000038000000380000003C0000003E0000003F0000003F8000007}
IconIndex = -1
PopupMenu = popTrayIcon
Left = 264
Top = 32
end
object popTrayIcon: TPopupMenu
Left = 320
Top = 32
object mnuShowHide: TMenuItem
Caption = 'Show / Hide'
OnClick = mnuShowHideClick
end
end
object RestoreTimer: TTimer
Interval = 15000
OnTimer = RestoreTimerTimer
Left = 174
Top = 156
end
end
--- NEW FILE: MainFrm.pas ---
unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, JvComponent, JvTrayIcon, ExtCtrls;
type
TfrmMain = class(TForm)
JvTrayIcon1: TJvTrayIcon;
GroupBox1: TGroupBox;
chkActive: TCheckBox;
Label1: TLabel;
edHint: TEdit;
chkSnap: TCheckBox;
chkTaskBar: TCheckBox;
chkTaskList: TCheckBox;
chkAutoHide: TCheckBox;
chkRestoreClick: TCheckBox;
chkRestoreDblClick: TCheckBox;
chkMinClick: TCheckBox;
chkMinDblClick: TCheckBox;
popTrayIcon: TPopupMenu;
mnuShowHide: TMenuItem;
chkPopUp: TCheckBox;
btnUpdate: TButton;
chkDropDown: TCheckBox;
chkAutoRestore: TCheckBox;
RestoreTimer: TTimer;
GroupBox2: TGroupBox;
Label2: TLabel;
edBalloonTitle: TEdit;
Label3: TLabel;
edBalloonText: TEdit;
btnBalloon: TButton;
Label4: TLabel;
cbBalloonType: TComboBox;
procedure btnUpdateClick(Sender: TObject);
procedure mnuShowHideClick(Sender: TObject);
procedure chkRestoreClickClick(Sender: TObject);
procedure chkRestoreDblClickClick(Sender: TObject);
procedure chkMinClickClick(Sender: TObject);
procedure chkMinDblClickClick(Sender: TObject);
procedure RestoreTimerTimer(Sender: TObject);
procedure chkAutoRestoreClick(Sender: TObject);
procedure btnBalloonClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure chkActiveClick(Sender: TObject);
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.btnUpdateClick(Sender: TObject);
var Options:TTrayVisibilities;
begin
with JvTrayIcon1 do
begin
Active := false;
Hint := edHint.Text;
// Snap := chkSnap.Checked;
if chkPopUp.Checked then
PopUpMenu := popTrayIcon
else
PopUpMenu := nil;
if chkDropDown.Checked then
DropDownMenu := popTrayIcon
else
DropDownMenu := nil;
Options := [];
if chkTaskBar.Checked then
Include(Options,tvVisibleTaskBar);
if chkTaskList.Checked then
Include(Options,tvVisibleTaskList);
if chkAutohide.Checked then
Include(Options,tvAutoHide);
if chkRestoreClick.Checked and chkRestoreClick.Enabled then
Include(Options,tvRestoreClick);
if chkRestoreDblClick.Checked and chkRestoreDblClick.Enabled then
Include(Options,tvRestoreDbClick);
// if chkMinClick.Checked and chkMinClick.Enabled then
// Include(Options,tvMinimizeClick);
// if chkMinDblClick.Checked and chkMinDblClick.Enabled then
// Include(Options,tvMinimizeDbClick);
Visibility := Options;
Active := chkActive.Checked;
btnBalloon.Enabled := Active;
end;
end;
procedure TfrmMain.mnuShowHideClick(Sender: TObject);
begin
if IsWindowVisible(Handle) then
JvTrayIcon1.HideApplication
else
JvTrayIcon1.ShowApplication;
end;
procedure TfrmMain.chkRestoreClickClick(Sender: TObject);
begin
chkRestoreDblClick.Enabled := not chkRestoreClick.Checked;
end;
procedure TfrmMain.chkRestoreDblClickClick(Sender: TObject);
begin
chkRestoreClick.Enabled := not chkRestoreDblClick.Checked;
end;
procedure TfrmMain.chkMinClickClick(Sender: TObject);
begin
chkMinDblClick.Enabled := not chkMinClick.Checked;
end;
procedure TfrmMain.chkMinDblClickClick(Sender: TObject);
begin
chkMinClick.Enabled := not chkMinDblClick.Checked;
end;
procedure TfrmMain.RestoreTimerTimer(Sender: TObject);
begin
if not IsWindowVisible(Handle) then
JvTrayIcon1.ShowApplication;
end;
procedure TfrmMain.chkAutoRestoreClick(Sender: TObject);
begin
RestoreTimer.Enabled := not chkAutoRestore.Checked;
end;
procedure TfrmMain.btnBalloonClick(Sender: TObject);
begin
JvTrayIcon1.BalloonHint(edBalloonTitle.Text,edBalloonText.Text,TBalloonType(cbBalloontype.ItemIndex),5000,true);
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
cbBalloonType.ItemIndex := 0;
end;
procedure TfrmMain.chkActiveClick(Sender: TObject);
begin
btnBalloon.Enabled := JvTrayIcon1.Active;
end;
end.
|