source: branches/2.20_branch/Components/coolbar2.pas@ 392

Last change on this file since 392 was 15, checked in by RBRi, 19 years ago

+ components stuff

  • Property svn:eol-style set to native
File size: 38.0 KB
Line 
1// Enhanced version of TCoolBar from Sibyl samples
2// - Bitmap for first button draws correctly
3// - Draws a border line underneath
4// - Buttons look better (have black frame, when pressed look sunken, background moves)
5// - Button text highlights under mouse (HotColor property)
6// - bitmap does not overwrite border of button
7// (C) 1998 SpeedSoft
8
9Unit coolbar2;
10
11Interface
12
13Uses Classes,Forms,Graphics,Buttons,StdCtrls,ComCtrls,Dialogs, Messages;
14
15Type
16 TCoolSection2=Class(THeaderSection)
17 Private
18 FImage:LongInt;
19 FHotImage:LongInt;
20 FDisabledImage:LongInt;
21 FDisabled:Boolean;
22 Private
23 Procedure SetDisabled(NewValue:Boolean);
24 Procedure SetImage(NewValue:LongInt);
25 Procedure SetHotImage(NewValue:LongInt);
26 Procedure SetDisabledImage(NewValue:LongInt);
27 Public
28 Hint:string;
29 Constructor Create(ACollection:TCollection);Override;
30 Procedure Assign(Source:TCollectionItem);Override;
31 Public
32 Property Disabled:Boolean read FDisabled write SetDisabled;
33 Property Image:LongInt read FImage write SetImage;
34 Property HotImage:LongInt read FHotImage write SetHotImage;
35 Property DisabledImage:LongInt read FDisabledImage write SetDisabledImage;
36 End;
37
38 TCoolSections2=Class(THeaderSections)
39 Protected
40 Function GetSection( Index: longint ): TCoolSection2;
41 Public
42 Procedure SetupComponent;Override;
43 Property Items[ Index: Longint ]: TCoolSection2 read GetSection; default;
44 End;
45
46 TDrawCoolSectionEvent=Procedure(HeaderControl:THeaderControl;Section:TCoolSection2;
47 Const rc:TRect;Pressed,Hot,Enabled:Boolean) Of Object;
48
49 TCoolBar2=Class(THeaderControl)
50 Private
51 FBackgroundBitmap:TBitmap;
52 FActiveSection:TCoolSection2;
53 FImages:TImageList;
54 FFlat:Boolean;
55 FBackgroundOffset:LongWord;
56 FMouseTimer:TTimer;
57 FOnDrawSection:TDrawCoolSectionEvent;
58 FHotColor: TColor;
59 FShowText: boolean;
60 FShowImages: boolean;
61 Private
62 Procedure EvFMouseTimer(Sender:TObject);
63 Procedure SetBackgroundBitmap(NewValue:TBitmap);
64 Procedure UpdateHeader(Header:THeaderSection);Override;
65 Procedure SetImages(NewValue:TImageList);
66 Procedure SetFlat(NewValue:Boolean);
67 Procedure SetBackgroundOffset(NewValue:LongWord);
68 Function GetSections:TCoolSections2;
69 Procedure SetSections(NewValue:TCoolSections2);
70
71 Procedure SetShowText( NewValue: boolean );
72 Procedure SetShowImages( NewValue: boolean );
73
74 Protected
75 Procedure DrawSection(Section:TCoolSection2;Const rc:TRect;Pressed,Hot,Enabled:Boolean);Virtual;
76 Procedure MouseDown(Button:TMouseButton;ShiftState:TShiftState;X,Y:LongInt);Override;
77 Procedure MouseDblClick(Button:TMouseButton;ShiftState:TShiftState;X,Y:LongInt);Override;
78 Procedure MouseMove(ShiftState:TShiftState;X,Y:LongInt);Override;
79 Procedure Notification( AComponent: TComponent;
80 Operation:TOperation ); Override;
81 Procedure DrawBackground( rec: TRect;
82 XOffset, YOffset: longint );
83 Public
84 Procedure SetupComponent;Override;
85 Procedure Redraw(Const rec:TRect);Override;
86 Procedure ReadSCUResource(Const ResName:TResourceName;Var Data;DataLen:LongInt);Override;
87 Function WriteSCUResource(Stream:TResourceStream):Boolean;Override;
88 Procedure EditSections;
89
90 Procedure SetMinConstButtonWidth;
91 Published
92 Property BackgroundBitmap:TBitmap read FBackgroundBitmap write SetBackgroundBitmap;
93 Property BackgroundOffset:LongWord read FBackgroundOffset write SetBackgroundOffset;
94 Property Images:TImageList read FImages write SetImages;
95 Property Flat:Boolean read FFlat write SetFlat;
96 Property Sections:TCoolSections2 Read GetSections Write SetSections;
97 Property HotColor: TColor read FHotColor write FHotColor;
98
99 Property ShowText: boolean read FShowText write SetShowText;
100 Property ShowImages: boolean read FShowImages write SetShowImages;
101
102 Published
103 Property OnDrawSection:TDrawCoolSectionEvent Read FOnDrawSection Write FOnDrawSection;
104 Property OnFontChange;
105 End;
106
107Implementation
108
109// default bitmap from resource file
110// {$R CoolBar2}
111
112exports
113 TCoolBar2, 'User', 'Coolbar2.bmp';
114{
115ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
116º º
117º Speed-Pascal/2 Version 2.0 º
118º º
119º Speed-Pascal Component Classes (SPCC) º
120º º
121º This section: TCoolSection2 Class Implementation º
122º º
123º (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited ! º
124º º
125ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
126}
127
128Constructor TCoolSection2.Create(ACollection:TCollection);
129Begin
130 Inherited Create(ACollection);
131 FImage:=-1;
132 FHotImage:=-1;
133 FDisabledImage:=-1;
134 AllowSize:= false;
135 Width:= 60;
136 Alignment:= taCenter;
137End;
138
139Procedure TCoolSection2.Assign(Source:TCollectionItem);
140Begin
141 Inherited Assign(Source);
142 If Source Is TCoolSection2 Then
143 If Source<>Self Then
144 Begin
145 FImage:=TCoolSection2(Source).Image;
146 FHotImage:=TCoolSection2(Source).HotImage;
147 FDisabledImage:=TCoolSection2(Source).DisabledImage;
148 FDisabled:=TCoolSection2(Source).Disabled;
149 End;
150End;
151
152Procedure TCoolSection2.SetDisabled(NewValue:Boolean);
153Begin
154 If NewValue=FDisabled Then exit;
155 FDisabled:=NewValue;
156 Changed(False);
157End;
158
159Procedure TCoolSection2.SetImage(NewValue:LongInt);
160Begin
161 If NewValue=FImage Then exit;
162 FImage:=NewValue;
163 Changed(False);
164End;
165
166Procedure TCoolSection2.SetHotImage(NewValue:LongInt);
167Begin
168 If NewValue=FHotImage Then exit;
169 FHotImage:=NewValue;
170 Changed(False);
171End;
172
173Procedure TCoolSection2.SetDisabledImage(NewValue:LongInt);
174Begin
175 If NewValue=FDisabledImage Then exit;
176 FDisabledImage:=NewValue;
177 Changed(False);
178End;
179
180{
181ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
182º º
183º Speed-Pascal/2 Version 2.0 º
184º º
185º Speed-Pascal Component Classes (SPCC) º
186º º
187º This section: TCoolSections2 Class Implementation º
188º º
189º (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited ! º
190º º
191ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
192}
193
194Procedure TCoolSections2.SetupComponent;
195Begin
196 Inherited SetupComponent;
197 Name:='CoolSections';
198 ItemClass:=TCoolSection2;
199End;
200
201Function TCoolSections2.GetSection( Index: longint ): TCoolSection2;
202begin
203 Result:= ( inherited Items[ Index ] ) as TCoolSection2;
204end;
205
206{
207ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
208º º
209º Speed-Pascal/2 Version 2.0 º
210º º
211º Speed-Pascal Component Classes (SPCC) º
212º º
213º This section: TCoolBar2 Class Implementation º
214º º
215º (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited ! º
216º º
217ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
218}
219
220Procedure TCoolBar2.SetupComponent;
221Begin
222 Inherited SetupComponent;
223
224 FBackgroundBitmap := nil;
225// FBackgroundBitmap.Create;
226// FBackgroundBitmap.LoadFromResourceName('Cool');
227 FFlat:=True;
228 FMouseTimer.Create(Self);
229 Include(FMouseTimer.ComponentState, csDetail);
230 FMouseTimer.Interval := 50;
231 FMouseTimer.OnTimer := EvFMouseTimer;
232 Name:='CoolBar';
233 SectionsClass:=TCoolSections2;
234 FHotColor:= clBlue;
235End;
236
237Procedure TCoolBar2.SetFlat(NewValue:Boolean);
238Begin
239 If NewValue=FFlat Then exit;
240 FFlat:=NewValue;
241 Invalidate;
242End;
243
244Function TCoolBar2.GetSections:TCoolSections2;
245Begin
246 Result:=TCoolSections2(Inherited Sections);
247End;
248
249Procedure TCoolBar2.SetSections(NewValue:TCoolSections2);
250Begin
251 Inherited Sections:=NewValue;
252End;
253
254Procedure TCoolBar2.SetImages(NewValue:TImageList);
255Begin
256 If NewValue = FImages Then
257 exit;
258 If FImages<>Nil Then
259 FImages.Notification( Self, opRemove );
260 FImages:= NewValue;
261 If FImages <> Nil Then
262 FImages.FreeNotification( Self );
263 Invalidate;
264End;
265
266Procedure TCoolBar2.SetShowText( NewValue: boolean );
267begin
268 If NewValue = FShowText Then
269 exit;
270 FShowText := NewValue;
271 Invalidate;
272end;
273
274Procedure TCoolBar2.SetShowImages( NewValue: boolean );
275begin
276 If NewValue = FShowImages Then
277 exit;
278 FShowImages := NewValue;
279 Invalidate;
280end;
281
282Procedure TCoolBar2.SetMinConstButtonWidth;
283var
284 i: longint;
285 TextWidth: longint;
286 ImageWidth: longint;
287 Section: TCoolSection2;
288 Bitmap: TBitmap;
289 ButtonWidth: longint;
290begin
291 if Handle = 0 then
292 exit;
293
294 ButtonWidth := 0;
295
296 for i := 0 to Sections.Count - 1 do
297 begin
298 Section := Sections[ i ];
299
300 TextWidth := 0;
301
302 if FShowText then
303 TextWidth := Canvas.TextWidth( Section.Text );
304
305 ImageWidth := 0;
306
307 if ( FImages <> nil )
308 and FShowImages then
309 begin
310 if Section.Image < FImages.Count then
311 begin
312 Bitmap := FImages.GetBitmapReference( Section.Image );
313 ImageWidth := Bitmap.Width;
314 end;
315 end;
316
317 if TextWidth > ButtonWidth then
318 ButtonWidth := TextWidth;
319 if ImageWidth > ButtonWidth then
320 ButtonWidth := ImageWidth;
321 end;
322
323 inc( ButtonWidth, 8 ); // allow for borders etc
324
325 for i := 0 to Sections.Count - 1 do
326 begin
327 Section := Sections[ i ];
328 Section.Width := ButtonWidth;
329 end;
330
331end;
332
333Procedure TCoolBar2.Notification( AComponent: TComponent;
334 Operation: TOperation );
335Begin
336 Inherited Notification( AComponent, Operation );
337
338 If Operation = opRemove Then
339 If AComponent = FImages Then
340 FImages := Nil;
341End;
342
343
344Procedure TCoolBar2.SetBackgroundBitmap(NewValue:TBitmap);
345Begin
346 If NewValue=FBackgroundBitmap Then exit;
347 If FBackgroundBitmap<>Nil Then FBackgroundBitmap.Destroy;
348 If NewValue<>Nil Then FBackgroundBitmap:=NewValue.Copy
349 Else FBackgroundBitmap:=Nil;
350 Invalidate;
351End;
352
353Procedure TCoolBar2.SetBackgroundOffset(NewValue:LongWord);
354Begin
355 If NewValue=FBackgroundOffset Then exit;
356 FBackgroundOffset:=NewValue;
357 Invalidate;
358End;
359
360Procedure TCoolBar2.DrawSection(Section:TCoolSection2;Const rc:TRect;Pressed,Hot,Enabled:Boolean);
361Var
362 Align:TAlignment;
363 S:String;
364 CX,CY,CX1,CY1,H,X,Y:LongInt;
365 rec:TRect;
366 PointsArray:Array[0..5] Of TPoint;
367 offs:LongInt;
368 Bitmap,Mask:TBitmap;
369 bevelrc: TRect;
370 bgrc: TRect;
371
372 HaveText: boolean;
373 HaveImage: boolean;
374
375 Procedure DrawMasked(Bitmap,Mask:TBitmap;X,Y:LongInt);
376 Var Source,Dest:TRect;
377 Begin
378 If Bitmap=Nil Then exit;
379 Source.Left:=0;
380 Source.Bottom:=0;
381 Dest.Left:=X;
382 Dest.Bottom:=Y;
383
384 If Mask<>Nil Then
385 Begin
386 Source.Right:=Mask.Width;
387 Source.Top:=Mask.Height;
388 Dest.Top:=Dest.Bottom+Mask.Height;
389 Dest.Right:=Dest.Left+Mask.Width;
390 Mask.Canvas.BitBlt(Canvas,Dest,Source,cmSrcAnd,bitfIgnore);
391 End;
392
393 Source.Right:=Bitmap.Width;
394 Source.Top:=Bitmap.Height;
395 Dest.Top:=Dest.Bottom+Bitmap.Height;
396 Dest.Right:=Dest.Left+Bitmap.Width;
397 If Mask<>Nil Then
398 Bitmap.Canvas.BitBlt(Canvas,Dest,Source,cmSrcPaint,bitfIgnore)
399 Else
400 Bitmap.Canvas.BitBlt(Canvas,Dest,Source,cmSrcCopy,bitfIgnore);
401
402// Canvas.ExcludeClipRect(Dest);
403 End;
404
405 Procedure DestroyIfEmpty( Var Bitmap: TBitmap );
406 Begin
407 If Bitmap<>Nil Then
408 Begin
409 If Bitmap.Empty Then
410 begin
411 Bitmap.Destroy;
412 Bitmap := Nil;
413 End;
414 End;
415 End;
416
417Begin
418 Align:=section.Alignment;
419 S:=section.Text;
420
421 HaveText := ( S <> '' )
422 and FShowText;
423 If not HaveText Then
424 Begin
425 CX:=0;
426 CY:=0;
427 End
428 Else Canvas.GetTextExtent(S,CX,CY);
429
430 // First get or generate bitmap to draw.
431
432 Bitmap := Nil;
433 Mask := Nil;
434
435 If ( FImages <> Nil )
436 and FShowImages Then
437 Begin
438 If FImages.Count>0 Then
439 Begin
440 If not Enabled Then
441 Begin
442 If Section.DisabledImage>=0 Then
443 begin
444 If FImages.Count>Section.DisabledImage Then
445 Begin
446 Bitmap := TBitmap.Create;
447 FImages.GetBitmap(Section.DisabledImage,Bitmap);
448 Mask := TBitmap.Create;
449 Images.GetMask(Section.DisabledImage,Mask);
450 End;
451 end
452 else
453 begin
454 Bitmap := TBitmap.Create;
455 FImages.GetBitmap(Section.Image,Bitmap);
456 Mask := TBitmap.Create;
457 FImages.GetMask(Section.Image,Mask);
458 Y:= 0;
459 while Y < Mask.Height do
460 begin
461 X:= 0;
462 if ( Y mod 2 ) = 1 then
463 X:= 1;
464 while X < Mask.Width do
465 begin
466 Mask.Canvas.Pixels[ X, Y ]:= clBlack;
467 Bitmap.Canvas.Pixels[ X, Y ]:= clBlack;
468 inc( X, 2 );
469 end;
470 inc( Y, 1 );
471 end;
472 end;
473 End
474 Else If Hot Then
475 Begin
476 If Section.HotImage>=0 Then
477 If Section.HotImage < FImages.Count Then
478 Begin
479 Bitmap := TBitmap.Create;
480 FImages.GetBitmap(Section.HotImage,Bitmap);
481 Mask := TBitmap.Create;
482 FImages.GetMask(Section.HotImage,Mask);
483 End;
484 End;
485
486 DestroyIfEmpty( Bitmap );
487 DestroyIfEmpty( Mask );
488
489 If Bitmap=Nil Then
490 Begin
491 If Section.Image>=0 Then
492 If FImages.Count>Section.Image Then
493 Begin
494 Bitmap := TBitmap.Create;
495 FImages.GetBitmap(Section.Image,Bitmap);
496 Mask := TBitmap.Create;
497 FImages.GetMask(Section.Image,Mask);
498 End;
499 End;
500
501 DestroyIfEmpty( Bitmap );
502 DestroyIfEmpty( Mask );
503 End;
504 End;
505
506 CX1:=CX;
507 CY1:=CY;
508
509 HaveImage := Bitmap <> Nil;
510
511 If HaveImage Then
512 Begin
513 If Align=taCenter Then
514 inc(CY1,Bitmap.Height)
515 Else
516 inc(CX1,Bitmap.Width);
517
518 If HaveText Then
519 // space between
520 If Align=taCenter Then
521 inc(CY1,3)
522 Else
523 inc(CX1,3);
524 End;
525
526 Case Align Of
527 taLeftJustify:
528 Begin
529 H:=rc.Right-rc.Left;
530 rec.Left:=rc.Left+((H-CX1) Div 2);
531 End;
532 taRightJustify:
533 Begin
534 H:=rc.Right-rc.Left;
535 rec.Left:=rc.Left+((H-CX1) Div 2);
536 If Bitmap<>Nil Then inc(rec.Left,Bitmap.Width);
537 End
538 Else //taCenter
539 Begin
540 H:=rc.Right-rc.Left;
541 rec.Left:=rc.Left+((H-CX) Div 2);
542 End;
543 End; //Case
544
545 If rec.Left<rc.Left+3 Then rec.Left:=rc.Left+3;
546
547 H:=rc.Top-rc.Bottom;
548 rec.Bottom:=rc.Bottom+((H-CY1) Div 2);
549 If rec.Bottom<rc.Bottom+3 Then rec.Bottom:=rc.Bottom+3;
550 rec.Right:=rec.Left+CX-1;
551 rec.Top:=rec.Bottom+CY-1;
552
553 // Draw background
554 bgrc:= rc;
555 If ((not Flat)Or(Hot And Enabled)) Then
556 InflateRect( bgrc,
557 - ( 1 + BevelWidth ),
558 - ( 1 + BevelWidth ) );
559
560 if Pressed then
561 DrawBackground( bgrc, 1, -1 )
562 else
563 DrawBackground( bgrc, 0, 0 );
564
565 // Draw Bitmap
566 If Bitmap<>Nil Then
567 Begin
568 H:=rc.Top-rc.Bottom;
569 Y:=rc.Bottom+((H-CY1) Div 2);
570 If Y<rc.Bottom+3 Then Y:=rc.Bottom+3;
571
572 Canvas.Pen.Color:= clBlack;
573 Case Align Of
574 taLeftJustify:
575 Begin
576 DrawMasked(Bitmap,Mask,rec.Right+3,Y);
577 End;
578 taRightJustify:
579 Begin
580 DrawMasked(Bitmap,Mask,rec.Left-3-Bitmap.Width,Y);
581 End;
582 Else //taCenter
583 Begin
584 H:=rc.Right-rc.Left;
585 X:=rc.Left+((H-Bitmap.Width) Div 2);
586 If X<rc.Left+3 Then X:=rc.Left+3;
587 if Pressed then
588 begin
589 inc( X );
590 dec( Y );
591 end;
592 if HaveText then
593 inc( Y, 3 );
594 DrawMasked(Bitmap,Mask,X,Y+CY);
595 End;
596 End; //Case
597
598 Bitmap.Destroy;
599 If Mask<>Nil Then Mask.Destroy;
600 End;
601
602 // Draw text
603 If ( S <> '' )
604 And FShowText Then
605 Begin
606 Canvas.Brush.Mode:=bmTransparent;
607 If not Enabled Then
608 Canvas.Pen.Color:=clDkGray
609 Else if Hot then
610 Canvas.Pen.Color:= FHotColor
611 else
612 Canvas.Pen.Color:=PenColor;
613
614 if Pressed then
615 Canvas.TextOut(rec.Left+1,rec.Bottom-1,S)
616 else
617 Canvas.TextOut(rec.Left,rec.Bottom,S);
618 Canvas.Brush.Mode:=bmOpaque;
619
620// Canvas.ExcludeClipRect(rec);
621 End;
622
623 If ((not Flat)Or(Hot And Enabled)) Then
624 Begin
625 // draw button outline
626 Canvas.Pen.Color:= clBlack;
627 Canvas.Rectangle( rc );
628 bevelrc:= rc;
629 InflateRect( bevelrc, -1, -1 );
630 If BevelWidth > 1 Then
631 Begin
632 offs := BevelWidth-1;
633 PointsArray[0] := Point(bevelrc.Left,bevelrc.Bottom);
634 PointsArray[1] := Point(bevelrc.Left+offs,bevelrc.Bottom+offs);
635 PointsArray[2] := Point(bevelrc.Left+offs,bevelrc.Top-offs);
636 PointsArray[3] := Point(bevelrc.Right-offs,bevelrc.Top-offs);
637 PointsArray[4] := Point(bevelrc.Right,bevelrc.Top);
638 PointsArray[5] := Point(bevelrc.Left,bevelrc.Top);
639 if Pressed then
640 Canvas.Pen.color := clDkGray
641 else
642 Canvas.Pen.color := clWhite;
643 Canvas.Polygon(PointsArray);
644 PointsArray[2] := Point(bevelrc.Right-offs,bevelrc.Bottom+offs);
645 PointsArray[3] := Point(bevelrc.Right-offs,bevelrc.Top-offs);
646 PointsArray[4] := Point(bevelrc.Right,bevelrc.Top);
647 PointsArray[5] := Point(bevelrc.Right,bevelrc.Bottom);
648 if Pressed then
649 Canvas.Pen.color := clWhite
650 else
651 Canvas.Pen.color := clDkGray;
652 Canvas.Polygon(PointsArray);
653 Canvas.Pen.color:=PenColor;
654 End
655 Else
656 if Pressed then
657 Canvas.ShadowedBorder(bevelrc,clDkGray,clWhite)
658 else
659 Canvas.ShadowedBorder(bevelrc,clWhite,clDkGray);
660 End;
661End;
662
663Type
664 PHeaderItem=^THeaderItem;
665 THeaderItem=Record
666 Image:LongInt;
667 HotImage:LongInt;
668 DisabledImage:LongInt;
669 Disabled:Boolean;
670 End;
671
672Const rnCoolHeaders='rnCoolHeaders';
673
674Procedure TCoolBar2.ReadSCUResource(Const ResName:TResourceName;Var Data;DataLen:LongInt);
675Var
676 Count:^LongInt;
677 Items:PHeaderItem;
678 section:TCoolSection2;
679 T:LongInt;
680Begin
681 If ResName = rnCoolHeaders Then
682 Begin
683 Count:=@Data;
684 Items:=@Data;
685 Inc(Items,4);
686 For T:=1 To Count^ Do
687 Begin
688 Section:=TCoolSection2(Sections[t-1]);
689 section.Image:=Items^.Image;
690 section.HotImage:=Items^.HotImage;
691 section.DisabledImage:=Items^.DisabledImage;
692 section.Disabled:=Items^.Disabled;
693 Inc(Items,SizeOf(THeaderItem));
694 End;
695 End
696 Else Inherited ReadSCUResource(ResName,Data,DataLen);
697End;
698
699
700Function TCoolBar2.WriteSCUResource(Stream:TResourceStream):Boolean;
701Var MemStream:TMemoryStream;
702 T:LongInt;
703 Item:THeaderItem;
704 section:TCoolSection2;
705Begin
706 Result := Inherited WriteSCUResource(Stream);
707 If Not Result Then Exit;
708
709 If Sections<>Nil Then If Sections.Count>0 Then
710 Begin
711 MemStream.Create;
712 T:=Sections.Count;
713 MemStream.Write(T,4);
714 For T:=0 To Sections.Count-1 Do
715 Begin
716 section:=TCoolSection2(Sections[T]);
717 Item.Image:=section.Image;
718 Item.HotImage:=section.HotImage;
719 Item.DisabledImage:=section.DisabledImage;
720 Item.Disabled:=section.Disabled;
721 MemStream.Write(Item,SizeOf(THeaderItem));
722 End;
723
724 Result:=Stream.NewResourceEntry(rnCoolHeaders,MemStream.Memory^,MemStream.Size);
725 MemStream.Destroy;
726 End;
727End;
728
729Procedure TCoolbar2.DrawBackground( rec: TRect;
730 XOffset, YOffset: longint );
731var
732 X: longint;
733 Y: longint;
734 DrawRect: TRect;
735 SourceRect: TRect;
736 BlockWidth: longint;
737 BlockHeight: longint;
738 BitmapX: longint;
739 BitmapY: longint;
740begin
741 If FBackgroundBitmap=Nil Then
742 begin
743 Canvas.FillRect( rec, Color );
744 exit;
745 end;
746
747 Y:= rec.Bottom;
748 While Y<=rec.Top Do
749 Begin
750 BitmapY:= ( Y - YOffset ) mod FBackGroundBitmap.Height;
751 if BitmapY < 0 then
752 BitmapY:= FBackGroundBitmap.Height + BitmapY;
753
754 BlockHeight:= FBackgroundBitmap.Height - BitmapY;
755 if Y + BlockHeight > rec.Top then
756 BlockHeight:= rec.Top - Y + 1;
757
758 X:= rec.Left;
759 While X<=rec.Right Do
760 Begin
761 BitmapX:= ( X - XOffset ) mod FBackgroundBitmap.Width;
762 if BitmapX < 0 then
763 BitmapX:= FBackgroundBitmap.Width + BitmapX;
764
765 BlockWidth:= FBackgroundBitmap.Width - BitmapX;
766 if X + BlockWidth > rec.Right then
767 BlockWidth:= rec.Right - X + 1;
768
769 DrawRect.Left:= X;
770 DrawRect.Right:= X + BlockWidth;
771 DrawRect.Bottom:= Y;
772 DrawRect.Top:= Y + BlockHeight;
773
774 SourceRect.Left:= BitmapX;
775 SourceRect.Right:= BitmapX + BlockWidth;
776 SourceRect.Bottom:= BitmapY;
777 SourceRect.Top:= BitmapY + BlockHeight;
778
779 FBackgroundBitmap.PartialDraw( Canvas,
780 SourceRect,
781 DrawRect );
782 inc( X, BlockWidth );
783 End;
784 inc( Y, BlockHeight );
785 End;
786end;
787
788Procedure TCoolBar2.Redraw(Const rec:TRect);
789Var rc,rc2:TRect;
790 FSections:TCoolSections2;
791 Section:TCoolSection2;
792 IsPressed:Boolean;
793 t:LongInt;
794Begin
795 Canvas.ClipRect:=rec;
796
797 Canvas.Pen.Color:= clDkGray;
798 Canvas.Line( 0, 0, Width -1, 0 );
799// Canvas.Pen.Color:= cl3dLight;
800// Canvas.Line( 0, 0, Width -1, 0 );
801
802 FSections:=TCoolSections2(Sections);
803 rc:=ClientRect;
804 Inc(rc.Bottom,1);
805 For T:=0 To FSections.Count-1 Do
806 Begin
807 Section:=TCoolSection2(FSections[T]);
808 rc.Right:=rc.Left+section.Width;
809 If rc.Right>Width-1 Then rc.Right:=Width-1;
810
811 IsPressed:=Section=ClickSection;
812
813 rc2:=Forms.IntersectRect(rc,rec);
814 If Not Forms.IsRectEmpty(rc2) Then
815 Begin
816 Canvas.ClipRect:=rc2;
817
818 If ( Section.Style=hsOwnerDraw )
819 and ( OnDrawSection<>Nil ) Then
820 OnDrawSection(Self,section,rc,IsPressed,Section=FActiveSection,Section.Disabled=False)
821 Else
822 DrawSection(section,rc,IsPressed,Section=FActiveSection,Section.Disabled=False);
823 End;
824
825 // draw space between this button and next
826 rc2:= rc;
827 rc2.Left:= rc.Right + 1;
828 rc2.Right:= rc2.Left + Spacing - 1;
829 rc2:=Forms.IntersectRect(rc2,rec);
830
831 If Not Forms.IsRectEmpty(rc2) Then
832 Begin
833 Canvas.ClipRect:=rc2;
834 DrawBackGround( rc2, 0, 0 );
835 end;
836
837 Inc(rc.Left,Section.Width+Spacing+1);
838 End;
839
840 rc.Right:= Width-1;
841 rc2:=Forms.IntersectRect(rc,rec);
842 If Not Forms.IsRectEmpty(rc2) Then
843 Begin
844 inc(rc2.Right);
845 Canvas.ClipRect:=rc2;
846 DrawBackground( rc, 0, 0 );
847 end;
848 Canvas.DeleteClipRegion;
849End;
850
851Procedure TCoolBar2.MouseDown(Button:TMouseButton;ShiftState:TShiftState;X,Y:LongInt);
852Var T:LongInt;
853 section:TCoolSection2;
854 FSections:TCoolSections2;
855Begin
856 TControl.MouseDown(Button,ShiftState,X,Y);
857
858 If Button <> mbLeft Then Exit;
859
860 FSections:=TCoolSections2(Sections);
861 For T:=0 To FSections.Count-1 Do
862 Begin
863 section:=TCoolSection2(FSections[T]);
864 If ((section.AllowSize)And(X>section.Right-2)And(X<section.Right+2)) Then
865 Begin
866 Inherited MouseDown(Button,ShiftState,X,Y);
867 exit;
868 End;
869 End;
870
871 If Designed Then Exit;
872
873 //Test Press
874 Section:=TCoolSection2(GetMouseHeader(X,Y));
875 If Section<>Nil Then If section.AllowClick Then If not Section.Disabled Then
876 Inherited MouseDown(Button,ShiftState,X,Y);
877End;
878
879Procedure TCoolBar2.MouseDblClick(Button:TMouseButton;ShiftState:TShiftState;X,Y:LongInt);
880Var section:TCoolSection2;
881Begin
882 If Button=mbLeft Then
883 Begin
884 Section:=TCoolSection2(GetMouseHeader(X,Y));
885 If Section<>Nil Then If section.AllowClick Then If not Section.Disabled Then
886 Inherited MouseDblClick(Button,ShiftState,X,Y);
887 End
888 Else Inherited MouseDblClick(Button,ShiftState,X,Y);
889End;
890
891Procedure TCoolBar2.UpdateHeader(Header:THeaderSection);
892Var T:LongInt;
893 rc:TRect;
894 FSections:TCoolSections2;
895Begin
896 //Get Rectangle For the Panel
897 rc:=ClientRect;
898 FSections:=TCoolSections2(Sections);
899 For T:=0 To FSections.Count-1 Do
900 Begin
901 If FSections[T]=Header Then break
902 Else Inc(rc.Left,FSections[T].Width+Spacing+1);
903 End;
904
905 rc.Right:=rc.Left+Header.Width+1;
906 If not Flat Then InflateRect(rc,-BevelWidth*2,-BevelWidth*2);
907 InvalidateRect(rc);
908 Update;
909End;
910
911
912Procedure TCoolBar2.MouseMove(ShiftState:TShiftState;X,Y:LongInt);
913Var
914 OldActiveSection:TCoolSection2;
915Begin
916 FMouseTimer.Stop;
917
918 OldActiveSection:=FActiveSection;
919 FActiveSection:=TCoolSection2(GetMouseHeader(X,Y));
920
921 if FActiveSection <> nil Then
922 if FActiveSection.Disabled Then
923 FActiveSection := nil;
924
925 If FActiveSection<>OldActiveSection Then
926 Begin
927 If FActiveSection <> nil Then
928 Hint := FActiveSection.Hint
929 Else
930 Hint := '';
931 End;
932
933 Inherited MouseMove(ShiftState,X,Y);
934
935 If FActiveSection<>OldActiveSection Then
936 Begin
937 If OldActiveSection<>Nil Then UpdateHeader(OldActiveSection);
938 If FActiveSection<>Nil Then UpdateHeader(FActiveSection);
939 End;
940
941 If FFlat Then FMouseTimer.Start;
942End;
943
944
945Procedure TCoolBar2.EvFMouseTimer(Sender:TObject);
946Var
947 AControl:TControl;
948 OldActiveSection:TCoolSection2;
949Begin
950 FMouseTimer.Stop;
951
952 AControl := Screen.GetControlFromPoint(Screen.MousePos);
953
954 If AControl <> Self Then
955 Begin
956 OldActiveSection:=FActiveSection;
957 FActiveSection := Nil;
958 If OldActiveSection<>Nil Then UpdateHeader(OldActiveSection);
959 End
960 Else FMouseTimer.Start;
961End;
962
963Procedure TCoolBar2.EditSections;
964begin
965 CallClassPropertyEditor( FSections );
966end;
967
968{
969ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
970º º
971º Sibyl Version 2.0 º
972º º
973º This section: TCoolSectionsPropertyEditor Class implementation º
974º º
975º º
976ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
977}
978
979Type
980 TCoolSectionsPropertyEditor=Class(TClassPropertyEditor)
981 Public
982 Function Execute(Var ClassToEdit:TObject):TClassPropertyEditorReturn;Override;
983 End;
984
985 TCoolSectionsPropEditDialog=Class(TDialog)
986 Private
987 FSections:TCoolSections2;
988 FListBox:TListBox;
989 FText:TEdit;
990 FWidth:TEdit;
991 FMinWidth,FMaxWidth:TEdit;
992 FImage,FHotImage,FDisabledImage:TEdit;
993 FStyle:TComboBox;
994 FAlignment:TComboBox;
995 FAllowClick:TCheckBox;
996 FAllowSize:TCheckBox;
997 FDisabled:TCheckBox;
998 FCurrentSection:TCoolSection2;
999 Protected
1000 Function GetCurrentSection: TCoolSection2;
1001 Procedure SetupComponent;Override;
1002 Procedure RefreshListBox;
1003 Procedure NewClicked(Sender:TObject);
1004 Procedure DeleteClicked(Sender:TObject);
1005 Procedure UpdateClicked(Sender:TObject);
1006 Procedure MoveUpClicked(Sender:TObject);
1007 Procedure MoveDownClicked(Sender:TObject);
1008 Procedure ListItemFocus(Sender:TObject;Index:LongInt);
1009 Procedure SetupShow; override;
1010 Procedure StoreItem;
1011 End;
1012
1013Function TCoolSectionsPropEditDialog.GetCurrentSection: TCoolSection2;
1014begin
1015 Result := FCurrentSection;
1016end;
1017
1018{$HINTS OFF}
1019
1020Procedure TCoolSectionsPropEditDialog.UpdateClicked(Sender:TObject);
1021Begin
1022 StoreItem;
1023 FSections.Update(Nil);
1024End;
1025
1026Procedure TCoolSectionsPropEditDialog.NewClicked(Sender:TObject);
1027Var
1028 Section: THeaderSection;
1029Begin
1030 StoreItem;
1031 Section:= FSections.Add;
1032 RefreshListBox;
1033 FListBox.ItemIndex:= Section.Index;
1034 FText.SetFocus;
1035End;
1036
1037Procedure TCoolSectionsPropEditDialog.RefreshListBox;
1038Var
1039 Index: LongInt;
1040 Section: TCoolSection2;
1041Begin
1042 FListBox.BeginUpdate;
1043 FListBox.Clear;
1044 for Index := 0 to FSections.Count - 1 do
1045 begin
1046 Section := FSections[ Index ];
1047 FListBox.Items.AddObject( ToStr( Index )
1048 + ' - '
1049 + Section.Text,
1050 Section );
1051 end;
1052 FListBox.EndUpdate;
1053
1054 FSections.Update( Nil );
1055end;
1056
1057Procedure TCoolSectionsPropEditDialog.DeleteClicked(Sender:TObject);
1058Var
1059 Section: THeaderSection;
1060 Index: longint;
1061Begin
1062 Section:= GetCurrentSection;
1063 Index := Section.Index;
1064 Section.Destroy;
1065
1066 FCurrentSection := nil; // so we don't crash in storeitem
1067 RefreshListBox;
1068
1069 // Select the next section (now in the same position)
1070 // or the previous if we deleted the last item
1071 if FSections.Count > 0 then
1072 begin
1073 if Index < FSections.Count then
1074 FListBox.ItemIndex := Index
1075 else
1076 FListBox.ItemIndex := Index - 1;
1077 end;
1078End;
1079
1080Procedure TCoolSectionsPropEditDialog.MoveUpClicked(Sender:TObject);
1081Var
1082 Section: THeaderSection;
1083 Index: longint;
1084Begin
1085 StoreItem;
1086
1087 Section := GetCurrentSection;
1088 If Section = nil Then
1089 exit;
1090
1091 Index := Section.Index;
1092 if Index <= 0 then
1093 // can't move top section up
1094 exit;
1095 FSections.Swap( Index, Index - 1 );
1096 RefreshListBox;
1097 FListBox.ItemIndex := Index - 1;
1098End;
1099
1100Procedure TCoolSectionsPropEditDialog.MoveDownClicked(Sender:TObject);
1101Var
1102 Section: THeaderSection;
1103 Index: longint;
1104Begin
1105 StoreItem;
1106
1107 Section := GetCurrentSection;
1108 If Section = nil Then
1109 exit;
1110
1111 Index := Section.Index;
1112 if Index >= FSections.Count - 1 then
1113 // can't move bottom section down
1114 exit;
1115 FSections.Swap( Index, Index + 1 );
1116 RefreshListBox;
1117 FListBox.ItemIndex := Index + 1;
1118End;
1119
1120{$HINTS ON}
1121
1122Procedure TCoolSectionsPropEditDialog.StoreItem;
1123Var
1124 c: Integer;
1125 i: LongInt;
1126 Section: TCoolSection2;
1127Begin
1128 Section := GetCurrentSection;
1129 if Section = nil then
1130 exit;
1131
1132 if FText.Text <> Section.Text then
1133 begin
1134 // Text has changed, refresh the display
1135 Section.Text:= FText.Text;
1136 RefreshListBox;
1137 FListBox.ItemIndex := Section.Index;
1138 end;
1139
1140 VAL(FWidth.Text,i,c);
1141 If c<>0 Then
1142 i:=100;
1143 Section.Width:=i;
1144
1145 VAL(FMinWidth.Text,i,c);
1146 If c<>0 Then
1147 i:=0;
1148 Section.MinWidth:=i;
1149
1150 VAL(FMaxWidth.Text,i,c);
1151 If c<>0 Then
1152 i:=10000;
1153 Section.MaxWidth:=i;
1154
1155 VAL(FImage.Text,i,c);
1156 If c<>0 Then
1157 i:=10000;
1158 Section.Image:=i;
1159
1160 VAL(FHotImage.Text,i,c);
1161 If c<>0 Then
1162 i:=10000;
1163 Section.HotImage:=i;
1164
1165 VAL(FDisabledImage.Text,i,c);
1166 If c<>0 Then
1167 i:=10000;
1168 Section.DisabledImage:=i;
1169
1170 Section.Disabled:=FDisabled.Checked;
1171
1172 If FStyle.Text='OwnerDraw' Then
1173 Section.Style:=hsOwnerDraw
1174 Else
1175 Section.Style:=hsText;
1176
1177 If FAlignment.Text='Center' Then
1178 Section.Alignment:=taCenter
1179 Else If FAlignment.Text='Right justify' Then
1180 Section.Alignment:=taRightJustify
1181 Else
1182 Section.Alignment:=taLeftJustify;
1183
1184 Section.AllowClick:=FAllowClick.Checked;
1185 Section.AllowSize:=FAllowSize.Checked;
1186
1187End;
1188
1189Procedure TCoolSectionsPropEditDialog.ListItemFocus(Sender:TObject;Index:LongInt);
1190var
1191 Section: TCoolSection2;
1192Begin
1193 StoreItem;
1194
1195 Section := FSections[ Index ];
1196 FCurrentSection := Section;
1197
1198 FText.Text:= Section.Text;
1199 FWidth.Text:=tostr( Section.Width);
1200 FMinWidth.Text:=tostr( Section.MinWidth);
1201 FMaxWidth.Text:=tostr( Section.MaxWidth);
1202 FImage.Text:=tostr( Section.Image);
1203 FHotImage.Text:=tostr( Section.HotImage);
1204 FDisabledImage.Text:=tostr( Section.DisabledImage);
1205 FDisabled.Checked:= Section.Disabled;
1206 If Section.Style=hsText Then
1207 FStyle.Text:='Text'
1208 Else
1209 FStyle.Text:='OwnerDraw';
1210
1211 Case Section.Alignment Of
1212 taRightJustify:
1213 FAlignment.Text:='Right justify';
1214 taCenter:
1215 FAlignment.Text:='Center';
1216 Else
1217 FAlignment.Text:='Left justify';
1218 End;
1219
1220 FAllowClick.Checked:= Section.AllowClick;
1221 FAllowSize.Checked:= Section.AllowSize;
1222End;
1223
1224Procedure TCoolSectionsPropEditDialog.SetupComponent;
1225Var
1226 Button: TButton;
1227Begin
1228 Inherited SetupComponent;
1229
1230 Caption:='CoolBar sections editor';
1231 Width:=445;
1232 Height:=380;
1233
1234 InsertGroupBox(Self,10,50,180,290,'Sections');
1235 FListBox:=InsertListBox(Self,20,140,160,180,'');
1236 FListBox.OnItemFocus:=ListItemFocus;
1237
1238 Button:=InsertButton(Self,20,60,70,30,'&New','New Section');
1239 Button.OnClick:=NewClicked;
1240 Button:=InsertButton(Self,100,60,70,30,'&Delete','Delete Section');
1241 Button.OnClick:=DeleteClicked;
1242
1243 Button:=InsertButton(Self,100,100,70,30,'&Up','Move Section Up');
1244 Button.OnClick:=MoveUpClicked;
1245 Button:=InsertButton(Self,20,100,70,30,'Do&wn','Move Section Down');
1246 Button.OnClick:=MoveDownClicked;
1247
1248 InsertGroupBox(Self,200,50,230,290,'Section Properties');
1249
1250 InsertLabel(Self,210,290,50,20,'Text');
1251 FText:=InsertEdit(Self,280,295,140,20,'','');
1252
1253 InsertLabel(Self,210,260,100,20,'Width');
1254 FWidth:=InsertEdit(Self,280,265,140,20,'','');
1255 FWidth.NumbersOnly:=TRUE;
1256
1257 InsertLabel(Self,210,230,60,20,'Min/Max');
1258 FMinWidth:=InsertEdit(Self,280,235,65,20,'','');
1259 FMinWidth.NumbersOnly:=TRUE;
1260 FMaxWidth:=InsertEdit(Self,355,235,65,20,'','');
1261 FMaxWidth.NumbersOnly:=TRUE;
1262
1263 InsertLabel(Self,210,200,100,20,'Style');
1264 FStyle:=InsertComboBox(Self,280,205,140,20,csDropDownList);
1265 FStyle.Items.Add('Text');
1266 FStyle.Items.Add('OwnerDraw');
1267
1268 InsertLabel(Self,210,170,100,20,'Alignment');
1269 FAlignment:=InsertComboBox(Self,280,175,140,20,csDropDownList);
1270 FAlignment.Items.Add('Left justify');
1271 FAlignment.Items.Add('Right justify');
1272 FAlignment.Items.Add('Center');
1273
1274 FAllowClick:=InsertCheckBox(Self,210,135,100,20,'Allow Click','');
1275 FAllowSize:=InsertCheckBox(Self,210,115,100,20,'Allow Size','');
1276 FDisabled:=InsertCheckBox(Self,210,95,100,20,'Disabled','');
1277
1278 InsertLabel(Self,300,133,100,20,'Image');
1279 FImage:=InsertEdit(Self,400,138,20,20,'','');
1280 FImage.NumbersOnly:=TRUE;
1281
1282 InsertLabel(Self,300,113,100,20,'HotImage');
1283 FHotImage:=InsertEdit(Self,400,118,20,20,'','');
1284 FHotImage.NumbersOnly:=TRUE;
1285
1286 InsertLabel(Self,300,93,100,20,'DisabledImage');
1287 FDisabledImage:=InsertEdit(Self,400,98,20,20,'','');
1288 FDisabledImage.NumbersOnly:=TRUE;
1289
1290 Button:=InsertButton(Self,210,60,200,30,'Update','Update Section');
1291 Button.OnClick:=UpdateClicked;
1292
1293 InsertBitBtn(Self,10,10,90,30,bkOk,'~Ok','Click here to accept');
1294 InsertBitBtn(Self,110,10,90,30,bkCancel,'~Cancel','Click here to cancel');
1295 InsertBitBtn(Self,210,10,90,30,bkHelp,'~Help','Click here to get help');
1296
1297 FCurrentSection := nil;
1298End;
1299
1300Procedure TCoolSectionsPropEditDialog.SetupShow;
1301begin
1302 inherited SetupShow;
1303 RefreshListBox;
1304 If FSections.Count > 0 Then
1305 FListBox.ItemIndex:= 0;
1306end;
1307
1308Function TCoolSectionsPropertyEditor.Execute(Var ClassToEdit:TObject):TClassPropertyEditorReturn;
1309Var
1310 HeaderSections: TCoolSections2;
1311 FDialog: TCoolSectionsPropEditDialog;
1312 SaveHeaders: TCoolSections2;
1313Begin
1314 HeaderSections:=TCoolSections2(ClassToEdit);
1315 If HeaderSections.HeaderControl=Nil Then
1316 Begin
1317 result:=peNoEditor;
1318 exit;
1319 End;
1320
1321 SaveHeaders.Create(Nil);
1322 SaveHeaders.Assign(HeaderSections);
1323
1324 FDialog.Create(Nil);
1325 FDialog.FSections:=HeaderSections;
1326 FDialog.ShowModal;
1327
1328 //Modify ClassToEdit here
1329 result:=peCancel;
1330 Case FDialog.ModalResult Of
1331 cmOk:
1332 Begin
1333 FDialog.StoreItem;
1334 result:=peOk;
1335 End;
1336 Else
1337 Begin
1338 HeaderSections.Assign(SaveHeaders);
1339 result:=peCancel;
1340 End;
1341 End; {Case}
1342
1343 SaveHeaders.Destroy;
1344 FDialog.Destroy;
1345End;
1346
1347Initialization
1348 RegisterClasses([TCoolBar2]);
1349 //Register property editor
1350 AddClassPropertyEditor(TCoolSections2,TCoolSectionsPropertyEditor);
1351End.
1352
Note: See TracBrowser for help on using the repository browser.