You've already forked lazarus-ccr
RxFPC:RxPopupNotifier - new style for close button and timer label
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6411 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -123,13 +123,72 @@ object Form1: TForm1
|
|||||||
OnClick = Button1Click
|
OnClick = Button1Click
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
|
object TrackBar1: TTrackBar
|
||||||
|
Left = 35
|
||||||
|
Height = 52
|
||||||
|
Top = 265
|
||||||
|
Width = 485
|
||||||
|
Max = 250
|
||||||
|
Position = 250
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
object CheckBox1: TCheckBox
|
||||||
|
Left = 415
|
||||||
|
Height = 24
|
||||||
|
Top = 53
|
||||||
|
Width = 137
|
||||||
|
Caption = 'Show close timer'
|
||||||
|
Checked = True
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
|
object SpeedButton1: TSpeedButton
|
||||||
|
Left = 422
|
||||||
|
Height = 26
|
||||||
|
Top = 7
|
||||||
|
Width = 26
|
||||||
|
Glyph.Data = {
|
||||||
|
1A020000424D1A0200000000000036000000280000000B0000000B0000000100
|
||||||
|
200000000000E401000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000FF0000
|
||||||
|
00FF00000000000000000000000000000000000000FF000000FF000000000000
|
||||||
|
00000000000000000000000000FF000000FF0000000000000000000000FF0000
|
||||||
|
00FF000000000000000000000000000000000000000000000000000000FF0000
|
||||||
|
00FF000000FF000000FF00000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000FF000000FF0000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000FF000000FF000000FF0000
|
||||||
|
00FF000000000000000000000000000000000000000000000000000000FF0000
|
||||||
|
00FF0000000000000000000000FF000000FF0000000000000000000000000000
|
||||||
|
0000000000FF000000FF00000000000000000000000000000000000000FF0000
|
||||||
|
00FF000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
|
end
|
||||||
|
object BitBtn1: TBitBtn
|
||||||
|
Left = 150
|
||||||
|
Height = 36
|
||||||
|
Top = 325
|
||||||
|
Width = 60
|
||||||
|
AutoSize = True
|
||||||
|
Default = True
|
||||||
|
DefaultCaption = True
|
||||||
|
Kind = bkOK
|
||||||
|
ModalResult = 1
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
object RxPopupNotifier1: TRxPopupNotifier
|
object RxPopupNotifier1: TRxPopupNotifier
|
||||||
Items = <
|
Items = <
|
||||||
item
|
item
|
||||||
Active = False
|
Active = False
|
||||||
Color = clAqua
|
Color = clAqua
|
||||||
|
AutoClose = False
|
||||||
Caption = 'Design message'
|
Caption = 'Design message'
|
||||||
Message = 'Design time message'
|
Message = 'Design time message'
|
||||||
|
CloseButton.Hint = 'Close message'
|
||||||
|
CloseButton.Flat = True
|
||||||
end>
|
end>
|
||||||
OnNotifiClick = RxPopupNotifier1NotifiClick
|
OnNotifiClick = RxPopupNotifier1NotifiClick
|
||||||
Left = 176
|
Left = 176
|
||||||
|
@ -6,21 +6,25 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
PopupNotifier, ExtCtrls, ColorBox, MRUList, rxPopupNotifier, rxtooledit, DB;
|
ExtCtrls, ColorBox, ComCtrls, Buttons, rxPopupNotifier;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
|
BitBtn1: TBitBtn;
|
||||||
Button1: TButton;
|
Button1: TButton;
|
||||||
Button4: TButton;
|
Button4: TButton;
|
||||||
Button5: TButton;
|
Button5: TButton;
|
||||||
Button6: TButton;
|
Button6: TButton;
|
||||||
|
CheckBox1: TCheckBox;
|
||||||
ColorBox1: TColorBox;
|
ColorBox1: TColorBox;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
RadioGroup1: TRadioGroup;
|
RadioGroup1: TRadioGroup;
|
||||||
RxPopupNotifier1: TRxPopupNotifier;
|
RxPopupNotifier1: TRxPopupNotifier;
|
||||||
|
SpeedButton1: TSpeedButton;
|
||||||
|
TrackBar1: TTrackBar;
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
procedure Button4Click(Sender: TObject);
|
procedure Button4Click(Sender: TObject);
|
||||||
procedure Button5Click(Sender: TObject);
|
procedure Button5Click(Sender: TObject);
|
||||||
@ -71,7 +75,14 @@ var
|
|||||||
begin
|
begin
|
||||||
Inc(FCurID);
|
Inc(FCurID);
|
||||||
R1:=RxPopupNotifier1.AddNotifyItem('Warning', 'Error message № ' + IntToStr(FCurID));
|
R1:=RxPopupNotifier1.AddNotifyItem('Warning', 'Error message № ' + IntToStr(FCurID));
|
||||||
R1.ShowCloseTimer:=true;
|
|
||||||
|
if TrackBar1.Position < 255 then
|
||||||
|
begin
|
||||||
|
R1.AlphaBlend:=true;
|
||||||
|
R1.AlphaBlendValue:=TrackBar1.Position;
|
||||||
|
end;
|
||||||
|
|
||||||
|
R1.ShowCloseTimer:=CheckBox1.Checked;
|
||||||
R1.Color:=ColorBox1.Selected;
|
R1.Color:=ColorBox1.Selected;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -89,6 +100,7 @@ end;
|
|||||||
procedure TForm1.RadioGroup1Click(Sender: TObject);
|
procedure TForm1.RadioGroup1Click(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
RxPopupNotifier1.MessageCorner:=TRxPopupNotifierCorner(RadioGroup1.ItemIndex);
|
RxPopupNotifier1.MessageCorner:=TRxPopupNotifierCorner(RadioGroup1.ItemIndex);
|
||||||
|
// Hint:=;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.RxPopupNotifier1NotifiClick(Sender: TRxPopupNotifier;
|
procedure TForm1.RxPopupNotifier1NotifiClick(Sender: TRxPopupNotifier;
|
||||||
|
@ -55,6 +55,10 @@ msgstr ""
|
|||||||
msgid "Close all windows"
|
msgid "Close all windows"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sclosemessagehint
|
||||||
|
msgid "Close message"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sclosevaliderror
|
#: rxconst.sclosevaliderror
|
||||||
msgid "Error. Expected values..."
|
msgid "Error. Expected values..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -53,6 +53,10 @@ msgstr ""
|
|||||||
msgid "Close all windows"
|
msgid "Close all windows"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sclosemessagehint
|
||||||
|
msgid "Close message"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sclosevaliderror
|
#: rxconst.sclosevaliderror
|
||||||
msgid "Error. Expected values..."
|
msgid "Error. Expected values..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -53,6 +53,10 @@ msgstr "Закрыть все окна, за исключением этого"
|
|||||||
msgid "Close all windows"
|
msgid "Close all windows"
|
||||||
msgstr "Закрыть все окна"
|
msgstr "Закрыть все окна"
|
||||||
|
|
||||||
|
#: rxconst.sclosemessagehint
|
||||||
|
msgid "Close message"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sclosevaliderror
|
#: rxconst.sclosevaliderror
|
||||||
msgid "Error. Expected values..."
|
msgid "Error. Expected values..."
|
||||||
msgstr "Ошибка. Ожидается значение..."
|
msgstr "Ошибка. Ожидается значение..."
|
||||||
|
@ -64,6 +64,10 @@ msgstr "Закрити всі вікна, за виключенням цього
|
|||||||
msgid "Close all windows"
|
msgid "Close all windows"
|
||||||
msgstr "Закрити всі вікна"
|
msgstr "Закрити всі вікна"
|
||||||
|
|
||||||
|
#: rxconst.sclosemessagehint
|
||||||
|
msgid "Close message"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sclosevaliderror
|
#: rxconst.sclosevaliderror
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
#| msgid "Error. Expected vailes..."
|
#| msgid "Error. Expected vailes..."
|
||||||
|
@ -262,13 +262,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TRxMDICloseButton.Create(AOwner: TComponent);
|
constructor TRxMDICloseButton.Create(AOwner: TComponent);
|
||||||
|
var
|
||||||
|
D: TBitmap;
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
// FLabelPosition := lpAbove;
|
// FLabelPosition := lpAbove;
|
||||||
FLabelSpacing := 6;
|
FLabelSpacing := 6;
|
||||||
FShowInfoLabel:=true;
|
FShowInfoLabel:=true;
|
||||||
CreateInternalLabel;
|
CreateInternalLabel;
|
||||||
Glyph:=LoadLazResBitmapImage('RxMDICloseIcon');
|
D:=LoadLazResBitmapImage('RxMDICloseIcon');
|
||||||
|
Glyph:=D;
|
||||||
|
D.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRxMDIPanel }
|
{ TRxMDIPanel }
|
||||||
|
@ -36,7 +36,7 @@ unit RxPopupNotifier;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, ExtCtrls, Forms, Graphics, Controls, StdCtrls, Buttons;
|
Classes, SysUtils, ExtCtrls, Forms, Graphics, Controls, StdCtrls, Buttons, LCLType;
|
||||||
|
|
||||||
type
|
type
|
||||||
TRxPopupNotifierItem = class;
|
TRxPopupNotifierItem = class;
|
||||||
@ -50,40 +50,70 @@ type
|
|||||||
|
|
||||||
TRxNotifierForm = class(TCustomForm)
|
TRxNotifierForm = class(TCustomForm)
|
||||||
private
|
private
|
||||||
//FCloseButton:TSpeedButton;
|
FCloseButton:TSpeedButton;
|
||||||
FCloseButton:TButton;
|
|
||||||
FCaptionLabel:TLabel;
|
FCaptionLabel:TLabel;
|
||||||
FMessageLabel:TLabel;
|
FMessageLabel:TLabel;
|
||||||
FTimerLabel:TLabel;
|
FTimerLabel:TLabel;
|
||||||
FOwnerItem:TRxPopupNotifierItem;
|
FOwnerItem:TRxPopupNotifierItem;
|
||||||
|
FMessageIcon:TImage;
|
||||||
procedure CreateCloseButton;
|
procedure CreateCloseButton;
|
||||||
procedure CreateCaption(ACaption:string);
|
procedure CreateCaption(ACaption:string);
|
||||||
procedure CreateMessage(AMessage:string);
|
procedure CreateMessage(AMessage:string);
|
||||||
procedure CreateTimerLabel;
|
procedure CreateTimerLabel;
|
||||||
procedure ButtonCloseClick(Sender: TObject);
|
procedure ButtonCloseClick(Sender: TObject);
|
||||||
|
procedure DoUpdateControls;
|
||||||
protected
|
protected
|
||||||
//procedure DoShowWindow; override;
|
|
||||||
public
|
public
|
||||||
constructor CreateNotifierForm(AOwnerItem:TRxPopupNotifierItem);
|
constructor CreateNotifierForm(AOwnerItem:TRxPopupNotifierItem);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TCloseButtonItem }
|
||||||
|
|
||||||
|
TCloseButtonItem = class(TPersistent)
|
||||||
|
private
|
||||||
|
FOwner: TRxPopupNotifierItem;
|
||||||
|
FFlat: Boolean;
|
||||||
|
FHint: TTranslateString;
|
||||||
|
FVisible: boolean;
|
||||||
|
procedure SetFlat(AValue: Boolean);
|
||||||
|
procedure SetHint(AValue: TTranslateString);
|
||||||
|
procedure SetVisible(AValue: boolean);
|
||||||
|
protected
|
||||||
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner:TRxPopupNotifierItem);
|
||||||
|
published
|
||||||
|
property Hint:TTranslateString read FHint write SetHint;
|
||||||
|
property Flat:Boolean read FFlat write SetFlat;
|
||||||
|
property Visible:boolean read FVisible write SetVisible default true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TRxPopupNotifierItem }
|
{ TRxPopupNotifierItem }
|
||||||
|
|
||||||
TRxPopupNotifierItem = class(TCollectionItem)
|
TRxPopupNotifierItem = class(TCollectionItem)
|
||||||
private
|
private
|
||||||
FActive: boolean;
|
FActive: boolean;
|
||||||
|
FAlphaBlend: boolean;
|
||||||
|
FAlphaBlendValue: Byte;
|
||||||
FAutoClose: boolean;
|
FAutoClose: boolean;
|
||||||
FCaption: string;
|
FCaption: string;
|
||||||
|
FCloseButton: TCloseButtonItem;
|
||||||
FColor: TColor;
|
FColor: TColor;
|
||||||
FMessage: string;
|
FMessage: string;
|
||||||
FNotifyForm:TRxNotifierForm;
|
FNotifyForm:TRxNotifierForm;
|
||||||
FShowCloseButton: boolean;
|
|
||||||
FShowCloseTimer: boolean;
|
FShowCloseTimer: boolean;
|
||||||
FCloseTime:TDateTime;
|
FCloseTime:TDateTime;
|
||||||
FState: TRxPopupNotifierState;
|
FState: TRxPopupNotifierState;
|
||||||
|
function GetShowCloseButton: boolean;
|
||||||
procedure OnNotifyFormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure OnNotifyFormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
procedure SetActive(AValue: boolean);
|
procedure SetActive(AValue: boolean);
|
||||||
|
procedure SetAlphaBlend(AValue: boolean);
|
||||||
|
procedure SetAlphaBlendValue(AValue: Byte);
|
||||||
|
procedure SetCloseButton(AValue: TCloseButtonItem);
|
||||||
procedure SetColor(AValue: TColor);
|
procedure SetColor(AValue: TColor);
|
||||||
|
procedure SetShowCloseButton(AValue: boolean);
|
||||||
|
procedure SetShowCloseTimer(AValue: boolean);
|
||||||
procedure UpdateCloseLabel;
|
procedure UpdateCloseLabel;
|
||||||
procedure CreateNotifierForm;
|
procedure CreateNotifierForm;
|
||||||
procedure UpdateFormSizes(var ATop:integer);
|
procedure UpdateFormSizes(var ATop:integer);
|
||||||
@ -93,15 +123,19 @@ type
|
|||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
public
|
public
|
||||||
constructor Create(ACollection: TCollection); override;
|
constructor Create(ACollection: TCollection); override;
|
||||||
|
destructor Destroy; override;
|
||||||
property State:TRxPopupNotifierState read FState;
|
property State:TRxPopupNotifierState read FState;
|
||||||
published
|
published
|
||||||
|
property AlphaBlend:boolean read FAlphaBlend write SetAlphaBlend default false;
|
||||||
|
property AlphaBlendValue:Byte read FAlphaBlendValue write SetAlphaBlendValue default 255;
|
||||||
property Active:boolean read FActive write SetActive;
|
property Active:boolean read FActive write SetActive;
|
||||||
property Color:TColor read FColor write SetColor default clYellow;
|
property Color:TColor read FColor write SetColor default clYellow;
|
||||||
property AutoClose:boolean read FAutoClose write FAutoClose default true;
|
property AutoClose:boolean read FAutoClose write FAutoClose default true;
|
||||||
property ShowCloseTimer:boolean read FShowCloseTimer write FShowCloseTimer default true;
|
property ShowCloseTimer:boolean read FShowCloseTimer write SetShowCloseTimer default true;
|
||||||
property ShowCloseButton:boolean read FShowCloseButton write FShowCloseButton default true;
|
property ShowCloseButton:boolean read GetShowCloseButton write SetShowCloseButton default true;
|
||||||
property Caption:string read FCaption write FCaption;
|
property Caption:string read FCaption write FCaption;
|
||||||
property Message:string read FMessage write FMessage;
|
property Message:string read FMessage write FMessage;
|
||||||
|
property CloseButton:TCloseButtonItem read FCloseButton write SetCloseButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TNotifierCollection }
|
{ TNotifierCollection }
|
||||||
@ -155,39 +189,99 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses rxconst, LCLType;
|
uses rxconst, rxlclutils;
|
||||||
|
|
||||||
|
{ TCloseButtonItem }
|
||||||
|
|
||||||
|
procedure TCloseButtonItem.SetFlat(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FFlat=AValue then Exit;
|
||||||
|
FFlat:=AValue;
|
||||||
|
FOwner.Changed(false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCloseButtonItem.SetHint(AValue: TTranslateString);
|
||||||
|
begin
|
||||||
|
if FHint=AValue then Exit;
|
||||||
|
FHint:=AValue;
|
||||||
|
FOwner.Changed(false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCloseButtonItem.SetVisible(AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FVisible=AValue then Exit;
|
||||||
|
FVisible:=AValue;
|
||||||
|
FOwner.Changed(false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCloseButtonItem.AssignTo(Dest: TPersistent);
|
||||||
|
begin
|
||||||
|
if Dest is TCloseButtonItem then
|
||||||
|
begin
|
||||||
|
TCloseButtonItem(Dest).FFlat:=FFlat;
|
||||||
|
TCloseButtonItem(Dest).FHint:=FHint;
|
||||||
|
TCloseButtonItem(Dest).FVisible:=FVisible;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
inherited AssignTo(Dest);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TCloseButtonItem.Create(AOwner: TRxPopupNotifierItem);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FOwner:=AOwner;
|
||||||
|
FFlat:=true;
|
||||||
|
FHint:=sCloseMessageHint;
|
||||||
|
FVisible:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TRxNotifierForm }
|
{ TRxNotifierForm }
|
||||||
|
|
||||||
procedure TRxNotifierForm.CreateCloseButton;
|
procedure TRxNotifierForm.CreateCloseButton;
|
||||||
|
var
|
||||||
|
D: TBitmap;
|
||||||
begin
|
begin
|
||||||
begin
|
FCloseButton:=TSpeedButton.Create(Self);
|
||||||
//FCloseButton:=TSpeedButton.Create(Self);
|
|
||||||
FCloseButton:=TButton.Create(Self);
|
|
||||||
FCloseButton.Parent:=Self;
|
FCloseButton.Parent:=Self;
|
||||||
FCloseButton.AutoSize:=true;
|
|
||||||
FCloseButton.Caption:=' X '; //sClose;
|
|
||||||
FCloseButton.Top:=6;
|
|
||||||
//FCloseButton.Flat:=true;
|
|
||||||
//FCloseButton.Left:=Width - Canvas.TextWidth(FCloseButton.Caption) - 6;
|
|
||||||
FCloseButton.Left:=Width - FCloseButton.Width - 6;
|
|
||||||
{
|
|
||||||
FCloseButton.BorderSpacing.Around:=6;
|
FCloseButton.BorderSpacing.Around:=6;
|
||||||
FCloseButton.AnchorSideLeft.Control:=nil;
|
|
||||||
|
FCloseButton.Width:=26;
|
||||||
|
FCloseButton.Height:=26;
|
||||||
|
D:=LoadLazResBitmapImage('RxMDICloseIcon');
|
||||||
|
FCloseButton.Glyph:=D;
|
||||||
|
D.Free;
|
||||||
|
FCloseButton.Hint:=FOwnerItem.CloseButton.Hint;
|
||||||
|
FCloseButton.Flat:=FOwnerItem.CloseButton.Flat;
|
||||||
|
|
||||||
|
FCloseButton.Anchors:=[akTop, akRight];
|
||||||
FCloseButton.AnchorSideRight.Control:=Self;
|
FCloseButton.AnchorSideRight.Control:=Self;
|
||||||
FCloseButton.AnchorSideRight.Side:=asrRight;
|
FCloseButton.AnchorSideRight.Side:=asrRight;
|
||||||
FCloseButton.AnchorSideTop.Control:=Self;}
|
FCloseButton.AnchorSideTop.Control:=Self;
|
||||||
|
|
||||||
FCloseButton.OnClick:=@ButtonCloseClick;
|
FCloseButton.OnClick:=@ButtonCloseClick;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TRxNotifierForm.CreateCaption(ACaption: string);
|
procedure TRxNotifierForm.CreateCaption(ACaption: string);
|
||||||
begin
|
begin
|
||||||
FCaptionLabel:=TLabel.Create(Self);
|
FCaptionLabel:=TLabel.Create(Self);
|
||||||
FCaptionLabel.Parent:=Self;
|
FCaptionLabel.Parent:=Self;
|
||||||
|
FCaptionLabel.AutoSize:=true;
|
||||||
|
|
||||||
FCaptionLabel.BorderSpacing.Around:=6;
|
FCaptionLabel.BorderSpacing.Around:=6;
|
||||||
FCaptionLabel.Align:=alTop;
|
FCaptionLabel.Anchors:=[akTop, akLeft, akRight];
|
||||||
|
FCaptionLabel.AnchorSideTop.Control:=Self;
|
||||||
|
FCaptionLabel.AnchorSideLeft.Control:=Self;
|
||||||
|
if Assigned(FCloseButton) then
|
||||||
|
begin
|
||||||
|
FCaptionLabel.AnchorSideRight.Control:=FCloseButton;
|
||||||
|
FCaptionLabel.AnchorSideRight.Side:=asrLeft;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
FCaptionLabel.AnchorSideRight.Control:=Self;
|
||||||
|
FCaptionLabel.AnchorSideRight.Side:=asrRight;
|
||||||
|
end;
|
||||||
|
|
||||||
FCaptionLabel.Caption:=ACaption;
|
FCaptionLabel.Caption:=ACaption;
|
||||||
FCaptionLabel.Font.Style:=FCaptionLabel.Font.Style + [fsBold];
|
FCaptionLabel.Font.Style:=FCaptionLabel.Font.Style + [fsBold];
|
||||||
FCaptionLabel.OnClick:=@FOwnerItem.NotifierClick;
|
FCaptionLabel.OnClick:=@FOwnerItem.NotifierClick;
|
||||||
@ -199,18 +293,51 @@ begin
|
|||||||
FMessageLabel.Parent:=Self;
|
FMessageLabel.Parent:=Self;
|
||||||
FMessageLabel.WordWrap:=true;
|
FMessageLabel.WordWrap:=true;
|
||||||
FMessageLabel.BorderSpacing.Around:=6;
|
FMessageLabel.BorderSpacing.Around:=6;
|
||||||
FMessageLabel.Align:=alClient;
|
|
||||||
|
FMessageLabel.Anchors:=[akTop, akLeft, akRight, akBottom];
|
||||||
|
|
||||||
|
FMessageLabel.AnchorSideTop.Side:=asrBottom;
|
||||||
|
|
||||||
|
FMessageLabel.AnchorSideLeft.Control:=Self;
|
||||||
|
FMessageLabel.AnchorSideRight.Control:=Self;
|
||||||
|
FMessageLabel.AnchorSideRight.Side:=asrRight;
|
||||||
|
FMessageLabel.AnchorSideBottom.Control:=Self;
|
||||||
|
FMessageLabel.AnchorSideBottom.Side:=asrBottom;
|
||||||
|
|
||||||
|
|
||||||
FMessageLabel.Caption:=AMessage;
|
FMessageLabel.Caption:=AMessage;
|
||||||
FMessageLabel.OnClick:=@FOwnerItem.NotifierClick;
|
FMessageLabel.OnClick:=@FOwnerItem.NotifierClick;
|
||||||
|
|
||||||
|
DoUpdateControls;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxNotifierForm.CreateTimerLabel;
|
procedure TRxNotifierForm.CreateTimerLabel;
|
||||||
begin
|
begin
|
||||||
FTimerLabel:=TLabel.Create(Self);
|
FTimerLabel:=TLabel.Create(Self);
|
||||||
FTimerLabel.Parent:=Self;
|
FTimerLabel.Parent:=Self;
|
||||||
FTimerLabel.Top:=FCaptionLabel.Height+1;
|
FTimerLabel.AutoSize:=true;
|
||||||
FTimerLabel.Align:=alTop;
|
|
||||||
FTimerLabel.BorderSpacing.Around:=6;
|
FTimerLabel.BorderSpacing.Around:=6;
|
||||||
|
FTimerLabel.Anchors:=[akTop, akLeft, akRight];
|
||||||
|
|
||||||
|
FTimerLabel.AnchorSideTop.Control:=FCaptionLabel;
|
||||||
|
FTimerLabel.AnchorSideTop.Side:=asrBottom;
|
||||||
|
|
||||||
|
FTimerLabel.AnchorSideLeft.Control:=Self;
|
||||||
|
FTimerLabel.AnchorSideLeft.Side:=asrLeft;
|
||||||
|
|
||||||
|
if Assigned(FCloseButton) then
|
||||||
|
begin
|
||||||
|
FTimerLabel.AnchorSideRight.Control:=FCloseButton;
|
||||||
|
FTimerLabel.AnchorSideRight.Side:=asrLeft;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
FTimerLabel.AnchorSideRight.Control:=Self;
|
||||||
|
FTimerLabel.AnchorSideRight.Side:=asrRight;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FTimerLabel.Visible:=FOwnerItem.ShowCloseTimer;
|
||||||
FTimerLabel.Font.Style:=FTimerLabel.Font.Style + [fsItalic];
|
FTimerLabel.Font.Style:=FTimerLabel.Font.Style + [fsItalic];
|
||||||
FTimerLabel.Caption:=' ';
|
FTimerLabel.Caption:=' ';
|
||||||
FTimerLabel.OnClick:=@FOwnerItem.NotifierClick;
|
FTimerLabel.OnClick:=@FOwnerItem.NotifierClick;
|
||||||
@ -220,25 +347,21 @@ procedure TRxNotifierForm.ButtonCloseClick(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
Close;
|
Close;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
procedure TRxNotifierForm.DoShowWindow;
|
procedure TRxNotifierForm.DoUpdateControls;
|
||||||
begin
|
begin
|
||||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState)) and (Parent=nil) then
|
if FTimerLabel.Visible then
|
||||||
begin
|
FMessageLabel.AnchorSideTop.Control:=FTimerLabel
|
||||||
// automatically choose a control to focus
|
else
|
||||||
{$IFDEF VerboseFocus}
|
FMessageLabel.AnchorSideTop.Control:=FCaptionLabel;
|
||||||
DebugLn('THintWindow.WMShowWindow ',DbgSName(Self),' Set ActiveControl := ',DbgSName(FindDefaultForActiveControl));
|
|
||||||
{$ENDIF}
|
|
||||||
ActiveControl := FindNextControl(nil, True, True, False); //FindDefaultForActiveControl;
|
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
*)
|
|
||||||
constructor TRxNotifierForm.CreateNotifierForm(AOwnerItem: TRxPopupNotifierItem
|
constructor TRxNotifierForm.CreateNotifierForm(AOwnerItem: TRxPopupNotifierItem
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
inherited CreateNew(Application);
|
inherited CreateNew(Application);
|
||||||
FOwnerItem:=AOwnerItem;
|
FOwnerItem:=AOwnerItem;
|
||||||
//fCompStyle := csHintWindow;
|
ShowHint:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TNotifierCollection }
|
{ TNotifierCollection }
|
||||||
@ -281,6 +404,11 @@ begin
|
|||||||
FState:=rpsInactive;
|
FState:=rpsInactive;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TRxPopupNotifierItem.GetShowCloseButton: boolean;
|
||||||
|
begin
|
||||||
|
Result:=FCloseButton.Visible;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxPopupNotifierItem.SetActive(AValue: boolean);
|
procedure TRxPopupNotifierItem.SetActive(AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FActive=AValue then Exit;
|
if FActive=AValue then Exit;
|
||||||
@ -301,6 +429,27 @@ begin
|
|||||||
Changed(false);
|
Changed(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxPopupNotifierItem.SetAlphaBlend(AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FAlphaBlend=AValue then Exit;
|
||||||
|
FAlphaBlend:=AValue;
|
||||||
|
if Assigned(FNotifyForm) then
|
||||||
|
FNotifyForm.AlphaBlend:=FAlphaBlend;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxPopupNotifierItem.SetAlphaBlendValue(AValue: Byte);
|
||||||
|
begin
|
||||||
|
if FAlphaBlendValue=AValue then Exit;
|
||||||
|
FAlphaBlendValue:=AValue;
|
||||||
|
if Assigned(FNotifyForm) then
|
||||||
|
FNotifyForm.AlphaBlendValue:=FAlphaBlendValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxPopupNotifierItem.SetCloseButton(AValue: TCloseButtonItem);
|
||||||
|
begin
|
||||||
|
FCloseButton.Assign(AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxPopupNotifierItem.SetColor(AValue: TColor);
|
procedure TRxPopupNotifierItem.SetColor(AValue: TColor);
|
||||||
begin
|
begin
|
||||||
if FColor=AValue then Exit;
|
if FColor=AValue then Exit;
|
||||||
@ -309,19 +458,35 @@ begin
|
|||||||
FNotifyForm.Color:=FColor;
|
FNotifyForm.Color:=FColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxPopupNotifierItem.SetShowCloseButton(AValue: boolean);
|
||||||
|
begin
|
||||||
|
FCloseButton.Visible:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxPopupNotifierItem.SetShowCloseTimer(AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FShowCloseTimer=AValue then Exit;
|
||||||
|
FShowCloseTimer:=AValue;
|
||||||
|
if Assigned(FNotifyForm) then
|
||||||
|
begin
|
||||||
|
FNotifyForm.FTimerLabel.Visible:=AValue;
|
||||||
|
FNotifyForm.DoUpdateControls;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxPopupNotifierItem.UpdateCloseLabel;
|
procedure TRxPopupNotifierItem.UpdateCloseLabel;
|
||||||
var
|
var
|
||||||
D, D1: TDateTime;
|
D: TDateTime;
|
||||||
N: Int64;
|
N: Int64;
|
||||||
begin
|
begin
|
||||||
if Assigned(FNotifyForm) and FShowCloseTimer then
|
if Assigned(FNotifyForm) and FAutoClose then
|
||||||
begin
|
begin
|
||||||
D:=Now;
|
D:=Now;
|
||||||
if FCloseTime < D then
|
if FCloseTime < D then
|
||||||
FState:=rpsMinimized
|
FState:=rpsMinimized
|
||||||
else
|
else
|
||||||
|
if FShowCloseTimer then
|
||||||
begin
|
begin
|
||||||
// D1:=;
|
|
||||||
N:=Trunc((FCloseTime - D) * SecsPerDay);
|
N:=Trunc((FCloseTime - D) * SecsPerDay);
|
||||||
FNotifyForm.FTimerLabel.Caption:=Format( sCloseAfterSec, [N]);
|
FNotifyForm.FTimerLabel.Caption:=Format( sCloseAfterSec, [N]);
|
||||||
end;
|
end;
|
||||||
@ -368,12 +533,13 @@ begin
|
|||||||
FNotifyForm.FormStyle:=fsStayOnTop;
|
FNotifyForm.FormStyle:=fsStayOnTop;
|
||||||
FNotifyForm.ShowInTaskBar:=stNever;
|
FNotifyForm.ShowInTaskBar:=stNever;
|
||||||
FNotifyForm.Color:=FColor;
|
FNotifyForm.Color:=FColor;
|
||||||
|
FNotifyForm.AlphaBlend:=FAlphaBlend;
|
||||||
|
FNotifyForm.AlphaBlendValue:=FAlphaBlendValue;
|
||||||
|
|
||||||
if FShowCloseButton then
|
if FCloseButton.Visible then
|
||||||
FNotifyForm.CreateCloseButton;
|
FNotifyForm.CreateCloseButton;
|
||||||
|
|
||||||
FNotifyForm.CreateCaption(FCaption);
|
FNotifyForm.CreateCaption(FCaption);
|
||||||
if FShowCloseTimer then
|
|
||||||
FNotifyForm.CreateTimerLabel;
|
FNotifyForm.CreateTimerLabel;
|
||||||
FNotifyForm.CreateMessage(FMessage);
|
FNotifyForm.CreateMessage(FMessage);
|
||||||
|
|
||||||
@ -465,7 +631,7 @@ begin
|
|||||||
TRxPopupNotifierItem(Dest).FShowCloseTimer:=FShowCloseTimer;
|
TRxPopupNotifierItem(Dest).FShowCloseTimer:=FShowCloseTimer;
|
||||||
TRxPopupNotifierItem(Dest).FCaption:=FCaption;
|
TRxPopupNotifierItem(Dest).FCaption:=FCaption;
|
||||||
TRxPopupNotifierItem(Dest).FMessage:=FMessage;
|
TRxPopupNotifierItem(Dest).FMessage:=FMessage;
|
||||||
TRxPopupNotifierItem(Dest).FShowCloseButton:=FShowCloseButton;
|
TRxPopupNotifierItem(Dest).CloseButton:=CloseButton;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inherited AssignTo(Dest);
|
inherited AssignTo(Dest);
|
||||||
@ -474,9 +640,18 @@ end;
|
|||||||
constructor TRxPopupNotifierItem.Create(ACollection: TCollection);
|
constructor TRxPopupNotifierItem.Create(ACollection: TCollection);
|
||||||
begin
|
begin
|
||||||
inherited Create(ACollection);
|
inherited Create(ACollection);
|
||||||
|
FCloseButton:=TCloseButtonItem.Create(Self);
|
||||||
FColor:=TRxPopupNotifier(ACollection.Owner).FDefaultColor;
|
FColor:=TRxPopupNotifier(ACollection.Owner).FDefaultColor;
|
||||||
FShowCloseButton:=true;
|
|
||||||
FShowCloseTimer:=true;
|
FShowCloseTimer:=true;
|
||||||
|
FAutoClose:=true;
|
||||||
|
FAlphaBlendValue:=255;
|
||||||
|
FAlphaBlend:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TRxPopupNotifierItem.Destroy;
|
||||||
|
begin
|
||||||
|
FreeAndNil(FCloseButton);
|
||||||
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRxPopupNotifier }
|
{ TRxPopupNotifier }
|
||||||
@ -534,7 +709,7 @@ begin
|
|||||||
for i:=FItems.Count - 1 downto 0 do
|
for i:=FItems.Count - 1 downto 0 do
|
||||||
begin
|
begin
|
||||||
F:=FItems.Items[i] as TRxPopupNotifierItem;
|
F:=FItems.Items[i] as TRxPopupNotifierItem;
|
||||||
if F.Active and (F.State = rpsShowing) and F.ShowCloseTimer then
|
if F.Active and (F.State = rpsShowing) and F.AutoClose then
|
||||||
F.UpdateCloseLabel;
|
F.UpdateCloseLabel;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -132,6 +132,8 @@ resourcestring
|
|||||||
{ TRxNotifierForm }
|
{ TRxNotifierForm }
|
||||||
sClose = 'Close';
|
sClose = 'Close';
|
||||||
sCloseAfterSec = 'Close after %d sec';
|
sCloseAfterSec = 'Close after %d sec';
|
||||||
|
sCloseMessageHint = 'Close message';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user