OSDN Git Service

ToolButton1,3,5,9,11,16,20
[gikonavigoeson/gikonavi.git] / Component / GikoCoolBar.pas
1 unit GikoCoolBar;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Classes, Controls, ToolWin, ComCtrls, CommCtrl;
7
8 type
9         tagNMREBARCHEVRON = packed record
10                 hdr: TNMHdr;
11                 uBand: UINT;
12                 wID: UINT;
13                 lParam: LPARAM;
14                 rc: TRect;
15                 lParamNM: LPARAM;
16         end;
17         PNMRebarChevron = ^TNMRebarChevron;
18         TNMRebarChevron = tagNMRebarChevron;
19
20         TGikoCoolBar = class;
21
22         TBandInfoEvent = procedure(Sender: TObject; var BandInfo: PReBarBandInfo) of object;
23         TChevronClickEvent = procedure(Sender: TObject; RebarChevron: PNMRebarChevron) of object;
24
25         TGikoCoolBar = class(TCoolBar)
26         private
27                 FOnBandInfo: TBandInfoEvent;
28                 FOnChevronClick: TChevronClickEvent;
29                 procedure RBInsertBand(var Message: TMessage); message RB_INSERTBAND;
30                 procedure RBSetBandInfo(var Message: TMessage); message RB_SETBANDINFO;
31                 procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
32         protected
33         public
34         published
35                 property OnBandInfo: TBandInfoEvent read FOnBandInfo write FOnBandInfo;
36                 property OnChevronClick: TChevronClickEvent read FOnChevronClick write FOnChevronClick;
37         end;
38
39 const
40         RBBS_USECHEVRON         = $00000200;
41         RBN_CHEVRONPUSHED = RBN_FIRST - 10;
42
43 procedure Register;
44
45 implementation
46
47 procedure Register;
48 begin
49         RegisterComponents('gikoNavi', [TGikoCoolBar]);
50 end;
51
52 procedure TGikoCoolBar.RBInsertBand(var Message: TMessage);
53 begin
54         if Assigned(FOnBandInfo) then
55                 FOnBandInfo(Self, PReBarBandInfo(Message.LParam));
56         inherited;
57 end;
58
59 procedure TGikoCoolBar.RBSetBandInfo(var Message: TMessage);
60 begin
61         if Assigned(FOnBandInfo) then
62                 FOnBandInfo(Self, PReBarBandInfo(Message.LParam));
63         inherited;
64 end;
65
66 procedure TGikoCoolBar.CNNotify(var Message: TWMNotify);
67 begin
68         if Message.NMHdr^.code = RBN_CHEVRONPUSHED then begin
69                 if Assigned(FOnChevronClick) then begin
70                         FOnChevronClick(Self, PNMRebarChevron(Message.NMHdr));
71                 end;
72         end;
73         inherited;
74 end;
75
76 end.