• R/O
  • SSH
  • HTTPS

akdf: Commit


Commit MetaInfo

Revision574 (tree)
Time2022-03-07 04:35:42
Authorderekwildstar

Log Message

Novos eventos adicionados a TKRKForm

Change Summary

Incremental Difference

--- trunk/rtp/src/Vcl/KRK.Vcl.Forms.pas (revision 573)
+++ trunk/rtp/src/Vcl/KRK.Vcl.Forms.pas (revision 574)
@@ -2,13 +2,9 @@
22 {$IF CompilerVersion >= 25}{$LEGACYIFEND ON}{$IFEND} { Delphi XE4 }
33 interface
44
5-uses Forms
6- , Messages
7- , Classes
8- , Buttons
9- , Controls
10- , Graphics
11- , KRK.Vcl.StdCtrls;
5+uses
6+ Forms, Messages, Classes, Buttons, Controls, Graphics, Windows,
7+ KRK.Vcl.StdCtrls, CommCtrl;
128
139 type
1410 TVisibleButton = (vbOk,vbYes,vbYesToAll,vbNo,vbIgnore,vbCancel,vbClose,vbHelp);
@@ -72,6 +68,12 @@
7268 property ButtonsPanel: TButtonsPanel read FButtonsPanel write FButtonsPanel;
7369 end;
7470
71+ TTTNLinkClick = procedure (ANMLink: TNMLink) of object;
72+ TTTNGetDispInfo = procedure (ANMDispInfo: {$IFDEF UNICODE}PNMTTDispInfoW{$ELSE}PNMTTDispInfoA{$ENDIF}) of object;
73+ TTTNShow = procedure (ANMHdr: TNMHdr) of object;
74+ TTTNPop = procedure (ANMHdr: TNMHdr) of object;
75+ TTTNCustomDraw = procedure (ANMTTCustomDraw: TNMTTCustomDraw) of object;
76+
7577 { Novos Forms precisam ser herdados de TForm e não de TCustomForm porque
7678 apenas os descendentes de TForm são incluídos na lista de forms de tela no
7779 objeto TScreen, não sei se é um bug, mas é assim }
@@ -78,6 +80,12 @@
7880 TCustomKRKForm = class(TForm)
7981 private
8082 FKRKFormProperties: TKRKFormProperties;
83+ FTTNLinkClick: TTTNLinkClick;
84+ FTTNGetDispInfo: TTTNGetDispInfo;
85+ FTTNCustomDraw: TTTNCustomDraw;
86+ FTTNPop: TTTNPop;
87+ FTTNShow: TTTNShow;
88+
8189 function GetOnCancelButtonClick: TNotifyEvent;
8290 function GetOnCloseButtonClick: TNotifyEvent;
8391 function GetOnHelpButtonClick: TNotifyEvent;
@@ -86,6 +94,7 @@
8694 function GetOnOkButtonClick: TNotifyEvent;
8795 function GetOnYesButtonClick: TNotifyEvent;
8896 function GetOnYesToAllButtonClick: TNotifyEvent;
97+
8998 procedure SetOnCancelButtonClick(const Value: TNotifyEvent);
9099 procedure SetOnCloseButtonClick(const Value: TNotifyEvent);
91100 procedure SetOnHelpButtonClick(const Value: TNotifyEvent);
@@ -97,9 +106,11 @@
97106 protected
98107 procedure DoClose(var Action: TCloseAction); override;
99108 procedure DoShow; override;
109+ procedure HandleNotificationMessages(var AMessage: TWMNotify); message WM_NOTIFY;
100110 public
101111 constructor Create(aOwner: TComponent); override;
102112 destructor Destroy; override;
113+
103114 property KRKFormProperties: TKRKFormProperties read FKRKFormProperties write FKRKFormProperties;
104115 property OnOkButtonClick: TNotifyEvent read GetOnOkButtonClick write SetOnOkButtonClick;
105116 property OnCancelButtonClick: TNotifyEvent read GetOnCancelButtonClick write SetOnCancelButtonClick;
@@ -109,6 +120,11 @@
109120 property OnIgnoreButtonClick: TNotifyEvent read GetOnIgnoreButtonClick write SetOnIgnoreButtonClick;
110121 property OnCloseButtonClick: TNotifyEvent read GetOnCloseButtonClick write SetOnCloseButtonClick;
111122 property OnHelpButtonClick: TNotifyEvent read GetOnHelpButtonClick write SetOnHelpButtonClick;
123+ property OnTTNLinkClick: TTTNLinkClick read FTTNLinkClick write FTTNLinkClick;
124+ property OnTTNGetDispInfo: TTTNGetDispInfo read FTTNGetDispInfo write FTTNGetDispInfo;
125+ property OnTTNShow: TTTNShow read FTTNShow write FTTNShow;
126+ property OnTTNPop: TTTNPop read FTTNPop write FTTNPop;
127+ property OnTTNCustomDraw: TTTNCustomDraw read FTTNCustomDraw write FTTNCustomDraw;
112128 end;
113129
114130 TKRKForm = class (TCustomKRKForm)
@@ -122,6 +138,11 @@
122138 property OnIgnoreButtonClick;
123139 property OnCloseButtonClick;
124140 property OnHelpButtonClick;
141+ property OnTTNLinkClick;
142+ property OnTTNGetDispInfo;
143+ property OnTTNShow;
144+ property OnTTNPop;
145+ property OnTTNCustomDraw;
125146 end;
126147
127148 TKRKFormClass = class of TKRKForm;
@@ -143,11 +164,9 @@
143164
144165 implementation
145166
146-uses Windows
147- {$IF RTLVersion >= 24} { Delphi XE3 }
148- , Themes
149- {$IFEND}
150- , KRK.Rtl.Common.Classes;
167+uses
168+ {$IF RTLVersion >= 24}Themes{$IFEND} { Delphi XE3 }, KRK.Rtl.Common.Classes,
169+ KRK.Rtl.Win.CommCtrl;
151170
152171 { TCustomKRKForm }
153172
@@ -224,6 +243,29 @@
224243 Result := FKRKFormProperties.FButtonsPanel.FBBTNYesToAll.OnClick;
225244 end;
226245
246+procedure TCustomKRKForm.HandleNotificationMessages(var AMessage: TWMNotify);
247+begin
248+ case AMessage.NMHdr.code of
249+ TTN_LINKCLICK:
250+ if Assigned(FTTNLinkClick) then
251+ FTTNLinkClick(PNMLink(AMessage.NMHdr)^);
252+ TTN_GETDISPINFO:
253+ if Assigned(FTTNGetDispInfo) then
254+ FTTNGetDispInfo({$IFDEF UNICODE}PNMTTDispInfoW{$ELSE}PNMTTDispInfoA{$ENDIF}(AMessage.NMHdr));
255+ TTN_SHOW:
256+ if Assigned(FTTNShow) then
257+ FTTNShow(AMessage.NMHdr^);
258+ TTN_POP:
259+ if Assigned(FTTNPop) then
260+ FTTNPop(AMessage.NMHdr^);
261+ NM_CUSTOMDRAW: { ToolTip }
262+ if Assigned(FTTNCustomDraw) then
263+ FTTNCustomDraw(PNMTTCustomDraw(AMessage.NMHdr)^)
264+ end;
265+
266+ inherited;
267+end;
268+
227269 procedure TCustomKRKForm.SetOnCancelButtonClick(const Value: TNotifyEvent);
228270 begin
229271 FKRKFormProperties.FButtonsPanel.FBBTNCancel.OnClick := Value;
@@ -274,6 +316,7 @@
274316 destructor TKRKFormProperties.Destroy;
275317 begin
276318 inherited;
319+ FButtonsPanel.Free;
277320 end;
278321
279322 function TKRKFormProperties.GetParent: TWinControl;
Show on old repository browser