1 {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
3 KKKKK KKKKK OOOOOOOOO LLLLL
4 KKKKK KKKKK OOOOOOOOOOOOO LLLLL
5 KKKKK KKKKK OOOOO OOOOO LLLLL
6 KKKKK KKKKK OOOOO OOOOO LLLLL
7 KKKKKKKKKK OOOOO OOOOO LLLLL
8 KKKKK KKKKK OOOOO OOOOO LLLLL
9 KKKKK KKKKK OOOOO OOOOO LLLLL
10 KKKKK KKKKK OOOOOOOOOOOOO LLLLLLLLLLLLL kkkkk
11 KKKKK KKKKK OOOOOOOOO LLLLLLLLLLLLL kkkkk
13 mmmmm mmmmm mmmmmm cccccccccccc kkkkk kkkkk
14 mmmmmmmm mmmmm mmmmm cccccc ccccc kkkkk kkkkk
15 mmmmmmmm mmmmm mmmmm cccccc kkkkkkkk
16 mmmmm mmmmm mmmmm cccccc ccccc kkkkk kkkkk
17 mmmmm mmmmm mmmmm cccccccccccc kkkkk kkkkk
19 Key Objects Library (C) 2000 by Kladov Vladimir.
20 KOL Mirror Classes Kit (C) 2000 by Kladov Vladimir.
24 This unit contains definitions for mirrors of the most of visual controls,
25 defined in KOL. This mirror objects are placed on form at design time and
26 behave itselves like usual VCL visual components (controls). But after
27 compiling of the project (and at run time) these are transformed to poor KOL
28 controls, so all bloats of VCL are removed and executable file become very small.
30 Äàííûé ìîäóëü ñîäåðæèò îïðåäåëåíèå çåðêàë äëÿ áîëüøèíñòâà âèçóàëüíûõ îáúåêòîâ,
31 îïðåäåëåííûõ â áèáëèîòåêå KOL. Çåðêàëüíûå îáúåêòû ïîìåùàþòñÿ íà ôîðìó âî âðåìÿ
32 ïðîåêòèðîâàíèÿ è âåäóò ñåáÿ òàê æå, êàê îáû÷íûå âèçóàëüíûå îáúåêòû VCL. Íî
33 ïîñëå êîìïèëÿöèè ïðîåêòà (è âî âðåìÿ èñïîëíåíèÿ) îíè òðàíñôîðìèðóþòñÿ â
34 îáúåêòû KOL, òàê ÷òî âñå "íàâîðîòû" VCL óäàëÿþòñÿ è èñïîëíèìûé ôàéë ñòàíîâèòñÿ
42 uses KOL
, Classes
, Forms
, Controls
, Dialogs
, Windows
, Messages
, extctrls
,
43 stdctrls
, comctrls
, CommCtrl
, SysUtils
, Graphics
, mirror
, ShellAPI
,
45 //////////////////////////////////////////////////
46 {$IFDEF _D6orHigher} //
47 DesignIntf
, DesignEditors
, DesignConst
, //
50 //////////////////////////////////////////////////
52 //////////////////////////////////////////////////////////
54 mckToolbarEditor
, mckLVColumnsEditor
59 //============================================================================
60 //---- MIRROR FOR A BUTTON ----
61 //---- ÇÅÐÊÀËÎ ÄËß ÊÍÎÏÊÈ ----
62 TKOLButton
= class(TKOLControl
)
64 FpopupMenu
: TKOLPopupMenu
;
65 FLikeSpeedButton
: Boolean;
68 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
69 procedure SetLikeSpeedButton(const Value
: Boolean);
70 procedure Setimage(const Value
: TPicture
);
71 procedure SetFlat(const Value
: Boolean);
73 function TabStopByDefault
: Boolean; override;
74 procedure FirstCreate
; override;
75 function GenerateTransparentInits
: String; override;
76 function SetupParams( const AName
, AParent
: String ): String; override;
77 procedure SetupColor( SL
: TStrings
; const AName
: String ); override;
78 procedure SetupFont( SL
: TStrings
; const AName
: String ); override;
79 procedure SetupTextAlign( SL
: TStrings
; const AName
: String ); override;
80 function ClientMargins
: TRect
; override;
81 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
82 function CanNotChangeFontColor
: Boolean; override;
83 function DefaultParentColor
: Boolean; override;
84 function CanChangeColor
: Boolean; override;
85 procedure Paint
; override;
86 function WYSIWIGPaintImplemented
: Boolean; override;
87 function NoDrawFrame
: Boolean; override;
88 procedure CreateKOLControl(Recreating
: boolean); override;
89 function ImageResourceName
: String;
90 function TypeName
: String; override;
92 constructor Create( AOwner
: TComponent
); override;
93 destructor Destroy
; override;
96 property VerticalAlign
;
104 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
105 property LikeSpeedButton
: Boolean read FLikeSpeedButton write SetLikeSpeedButton
;
109 property image
: TPicture read Fimage write Setimage
;
112 property Flat
: Boolean read FFlat write SetFlat
; // only for not windowed ?
116 //============================================================================
117 //---- MIRROR FOR A BIT BUTTON ----
118 //---- ÇÅÐÊÀËÎ ÄËß ÐÈÑÎÂÀÍÍÎÉ ÊÍÎÏÊÈ ----
119 TKOLBitBtn
= class(TKOLControl
)
121 FOptions
: TBitBtnOptions
;
122 FGlyphBitmap
: TBitmap
;
123 FGlyphCount
: Integer;
124 FImageList
: TKOLImageList
;
125 FGlyphLayout
: TGlyphLayout
;
126 FImageIndex
: Integer;
127 FOnTestMouseOver
: TOnTestMouseOver
;
128 FpopupMenu
: TKOLPopupMenu
;
129 FLikeSpeedButton
: Boolean;
130 FRepeatInterval
: Integer;
132 FautoAdjustSize
: Boolean;
133 FBitBtnDrawMnemonic
: Boolean;
134 FTextShiftY
: Integer;
135 FTextShiftX
: Integer;
136 procedure SetOptions(Value
: TBitBtnOptions
);
137 procedure SetGlyphBitmap(const Value
: TBitmap
);
138 procedure SetGlyphCount(Value
: Integer);
139 procedure SetImageList(const Value
: TKOLImageList
);
140 procedure SetGlyphLayout(const Value
: TGlyphLayout
);
141 procedure SetImageIndex(const Value
: Integer);
142 procedure RecalcSize
;
143 procedure SetOnTestMouseOver(const Value
: TOnTestMouseOver
);
144 procedure SetautoAdjustSize(const Value
: Boolean);
145 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
146 procedure SetLikeSpeedButton(const Value
: Boolean);
147 procedure SetRepeatInterval(const Value
: Integer);
148 procedure SetFlat(const Value
: Boolean);
149 procedure SetBitBtnDrawMnemonic(const Value
: Boolean);
150 procedure SetTextShiftX(const Value
: Integer);
151 procedure SetTextShiftY(const Value
: Integer);
153 function TabStopByDefault
: Boolean; override;
154 procedure FirstCreate
; override;
155 function GenerateTransparentInits
: String; override;
156 function SetupParams( const AName
, AParent
: String ): String; override;
157 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
158 procedure SetupTextAlign( SL
: TStrings
; const AName
: String ); override;
159 procedure AssignEvents( SL
: TStringList
; const AName
: String ); override;
160 function ClientMargins
: TRect
; override;
161 procedure AutoSizeNow
; override;
162 procedure CreateKOLControl(Recreating
: boolean); override;
163 function NoDrawFrame
: Boolean; override;
165 constructor Create( AOwner
: TComponent
); override;
166 procedure NotifyLinkedComponent( Sender
: TObject
; Operation
: TNotifyOperation
); override;
167 destructor Destroy
; override;
169 property options
: TBitBtnOptions read FOptions write SetOptions
;
170 property glyphBitmap
: TBitmap read FGlyphBitmap write SetGlyphBitmap
;
171 property glyphCount
: Integer read FGlyphCount write SetGlyphCount
;
172 property glyphLayout
: TGlyphLayout read FGlyphLayout write SetGlyphLayout
;
173 property imageList
: TKOLImageList read FImageList write SetImageList
;
174 property imageIndex
: Integer read FImageIndex write SetImageIndex
;
176 property VerticalAlign
;
179 property Transparent
;
186 property OnBitBtnDraw
;
187 property OnTestMouseOver
: TOnTestMouseOver read FOnTestMouseOver write SetOnTestMouseOver
;
188 property autoAdjustSize
: Boolean read FautoAdjustSize write SetautoAdjustSize
;
189 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
190 property LikeSpeedButton
: Boolean read FLikeSpeedButton write SetLikeSpeedButton
;
191 property RepeatInterval
: Integer read FRepeatInterval write SetRepeatInterval
;
192 property Flat
: Boolean read FFlat write SetFlat
;
194 property BitBtnDrawMnemonic
: Boolean read FBitBtnDrawMnemonic write SetBitBtnDrawMnemonic
;
195 property TextShiftX
: Integer read FTextShiftX write SetTextShiftX
;
196 property TextShiftY
: Integer read FTextShiftY write SetTextShiftY
;
225 //============================================================================
226 //---- MIRROR FOR A LABEL ----
227 //---- ÇÅÐÊÀËÎ ÄËß ÌÅÒÊÈ ----
228 TKOLLabel
= class(TKOLControl
)
230 FpopupMenu
: TKOLPopupMenu
;
231 FShowAccelChar
: Boolean;
232 function Get_VertAlign
: TVerticalAlign
;
233 procedure Set_VertAlign(const Value
: TVerticalAlign
);
234 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
235 procedure SetShowAccelChar(const Value
: Boolean);
238 function AdjustVerticalAlign( Value
: TVerticalAlign
): TVerticalAlign
; virtual;
239 procedure FirstCreate
; override;
240 function SetupParams( const AName
, AParent
: String ): String; override;
241 procedure SetupTextAlign( SL
: TStrings
; const AName
: String ); override;
242 function GetTaborder
: Integer; override;
243 function TypeName
: String; override;
244 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String );
246 procedure CallInheritedPaint
;
247 procedure Paint
; override;
248 function WYSIWIGPaintImplemented
: Boolean; override;
249 procedure Loaded
; override;
251 constructor Create( AOwner
: TComponent
); override;
253 property Transparent
;
255 property VerticalAlign
: TVerticalAlign read Get_VertAlign write Set_VertAlign
;
257 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
260 property ShowAccelChar
: Boolean read FShowAccelChar write SetShowAccelChar
;
265 //============================================================================
266 //---- MIRROR FOR A LABEL EFFECT ----
267 //---- ÇÅÐÊÀËÎ ÄËß ÌÅÒÊÈ Ñ ÝÔÔÅÊÒÀÌÈ ----
268 TKOLLabelEffect
= class( TKOLLabel
)
270 FShadowDeep
: Integer;
272 procedure SetShadowDeep(const Value
: Integer);
273 procedure SetColor2(const Value
: TColor
);
275 function AdjustVerticalAlign( Value
: TVerticalAlign
): TVerticalAlign
; override;
276 function SetupParams( const AName
, AParent
: String ): String; override;
277 procedure SetupTextAlign( SL
: TStrings
; const AName
: String ); override;
278 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
279 function AutoWidth( Canvas
: graphics
.TCanvas
): Integer; override;
280 function AutoHeight( Canvas
: graphics
.TCanvas
): Integer; override;
281 procedure Paint
; override;
283 constructor Create( AOwner
: TComponent
); override;
285 property ShadowDeep
: Integer read FShadowDeep write SetShadowDeep
;
286 property Color2
: TColor read FColor2 write SetColor2
;
309 //============================================================================
310 //---- MIRROR FOR A PANEL ----
311 //---- ÇÅÐÊÀËÎ ÄËß ÏÀÍÅËÈ ----
312 TKOLPanel
= class(TKOLControl
)
314 FEdgeStyle
: TEdgeStyle
;
315 FpopupMenu
: TKOLPopupMenu
;
316 FShowAccelChar
: Boolean;
317 procedure SetEdgeStyle(const Value
: TEdgeStyle
);
318 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
319 procedure SetShowAccelChar(const Value
: Boolean);
321 function Get_VA
: TVerticalAlign
;
322 procedure Set_VA(const Value
: TVerticalAlign
); virtual;
323 function SetupParams( const AName
, AParent
: String ): String; override;
324 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
325 procedure SetupConstruct( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
326 procedure SetupTextAlign( SL
: TStrings
; const AName
: String ); override;
327 function ClientMargins
: TRect
; override;
328 function RefName
: String; override;
329 procedure Paint
; override;
330 function WYSIWIGPaintImplemented
: Boolean; override;
331 function NoDrawFrame
: Boolean; override;
332 procedure SetCaption( const Value
: String ); override;
334 constructor Create( AOwner
: TComponent
); override;
335 destructor Destroy
; override;
337 property Transparent
;
339 property edgeStyle
: TEdgeStyle read FEdgeStyle write SetEdgeStyle
;
341 property VerticalAlign
: TVerticalAlign read Get_VA write Set_VA
;
344 property MarginBottom
;
346 property MarginRight
;
347 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
349 property ShowAccelChar
: Boolean read FShowAccelChar write SetShowAccelChar
;
352 //============================================================================
353 //---- MIRROR FOR MDI CLIENT ----
354 //---- ÇÅÐÊÀËÎ ÄËß MDI ÊËÈÅÍÒÀ ----
355 TKOLMDIClient
= class(TKOLControl
)
358 procedure Tick( Sender
: TObject
);
360 function SetupParams( const AName
, AParent
: String ): String; override;
362 constructor Create( AOwner
: TComponent
); override;
363 destructor Destroy
; override;
369 //===========================================================================
370 //---- MIRROR FOR A GRADIENT PANEL
371 //---- ÇÅÐÊÀËÎ ÄËß ÃÐÀÄÈÅÍÒÍÎÉ ÏÀÍÅËÈ
372 TKOLGradientPanel
= class(TKOLControl
)
376 FpopupMenu
: TKOLPopupMenu
;
377 FgradientLayout
: TGradientLayout
;
378 FgradientStyle
: TGradientStyle
;
379 procedure SetColor1(const Value
: TColor
);
380 procedure SetColor2(const Value
: TColor
);
381 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
382 procedure SetgradientLayout(const Value
: TGradientLayout
);
383 procedure SetgradientStyle(const Value
: TGradientStyle
);
385 function TabStopByDefault
: Boolean; override;
386 function TypeName
: String; override;
387 function SetupParams( const AName
, AParent
: String ): String; override;
388 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
389 procedure Paint
; override;
390 function WYSIWIGPaintImplemented
: Boolean; override;
391 function NoDrawFrame
: Boolean; override;
393 constructor Create( AOwner
: TComponent
); override;
395 property Transparent
;
396 property Color1
: TColor read FColor1 write SetColor1
;
397 property Color2
: TColor read FColor2 write SetColor2
;
398 property GradientStyle
: TGradientStyle read FgradientStyle write SetgradientStyle
;
399 property GradientLayout
: TGradientLayout read FgradientLayout write SetgradientLayout
;
403 property MarginBottom
;
405 property MarginRight
;
406 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
412 //===========================================================================
413 //---- MIRROR FOR A SPLITTER
414 //---- ÇÅÐÊÀËÎ ÄËß ÐÀÇÄÅËÈÒÅËß
415 TKOLSplitter
= class( TKOLControl
)
417 FMinSizePrev
: Integer;
418 FMinSizeNext
: Integer;
420 FEdgeStyle
: TEdgeStyle
;
421 fNotAvailable
: Boolean;
422 procedure SetMinSizeNext(const Value
: Integer);
423 procedure SetMinSizePrev(const Value
: Integer);
424 //procedure SetBeveled(const Value: Boolean);
425 procedure SetEdgeStyle(const Value
: TEdgeStyle
);
427 function IsCursorDefault
: Boolean; override;
428 function SetupParams( const AName
, AParent
: String ): String; override;
429 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
430 function TypeName
: String; override;
431 procedure AssignEvents( SL
: TStringList
; const AName
: String ); override;
432 function BestEventName
: String; override;
433 procedure CreateKOLControl(Recreating
: boolean); override;
434 function NoDrawFrame
: Boolean; override;
436 constructor Create( AOwner
: TComponent
); override;
438 property Transparent
;
439 property MinSizePrev
: Integer read FMinSizePrev write SetMinSizePrev
;
440 property MinSizeNext
: Integer read FMinSizeNext write SetMinSizeNext
;
442 //property beveled: Boolean read FBeveled write SetBeveled;
443 property edgeStyle
: TEdgeStyle read FEdgeStyle write SetEdgeStyle
;
444 property Caption
: Boolean read fNotAvailable
;
445 //property CenterOnParent: Boolean read fNotAvailable;
452 //===========================================================================
453 //---- MIRROR FOR A GROUPBOX
454 //---- ÇÅÐÊÀËÎ ÄËß ÃÐÓÏÏÛ
455 TKOLGroupBox
= class( TKOLControl
)
457 FpopupMenu
: TKOLPopupMenu
;
458 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
460 function TabStopByDefault
: Boolean; override;
461 procedure FirstCreate
; override;
462 function SetupParams( const AName
, AParent
: String ): String; override;
463 function ClientMargins
: TRect
; override;
464 function DrawMargins
: TRect
; override;
465 {$IFDEF _KOLCtrlWrapper_} {YS}
466 procedure CreateKOLControl(Recreating
: boolean); override;
469 constructor Create( AOwner
: TComponent
); override;
470 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
472 property Transparent
;
476 property MarginBottom
;
478 property MarginRight
;
479 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
486 //===========================================================================
487 //---- MIRROR FOR A CHECKBOX
488 //---- ÇÅÐÊÀËÎ ÄËß ÔËÀÆÊÀ
489 TKOLCheckBox
= class( TKOLControl
)
492 FpopupMenu
: TKOLPopupMenu
;
493 FAuto3State
: Boolean;
494 procedure SetChecked(const Value
: Boolean);
495 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
496 procedure SetAuto3State(const Value
: Boolean);
498 function TabStopByDefault
: Boolean; override;
499 procedure FirstCreate
; override;
500 function SetupParams( const AName
, AParent
: String ): String; override;
501 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
502 procedure Paint
; override;
503 function WYSIWIGPaintImplemented
: Boolean; override;
504 function NoDrawFrame
: Boolean; override;
505 procedure CreateKOLControl(Recreating
: boolean); override;
506 function TypeName
: String; override;
508 constructor Create( AOwner
: TComponent
); override;
510 property Transparent
;
511 property Checked
: Boolean read FChecked write SetChecked
;
519 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
523 property Auto3State
: Boolean read FAuto3State write SetAuto3State
;
526 property WordWrap
; // only for not windowed
527 property Border
; // only for not windowed when WordWrap=TRUE
531 //===========================================================================
532 //---- MIRROR FOR A RADIOBOX
533 //---- ÇÅÐÊÀËÎ ÄËß ÐÀÄÈÎ-ÔËÀÆÊÀ
534 TKOLRadioBox
= class( TKOLControl
)
537 FpopupMenu
: TKOLPopupMenu
;
538 procedure SetChecked(const Value
: Boolean);
539 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
541 function TabStopByDefault
: Boolean; override;
542 procedure FirstCreate
; override;
543 function SetupParams( const AName
, AParent
: String ): String; override;
544 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
545 procedure Paint
; override;
546 function WYSIWIGPaintImplemented
: Boolean; override;
547 function NoDrawFrame
: Boolean; override;
549 constructor Create( AOwner
: TComponent
); override;
551 property Transparent
;
552 property Checked
: Boolean read FChecked write SetChecked
;
560 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
566 property WordWrap
; // only for not windowed
567 property Border
; // only for not windowed when WordWrap=TRUE
577 //===========================================================================
578 //---- MIRROR FOR AN EDITBOX
579 //---- ÇÅÐÊÀËÎ ÄËß ÎÊÍÀ ÂÂÎÄÀ
580 TKOLEditOption
= ( {eoNoHScroll, eoNoVScroll,} eoLowercase
, {eoMultiline,}
581 eoNoHideSel
, eoOemConvert
, eoPassword
, eoReadonly
,
582 eoUpperCase
, eoWantTab
, eoNumber
);
583 TKOLEditOptions
= Set of TKOLEditOption
;
585 TKOLEditBox
= class( TKOLControl
)
587 FOptions
: TKOLEditOptions
;
588 FpopupMenu
: TKOLPopupMenu
;
589 FEdTransparent
: Boolean;
590 procedure SetOptions(const Value
: TKOLEditOptions
);
591 function GetCaption
: String;
592 function GetText
: String;
593 procedure SetText(const Value
: String);
594 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
595 procedure SetEdTransparent(const Value
: Boolean);
597 function TabStopByDefault
: Boolean; override;
598 procedure FirstCreate
; override;
599 function SetupParams( const AName
, AParent
: String ): String; override;
600 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
601 procedure WantTabs( Want
: Boolean ); override;
602 function DefaultColor
: TColor
; override;
603 function BestEventName
: String; override;
604 procedure SetupTextAlign(SL
: TStrings
; const AName
: String); override;
606 constructor Create( AOwner
: TComponent
); override;
607 procedure Paint
; override;
608 function WYSIWIGPaintImplemented
: Boolean; override;
609 function NoDrawFrame
: Boolean; override;
611 property Transparent
: Boolean read FEdTransparent write SetEdTransparent
;
612 property Text: String read GetText write SetText
;
613 property Options
: TKOLEditOptions read FOptions write SetOptions
;
617 property OnSelChange
;
618 property Caption
: String read GetCaption
; // redefined as read only to remove from Object Inspector
624 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
628 property EditTabChar
;
634 //===========================================================================
635 //---- MIRROR FOR A MEMO
636 //---- ÇÅÐÊÀËÎ ÄËß ÌÍÎÃÎÑÒÐÎ×ÍÎÃÎ ÎÊÍÀ ÂÂÎÄÀ
637 TKOLMemoOption
= ( eo_NoHScroll
, eo_NoVScroll
, eo_Lowercase
, {eoMultiline,}
638 eo_NoHideSel
, eo_OemConvert
, eo_Password
, eo_Readonly
,
639 eo_UpperCase
, eo_WantReturn
, eo_WantTab
);
640 // Character '_' is used to prevent conflict of option names
641 // with the same in TKOLEditOption type. Fortunately, we never
642 // should to use these names in run-time code of the project.
644 // Ñèìâîë '_' èñïîëüçóåòñÿ, ÷òîáû ïðåäîòâðàòèòü êîíôëèêò ñ
645 // èìåíàìè òàêèõ æå îïöèé äëÿ òèïà TKOLEditOption. Ê ñ÷àñòüþ,
646 // íàì ýòè èìåíà íèêîãäà íå ïîíàäîáÿòñÿ ïðè íàïèñàíèè êîíå÷íîãî
648 TKOLMemoOptions
= Set of TKOLMemoOption
;
650 TKOLMemo
= class( TKOLControl
)
652 FOptions
: TKOLMemoOptions
;
654 FpopupMenu
: TKOLPopupMenu
;
655 FEdTransparent
: Boolean;
656 procedure SetOptions(const Value
: TKOLMemoOptions
);
657 function GetCaption
: String;
658 procedure SetText(const Value
: TStrings
);
659 function GetText
: TStrings
;
660 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
661 procedure SetEdTransparent(const Value
: Boolean);
663 function TabStopByDefault
: Boolean; override;
664 procedure FirstCreate
; override;
665 function SetupParams( const AName
, AParent
: String ): String; override;
666 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
667 function DefaultColor
: TColor
; override;
668 function BestEventName
: String; override;
669 procedure CreateKOLControl(Recreating
: boolean); override;
670 procedure KOLControlRecreated
; override;
671 function NoDrawFrame
: Boolean; override;
672 procedure Loaded
; override;
673 procedure SetTextAlign(const Value
: TTextAlign
); override;
674 procedure SetupTextAlign(SL
: TStrings
; const AName
: String); override;
676 constructor Create( AOwner
: TComponent
); override;
677 destructor Destroy
; override;
678 function TypeName
: String; override;
679 procedure WantTabs( Want
: Boolean ); override;
681 property Transparent
: Boolean read FEdTransparent write SetEdTransparent
;
682 property Text: TStrings read GetText write SetText
;
686 property Options
: TKOLMemoOptions read FOptions write SetOptions
;
688 property OnSelChange
;
689 property Caption
: String read GetCaption
; // redefined as read only to remove from Object Inspector
695 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
698 property EditTabChar
;
705 //===========================================================================
706 //---- MIRROR FOR A RICHEDIT
707 //---- ÇÅÐÊÀËÎ ÄËß ÐÅÄÀÊÒÎÐÀ
708 TKOLRichEditVersion
= ( ver1
, ver3
);
710 TKOLRichEdit
= class( TKOLControl
)
712 FOptions
: TKOLMemoOptions
;
714 Fversion
: TKOLRichEditVersion
;
716 FRE_FmtStandard
: Boolean;
717 FRE_AutoKeyboard
: Boolean;
718 FRE_AutoKeybdSet
: Boolean;
719 FRE_DisableOverwriteChange
: Boolean;
720 FRE_AutoURLDetect
: Boolean;
721 FRE_Transparent
: Boolean;
722 FpopupMenu
: TKOLPopupMenu
;
723 FOLESupport
: Boolean;
724 function GetText
: TStrings
;
725 procedure SetText(const Value
: TStrings
);
726 procedure SetOptions(const Value
: TKOLMemoOptions
);
727 function GetCaption
: String;
728 procedure Setversion(const Value
: TKOLRichEditVersion
);
729 procedure SetMaxTextSize(const Value
: DWORD
);
730 procedure SetRE_FmtStandard(const Value
: Boolean);
731 procedure SetRE_AutoKeyboard(const Value
: Boolean);
732 procedure SetRE_AutoKeybdSet(const Value
: Boolean);
733 procedure SetRE_DisableOverwriteChange(const Value
: Boolean);
734 procedure SetRE_AutoURLDetect(const Value
: Boolean);
735 procedure SetRE_Transparent(const Value
: Boolean);
736 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
737 procedure SetOLESupport(const Value
: Boolean);
739 function TabStopByDefault
: Boolean; override;
740 procedure FirstCreate
; override;
741 function SetupParams( const AName
, AParent
: String ): String; override;
742 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
743 function TypeName
: String; override;
744 function GenerateTransparentInits
: String; override;
745 procedure BeforeFontChange( SL
: TStrings
; const AName
, Prefix
: String ); override;
746 function FontPropName
: String; override;
747 procedure AfterFontChange( SL
: TStrings
; const AName
, Prefix
: String ); override;
748 procedure WantTabs( Want
: Boolean ); override;
749 function DefaultColor
: TColor
; override;
750 function AdditionalUnits
: String; override;
751 function BestEventName
: String; override;
752 procedure CreateKOLControl(Recreating
: boolean); override;
753 procedure KOLControlRecreated
; override;
754 procedure Loaded
; override;
755 function NoDrawFrame
: Boolean; override;
757 constructor Create( AOwner
: TComponent
); override;
758 destructor Destroy
; override;
760 property Transparent read FRE_Transparent write SetRE_Transparent
;
761 property RE_Transparent
: Boolean read FRE_Transparent write SetRE_Transparent
;
762 property Text: TStrings read GetText write SetText
;
765 property Options
: TKOLMemoOptions read FOptions write SetOptions
;
767 property OnSelChange
;
768 property Caption
: String read GetCaption
; // redefined as read only to remove from Object Inspector
772 property version
: TKOLRichEditVersion read Fversion write Setversion
;
774 property OnRE_URLClick
;
775 property OnRE_OverURL
;
776 property OnRE_InsOvrMode_Change
;
777 property RE_DisableOverwriteChange
: Boolean read FRE_DisableOverwriteChange write SetRE_DisableOverwriteChange
;
778 property MaxTextSize
: DWORD read FMaxTextSize write SetMaxTextSize
;
779 property RE_FmtStandard
: Boolean read FRE_FmtStandard write SetRE_FmtStandard
;
780 property RE_AutoKeyboard
: Boolean read FRE_AutoKeyboard write SetRE_AutoKeyboard
;
781 property RE_AutoKeybdSet
: Boolean read FRE_AutoKeybdSet write SetRE_AutoKeybdSet
;
782 property RE_AutoURLDetect
: Boolean read FRE_AutoURLDetect write SetRE_AutoURLDetect
;
785 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
788 property EditTabChar
;
790 property OLESupport
: Boolean read FOLESupport write SetOLESupport
;
797 //===========================================================================
798 //---- MIRROR FOR A LISTBOX
799 //---- ÇÅÐÊÀËÎ ÄËß ÑÏÈÑÊÀ
800 TKOLListboxOption
= ( loNoHideScroll
, loNoExtendSel
, loMultiColumn
, loMultiSelect
,
801 loNoIntegralHeight
, loNoSel
, loSort
, loTabstops
,
802 loNoStrings
, loNoData
, loOwnerDrawFixed
, loOwnerDrawVariable
);
803 TKOLListboxOptions
= Set of TKOLListboxOption
;
805 TKOLListBox
= class( TKOLControl
)
807 FOptions
: TKOLListboxOptions
;
811 FpopupMenu
: TKOLPopupMenu
;
812 fLBItemHeight
: Integer; {+ecm}
813 procedure SetLBItemHeight(const Value
: Integer); {+ecm}
814 procedure SetOptions(const Value
: TKOLListboxOptions
);
815 procedure SetItems(const Value
: TStrings
);
816 procedure SetCurIndex(const Value
: Integer);
817 function GetCaption
: String;
818 procedure SetCount(Value
: Integer);
819 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
820 procedure UpdateItems
;
822 function TabStopByDefault
: Boolean; override;
823 procedure FirstCreate
; override;
824 function SetupParams( const AName
, AParent
: String ): String; override;
825 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
826 procedure SetupLast( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
827 function DefaultColor
: TColor
; override;
828 procedure CreateKOLControl(Recreating
: boolean); override;
829 procedure KOLControlRecreated
; override;
830 function NoDrawFrame
: Boolean; override;
831 procedure Loaded
; override;
832 function GenerateTransparentInits
: String; override; {+ecm}
834 constructor Create( AOwner
: TComponent
); override;
835 destructor Destroy
; override;
837 property Transparent
;
840 property Options
: TKOLListboxOptions read FOptions write SetOptions
;
841 property OnSelChange
;
842 property Items
: TStrings read FItems write SetItems
;
843 property CurIndex
: Integer read FCurIndex write SetCurIndex
;
847 property Caption
: String read GetCaption
; // hide Caption in Object Inspector
849 property OnMeasureItem
;
850 property Count
: Integer read FCount write SetCount
;
853 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
857 property LBItemHeight
: Integer read fLBItemHeight write SetLBItemHeight
; {+ecm}
865 //===========================================================================
866 //---- MIRROR FOR A COMBOBOX
867 //---- ÇÅÐÊÀËÎ ÄËß ÂÛÏÀÄÀÞÙÅÃÎ ÑÏÈÑÊÀ
868 TKOLComboOption
= ( coReadOnly
, coNoHScroll
, coAlwaysVScroll
, coLowerCase
,
869 coNoIntegralHeight
, coOemConvert
, coSort
, coUpperCase
,
870 coOwnerDrawFixed
, coOwnerDrawVariable
, coSimple
);
871 TKOLComboOptions
= Set of TKOLComboOption
;
873 TKOLComboBox
= class( TKOLControl
)
875 FOptions
: TKOLComboOptions
;
878 FDroppedWidth
: Integer;
879 FpopupMenu
: TKOLPopupMenu
;
880 fCBItemHeight
: Integer; {+ecm}
881 procedure SetCBItemHeight(const Value
: Integer); {+ecm}
882 procedure SetOptions(const Value
: TKOLComboOptions
);
883 procedure SetCurIndex(const Value
: Integer);
884 procedure SetItems(const Value
: TStrings
);
885 procedure SetDroppedWidth(const Value
: Integer);
886 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
888 function TabStopByDefault
: Boolean; override;
889 procedure FirstCreate
; override;
890 function SetupParams( const AName
, AParent
: String ): String; override;
891 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
892 function DefaultColor
: TColor
; override;
893 function DefaultInitialColor
: TColor
; override;
894 procedure Paint
; override;
895 function WYSIWIGPaintImplemented
: Boolean; override;
896 function NoDrawFrame
: Boolean; override;
897 function AutoHeight( Canvas
: graphics
.TCanvas
): Integer; override;
898 function AutoSizeRunTime
: Boolean; override;
899 function GenerateTransparentInits
: String; override; {+ecm}
901 constructor Create( AOwner
: TComponent
); override;
902 destructor Destroy
; override;
904 property Transparent
;
907 property Options
: TKOLComboOptions read FOptions write SetOptions
;
909 property OnSelChange
;
912 property Items
: TStrings read FItems write SetItems
;
913 property CurIndex
: Integer read FCurIndex write SetCurIndex
;
914 property DroppedWidth
: Integer read FDroppedWidth write SetDroppedWidth
;
918 property OnMeasureItem
;
922 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
925 property CBItemHeight
: Integer read fCBItemHeight write SetCBItemHeight
; {+ecm}
931 //===========================================================================
932 //---- MIRROR FOR A PAINTBOX
933 //---- ÇÅÐÊÀËÎ ÄËß ÌÎËÜÁÅÐÒÀ
934 TKOLPaintBox
= class( TKOLControl
)
936 FpopupMenu
: TKOLPopupMenu
;
937 fNotAvailable
: Boolean;
938 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
940 function SetupParams( const AName
, AParent
: String ): String; override;
941 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
942 function BestEventName
: String; override;
944 constructor Create( AOwner
: TComponent
); override;
946 property Transparent
;
950 property MarginBottom
;
952 property MarginRight
;
953 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
954 property Caption
: Boolean read fNotAvailable
;
960 //===========================================================================
961 //---- MIRROR FOR A IMAGESHOW
962 //---- ÇÅÐÊÀËÎ ÄËß ÊÀÐÒÈÍÊÈ
963 TKOLImageShow
= class( TKOLControl
)
966 FImageListNormal
: TKOLImageList
;
967 FpopupMenu
: TKOLPopupMenu
;
968 fNotAvailable
: Boolean;
970 fImgShwAutoSize
: Boolean;
971 procedure SetCurIndex(const Value
: Integer);
972 procedure SetImageListNormal(const Value
: TKOLImageList
);
973 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
974 procedure SetImgShwAutoSize(const Value
: Boolean);
976 function SetupParams( const AName
, AParent
: String ): String; override;
977 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
978 procedure DoAutoSize
;
979 procedure SetHasBorder(const Value
: Boolean); override;
980 procedure Paint
; override;
981 function WYSIWIGPaintImplemented
: Boolean; override;
982 function NoDrawFrame
: Boolean; override;
984 constructor Create( AOwner
: TComponent
); override;
985 destructor Destroy
; override;
986 procedure NotifyLinkedComponent( Sender
: TObject
; Operation
: TNotifyOperation
); override;
987 procedure SetBounds( aLeft
, aTop
, aWidth
, aHeight
: Integer ); override;
989 property ImageListNormal
: TKOLImageList read FImageListNormal write SetImageListNormal
;
990 property CurIndex
: Integer read FCurIndex write SetCurIndex
;
991 property Transparent
;
992 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
993 property Caption
: Boolean read fNotAvailable
;
994 property HasBorder
; //: Boolean read FHasBorder write SetHasBorder;
995 property autoSize
: Boolean read fImgShwAutoSize write SetImgShwAutoSize
;
999 //===========================================================================
1000 //---- MIRROR FOR A PROGRESSBAR
1001 //---- ÇÅÐÊÀËÎ ÄËß ËÈÍÅÉÊÈ ÏÐÎÃÐÅÑÑÀ
1002 TKOLProgressBar
= class( TKOLControl
)
1006 //FProgressBkColor: TColor;
1007 FProgressColor
: TColor
;
1008 FMaxProgress
: Integer;
1010 fNotAvailable
: Boolean;
1011 FpopupMenu
: TKOLPopupMenu
;
1012 procedure SetSmooth(const Value
: Boolean);
1013 procedure SetVertical(const Value
: Boolean);
1014 //procedure SetProgressBkColor(const Value: TColor);
1015 procedure SetProgressColor(const Value
: TColor
);
1016 procedure SetMaxProgress(const Value
: Integer);
1017 procedure SetProgress(const Value
: Integer);
1018 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1019 function GetColor
: TColor
;
1020 procedure SetColor(const Value
: TColor
);
1022 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1023 function SetupParams( const AName
, AParent
: String ): String; override;
1024 function TypeName
: String; override;
1025 procedure CreateKOLControl(Recreating
: boolean); override;
1026 procedure KOLControlRecreated
; override;
1027 function NoDrawFrame
: Boolean; override;
1029 constructor Create( AOwner
: TComponent
); override;
1031 property Transparent
;
1032 property Vertical
: Boolean read FVertical write SetVertical
;
1033 property Smooth
: Boolean read FSmooth write SetSmooth
;
1034 property ProgressColor
: TColor read FProgressColor write SetProgressColor
;
1035 property ProgressBkColor
: TColor read GetColor write SetColor
;
1036 property Progress
: Integer read FProgress write SetProgress
;
1037 property MaxProgress
: Integer read FMaxProgress write SetMaxProgress
;
1038 property Caption
: Boolean read fNotAvailable
;
1039 property OnMouseDblClk
: Boolean read fNotAvailable
;
1040 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1045 //===========================================================================
1046 //---- MIRROR FOR A LISTVIEW
1047 //---- ÇÅÐÊÀËÎ ÄËß ÏÐÎÑÌÎÒÐÀ ÑÏÈÑÊÀ / ÒÀÁËÈÖÛ
1048 TKOLListViewStyle
= ( lvsIcon
, lvsSmallIcon
, lvsList
, lvsDetail
, lvsDetailNoHeader
);
1050 TKOLListViewOption
= ( lvoIconLeft
, lvoAutoArrange
, lvoButton
, lvoEditLabel
,
1051 lvoNoLabelWrap
, lvoNoScroll
, lvoNoSortHeader
, lvoHideSel
, lvoMultiselect
,
1052 lvoSortAscending
, lvoSortDescending
, lvoGridLines
, lvoSubItemImages
,
1053 lvoCheckBoxes
, lvoTrackSelect
, lvoHeaderDragDrop
, lvoRowSelect
, lvoOneClickActivate
,
1054 lvoTwoClickActivate
, lvoFlatsb
, lvoRegional
, lvoInfoTip
, lvoUnderlineHot
,
1055 lvoMultiWorkares
, lvoOwnerData
, lvoOwnerDrawFixed
);
1056 TKOLListViewOptions
= Set of TKOLListViewOption
;
1058 TKOLListViewColWidthType
= ( lvcwtCustom
, lvcwtAutosize
, lvcwtAutoSizeCaption
);
1060 TKOLListView
= class;
1062 TKOLListViewColumn
= class( TComponent
)
1064 FListView
: TKOLListView
;
1065 FLVColImage
: Integer;
1066 FLVColOrder
: Integer;
1069 FWidthType
: TKOLListViewColWidthType
;
1070 FTextAlign
: TTextAlign
;
1071 FLVColRightImg
: Boolean;
1072 procedure SetCaption(const Value
: String);
1073 procedure SetLVColImage(const Value
: Integer);
1074 procedure SetLVColOrder(const Value
: Integer);
1075 procedure SetTextAlign(const Value
: TTextAlign
);
1076 procedure SetWidth(const Value
: Integer);
1077 procedure SetWidthType(const Value
: TKOLListViewColWidthType
);
1079 procedure SetLVColRightImg(const Value
: Boolean);
1081 procedure SetName( const AName
: TComponentName
); override;
1082 procedure DefProps( const Prefix
: String; Filer
: TFiler
);
1083 procedure LoadName( Reader
: TReader
);
1084 procedure SaveName( Writer
: TWriter
);
1085 procedure LoadCaption( Reader
: TReader
);
1086 procedure SaveCaption( Writer
: TWriter
);
1087 procedure LoadTextAlign( Reader
: TReader
);
1088 procedure SaveTextAlign( Writer
: TWriter
);
1089 procedure LoadWidth( Reader
: TReader
);
1090 procedure SaveWidth( Writer
: TWriter
);
1091 procedure LoadWidthType( Reader
: TReader
);
1092 procedure SaveWidthType( Writer
: TWriter
);
1093 procedure LoadLVColImage( Reader
: TReader
);
1094 procedure SaveLVColImage( Writer
: TWriter
);
1095 procedure LoadLVColOrder( Reader
: TReader
);
1096 procedure SaveLVColOrder( Writer
: TWriter
);
1097 procedure LoadLVColRightImg( Reader
: TReader
);
1098 procedure SaveLVColRightImg( Writer
: TWriter
);
1100 constructor Create( AOwner
: TComponent
); override;
1101 destructor Destroy
; override;
1103 property Caption
: String read FCaption write SetCaption
;
1104 property TextAlign
: TTextAlign read FTextAlign write SetTextAlign
;
1105 property Width
: Integer read FWidth write SetWidth
;
1106 property WidthType
: TKOLListViewColWidthType read FWidthType write SetWidthType
;
1107 property LVColImage
: Integer read FLVColImage write SetLVColImage
;
1108 property LVColRightImg
: Boolean read FLVColRightImg write SetLVColRightImg
;
1109 property LVColOrder
: Integer read FLVColOrder write SetLVColOrder
;
1112 TKOLListView
= class( TKOLControl
)
1114 FOptions
: TKOLListViewOptions
;
1115 FStyle
: TKOLListViewStyle
;
1116 FImageListNormal
: TKOLImageList
;
1117 FImageListSmall
: TKOLImageList
;
1118 FImageListState
: TKOLImageList
;
1121 FpopupMenu
: TKOLPopupMenu
;
1123 FLVTextBkColor
: TColor
;
1124 FOnLVDelete
: TOnLVDelete
;
1125 FGenerateColIdxConst
: Boolean;
1126 FOnLVCustomDraw
: TOnLVCustomDraw
;
1128 FOnLVDataW
: TOnLVDataW
;
1130 fLVItemHeight
: Integer;
1131 procedure SetOptions(const Value
: TKOLListViewOptions
);
1132 procedure SetStyle(const Value
: TKOLListViewStyle
);
1133 procedure SetImageListNormal(const Value
: TKOLImageList
);
1134 procedure SetImageListSmall(const Value
: TKOLImageList
);
1135 procedure SetImageListState(const Value
: TKOLImageList
);
1136 function GetCaption
: String;
1137 procedure SetLVCount(Value
: Integer);
1138 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1139 procedure SetLVTextBkColor(const Value
: TColor
);
1140 function GetColor
: TColor
;
1141 procedure SetColor(const Value
: TColor
);
1142 procedure SetOnLVDelete(const Value
: TOnLVDelete
);
1143 function GetColumns
: String;
1144 procedure SetColumns(const Value
: String);
1145 procedure SetGenerateColIdxConst(const Value
: Boolean);
1146 procedure SetOnLVCustomDraw(const Value
: TOnLVCustomDraw
);
1147 procedure UpdateColumns
;
1149 procedure SetOnLVDataW(const Value
: TOnLVDataW
); {YS}
1151 procedure SetLVItemHeight(const Value
: Integer);
1155 function TabStopByDefault
: Boolean; override;
1156 function SetupParams( const AName
, AParent
: String ): String; override;
1157 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1158 procedure SetupLast( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1159 function DefaultColor
: TColor
; override;
1160 procedure AssignEvents( SL
: TStringList
; const AName
: String ); override;
1161 procedure DefineProperties( Filer
: TFiler
); override;
1162 procedure LoadColCount( Reader
: TReader
);
1163 procedure SaveColCount( Writer
: TWriter
);
1164 procedure DoGenerateConstants( SL
: TStringList
); override;
1165 procedure Loaded
; override; {YS}
1166 function NoDrawFrame
: Boolean; override;
1167 procedure CreateKOLControl(Recreating
: boolean); override;
1168 procedure KOLControlRecreated
; override;
1169 function GetDefaultControlFont
: HFONT
; override;
1170 function GenerateTransparentInits
: String; override;
1172 ActiveDesign
: TfmLVColumnsEditor
;
1173 constructor Create( AOwner
: TComponent
); override;
1174 procedure NotifyLinkedComponent( Sender
: TObject
; Operation
: TNotifyOperation
); override;
1175 destructor Destroy
; override;
1176 property Cols
: TList read FCols
;
1177 function HasOrderedColumns
: Boolean;
1178 procedure Invalidate
; override; {YS}
1180 property Transparent
;
1181 property Style
: TKOLListViewStyle read FStyle write SetStyle
;
1182 property Options
: TKOLListViewOptions read FOptions write SetOptions
;
1183 property ImageListSmall
: TKOLImageList read FImageListSmall write SetImageListSmall
;
1184 property ImageListNormal
: TKOLImageList read FImageListNormal write SetImageListNormal
;
1185 property ImageListState
: TKOLImageList read FImageListState write SetImageListState
;
1186 //property CurIndex: Integer read FCurIndex write SetCurIndex;
1191 property Caption
: String read GetCaption
; // hide Caption in Object Inspector
1192 property OnDeleteLVItem
;
1193 property OnDeleteAllLVItems
;
1195 property LVCount
: Integer read FLVCount write SetLVCount
;
1196 property LVTextBkColor
: TColor read FLVTextBkColor write SetLVTextBkColor
;
1197 property LVBkColor
: TColor read GetColor write SetColor
;
1198 property LVItemHeight
: Integer read fLVItemHeight write SetLVItemHeight
;
1199 property OnCompareLVItems
;
1200 property OnEndEditLVItem
;
1201 property OnColumnClick
;
1202 property OnLVStateChange
;
1203 property OnDrawItem
;
1204 property OnLVCustomDraw
: TOnLVCustomDraw read FOnLVCustomDraw write SetOnLVCustomDraw
;
1207 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1208 property OnMeasureItem
;
1212 property OnLVDelete
: TOnLVDelete read FOnLVDelete write SetOnLVDelete
;
1213 property Columns
: String read GetColumns write SetColumns stored
FALSE;
1214 property generateConstants
: Boolean read FGenerateColIdxConst write SetGenerateColIdxConst
;
1218 property OnLVDataW
: TOnLVDataW read FOnLVDataW write SetOnLVDataW
;
1222 TKOLLVColumnsEditor
= class( TComponentEditor
)
1226 procedure Edit
; override;
1227 procedure ExecuteVerb(Index
: Integer); override;
1228 function GetVerb(Index
: Integer): string; override;
1229 function GetVerbCount
: Integer; override;
1232 TKOLLVColumnsPropEditor
= class( TStringProperty
)
1236 function GetAttributes
: TPropertyAttributes
; override;
1237 procedure Edit
; override;
1242 //===========================================================================
1243 //---- MIRROR FOR A TREEVIEW
1244 //---- ÇÅÐÊÀËÎ ÄËß ÏÐÎÑÌÎÒÐÀ ÄÅÐÅÂÀ
1245 TKOLTreeViewOption
= ( tvoNoLines
, tvoLinesRoot
, tvoNoButtons
, tvoEditLabels
, tvoHideSel
,
1246 tvoDragDrop
, tvoNoTooltips
, tvoCheckBoxes
, tvoTrackSelect
,
1247 tvoSingleExpand
, tvoInfoTip
, tvoFullRowSelect
, tvoNoScroll
,
1249 TKOLTreeViewOptions
= Set of TKOLTreeViewOption
;
1251 TKOLTreeView
= class( TKOLControl
)
1253 FOptions
: TKOLTreeViewOptions
;
1255 FImageListNormal
: TKOLImageList
;
1256 FImageListState
: TKOLImageList
;
1257 FTVRightClickSelect
: Boolean;
1258 FpopupMenu
: TKOLPopupMenu
;
1260 procedure SetOptions(const Value
: TKOLTreeViewOptions
);
1261 procedure SetCurIndex(const Value
: Integer);
1262 procedure SetImageListNormal(const Value
: TKOLImageList
);
1263 procedure SetImageListState(const Value
: TKOLImageList
);
1264 procedure SetTVRightClickSelect(const Value
: Boolean);
1265 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1266 procedure SetTVIndent(const Value
: Integer);
1268 function TabStopByDefault
: Boolean; override;
1269 function SetupParams( const AName
, AParent
: String ): String; override;
1270 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1271 function DefaultColor
: TColor
; override;
1272 procedure CreateKOLControl(Recreating
: boolean); override;
1273 function NoDrawFrame
: Boolean; override;
1275 constructor Create( AOwner
: TComponent
); override;
1276 procedure NotifyLinkedComponent( Sender
: TObject
; Operation
: TNotifyOperation
); override;
1277 destructor Destroy
; override;
1279 property Transparent
;
1280 property Options
: TKOLTreeViewOptions read FOptions write SetOptions
;
1281 property ImageListNormal
: TKOLImageList read FImageListNormal write SetImageListNormal
;
1282 property ImageListState
: TKOLImageList read FImageListState write SetImageListState
;
1283 property CurIndex
: Integer read FCurIndex write SetCurIndex
;
1284 property TVRightClickSelect
: Boolean read FTVRightClickSelect write SetTVRightClickSelect
;
1286 property OnSelChange
;
1290 property OnTVBeginDrag
;
1291 property OnTVBeginEdit
;
1292 property OnTVEndEdit
;
1293 property OnTVExpanding
;
1294 property OnTVExpanded
;
1295 property OnTVDelete
;
1296 property OnTVSelChanging
;
1299 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1300 property TVIndent
: Integer read FTVIndent write SetTVIndent
;
1308 //===========================================================================
1309 //---- MIRROR FOR A TOOLBAR
1310 //---- ÇÅÐÊÀËÎ ÄËß ËÈÍÅÉÊÈ ÊÍÎÏÎÊ
1311 TKOLToolbar
= class;
1313 TSystemToolbarImage
= ( stiCustom
, stdCUT
, stdCOPY
, stdPASTE
, stdUNDO
,
1314 stdREDO
, stdDELETE
, stdFILENEW
, stdFILEOPEN
,
1315 stdFILESAVE
, stdPRINTPRE
, stdPROPERTIES
,
1316 stdHELP
, stdFIND
, stdREPLACE
, stdPRINT
,
1318 viewLARGEICONS
, viewSMALLICONS
, viewLIST
,
1319 viewDETAILS
, viewSORTNAME
, viewSORTSIZE
,
1320 viewSORTDATE
, viewSORTTYPE
, viewPARENTFOLDER
,
1321 viewNETCONNECT
, viewNETDISCONNECT
, viewNEWFOLDER
,
1324 histBACK
, histFORWARD
, histFAVORITES
,
1325 histADDTOFAVORITES
, histVIEWTREE
);
1327 TKOLToolbarButton
= class( TComponent
)
1329 FToolbar
: TKOLToolbar
;
1331 Fseparator
: Boolean;
1336 FonClick
: TOnToolbarButtonClick
;
1337 fOnClickMethodName
: String;
1340 fNotAvailable
: Boolean;
1341 Fsysimg
: TSystemToolbarImage
;
1342 FradioGroup
: Integer;
1344 Faction
: TKOLAction
;
1345 procedure Setcaption(const Value
: String);
1346 procedure Setdropdown(const Value
: Boolean);
1347 procedure Setenabled(const Value
: Boolean);
1348 procedure SetonClick(const Value
: TOnToolbarButtonClick
);
1349 procedure Setpicture(Value
: TPicture
);
1350 procedure Setseparator(const Value
: Boolean);
1351 procedure Settooltip(const Value
: String);
1352 procedure Setvisible(const Value
: Boolean);
1353 procedure Setchecked(const Value
: Boolean);
1354 procedure Setsysimg(const Value
: TSystemToolbarImage
);
1355 procedure SetradioGroup(const Value
: Integer);
1356 procedure SetimgIndex(const Value
: Integer);
1357 procedure Setaction(const Value
: TKOLAction
);
1360 procedure SetName( const NewName
: TComponentName
); override;
1361 procedure DefProps( const Prefix
: String; Filer
: Tfiler
);
1362 procedure LoadName( Reader
: TReader
);
1363 procedure SaveName( Writer
: TWriter
);
1364 procedure LoadProps( Reader
: TReader
);
1365 procedure SaveProps( Writer
: TWriter
);
1366 procedure LoadCaption( Reader
: TReader
);
1367 procedure SaveCaption( Writer
: TWriter
);
1368 procedure LoadChecked( Reader
: TReader
);
1369 procedure SaveChecked( Writer
: TWriter
);
1370 procedure LoadDropDown( Reader
: TReader
);
1371 procedure SaveDropDown( Writer
: TWriter
);
1372 procedure LoadEnabled( Reader
: TReader
);
1373 procedure SaveEnabled( Writer
: TWriter
);
1374 procedure LoadSeparator( Reader
: TReader
);
1375 procedure SaveSeparator( Writer
: TWriter
);
1376 procedure LoadTooltip( Reader
: TReader
);
1377 procedure SaveTooltip( Writer
: TWriter
);
1378 procedure LoadVisible( Reader
: TReader
);
1379 procedure SaveVisible( Writer
: TWriter
);
1380 procedure LoadOnClick( Reader
: TReader
);
1381 procedure SaveOnClick( Writer
: TWriter
);
1382 procedure LoadPicture( Reader
: TReader
);
1383 procedure SavePicture( Writer
: TWriter
);
1384 procedure LoadSysImg( Reader
: TReader
);
1385 procedure SaveSysImg( Writer
: TWriter
);
1386 procedure LoadRadioGroup( Reader
: TReader
);
1387 procedure SaveRadioGroup( Writer
: TWriter
);
1388 procedure LoadImgIndex( Reader
: TReader
);
1389 procedure SaveImgIndex( Writer
: TWriter
);
1390 procedure Notification(AComponent
: TComponent
; Operation
: TOperation
); override;
1392 constructor Create( AOwner
: TComponent
); override;
1393 destructor Destroy
; override;
1394 function HasPicture
: Boolean;
1395 property ToolbarComponent
: TKOLToolbar read FToolbar
;
1397 property separator
: Boolean read Fseparator write Setseparator
;
1398 property dropdown
: Boolean read Fdropdown write Setdropdown
;
1399 property checked
: Boolean read Fchecked write Setchecked
;
1400 property radioGroup
: Integer read FradioGroup write SetradioGroup
;
1401 property picture
: TPicture read Fpicture write Setpicture
;
1402 property sysimg
: TSystemToolbarImage read Fsysimg write Setsysimg
;
1403 property imgIndex
: Integer read FimgIndex write SetimgIndex
;
1404 property visible
: Boolean read Fvisible write Setvisible
;
1405 property enabled
: Boolean read Fenabled write Setenabled
;
1406 property onClick
: TOnToolbarButtonClick read FonClick write SetonClick
;
1407 property caption
: String read Fcaption write Setcaption
;
1408 property tooltip
: String read Ftooltip write Settooltip
;
1409 property Tag
: Boolean read fNotAvailable
;
1410 property action
: TKOLAction read Faction write Setaction
;
1413 TKOLToolbar
= class( TKOLControl
)
1415 FOptions
: TToolbarOptions
;
1418 FnoTextLabels
: Boolean;
1419 Ftooltips
: TStrings
;
1420 FshowTooltips
: Boolean;
1421 FmapBitmapColors
: Boolean;
1422 FpopupMenu
: TKOLPopupMenu
;
1423 fNotAvailable
: Boolean;
1425 FItems
: TList
; // of TKOLToolbarButton
1426 FButtonCount
: Integer;
1427 FStandardImagesLarge
: Boolean;
1428 FgenerateConstants
: Boolean;
1429 FbuttonMinWidth
: Integer;
1430 FbuttonMaxWidth
: Integer;
1431 FHeightAuto
: Boolean;
1432 FimageListNormal
: TKOLImageList
;
1433 FimageListDisabled
: TKOLImageList
;
1434 FimageListHot
: TKOLImageList
;
1435 FFixFlatXP
: Boolean;
1436 FTBButtonsWidth
: Integer;
1437 FgenerateVariables
: Boolean;
1438 procedure SetOptions(const Value
: TToolbarOptions
);
1439 procedure Setbitmap(const Value
: TBitmap
);
1440 procedure SetnoTextLabels(const Value
: Boolean);
1441 procedure Settooltips(const Value
: TStrings
);
1442 procedure SetshowTooltips(const Value
: Boolean);
1443 procedure SetmapBitmapColors(const Value
: Boolean);
1444 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1445 procedure SetBtnCount_Dummy(const Value
: Integer);
1446 function MaxBtnImgHeight
: Integer;
1447 function MaxBtnImgWidth
: Integer;
1448 procedure SetStandardImagesLarge(const Value
: Boolean);
1449 procedure SetgenerateConstants(const Value
: Boolean);
1450 procedure SetbuttonMaxWidth(const Value
: Integer);
1451 procedure SetbuttonMinWidth(const Value
: Integer);
1452 function GetButtons
: String;
1453 procedure SetAutoHeight(const Value
: Boolean);
1454 procedure UpdateButtons
;
1455 procedure CMDesignHitTest(var Message: TCMDesignHitTest
); message CM_DESIGNHITTEST
;
1456 procedure WMLButtonDown(var Message: TWMLButtonDown
); message WM_LBUTTONDOWN
;
1457 procedure WMMouseMove(var Message: TWMMouseMove
); message WM_MOUSEMOVE
;
1458 procedure WMLButtonDblClk(var Message: TWMLButtonDblClk
); message WM_LBUTTONDBLCLK
;
1459 procedure SetimageList(const Value
: TKOLImageList
);
1460 procedure SetDisabledimageList(const Value
: TKOLImageList
);
1461 procedure SetHotimageList(const Value
: TKOLImageList
);
1462 procedure SetFixFlatXP(const Value
: Boolean);
1463 procedure SetTBButtonsWidth(const Value
: Integer);
1464 procedure SetgenerateVariables(const Value
: Boolean);
1467 fNewVersion
: Boolean;
1468 FBmpTranColor
: TColor
;
1469 FBmpDesign
: HBitmap
;
1470 procedure SetupFirst( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1471 function SetupParams( const AName
, AParent
: String ): String; override;
1472 procedure SetupLast( SL
: TStringList
; const AName
, AParent
, Prefix
: String ); override;
1473 procedure DefineProperties(Filer
: TFiler
); override;
1474 procedure ReadNewVersion( Reader
: TReader
);
1475 procedure WriteNewVersion( Writer
: TWriter
);
1476 procedure LoadButtonCount( R
: TReader
);
1477 procedure SaveButtonCount( W
: TWriter
);
1478 procedure Loaded
; override;
1479 function StandardImagesUsed
: Integer;
1480 function PicturedButtonsCount
: Integer;
1481 function ImagedButtonsCount
: Integer;
1482 function NoMorePicturedButtonsFrom( Idx
: Integer ): Boolean;
1483 function AllPicturedButtonsAreLeading
: Boolean;
1484 function LastBtnHasPicture
: Boolean;
1485 procedure CreateKOLControl(Recreating
: boolean); override;
1486 procedure KOLControlRecreated
; override;
1487 function NoDrawFrame
: Boolean; override;
1488 procedure SetMargin(const Value
: Integer); override;
1489 procedure Paint
; override;
1490 function GetDefaultControlFont
: HFONT
; override;
1491 function ImageListsUsed
: Boolean;
1493 function Generate_SetSize
: String; override;
1495 ActiveDesign
: TfmToolbarEditor
;
1496 constructor Create( AOwner
: TComponent
); override;
1497 destructor Destroy
; override;
1498 procedure Change
; override;
1499 procedure Tick( Sender
: TObject
);
1500 property Items
: TList read FItems
;
1501 procedure Items2buttons
;
1502 procedure DoGenerateConstants( SL
: TStringList
); override;
1503 procedure NotifyLinkedComponent( Sender
: TObject
; Operation
: TNotifyOperation
); override;
1504 function MaxImgIndex
: Integer;
1506 property Transparent
;
1507 property Options
: TToolbarOptions read FOptions write SetOptions
;
1508 property bitmap
: TBitmap read Fbitmap write Setbitmap
;
1509 property buttons
: String read GetButtons write Fbuttons
;
1510 property OnTBDropDown
;
1512 property noTextLabels
: Boolean read FnoTextLabels write SetnoTextLabels
;
1513 property tooltips
: TStrings read Ftooltips write Settooltips
;
1514 property showTooltips
: Boolean read FshowTooltips write SetshowTooltips
;
1515 property mapBitmapColors
: Boolean read FmapBitmapColors write SetmapBitmapColors
;
1518 property MarginBottom
;
1519 property MarginLeft
;
1520 property MarginRight
;
1521 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1522 property Caption
: Boolean read fNotAvailable
;
1525 property ButtonCount
: Integer read FButtonCount write SetBtnCount_Dummy
1527 procedure buttons2Items
;
1528 procedure bitmap2ItemPictures( AnyWay
: Boolean );
1529 procedure AssembleBitmap
;
1530 procedure AssembleTooltips
;
1531 property StandardImagesLarge
: Boolean read FStandardImagesLarge write SetStandardImagesLarge
;
1532 property generateConstants
: Boolean read FgenerateConstants write SetgenerateConstants
;
1533 property generateVariables
: Boolean read FgenerateVariables write SetgenerateVariables
;
1534 property TBButtonsMinWidth
: Integer read FbuttonMinWidth write SetbuttonMinWidth
;
1535 property TBButtonsMaxWidth
: Integer read FbuttonMaxWidth write SetbuttonMaxWidth
;
1536 property TBButtonsWidth
: Integer read FTBButtonsWidth write SetTBButtonsWidth
;
1537 property HeightAuto
: Boolean read FHeightAuto write SetAutoHeight
;
1541 property imageListNormal
: TKOLImageList read FimageListNormal write SetimageList
;
1542 property imageListDisabled
: TKOLImageList read FimageListDisabled write SetDisabledimageList
;
1543 property imageListHot
: TKOLImageList read FimageListHot write SetHotimageList
;
1545 property FixFlatXP
: Boolean read FFixFlatXP write SetFixFlatXP
;
1546 // If TRUE (default) then some styles are changed in case of XP on start.
1547 // This useful (and necessary) only if XP Manifest is used in the application
1548 // in other case this property can be set to FALSE to make code smaller
1549 // and to prevent "heavy" property TRUE from usage.
1550 // This property has effect only for toolbars with tboFlat style though.
1553 TKOLToolbarButtonsEditor
= class( TStringProperty
)
1557 function GetAttributes
: TPropertyAttributes
; override;
1558 procedure Edit
; override;
1561 TKOLToolbarEditor
= class( TComponentEditor
)
1565 procedure Edit
; override;
1566 procedure ExecuteVerb(Index
: Integer); override;
1567 function GetVerb(Index
: Integer): string; override;
1568 function GetVerbCount
: Integer; override;
1571 TKOLToolButtonOnClickPropEditor
= class( TMethodProperty
)
1573 FResetting
: Boolean;
1576 function GetValue
: string; override;
1577 procedure SetValue(const AValue
: string); override;
1581 //===========================================================================
1582 //---- MIRROR FOR A DATE TIME PICKER
1583 //---- ÇÅÐÊÀËÎ ÄËß ÂÂÎÄÀ ÄÀÒÛ È ÂÐÅÌÅÍÈ
1584 TKOLDateTimePicker
= class( TKOLControl
)
1586 FOnDTPUserString
: TDTParseInputEvent
;
1587 FOptions
: TDateTimePickerOptions
;
1589 procedure SetOnDTPUserString(const Value
: TDTParseInputEvent
);
1590 procedure SetOptions(const Value
: TDateTimePickerOptions
);
1591 procedure SetFormat(const Value
: String);
1593 function SetupParams( const AName
, AParent
: String ): String; override;
1594 function GenerateTransparentInits
: String; override;
1595 procedure SetupFirst(SL
: TStringList
; const AName
, AParent
, Prefix
: String); override;
1596 procedure AssignEvents( SL
: TStringList
; const AName
: String ); override;
1598 constructor Create( AOwner
: TComponent
); override;
1600 function TabStopByDefault
: Boolean; override;
1601 property OnDTPUserString
: TDTParseInputEvent read FOnDTPUserString write SetOnDTPUserString
;
1602 property Options
: TDateTimePickerOptions read FOptions write SetOptions
;
1603 property Format
: String read FFormat write SetFormat
;
1609 //===========================================================================
1610 //---- MIRROR FOR A TAB CONTROL
1611 //---- ÇÅÐÊÀËÎ ÄËß ÒÀÁÓËÈÐÎÂÀÍÍÎÃÎ ÁËÎÊÍÎÒÀ
1612 TKOLTabPage
= TKOLPanel
;
1614 TKOLTabControl
= class( TKOLControl
)
1616 FOptions
: TTabControlOptions
;
1617 FImageList
: TKOLImageList
;
1619 FImageList1stIdx
: Integer;
1620 FedgeType
: TEdgeStyle
;
1621 FpopupMenu
: TKOLPopupMenu
; // of TRect
1622 FCurPage
: TKOLPanel
;
1623 FgenerateConstants
: Boolean;
1624 procedure SetOptions(const Value
: TTabControlOptions
);
1625 procedure SetImageList(const Value
: TKOLImageList
);
1626 function GetPages(Idx
: Integer): TKOLTabPage
;
1627 procedure SetCount(const Value
: Integer);
1628 function GetCount
: Integer;
1629 procedure AdjustPages
;
1630 function GetCurIndex
: Integer;
1631 procedure SetCurIndex(const Value
: Integer);
1632 procedure AttemptToChangePageBounds( Sender
: TObject
; var NewBounds
: TRect
);
1633 procedure SetImageList1stIdx(const Value
: Integer);
1634 procedure SetedgeType(const Value
: TEdgeStyle
);
1635 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1636 procedure SetgenerateConstants(const Value
: Boolean);
1638 fDestroyingTabControl
: Boolean;
1639 FAdjustingPages
: Boolean;
1640 function TabStopByDefault
: Boolean; override;
1641 function SetupParams( const AName
, AParent
: String ): String; override;
1642 procedure SetupFirst(SL
: TStringList
; const AName
, AParent
, Prefix
: String); override;
1643 procedure SetupLast(SL
: TStringList
; const AName
, AParent
, Prefix
: String); override;
1644 procedure SchematicPaint
;
1645 procedure Paint
; override;
1646 function WYSIWIGPaintImplemented
: Boolean; override;
1647 function NoDrawFrame
: Boolean; override;
1648 function GetCurrentPage
: TKOLTabPage
;
1649 procedure DoGenerateConstants( SL
: TStringList
); override;
1651 constructor Create( AOwner
: TComponent
); override;
1652 destructor Destroy
; override;
1653 property Pages
[ Idx
: Integer ]: TKOLTabPage read GetPages
;
1654 procedure SetBounds( aLeft
, aTop
, aWidth
, aHeight
: Integer ); override;
1656 property Transparent
;
1657 property Options
: TTabControlOptions read FOptions write SetOptions
;
1658 property ImageList
: TKOLImageList read FImageList write SetImageList
;
1659 property ImageList1stIdx
: Integer read FImageList1stIdx write SetImageList1stIdx
;
1660 property Count
: Integer read GetCount write SetCount
;
1662 property CurIndex
: Integer read GetCurIndex write SetCurIndex stored
FALSE;
1663 property OnSelChange
;
1664 property edgeType
: TEdgeStyle read FedgeType write SetedgeType
;
1667 property MarginBottom
;
1668 property MarginLeft
;
1669 property MarginRight
;
1672 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1676 property generateConstants
: Boolean read FgenerateConstants write SetgenerateConstants
;
1677 property OnDrawItem
;
1681 TKOLTabControlEditor
= class( TComponentEditor
)
1682 // This component editor is to provide easy page select on tab control with
1683 // double click on one of page indicators.
1687 procedure Edit
; override;
1688 procedure ExecuteVerb(Index
: Integer); override;
1689 function GetVerb(Index
: Integer): string; override;
1690 function GetVerbCount
: Integer; override;
1695 //===========================================================================
1696 //---- MIRROR FOR A SCROLL BOX
1697 //---- ÇÅÐÊÀËÎ ÄËß ÎÊÍÀ ÏÐÎÊÐÓÒÊÈ
1698 TScrollBars
= ( ssNone
, ssHorz
, ssVert
, ssBoth
);
1700 TKOLScrollBox
= class( TKOLControl
)
1702 FScrollBars
: TScrollBars
;
1703 FControlContainer
: Boolean;
1704 FEdgeStyle
: TEdgeStyle
;
1705 FpopupMenu
: TKOLPopupMenu
;
1706 fNotAvailable
: Boolean;
1707 procedure SetScrollBars(const Value
: TScrollBars
);
1708 procedure SetControlContainer(const Value
: Boolean);
1709 procedure SetEdgeStyle(const Value
: TEdgeStyle
);
1710 procedure SetpopupMenu(const Value
: TKOLPopupMenu
);
1712 procedure SetupFirst(SL
: TStringList
; const AName
, AParent
, Prefix
: String); override;
1713 function SetupParams( const AName
, AParent
: String ): String; override;
1714 function IsControlContainer
: Boolean; virtual;
1715 function TypeName
: String; override;
1718 constructor Create( AOwner
: TComponent
); override;
1719 property ScrollBars
: TScrollBars read FScrollBars write SetScrollBars
;
1720 property ControlContainer
: Boolean read FControlContainer write SetControlContainer
;
1721 property EdgeStyle
: TEdgeStyle read FEdgeStyle write SetEdgeStyle
;
1722 property popupMenu
: TKOLPopupMenu read FpopupMenu write SetpopupMenu
;
1724 property Caption
: Boolean read fNotAvailable
;
1726 property MarginBottom
;
1727 property MarginLeft
;
1728 property MarginRight
;
1730 property Transparent
;
1744 RegisterComponents( 'KOL', [ TKOLButton
, TKOLBitBtn
, TKOLLabel
, TKOLLabelEffect
, TKOLPanel
,
1745 TKOLSplitter
, TKOLGradientPanel
, TKOLGroupBox
, TKOLCheckBox
, TKOLRadioBox
,
1746 TKOLEditBox
, TKOLMemo
, TKOLRichEdit
, TKOLListBox
, TKOLComboBox
, TKOLPaintBox
,
1747 TKOLProgressBar
, TKOLListView
, TKOLTreeView
, TKOLToolbar
, TKOLTabControl
,
1748 TKOLDateTimePicker
, TKOLImageShow
, TKOLScrollBox
, TKOLMDIClient
] );
1749 RegisterPropertyEditor( TypeInfo( string ), TKOLToolbar
, 'buttons',
1750 TKOLToolbarButtonsEditor
);
1751 RegisterPropertyEditor( TypeInfo( TOnToolbarButtonClick
), TKOLToolbarButton
, 'onClick',
1752 TKOLToolButtonOnClickPropEditor
);
1753 RegisterPropertyEditor( TypeInfo( string ), TKOLListView
, 'Columns',
1754 TKOLLVColumnsPropEditor
);
1755 RegisterComponentEditor( TKOLToolbar
, TKOLToolbarEditor
);
1756 RegisterComponentEditor( TKOLTabControl
, TKOLTabControlEditor
);
1757 RegisterComponentEditor( TKOLListView
, TKOLLVColumnsEditor
);
1760 {function CanMapBitmap( Bitmap: TBitmap ): Boolean;
1761 var KOLBmp: KOL.PBitmap;
1763 KOLBmp := NewDIBBitmap( Bitmap.Width, Bitmap.Height, KOL.pf32bit );
1765 BitBlt( KOLBmp.Canvas.Handle, 0, 0, Bitmap.Width, Bitmap.Height,
1766 Bitmap.Canvas.Handle, 0, 0, SRCCOPY );
1767 KOLBmp.HandleType := KOL.bmDIB;
1768 KOLBmp.PixelFormat := KOL.pf32bit;
1769 case CountSystemColorsUsedInBitmap( KOLBmp ) of
1770 KOL.pf1bit, KOL.pf4bit, KOL.pf8bit: Result := TRUE;
1771 else Result := FALSE
1773 //Rpt( '!!!! CanMapBitmap: ' + Int2Str( Integer( Result ) ) );
1778 (*var BI: TBitmapInfo;
1783 DB '#$signature$#', 0
1784 DB 'CanMapBitmap', 0
1788 if Bitmap = nil then Exit;
1789 if (Bitmap.Width = 0) or (Bitmap.Height = 0) then Exit;
1791 if (Bitmap.HandleType = bmDIB) and not (Bitmap.PixelFormat in [pfCustom, pfDevice]) then
1793 //ShowMessage( 'format=' + IntToStr( Integer( Bitmap.PixelFormat ) ) );
1794 Result := Bitmap.PixelFormat in [ pf1bit, pf4bit, pf8bit ];
1799 if Bitmap.Handle = 0 then
1803 if GetObject( Bitmap.Handle, Sizeof( BI ), @BI ) = 0 then
1807 C := BI.bmiHeader.biBitCount;
1808 Result := (C=1) or (C=4) or (C=8);
1816 function TKOLButton.CanChangeColor: Boolean;
1820 DB '#$signature$#', 0
1821 DB 'TKOLButton.CanChangeColor', 0
1827 function TKOLButton.CanNotChangeFontColor: Boolean;
1831 DB '#$signature$#', 0
1832 DB 'TKOLButton.CanNotChangeFontColor', 0
1838 function TKOLButton.ClientMargins: TRect;
1842 DB '#$signature$#', 0
1843 DB 'TKOLButton.ClientMargins', 0
1846 Result := Rect( 2, 2, 2, 2 );
1849 constructor TKOLButton.Create(AOwner: TComponent);
1853 DB '#$signature$#', 0
1854 DB 'TKOLButton.Create', 0
1858 FImage := TPicture.Create;
1859 FDefIgnoreDefault := TRUE;
1860 FIgnoreDefault := TRUE;
1862 Height := 22; DefaultHeight := 22;
1863 TextAlign := taCenter;
1864 VerticalAlign := vaCenter;
1868 procedure TKOLButton.CreateKOLControl(Recreating: boolean);
1870 FKOLCtrl:=NewButton(KOLParentCtrl, '');
1873 function TKOLButton.DefaultParentColor: Boolean;
1877 DB '#$signature$#', 0
1878 DB 'TKOLButton.DefaultParentColor', 0
1884 destructor TKOLButton.Destroy;
1890 procedure TKOLButton.FirstCreate;
1894 DB '#$signature$#', 0
1895 DB 'TKOLButton.FirstCreate', 0
1902 function TKOLButton.GenerateTransparentInits: String;
1906 DB '#$signature$#', 0
1907 DB 'TKOLButton.GenerateTransparentInits', 0
1910 Result := inherited GenerateTransparentInits;
1911 if assigned( Fimage ) {and Assigned( Fimage.Graphic ) and
1912 not Fimage.Graphic.Empty} then
1914 if Assigned( image.Icon ) and not image.icon.Empty
1916 and (image.icon.Width > 0) and (image.icon.Height > 0)
1920 Result := Result + '.SetButtonIcon( LoadIcon( hInstance, ''' +
1921 ImageResourceName + ''' ) )';
1922 Rpt( 'Button has icon, generating code SetButtonIcon:'#13#10 + Result );
1925 if Assigned( image.Bitmap ) and not image.Bitmap.Empty then
1927 Rpt( 'Button has bitmap, generating code SetBittonBitmap' );
1928 Result := Result + '.SetButtonBitmap( LoadBitmap( hInstance, ''' +
1929 ImageResourceName + ''' ) )';
1932 if LikeSpeedButton then
1933 Result := Result + '.LikeSpeedButton';
1936 function TKOLButton.ImageResourceName: String;
1938 Result := 'Z' + UpperCase( ParentForm.Name ) + '_' + UpperCase( Name ) + '_IMAGE';
1941 function TKOLButton.NoDrawFrame: Boolean;
1946 procedure TKOLButton.Paint;
1948 if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
1949 PrepareCanvasFontForWYSIWIGPaint( Canvas );
1950 DrawButton( Self, Canvas );
1955 procedure TKOLButton.SetFlat(const Value: Boolean);
1961 procedure TKOLButton.Setimage(const Value: TPicture);
1964 if Assigned( Value ) and Assigned( Value.Graphic ) then
1966 Fimage.Assign( Value.Graphic );
1967 Rpt( '$$$$$$$$$$$$ Success' );
1971 FImage.Assign( nil );
1972 Rpt( '$$$$$$$$$$$$ nil' );
1975 Rpt( '$$$$$$$$$$$$ Exception assigning image (' + Name + ')' );
1980 procedure TKOLButton.SetLikeSpeedButton(const Value: Boolean);
1984 DB '#$signature$#', 0
1985 DB 'TKOLButton.SetLikeSpeedButton', 0
1988 FLikeSpeedButton := Value;
1992 procedure TKOLButton.SetpopupMenu(const Value: TKOLPopupMenu);
1996 DB '#$signature$#', 0
1997 DB 'TKOLButton.SetpopupMenu', 0
2000 FpopupMenu := Value;
2004 procedure TKOLButton.SetupColor(SL: TStrings; const AName: String);
2008 DB '#$signature$#', 0
2009 DB 'TKOLButton.SetupColor', 0
2012 // there are no setup color for TKOLButton:
2013 if ClassName = 'TKOLButton' then Exit;
2017 procedure TKOLButton.SetupFirst(SL: TStringList; const AName, AParent,
2019 var Updated: Boolean;
2023 DB '#$signature$#', 0
2024 DB 'TKOLButton.SetupFirst', 0
2028 if Assigned( FpopupMenu ) then
2029 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
2033 SL.Add( Prefix + AName + '.Style := ' + AName + '.Style or BS_FLAT;' )
2035 SL.Add( Prefix + AName + '.Flat := TRUE;' );
2037 if assigned( Fimage ) {and Assigned( Fimage.Graphic ) and
2038 not Fimage.Graphic.Empty} then
2040 if Assigned( image.Icon ) and not image.icon.Empty then
2042 Rpt( 'Button has icon, generate resource' );
2043 SL.Add( '{$R ' + ImageResourceName + '.res}' );
2044 GenerateIconResource( image.Icon, ImageResourceName, ImageResourceName,
2048 if Assigned( image.Bitmap ) and not image.Bitmap.Empty then
2050 Rpt( 'Button has bitmap, generate resource' );
2051 GenerateBitmapResource( image.Bitmap, ImageResourceName, ImageResourceName,
2057 procedure TKOLButton.SetupFont(SL: TStrings; const AName: String);
2058 var BFont: TKOLFont;
2062 DB '#$signature$#', 0
2063 DB 'TKOLButton.SetupFont', 0
2066 if (ParentKOLControl = ParentKOLForm) and (ParentKOLForm <> nil) then
2067 BFont := ParentKOLForm.Font
2069 if (ParentKOLControl <> nil) and (ParentKOLControl is TKOLCustomControl) then
2070 BFont := (ParentKOLControl as TKOLCustomControl).Font
2073 if BFont = nil then Exit;
2074 BFont.Color := Font.Color;
2075 if not Font.Equal2( BFont ) then
2076 Font.GenerateCode( SL, AName, BFont );
2079 function TKOLButton.SetupParams(const AName, AParent: String): String;
2085 DB '#$signature$#', 0
2086 DB 'TKOLButton.SetupParams', 0
2089 if action = nil then
2090 C := StringConstant('Caption',Caption)
2093 Result := AParent + ', ' + C;
2096 const TextAligns: array[ TTextAlign ] of String = ( 'taLeft', 'taRight', 'taCenter' );
2097 VertAligns: array[ TVerticalAlign ] of String = ( 'vaTop', 'vaCenter', 'vaBottom' );
2099 procedure TKOLButton.SetupTextAlign(SL: TStrings; const AName: String);
2103 DB '#$signature$#', 0
2104 DB 'TKOLButton.SetupTextAlign', 0
2107 if TextAlign <> taCenter then
2108 SL.Add( ' ' + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
2109 if VerticalAlign <> vaCenter then
2110 SL.Add( ' ' + AName + '.VerticalAlign := ' + VertAligns[ VerticalAlign ] + ';' );
2113 function TKOLButton.TabStopByDefault: Boolean;
2117 DB '#$signature$#', 0
2118 DB 'TKOLButton.TabStopByDefault', 0
2124 function TKOLButton.TypeName: String;
2128 DB '#$signature$#', 0
2129 DB 'TKOLButton.TypeName', 0
2132 Result := inherited TypeName;
2134 Result := 'WordWrap' + Result;}
2137 function TKOLButton.WYSIWIGPaintImplemented: Boolean;
2144 function TKOLLabel.AdjustVerticalAlign(
2145 Value: TVerticalAlign): TVerticalAlign;
2149 DB '#$signature$#', 0
2150 DB 'TKOLButton.AdjustVerticalAlign', 0
2153 if (Value = vaBottom) and Windowed and not( csLoading in ComponentState ) then
2159 procedure TKOLLabel.CallInheritedPaint;
2164 constructor TKOLLabel.Create(AOwner: TComponent);
2168 DB '#$signature$#', 0
2169 DB 'TKOLLabel.Create', 0
2175 Height := 22; DefaultHeight := 22;
2179 procedure TKOLLabel.FirstCreate;
2183 DB '#$signature$#', 0
2184 DB 'TKOLLabel.FirstCreate', 0
2191 function TKOLLabel.GetTaborder: Integer;
2195 DB '#$signature$#', 0
2196 DB 'TKOLLabel.GetTaborder', 0
2202 function TKOLLabel.Get_VertAlign: TVerticalAlign;
2206 DB '#$signature$#', 0
2207 DB 'TKOLLabel.Get_VertAlign', 0
2210 Result := inherited VerticalAlign;
2213 procedure TKOLLabel.Loaded;
2216 VerticalAlign := VerticalAlign;
2219 procedure TKOLLabel.Paint;
2223 TMPBrushStyle: TBrushStyle;
2227 DB '#$signature$#', 0
2228 DB 'TKOLLabel.Paint', 0
2238 taRight: Flag:=Flag or DT_RIGHT;
2239 taLeft: Flag:=Flag or DT_LEFT;
2240 taCenter: Flag:=Flag or DT_CENTER;
2243 case VerticalAlign of
2244 vaTop: Flag:=Flag or DT_TOP;
2245 vaBottom: Flag:=Flag or DT_BOTTOM;
2246 vaCenter: Flag:=Flag or DT_VCENTER or DT_SINGLELINE;
2249 if (WordWrap) and (not AutoSize or (Align in [ caClient, caTop, caBottom ])) then
2250 Flag:=Flag or DT_WORDBREAK;
2252 PrepareCanvasFontForWYSIWIGPaint( Canvas );
2254 TMPBrushStyle := Canvas.Brush.Style;
2255 Canvas.Brush.Style := bsClear;
2256 DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);
2257 Canvas.Brush.Style :=TMPBrushStyle;
2263 procedure TKOLLabel.SetpopupMenu(const Value: TKOLPopupMenu);
2267 DB '#$signature$#', 0
2268 DB 'TKOLLabel.SetpopupMenu', 0
2271 FpopupMenu := Value;
2275 procedure TKOLLabel.SetShowAccelChar(const Value: Boolean);
2277 FShowAccelChar := Value;
2281 procedure TKOLLabel.SetupFirst(SL: TStringList; const AName, AParent,
2286 DB '#$signature$#', 0
2287 DB 'TKOLLabel.SetupFirst', 0
2291 if Assigned( FpopupMenu ) then
2292 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
2294 if ShowAccelChar then
2295 SL.Add( Prefix + AName + '.Style := ' + AName + '.Style and not SS_NOPREFIX;' );
2298 function TKOLLabel.SetupParams(const AName, AParent: String): String;
2302 DB '#$signature$#', 0
2303 DB 'TKOLLabel.SetupParams', 0
2306 Result := AParent + ', ' + StringConstant('Caption', Caption);
2309 procedure TKOLLabel.SetupTextAlign(SL: TStrings; const AName: String);
2313 DB '#$signature$#', 0
2314 DB 'TKOLLabel.SetupTextAlign', 0
2317 if TextAlign <> taLeft then
2318 SL.Add( ' ' + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
2319 if VerticalAlign <> vaTop then
2320 SL.Add( ' ' + AName + '.VerticalAlign := ' + VertAligns[ VerticalAlign ] + ';' );
2323 procedure TKOLLabel.Set_VertAlign(const Value: TVerticalAlign);
2327 DB '#$signature$#', 0
2328 DB 'TKOLLabel.Set_VertAlign', 0
2331 inherited VerticalAlign := AdjustVerticalAlign( Value );
2334 function TKOLLabel.TypeName: String;
2338 DB '#$signature$#', 0
2339 DB 'TKOLLabel.TypeName', 0
2342 Result := inherited TypeName;
2344 Result := 'WordWrap' + Result;}
2347 function TKOLLabel.WYSIWIGPaintImplemented: Boolean;
2351 DB '#$signature$#', 0
2352 DB 'TKOLLabel.WYSIWIGPaintImplemented', 0
2360 function TKOLPanel.ClientMargins: TRect;
2364 DB '#$signature$#', 0
2365 DB 'TKOLPanel.ClientMargins', 0
2369 esLowered: Result := Rect( 1, 1, 1, 1 );
2370 esRaised: Result := Rect( 3, 3, 3, 3 );
2371 esNone: Result := Rect( 0, 0, 0, 0 );
2375 constructor TKOLPanel.Create(AOwner: TComponent);
2379 DB '#$signature$#', 0
2380 DB 'TKOLPanel.Create', 0
2384 Width := 100; DefaultWidth := Width;
2385 Height := 100; DefaultHeight := 100;
2386 ControlStyle := ControlStyle + [ csAcceptsControls ];
2389 destructor TKOLPanel.Destroy;
2390 var P: TKOLTabControl;
2394 DB '#$signature$#', 0
2395 DB 'TKOLPanel.Destroy', 0
2398 if Parent <> nil then
2399 if Parent is TKOLTabControl then
2401 P:=Parent as TKOLTabControl;
2402 if (P.FCurPage=self) and (P.CurIndex>0) then P.CurIndex:=pred(P.CurIndex);
2408 function TKOLPanel.Get_VA: TVerticalAlign;
2412 DB '#$signature$#', 0
2413 DB 'TKOLPanel.Get_VA', 0
2416 Result := inherited VerticalAlign;
2419 function TKOLPanel.NoDrawFrame: Boolean;
2423 DB '#$signature$#', 0
2424 DB 'TKOLPanel.NoDrawFrame', 0
2427 Result := (EdgeStyle <> esNone) or
2428 (Parent <> nil) and (Parent is TKOLTabControl);
2431 procedure TKOLPanel.Paint;
2434 Flag,EdgeFlag:DWord;
2439 DB '#$signature$#', 0
2440 DB 'TKOLPanel.Paint', 0
2452 EdgeFlag:=EDGE_RAISED;
2458 EdgeFlag:=BDR_SUNKENOUTER;
2472 DrawEdge(Canvas.Handle,R,EdgeFlag,BF_RECT or BF_MIDDLE );
2475 R.Right:=Width-Delta;
2476 R.Bottom:=Height-Delta;
2477 Canvas.Brush.Color := Color;
2478 Canvas.FillRect( R );
2483 taRight: Flag:=Flag or DT_RIGHT;
2484 taLeft: Flag:=Flag or DT_LEFT;
2485 taCenter: Flag:=Flag or DT_CENTER;
2488 case VerticalAlign of
2489 vaTop: Flag:=Flag or DT_TOP or DT_SINGLELINE;
2490 vaBottom: Flag:=Flag or DT_BOTTOM or DT_SINGLELINE;
2491 vaCenter: Flag:=Flag or DT_VCENTER or DT_SINGLELINE;
2494 Flag:=Flag+DT_WORDBREAK;
2496 if not( (Parent <> nil) and (Parent is TKOLTabControl) ) then
2498 PrepareCanvasFontForWYSIWIGPaint( Canvas );
2499 DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);
2505 function TKOLPanel.RefName: String;
2510 DB '#$signature$#', 0
2511 DB 'TKOLPanel.RefName', 0
2514 Result := inherited RefName;
2515 if Parent is TKOLTabControl then
2517 for J := 0 to (Parent as TKOLTabControl).Count - 1 do
2518 if (Parent as TKOLTabControl).Pages[ J ] = Self then
2520 Result := (Parent as TKOLTabControl).RefName + '.Pages[ ' + IntToStr( J ) + ' ]';
2526 procedure TKOLPanel.SetCaption(const Value: String);
2529 if (Parent <> nil) and (Parent is TKOLTabControl) then
2533 procedure TKOLPanel.SetEdgeStyle(const Value: TEdgeStyle);
2537 DB '#$signature$#', 0
2538 DB 'TKOLPanel.SetEdgeStyle', 0
2541 if FEdgeStyle = Value then Exit;
2542 FEdgeStyle := Value;
2548 procedure TKOLPanel.SetpopupMenu(const Value: TKOLPopupMenu);
2552 DB '#$signature$#', 0
2553 DB 'TKOLPanel.SetpopupMenu', 0
2556 FpopupMenu := Value;
2560 procedure TKOLPanel.SetShowAccelChar(const Value: Boolean);
2562 FShowAccelChar := Value;
2566 procedure TKOLPanel.SetupConstruct(SL: TStringList; const AName, AParent,
2571 DB '#$signature$#', 0
2572 DB 'TKOLPanel.SetupConstruct', 0
2575 if Parent <> nil then
2576 if Parent is TKOLTabControl then
2577 Exit; // this is not a panel, but a tab page on tab control.
2581 procedure TKOLPanel.SetupFirst(SL: TStringList; const AName,
2582 AParent, Prefix: String);
2586 DB '#$signature$#', 0
2587 DB 'TKOLPanel.SetupFirst', 0
2591 if Parent <> nil then
2592 if Parent is TKOLTabControl then
2593 Exit; // this is not a panel, but a tab page on tab control.
2594 if Caption <> '' then
2595 SL.Add( Prefix + AName + '.Caption := ' + StringConstant('Caption', Caption) + ';' );
2596 if Assigned( FpopupMenu ) then
2597 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
2599 if ShowAccelChar then
2600 SL.Add( Prefix + AName + '.Style := ' + AName + '.Style and not SS_NOPREFIX;' );
2603 function TKOLPanel.SetupParams(const AName, AParent: String): String;
2604 const EdgeStyles: array[ TEdgeStyle ] of String = ( 'esRaised', 'esLowered', 'esNone' );
2608 DB '#$signature$#', 0
2609 DB 'TKOLPanel.SetupParams', 0
2612 Result := AParent + ', ' + EdgeStyles[ EdgeStyle ];
2615 procedure TKOLPanel.SetupTextAlign(SL: TStrings; const AName: String);
2619 DB '#$signature$#', 0
2620 DB 'TKOLPanel.SetupTextAlign', 0
2623 if TextAlign <> taLeft then
2624 SL.Add( ' ' + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
2625 if VerticalAlign <> vaTop then
2626 SL.Add( ' ' + AName + '.VerticalAlign := ' + VertAligns[ VerticalAlign ] + ';' );
2629 procedure TKOLPanel.Set_VA(const Value: TVerticalAlign);
2633 DB '#$signature$#', 0
2634 DB 'TKOLPanel.Set_VA', 0
2637 if Value = vaBottom then
2638 inherited VerticalAlign := vaCenter
2640 inherited VerticalAlign := Value;
2643 function TKOLPanel.WYSIWIGPaintImplemented: Boolean;
2647 DB '#$signature$#', 0
2648 DB 'TKOLPanel.WYSIWIGPaintImplemented', 0
2656 procedure TKOLBitBtn.AssignEvents(SL: TStringList; const AName: String);
2660 DB '#$signature$#', 0
2661 DB 'TKOLBitBtn.AssignEvents', 0
2665 DoAssignEvents( SL, AName, [ 'OnTestMouseOver' ], [ @OnTestMouseOver ] );
2668 procedure TKOLBitBtn.AutoSizeNow;
2669 var TmpBmp: graphics.TBitmap;
2674 DB '#$signature$#', 0
2675 DB 'TKOLBitBtn.AutoSizeNow', 0
2678 if fAutoSizingNow then Exit;
2679 fAutoSizingNow := TRUE;
2680 TmpBmp := graphics.TBitmap.Create;
2683 TmpBmp.Height := 10;
2684 //Rpt( 'TmpBmp.Width=' + IntToStr( TmpBmp.Width ) + ' TmpBmp.Height=' + IntToStr( TmpBmp.Height ) );
2685 TmpBmp.Canvas.Font.Name := Font.FontName;
2686 TmpBmp.Canvas.Font.Style := TFontStyles(Font.FontStyle);
2687 if Font.FontHeight > 0 then
2688 TmpBmp.Canvas.Font.Height := Font.FontHeight
2690 if Font.FontHeight < 0 then
2691 TmpBmp.Canvas.Font.Size := - Font.FontHeight
2693 TmpBmp.Canvas.Font.Size := 0;
2694 W := TmpBmp.Canvas.TextWidth( Caption );
2695 if fsItalic in TFontStyles( Font.FontStyle ) then
2696 Inc( W, TmpBmp.Canvas.TextWidth( ' ' ) );
2697 H := TmpBmp.Canvas.TextHeight( 'Ap^_' );
2698 //Rpt( 'W=' + IntToStr( W ) + ' H=' + IntToStr( H ) );
2699 if Align in [ caNone, caLeft, caRight ] then
2701 if (glyphBitmap.Width > 0) and (glyphBitmap.Height > 0) then
2703 I := glyphBitmap.Width;
2704 if glyphCount > 1 then
2705 I := I div glyphCount;
2706 if glyphLayout in [ glyphLeft, glyphRight ] then
2712 if not (bboNoBorder in options) then
2714 Width := W + fAutoSzX;
2716 if Align in [ caNone, caTop, caBottom ] then
2718 if (glyphBitmap.Width > 0) and (glyphBitmap.Height > 0) then
2720 I := glyphBitmap.Height;
2721 if glyphLayout in [ glyphTop, glyphBottom ] then
2722 H := H + I + fAutoSzY
2726 if not (bboNoBorder in options) then
2728 Height := H; // + fAutoSzY;
2732 fAutoSizingNow := FALSE;
2736 function TKOLBitBtn.ClientMargins: TRect;
2740 DB '#$signature$#', 0
2741 DB 'TKOLBitBtn.ClientMargins', 0
2744 Result := Rect( 3, 3, 3, 3 );
2747 constructor TKOLBitBtn.Create(AOwner: TComponent);
2751 DB '#$signature$#', 0
2752 DB 'TKOLBitBtn.Create', 0
2756 FDefIgnoreDefault := TRUE;
2757 FIgnoreDefault := TRUE;
2760 FGlyphBitmap := TBitmap.Create;
2761 Height := 22; DefaultHeight := 22;
2762 DefaultWidth := Width;
2763 TextAlign := taCenter;
2764 VerticalAlign := vaCenter;
2770 procedure TKOLBitBtn.CreateKOLControl(Recreating: boolean);
2772 FKOLCtrl:=NewBitBtn(KOLParentCtrl, '', [], glyphLeft, 0, 0);
2775 destructor TKOLBitBtn.Destroy;
2779 DB '#$signature$#', 0
2780 DB 'TKOLBitBtn.Destroy', 0
2784 if ImageList <> nil then
2785 ImageList.NotifyLinkedComponent( Self, noRemoved );
2789 procedure TKOLBitBtn.FirstCreate;
2793 DB '#$signature$#', 0
2794 DB 'TKOLBitBtn.FirstCreate', 0
2801 function TKOLBitBtn.GenerateTransparentInits: String;
2805 DB '#$signature$#', 0
2806 DB 'TKOLBitBtn.GenerateTransparentInits', 0
2809 if autoAdjustSize then
2811 DefaultWidth := Width;
2812 DefaultHeight := Height;
2814 Result := inherited GenerateTransparentInits;
2815 if LikeSpeedButton then
2816 Result := Result + '.LikeSpeedButton';
2819 function TKOLBitBtn.NoDrawFrame: Boolean;
2824 procedure TKOLBitBtn.NotifyLinkedComponent(Sender: TObject;
2825 Operation: TNotifyOperation);
2829 DB '#$signature$#', 0
2830 DB 'TKOLBitBtn.NotifyLinkedComponent', 0
2834 if Operation = noRemoved then
2838 procedure TKOLBitBtn.RecalcSize;
2842 DB '#$signature$#', 0
2843 DB 'TKOLBitBtn.RecalcSize', 0
2846 if (ImageList <> nil) or
2847 (GlyphBitmap.Width <> 0) and (GlyphBitmap.Height <> 0) then
2855 DefaultHeight := 22;
2859 procedure TKOLBitBtn.SetautoAdjustSize(const Value: Boolean);
2863 DB '#$signature$#', 0
2864 DB 'TKOLBitBtn.SetautoAdjustSize', 0
2867 FautoAdjustSize := Value;
2871 procedure TKOLBitBtn.SetBitBtnDrawMnemonic(const Value: Boolean);
2875 DB '#$signature$#', 0
2876 DB 'TKOLBitBtn.SetBitBtnDrawMnemonic', 0
2879 FBitBtnDrawMnemonic := Value;
2883 procedure TKOLBitBtn.SetFlat(const Value: Boolean);
2887 DB '#$signature$#', 0
2888 DB 'TKOLBitBtn.SetFlat', 0
2895 procedure TKOLBitBtn.SetGlyphBitmap(const Value: TBitmap);
2899 DB '#$signature$#', 0
2900 DB 'TKOLBitBtn.SetGlyphBitmap', 0
2903 if (Value <> nil) and (not Value.Empty) then
2905 FGlyphBitmap.Assign( Value );
2906 FOptions := FOptions - [bboImageList];
2911 {FGlyphBitmap.Width := 0;
2912 FGlyphBitmap.Height := 0;}
2914 FGlyphBitmap := TBitmap.Create;
2917 if FGlyphBitmap.Height > 0 then
2918 FGlyphCount := FGlyphBitmap.Width div FGlyphBitmap.Height;
2920 if (DefaultWidth <> 0) and (DefaultHeight <> 0) then
2922 Width := DefaultWidth;
2923 Height := DefaultHeight;
2928 procedure TKOLBitBtn.SetGlyphCount(Value: Integer);
2932 DB '#$signature$#', 0
2933 DB 'TKOLBitBtn.SetGlyphCount', 0
2940 if Value = FGlyphCount then Exit;
2941 FGlyphCount := Value;
2945 procedure TKOLBitBtn.SetGlyphLayout(const Value: TGlyphLayout);
2949 DB '#$signature$#', 0
2950 DB 'TKOLBitBtn.SetGlyphLayout', 0
2953 FGlyphLayout := Value;
2959 procedure TKOLBitBtn.SetImageIndex(const Value: Integer);
2963 DB '#$signature$#', 0
2964 DB 'TKOLBitBtn.SetImageIndex', 0
2967 FImageIndex := Value;
2971 procedure TKOLBitBtn.SetImageList(const Value: TKOLImageList);
2975 DB '#$signature$#', 0
2976 DB 'TKOLBitBtn.SetImageList', 0
2979 if FImageList <> nil then
2980 FImageList.NotifyLinkedComponent( Self, noRemoved );
2981 FImageList := Value;
2982 if (Value <> nil) and (Value is TKOLImageList) then
2984 FGlyphBitmap.Width := 0;
2985 FGlyphBitmap.Height := 0;
2986 FOptions := FOptions + [bboImageList];
2987 Value.AddToNotifyList( Self );
2990 FOptions := FOptions - [bboImageList];
2994 procedure TKOLBitBtn.SetLikeSpeedButton(const Value: Boolean);
2998 DB '#$signature$#', 0
2999 DB 'TKOLBitBtn.SetLikeSpeedButton', 0
3002 FLikeSpeedButton := Value;
3006 procedure TKOLBitBtn.SetOnTestMouseOver(const Value: TOnTestMouseOver);
3010 DB '#$signature$#', 0
3011 DB 'TKOLBitBtn.SetOnTestMouseOver', 0
3014 FOnTestMouseOver := Value;
3018 procedure TKOLBitBtn.SetOptions(Value: TBitBtnOptions);
3022 DB '#$signature$#', 0
3023 DB 'TKOLBitBtn.SetOptions', 0
3026 Value := Value - [ bboImageList ];
3027 if Assigned( ImageList ) then
3028 Value := Value + [bboImageList];
3033 function BitBtnOptions( Options: TBitBtnOptions ): String;
3037 DB '#$signature$#', 0
3038 DB 'BitBtnOptions', 0
3042 if bboImageList in Options then
3043 Result := 'bboImageList, ';
3044 if bboNoBorder in Options then
3045 Result := Result + 'bboNoBorder, ';
3046 if bboNoCaption in Options then
3047 Result := Result + 'bboNoCaption, ';
3048 if bboFixed in Options then
3049 Result := Result + 'bboFixed, ';
3050 Result := Trim( Result );
3051 if Result <> '' then
3052 Result := Copy( Result, 1, Length( Result ) - 1 );
3053 Result := '[ ' + Result + ' ]';
3056 procedure TKOLBitBtn.SetpopupMenu(const Value: TKOLPopupMenu);
3060 DB '#$signature$#', 0
3061 DB 'TKOLBitBtn.SetpopupMenu', 0
3064 FpopupMenu := Value;
3068 procedure TKOLBitBtn.SetRepeatInterval(const Value: Integer);
3072 DB '#$signature$#', 0
3073 DB 'TKOLBitBtn.SetRepeatInterval', 0
3076 FRepeatInterval := Value;
3080 procedure TKOLBitBtn.SetTextShiftX(const Value: Integer);
3084 DB '#$signature$#', 0
3085 DB 'TKOLBitBtn.SetTextShiftX', 0
3088 FTextShiftX := Value;
3092 procedure TKOLBitBtn.SetTextShiftY(const Value: Integer);
3096 DB '#$signature$#', 0
3097 DB 'TKOLBitBtn.SetTextShiftY', 0
3100 FTextShiftY := Value;
3104 procedure TKOLBitBtn.SetupFirst(SL: TStringList; const AName,
3105 AParent, Prefix: String);
3110 DB '#$signature$#', 0
3111 DB 'TKOLBitBtn.SetupFirst', 0
3114 if ImageList = nil then
3115 if Assigned( GlyphBitmap ) and
3116 (GlyphBitmap.Width <> 0) and (GlyphBitmap.Height <> 0) then
3118 RName := ParentKOLForm.FormName + '_' + Name;
3119 Rpt( 'Prepare resource ' + RName + ' (' + UpperCase( Name + '_BITMAP' ) + ')' );
3120 GenerateBitmapResource( GlyphBitmap, UpperCase( Name + '_BITMAP' ), RName, fUpdated );
3121 SL.Add( Prefix + '{$R ' + RName + '.res}' );
3124 if (Height = DefaultHeight) or autoAdjustSize then
3125 if imageList <> nil then
3126 if ImageIndex >= 0 then
3127 SL.Add( Prefix + AName + '.Height := ' + IntToStr( Height ) + ';' );
3128 if (Width = DefaultWidth) or autoAdjustSize then
3129 if imageList <> nil then
3130 if ImageIndex >= 0 then
3131 SL.Add( Prefix + AName + '.Width := ' + IntToStr( Width ) + ';' );
3132 if RepeatInterval > 0 then
3133 SL.Add( Prefix + AName + '.RepeatInterval := ' + IntToStr( RepeatInterval ) + ';' );
3135 SL.Add( Prefix + AName + '.Flat := TRUE;' );
3136 if BitBtnDrawMnemonic then
3137 SL.Add( Prefix + AName + '.BitBtnDrawMnemonic := TRUE;' );
3138 if Assigned( FpopupMenu ) then
3139 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
3141 if TextShiftX <> 0 then
3142 SL.Add( Prefix + AName + '.TextShiftX := ' + IntToStr( TextShiftX ) + ';' );
3143 if TextShiftY <> 0 then
3144 SL.Add( Prefix + AName + '.TextShiftY := ' + IntToStr( TextShiftY ) + ';' );
3148 function TKOLBitBtn.SetupParams(const AName, AParent: String): String;
3149 const Layouts: array[ TGlyphLayout ] of String = ( 'glyphLeft', 'glyphTop',
3150 'glyphRight', 'glyphBottom', 'glyphOver' );
3151 var S, U, C: String;
3155 DB '#$signature$#', 0
3156 DB 'TKOLBitBtn.SetupParams', 0
3161 if (GlyphBitmap <> nil) and
3162 (GlyphBitmap.Width <> 0) and (GlyphBitmap.Height <> 0) then
3164 S := 'LoadBmp( hInstance, ' + String2Pascal(UpperCase( Name + '_BITMAP' )) +
3166 U := IntToStr( GlyphCount );
3169 if (ImageList <> nil) then
3171 if ImageList.ParentFORM.Name = ParentForm.Name then
3172 S := 'Result.' + ImageList.Name + '.Handle'
3173 else S := ImageList.ParentFORM.Name +'.'+ ImageList.Name + '.Handle';
3174 if GlyphCount > 0 then
3175 U := '$' + Int2Hex( GlyphCount shl 16, 5 ) + ' + ' + IntToStr( ImageIndex )
3177 U := IntToStr( ImageIndex );
3179 if action = nil then
3180 C := StringConstant('Caption',Caption)
3183 Result := AParent + ', ' + C + ', ' +
3184 BitBtnOptions( Options ) + ', ' +
3185 Layouts[ GlyphLayout ] + ', ' + S + ', ' + U;
3188 procedure TKOLBitBtn.SetupTextAlign(SL: TStrings; const AName: String);
3192 DB '#$signature$#', 0
3193 DB 'TKOLBitBtn.SetupTextAlign', 0
3196 if TextAlign <> taCenter then
3197 SL.Add( ' ' + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
3198 if VerticalAlign <> vaCenter then
3199 SL.Add( ' ' + AName + '.VerticalAlign := ' + VertAligns[ VerticalAlign ] + ';' );
3202 function TKOLBitBtn.TabStopByDefault: Boolean;
3206 DB '#$signature$#', 0
3207 DB 'TKOLBitBtn.TabStopByDefault', 0
3213 { TKOLGradientPanel }
3215 constructor TKOLGradientPanel.Create(AOwner: TComponent);
3219 DB '#$signature$#', 0
3220 DB 'TKOLGradientPanel.Create', 0
3224 Width := 40; DefaultWidth := Width;
3225 Height := 40; DefaultHeight := Height;
3226 ControlStyle := ControlStyle + [ csAcceptsControls ];
3229 //Transparent := TRUE;
3230 gradientLayout := glTop;
3231 gradientStyle := gsVertical;
3234 function TKOLGradientPanel.NoDrawFrame: Boolean;
3238 DB '#$signature$#', 0
3239 DB 'TKOLGradientPanel.NoDrawFrame', 0
3245 procedure TKOLGradientPanel.Paint;
3247 function Ceil( X: Double ): Integer;
3249 Result := Round( X );
3252 SQRT2 = 1.4142135623730950488016887242097;
3262 R,G,B,R1,G1,B1:Byte;
3266 R2, G2, B2: Integer;
3267 DX1, DX2, DY1, DY2, DR, DG, DB, K: Double;
3268 // PaintStruct: TPaintStruct;
3271 Poly: array[ 0..3 ] of TPoint;
3277 DB '#$signature$#', 0
3278 DB 'TKOLGradientPanel.Paint', 0
3282 PrepareCanvasFontForWYSIWIGPaint( Canvas );
3283 case fGradientStyle of
3284 gsHorizontal,gsVertical:
3291 if fGradientStyle = gsHorizontal then
3297 Bmp :=TBitmap.Create();
3300 C := Color2RGB( fColor1 );
3302 G := (C shr 8) and $FF;
3304 C := Color2RGB( fColor2 );
3306 G1 := (C shr 8) and $FF;
3308 for I := 0 to WH-1 do
3310 C := ((( R + (R1 - R) * I div WH ) and $FF) shl 16) or
3311 ((( G + (G1 - G) * I div WH ) and $FF) shl 8) or
3312 ( B + (B1 - B) * I div WH ) and $FF;
3314 if fGradientStyle = gsVertical then
3315 Bmp.Canvas.Pixels[0,I]:=C
3317 Bmp.Canvas.Pixels[I,0]:=C;
3319 Canvas.StretchDraw(CR,BMP);
3320 Bmp.Free; {YS}//! Memory leak fix
3323 gsRectangle, gsRombic, gsElliptic:
3326 C := Color2RGB( fColor2 );
3328 G2 := (C shr 8) and $FF;
3329 B2 := (C shr 16) and $FF;
3330 C := Color2RGB( fColor1 );
3332 G1 := (C shr 8) and $FF;
3333 B1 := (C shr 16) and $FF;
3334 DR := (R2 - R1) / 256;
3335 DG := (G2 - G1) / 256;
3336 DB := (B2 - B1) / 256;
3337 {OldPaintDC :=} Canvas.handle;//fPaintDC;
3338 // Self_.fPaintDC := Msg.wParam;
3339 // if Self_.fPaintDC = 0 then
3340 // Self_.fPaintDC := BeginPaint( Self_.fHandle, PaintStruct );
3342 case fGradientStyle of
3344 RF := MakeRect( 0, 0, RC.Right div 128, RC.Bottom div 128 );
3346 RF := MakeRect( 0, 0, Ceil( RC.Right / 256 * SQRT2 ), Ceil( RC.Bottom / 256 * SQRT2 ) );
3348 RF := MakeRect( 0, 0, RC.Right div 256, RC.Bottom div 256 );
3350 case fGradientStyle of
3351 gsRectangle, gsRombic, gsElliptic:
3353 case FGradientLayout of
3354 glCenter, glTop, glBottom:
3355 OffsetRect( RF, (RC.Right - RF.Right) div 2, 0 );
3356 glTopRight, glBottomRight, glRight:
3357 OffsetRect( RF, RC.Right - RF.Right div 2, 0 );
3358 glTopLeft, glBottomLeft, glLeft:
3359 OffsetRect( RF, -RF.Right div 2, 0 );
3361 case FGradientLayout of
3362 glCenter, glLeft, glRight:
3363 OffsetRect( RF, 0, (RC.Bottom - RF.Bottom) div 2 );
3364 glBottom, glBottomLeft, glBottomRight:
3365 OffsetRect( RF, 0, RC.Bottom - RF.Bottom div 2 );
3366 glTop, glTopLeft, glTopRight:
3367 OffsetRect( RF, 0, -RF.Bottom div 2 );
3371 DX1 := (-RF.Left) / 255;
3372 DY1 := (-RF.Top) / 255;
3373 DX2 := (RC.Right - RF.Right) / 255;
3374 DY2 := (RC.Bottom - RF.Bottom) / 255;
3375 case fGradientStyle of
3376 gsRombic, gsElliptic:
3378 if DX2 < -DX1 then DX2 := -DX1;
3379 if DY2 < -DY1 then DY2 := -DY1;
3381 if fGradientStyle = gsElliptic then K := SQRT2;
3389 for I := 0 to 255 do
3393 C2 := TColor( (( Ceil( B1 + DB * (I+1) ) and $FF) shl 16) or
3394 (( Ceil( G1 + DG * (I+1) ) and $FF) shl 8) or
3395 Ceil( R1 + DR * (I+1) ) and $FF );
3396 if (fGradientStyle in [gsRombic,gsElliptic,gsRectangle]) and
3397 (C2 = C) then continue;
3399 Br := CreateSolidBrush( C );
3400 R0 := MakeRect( Ceil( RF.Left + DX1 * I ),
3401 Ceil( RF.Top + DY1 * I ),
3402 Ceil( RF.Right + DX2 * I ),
3403 Ceil( RF.Bottom + DY2 * I ) );
3405 case fGradientStyle of
3407 Rgn := CreateRectRgnIndirect( R0 );
3410 Poly[ 0 ].x := R0.Left;
3411 Poly[ 0 ].y := R0.Top + (R0.Bottom - R0.Top) div 2;
3412 Poly[ 1 ].x := R0.Left + (R0.Right - R0.Left) div 2;
3413 Poly[ 1 ].y := R0.Top;
3414 Poly[ 2 ].x := R0.Right;
3415 Poly[ 2 ].y := Poly[ 0 ].y;
3416 Poly[ 3 ].x := Poly[ 1 ].x;
3417 Poly[ 3 ].y := R0.Bottom;
3418 Rgn := CreatePolygonRgn( Poly[ 0 ].x, 4, ALTERNATE );
3421 Rgn := CreateEllipticRgnIndirect( R0 );
3425 if Rgn <> NULLREGION then
3427 Windows.FillRgn({ fPaintDC}Canvas.Handle, Rgn, Br );
3428 ExtSelectClipRgn( {fPaintDC}Canvas.Handle, Rgn, RGN_DIFF );
3430 DeleteObject( Rgn );
3435 // if Self_.fPaintDC <> HDC( Msg.wParam ) then
3436 // EndPaint( Self_.fHandle, PaintStruct );
3437 // Self_.fPaintDC := OldPaintDC;
3447 procedure TKOLGradientPanel.SetColor1(const Value: TColor);
3451 DB '#$signature$#', 0
3452 DB 'TKOLGradientPanel.SetColor1', 0
3460 procedure TKOLGradientPanel.SetColor2(const Value: TColor);
3464 DB '#$signature$#', 0
3465 DB 'TKOLGradientPanel.SetColor2', 0
3473 procedure TKOLGradientPanel.SetgradientLayout(
3474 const Value: TGradientLayout);
3478 DB '#$signature$#', 0
3479 DB 'TKOLGradientPanel.SetgradientLayout', 0
3482 FgradientLayout := Value;
3487 procedure TKOLGradientPanel.SetgradientStyle(const Value: TGradientStyle);
3491 DB '#$signature$#', 0
3492 DB 'TKOLGradientPanel.SetgradientStyle', 0
3495 FgradientStyle := Value;
3500 procedure TKOLGradientPanel.SetpopupMenu(const Value: TKOLPopupMenu);
3504 DB '#$signature$#', 0
3505 DB 'TKOLGradientPanel.SetpopupMenu', 0
3508 FpopupMenu := Value;
3512 procedure TKOLGradientPanel.SetupFirst(SL: TStringList; const AName,
3513 AParent, Prefix: String);
3517 DB '#$signature$#', 0
3518 DB 'TKOLGradientPanel.SetupFirst', 0
3522 if GradientStyle = gsHorizontal then
3523 SL.Add( Prefix + AName + '.GradientStyle := gsHorizontal;' );
3525 SL.Add( Prefix + AName + '.HasBorder := TRUE;' );
3526 if Assigned( FpopupMenu ) then
3527 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
3531 function TKOLGradientPanel.SetupParams(const AName,
3532 AParent: String): String;
3534 GradientLayouts: array[ TGradientLayout ] of String = ( 'glTopLeft',
3535 'glTop', 'glTopRight',
3536 'glLeft', 'glCenter', 'glRight',
3537 'glBottomLeft', 'glBottom', 'glBottomRight' );
3538 GradientStyles: array[ TGradientStyle ] of String = ( 'gsHorizontal',
3539 'gsVertical', 'gsRectangle', 'gsElliptic', 'gsRombic' );
3543 DB '#$signature$#', 0
3544 DB 'TKOLGradientPanel.SetupParams', 0
3547 Result := AParent + ', ' + Color2Str( FColor1 ) + ', ' + Color2Str( FColor2 );
3548 if TypeName <> 'GradientPanel' then
3549 Result := Result + ', ' + GradientStyles[ gradientStyle ] + ', ' +
3550 GradientLayouts[ GradientLayout ];
3553 function TKOLGradientPanel.TabStopByDefault: Boolean;
3557 DB '#$signature$#', 0
3558 DB 'TKOLGradientPanel.TabStopByDefault', 0
3564 function TKOLGradientPanel.TypeName: String;
3568 DB '#$signature$#', 0
3569 DB 'TKOLGradientPanel.TypeName', 0
3572 Result := inherited TypeName;
3573 if not (GradientStyle in [ gsVertical, gsHorizontal ]) or (gradientLayout <> glTop) then
3574 Result := 'GradientPanelEx';
3577 function TKOLGradientPanel.WYSIWIGPaintImplemented: Boolean;
3584 function TKOLGroupBox.ClientMargins: TRect;
3588 DB '#$signature$#', 0
3589 DB 'TKOLGradientPanel.ClientMargins', 0
3592 Result := Rect( 0, 0, 0, 0 );
3595 constructor TKOLGroupBox.Create(AOwner: TComponent);
3599 DB '#$signature$#', 0
3600 DB 'TKOLGroupBox.Create', 0
3604 Width := 100; DefaultWidth := Width;
3605 Height := 100; DefaultHeight := 100;
3606 ControlStyle := ControlStyle + [ csAcceptsControls ];
3607 DefaultMarginTop := 22; MarginTop := 22;
3608 DefaultMarginLeft := 2; MarginLeft := 2;
3609 DefaultMarginRight := 2; MarginRight := 2;
3610 DefaultMarginBottom := 2; MarginBottom := 2;
3611 FHasBorder := FALSE; FDefHasBorder := FALSE;
3614 {$IFDEF _KOLCtrlWrapper_} {YS}
3615 procedure TKOLGroupBox.CreateKOLControl(Recreating: boolean);
3617 FKOLCtrl := NewGroupbox(KOLParentCtrl, '');
3621 function TKOLGroupBox.DrawMargins: TRect;
3625 DB '#$signature$#', 0
3626 DB 'TKOLGroupBox.DrawMargins', 0
3629 Result := Rect( 4, 18, 4, 4 );
3631 if Font.FontHeight > 0 then
3632 Result.Top := Font.FontHeight;
3635 procedure TKOLGroupBox.FirstCreate;
3639 DB '#$signature$#', 0
3640 DB 'TKOLGroupBox.FirstCreate', 0
3647 procedure TKOLGroupBox.SetpopupMenu(const Value: TKOLPopupMenu);
3651 DB '#$signature$#', 0
3652 DB 'TKOLGroupBox.SetpopupMenu', 0
3655 FpopupMenu := Value;
3659 procedure TKOLGroupBox.SetupFirst(SL: TStringList; const AName, AParent,
3662 TextAligns: array[ TTextAlign ] of String = ( 'taLeft', 'taRight', 'taCenter' );
3666 DB '#$signature$#', 0
3667 DB 'TKOLGroupBox.SetupFirst', 0
3671 if TextAlign <> taLeft then
3672 SL.Add( Prefix + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
3673 if Assigned( FpopupMenu ) then
3674 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
3678 function TKOLGroupBox.SetupParams(const AName, AParent: String): String;
3682 DB '#$signature$#', 0
3683 DB 'TKOLGroupBox.SetupParams', 0
3686 Result := AParent + ', ' + StringConstant('Caption',Caption);
3689 function TKOLGroupBox.TabStopByDefault: Boolean;
3693 DB '#$signature$#', 0
3694 DB 'TKOLGroupBox.TabStopByDefault', 0
3702 constructor TKOLCheckBox.Create(AOwner: TComponent);
3706 DB '#$signature$#', 0
3707 DB 'TKOLCheckBox.Create', 0
3713 Width := 72; DefaultWidth := Width;
3714 Height := 22; DefaultHeight := 22;
3715 FHasBorder := FALSE;
3716 FDefHasBorder := FALSE;
3719 procedure TKOLCheckBox.CreateKOLControl(Recreating: boolean);
3722 FKOLCtrl:=NewCheckBox3State(KOLParentCtrl, '')
3724 FKOLCtrl:=NewCheckbox(KOLParentCtrl, '');
3727 procedure TKOLCheckBox.FirstCreate;
3731 DB '#$signature$#', 0
3732 DB 'TKOLCheckBox.FirstCreate', 0
3739 function TKOLCheckBox.NoDrawFrame: Boolean;
3741 Result := HasBorder;
3744 procedure TKOLCheckBox.Paint;
3746 if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
3747 PrepareCanvasFontForWYSIWIGPaint( Canvas );
3748 DrawCheckBox( Self, Canvas );
3753 procedure TKOLCheckBox.SetAuto3State(const Value: Boolean);
3755 FAuto3State := Value;
3759 procedure TKOLCheckBox.SetChecked(const Value: Boolean);
3763 DB '#$signature$#', 0
3764 DB 'TKOLCheckBox.SetChecked', 0
3767 if FChecked = Value then exit;
3768 if action = nil then
3771 FChecked := action.Checked;
3773 if Assigned(FKOLCtrl) then
3774 FKOLCtrl.Checked:=FChecked;
3778 procedure TKOLCheckBox.SetpopupMenu(const Value: TKOLPopupMenu);
3782 DB '#$signature$#', 0
3783 DB 'TKOLCheckBox.SetpopupMenu', 0
3786 FpopupMenu := Value;
3790 procedure TKOLCheckBox.SetupFirst(SL: TStringList; const AName, AParent,
3795 DB '#$signature$#', 0
3796 DB 'TKOLCheckBox.SetupFirst', 0
3800 if Checked and (action = nil) then
3801 SL.Add( Prefix + AName + '.Checked := TRUE;' );
3802 if Assigned( FpopupMenu ) then
3803 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
3806 SL.Add( Prefix + AName + '.WordWrap := TRUE;' );}
3809 function TKOLCheckBox.SetupParams(const AName, AParent: String): String;
3815 DB '#$signature$#', 0
3816 DB 'TKOLCheckBox.SetupParams', 0
3819 if action = nil then
3820 C := StringConstant('Caption',Caption)
3823 Result := AParent + ', ' + C;
3826 function TKOLCheckBox.TabStopByDefault: Boolean;
3830 DB '#$signature$#', 0
3831 DB 'TKOLCheckBox.TabStopByDefault', 0
3837 function TKOLCheckBox.TypeName: String;
3839 if Auto3State and Windowed
3840 then Result := 'CheckBox3State'
3841 else Result := inherited TypeName;
3844 function TKOLCheckBox.WYSIWIGPaintImplemented: Boolean;
3851 constructor TKOLRadioBox.Create(AOwner: TComponent);
3855 DB '#$signature$#', 0
3856 DB 'TKOLRadioBox.Create', 0
3862 Width := 72; DefaultWidth := Width;
3863 Height := 22; DefaultHeight := 22;
3864 FHasBorder := FALSE;
3865 FDefHasBorder := FALSE;
3868 procedure TKOLRadioBox.FirstCreate;
3872 DB '#$signature$#', 0
3873 DB 'TKOLRadioBox.FirstCreate', 0
3880 function TKOLRadioBox.NoDrawFrame: Boolean;
3882 Result := HasBorder;
3885 procedure TKOLRadioBox.Paint;
3887 PrepareCanvasFontForWYSIWIGPaint( Canvas );
3888 DrawRadioBox( Self, Canvas );
3892 procedure TKOLRadioBox.SetChecked(const Value: Boolean);
3895 K: TKOLCustomControl;
3899 DB '#$signature$#', 0
3900 DB 'TKOLRadioBox.SetChecked', 0
3903 if FChecked = Value then exit;
3904 if action = nil then
3907 FChecked := action.Checked;
3910 if Parent <> nil then
3912 for I := 0 to ParentForm.ComponentCount - 1 do
3914 C := ParentForm.Components[ I ];
3916 if C is TKOLCustomControl then
3918 K := C as TKOLCustomControl;
3919 if K.Parent = Parent then
3920 if K is TKOLRadioBox then
3921 (K as TKOLRadioBox).Checked := FALSE;
3927 procedure TKOLRadioBox.SetpopupMenu(const Value: TKOLPopupMenu);
3931 DB '#$signature$#', 0
3932 DB 'TKOLRadioBox.SetpopupMenu', 0
3935 FpopupMenu := Value;
3939 procedure TKOLRadioBox.SetupFirst(SL: TStringList; const AName, AParent,
3944 DB '#$signature$#', 0
3945 DB 'TKOLRadioBox.SetupFirst', 0
3949 if Checked and (action = nil) then
3950 SL.add( Prefix + AName + '.SetRadioChecked;' );
3951 if Assigned( FpopupMenu ) then
3952 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
3955 SL.Add( Prefix + AName + '.WordWrap := TRUE;' );}
3958 function TKOLRadioBox.SetupParams(const AName, AParent: String): String;
3964 DB '#$signature$#', 0
3965 DB 'TKOLRadioBox.SetupParams', 0
3968 if action = nil then
3969 C := StringConstant('Caption',Caption)
3972 Result := AParent + ', ' + C;
3975 function TKOLRadioBox.TabStopByDefault: Boolean;
3979 DB '#$signature$#', 0
3980 DB 'TKOLRadioBox.TabStopByDefault', 0
3986 function TKOLRadioBox.WYSIWIGPaintImplemented: Boolean;
3993 function TKOLEditBox.BestEventName: String;
3995 Result := 'OnChange';
3998 constructor TKOLEditBox.Create(AOwner: TComponent);
4002 DB '#$signature$#', 0
4003 DB 'TKOLEditBox.Create', 0
4007 fNoAutoSizeX := TRUE;
4009 Width := 100; DefaultWidth := Width;
4010 Height := 22; DefaultHeight := 22;
4012 FResetTabStopByStyle := TRUE;
4015 function TKOLEditBox.DefaultColor: TColor;
4019 DB '#$signature$#', 0
4020 DB 'TKOLEditBox.DefaultColor', 0
4026 procedure TKOLEditBox.FirstCreate;
4030 DB '#$signature$#', 0
4031 DB 'TKOLEditBox.FirstCreate', 0
4038 function TKOLEditBox.GetCaption: String;
4042 DB '#$signature$#', 0
4043 DB 'TKOLEditBox.GetCaption', 0
4046 Result := inherited Caption;
4049 function TKOLEditBox.GetText: String;
4053 DB '#$signature$#', 0
4054 DB 'TKOLEditBox.GetText', 0
4060 function TKOLEditBox.NoDrawFrame: Boolean;
4064 DB '#$signature$#', 0
4065 DB 'TKOLEditBox.NoDrawFrame', 0
4068 Result := HasBorder;
4071 procedure TKOLEditBox.Paint;
4079 DB '#$signature$#', 0
4080 DB 'TKOLEditBox.Paint', 0
4084 PrepareCanvasFontForWYSIWIGPaint( Canvas );
4095 DrawEdge(Canvas.Handle,R,EDGE_SUNKEN,BF_RECT);
4100 Canvas.Brush.Color := clWindowText;
4101 Canvas.FrameRect(R);
4107 R.Right:=Width-Delta;
4108 R.Bottom:=Height-Delta;
4113 taRight: Flag:=Flag or DT_RIGHT;
4114 taLeft: Flag:=Flag or DT_LEFT;
4115 taCenter: Flag:=Flag or DT_CENTER;
4118 Canvas.Brush.Color := Color;
4119 DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);
4125 procedure TKOLEditBox.SetEdTransparent(const Value: Boolean);
4129 DB '#$signature$#', 0
4130 DB 'TKOLEditBox.SetEdTransparent', 0
4133 FEdTransparent := Value;
4137 procedure TKOLEditBox.SetOptions(const Value: TKOLEditOptions);
4141 DB '#$signature$#', 0
4142 DB 'TKOLEditBox.SetOptions', 0
4149 procedure TKOLEditBox.SetpopupMenu(const Value: TKOLPopupMenu);
4153 DB '#$signature$#', 0
4154 DB 'TKOLEditBox.SetpopupMenu', 0
4157 FpopupMenu := Value;
4161 procedure TKOLEditBox.SetText(const Value: String);
4165 DB '#$signature$#', 0
4166 DB 'TKOLEditBox.SetText', 0
4169 SetCaption( Value );
4172 procedure TKOLEditBox.SetupFirst(SL: TStringList; const AName,
4173 AParent, Prefix: String);
4175 Aligns: array[ TTextAlign ] of String = ( 'taLeft', 'taRight', 'taCenter' );
4179 DB '#$signature$#', 0
4180 DB 'TKOLEditBox.SetupFirst', 0
4185 AddLongTextField( SL, Prefix + AName + '.Text := ', Text, ';' );
4186 if TextAlign <> taLeft then
4187 SL.Add( Prefix + AName + '.TextAlign := ' + Aligns[ TextAlign ] + ';' );
4189 SL.Add( Prefix + AName + '.Ed_Transparent := TRUE;' );
4190 if Assigned( FpopupMenu ) then
4191 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
4195 function TKOLEditBox.SetupParams(const AName, AParent: String): String;
4200 DB '#$signature$#', 0
4201 DB 'TKOLEditBox.SetupParams', 0
4205 if eoLowercase in Options then
4206 S := S + ', eoLowercase';
4207 if eoNoHideSel in Options then
4208 S := S + ', eoNoHideSel';
4209 if eoOemConvert in Options then
4210 S := S + ', eoOemConvert';
4211 if eoPassword in Options then
4212 S := S + ', eoPassword';
4213 if eoReadonly in Options then
4214 S := S + ', eoReadonly';
4215 if eoUpperCase in Options then
4216 S := S + ', eoUpperCase';
4217 if eoWantTab in Options then
4218 S := S + ', eoWantTab';
4219 if eoNumber in Options then
4220 S := S + ', eoNumber';
4222 if S[ 1 ] = ',' then
4223 S := Copy( S, 3, MaxInt );
4224 Result := AParent + ', [ ' + S + ' ]';
4227 procedure TKOLEditBox.SetupTextAlign(SL: TStrings; const AName: String);
4230 if TextAlign <> taLeft then
4231 SL.Add(' ' + AName + '.TextAlign := ' + TextAligns[TextAlign] + ';');
4234 function TKOLEditBox.TabStopByDefault: Boolean;
4238 DB '#$signature$#', 0
4239 DB 'TKOLEditBox.TabStopByDefault', 0
4245 procedure TKOLEditBox.WantTabs( Want: Boolean );
4249 DB '#$signature$#', 0
4250 DB 'TKOLEditBox.WantTabs', 0
4254 Options := Options + [ eoWantTab ]
4256 Options := Options - [ eoWantTab ];
4259 function TKOLEditBox.WYSIWIGPaintImplemented: Boolean;
4263 DB '#$signature$#', 0
4264 DB 'TKOLEditBox.WYSIWIGPaintImplemented', 0
4272 function TKOLMemo.BestEventName: String;
4274 Result := 'OnChange';
4277 constructor TKOLMemo.Create(AOwner: TComponent);
4281 DB '#$signature$#', 0
4282 DB 'TKOLMemo.Create', 0
4285 FLines := TStringList.Create;
4287 FDefIgnoreDefault := TRUE;
4288 FIgnoreDefault := TRUE;
4289 Width := 200; DefaultWidth := Width;
4290 Height := 222; DefaultHeight := Height;
4294 procedure TKOLMemo.CreateKOLControl(Recreating: boolean);
4296 opts: kol.TEditOptions;
4298 opts:=[eoMultiline];
4299 if eo_Lowercase in FOptions then
4300 Include(opts, kol.eoLowercase);
4301 if eo_NoHScroll in FOptions then
4302 Include(opts, kol.eoNoHScroll);
4303 if eo_NoVScroll in FOptions then
4304 Include(opts, kol.eoNoVScroll);
4305 if eo_UpperCase in FOptions then
4306 Include(opts, kol.eoUpperCase);
4307 FKOLCtrl:=NewEditbox(KOLParentCtrl, opts);
4309 FKOLCtrl.TextAlign:=kol.TTextAlign(TextAlign);
4312 function TKOLMemo.DefaultColor: TColor;
4316 DB '#$signature$#', 0
4317 DB 'TKOLMemo.DefaultColor', 0
4323 destructor TKOLMemo.Destroy;
4327 DB '#$signature$#', 0
4328 DB 'TKOLMemo.Destroy', 0
4335 procedure TKOLMemo.FirstCreate;
4339 DB '#$signature$#', 0
4340 DB 'TKOLMemo.FirstCreate', 0
4343 FLines.Text := Name;
4344 if Assigned(FKOLCtrl) then
4345 FKOLCtrl.Text:=FLines.Text;
4349 function TKOLMemo.GetCaption: String;
4353 DB '#$signature$#', 0
4354 DB 'TKOLMemo.GetCaption', 0
4357 Result := inherited Caption;
4360 function TKOLMemo.GetText: TStrings;
4364 DB '#$signature$#', 0
4365 DB 'TKOLMemo.GetText', 0
4371 procedure TKOLMemo.KOLControlRecreated;
4374 FKOLCtrl.Text:=FLines.Text;
4377 procedure TKOLMemo.Loaded;
4380 if Assigned(FKOLCtrl) then
4381 FKOLCtrl.Text:=FLines.Text;
4384 function TKOLMemo.NoDrawFrame: Boolean;
4386 Result := HasBorder;
4389 procedure TKOLMemo.SetEdTransparent(const Value: Boolean);
4393 DB '#$signature$#', 0
4394 DB 'TKOLMemo.SetEdTransparent', 0
4397 FEdTransparent := Value;
4401 procedure TKOLMemo.SetOptions(const Value: TKOLMemoOptions);
4405 DB '#$signature$#', 0
4406 DB 'TKOLMemo.SetOptions', 0
4410 if Assigned(FKOLCtrl) then
4415 procedure TKOLMemo.SetpopupMenu(const Value: TKOLPopupMenu);
4419 DB '#$signature$#', 0
4420 DB 'TKOLMemo.SetpopupMenu', 0
4423 FpopupMenu := Value;
4427 procedure TKOLMemo.SetText(const Value: TStrings);
4431 DB '#$signature$#', 0
4432 DB 'TKOLMemo.SetText', 0
4435 FLines.Text := Value.Text;
4436 if Assigned(FKOLCtrl) then
4437 FKOLCtrl.Text:=Value.Text;
4441 procedure TKOLMemo.SetTextAlign(const Value: TTextAlign);
4444 if Assigned(FKOLCtrl) then
4448 procedure TKOLMemo.SetupFirst(SL: TStringList; const AName,
4449 AParent, Prefix: String);
4453 DB '#$signature$#', 0
4454 DB 'TKOLMemo.SetupFirst', 0
4458 if TextAlign <> taLeft then
4459 SL.Add( Prefix + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
4460 if FLines.Text <> '' then
4461 AddLongTextField( SL, Prefix + AName + '.Text := ', FLines.Text, ';' );
4463 SL.Add( Prefix + AName + '.Ed_Transparent := TRUE;' );
4464 if Assigned( FpopupMenu ) then
4465 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
4469 function TKOLMemo.SetupParams(const AName, AParent: String): String;
4474 DB '#$signature$#', 0
4475 DB 'TKOLMemo.SetupParams', 0
4479 if eo_NoHScroll in Options then
4480 S := S + ', eoNoHScroll';
4481 if eo_NoVScroll in Options then
4482 S := S + ', eoNoVScroll';
4483 if eo_Lowercase in Options then
4484 S := S + ', eoLowercase';
4485 if eo_NoHideSel in Options then
4486 S := S + ', eoNoHideSel';
4487 if eo_OemConvert in Options then
4488 S := S + ', eoOemConvert';
4489 if eo_Password in Options then
4490 S := S + ', eoPassword';
4491 if eo_Readonly in Options then
4492 S := S + ', eoReadonly';
4493 if eo_UpperCase in Options then
4494 S := S + ', eoUpperCase';
4495 if eo_WantReturn in Options then
4496 S := S + ', eoWantReturn';
4497 if eo_WantTab in Options then
4498 S := S + ', eoWantTab';
4500 if S[ 1 ] = ',' then
4501 S := Copy( S, 3, MaxInt );
4502 Result := AParent + ', [ ' + S + ' ]';
4505 procedure TKOLMemo.SetupTextAlign(SL: TStrings; const AName: String);
4508 if TextAlign <> taLeft then
4509 SL.Add(' ' + AName + '.TextAlign := ' + TextAligns[TextAlign] + ';');
4512 function TKOLMemo.TabStopByDefault: Boolean;
4516 DB '#$signature$#', 0
4517 DB 'TKOLMemo.TabStopByDefault', 0
4523 function TKOLMemo.TypeName: String;
4527 DB '#$signature$#', 0
4528 DB 'TKOLMemo.TypeName', 0
4531 Result := 'EditBox';
4534 procedure TKOLMemo.WantTabs( Want: Boolean );
4538 DB '#$signature$#', 0
4539 DB 'TKOLMemo.WantTabs', 0
4543 Options := Options + [ eo_WantTab ]
4545 Options := Options - [ eo_WantTab ];
4550 constructor TKOLListBox.Create(AOwner: TComponent);
4554 DB '#$signature$#', 0
4555 DB 'TKOLListBox.Create', 0
4558 FItems := TStringList.Create;
4560 Width := 164; DefaultWidth := Width;
4561 Height := 200; DefaultHeight := Height;
4563 Options := [ loNoIntegralHeight ];
4566 procedure TKOLListBox.CreateKOLControl(Recreating: boolean);
4568 opts: kol.TListOptions;
4571 if loNoHideScroll in FOptions then
4572 Include(opts, kol.loNoHideScroll);
4573 if loMultiColumn in FOptions then
4574 Include(opts, kol.loMultiColumn);
4575 FKOLCtrl:=NewListbox(KOLParentCtrl, opts + [kol.loNoIntegralHeight]);
4578 function TKOLListBox.DefaultColor: TColor;
4582 DB '#$signature$#', 0
4583 DB 'TKOLListBox.DefaultColor', 0
4589 destructor TKOLListBox.Destroy;
4593 DB '#$signature$#', 0
4594 DB 'TKOLListBox.Destroy', 0
4601 procedure TKOLListBox.FirstCreate;
4605 DB '#$signature$#', 0
4606 DB 'TKOLListBox.FirstCreate', 0
4609 //FItems.Text := Name;
4615 function TKOLListBox.GenerateTransparentInits: String;
4617 if fLBItemHeight > 0 then Result := '.SetLVItemHeight('+IntToStr(fLBItemHeight)+')'
4619 Result := Result + inherited GenerateTransparentInits();
4623 function TKOLListBox.GetCaption: String;
4627 DB '#$signature$#', 0
4628 DB 'TKOLListBox.GetCaption', 0
4631 Result := inherited Caption;
4634 procedure TKOLListBox.KOLControlRecreated;
4640 procedure TKOLListBox.Loaded;
4646 function TKOLListBox.NoDrawFrame: Boolean;
4651 procedure TKOLListBox.SetCount(Value: Integer);
4655 DB '#$signature$#', 0
4656 DB 'TKOLListBox.SetCount', 0
4665 procedure TKOLListBox.SetCurIndex(const Value: Integer);
4669 DB '#$signature$#', 0
4670 DB 'TKOLListBox.SetCurIndex', 0
4677 procedure TKOLListBox.SetItems(const Value: TStrings);
4681 DB '#$signature$#', 0
4682 DB 'TKOLListBox.SetItems', 0
4685 FItems.Text := Value.Text;
4691 procedure TKOLListBox.SetLBItemHeight(const Value: Integer);
4693 if fLBItemHeight <> Value then begin
4694 fLBItemHeight := Value;
4700 procedure TKOLListBox.SetOptions(const Value: TKOLListboxOptions);
4704 DB '#$signature$#', 0
4705 DB 'TKOLListBox.SetOptions', 0
4709 if Assigned(FKOLCtrl) then
4714 procedure TKOLListBox.SetpopupMenu(const Value: TKOLPopupMenu);
4718 DB '#$signature$#', 0
4719 DB 'TKOLListBox.SetpopupMenu', 0
4722 FpopupMenu := Value;
4726 procedure TKOLListBox.SetupFirst(SL: TStringList; const AName,
4727 AParent, Prefix: String);
4732 DB '#$signature$#', 0
4733 DB 'TKOLListBox.SetupFirst', 0
4737 if FItems.Text <> '' then
4739 for I := 0 to FItems.Count - 1 do
4740 SL.Add( Prefix + AName + '.Items[ ' + Int2Str( I ) + ' ] := ' +
4741 StringConstant( 'Item' + IntToStr( I ), FItems[ I ] ) + ';' );
4743 if FCurIndex >= 0 then
4744 SL.Add( Prefix + AName + '.CurIndex := ' + Int2Str( FCurIndex ) + ';' );
4745 if Assigned( FpopupMenu ) then
4746 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
4750 procedure TKOLListBox.SetupLast(SL: TStringList; const AName, AParent,
4755 DB '#$signature$#', 0
4756 DB 'TKOLListBox.SetupLast', 0
4760 if loNoData in Options then
4762 SL.Add( Prefix + AName + '.Count := ' + IntToStr( Count ) + ';' );
4765 function TKOLListBox.SetupParams(const AName, AParent: String): String;
4770 DB '#$signature$#', 0
4771 DB 'TKOLListBox.SetupParams', 0
4774 if loNoHideScroll in Options then
4775 S := S + 'loNoHideScroll';
4776 if loNoExtendSel in Options then
4777 S := S + ', loNoExtendSel';
4778 if loMultiColumn in Options then
4779 S := S + ', loMultiColumn';
4780 if loMultiSelect in Options then
4781 S := S + ', loMultiSelect';
4782 if loNoIntegralHeight in Options then
4783 S := S + ', loNoIntegralHeight';
4784 if loNoSel in Options then
4785 S := S + ', loNoSel';
4786 if loSort in Options then
4787 S := S + ', loSort';
4788 if loTabstops in Options then
4789 S := S + ', loTabstops';
4790 if loNoStrings in Options then
4791 S := S + ', loNoStrings';
4792 if loNoData in Options then
4793 S := S + ', loNoData';
4794 if loOwnerDrawFixed in Options then
4795 S := S + ', loOwnerDrawFixed';
4796 if loOwnerDrawVariable in Options then
4797 S := S + ', loOwnerDrawVariable';
4799 if S[ 1 ] = ',' then
4800 S := Copy( S, 3, MaxInt );
4801 Result := AParent + ', [ ' + S + ' ]';
4804 function TKOLListBox.TabStopByDefault: Boolean;
4808 DB '#$signature$#', 0
4809 DB 'TKOLListBox.TabStopByDefault', 0
4815 procedure TKOLListBox.UpdateItems;
4819 if Assigned(FKOLCtrl) then begin
4820 FKOLCtrl.BeginUpdate;
4823 if [loOwnerDrawFixed, loOwnerDrawVariable] * FOptions = [] then
4824 for i:=0 to FItems.Count - 1 do
4825 FKOLCtrl.Items[i]:=FItems[i];
4834 function TKOLComboBox.AutoHeight(Canvas: TCanvas): Integer;
4836 if coSimple in Options then
4839 Result := inherited AutoHeight( Canvas );
4842 function TKOLComboBox.AutoSizeRunTime: Boolean;
4844 Result := not( coSimple in Options );
4847 constructor TKOLComboBox.Create(AOwner: TComponent);
4851 DB '#$signature$#', 0
4852 DB 'TKOLComboBox.Create', 0
4855 FItems := TStringList.Create;
4857 fNoAutoSizeX := TRUE;
4859 Width := 100; DefaultWidth := Width;
4860 Height := 22; DefaultHeight := Height;
4862 Options := [ coNoIntegralHeight ];
4865 function TKOLComboBox.DefaultColor: TColor;
4869 DB '#$signature$#', 0
4870 DB 'TKOLComboBox.DefaultColor', 0
4873 Result := clWhite; // !!! in Windows, default color for combobox really is clWhite
4876 function TKOLComboBox.DefaultInitialColor: TColor;
4880 DB '#$signature$#', 0
4881 DB 'TKOLComboBox.DefaultInitialColor', 0
4887 destructor TKOLComboBox.Destroy;
4891 DB '#$signature$#', 0
4892 DB 'TKOLComboBox.Destroy', 0
4899 procedure TKOLComboBox.FirstCreate;
4903 DB '#$signature$#', 0
4904 DB 'TKOLComboBox.FirstCreate', 0
4907 FItems.Text := Name;
4912 function TKOLComboBox.GenerateTransparentInits: String;
4914 if fCBItemHeight > 0 then Result := '.SetLVItemHeight('+IntToStr(fCBItemHeight)+')'
4916 Result := Result + inherited GenerateTransparentInits();
4919 function TKOLComboBox.NoDrawFrame: Boolean;
4921 Result := HasBorder;
4924 procedure TKOLComboBox.Paint;
4926 if not (Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames])) then begin
4927 PrepareCanvasFontForWYSIWIGPaint( Canvas );
4928 DrawCombobox( Self, Canvas );
4933 procedure TKOLComboBox.SetCBItemHeight(const Value: Integer);
4935 if fCBItemHeight <> Value then
4937 fCBItemHeight := Value;
4942 procedure TKOLComboBox.SetCurIndex(const Value: Integer);
4946 DB '#$signature$#', 0
4947 DB 'TKOLComboBox.SetCurIndex', 0
4954 procedure TKOLComboBox.SetDroppedWidth(const Value: Integer);
4958 DB '#$signature$#', 0
4959 DB 'TKOLComboBox.SetDroppedWidth', 0
4962 FDroppedWidth := Value;
4966 procedure TKOLComboBox.SetItems(const Value: TStrings);
4970 DB '#$signature$#', 0
4971 DB 'TKOLComboBox.SetItems', 0
4974 FItems.Text := Value.Text;
4978 procedure TKOLComboBox.SetOptions(const Value: TKOLComboOptions);
4982 DB '#$signature$#', 0
4983 DB 'TKOLComboBox.SetOptions', 0
4993 procedure TKOLComboBox.SetpopupMenu(const Value: TKOLPopupMenu);
4997 DB '#$signature$#', 0
4998 DB 'TKOLComboBox.SetpopupMenu', 0
5001 FpopupMenu := Value;
5005 procedure TKOLComboBox.SetupFirst(SL: TStringList; const AName, AParent,
5011 DB '#$signature$#', 0
5012 DB 'TKOLComboBox.SetupFirst', 0
5016 if FItems.Text <> '' then
5018 for I := 0 to FItems.Count - 1 do
5019 SL.Add( Prefix + AName + '.Items[ ' + Int2Str( I ) + ' ] := ' +
5020 StringConstant( 'Item' + IntToStr( I ), FItems[ I ] ) + ';' );
5022 if FCurIndex >= 0 then
5023 SL.Add( Prefix + AName + '.CurIndex := ' + Int2Str( FCurIndex ) + ';' );
5024 if (FDroppedWidth <> Width) and (FDroppedWidth <> 0) then
5025 SL.Add( Prefix + AName + '.DroppedWidth := ' + Int2Str( FDroppedWidth ) + ';' );
5026 if Assigned( FpopupMenu ) then
5027 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
5031 function TKOLComboBox.SetupParams(const AName, AParent: String): String;
5036 DB '#$signature$#', 0
5037 DB 'TKOLComboBox.SetupParams', 0
5040 if coReadOnly in Options then
5041 S := S + 'coReadOnly';
5042 if coNoHScroll in Options then
5043 S := S + ', coNoHScroll';
5044 if coAlwaysVScroll in Options then
5045 S := S + ', coAlwaysVScroll';
5046 if coLowerCase in Options then
5047 S := S + ', coLowerCase';
5048 if coNoIntegralHeight in Options then
5049 S := S + ', coNoIntegralHeight';
5050 if coOemConvert in Options then
5051 S := S + ', coOemConvert';
5052 if coSort in Options then
5053 S := S + ', coSort';
5054 if coUpperCase in Options then
5055 S := S + ', coUpperCase';
5056 if coOwnerDrawFixed in Options then
5057 S := S + ', coOwnerDrawFixed';
5058 if coOwnerDrawVariable in Options then
5059 S := S + ', coOwnerDrawVariable';
5060 if coSimple in Options then
5061 S := S + ', coSimple';
5063 if S[ 1 ] = ',' then
5064 S := Copy( S, 3, MaxInt );
5065 Result := AParent + ', [ ' + S + ' ]';
5068 function TKOLComboBox.TabStopByDefault: Boolean;
5072 DB '#$signature$#', 0
5073 DB 'TKOLComboBox.TabStopByDefault', 0
5079 function TKOLComboBox.WYSIWIGPaintImplemented: Boolean;
5086 procedure TKOLSplitter.AssignEvents(SL: TStringList; const AName: String);
5090 DB '#$signature$#', 0
5091 DB 'TKOLSplitter.AssignEvents', 0
5095 DoAssignEvents( SL, AName, [ 'OnSplit' ], [ @OnSplit ] );
5098 function TKOLSplitter.BestEventName: String;
5100 Result := 'OnSplit';
5103 constructor TKOLSplitter.Create(AOwner: TComponent);
5107 DB '#$signature$#', 0
5108 DB 'TKOLSplitter.Create', 0
5113 Width := 4; DefaultWidth := Width;
5118 EdgeStyle := esLowered;
5121 procedure TKOLSplitter.CreateKOLControl(Recreating: boolean);
5129 FKOLCtrl:=NewSplitterEx(KOLParentCtrl, 0, 0, es);
5132 function TKOLSplitter.IsCursorDefault: Boolean;
5136 DB '#$signature$#', 0
5137 DB 'TKOLSplitter.IsCursorDefault', 0
5141 caLeft, caRight: Result := (Trim(Cursor_)='') or (Trim(Cursor_)='IDC_SIZEWE');
5142 caTop, caBottom: Result := (Trim(Cursor_)='') or (Trim(Cursor_)='IDC_SIZENS');
5143 else Result := inherited IsCursorDefault;
5147 function TKOLSplitter.NoDrawFrame: Boolean;
5149 Result:=FEdgeStyle <> esNone;
5152 procedure TKOLSplitter.SetEdgeStyle(const Value: TEdgeStyle);
5156 DB '#$signature$#', 0
5157 DB 'TKOLSplitter.SetEdgeStyle', 0
5160 FEdgeStyle := Value;
5161 if Assigned(FKOLCtrl) then
5166 procedure TKOLSplitter.SetMinSizeNext(const Value: Integer);
5170 DB '#$signature$#', 0
5171 DB 'TKOLSplitter.SetMinSizeNext', 0
5174 FMinSizeNext := Value;
5178 procedure TKOLSplitter.SetMinSizePrev(const Value: Integer);
5182 DB '#$signature$#', 0
5183 DB 'TKOLSplitter.SetMinSizePrev', 0
5186 FMinSizePrev := Value;
5190 procedure TKOLSplitter.SetupFirst(SL: TStringList; const AName, AParent,
5195 DB '#$signature$#', 0
5196 DB 'TKOLSplitter.SetupFirst', 0
5202 function TKOLSplitter.SetupParams(const AName, AParent: String): String;
5203 const Styles: array[ TEdgeStyle ] of String = ( 'esRaised', 'esLowered', 'esNone' );
5207 DB '#$signature$#', 0
5208 DB 'TKOLSplitter.SetupParams', 0
5211 Result := AParent + ', ' + Int2Str( MinSizePrev ) + ', ' + Int2Str( MinSizeNext );
5212 if EdgeStyle <> esLowered then
5213 Result := Result + ', ' + Styles[ EdgeStyle ];
5216 function TKOLSplitter.TypeName: String;
5220 DB '#$signature$#', 0
5221 DB 'TKOLSplitter.TypeName', 0
5224 Result := inherited TypeName;
5225 if EdgeStyle <> esLowered then
5226 Result := 'SplitterEx';
5231 function TKOLPaintBox.BestEventName: String;
5233 Result := 'OnPaint';
5236 constructor TKOLPaintBox.Create(AOwner: TComponent);
5240 DB '#$signature$#', 0
5241 DB 'TKOLPaintBox.Create', 0
5245 Width := 40; DefaultWidth := Width;
5246 Height := 40; DefaultHeight := Height;
5247 ControlStyle := ControlStyle + [ csAcceptsControls ];
5250 procedure TKOLPaintBox.SetpopupMenu(const Value: TKOLPopupMenu);
5254 DB '#$signature$#', 0
5255 DB 'TKOLPaintBox.SetpopupMenu', 0
5258 FpopupMenu := Value;
5262 procedure TKOLPaintBox.SetupFirst(SL: TStringList; const AName, AParent,
5267 DB '#$signature$#', 0
5268 DB 'TKOLPaintBox.SetupFirst', 0
5272 if Assigned( FpopupMenu ) then
5273 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
5277 function TKOLPaintBox.SetupParams(const AName, AParent: String): String;
5281 DB '#$signature$#', 0
5282 DB 'TKOLPaintBox.SetupParams', 0
5290 procedure TKOLListView.AssignEvents(SL: TStringList; const AName: String);
5293 DoAssignEvents( SL, AName, [ 'OnLVDelete', 'OnLVCustomDraw'
5294 {$IFNDEF _D2}, 'OnLVDataW' {$ENDIF _D2} ],
5295 [ @ OnLVDelete, @ OnLVCustomDraw
5296 {$IFNDEF _D2}, @ OnLVDataW {$ENDIF _D2} ] );
5299 constructor TKOLListView.Create(AOwner: TComponent);
5303 DB '#$signature$#', 0
5304 DB 'TKOLListView.Create', 0
5308 FCols := TList.Create;
5309 FGenerateColIdxConst := TRUE;
5310 Width := 200; DefaultWidth := Width;
5311 Height := 150; DefaultHeight := Height;
5313 FLVBkColor := clWindow;
5314 FLVTextBkColor := clWindow;
5318 function TKOLListView.DefaultColor: TColor;
5322 DB '#$signature$#', 0
5323 DB 'TKOLListView.DefaultColor', 0
5329 procedure TKOLListView.DefineProperties(Filer: TFiler);
5331 Col: TKOLListViewColumn;
5334 Filer.DefineProperty( 'ColCount', LoadColCount, SaveColCount, TRUE );
5335 for I := 0 to FColCount-1 do
5337 if FCols.Count <= I then
5338 Col := TKOLListViewColumn.Create( Self )
5341 Col.DefProps( 'Column' + IntToStr( I ), Filer );
5345 destructor TKOLListView.Destroy;
5349 if ImageListNormal <> nil then
5350 ImageListNormal.NotifyLinkedComponent( Self, noRemoved );
5351 if ImageListSmall <> nil then
5352 ImageListSmall.NotifyLinkedComponent( Self, noRemoved );
5353 if ImageListState <> nil then
5354 ImageListState.NotifyLinkedComponent( Self, noRemoved );
5355 for I := FCols.Count-1 downto 0 do
5356 TObject( FCols[ I ] ).Free;
5361 procedure TKOLListView.DoGenerateConstants(SL: TStringList);
5363 Col: TKOLListViewColumn;
5365 if not generateConstants then Exit;
5366 for I := 0 to Cols.Count-1 do
5369 if Col.Name <> '' then
5370 SL.Add( 'const ' + Col.Name + ' = ' + IntToStr( I ) + ';' );
5374 function TKOLListView.GetCaption: String;
5378 DB '#$signature$#', 0
5379 DB 'TKOLListView.GetCaption', 0
5382 Result := inherited Caption;
5385 function TKOLListView.GetColor: TColor;
5389 DB '#$signature$#', 0
5390 DB 'TKOLListView.GetColor', 0
5393 Result := inherited Color;
5396 function TKOLListView.GetColumns: String;
5400 if Cols.Count > 0 then
5401 Result := IntToStr( Cols.Count ) + ' columns';
5402 {for I := 0 to Cols.Count-1 do
5404 if Result <> '' then Result := Result + ';';
5405 Result := Result + Trim( TKOLListViewColumn( Cols[ I ] ).Caption );
5409 function TKOLListView.HasOrderedColumns: Boolean;
5411 C: TKOLListViewColumn;
5414 for I := 0 to Cols.Count-1 do
5417 if C.FLVColOrder >= 0 then
5426 procedure TKOLListView.Invalidate;
5428 {$IFDEF _KOLCtrlWrapper_}
5429 if Assigned(FKOLCtrl) then
5430 FKOLCtrl.InvalidateEx
5436 procedure TKOLListView.Loaded;
5442 procedure TKOLListView.LoadColCount(Reader: TReader);
5444 FColCount := Reader.ReadInteger;
5447 procedure TKOLListView.NotifyLinkedComponent(Sender: TObject;
5448 Operation: TNotifyOperation);
5452 DB '#$signature$#', 0
5453 DB 'TKOLListView.NotifyLinkedComponent', 0
5457 if Operation = noRemoved then
5459 if Sender = FImageListNormal then
5460 ImageListNormal := nil;
5461 if Sender = FImageListSmall then
5462 ImageListSmall := nil;
5463 if Sender = FImageListState then
5464 ImageListState := nil;
5468 procedure TKOLListView.SaveColCount(Writer: TWriter);
5470 FColCount := FCols.Count;
5471 Writer.WriteInteger( FColCount );
5474 procedure TKOLListView.SetColor(const Value: TColor);
5478 DB '#$signature$#', 0
5479 DB 'TKOLListView.SetColor', 0
5482 inherited Color := Value;
5485 procedure TKOLListView.SetColumns(const Value: String);
5490 procedure TKOLListView.SetGenerateColIdxConst(const Value: Boolean);
5492 FGenerateColIdxConst := Value;
5496 procedure TKOLListView.SetImageListNormal(const Value: TKOLImageList);
5500 DB '#$signature$#', 0
5501 DB 'TKOLListView.SetImageListNormal', 0
5504 if FImageListNormal <> nil then
5505 FImageListNormal.NotifyLinkedComponent( Self, noRemoved );
5506 FImageListNormal := Value;
5507 if Value <> nil then
5508 Value.AddToNotifyList( Self );
5512 procedure TKOLListView.SetImageListSmall(const Value: TKOLImageList);
5516 DB '#$signature$#', 0
5517 DB 'TKOLListView.SetImageListSmall', 0
5520 if FImageListSmall <> nil then
5521 FImageListSmall.NotifyLinkedComponent( Self, noRemoved );
5522 FImageListSmall := Value;
5523 if Value <> nil then
5524 Value.AddToNotifyList( Self );
5528 procedure TKOLListView.SetImageListState(const Value: TKOLImageList);
5532 DB '#$signature$#', 0
5533 DB 'TKOLListView.SetImageListState', 0
5536 if FImageListState <> nil then
5537 FImageListState.NotifyLinkedComponent( Self, noRemoved );
5538 FImageListState := Value;
5539 if Value <> nil then
5540 Value.AddToNotifyList( Self );
5544 procedure TKOLListView.SetLVCount(Value: Integer);
5548 DB '#$signature$#', 0
5549 DB 'TKOLListView.SetLVCount', 0
5558 procedure TKOLListView.SetLVTextBkColor(const Value: TColor);
5562 DB '#$signature$#', 0
5563 DB 'TKOLListView.SetLVTextBkColor', 0
5566 FLVTextBkColor := Value;
5570 procedure TKOLListView.SetOnLVCustomDraw(const Value: TOnLVCustomDraw);
5572 FOnLVCustomDraw := Value;
5576 procedure TKOLListView.SetOnLVDelete(const Value: TOnLVDelete);
5578 FOnLVDelete := Value;
5582 procedure TKOLListView.SetOptions(const Value: TKOLListViewOptions);
5584 Opts: kol.TListViewOptions;
5585 OldOpts: TKOLListViewOptions;
5589 DB '#$signature$#', 0
5590 DB 'TKOLListView.SetOptions', 0
5593 OldOpts := FOptions;
5595 if Assigned(FKOLCtrl) then begin
5596 if ([lvoNoScroll, lvoNoSortHeader] * OldOpts <> []) or ([lvoNoScroll, lvoNoSortHeader] * Value <> []) then
5600 if lvoGridLines in FOptions then
5601 Include(Opts, kol.lvoGridLines);
5602 if lvoFlatsb in FOptions then
5603 Include(Opts, kol.lvoFlatsb);
5604 FKOLCtrl.LVOptions:=Opts;
5605 UpdateAllowSelfPaint;
5611 procedure TKOLListView.SetpopupMenu(const Value: TKOLPopupMenu);
5615 DB '#$signature$#', 0
5616 DB 'TKOLListView.SetpopupMenu', 0
5619 FpopupMenu := Value;
5623 procedure TKOLListView.SetStyle(const Value: TKOLListViewStyle);
5627 DB '#$signature$#', 0
5628 DB 'TKOLListView.SetStyle', 0
5633 {$IFDEF _KOLCtrlWrapper_}
5634 if Assigned( FKOLCtrl ) then
5635 FKOLCtrl.LVStyle:=TListViewStyle(Value);
5636 UpdateAllowSelfPaint;
5642 procedure TKOLListView.SetupFirst(SL: TStringList; const AName, AParent,
5645 Col: TKOLListViewColumn;
5651 DB '#$signature$#', 0
5652 DB 'TKOLListView.SetupFirst', 0
5656 if Unicode then WifUnicode := 'W' else WifUnicode := '';
5657 if (Font.Color <> clWindowText) and (Font.Color <> clNone) and (Font.Color <> clDefault) then
5658 SL.Add( Prefix + AName + '.LVTextColor := ' + Color2Str( Font.Color ) + ';' );
5659 if (LVTextBkColor <> clDefault) and (LVTextBkColor <> clNone) and (LVTextBkColor <> clWindow) then
5660 SL.Add( Prefix + AName + '.LVTextBkColor := ' + Color2Str( LVTextBkColor ) + ';' );
5661 if (LVBkColor <> clDefault) and (LVBkColor <> clNone) and (LVBkColor <> clWindow) then
5662 SL.Add( Prefix + AName + '.LVBkColor := ' + Color2Str( LVBkColor ) + ';' );
5663 if Assigned( FpopupMenu ) then
5664 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
5666 for I := 0 to Cols.Count-1 do
5670 if Col.FLVColRightImg then
5672 SL.Add( Prefix + AName + '.LVColAdd' + WifUnicode + '( ' +
5673 StringConstant( 'Column' + IntToStr( I ) + 'Caption',
5674 Col.Caption ) + ', ' +
5675 TextAligns[ Col.TextAlign ] + ', ' + IntToStr( W ) + ');' );
5676 if Col.LVColImage >= 0 then
5677 SL.Add( Prefix + AName + '.LVColImage[ ' + IntToStr( I ) + ' ] := ' +
5678 IntToStr( Col.LVColImage ) + ';' );
5680 for I := 0 to Cols.Count-1 do
5683 if Col.LVColOrder >= 0 then
5684 if Col.LVColOrder <> I then
5685 SL.Add( Prefix + AName + '.LVColOrder[ ' + IntToStr( I ) + ' ] := ' +
5686 IntToStr( Col.LVColOrder ) + ';' );
5690 procedure TKOLListView.SetupLast(SL: TStringList; const AName, AParent,
5695 DB '#$signature$#', 0
5696 DB 'TKOLListView.SetupLast', 0
5701 SL.Add( Prefix + AName + '.LVCount := ' + IntToStr( LVCount ) + ';' );
5704 function TKOLListView.SetupParams(const AName, AParent: String): String;
5705 var S, O, ILSm, ILNr, ILSt: String;
5709 DB '#$signature$#', 0
5710 DB 'TKOLListView.SetupParams', 0
5714 lvsIcon: S := 'lvsIcon';
5715 lvsSmallIcon: S := 'lvsSmallIcon';
5716 lvsList: S := 'lvsList';
5717 lvsDetail: S := 'lvsDetail';
5718 lvsDetailNoHeader: S := 'lvsDetailNoHeader';
5721 if lvoIconLeft in Options then
5723 if lvoAutoArrange in Options then
5724 O := O + ', lvoAutoArrange';
5725 if lvoButton in Options then
5726 O := O + ', lvoButton';
5727 if lvoEditLabel in Options then
5728 O := O + ', lvoEditLabel';
5729 if lvoNoLabelWrap in Options then
5730 O := O + ', lvoNoLabelWrap';
5731 if lvoNoScroll in Options then
5732 O := O + ', lvoNoScroll';
5733 if lvoNoSortHeader in Options then
5734 O := O + ', lvoNoSortHeader';
5735 if lvoHideSel in Options then
5736 O := O + ', lvoHideSel';
5737 if lvoMultiselect in Options then
5738 O := O + ', lvoMultiselect';
5739 if lvoSortAscending in Options then
5740 O := O + ', lvoSortAscending';
5741 if lvoSortDescending in Options then
5742 O := O + ', lvoSortDescending';
5743 if lvoGridLines in Options then
5744 O := O + ', lvoGridLines';
5745 if lvoSubItemImages in Options then
5746 O := O + ', lvoSubItemImages';
5747 if lvoCheckBoxes in Options then
5748 O := O + ', lvoCheckBoxes';
5749 if lvoTrackSelect in Options then
5750 O := O + ', lvoTrackSelect';
5751 if lvoHeaderDragDrop in Options then
5752 O := O + ', lvoHeaderDragDrop';
5753 if lvoRowSelect in Options then
5754 O := O + ', lvoRowSelect';
5755 if lvoOneClickActivate in Options then
5756 O := O + ', lvoOneClickActivate';
5757 if lvoTwoClickActivate in Options then
5758 O := O + ', lvoTwoClickActivate';
5759 if lvoFlatsb in Options then
5760 O := O + ', lvoFlatsb';
5761 if lvoRegional in Options then
5762 O := O + ', lvoRegional';
5763 if lvoInfoTip in Options then
5764 O := O + ', lvoInfoTip';
5765 if lvoUnderlineHot in Options then
5766 O := O + ', lvoUnderlineHot';
5767 if lvoMultiWorkares in Options then
5768 O := O + ', lvoMultiWorkares';
5769 if lvoOwnerData in Options then
5770 O := O + ', lvoOwnerData';
5771 if lvoOwnerDrawFixed in Options then
5772 O := O + ', lvoOwnerDrawFixed';
5774 if O[ 1 ] = ',' then
5775 O := Copy( O, 3, MaxInt );
5777 if ImageListSmall <> nil then
5779 if ImageListSmall.ParentFORM.Name = ParentForm.Name then
5780 ILSm := 'Result.' + ImageListSmall.Name
5782 ILSm := ImageListSmall.ParentFORM.Name +'.'+ ImageListSmall.Name;
5785 if ImageListNormal <> nil then
5787 if ImageListNormal.ParentFORM.Name = ParentForm.Name then
5788 ILNr := 'Result.' + ImageListNormal.Name
5790 ILNr := ImageListNormal.ParentFORM.Name +'.'+ ImageListNormal.Name;
5793 if ImageListState <> nil then
5795 if ImageListState.ParentFORM.Name = ParentForm.Name then
5796 ILSt := 'Result.' + ImageListState.Name
5798 ILSt := ImageListState.ParentFORM.Name +'.'+ ImageListState.Name;
5800 Result := AParent + ', ' + S + ', [ ' + O + ' ], ' + ILSm + ', ' + ILNr
5804 function TKOLListView.TabStopByDefault: Boolean;
5808 DB '#$signature$#', 0
5809 DB 'TKOLListView.TabStopByDefault', 0
5815 procedure TKOLListView.UpdateColumns;
5816 {$IFDEF _KOLCtrlWrapper_}
5819 col: TKOLListViewColumn;
5822 {$IFDEF _KOLCtrlWrapper_}
5823 if Assigned(FKOLCtrl) then
5824 with FKOLCtrl^ do begin
5827 while LVColCount > 0 do
5829 for i:=0 to FCols.Count - 1 do begin
5831 LVColAdd(col.Caption, KOL.TTextAlign(col.TextAlign), col.Width)
5836 UpdateAllowSelfPaint;
5841 procedure TKOLListView.CreateKOLControl(Recreating: boolean);
5843 Opts: kol.TListViewOptions;
5846 if lvoGridLines in FOptions then
5847 Include(Opts, kol.lvoGridLines);
5848 if lvoFlatsb in FOptions then
5849 Include(Opts, kol.lvoFlatsb);
5850 if lvoNoScroll in FOptions then
5851 Include(Opts, kol.lvoNoScroll);
5852 if lvoNoSortHeader in FOptions then
5853 Include(Opts, kol.lvoNoSortHeader);
5854 FKOLCtrl := NewListView(KOLParentCtrl, TListViewStyle(Style), opts, nil, nil, nil);
5857 function TKOLListView.NoDrawFrame: Boolean;
5863 procedure TKOLListView.KOLControlRecreated;
5869 function TKOLListView.GetDefaultControlFont: HFONT;
5871 Result:=GetStockObject(DEFAULT_GUI_FONT);
5875 procedure TKOLListView.SetOnLVDataW(const Value: TOnLVDataW);
5877 FOnLVDataW := Value;
5882 procedure TKOLListView.SetLVItemHeight(const Value: Integer);
5884 if fLVItemHeight <> Value then begin
5885 fLVItemHeight := Value;
5890 function TKOLListView.GenerateTransparentInits: String;
5892 if fLVItemHeight > 0 then Result := '.SetLVItemHeight('+IntToStr(fLVItemHeight)+')'
5894 Result := Result + inherited GenerateTransparentInits();
5899 constructor TKOLTreeView.Create(AOwner: TComponent);
5903 DB '#$signature$#', 0
5904 DB 'TKOLTreeView.Create', 0
5908 Width := 150; DefaultWidth := Width;
5909 Height := 200; DefaultHeight := Height;
5914 procedure TKOLTreeView.CreateKOLControl(Recreating: boolean);
5916 FKOLCtrl:=NewTreeView(KOLParentCtrl, [], nil, nil);
5919 function TKOLTreeView.DefaultColor: TColor;
5923 DB '#$signature$#', 0
5924 DB 'TKOLTreeView.DefaultColor', 0
5930 destructor TKOLTreeView.Destroy;
5932 if ImageListNormal <> nil then
5933 ImageListNormal.NotifyLinkedComponent( Self, noRemoved );
5934 if ImageListState <> nil then
5935 ImageListState.NotifyLinkedComponent( Self, noRemoved );
5939 function TKOLTreeView.NoDrawFrame: Boolean;
5944 procedure TKOLTreeView.NotifyLinkedComponent(Sender: TObject;
5945 Operation: TNotifyOperation);
5949 DB '#$signature$#', 0
5950 DB 'TKOLTreeView.NotifyLinkedComponent', 0
5954 if Operation = noRemoved then
5956 if Sender = FImageListNormal then
5957 ImageListNormal := nil;
5958 if Sender = FImageListState then
5959 ImageListState := nil;
5963 procedure TKOLTreeView.SetCurIndex(const Value: Integer);
5967 DB '#$signature$#', 0
5968 DB 'TKOLTreeView.SetCurIndex', 0
5975 procedure TKOLTreeView.SetImageListNormal(const Value: TKOLImageList);
5979 DB '#$signature$#', 0
5980 DB 'TKOLTreeView.SetImageListNormal', 0
5983 if FImageListNormal <> nil then
5984 FImageListNormal.NotifyLinkedComponent( Self, noRemoved );
5985 FImageListNormal := Value;
5986 if Value <> nil then
5987 Value.AddToNotifyList( Self );
5991 procedure TKOLTreeView.SetImageListState(const Value: TKOLImageList);
5995 DB '#$signature$#', 0
5996 DB 'TKOLTreeView.SetImageListState', 0
5999 if FImageListState <> nil then
6000 FImageListState.NotifyLinkedComponent( Self, noRemoved );
6001 FImageListState := Value;
6002 if Value <> nil then
6003 Value.AddToNotifyList( Self );
6007 procedure TKOLTreeView.SetOptions(const Value: TKOLTreeViewOptions);
6011 DB '#$signature$#', 0
6012 DB 'TKOLTreeView.SetOptions', 0
6019 procedure TKOLTreeView.SetpopupMenu(const Value: TKOLPopupMenu);
6023 DB '#$signature$#', 0
6024 DB 'TKOLTreeView.SetpopupMenu', 0
6027 FpopupMenu := Value;
6031 procedure TKOLTreeView.SetTVIndent(const Value: Integer);
6035 DB '#$signature$#', 0
6036 DB 'TKOLTreeView.SetTVIndent', 0
6043 procedure TKOLTreeView.SetTVRightClickSelect(const Value: Boolean);
6047 DB '#$signature$#', 0
6048 DB 'TKOLTreeView,SetTVRightClickSelect', 0
6051 FTVRightClickSelect := Value;
6055 procedure TKOLTreeView.SetupFirst(SL: TStringList; const AName, AParent,
6060 DB '#$signature$#', 0
6061 DB 'TKOLTreeView.SetupFirst', 0
6065 if TVRightClickSelect then
6066 SL.Add( Prefix + AName + '.TVRightClickSelect := TRUE;' );
6067 if TVIndent > 0 then
6068 SL.Add( Prefix + AName + '.TVIndent := ' + IntToStr( TVIndent ) + ';' );
6069 if Assigned( FpopupMenu ) then
6070 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
6074 function TKOLTreeView.SetupParams(const AName, AParent: String): String;
6075 var O, ILNr, ILSt: String;
6079 DB '#$signature$#', 0
6080 DB 'TKOLTreeView.SetupParams', 0
6084 if tvoNoLines in Options then
6086 if tvoLinesRoot in Options then
6087 O := O + ', tvoLinesRoot';
6088 if tvoNoButtons in Options then
6089 O := O + ', tvoNoButtons';
6090 if tvoEditLabels in Options then
6091 O := O + ', tvoEditLabels';
6092 if tvoHideSel in Options then
6093 O := O + ', tvoHideSel';
6094 if tvoDragDrop in Options then
6095 O := O + ', tvoDragDrop';
6096 if tvoNoTooltips in Options then
6097 O := O + ', tvoNoTooltips';
6098 if tvoCheckBoxes in Options then
6099 O := O + ', tvoCheckBoxes';
6100 if tvoTrackSelect in Options then
6101 O := O + ', tvoTrackSelect';
6102 if tvoSingleExpand in Options then
6103 O := O + ', tvoSingleExpand';
6104 if tvoInfoTip in Options then
6105 O := O + ', tvoInfoTip';
6106 if tvoFullRowSelect in Options then
6107 O := O + ', tvoFullRowSelect';
6108 if tvoNoScroll in Options then
6109 O := O + ', tvoNoScroll';
6110 if tvoNonEvenHeight in Options then
6111 O := O + ', tvoNonEvenHeight';
6113 if O[ 1 ] = ',' then
6114 O := Copy( O, 3, MaxInt );
6116 if ImageListNormal <> nil then
6118 if ImageListNormal.ParentFORM.Name = ParentForm.Name then
6119 ILNr := 'Result.' + ImageListNormal.Name
6121 ILNr := ImageListNormal.ParentFORM.Name +'.'+ ImageListNormal.Name;
6124 if ImageListState <> nil then
6126 if ImageListState.ParentFORM.Name = ParentForm.Name then
6127 ILSt := 'Result.' + ImageListState.Name
6129 ILSt := ImageListState.ParentFORM.Name +'.'+ ImageListState.Name;
6131 Result := AParent + ', [ ' + O + ' ], ' + ILNr + ', ' + ILSt;
6134 function TKOLTreeView.TabStopByDefault: Boolean;
6138 DB '#$signature$#', 0
6139 DB 'TKOLTreeView.TabStopByDefault', 0
6147 function TKOLRichEdit.AdditionalUnits: String;
6149 Result := inherited AdditionalUnits;
6151 Result := Result + ', KOLOLERE';
6154 procedure TKOLRichEdit.AfterFontChange( SL: TStrings; const AName, Prefix: String );
6158 DB '#$signature$#', 0
6159 DB 'TKOLRichEdit.AfterFontChange', 0
6162 SL.Add( Prefix + AName + '.RE_CharFmtArea := raSelection;' );
6165 procedure TKOLRichEdit.BeforeFontChange( SL: TStrings; const AName, Prefix: String );
6169 DB '#$signature$#', 0
6170 DB 'TKOLRichEdit.BeforeFontChange', 0
6173 SL.Add( Prefix + AName + '.RE_CharFmtArea := raAll;' );
6176 function TKOLRichEdit.BestEventName: String;
6178 Result := 'OnChange';
6181 constructor TKOLRichEdit.Create(AOwner: TComponent);
6185 DB '#$signature$#', 0
6186 DB 'TKOLRichEdit.Create', 0
6189 FLines := TStringList.Create;
6191 FDefIgnoreDefault := TRUE;
6192 FIgnoreDefault := TRUE;
6193 Width := 164; DefaultWidth := 100;
6194 Height := 200; DefaultHeight := Height;
6197 FMaxTextSize := 32767;
6200 procedure TKOLRichEdit.CreateKOLControl(Recreating: boolean);
6202 opts: kol.TEditOptions;
6205 if eo_Lowercase in FOptions then
6206 Include(opts, kol.eoLowercase);
6207 if eo_NoHScroll in FOptions then
6208 Include(opts, kol.eoNoHScroll);
6209 if eo_NoVScroll in FOptions then
6210 Include(opts, kol.eoNoVScroll);
6211 if eo_UpperCase in FOptions then
6212 Include(opts, kol.eoUpperCase);
6213 FKOLCtrl:=NewRichEdit(KOLParentCtrl, opts);
6216 function TKOLRichEdit.DefaultColor: TColor;
6220 DB '#$signature$#', 0
6221 DB 'TKOLRichEdit.DefaultColor', 0
6227 destructor TKOLRichEdit.Destroy;
6231 DB '#$signature$#', 0
6232 DB 'TKOLRichEdit.Destroy', 0
6239 procedure TKOLRichEdit.FirstCreate;
6243 DB '#$signature$#', 0
6244 DB 'TKOLRichEdit.FirstCreate', 0
6247 FLines.Text := Name;
6251 function TKOLRichEdit.FontPropName: String;
6255 DB '#$signature$#', 0
6256 DB 'TKOLRichEdit.FontPropName', 0
6259 Result := 'RE_Font';
6262 function TKOLRichEdit.GenerateTransparentInits: String;
6266 DB '#$signature$#', 0
6267 DB 'TKOLRichEdit.GenerateTransparentInits', 0
6270 Result := inherited GenerateTransparentInits;
6271 if RE_FmtStandard then
6272 Result := Result + '.RE_FmtStandard';
6275 function TKOLRichEdit.GetCaption: String;
6279 DB '#$signature$#', 0
6280 DB 'TKOLRichEdit.GetCaption', 0
6283 Result := FLines.Text;
6286 function TKOLRichEdit.GetText: TStrings;
6290 DB '#$signature$#', 0
6291 DB 'TKOLRichEdit.GetText', 0
6297 procedure TKOLRichEdit.KOLControlRecreated;
6300 if Assigned(FKOLCtrl) then
6301 FKOLCtrl.Text:=FLines.Text;
6304 procedure TKOLRichEdit.Loaded;
6307 if Assigned(FKOLCtrl) then
6308 FKOLCtrl.Text:=FLines.Text;
6311 function TKOLRichEdit.NoDrawFrame: Boolean;
6316 procedure TKOLRichEdit.SetMaxTextSize(const Value: DWORD);
6320 DB '#$signature$#', 0
6321 DB 'TKOLRichEdit.SetMaxTextSize', 0
6324 FMaxTextSize := Value;
6328 procedure TKOLRichEdit.SetOLESupport(const Value: Boolean);
6330 FOLESupport := Value;
6334 procedure TKOLRichEdit.SetOptions(const Value: TKOLMemoOptions);
6338 DB '#$signature$#', 0
6339 DB 'TKOLRichEdit.SetOptions', 0
6342 if FOptions = Value then exit;
6344 if Assigned(FKOLCtrl) then
6349 procedure TKOLRichEdit.SetpopupMenu(const Value: TKOLPopupMenu);
6353 DB '#$signature$#', 0
6354 DB 'TKOLRichEdit.SetpopupMenu', 0
6357 FpopupMenu := Value;
6361 procedure TKOLRichEdit.SetRE_AutoKeybdSet(const Value: Boolean);
6365 DB '#$signature$#', 0
6366 DB 'TKOLRichEdit.SetRE_AutoKeybdSet', 0
6369 FRE_AutoKeybdSet := Value;
6373 procedure TKOLRichEdit.SetRE_AutoKeyboard(const Value: Boolean);
6377 DB '#$signature$#', 0
6378 DB 'TKOLRichEdit.SetRE_AutoKeyboard', 0
6381 FRE_AutoKeyboard := Value;
6385 procedure TKOLRichEdit.SetRE_AutoURLDetect(const Value: Boolean);
6389 DB '#$signature$#', 0
6390 DB 'TKOLRichEdit.SetRE_AutoURLDetect', 0
6393 FRE_AutoURLDetect := Value;
6397 procedure TKOLRichEdit.SetRE_DisableOverwriteChange(const Value: Boolean);
6401 DB '#$signature$#', 0
6402 DB 'TKOLRichEdit.SetRE_DisableOverwriteChange', 0
6405 FRE_DisableOverwriteChange := Value;
6409 procedure TKOLRichEdit.SetRE_FmtStandard(const Value: Boolean);
6413 DB '#$signature$#', 0
6414 DB 'TKOLRichEdit.SetRE_FmtStandard', 0
6417 FRE_FmtStandard := Value;
6421 procedure TKOLRichEdit.SetRE_Transparent(const Value: Boolean);
6425 DB '#$signature$#', 0
6426 DB 'TKOLRichEdit.SetRE_Transparent', 0
6429 FRE_Transparent := Value;
6433 procedure TKOLRichEdit.SetText(const Value: TStrings);
6437 DB '#$signature$#', 0
6438 DB 'TKOLRichEdit.SetText', 0
6441 FLines.Text := Value.Text;
6442 if Assigned(FKOLCtrl) then
6443 FKOLCtrl.Text:=Value.Text;
6447 procedure TKOLRichEdit.SetupFirst(SL: TStringList; const AName, AParent,
6450 BoolVal: array[ Boolean ] of String = ( 'FALSE', 'TRUE' );
6454 DB '#$signature$#', 0
6455 DB 'TKOLRichEdit.SetupFirst', 0
6459 if FLines.Text <> '' then
6460 AddLongTextField( SL, Prefix + AName + '.Text := ', FLines.Text, ';' );
6461 if MaxTextSize <> 32767 then
6462 if MaxTextSize > $7FFFffff then
6463 SL.Add( Prefix + AName + '.MaxTextSize := $' + Int2Hex( MaxTextSize, 8 ) + ';' )
6465 SL.Add( Prefix + AName + '.MaxTextSize := ' + IntToStr( MaxTextSize ) + ';' );
6466 if RE_AutoKeybdSet then
6467 SL.Add( Prefix + AName + '.RE_AutoKeyboard := ' + BoolVal[ RE_AutoKeyboard ] + ';' );
6468 if RE_DisableOverwriteChange then
6469 SL.Add( Prefix + AName + '.RE_DisableOverwriteChange := TRUE;' );
6470 if RE_AutoURLDetect then
6471 SL.Add( Prefix + AName + '.RE_AutoURLDetect := TRUE;' );
6472 if RE_Transparent then
6473 SL.Add( Prefix + AName + '.RE_Transparent := TRUE;' );
6474 if Assigned( FpopupMenu ) then
6475 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
6479 function TKOLRichEdit.SetupParams(const AName, AParent: String): String;
6484 DB '#$signature$#', 0
6485 DB 'TKOLRichEdit.SetupParams', 0
6489 if eo_NoHScroll in Options then
6490 S := S + ', eoNoHScroll';
6491 if eo_NoVScroll in Options then
6492 S := S + ', eoNoVScroll';
6493 if eo_Lowercase in Options then
6494 S := S + ', eoLowercase';
6495 if eo_NoHideSel in Options then
6496 S := S + ', eoNoHideSel';
6497 if eo_OemConvert in Options then
6498 S := S + ', eoOemConvert';
6499 if eo_Password in Options then
6500 S := S + ', eoPassword';
6501 if eo_Readonly in Options then
6502 S := S + ', eoReadonly';
6503 if eo_UpperCase in Options then
6504 S := S + ', eoUpperCase';
6505 if eo_WantReturn in Options then
6506 S := S + ', eoWantReturn';
6507 if eo_WantTab in Options then
6508 S := S + ', eoWantTab';
6510 if S[ 1 ] = ',' then
6511 S := Copy( S, 3, MaxInt );
6512 Result := AParent + ', [ ' + S + ' ]';
6515 procedure TKOLRichEdit.Setversion(const Value: TKOLRichEditVersion);
6519 DB '#$signature$#', 0
6520 DB 'TKOLRichEdit.Setversion', 0
6527 function TKOLRichEdit.TabStopByDefault: Boolean;
6531 DB '#$signature$#', 0
6532 DB 'TKOLRichEdit.TabStopByDefault', 0
6538 function TKOLRichEdit.TypeName: String;
6542 DB '#$signature$#', 0
6543 DB 'TKOLRichEdit.TypeName', 0
6546 Result := inherited TypeName;
6547 if version = ver1 then
6548 Result := 'RichEdit1';
6550 Result := 'OLERichEdit';
6553 procedure TKOLRichEdit.WantTabs( Want: Boolean );
6557 DB '#$signature$#', 0
6558 DB 'TKOLRichEdit.WantTabs', 0
6562 Options := Options + [ eo_WantTab ]
6564 Options := Options - [ eo_WantTab ];
6569 constructor TKOLProgressBar.Create(AOwner: TComponent);
6573 DB '#$signature$#', 0
6574 DB 'TKOLProgressBar.Create', 0
6578 Width := 300; DefaultWidth := Width;
6579 Height := 20; DefaultHeight := Height;
6581 ProgressColor := clHighLight;
6582 ProgressBkColor := clBtnFace;
6585 procedure TKOLProgressBar.CreateKOLControl(Recreating: boolean);
6587 opts: kol.TProgressbarOptions;
6591 Include(opts, kol.pboSmooth);
6593 Include(opts, kol.pboVertical);
6594 FKOLCtrl:=NewProgressbarEx(KOLParentCtrl, opts);
6597 function TKOLProgressBar.GetColor: TColor;
6601 DB '#$signature$#', 0
6602 DB 'TKOLProgressBar.GetColor', 0
6605 Result := inherited Color;
6608 procedure TKOLProgressBar.KOLControlRecreated;
6611 FKOLCtrl.Progress:=Progress;
6612 FKOLCtrl.MaxProgress:=MaxProgress;
6613 FKOLCtrl.ProgressBkColor:=ProgressBkColor;
6616 function TKOLProgressBar.NoDrawFrame: Boolean;
6621 procedure TKOLProgressBar.SetColor(const Value: TColor);
6625 DB '#$signature$#', 0
6626 DB 'TKOLProgressBar.SetColor', 0
6629 inherited Color := Value;
6632 procedure TKOLProgressBar.SetMaxProgress(const Value: Integer);
6636 DB '#$signature$#', 0
6637 DB 'TKOLProgressBar.SetMaxProgress', 0
6640 if Value < 1 then Exit;
6641 FMaxProgress := Value;
6642 if Value < Progress then
6644 if Assigned(FKOLCtrl) then begin
6645 FKOLCtrl.MaxProgress:=FMaxProgress;
6646 FKOLCtrl.Progress:=FProgress;
6651 procedure TKOLProgressBar.SetpopupMenu(const Value: TKOLPopupMenu);
6655 DB '#$signature$#', 0
6656 DB 'TKOLProgressBar.SetpopupMenu', 0
6659 FpopupMenu := Value;
6663 procedure TKOLProgressBar.SetProgress(const Value: Integer);
6667 DB '#$signature$#', 0
6668 DB 'TKOLProgressBar.SetProgress', 0
6671 if Value < 0 then Exit;
6673 if Value > MaxProgress then
6674 FMaxProgress := Value;
6675 if Assigned(FKOLCtrl) then begin
6676 FKOLCtrl.MaxProgress:=FMaxProgress;
6677 FKOLCtrl.Progress:=FProgress;
6682 procedure TKOLProgressBar.SetProgressColor(const Value: TColor);
6686 DB '#$signature$#', 0
6687 DB 'TKOLProgressBar.SetProgressColor', 0
6690 FProgressColor := Value;
6691 if Assigned(FKOLCtrl) then
6692 FKOLCtrl.ProgressColor:=Value;
6696 procedure TKOLProgressBar.SetSmooth(const Value: Boolean);
6700 DB '#$signature$#', 0
6701 DB 'TKOLProgressBar.SetSmooth', 0
6705 if Assigned(FKOLCtrl) then
6710 procedure TKOLProgressBar.SetupFirst(SL: TStringList; const AName, AParent,
6715 DB '#$signature$#', 0
6716 DB 'TKOLProgressBar.SetupFirst', 0
6720 if MaxProgress <> 100 then
6721 SL.Add( Prefix + AName + '.MaxProgress := ' + IntToStr( MaxProgress ) + ';' );
6722 if Progress <> 0 then
6723 SL.Add( Prefix + AName + '.Progress := ' + IntToStr( Progress ) + ';' );
6724 if ProgressColor <> clHighLight then
6725 SL.Add( Prefix + AName + '.ProgressColor := ' + Color2Str( ProgressColor ) + ';' );
6726 {if ProgressBkColor <> clBtnFace then
6727 SL.Add( Prefix + AName + '.ProgressBkColor := ' + Color2Str( ProgressBkColor ) + ';' );}
6728 if Assigned( FpopupMenu ) then
6729 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
6733 function TKOLProgressBar.SetupParams(const AName, AParent: String): String;
6738 DB '#$signature$#', 0
6739 DB 'TKOLProgressBar.SetupParams', 0
6743 if Smooth or Vertical then
6749 S := S + ', pboVertical';
6751 if S[ 1 ] = ',' then
6752 S := Copy( S, 3, MaxInt );
6753 Result := Result + ', [ ' + S + ' ]';
6757 procedure TKOLProgressBar.SetVertical(const Value: Boolean);
6761 DB '#$signature$#', 0
6762 DB 'TKOLProgressBar.SetVertical', 0
6766 if Assigned(FKOLCtrl) then
6771 function TKOLProgressBar.TypeName: String;
6775 DB '#$signature$#', 0
6776 DB 'TKOLProgressBar.TypeName', 0
6779 Result := inherited TypeName;
6780 if Smooth or Vertical then
6781 Result := 'ProgressBarEx';
6786 procedure TKOLTabControl.AdjustPages;
6793 DB '#$signature$#', 0
6794 DB 'TKOLTabControl.AdjustPages', 0
6797 if Parent = nil then
6806 if tcoVertical in Options then
6811 if tcoBottom in Options then
6814 Dec( R.Bottom, Dy );
6821 FAdjustingPages := TRUE;
6822 for I := 0 to Count-1 do
6824 Pages[ I ].FOnSetBounds := AttemptToChangePageBounds;
6825 Pages[ I ].BoundsRect := R;
6827 FAdjustingPages := FALSE;
6830 procedure TKOLTabControl.AttemptToChangePageBounds(Sender: TObject;
6831 var NewBounds: TRect);
6835 DB '#$signature$#', 0
6836 DB 'TKOLTabControl.AttemptToChangePageBounds', 0
6839 if FAdjustingPages then Exit;
6843 NewBounds := Pages[ 0 ].BoundsRect;
6847 constructor TKOLTabControl.Create(AOwner: TComponent);
6851 DB '#$signature$#', 0
6852 DB 'TKOLTabControl.Create', 0
6856 Width := 100; DefaultWidth := Width;
6857 Height := 100; DefaultHeight := Height;
6858 FTabs := TList.Create;
6859 FedgeType := esNone;
6860 FgenerateConstants := TRUE;
6863 destructor TKOLTabControl.Destroy;
6868 DB '#$signature$#', 0
6869 DB 'TKOLTabControl.Destroy', 0
6872 fDestroyingTabControl := TRUE;
6873 for I := FTabs.Count-1 downto 0 do
6874 FreeMem( FTabs[ I ] );
6879 function CompareTabPages( L: TList; e1, e2: DWORD ): Integer;
6880 var P1, P2: TKOLTabPage;
6884 DB '#$signature$#', 0
6885 DB 'CompareTabPages', 0
6890 if P1.TabOrder < P2.TabOrder then Result := -1
6892 if P1.TabOrder > P2.TabOrder then Result := 1
6897 procedure SwapTabPages( L: TList; e1, e2: DWORD );
6902 DB '#$signature$#', 0
6903 DB 'SwapTabPages', 0
6911 procedure TKOLTabControl.DoGenerateConstants(SL: TStringList);
6918 if not generateConstants then Exit;
6919 if Owner = nil then Exit;
6920 if not( Owner is TForm ) then Exit;
6921 F := Owner as TForm;
6922 Pages := TList.Create;
6924 for I := 0 to F.ComponentCount-1 do
6926 C := F.Components[ I ];
6927 if not ( C is TKOLTabPage ) then CONTINUE;
6928 K := C as TKOLTabPage;
6929 if K.Parent <> Self then CONTINUE;
6932 SortData( Pages, Pages.Count, @ CompareTabPages, @ SwapTabPages );
6933 for I := 0 to Pages.Count-1 do
6936 SL.Add( 'const _' + K.Name + ' = ' + IntToStr( I ) + ';' );
6943 function TKOLTabControl.GetCount: Integer;
6951 DB '#$signature$#', 0
6952 DB 'TKOLTabControl.GetCount', 0
6956 if Owner = nil then Exit;
6957 if not( Owner is TForm ) then Exit;
6958 F := Owner as TForm;
6959 for I := 0 to F.ComponentCount-1 do
6961 C := F.Components[ I ];
6962 if not ( C is TKOLTabPage ) then CONTINUE;
6963 K := C as TKOLTabPage;
6964 if K.Parent <> Self then CONTINUE;
6969 function TKOLTabControl.GetCurIndex: Integer;
6971 CurPage: TKOLTabPage;
6975 DB '#$signature$#', 0
6976 DB 'TKOLTabControl.GetCurIndex', 0
6980 CurPage := GetCurrentPage;
6981 if CurPage = nil then Exit;
6982 for I := 0 to Count-1 do
6983 if CurPage = Pages[ I ] then
6990 function TKOLTabControl.GetCurrentPage: TKOLTabPage;
6996 DB '#$signature$#', 0
6997 DB 'TKOLTabControl.GetCurrentPage', 0
7001 if Result = nil then
7003 W := GetWindow( Handle, GW_CHILD );
7005 C := FindControl( W );
7006 if C is TKOLTabPage then
7008 Result := C as TKOLTabPage;
7013 W := GetWindow( Handle, GW_CHILD );
7015 C := FindControl( W );
7016 if C is TKOLTabPage then
7017 Result := C as TKOLTabPage;}
7020 function TKOLTabControl.GetPages(Idx: Integer): TKOLTabPage;
7029 DB '#$signature$#', 0
7030 DB 'TKOLTabControl.GetPages', 0
7036 if Owner = nil then Exit;
7037 if not( Owner is TForm ) then Exit;
7038 F := Owner as TForm;
7039 for I := 0 to F.ComponentCount-1 do
7041 C := F.Components[ I ];
7042 if not ( C is TKOLTabPage ) then CONTINUE;
7043 K := C as TKOLTabPage;
7044 if K.Parent <> Self then CONTINUE;
7047 SortData( L, L.Count, @CompareTabPages, @SwapTabPages );
7048 Result := L.Items[ Idx ];
7054 function TKOLTabControl.NoDrawFrame: Boolean;
7059 procedure TKOLTabControl.Paint;
7062 I, Tw, Sx, Sy, W, H: Integer;
7064 CurPage: TKOLTabPage;
7066 DirXX_YY,DirXY_YX:SmallInt;
7067 O_V, O_B, O_BTN, O_F, O_BRD: Boolean;
7069 Col: array[0..3] of TColor;
7072 procedure _MoveTo(const x,y:integer);
7079 procedure MoveRel(const dx,dy:integer);
7081 p.x:=p.x+dirxx_yy*dx+dirxy_yx*dy;
7082 p.y:=p.y+dirxx_yy*dy+dirxy_yx*dx;
7083 canvas.moveto(p.x,p.y);
7086 procedure LineRel(const dx,dy:integer);
7088 p.x:=p.x+dirxx_yy*dx+dirxy_yx*dy;
7089 p.y:=p.y+dirxx_yy*dy+dirxy_yx*dx;
7090 canvas.lineto(p.x,p.y);
7093 procedure prepare(const r:trect);
7121 procedure DrawTab(r:trect; const cur:boolean);
7127 then drawedge(canvas.handle,r,BDR_RAISEDOUTER,BF_RECT or BF_SOFT)
7128 else drawedge(canvas.handle,r,EDGE_RAISED*succ(ord(cur)),BF_RECT or BF_SOFT);
7131 inflaterect(r,-2,-2);
7132 drawcaption(findwindow('Shell_TrayWnd',nil),canvas.handle,r,
7133 DC_TEXT or DC_ACTIVE or DC_INBUTTON);
7141 then if o_v then inc(r.left,2) else inc(r.top,2)
7142 else if o_v then dec(r.right,2) else dec(r.bottom,2);
7151 pen.color:=clbtnface;
7179 procedure preparefont;
7183 a:=900*pred(ord(not o_b) shl 1);
7184 fnt:=createfont(10,0,a,a,0,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
7185 CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,VARIABLE_PITCH,'MS Serif');
7191 DB '#$signature$#', 0
7192 DB 'TKOLTabControl.Paint', 0
7195 if PaintType = ptSchematic then
7200 o_b:=tcobottom in options;
7201 o_v:=tcovertical in options;
7202 o_btn:=tcobuttons in options;
7203 o_f:=tcoflat in options;
7204 o_brd:=tcoBorder in options;
7208 drawedge(canvas.handle,r,EDGE_SUNKEN,BF_RECT);
7209 inflaterect(r,-2,-2);
7211 inflaterect(r,-4,-4);
7213 then if o_v then r.left:=r.right-17 else r.top:=r.bottom-17
7214 else if o_v then r.right:=r.left+17 else r.bottom:=r.top+17;
7215 dirxx_yy:=ord(not o_v)*pred(ord(not o_b) shl 1);
7216 dirxy_yx:=ord(o_v)*pred(ord(not o_b) shl 1);
7217 col[0 xor ord(o_b)]:=clbtnhighlight;
7218 col[1 xor ord(o_b)]:=cl3ddkshadow;
7219 col[2 xor ord(o_b)]:=cl3dlight;
7220 col[3 xor ord(o_b)]:=clbtnshadow;
7221 if not o_v then PrepareCanvasFontForWYSIWIGPaint(canvas) else
7224 selectobject(canvas.handle,fnt);
7226 curpage:=getcurrentpage;
7227 for i:=0 to pred(ftabs.count) do freemem(ftabs[i]);
7229 setbkmode(canvas.handle,windows.TRANSPARENT);
7230 for i:=0 to pred(count) do
7232 getmem(m,sizeof(trect));
7233 s:=pages[i].caption;
7234 tw:=canvas.textwidth(s);
7235 if o_v then r.bottom:=r.top+tw+8 else r.right:=r.left+tw+8;
7238 if curpage=pages[i] then curr:=r else
7241 drawtext(canvas.handle,pchar(s),length(s),r,DT_CENTER or DT_VCENTER or DT_SINGLELINE);
7243 pages[i].fonsetbounds:=attempttochangepagebounds;
7244 if o_v then r.top:=r.bottom+4 else r.left:=r.right+4;
7246 if o_v then inc(r.top,2) else inc(r.left,2);
7249 if o_brd then inflaterect(r,-2,-2);
7251 then if o_v then r.right:=r.right-21 else r.bottom:=r.bottom-21
7252 else if o_v then r.left:=r.left+21 else r.top:=r.top+21;
7253 if not o_btn then drawedge(canvas.handle,r,EDGE_RAISED,BF_RECT or BF_SOFT);
7254 if curpage<>nil then
7258 if o_btn then offsetrect(curr,2,2) else offsetrect(curr,-2*dirxy_yx,-2*dirxx_yy);
7259 drawtext(canvas.handle,pchar(s),length(s),curr,DT_CENTER or DT_VCENTER or DT_SINGLELINE);
7261 if o_v then deleteobject(fnt);
7265 procedure TKOLTabControl.SchematicPaint;
7269 CurPage: TKOLTabPage;
7274 DB '#$signature$#', 0
7275 DB 'TKOLTabControl.Paint', 0
7284 if tcoBottom in Options then
7285 if tcoVertical in Options then
7286 R.Left := R.Right - 18
7288 R.Top := R.Bottom - 18
7290 if tcoVertical in Options then
7291 R.Right := R.Left + 18
7293 R.Bottom := R.Top + 18;
7294 R.Right := R.Left + 18;
7295 R.Bottom := R.Top + 18;
7296 Canvas.Font.Height := 8;
7297 Canvas.Brush.Color := clDkGray;
7298 CurPage := GetCurrentPage;
7299 for I := 0 to FTabs.Count-1 do
7300 FreeMem( FTabs[ I ] );
7302 for I := 0 to Count-1 do
7304 GetMem( M, SizeOf( TRect ) );
7308 Tw := Canvas.TextWidth( S );
7309 Th := Canvas.TextHeight( S );
7310 Canvas.TextRect( R, R.Left + (18 - Tw) div 2, R.Top + (18 - Th) div 2, S );
7311 Pages[ I ].FOnSetBounds := AttemptToChangePageBounds;
7312 if CurPage = Pages[ I ] then
7314 Canvas.Brush.Color := clBlack;
7315 Canvas.FrameRect( R );
7316 Canvas.Brush.Color := clDkGray;
7318 if tcoVertical in Options then
7321 Inc( R.Bottom, 22 );
7331 procedure TKOLTabControl.SetBounds(aLeft, aTop, aWidth, aHeight: Integer);
7335 DB '#$signature$#', 0
7336 DB 'TKOLTabControl.SetBounds', 0
7343 procedure TKOLTabControl.SetCount(const Value: Integer);
7344 var Pg: TKOLTabPage;
7350 DB '#$signature$#', 0
7351 DB 'TKOLTabControl.SetCount', 0
7354 if Value < Count then Exit;
7355 if csLoading in ComponentState then Exit;
7357 while Value > Count do
7361 S := Name + '_Tab' + IntToStr( I );
7362 if (Owner as TForm).FindComponent( S ) = nil then
7366 Pg := TKOLTabPage.Create( Owner );
7369 Pg.Caption := 'Tab' + IntToStr( I );
7370 //Pg.BevelOuter := bvNone;
7371 Pg.edgeStyle := esNone;
7372 //Pg.Align := caClient;
7380 procedure TKOLTabControl.SetCurIndex(const Value: Integer);
7381 //var Pg: TKOLTabPage;
7385 DB '#$signature$#', 0
7386 DB 'TKOLTabControl.SetCurIndex', 0
7389 if (Value >= Count) or (Value < 0) then
7394 FCurPage:=Pages[ Value ];
7395 if FCurPage <> nil then
7397 FCurPage.BringToFront;
7400 {Pg := Pages[ Value ];
7409 procedure TKOLTabControl.SetedgeType(const Value: TEdgeStyle);
7413 DB '#$signature$#', 0
7414 DB 'TKOLTabControl.SetedgeType', 0
7418 if Value = esNone then
7419 Options := Options - [ tcoBorder ]
7421 Options := Options + [ tcoBorder ];
7425 procedure TKOLTabControl.SetgenerateConstants(const Value: Boolean);
7427 FgenerateConstants := Value;
7431 procedure TKOLTabControl.SetImageList(const Value: TKOLImageList);
7435 DB '#$signature$#', 0
7436 DB 'TKOLTabControl.SetImageList', 0
7439 FImageList := Value;
7443 procedure TKOLTabControl.SetImageList1stIdx(const Value: Integer);
7447 DB '#$signature$#', 0
7448 DB 'TKOLTabControl.SetImageList1stIdx', 0
7451 FImageList1stIdx := Value;
7455 procedure TKOLTabControl.SetOptions(const Value: TTabControlOptions);
7459 DB '#$signature$#', 0
7460 DB 'TKOLTabControl.SetOptions', 0
7469 procedure TKOLTabControl.SetpopupMenu(const Value: TKOLPopupMenu);
7473 DB '#$signature$#', 0
7474 DB 'TKOLTabControl.SetpopupMenu', 0
7477 FpopupMenu := Value;
7481 procedure TKOLTabControl.SetupFirst(SL: TStringList; const AName, AParent,
7486 DB '#$signature$#', 0
7487 DB 'TKOLTabControl.SetupFirst', 0
7493 esRaised: SL.Add( Prefix + AName + '.Style := ' + AName +
7494 '.Style or WS_THICKFRAME;' );
7497 if Assigned( FpopupMenu ) then
7498 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
7502 procedure TKOLTabControl.SetupLast(SL: TStringList; const AName, AParent,
7507 DB '#$signature$#', 0
7508 DB 'TKOLTabControl.SetupLast', 0
7512 if CurIndex > 0 then
7514 //SL.Add( Prefix + ' ' + AName + '.GetWindowHandle;' );
7515 //SL.Add( Prefix + ' ' + AName + '.CreateWindow;' );
7516 SL.Add( Prefix + ' ' + AName + '.CurIndex := ' + IntToStr( CurIndex ) + ';' );
7517 //SL.Add( Prefix + ' PostMessage( ' + AName + '.GetWindowHandle, TCM_SETCURSEL, ' + IntToStr( CurIndex ) +
7519 SL.Add( Prefix + ' ' + AName + '.Pages[ ' + IntToStr( CurIndex ) + ' ].BringToFront;' );
7523 function TKOLTabControl.SetupParams(const AName, AParent: String): String;
7524 var O, IL, S: String;
7529 DB '#$signature$#', 0
7530 DB 'TKOLTabControl.SetupParams', 0
7534 for I := 0 to Count - 1 do
7538 S := S + StringConstant( 'Page' + IntToStr( I ) + 'Caption', Pages[ I ].Caption );
7541 if tcoButtons in Options then
7543 if tcoFixedWidth in Options then
7544 O := O + ', tcoFixedWidth';
7545 if tcoFocusTabs in Options then
7546 O := O + ', tcoFocusTabs';
7547 if tcoIconLeft in Options then
7548 O := O + ', tcoIconLeft';
7549 if tcoLabelLeft in Options then
7550 O := O + ', tcoLabelLeft';
7551 if tcoMultiline in Options then
7552 O := O + ', tcoMultiline';
7553 if tcoMultiselect in Options then
7554 O := O + ', tcoMultiselect';
7555 if tcoFitRows in Options then
7556 O := O + ', tcoFitRows';
7557 if tcoScrollOpposite in Options then
7558 O := O + ', tcoScrollOpposite';
7559 if tcoBottom in Options then
7560 O := O + ', tcoBottom';
7561 if tcoVertical in Options then
7562 O := O + ', tcoVertical';
7563 if tcoFlat in Options then
7564 O := O + ', tcoFlat';
7565 if tcoHotTrack in Options then
7566 O := O + ', tcoHotTrack';
7567 if tcoBorder in Options then
7568 O := O + ', tcoBorder';
7569 if tcoOwnerDrawFixed in Options then
7570 O := O + ', tcoOwnerDrawFixed';
7572 if O[ 1 ] = ',' then
7573 O := Copy( O, 3, MaxInt );
7575 if ImageList <> nil then
7576 IL := 'Result.' + ImageList.Name;
7577 Result := AParent + ', [ ' + S + ' ], [ ' + O + ' ], ' + IL
7578 + ', ' + IntToStr( ImageList1stIdx );
7581 function TKOLTabControl.TabStopByDefault: Boolean;
7585 DB '#$signature$#', 0
7586 DB 'TKOLTabControl.TabStopByDefault', 0
7592 function TKOLTabControl.WYSIWIGPaintImplemented: Boolean;
7599 function TKOLToolbar.AllPicturedButtonsAreLeading: Boolean;
7601 Bt: TKOLToolbarButton;
7604 if PicturedButtonsCount = 0 then Exit;
7606 if not Bt.HasPicture then Exit;
7608 for I := 0 to Items.Count-1 do
7611 if not Bt.HasPicture then
7613 if NoMorePicturedButtonsFrom( I ) then
7621 function TKOLToolbar.LastBtnHasPicture: Boolean;
7622 var Bt: TKOLToolbarButton;
7625 if PicturedButtonsCount = 0 then Exit;
7626 if not Assigned( Items ) then Exit;
7627 if Items.Count = 0 then Exit;
7628 Bt := Items[ Items.Count-1 ];
7629 Result := Bt.HasPicture;
7632 procedure TKOLToolbar.AssembleBitmap;
7633 var MaxWidth, MaxHeight: Integer;
7635 Bt: TKOLToolbarButton;
7641 DB '#$signature$#', 0
7642 DB 'TKOLToolbar.AssembleBitmap', 0
7647 TranColor := clNone;
7648 for I := 0 to Items.Count-1 do
7651 if Bt.HasPicture then
7653 if MaxWidth < Bt.picture.Width then
7654 MaxWidth := Bt.picture.Width;
7655 if MaxHeight < Bt.picture.Height then
7656 MaxHeight := Bt.picture.Height;
7657 if TranColor = clNone then
7659 TmpBmp := TBitmap.Create;
7661 TmpBmp.Width := Bt.picture.Width;
7662 TmpBmp.Height := Bt.picture.Height;
7663 TmpBmp.Canvas.Draw( 0, 0, Bt.picture.Graphic );
7664 TranColor := TmpBmp.Canvas.Pixels[ 0, TmpBmp.Height - 1 ];
7671 if (MaxWidth = 0) or (MaxHeight = 0) then
7674 Fbitmap.Height := 0;
7678 Fbitmap.Width := MaxWidth * Items.Count;
7679 Fbitmap.Height := MaxHeight;
7680 if TranColor <> clNone then
7682 Fbitmap.Canvas.Brush.Color := TranColor;
7683 Fbitmap.Canvas.FillRect( Rect( 0, 0, Fbitmap.Width, Fbitmap.Height ) );
7685 for I := 0 to Items.Count - 1 do
7688 if Bt.HasPicture then
7689 Fbitmap.Canvas.Draw( I * MaxWidth, 0, Bt.picture.Graphic );
7692 if ActiveDesign <> nil then
7694 ActiveDesign.Bitmap.Assign( Fbitmap );
7695 ActiveDesign.ApplyImages;
7697 if Assigned(FKOLCtrl) then
7701 function IsBitmapEmpty( Bmp: TBitmap ): Boolean;
7702 var //TmpBmp: TBitmap;
7706 KOLBmp: KOL.PBitmap;
7710 DB '#$signature$#', 0
7711 DB 'IsBitmapEmpty', 0
7715 if not Assigned( Bmp ) then Exit;
7716 if Bmp.Width * Bmp.Height = 0 then Exit;
7717 KOLBmp := NewBitmap( Bmp.Width, Bmp.Height );
7720 KOLBmp.HandleType := KOL.bmDIB;
7721 KOLBmp.PixelFormat := KOL.pf32bit;
7722 BitBlt( KOLBmp.Canvas.Handle, 0, 0, Bmp.Width, Bmp.Height,
7723 Bmp.Canvas.Handle, 0, 0, SrcCopy );
7724 Lin := KOLBmp.ScanLine[ 0 ];
7730 Color1 := Lin^ and $FFFFFF;
7731 for Y := 0 to KOLBmp.Height-1 do
7733 Lin := KOLBmp.ScanLine[ Y ];
7734 for X := 0 to KOLBmp.Width-1 do
7736 if DWORD(Lin^ and $FFFFFF) <> DWORD( Color1 ) then
7749 procedure TKOLToolbar.AssembleTooltips;
7750 var SL: TStringList;
7752 Bt: TKOLToolbarButton;
7756 DB '#$signature$#', 0
7757 DB 'TKOLToolbar.AssembleTooltips', 0
7761 SL := TStringList.Create;
7763 for I := 0 to Items.Count-1 do
7766 if Bt.separator then continue;
7767 SL.Add( Bt.Ftooltip );
7768 if Length( Bt.Ftooltip ) > 0 then
7774 showTooltips := SL.Count > 0;
7780 procedure TKOLToolbar.bitmap2ItemPictures( AnyWay: Boolean );
7783 Bt: TKOLToolbarButton;
7784 Format: TPixelFormat;
7785 KOLBmp: KOL.PBitmap;
7789 DB '#$signature$#', 0
7790 DB 'TKOLToolbar.bitmap2ItemPictures', 0
7793 if not Assigned( bitmap ) then Exit;
7794 if Items.Count = 0 then Exit;
7795 if bitmap.Width = 0 then Exit;
7796 if bitmap.Height = 0 then Exit;
7799 for I := 0 to Items.Count - 1 do
7802 if Bt.HasPicture then
7805 ShowMessage( 'Restoring toolbar buttons bitmap from then previous version of the KOL&MCK format.' );
7807 W := bitmap.Width div Items.Count;
7808 Bmp := TBitmap.Create;
7809 KOLBmp := NewDIBBitmap( Bitmap.Width, Bitmap.Height, KOL.pf32bit );
7811 BitBlt( KOLBmp.Canvas.Handle, 0, 0, bitmap.Width, bitmap.Height,
7812 bitmap.Canvas.Handle, 0, 0, SRCCOPY );
7813 KOLBmp.HandleType := KOL.bmDIB;
7814 KOLBmp.PixelFormat := KOL.pf32bit;
7815 case CountSystemColorsUsedInBitmap( KOLBmp ) of
7816 KOL.pf1bit: Format := pf1bit;
7817 KOL.pf4bit: Format := pf4bit;
7818 KOL.pf8bit: Format := pf8bit;
7819 else Format := pf24bit;
7826 Bmp.Height := bitmap.Height;
7828 Bmp.PixelFormat := Format;
7830 for I := 0 to Items.Count - 1 do
7832 if I >= Items.Count then break;
7833 if Items[ I ] = nil then break;
7834 Bmp.Canvas.CopyRect( Rect( 0, 0, Bmp.Width, Bmp.Height ),
7836 Rect( I * Bmp.Width, 0, (I + 1) * Bmp.Width, Bmp.Height ) );
7838 if IsBitmapEmpty( Bmp ) then
7841 Bt.Fpicture := TPicture.Create;
7845 Bt.Fpicture.Assign( Bmp );
7853 procedure TKOLToolbar.buttons2Items;
7856 Bt: TKOLToolbarButton;
7860 DB '#$signature$#', 0
7861 DB 'TKOLToolbar.buttons2Items', 0
7871 C := Copy( S, 1, I - 1 );
7872 S := Copy( S, I + 1, MaxInt );
7879 if J >= Items.Count then
7880 Bt := TKOLToolbarButton.Create( Self )
7884 if C[ 1 ] = '^' then
7886 C := Copy( C, 2, MaxInt );
7887 Bt.Fdropdown := TRUE;
7891 Bt.Fseparator := FALSE;
7894 bitmap2ItemPictures( FALSE );
7897 procedure TKOLToolbar.Change;
7901 DB '#$signature$#', 0
7902 DB 'TKOLToolbar.Change', 0
7906 if ActiveDesign <> nil then
7907 ActiveDesign.RefreshItems;
7908 if ParentForm <> nil then
7909 if ParentForm.Designer <> nil then
7910 ParentForm.Designer.Modified;
7913 constructor TKOLToolbar.Create(AOwner: TComponent);
7917 DB '#$signature$#', 0
7918 DB 'TKOLToolbar.Create', 0
7921 Ftooltips := TStringList.Create;
7924 FgenerateConstants := TRUE;
7925 FHeightAuto := TRUE;
7926 Fitems := TList.Create;
7927 ControlStyle := ControlStyle + [ csAcceptsControls ];
7928 Height := 22; DefaultHeight := Height;
7930 DefaultWidth := 400;
7932 FBitmap := TBitmap.Create;
7934 FmapBitmapColors := TRUE;
7936 FHasBorder := FALSE;
7937 FDefHasBorder := FALSE;
7938 FTimer := TTimer.Create( Self );
7939 FTimer.Interval := 200;
7940 FTimer.OnTimer := Tick;
7941 FTimer.Enabled := TRUE;
7942 AllowPostPaint := True;
7945 procedure TKOLToolbar.DefineProperties(Filer: TFiler);
7947 Bt: TKOLToolbarButton;
7951 DB '#$signature$#', 0
7952 DB 'TKOLToolbar.DefineProperties', 0
7956 Filer.DefineProperty( 'Buttons_Count', LoadButtonCount, SaveButtonCount, TRUE );
7957 for I := 0 to FButtonCount-1 do
7959 if FItems.Count <= I then
7960 Bt := TKOLToolbarButton.Create( Self )
7963 //Bt.DefineProperties( Filer );
7964 Bt.DefProps( 'Btn' + IntToStr( I + 1 ), Filer );
7966 Filer.DefineProperty( 'NewVersion', ReadNewVersion, WriteNewVersion, fNewVersion );
7969 destructor TKOLToolbar.Destroy;
7974 DB '#$signature$#', 0
7975 DB 'TKOLToolbar.Destroy', 0
7978 for I := FItems.Count-1 downto 0 do
7979 TObject( FItems[ I ] ).Free;
7986 {if FKOLCtrl <> nil then
7991 if FBmpDesign <> 0 then
7992 DeleteObject( FBmpDesign );
7996 function IsNumber( const S: String ): Boolean;
8000 if S = '' then Exit;
8001 for I := 1 to Length( S ) do
8002 if not( S[ I ] in [ '0'..'9' ] ) then
8007 procedure TKOLToolbar.DoGenerateConstants(SL: TStringList);
8008 var I, N, K: Integer;
8009 Bt: TKOLToolbarButton;
8011 if not (generateConstants or generateVariables) then Exit;
8014 for I := 0 to Items.Count-1 do
8017 if Bt.separator and (Copy( Bt.Name, 1, 2 ) = 'TB') and
8018 IsNumber( Copy( Bt.Name, 3, MaxInt ) ) then
8023 if Bt.Name <> '' then
8025 if generateConstants then
8026 SL.Add( 'const ' + Bt.Name + ' = ' + IntToStr( N ) + ';' )
8028 SL.Add( 'var ' + Bt.Name + ' = ' + IntToStr( N ) + ';' );
8037 function TKOLToolbar.GetButtons: String;
8040 if Items.Count = 0 then Exit;
8045 procedure TKOLToolbar.Items2buttons;
8048 Bt: TKOLToolbarButton;
8052 DB '#$signature$#', 0
8053 DB 'TKOLToolbar.Items2buttons', 0
8057 for I := 0 to Items.Count-1 do
8064 S := S + Bt.caption;
8069 procedure TKOLToolbar.LoadButtonCount(R: TReader);
8073 DB '#$signature$#', 0
8074 DB 'TKOLToolbar.LoadButtonCount', 0
8077 FButtonCount := R.ReadInteger;
8078 //ShowMessage( 'loaded FButtonCount=' + IntToStr( FButtonCount ) );
8081 procedure TKOLToolbar.Loaded;
8083 Bt: TKOLToolbarButton;
8085 AnyEnabled: Boolean;
8089 DB '#$signature$#', 0
8090 DB 'TKOLToolbar.Loaded', 0
8095 AnyEnabled := FALSE;
8096 for I := 0 to Items.Count-1 do
8099 if Bt.Name = '' then
8101 for J := 1 to MaxInt do
8103 S := 'TB' + IntToStr( J );
8104 if (FindComponent( S ) = nil) and ((Owner as TForm).FindComponent( S ) = nil) then
8114 if not AnyEnabled then
8116 for I := 0 to Items.Count-1 do
8122 fNewVersion := TRUE;
8123 if Assigned(FKOLCtrl) then
8124 if StandardImagesUsed > 0 then
8130 function TKOLToolbar.MaxBtnImgHeight: Integer;
8132 Bt: TKOLToolbarButton;
8136 DB '#$signature$#', 0
8137 DB 'TKOLToolbar.MaxBtnImgHeight', 0
8141 for I := 0 to Items.Count-1 do
8144 if Bt.HasPicture and (Bt.picture.Height > Result) then
8145 Result := Bt.picture.Height;
8149 function TKOLToolbar.MaxBtnImgWidth: Integer;
8151 Bt: TKOLToolbarButton;
8155 DB '#$signature$#', 0
8156 DB 'TKOLToolbar.MaxBtnImgWidth', 0
8160 for I := 0 to Items.Count-1 do
8163 if Bt.HasPicture and (Bt.picture.Width > Result) then
8164 Result := Bt.picture.Width;
8168 function TKOLToolbar.NoMorePicturedButtonsFrom(Idx: Integer): Boolean;
8170 Bt: TKOLToolbarButton;
8173 for I := Idx to Items.Count - 1 do
8176 if Bt.HasPicture or (Bt.sysimg <> stiCustom) then
8184 function TKOLToolbar.PicturedButtonsCount: Integer;
8186 Bt: TKOLToolbarButton;
8189 for I := 0 to Items.Count-1 do
8192 if Bt.HasPicture then
8195 //Rpt( '%%%%%%%%% PicturedButtonsCount := ' + IntToStr( Result ) );
8198 procedure TKOLToolbar.SaveButtonCount(W: TWriter);
8202 DB '#$signature$#', 0
8203 DB 'TKOLToolbar.SaveButtonCount', 0
8206 FButtonCount := FItems.Count;
8207 //ShowMessage( 'saved FButtonCount=' + IntToStr( FButtonCount ) );
8208 W.WriteInteger( FButtonCount );
8211 procedure TKOLToolbar.Setbitmap(const Value: TBitmap);
8215 DB '#$signature$#', 0
8216 DB 'TKOLToolbar.Setbitmap', 0
8219 if Value <> nil then
8220 Fbitmap.Assign( Value )
8224 Fbitmap.Height := 0;
8226 if not (csLoading in ComponentState) then
8227 bitmap2ItemPictures( TRUE );
8228 if Assigned(FKOLCtrl) then
8233 procedure TKOLToolbar.SetBtnCount_Dummy(const Value: Integer);
8237 DB '#$signature$#', 0
8238 DB 'TKOLToolbar.SetBtnCount_Dummy', 0
8241 //FButtonCount := Value;
8244 procedure TKOLToolbar.SetbuttonMaxWidth(const Value: Integer);
8246 FbuttonMaxWidth := Value;
8250 procedure TKOLToolbar.SetbuttonMinWidth(const Value: Integer);
8252 FbuttonMinWidth := Value;
8256 procedure TKOLToolbar.SetgenerateConstants(const Value: Boolean);
8258 FgenerateConstants := Value;
8260 FgenerateVariables := FALSE;
8264 procedure TKOLToolbar.SetmapBitmapColors(const Value: Boolean);
8268 DB '#$signature$#', 0
8269 DB 'TKOLToolbar.SetmapBitmapColors', 0
8272 if Value = FmapBitmapColors then Exit;
8273 FmapBitmapColors := Value;
8274 if Assigned(FKOLCtrl) then
8279 procedure TKOLToolbar.SetnoTextLabels(const Value: Boolean);
8283 DB '#$signature$#', 0
8284 DB 'TKOLToolbar.SetnoTextLabels', 0
8287 FnoTextLabels := Value;
8292 procedure TKOLToolbar.SetOptions(const Value: TToolbarOptions);
8296 DB '#$signature$#', 0
8297 DB 'TKOLToolbar.SetOptions', 0
8301 if Assigned(FKOLCtrl) then
8306 procedure TKOLToolbar.SetpopupMenu(const Value: TKOLPopupMenu);
8310 DB '#$signature$#', 0
8311 DB 'TKOLToolbar.SetpopupMenu', 0
8314 FpopupMenu := Value;
8318 procedure TKOLToolbar.SetshowTooltips(const Value: Boolean);
8322 DB '#$signature$#', 0
8323 DB 'TKOLToolbar.SetshowTooltips', 0
8326 FshowTooltips := Value;
8330 procedure TKOLToolbar.SetStandardImagesLarge(const Value: Boolean);
8332 FStandardImagesLarge := Value;
8333 if Assigned(FKOLCtrl) then
8338 procedure TKOLToolbar.Settooltips(const Value: TStrings);
8342 DB '#$signature$#', 0
8343 DB 'TKOLToolbar.Settooltips', 0
8346 Ftooltips.Text := Value.Text;
8350 procedure TKOLToolbar.SetupFirst(SL: TStringList; const AName, AParent,
8352 var RsrcFile, RsrcName: String;
8354 I, J, K, W, H, N, I0: Integer;
8357 Bt, Bt1: TKOLToolbarButton;
8362 DB '#$signature$#', 0
8363 DB 'TKOLToolbar.SetupFirst', 0
8368 H := MaxBtnImgHeight;
8369 W := MaxBtnImgWidth;
8372 ResBmpID := ParentKOLForm.NextUniqueID;
8373 RsrcName := UpperCase( ParentKOLForm.FormName ) + '_TBBMP' + IntToStr( ResBmpID );
8374 RsrcFile := ParentKOLForm.FormName + '_' + Name;
8375 SL.Add( Prefix + ' {$R ' + RsrcFile + '.res}' );
8376 Bmp := TBitmap.Create;
8379 FBmpTranColor := clNone;
8380 for I := 0 to Items.Count-1 do
8383 if Bt.HasPicture then
8385 if FBmpTranColor = clNone then
8387 Bmp.Assign( Bt.picture );
8388 FBmpTranColor := Bmp.Canvas.Pixels[ 0, Bmp.Height - 1 ];
8396 Bmp.PixelFormat := pf24bit;
8398 if FBmpTranColor <> clNone then
8400 Bmp.Canvas.Brush.Color := FBmpTranColor;
8401 Bmp.Canvas.FillRect( Rect( 0, 0, Bmp.Width, Bmp.Height ) );
8404 for I := 0 to Items.Count-1 do
8407 if Bt.HasPicture then
8409 Bmp.Canvas.Draw( N * W, 0, Bt.picture.Graphic );
8413 GenerateBitmapResource( Bmp, RsrcName, RsrcFile, fUpdated );
8420 DefaultHeight := Height;
8421 DefaultWidth := Width;
8425 if Align in [ caTop, caBottom, caNone ] then
8427 DefaultHeight := 22;
8428 DefaultWidth := Width;
8431 if Align in [ caLeft, caRight ] then
8433 DefaultHeight := Height;
8438 DefaultHeight := Height;
8439 DefaultWidth := Width;
8443 FResBmpID := ResBmpID;
8444 if Assigned( bitmap ) and (bitmap.Width * bitmap.Height > 0) then
8446 W := MaxBtnImgWidth;
8447 H := MaxBtnImgHeight;
8448 if (W <> H) or (StandardImagesUsed > 0) then
8450 SL.Add( ' ' + Prefix + AName + '.TBBtnImgWidth := ' + IntToStr( W ) + ';' );
8451 S := ' ' + Prefix + AName + '.TBAddBitmap( ';
8452 if mapBitmapColors then
8453 S := S + 'LoadMappedBitmapEx( ' + AName + ', hInstance, ''' + RsrcName + ''', [ ' +
8454 Color2Str( FBmpTranColor ) + ', Color2RGB( clBtnFace ) ] ) );'
8456 S := S + 'LoadBmp( hInstance, ''' + RsrcName + ''', ' +
8461 if TBButtonsWidth > 0 then
8462 SL.Add( ' ' + Prefix + AName + '.Perform( TB_SETBUTTONSIZE, ' +
8463 Int2Str( TBButtonsWidth ) + ', 0 );' );
8464 if ((StandardImagesUsed > 0) and (PicturedButtonsCount > 0)) or
8465 not IntIn(StandardImagesUsed, [ 1, 2, 4 ]) then
8467 if LongBool( StandardImagesUsed and 1 ) then
8469 if StandardImagesLarge then
8473 SL.Add( ' ' + Prefix + AName + '.TBAddBitmap( THandle( ' + S + ' ) );' );
8475 if LongBool( StandardImagesUsed and 2 ) then
8477 if StandardImagesLarge then
8481 SL.Add( ' ' + Prefix + AName + '.TBAddBitmap( THandle( ' + S + ' ) );' );
8483 if LongBool( StandardImagesUsed and 4 ) then
8485 if StandardImagesLarge then
8489 SL.Add( ' ' + Prefix + AName + '.TBAddBitmap( THandle( ' + S + ' ) );' );
8493 if showTooltips or (tooltips.Count > 0) then
8497 for I := 0 to Items.Count-1 do
8500 //if Bt.Faction <> nil then continue; // remove by YS 7-Aug-2004
8501 //if Bt.separator then continue;
8503 //---------{ Maxim Pushkar }----------------------------------------------
8504 //if (tooltips.Count > 0) and (J > tooltips.Count) then break;
8505 //----------------------------------------------------------------------//
8506 if (tooltips.Count > 0) and (J >= tooltips.Count) then break; //
8507 //--------------------------------------------------------------------//
8509 if Bt.Tooltip <> '' then
8512 if (tooltips.Count > 0) and (tooltips[ J ] <> '') and not Bt.separator then
8515 if showTooltips then
8519 if Bt.Faction = nil then // {YS} äîáàâèòü
8520 begin // {YS} äîáàâèòü
8521 if not Bt.separator then // {YS} äîáàâèòü
8525 S := S + PCharStringConstant( Self, Bt.Name + '_tip', B );
8536 end // {YS} äîáàâèòü
8537 else // {YS} äîáàâèòü
8540 // change by Alexander Pravdin (to fix tooltips for case of first separator):
8541 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8543 {for i := 0 to ButtonCount - 1 do
8544 if not TKOLToolbarButton( FItems.Items[i] ).Fseparator then begin
8549 SL.Add( Prefix + ' ' + AName + '.TBSetTooltips( ' + AName +
8550 '.TBIndex2Item( ' + IntToStr( Btn1st ) + ' ), [ ' + S + ' ] );' );
8551 //--------------------------------------------------------------------------
8553 SL.Add( Prefix + ' ' + AName + '.TBSetTooltips( ' + AName +
8554 '.TBIndex2Item( 0 ), [ ' + S + ' ] );' );}
8555 ////////////////////////////////////////////////////////////////////////////
8558 // assign image list if used:
8559 if ImageListNormal <> nil then
8561 SL.Add( Prefix + ' ' + AName + '.Perform( TB_SETIMAGELIST, 0, Result.' +
8562 ImageListNormal.Name + '.Handle );' );
8564 if ImageListDisabled <> nil then
8566 SL.Add( Prefix + ' ' + AName + '.Perform( TB_SETDISABLEDIMAGELIST, 0, Result.' +
8567 ImageListDisabled.Name + '.Handle );' );
8569 if ImageListHot <> nil then
8571 SL.Add( Prefix + ' ' + AName + '.Perform( TB_SETHOTIMAGELIST, 0, Result.' +
8572 ImageListHot.Name + '.Handle );' );
8576 for I := 0 to Items.Count-1 do
8580 //if Bt.separator then Continue;
8581 if Bt.fOnClickMethodName <> '' then
8584 for J := I to Items.Count - 1 do
8587 //if Bt.separator then Continue;
8588 if Bt.separator or (Bt.fOnClickMethodName = '') then
8591 for K := J to Items.Count-1 do
8594 if Bt1.separator then Continue;
8595 if Bt1.fOnClickMethodName <> '' then
8601 if N = 0 then break;
8603 if S <> '' then S := S + ', ';
8604 if Bt.fOnClickMethodName <> '' then
8605 S := S + 'Result.' + Bt.fOnClickMethodName
8609 SL.Add( ' ' + Prefix + AName + '.TBAssignEvents( ' + IntToStr( I0 ) +
8610 ', [ ' + S + ' ] );' );
8614 if Assigned( FpopupMenu ) then
8615 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
8617 if TBButtonsMinWidth > 0 then
8618 SL.Add( Prefix + AName + '.TBButtonsMinWidth := ' + IntToStr( TBButtonsMinWidth ) + ';' );
8619 if TBButtonsMaxWidth > 0 then
8620 SL.Add( Prefix + AName + '.TBButtonsMaxWidth := ' + IntToStr( TBButtonsMaxWidth ) + ';' );
8621 for I := Items.Count-1 downto 0 do
8624 if not Bt.visible and (Bt.Faction = nil) then
8625 SL.Add( Prefix + AName + '.TBButtonVisible[ ' + IntToStr( I ) + ' ] := FALSE;' );
8626 {if Bt.Checked and (Bt.Faction = nil) then
8627 SL.Add( Prefix + AName + '.TBButtonChecked[ ' + IntToStr( I ) + ' ] := TRUE;' );}
8628 if not Bt.enabled and (Bt.Faction = nil) then
8629 SL.Add( Prefix + AName + '.TBButtonEnabled[ ' + IntToStr( I ) + ' ] := FALSE;' );
8633 if (tboFlat in Options) and (Parent <> nil) and not(Parent is TForm) then
8635 if Align in [ caLeft, caRight ] then
8637 SL.Add( Prefix + ' ' + AName + '.Style := ' + AName +
8638 '.Style or TBSTYLE_WRAPABLE;' );
8642 SL.Add( Prefix + 'if WinVer >= wvXP then' );
8643 SL.Add( Prefix + 'begin' );
8644 SL.Add( Prefix + ' ' + AName + '.Style := ' + AName +
8645 '.Style or TBSTYLE_WRAPABLE;' );
8646 SL.Add( Prefix + ' ' + AName + '.Transparent := TRUE;' );
8647 SL.Add( Prefix + 'end;' );
8652 function TKOLToolbar.SetupParams(const AName, AParent: String): String;
8656 Bt, Bt1: TKOLToolbarButton;
8657 StdImagesStart, ViewImagesStart, HistImagesStart: Integer;
8658 TheSameBefore, TheSameAfter: Boolean;
8662 DB '#$signature$#', 0
8663 DB 'TKOLToolbar.SetupParams', 0
8666 // 1. Options parameter
8668 if (tboTextRight in Options) or
8669 FixFlatXP and {(Align in [caLeft, caRight]) and} (tboFlat in Options) then
8670 S := 'tboTextRight';
8671 if (tboTextBottom in Options) and (S = '') then
8672 S := S + ', tboTextBottom';
8673 if tboFlat in Options then
8674 S := S + ', tboFlat';
8675 if tboTransparent in Options then
8676 S := S + ', tboTransparent';
8677 if (tboWrapable in Options) and not( FixFlatXP and (Align in [caLeft, caRight]) and
8678 (tboFlat in Options) )
8680 ( (tboFlat in Options) and not (Align in [caLeft, caRight] ) and FixFlatXP )} then
8681 S := S + ', tboWrapable';
8682 if tboNoDivider in Options then
8683 S := S + ', tboNoDivider';
8684 if tbo3DBorder in Options then
8685 S := S + ', tbo3DBorder';
8687 if S[ 1 ] = ',' then
8688 S := Trim( Copy( S, 2, MaxInt ) );
8690 // 2. Align parameter
8692 caLeft: A := 'caLeft';
8693 caRight:A := 'caRight';
8694 caClient: A := 'caClient';
8695 caTop: A := 'caTop';
8696 caBottom: A := 'caBottom';
8699 Result := AParent + ', ' + A + ', [' + S + '], ';
8701 // 3. Bitmap from a resource
8702 if (Bitmap.Width > 0) and (Bitmap.Height > 0) and
8703 (FResBmpID >= 0) and (MaxBtnImgWidth = MaxBtnImgHeight) and
8704 (StandardImagesUsed=0) then
8706 if mapBitmapColors then
8707 Result := Result + 'LoadMappedBitmapEx( Result, hInstance, ''' +
8708 UpperCase( ParentKOLForm.FormName ) + '_TBBMP' + IntToStr( FResBmpID ) + ''', [ ' +
8709 Color2Str( FBmpTranColor ) + ', Color2RGB( clBtnFace ) ] ), '
8711 Result := Result + 'LoadBmp( hInstance, PChar( ''' +
8712 UpperCase( ParentKOLForm.FormName ) + '_TBBMP' + IntToStr( FResBmpID ) +
8715 else // or if standard images are used, type of images here
8716 if (PicturedButtonsCount = 0) and (IntIn( StandardImagesUsed, [ 1, 2, 4 ] )) then
8718 if StandardImagesUsed = 1 then
8719 if StandardImagesLarge then
8720 Result := Result + 'THandle( -2 ), '
8722 Result := Result + 'THandle( -1 ), '
8724 if StandardImagesUsed = 2 then
8725 if StandardImagesLarge then
8726 Result := Result + 'THandle( -6 ), '
8728 Result := Result + 'THandle( -5 ), '
8730 if StandardImagesLarge then
8731 Result := Result + 'THandle( -10 ), '
8733 Result := Result + 'THandle( -9 ), ';
8736 begin // or if Bitmap is empty, value 0
8737 if not ((Bitmap.Width > 0) and (Bitmap.Height > 0) and
8738 (FResBmpID >= 0)) then
8740 Result := Result + '0, ';
8743 // 4. Button captions
8744 Result := Result + '[ ';
8746 for I := 0 to Items.Count-1 do
8749 if Bt.separator then
8750 Result := Result + '''-'''
8753 if noTextLabels then
8758 if Bt.radioGroup <> 0 then
8760 TheSameBefore := FALSE;
8761 TheSameAfter := FALSE;
8764 Bt1 := Items[ I - 1 ];
8765 if not Bt1.separator and (Bt1.FradioGroup = Bt.FradioGroup) then
8766 TheSameBefore := TRUE;
8768 if I < Items.Count-1 then
8770 Bt1 := Items[ I + 1 ];
8771 if not Bt1.separator and (Bt1.FradioGroup = Bt.FradioGroup) then
8772 TheSameAfter := TRUE;
8774 if TheSameBefore or TheSameAfter then
8777 if Bt.checked and (Bt.Faction = nil) then
8780 if Bt.radioGroup <> 0 then
8784 if noTextLabels then
8785 Result := Result + '''' + S + B + ''''
8787 if Bt.Faction <> nil then
8788 Result := Result + '''' + S + ' '''
8791 B := StringConstant( Bt.Name + '_btn', B );
8792 if (B <> '') and (B[ 1 ] = '''') then
8793 Result := Result + '''' + S + Copy( B, 2, MaxInt )
8796 Result := Result + 'PChar( ''' + S + ''' + ' + B + ')'
8798 Result := Result + 'PChar( ' + B + ' )';
8801 if I < Items.Count-1 then
8802 Result := Result + ', ';
8804 Result := Result + ' ], ';
8806 // 5. Button image indexes used
8807 //Rpt( '$$$$$$$$$$$$$$$ PicturedButtonsCount := ' + IntToStr( PicturedButtonsCount ) );
8808 if (StandardImagesUsed = 0) and (PicturedButtonsCount = 0) and not ImageListsUsed then
8809 Result := Result + '[ -2 ]' else
8810 if (StandardImagesUsed = 0) and AllPicturedButtonsAreLeading and
8811 LastBtnHasPicture and not ImageListsUsed then
8812 Result := Result + '[ 0 ]' else
8814 N := PicturedButtonsCount;
8815 Result := Result + '[ ';
8816 StdImagesStart := N;
8817 ViewImagesStart := N;
8818 HistImagesStart := N;
8819 if (StandardImagesUsed > 1) and LongBool(StandardImagesUsed and 1) then
8821 ViewImagesStart := N + 15;
8822 HistImagesStart := N + 15;
8824 if LongBool(StandardImagesUsed and 2) then
8825 HistImagesStart := HistImagesStart + 12;
8828 for I := 0 to Items.Count-1 do
8831 //Rpt( '%%%%%%%%%% Bt ' + Bt.Name + ' HasPicture := ' + IntToStr( Integer( Bt.HasPicture ) ) );
8832 if ImageListsUsed then
8834 if Bt.imgIndex >= 0 then
8835 S := IntToStr( Bt.imgIndex )
8840 if Bt.HasPicture then
8848 S := '-2'; // I_IMAGENONE
8850 S := IntToStr( StdImagesStart + Ord( Bt.sysimg ) - Ord( stdCUT ) );
8851 viewLARGEICONS..viewVIEWMENU:
8852 S := IntToStr( ViewImagesStart + Ord( Bt.sysimg ) - Ord( viewLARGEICONS ) );
8854 S := IntToStr( HistImagesStart + Ord( Bt.sysimg ) - Ord( histBACK ) );
8856 Result := Result + S + ', ';
8858 if Items.Count > 0 then
8859 Result := Copy( Result, 1, Length( Result ) - 2 ) + ' ]'
8861 Result := Result + ']';
8865 var LastToolbarWarningtime: Integer;
8866 procedure ToolbarBetterToPlaceOverPanelWarning;
8870 DB '#$signature$#', 0
8871 DB 'ToolbarBetterToPlaceOverPanelWarning', 0
8874 if Abs( Integer( GetTickCount ) - LastToolbarWarningtime ) > 60000 then
8876 LastToolbarWarningtime := GetTickCount;
8877 {ShowMessage( 'It is better to place toolbar on a panel aligning it caClient.'#13 +
8878 'This can improve performance of the application, especially in ' +
8879 'Windows 9x/Me.' );}
8883 function TKOLToolbar.StandardImagesUsed: Integer;
8885 Bt: TKOLToolbarButton;
8888 for I := 0 to Items.Count-1 do
8891 if Bt.sysimg <> stiCustom then
8893 if Bt.sysimg in [ stdCUT..stdPRINT ] then
8894 Result := Result or 1
8896 if Bt.sysimg in [ viewLARGEICONS..viewVIEWMENU ] then
8897 Result := Result or 2
8899 Result := Result or 4;
8900 if Result = 7 then break;
8905 procedure TKOLToolbar.Tick(Sender: TObject);
8910 DB '#$signature$#', 0
8911 DB 'TKOLToolbar.Tick', 0
8914 if Parent <> nil then
8916 FTimer.Enabled := FALSE;
8917 if Parent = Owner then
8918 ToolbarBetterToPlaceOverPanelWarning;
8919 //ParentKOLForm.AlignChildren( nil );
8920 if Parent is TKOLCustomControl then
8921 (Parent as TKOLCustomControl).ReAlign( FALSE )
8924 KF := ParentKOLForm;
8926 KF.AlignChildren( nil, FALSE );
8933 procedure TKOLToolbar.ReadNewVersion(Reader: TReader);
8935 fNewVersion := Reader.ReadBoolean;
8938 procedure TKOLToolbar.WriteNewVersion(Writer: TWriter);
8940 Writer.WriteBoolean( fNewVersion );
8943 function TKOLToolbar.Generate_SetSize: String;
8945 Result := inherited Generate_SetSize;
8948 procedure TKOLToolbar.SetAutoHeight(const Value: Boolean);
8950 FHeightAuto := Value;
8954 procedure TKOLToolbar.CreateKOLControl(Recreating: boolean);
8956 al: kol.TControlAlign;
8959 if Recreating then begin
8960 al:=kol.TControlAlign(Align);
8961 //bmp:=bitmap.Handle;
8969 FKOLCtrl:=NewToolbar(KOLParentCtrl, al, kol.TToolbarOptions(FOptions), bmp, [nil], [-2]);
8970 FKOLCtrl.Visible:=False;
8974 ShowMessage( 'Error: ' + E.Message );
8979 procedure TKOLToolbar.KOLControlRecreated;
8982 TmpBmp, TmpBmp2: TBitmap;
8985 if ImageListsUsed then
8987 if ImageListNormal <> nil then
8988 FKOLCtrl.Perform( TB_SETIMAGELIST, 0, ImageListNormal.Handle );
8989 if ImageListDisabled <> nil then
8990 FKOLCtrl.Perform( TB_SETDISABLEDIMAGELIST, 0, ImageListDisabled.Handle );
8991 if ImageListHot <> nil then
8992 FKOLCtrl.Perform( TB_SETHOTIMAGELIST, 0, ImageListHot.Handle );
8996 if StandardImagesUsed > 0 then begin
8997 if StandardImagesLarge then
9001 FKOLCtrl.TBAddBitmap(HBITMAP(-1-N));
9002 FKOLCtrl.TBAddBitmap(HBITMAP(-5-N));
9003 FKOLCtrl.TBAddBitmap(HBITMAP(-9-N));
9005 if (Bitmap <> nil) and not Bitmap.Empty then
9007 if mapBitmapColors then
9009 TmpBmp := TBitmap.Create;
9011 TmpBmp.Canvas.Brush.Color := clBtnFace;
9012 TmpBmp.Width := Bitmap.Width;
9013 TmpBmp.Height := Bitmap.Height;
9014 {$IFDEF _D3orHigher}
9015 Bitmap.Transparent := TRUE;
9017 //Bitmap.TransparentColor := Bitmap.Canvas.Pixels[ 0, Bitmap.Height-1 ];
9018 TmpBmp.Canvas.Draw( 0, 0, Bitmap );
9019 {$IFDEF _D3orHigher}
9020 Bitmap.Transparent := FALSE;
9022 FBmpDesign := //CopyImage( TmpBmp.Handle, IMAGE_BITMAP, 0, 0, 0 {LR_CREATEDIBSECTION} );
9023 TmpBmp.ReleaseHandle;
9030 FBmpDesign := CopyImage( Bitmap.Handle, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION );
9033 if mapBitmapColors then
9035 TmpBmp := TBitmap.Create;
9036 TmpBmp2 := TBitmap.Create;
9038 TmpBmp.Handle := FBmpDesign;
9039 TmpBmp2.Canvas.Brush.Color := clBtnFace;
9040 TmpBmp2.Width := TmpBmp.Width;
9041 TmpBmp2.Height := TmpBmp.Height;
9042 {$IFDEF _D3orHigher}
9043 TmpBmp.Transparent := TRUE;
9045 TmpBmp2.Canvas.Draw( 0, 0, TmpBmp );
9046 FBmpDesign := TmpBmp2.ReleaseHandle;
9052 FKOLCtrl.TBAddBitmap( FBmpDesign );
9059 function TKOLToolbar.NoDrawFrame: Boolean;
9064 procedure TKOLToolbar.UpdateButtons;
9066 procedure GenerateButtons{(var Captions: array of string; var PCaptions: array of PChar; var ImgIndices: array of integer)};
9068 i, N, StdImagesStart, ViewImagesStart, HistImagesStart: integer;
9071 Bt: TKOLToolbarButton;
9073 if FItems.Count = 0 then exit;
9074 {if PicturedButtonsCount > 0 then
9078 StdImagesStart := 0;
9079 ViewImagesStart := 15;
9080 HistImagesStart := 15 + 12;
9082 if StandardImagesUsed > 0 then
9084 for i:=0 to FItems.Count - 1 do
9085 with TKOLToolbarButton(FItems[i]) do begin
9086 if noTextLabels then
9093 if radioGroup <> 0 then
9098 PCaptions[i]:=PChar(Captions[i]);}
9100 if ImageListsUsed then
9103 if ii < 0 then ii := -2;
9106 if HasPicture then begin
9107 ii {ImgIndices[i]} := N + i;
9112 ii {ImgIndices[i]} := -2; // I_IMAGENONE
9114 ii {ImgIndices[i]} := StdImagesStart + Ord( sysimg ) - Ord( stdCUT );
9115 viewLARGEICONS..viewVIEWMENU:
9116 ii {ImgIndices[i]} := ViewImagesStart + Ord( sysimg ) - Ord( viewLARGEICONS );
9118 ii {ImgIndices[i]} := HistImagesStart + Ord( sysimg ) - Ord( histBACK );
9120 FKOLCtrl.TBAddButtons( [ PChar( S ) ], [ ii ] );
9125 {capts: array of string;
9126 pcapts: array of PChar;
9127 imgs: array of integer;}
9131 if not Assigned(FKOLCtrl) then exit;
9132 while FKOLCtrl.TBButtonCount > 0 do
9133 FKOLCtrl.TBDeleteButton(0);
9135 if FItems.Count > 0 then begin
9136 {SetLength(capts, FItems.Count);
9137 SetLength(pcapts, FItems.Count);
9138 SetLength(imgs, FItems.Count);}
9139 GenerateButtons{(capts, pcapts, imgs)};
9140 //FKOLCtrl.TBAddButtons(pcapts, imgs);
9141 for i:=0 to FItems.Count - 1 do
9142 with TKOLToolbarButton(FItems[i]) do begin
9144 FKOLCtrl.TBButtonEnabled[i]:=False;
9149 procedure TKOLToolbar.SetMargin(const Value: Integer);
9152 if Assigned(FKOLCtrl) then
9153 FKOLCtrl.Perform( TB_SETINDENT, Border, 0 );
9156 procedure TKOLToolbar.CMDesignHitTest(var Message: TCMDesignHitTest);
9161 if Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames]) then begin
9163 pt:=SmallPointToPoint(Message.Pos);
9164 res:=FKOLCtrl.Perform(WM_USER + 69 {TB_HITTEST}, 0, integer(@pt));
9165 if Abs(res) <= FKOLCtrl.TBButtonCount then
9172 procedure TKOLToolbar.WMLButtonDown(var Message: TWMLButtonDown);
9180 if Assigned(FKOLCtrl) then begin
9181 pt:=SmallPointToPoint(Message.Pos);
9182 res:=FKOLCtrl.Perform(WM_USER + 69 {TB_HITTEST}, 0, integer(@pt));
9185 if res < FItems.Count then begin
9186 F := Owner as TForm;
9187 if F <> nil then begin
9188 //*///////////////////////////////////////////////////////
9189 {$IFDEF _D6orHigher} //
9190 F.Designer.QueryInterface(IFormDesigner,D); //
9192 //*///////////////////////////////////////////////////////
9194 //*///////////////////////////////////////////////////////
9196 //*///////////////////////////////////////////////////////
9197 if (D <> nil) and QueryFormDesigner( D, FD ) then begin
9198 FD.SelectComponent( FItems[res] );
9207 procedure TKOLToolbar.WMMouseMove(var Message: TWMMouseMove);
9211 procedure TKOLToolbar.WMLButtonDblClk(var Message: TWMLButtonDblClk);
9215 procedure TKOLToolbar.Paint;
9221 if Assigned(FKOLCtrl) and (PaintType in [ptWYSIWIG, ptWYSIWIGFrames]) then
9222 with Canvas do begin
9223 Brush.Style:=bsClear;
9224 Pen.Color:=clBtnShadow;
9226 for i:=0 to FItems.Count - 1 do
9227 with TKOLToolbarButton(FItems[i]) do begin
9228 if checked or (not separator and not (tboFlat in Options)) then continue;
9229 FKOLCtrl.Perform( TB_GETITEMRECT, i, Integer( @R ) );
9231 Windows.Rectangle( Handle, R.Left, R.Top, R.Right, R.Bottom )
9233 DrawEdge(Handle, R, BDR_RAISEDINNER, BF_RECT);
9236 Brush.Style:=bsSolid;
9240 function TKOLToolbar.GetDefaultControlFont: HFONT;
9242 Result:=GetStockObject(DEFAULT_GUI_FONT);
9245 procedure TKOLToolbar.SetimageList(const Value: TKOLImageList);
9246 procedure RemoveOldImageList;
9248 if FImageListNormal <> nil then
9249 FImageListNormal.NotifyLinkedComponent( Self, noRemoved );
9250 FImageListNormal := nil;
9254 Bt: TKOLToolbarButton;
9256 if (Value <> nil) and (Value is TKOLImageList) then
9258 if ImagedButtonsCount > 0 then
9260 I := MessageBox( Application.Handle, 'Some buttons have pictures assigned.'#13#10 +
9261 'All pictures will be removed. Continue assigning image list to a toolbar?',
9262 PChar( Application.Title + ' : ' + Name ), MB_OKCANCEL );
9263 if I <> ID_OK then Exit;
9264 for I := 0 to Items.Count-1 do
9267 if Bt.HasPicture then
9270 if Bt.sysimg <> stiCustom then
9271 Bt.sysimg := stiCustom;
9272 if Bt.Fseparator then
9277 Value.AddToNotifyList( Self );
9281 FImageListNormal := Value;
9282 if Value <> nil then
9283 if FKOLCtrl <> nil then
9285 //ShowMessage( 'ImageListNormal.Handle=' + Int2Str( Value.Handle ) );
9286 FKOLCtrl.Perform( TB_SETIMAGELIST, 0, FImageListNormal.Handle );
9292 procedure TKOLToolbar.NotifyLinkedComponent(Sender: TObject;
9293 Operation: TNotifyOperation);
9297 DB '#$signature$#', 0
9298 DB 'TKOLBitBtn.NotifyLinkedComponent', 0
9302 if Operation = noRemoved then
9304 if Sender = ImageListNormal then
9305 ImageListNormal := nil
9307 if Sender = ImageListDisabled then
9308 ImageListDisabled := nil
9310 if Sender = ImageListHot then
9313 ShowMessage( 'Could not remove a reference to image list !' );
9317 function TKOLToolbar.ImagedButtonsCount: Integer;
9319 Bt: TKOLToolbarButton;
9322 for I := 0 to Items.Count-1 do
9325 if Bt.HasPicture or (Bt.sysimg <> stiCustom) then
9330 function TKOLToolbar.MaxImgIndex: Integer;
9332 Bt: TKOLToolbarButton;
9335 for I := 0 to Items.Count-1 do
9338 if Bt.FimgIndex >= Result then
9339 Result := Bt.FimgIndex + 1;
9343 procedure TKOLToolbar.SetDisabledimageList(const Value: TKOLImageList);
9344 procedure RemoveOldImageList;
9346 if FimageListDisabled <> nil then
9347 FimageListDisabled.NotifyLinkedComponent( Self, noRemoved );
9348 FimageListDisabled := nil;
9352 Bt: TKOLToolbarButton;
9354 if (Value <> nil) and (Value is TKOLImageList) then
9356 if ImagedButtonsCount > 0 then
9358 I := MessageBox( Application.Handle, 'Some buttons have pictures assigned.'#13#10 +
9359 'All pictures will be removed. Continue assigning image list to a toolbar?',
9360 PChar( Application.Title + ' : ' + Name ), MB_OKCANCEL );
9361 if I <> ID_OK then Exit;
9362 for I := 0 to Items.Count-1 do
9365 if Bt.HasPicture then
9368 if Bt.sysimg <> stiCustom then
9369 Bt.sysimg := stiCustom;
9370 if Bt.Fseparator then
9375 Value.AddToNotifyList( Self );
9379 FimageListDisabled := Value;
9380 if Value <> nil then
9381 if FKOLCtrl <> nil then
9383 FKOLCtrl.Perform( TB_SETDISABLEDIMAGELIST, 0, FimageListDisabled.Handle );
9389 procedure TKOLToolbar.SetHotimageList(const Value: TKOLImageList);
9390 procedure RemoveOldImageList;
9392 if FImageListHot <> nil then
9393 FImageListHot.NotifyLinkedComponent( Self, noRemoved );
9394 FImageListHot := nil;
9398 Bt: TKOLToolbarButton;
9400 if (Value <> nil) and (Value is TKOLImageList) then
9402 if ImagedButtonsCount > 0 then
9404 I := MessageBox( Application.Handle, 'Some buttons have pictures assigned.'#13#10 +
9405 'All pictures will be removed. Continue assigning image list to a toolbar?',
9406 PChar( Application.Title + ' : ' + Name ), MB_OKCANCEL );
9407 if I <> ID_OK then Exit;
9408 for I := 0 to Items.Count-1 do
9411 if Bt.HasPicture then
9414 if Bt.sysimg <> stiCustom then
9415 Bt.sysimg := stiCustom;
9416 if Bt.Fseparator then
9421 Value.AddToNotifyList( Self );
9425 FImageListHot := Value;
9426 if Value <> nil then
9427 if FKOLCtrl <> nil then
9429 FKOLCtrl.Perform( TB_SETHOTIMAGELIST, 0, FimageListHot.Handle );
9435 function TKOLToolbar.ImageListsUsed: Boolean;
9437 Result := (ImageListNormal <> nil) or (ImageListDisabled <> nil) or
9438 (ImageListHot <> nil);
9441 procedure TKOLToolbar.SetFixFlatXP(const Value: Boolean);
9443 FFixFlatXP := Value;
9447 procedure TKOLToolbar.SetTBButtonsWidth(const Value: Integer);
9449 FTBButtonsWidth := Value;
9453 procedure TKOLToolbar.SetgenerateVariables(const Value: Boolean);
9455 FgenerateVariables := Value;
9457 FgenerateConstants := FALSE;
9461 procedure TKOLToolbar.SetupLast(SL: TStringList; const AName, AParent,
9464 Bt: TKOLToolbarButton;
9468 if generateVariables then
9471 for I := 0 to Items.Count-1 do
9474 if Bt.separator and (Copy( Bt.Name, 1, 2 ) = 'TB') and
9475 IsNumber( Copy( Bt.Name, 3, MaxInt ) ) then
9477 if Bt.Name <> '' then
9479 S := S + ',' + Bt.Name;
9485 SL.Add( Prefix + AName + '.TBConvertIdxArray2ID( [' + S + '] );' );
9490 { TKOLToolbarButtonsEditor }
9492 procedure TKOLToolbarButtonsEditor.Edit;
9493 var Tb: TKOLToolbar;
9497 DB '#$signature$#', 0
9498 DB 'TKOLToolbarButtonsEditor.Edit', 0
9501 if GetComponent( 0 ) = nil then Exit;
9502 Tb := GetComponent( 0 ) as TKOLToolbar;
9503 if Tb.ActiveDesign = nil then
9504 Tb.ActiveDesign := TfmToolbarEditor.Create( Application );
9505 Tb.ActiveDesign.ToolbarControl := Tb;
9506 Tb.ActiveDesign.Visible := TRUE;
9507 SetForegroundWindow( Tb.ActiveDesign.Handle );
9508 Tb.ActiveDesign.MakeActive( TRUE );
9509 if Tb.ParentForm <> nil then
9510 Tb.ParentForm.Invalidate;
9513 function TKOLToolbarButtonsEditor.GetAttributes: TPropertyAttributes;
9517 DB '#$signature$#', 0
9518 DB 'TKOLToolbarButtonsEditor.GetAttributes', 0
9521 Result := [ paDialog, paReadOnly ];
9524 { TKOLToolbarEditor }
9526 procedure TKOLToolbarEditor.Edit;
9527 var Tb: TKOLToolbar;
9531 DB '#$signature$#', 0
9532 DB 'TKOLToolbarEditor.Edit', 0
9535 if Component = nil then Exit;
9536 Tb := Component as TKOLToolbar;
9537 if Tb.ActiveDesign = nil then
9538 Tb.ActiveDesign := TfmToolbarEditor.Create( Application );
9539 Tb.ActiveDesign.ToolbarControl := Tb;
9540 Tb.ActiveDesign.Visible := TRUE;
9541 SetForegroundWindow( Tb.ActiveDesign.Handle );
9542 Tb.ActiveDesign.MakeActive( TRUE );
9543 if Tb.ParentForm <> nil then
9544 Tb.ParentForm.Invalidate;
9547 procedure TKOLToolbarEditor.ExecuteVerb(Index: Integer);
9551 DB '#$signature$#', 0
9552 DB 'TKOLToolbarEditor.ExecuteVerb', 0
9558 function TKOLToolbarEditor.GetVerb(Index: Integer): string;
9562 DB '#$signature$#', 0
9563 DB 'TKOLToolbarEditor.GetVerb', 0
9569 function TKOLToolbarEditor.GetVerbCount: Integer;
9573 DB '#$signature$#', 0
9574 DB 'TKOLToolbarEditor.GetVerbCount', 0
9580 { TKOLTabControlEditor }
9582 procedure TKOLTabControlEditor.Edit;
9585 TabControl: TKOLTabControl;
9591 DB '#$signature$#', 0
9592 DB 'TKOLTabControlEditor.Edit', 0
9597 if C = nil then Exit;
9598 if not( C is TKOLTabControl ) then Exit;
9599 TabControl := C as TKOLTabControl;
9600 P := TabControl.ScreenToClient( P );
9601 for I := 0 to TabControl.Count-1 do
9603 R := TabControl.FTabs[ I ];
9604 if PtInRect( R^, P ) then
9606 TabControl.CurIndex := I;
9612 procedure TKOLTabControlEditor.ExecuteVerb(Index: Integer);
9616 DB '#$signature$#', 0
9617 DB 'TKOLTabControlEditor.ExecuteVerb', 0
9623 function TKOLTabControlEditor.GetVerb(Index: Integer): string;
9627 DB '#$signature$#', 0
9628 DB 'TKOLTabControlEditor.GetVerb', 0
9634 function TKOLTabControlEditor.GetVerbCount: Integer;
9638 DB '#$signature$#', 0
9639 DB 'TKOLTabControlEditor.GetVerbCount', 0
9647 constructor TKOLImageShow.Create(AOwner: TComponent);
9651 DB '#$signature$#', 0
9652 DB 'TKOLImageShow.Create', 0
9656 FHasBorder := FALSE;
9657 FDefHasBorder := FALSE;
9660 destructor TKOLImageShow.Destroy;
9662 if ImageListNormal <> nil then
9663 ImageListNormal.NotifyLinkedComponent( Self, noRemoved );
9667 procedure TKOLImageShow.DoAutoSize;
9672 DB '#$signature$#', 0
9673 DB 'TKOLImageShow.DoAutoSize', 0
9676 if not fImgShwAutoSize then Exit;
9677 if FImageListNormal = nil then Exit;
9683 Width := FImageListNormal.ImgWidth + Delta;
9684 Height := FImageListNormal.ImgHeight + Delta;
9685 //FAutoSize := TRUE;
9686 fImgShwAutoSize := TRUE;
9690 function TKOLImageShow.NoDrawFrame: Boolean;
9692 Result := HasBorder;
9695 procedure TKOLImageShow.NotifyLinkedComponent(Sender: TObject;
9696 Operation: TNotifyOperation);
9700 DB '#$signature$#', 0
9701 DB 'TKOLImageShow.NotifyLinkedComponent', 0
9705 if Operation = noRemoved then
9706 ImageListNormal := nil;
9709 procedure TKOLImageShow.Paint;
9719 DB '#$signature$#', 0
9720 DB 'TKOLImageShow.Paint', 0
9731 EdgeFlag:=EDGE_RAISED;
9742 DrawEdge(Canvas.Handle,R,EdgeFlag,BF_RECT or BF_MIDDLE );
9745 R.Right:=Width-Integer( Delta )+1;
9746 R.Bottom:=Height-Integer( Delta )+1;
9747 Canvas.Brush.Color :=clInactiveBorder;
9748 Canvas.FrameRect(R);
9752 R.Bottom:=R.Bottom-1;
9753 Canvas.Brush.Color := Color;
9754 Canvas.FillRect( R );
9757 if ImageListNormal<>nil then
9759 TMP:=TBitMap.Create;
9760 TMP.Width:=ImageListNormal.ImgWidth;
9761 TMP.Height:=ImageListNormal.ImgHeight;
9763 TMP.Canvas.CopyRect(Rect(0,0,ImageListNormal.ImgWidth,ImageListNormal.ImgHeight),ImageListNormal.Bitmap.Canvas,Rect(ImageListNormal.ImgWidth*(CurIndex),0,ImageListNormal.ImgWidth*(CurIndex+1),ImageListNormal.ImgHeight));
9765 TMP.Transparent:=True;
9766 TMP.TransparentColor:=ImageListNormal.TransparentColor;
9768 Canvas.Draw(Delta,Delta,TMP);
9775 procedure TKOLImageShow.SetBounds(aLeft, aTop, aWidth, aHeight: Integer);
9779 DB '#$signature$#', 0
9780 DB 'TKOLImageShow.SetBounds', 0
9783 if (aWidth <> Width) or (aHeight <> Height) then
9789 procedure TKOLImageShow.SetCurIndex(const Value: Integer);
9793 DB '#$signature$#', 0
9794 DB 'TKOLImageShow.SetCurIndex', 0
9802 procedure TKOLImageShow.SetHasBorder(const Value: Boolean);
9803 var WasAuto: Boolean;
9807 DB '#$signature$#', 0
9808 DB 'TKOLImageShow.SetHasBorder', 0
9811 WasAuto := AutoSize;
9813 AutoSize := WasAuto;
9814 if AutoSize then DoAutoSize;
9818 procedure TKOLImageShow.SetImageListNormal(const Value: TKOLImageList);
9822 DB '#$signature$#', 0
9823 DB 'TKOLImageShow.SetImageListNormal', 0
9826 if FImageListNormal <> nil then
9827 FImageListNormal.NotifyLinkedComponent( Self, noRemoved );
9828 FImageListNormal := Value;
9829 if Value <> nil then
9831 Value.AddToNotifyList( Self );
9832 if Value.ImgWidth * Value.ImgHeight > 0 then
9843 procedure TKOLImageShow.SetImgShwAutoSize(const Value: Boolean);
9847 DB '#$signature$#', 0
9848 DB 'TKOLImageShow.SetImgShwAutoSize', 0
9851 fImgShwAutoSize := Value;
9857 procedure TKOLImageShow.SetpopupMenu(const Value: TKOLPopupMenu);
9861 DB '#$signature$#', 0
9862 DB 'TKOLImageShow.SetpopupMenu', 0
9865 FpopupMenu := Value;
9869 procedure TKOLImageShow.SetupFirst(SL: TStringList; const AName, AParent,
9874 DB '#$signature$#', 0
9875 DB 'TKOLImageShow.SetupFirst', 0
9879 if CurIndex <> 0 then
9880 SL.Add( Prefix + AName + '.CurIndex := ' + IntToStr( CurIndex ) + ';' );
9881 if Assigned( FpopupMenu ) then
9882 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
9886 function TKOLImageShow.SetupParams(const AName, AParent: String): String;
9890 DB '#$signature$#', 0
9891 DB 'TKOLImageShow.SetupParams', 0
9894 Result := AParent + ', ';
9895 if ImageListNormal <> nil then
9897 if ImageListNormal.ParentFORM.Name = ParentForm.Name then
9898 Result := Result + 'Result.' + ImageListNormal.Name
9899 else Result := Result + ImageListNormal.ParentFORM.Name +'.'+ ImageListNormal.Name;
9902 Result := Result + 'nil';
9903 Result := Result + ', ' + IntToStr( CurIndex );
9906 function TKOLImageShow.WYSIWIGPaintImplemented: Boolean;
9913 function TKOLLabelEffect.AdjustVerticalAlign(
9914 Value: TVerticalAlign): TVerticalAlign;
9918 DB '#$signature$#', 0
9919 DB 'TKOLLabelEffect.AdjustVerticalAlign', 0
9925 function TKOLLabelEffect.AutoHeight(Canvas: TCanvas): Integer;
9929 DB '#$signature$#', 0
9930 DB 'TKOLLabelEffect.AutoHeight', 0
9933 Result := inherited AutoHeight(Canvas);
9934 if Font.FontOrientation = 0 then Exit;
9936 Result := Trunc( Result * cos( Font.FontOrientation / 1800 * PI ) +
9937 inherited AutoWidth(Canvas) * sin( Font.FontOrientation / 1800 * PI ) );
9942 function TKOLLabelEffect.AutoWidth(Canvas: TCanvas): Integer;
9946 DB '#$signature$#', 0
9947 DB 'TKOLLabelEffect.AutoWidth', 0
9950 Result := inherited AutoWidth(Canvas);
9951 if Font.FontOrientation = 0 then Exit;
9953 Result := Trunc( Result * cos( Font.FontOrientation / 1800 * PI ) +
9954 inherited AutoHeight(Canvas) * sin( Font.FontOrientation / 1800 * PI ) );
9959 constructor TKOLLabelEffect.Create(AOwner: TComponent);
9963 DB '#$signature$#', 0
9964 DB 'TKOLLabelEffect.Create', 0
9968 //Color := clWindowText;
9973 procedure TKOLLabelEffect.Paint;
9979 PrepareCanvasFontForWYSIWIGPaint( Canvas );
9983 R.Right:=Width+ShadowDeep;
9984 R.Bottom:=Height+ShadowDeep;
9987 taRight: Flag:=Flag or DT_RIGHT;
9988 taLeft: Flag:=Flag or DT_LEFT;
9989 taCenter: Flag:=Flag or DT_CENTER;
9992 case VerticalAlign of
9993 vaTop: Flag:=Flag or DT_TOP or DT_SINGLELINE;
9994 vaBottom: Flag:=Flag or DT_BOTTOM or DT_SINGLELINE;
9995 vaCenter: Flag:=Flag or DT_VCENTER or DT_SINGLELINE;
9998 if (WordWrap) and (not AutoSize) then
9999 Flag:=Flag or DT_WORDBREAK and not DT_SINGLELINE;
10000 Canvas.Font.Color:=Color2;
10001 DrawText(Canvas.Handle,PChar(Caption),Length(Caption),R,Flag);
10007 procedure TKOLLabelEffect.SetColor2(const Value: TColor);
10011 DB '#$signature$#', 0
10012 DB 'TKOLLabelEffect.SetColor2', 0
10020 procedure TKOLLabelEffect.SetShadowDeep(const Value: Integer);
10024 DB '#$signature$#', 0
10025 DB 'TKOLLabelEffect.SetShadowDeep', 0
10028 FShadowDeep := Value;
10033 procedure TKOLLabelEffect.SetupFirst(SL: TStringList; const AName, AParent,
10038 DB '#$signature$#', 0
10039 DB 'TKOLLabelEffect.SetupFirst', 0
10043 if Color2 <> clNone then
10044 SL.Add( Prefix + AName + '.Color2 := ' + Color2Str( Color2 ) + ';' );
10046 SL.Add( Prefix + AName + '.Ctl3D := TRUE;' );
10049 function TKOLLabelEffect.SetupParams(const AName, AParent: String): String;
10053 DB '#$signature$#', 0
10054 DB 'TKOLLabelEffect.SetupParams', 0
10057 Result := AParent + ', ' + StringConstant('Caption', Caption) + ', ' +
10058 Int2Str( ShadowDeep );
10061 procedure TKOLLabelEffect.SetupTextAlign(SL: TStrings;
10062 const AName: String);
10066 DB '#$signature$#', 0
10067 DB 'TKOLLabelEffect.SetupTextAlign', 0
10070 if TextAlign <> taCenter then
10071 SL.Add( ' ' + AName + '.TextAlign := ' + TextAligns[ TextAlign ] + ';' );
10072 if VerticalAlign <> vaTop then
10073 SL.Add( ' ' + AName + '.VerticalAlign := ' + VertAligns[ VerticalAlign ] + ';' );
10078 constructor TKOLScrollBox.Create(AOwner: TComponent);
10082 DB '#$signature$#', 0
10083 DB 'TKOLScrollBox.Create', 0
10087 FEdgeStyle := esLowered;
10088 FScrollBars := ssBoth;
10089 ControlStyle := ControlStyle + [ csAcceptsControls ];
10092 function TKOLScrollBox.IsControlContainer: Boolean;
10099 DB '#$signature$#', 0
10100 DB 'TKOLScrollBox.IsControlContainer', 0
10103 Result := ControlContainer;
10104 if Result then Exit;
10105 if Owner = nil then Exit;
10106 for I := 0 to Owner.ComponentCount - 1 do
10108 C := Owner.Components[ I ];
10109 if C is TControl then
10111 K := C as TControl;
10112 if K.Parent = Self then
10121 procedure TKOLScrollBox.SetControlContainer(const Value: Boolean);
10125 DB '#$signature$#', 0
10126 DB 'TKOLScrollBox.SetControlContainer', 0
10129 FControlContainer := Value;
10133 procedure TKOLScrollBox.SetEdgeStyle(const Value: TEdgeStyle);
10137 DB '#$signature$#', 0
10138 DB 'TKOLScrollBox.SetEdgeStyle', 0
10141 FEdgeStyle := Value;
10146 procedure TKOLScrollBox.SetpopupMenu(const Value: TKOLPopupMenu);
10150 DB '#$signature$#', 0
10151 DB 'TKOLScrollBox.SetpopupMenu', 0
10154 FpopupMenu := Value;
10158 procedure TKOLScrollBox.SetScrollBars(const Value: TScrollBars);
10162 DB '#$signature$#', 0
10163 DB 'TKOLScrollBox.SetScrollBars', 0
10166 FScrollBars := Value;
10170 procedure TKOLScrollBox.SetupFirst(SL: TStringList; const AName, AParent,
10175 DB '#$signature$#', 0
10176 DB 'TKOLScrollBox.SetupFirst', 0
10180 if Assigned( FpopupMenu ) then
10181 SL.Add( Prefix + AName + '.SetAutoPopupMenu( Result.' + FpopupMenu.Name +
10185 function TKOLScrollBox.SetupParams(const AName, AParent: String): String;
10186 const EdgeStyles: array[ TEdgeStyle ] of String = ( 'esRaised', 'esLowered', 'esNone' );
10191 DB '#$signature$#', 0
10192 DB 'TKOLScrollBox.SetupParams', 0
10195 Result := AParent + ', ' + EdgeStyles[ EdgeStyle ];
10196 if not IsControlContainer then
10200 ssHorz: S := 'sbHorizontal';
10201 ssVert: S := 'sbVertical';
10202 ssBoth: S := 'sbHorizontal, sbVertical';
10204 Result := Result + ', [ ' + S + ' ]';
10208 function TKOLScrollBox.TypeName: String;
10212 DB '#$signature$#', 0
10213 DB 'TKOLScrollBox.TypeName', 0
10216 Result := inherited TypeName;
10217 if IsControlContainer then
10218 Result := 'ScrollBoxEx';
10223 var MDIWarningLastTime: Integer;
10224 procedure MDIClientMustBeAChildOfTheFormWarning;
10228 DB '#$signature$#', 0
10229 DB 'MDIClientMustBeAChildOfTheFormWarning', 0
10232 if Abs( Integer( GetTickCount ) - MDIWarningLastTime ) > 60000 then
10234 MDIWarningLastTime := GetTickCount;
10235 ShowMessage( 'TKOLMDIClient control must be a child of the form itself!'#13 +
10236 'Otherwise maximizing of MDI children will lead to access violation ' +
10237 'at run-time execution.' );
10241 procedure MsgDuplicatedMDIClient;
10245 DB '#$signature$#', 0
10246 DB 'MsgDuplicatedMDIClient', 0
10249 if Abs( Integer( GetTickCount ) - MDIWarningLastTime ) > 60000 then
10251 MDIWarningLastTime := GetTickCount;
10252 ShowMessage( 'TKOLMDIClient control must be a single on the form, ' +
10253 'but another instance of MDI client object found there.' );
10257 constructor TKOLMDIClient.Create(AOwner: TComponent);
10263 DB '#$signature$#', 0
10264 DB 'TKOLMDIClient.Create', 0
10269 if (AOwner <> nil) and (AOwner is TForm) then
10271 for I := 0 to (AOwner as TForm).ComponentCount-1 do
10273 C := (AOwner as TForm).Components[ I ];
10274 if C = Self then continue;
10275 if C is TKOLMDIClient then
10277 MsgDuplicatedMDIClient;
10282 FTimer := TTimer.Create( Self );
10283 FTimer.Interval := 200;
10284 FTimer.OnTimer := Tick;
10285 FTimer.Enabled := TRUE;
10288 destructor TKOLMDIClient.Destroy;
10292 DB '#$signature$#', 0
10293 DB 'TKOLMDIClient.Destroy', 0
10297 MDIWarningLastTime := 0;
10300 function TKOLMDIClient.SetupParams(const AName, AParent: String): String;
10302 function FindWindowMenu( MI: TKOLMenuItem ): Integer;
10307 if MI.WindowMenu then
10308 Result := MI.itemindex
10310 for I := 0 to MI.Count-1 do
10312 SMI := MI.SubItems[ I ];
10313 Result := FindWindowMenu( SMI );
10319 var I, J, WM: Integer;
10327 DB '#$signature$#', 0
10328 DB 'TKOLMDIClient.SetupParams', 0
10331 Result := AParent + ', ';
10333 for I := 0 to (Owner as TForm).ComponentCount-1 do
10335 C := (Owner as TForm).Components[ I ];
10336 if C is TKOLMainMenu then
10338 MM := C as TKOLMainMenu;
10339 for J := 0 to MM.Count-1 do
10341 MI := MM.Items[ J ];
10342 WM := FindWindowMenu( MI );
10345 S := 'Result.' + MM.Name + '.ItemHandle[ ' +
10346 IntToStr( WM ) + ' ]';
10353 Result := Result + S;
10356 procedure TKOLMDIClient.Tick(Sender: TObject);
10360 DB '#$signature$#', 0
10361 DB 'TKOLMDIClient.Tick', 0
10364 if Parent <> nil then
10366 FTimer.Enabled := FALSE;
10367 if Parent <> Owner then
10368 MDIClientMustBeAChildOfTheFormWarning
10370 ParentKOLForm.AlignChildren( nil, FALSE );
10376 { TKOLToolbarButton }
10378 procedure TKOLToolbarButton.Change;
10382 DB '#$signature$#', 0
10383 DB 'TKOLToolbarButton.Change', 0
10386 if csLoading in ComponentState then Exit;
10387 if FToolbar <> nil then begin
10388 FToolbar.UpdateButtons;
10393 constructor TKOLToolbarButton.Create(AOwner: TComponent);
10397 DB '#$signature$#', 0
10398 DB 'TKOLToolbarButton.Create', 0
10402 if AOwner <> nil then
10403 if AOwner is TKOLToolbar then
10405 FToolbar := AOwner as TKOLToolbar;
10406 FToolbar.FItems.Add( Self );
10408 Fpicture := TPicture.Create;
10414 procedure TKOLToolbarButton.DefProps(const Prefix: String; Filer: Tfiler);
10418 DB '#$signature$#', 0
10419 DB 'TKOLToolbarButton.DefProps', 0
10422 Filer.DefineProperty( Prefix + 'Name', LoadName, SaveName, TRUE );
10423 Filer.DefineProperty( Prefix + 'caption', LoadCaption, SaveCaption, TRUE );
10424 Filer.DefineProperty( Prefix + 'checked', LoadChecked, SaveChecked, TRUE );
10425 Filer.DefineProperty( Prefix + 'dropdown', LoadDropDown, SaveDropDown, TRUE );
10426 Filer.DefineProperty( Prefix + 'enabled', LoadEnabled, SaveEnabled, TRUE );
10427 Filer.DefineProperty( Prefix + 'separator', LoadSeparator, SaveSeparator, TRUE );
10428 Filer.DefineProperty( Prefix + 'tooltip', LoadTooltip, SaveTooltip, TRUE );
10429 Filer.DefineProperty( Prefix + 'visible', LoadVisible, SaveVisible, TRUE );
10430 Filer.DefineProperty( Prefix + 'onClick', LoadOnClick, SaveOnClick, TRUE );
10431 Filer.DefineProperty( Prefix + 'picture', LoadPicture, SavePicture, TRUE );
10432 Filer.DefineProperty( Prefix + 'sysimg', LoadSysImg, SaveSysImg, TRUE );
10433 Filer.DefineProperty( Prefix + 'radioGroup', LoadRadioGroup, SaveRadioGroup, radioGroup <> 0 );
10434 Filer.DefineProperty( Prefix + 'imgIndex', LoadImgIndex, SaveImgIndex, imgIndex >= 0 );
10437 destructor TKOLToolbarButton.Destroy;
10441 DB '#$signature$#', 0
10442 DB 'TKOLToolbarButton.Destroy', 0
10445 if FToolbar <> nil then
10446 FToolbar.FItems.Remove( Self );
10451 function TKOLToolbarButton.HasPicture: Boolean;
10455 DB '#$signature$#', 0
10456 DB 'TKOLToolbarButton.HasPicture', 0
10459 {if Assigned( picture ) then
10460 Rpt( '%%%%%%%% ' + Name + '.picture: Width=' + Int2Str( picture.Width ) +
10461 ' Height=' + Int2Str( picture.Height ) );}
10462 Result := Assigned( picture ) and (picture.Width * picture.Height > 0);
10465 procedure TKOLToolbarButton.LoadCaption(Reader: TReader);
10469 DB '#$signature$#', 0
10470 DB 'TKOLToolbarButton.LoadCaption', 0
10473 Fcaption := Reader.ReadString;
10476 procedure TKOLToolbarButton.LoadChecked(Reader: TReader);
10480 DB '#$signature$#', 0
10481 DB 'TKOLToolbarButton.LoadChecked', 0
10484 Fchecked := Reader.ReadBoolean;
10487 procedure TKOLToolbarButton.LoadDropDown(Reader: TReader);
10491 DB '#$signature$#', 0
10492 DB 'TKOLToolbarButton.LoadDropDown', 0
10495 Fdropdown := Reader.ReadBoolean;
10498 procedure TKOLToolbarButton.LoadEnabled(Reader: TReader);
10502 DB '#$signature$#', 0
10503 DB 'TKOLToolbarButton.LoadEnabled', 0
10506 Fenabled := Reader.ReadBoolean;
10509 procedure TKOLToolbarButton.LoadImgIndex(Reader: TReader);
10511 FimgIndex := Reader.ReadInteger;
10514 procedure TKOLToolbarButton.LoadName(Reader: TReader);
10519 DB '#$signature$#', 0
10520 DB 'TKOLToolbarButton.LoadName', 0
10523 S := Reader.ReadString;
10524 if FToolbar = nil then Exit;
10525 if FToolbar.FindComponent( S ) <> nil then Exit;
10526 if (FToolbar.Owner <> nil) and (FToolbar.Owner is TForm) then
10528 if (FToolbar.Owner as TForm).FindComponent( S ) <> nil then Exit;
10533 procedure TKOLToolbarButton.LoadOnClick(Reader: TReader);
10537 DB '#$signature$#', 0
10538 DB 'TKOLToolbarButton.LoadOnClick', 0
10541 fOnClickMethodName := Reader.ReadString;
10544 procedure TKOLToolbarButton.LoadPicture(Reader: TReader);
10551 DB '#$signature$#', 0
10552 DB 'TKOLToolbarButton.LoadPicture', 0
10555 S := Reader.ReadString;
10556 //ShowMessage( 'Read picture: <' + S + '>' );
10557 if Trim( S ) <> '' then
10559 MS := TMemoryStream.Create;
10561 MS.Write( S[ 1 ], Length( S ) );
10563 Bmp := TBitmap.Create;
10565 Bmp.LoadFromStream( MS );
10566 Fpicture.Assign( Bmp );
10574 //ShowMessage( 'Read picture - end' );
10577 procedure TKOLToolbarButton.LoadProps(Reader: TReader);
10581 DB '#$signature$#', 0
10582 DB 'TKOLToolbarButton.LoadProps', 0
10585 Fcaption := Reader.ReadString;
10586 Fchecked := Reader.ReadBoolean;
10587 Fdropdown := Reader.ReadBoolean;
10588 Fenabled := Reader.ReadBoolean;
10589 Fseparator := Reader.ReadBoolean;
10590 Ftooltip := Reader.ReadString;
10591 Fvisible := Reader.ReadBoolean;
10592 fOnClickMethodName := Reader.ReadString;
10595 procedure TKOLToolbarButton.LoadRadioGroup(Reader: TReader);
10599 DB '#$signature$#', 0
10600 DB 'TKOLToolbarButton.LoadRadioGroup', 0
10603 FradioGroup := Reader.ReadInteger;
10606 procedure TKOLToolbarButton.LoadSeparator(Reader: TReader);
10610 DB '#$signature$#', 0
10611 DB 'TKOLToolbarButton.LoadSeparator', 0
10614 Fseparator := Reader.ReadBoolean;
10617 procedure TKOLToolbarButton.LoadSysImg(Reader: TReader);
10619 Fsysimg := TSystemToolbarImage( Reader.ReadInteger );
10622 procedure TKOLToolbarButton.LoadTooltip(Reader: TReader);
10626 DB '#$signature$#', 0
10627 DB 'TKOLToolbarButton.LoadTooltip', 0
10630 Ftooltip := Reader.ReadString;
10633 procedure TKOLToolbarButton.LoadVisible(Reader: TReader);
10637 DB '#$signature$#', 0
10638 DB 'TKOLToolbarButton.LoadVisible', 0
10641 Fvisible := Reader.ReadBoolean;
10644 procedure TKOLToolbarButton.Notification(AComponent: TComponent; Operation: TOperation);
10647 if Operation = opRemove then
10648 if AComponent = Faction then begin
10649 Faction.UnLinkComponent(Self);
10654 procedure TKOLToolbarButton.SaveCaption(Writer: TWriter);
10658 DB '#$signature$#', 0
10659 DB 'TKOLToolbarButton.SaveCaption', 0
10662 Writer.WriteString( Fcaption );
10665 procedure TKOLToolbarButton.SaveChecked(Writer: TWriter);
10669 DB '#$signature$#', 0
10670 DB 'TKOLToolbarButton.SaveChecked', 0
10673 Writer.WriteBoolean( Fchecked );
10676 procedure TKOLToolbarButton.SaveDropDown(Writer: TWriter);
10680 DB '#$signature$#', 0
10681 DB 'TKOLToolbarButton.SaveDropDown', 0
10684 Writer.WriteBoolean( Fdropdown );
10687 procedure TKOLToolbarButton.SaveEnabled(Writer: TWriter);
10691 DB '#$signature$#', 0
10692 DB 'TKOLToolbarButton.SaveEnabled', 0
10695 Writer.WriteBoolean( Fenabled );
10698 procedure TKOLToolbarButton.SaveImgIndex(Writer: TWriter);
10700 Writer.WriteInteger( FimgIndex );
10703 procedure TKOLToolbarButton.SaveName(Writer: TWriter);
10707 DB '#$signature$#', 0
10708 DB 'TKOLToolbarButton.SaveName', 0
10711 Writer.WriteString( Name );
10714 procedure TKOLToolbarButton.SaveOnClick(Writer: TWriter);
10718 DB '#$signature$#', 0
10719 DB 'TKOLToolbarButton.SaveOnClick', 0
10722 Writer.WriteString( fOnClickMethodName );
10725 procedure TKOLToolbarButton.SavePicture(Writer: TWriter);
10732 DB '#$signature$#', 0
10733 DB 'TKOLToolbarButton.SavePicture', 0
10736 MS := TMemoryStream.Create;
10739 if Assigned( picture ) and (picture.Width * picture.Height > 0) then
10741 Bmp := TBitmap.Create;
10743 Bmp.Assign( picture.Graphic );
10744 Bmp.SaveToStream( MS );
10748 SetLength( S, MS.Size );
10749 Move( MS.Memory^, S[ 1 ], MS.Size );
10751 Writer.WriteString( S );
10757 procedure TKOLToolbarButton.SaveProps(Writer: TWriter);
10761 DB '#$signature$#', 0
10762 DB 'TKOLToolbarButton.SaveProps', 0
10765 Writer.WriteString( Fcaption );
10766 Writer.WriteBoolean( Fchecked );
10767 Writer.WriteBoolean( Fdropdown );
10768 Writer.WriteBoolean( Fenabled );
10769 Writer.WriteBoolean( Fseparator );
10770 Writer.WriteString( Ftooltip );
10771 Writer.WriteBoolean( Fvisible );
10772 Writer.WriteString( fOnClickMethodName );
10775 procedure TKOLToolbarButton.SaveRadioGroup(Writer: TWriter);
10779 DB '#$signature$#', 0
10780 DB 'TKOLToolbarButton.SaveRadioGroup', 0
10783 Writer.WriteInteger( FradioGroup );
10786 procedure TKOLToolbarButton.SaveSeparator(Writer: TWriter);
10790 DB '#$signature$#', 0
10791 DB 'TKOLToolbarButton.SaveSeparator', 0
10794 Writer.WriteBoolean( Fseparator );
10797 procedure TKOLToolbarButton.SaveSysImg(Writer: TWriter);
10799 Writer.WriteInteger( Integer( Fsysimg ) );
10802 procedure TKOLToolbarButton.SaveTooltip(Writer: TWriter);
10806 DB '#$signature$#', 0
10807 DB 'TKOLToolbarButton.SaveTooltip', 0
10810 Writer.WriteString( Ftooltip );
10813 procedure TKOLToolbarButton.SaveVisible(Writer: TWriter);
10817 DB '#$signature$#', 0
10818 DB 'TKOLToolbarButton.SaveVisible', 0
10821 Writer.WriteBoolean( Fvisible );
10824 procedure TKOLToolbarButton.Setaction(const Value: TKOLAction);
10826 if Faction = Value then exit;
10827 if Faction <> nil then
10828 Faction.UnLinkComponent(Self);
10830 if Faction <> nil then
10831 Faction.LinkComponent(Self);
10835 procedure TKOLToolbarButton.Setcaption(const Value: String);
10839 DB '#$signature$#', 0
10840 DB 'TKOLToolbarButton.Setcaption', 0
10843 if Fcaption = Value then Exit;
10844 if Faction = nil then
10847 Fcaption:=Faction.Caption;
10848 if Fcaption <> '-' then
10849 Fseparator := FALSE;
10853 procedure TKOLToolbarButton.Setchecked(const Value: Boolean);
10857 DB '#$signature$#', 0
10858 DB 'TKOLToolbarButton.Setchecked', 0
10861 if FChecked = Value then Exit;
10862 if Faction = nil then
10865 FChecked:=Faction.Checked;
10869 procedure TKOLToolbarButton.Setdropdown(const Value: Boolean);
10873 DB '#$signature$#', 0
10874 DB 'TKOLToolbarButton.Setdropdown', 0
10877 if Fdropdown = Value then Exit;
10878 Fdropdown := Value;
10882 procedure TKOLToolbarButton.Setenabled(const Value: Boolean);
10886 DB '#$signature$#', 0
10887 DB 'TKOLToolbarButton.Setenabled', 0
10890 if Fenabled = Value then Exit;
10891 if Faction = nil then
10894 Fenabled:=Faction.Enabled;
10898 procedure TKOLToolbarButton.SetimgIndex(const Value: Integer);
10903 FimgIndex := Value;
10907 procedure TKOLToolbarButton.SetName(const NewName: TComponentName);
10908 var OldName, NewMethodName: String;
10915 DB '#$signature$#', 0
10916 DB 'TKOLToolbarButton.SetName', 0
10920 //Rpt( 'Renaming ' + OldName + ' to ' + NewName );
10921 if (FToolbar <> nil) and (OldName <> '') and
10922 (FToolbar.FindComponent( NewName ) <> nil) then
10924 ShowMessage( 'Can not rename to ' + NewName + ' - such name is already used.' );
10927 if (OldName <> '') and (NewName = '') then
10929 ShowMessage( 'Can not rename to '''' - name must not be empty.' );
10933 if OldName = '' then Exit;
10934 if fOnClickMethodName <> '' then
10935 if FToolbar <> nil then
10937 if LowerCase( FToolbar.Name + OldName + 'Click' ) = LowerCase( fOnClickMethodName ) then
10939 // rename event handler also here:
10940 F := FToolbar.ParentForm;
10941 NewMethodName := FToolbar.Name + NewName + 'Click';
10944 {$IFDEF _D6orHigher}
10945 F.Designer.QueryInterface(IFormDesigner,D);
10950 if QueryFormDesigner( D, FD ) then
10952 if not FD.MethodExists( NewMethodName ) then
10954 FD.RenameMethod( fOnClickMethodName, NewMethodName );
10955 if FD.MethodExists( NewMethodName ) then
10956 fOnClickMethodName := NewMethodName;
10965 procedure TKOLToolbarButton.SetonClick(const Value: TOnToolbarButtonClick);
10970 DB '#$signature$#', 0
10971 DB 'TKOLToolbarButton.SetOnClick', 0
10974 if @ fOnClick = @ Value then Exit;
10976 if TMethod( Value ).Code <> nil then
10978 if FToolbar <> nil then
10980 F := FToolbar.ParentForm;
10981 fOnClickMethodName := F.MethodName( TMethod( Value ).Code );
10985 FOnClickMethodName := '';
10989 procedure TKOLToolbarButton.Setpicture(Value: TPicture);
10995 DB '#$signature$#', 0
10996 DB 'TKOLToolbarButton.Setpicture', 0
10999 if Value <> nil then
11000 if Value.Width * Value.Height = 0 then
11002 if Value = nil then
11005 Fpicture := TPicture.Create;
11009 if FToolbar.ImageListsUsed then
11011 I := MessageBox( Application.Handle, 'Image list(s) will be detached from the toolbar.'#13#10 +
11012 'Continue?', PChar( Application.Title + ' : ' + Name ), MB_OKCANCEL );
11013 if I <> ID_OK then Exit;
11014 FToolbar.imageListNormal := nil;
11015 FToolbar.imageListDisabled := nil;
11016 FToolbar.imageListHot := nil;
11018 Bmp := TBitmap.Create;
11020 Bmp.Width := Value.Width;
11021 Bmp.Height := Value.Height;
11022 if Value.Graphic is TIcon then
11024 Bmp.Canvas.Brush.Color := clSilver;
11025 Bmp.Canvas.FillRect( Rect( 0, 0, Bmp.Width, Bmp.Height ) );
11026 Bmp.Canvas.Draw( 0, 0, Value.Graphic );
11029 Bmp.Assign( Value.Graphic );
11030 Fpicture.Assign( Bmp );
11034 Fseparator := False;
11036 FToolbar.AssembleBitmap;
11037 if Assigned(FToolbar.FKOLCtrl) then
11038 FToolbar.RecreateWnd;
11042 procedure TKOLToolbarButton.SetradioGroup(const Value: Integer);
11044 AlreadyPresent, TheSameBefore, TheSameAfter: Boolean;
11045 Bt: TKOLToolbarButton;
11047 if Value = FradioGroup then Exit;
11048 I := FToolbar.Items.IndexOf( Self );
11049 if I < 0 then Exit;
11052 AlreadyPresent := FALSE;
11053 for J := 0 to FToolbar.Items.Count-1 do
11055 if I = J then continue;
11056 Bt := FToolbar.Items[ J ];
11057 if Bt.FradioGroup = Value then
11059 AlreadyPresent := TRUE;
11063 if AlreadyPresent then
11065 TheSameBefore := FALSE;
11066 TheSameAfter := FALSE;
11069 Bt := FToolbar.Items[ I - 1 ];
11070 if not Bt.separator and (Bt.FradioGroup = Value) then
11071 TheSameBefore := TRUE;
11073 if (I < FToolbar.Items.Count-1) then
11075 Bt := FToolbar.Items[ I + 1 ];
11076 if not Bt.separator and (Bt.FradioGroup = Value) then
11077 TheSameAfter := TRUE;
11079 if not (TheSameBefore or TheSameAfter) then Exit;
11082 FradioGroup := Value;
11086 procedure TKOLToolbarButton.Setseparator(const Value: Boolean);
11090 DB '#$signature$#', 0
11091 DB 'TKOLToolbarButton.Setseparator', 0
11094 if Fseparator = Value then Exit;
11095 Fseparator := Value;
11104 procedure TKOLToolbarButton.Setsysimg(const Value: TSystemToolbarImage);
11107 if Value <> stiCustom then
11109 if (FToolbar.ImageListNormal <> nil) or
11110 (FToolbar.ImageListDisabled <> nil) or
11111 (FToolbar.ImageListHot <> nil) then
11113 I := MessageBox( Application.Handle, 'Image list(s) will be detached from ' +
11114 'the toolbar. Continue?', PChar( Application.Title + ' : ' + Name ),
11116 if I <> ID_OK then Exit;
11117 FToolbar.ImageListNormal := nil;
11118 FToolbar.ImageListDisabled := nil;
11119 FToolbar.ImageListHot := nil;
11124 if Assigned(FToolbar.FKOLCtrl) then
11125 FToolbar.RecreateWnd;
11129 procedure TKOLToolbarButton.Settooltip(const Value: String);
11133 DB '#$signature$#', 0
11134 DB 'TKOLToolbarButton.Settooltip', 0
11137 if Ftooltip = Value then Exit;
11138 if Faction = nil then
11141 Ftooltip:=Faction.Hint;
11142 if FToolbar <> nil then
11143 FToolbar.AssembleTooltips;
11147 procedure TKOLToolbarButton.Setvisible(const Value: Boolean);
11151 DB '#$signature$#', 0
11152 DB 'TKOLToolbarButton.Setvisible', 0
11155 if Fvisible = Value then Exit;
11156 if Faction = nil then
11159 Fvisible:=Faction.Visible;
11163 { TKOLToolButtonOnClickPropEditor }
11165 function TKOLToolButtonOnClickPropEditor.GetValue: string;
11166 var Comp: TPersistent;
11174 DB '#$signature$#', 0
11175 DB 'TKOLToolbarButtonOnClickPropEditor.GetValue', 0
11183 Result := inherited GetValue;
11185 //**Windows.Beep( 100, 100 );
11186 if Result = '' then
11188 Comp := GetComponent( 0 );
11189 if Comp <> nil then
11190 if Comp is TKOLToolbarButton then
11192 Result := (Comp as TKOLToolbarButton).FOnClickMethodName;
11195 //**Windows.Beep( 200, 100 );
11198 Comp := GetComponent( 0 );
11199 if (Comp <> nil) and
11200 (Comp is TKOLToolbarButton) and
11201 ((Comp as TKOLToolbarButton).FToolbar <> nil) then
11203 F := (Comp as TKOLToolbarButton).FToolbar.ParentForm;
11204 if (F = nil) or (F.Designer = nil) then
11206 Result := ''; Exit;
11208 {$IFDEF _D6orHigher}
11209 F.Designer.QueryInterface(IFormDesigner,D);
11213 if (D <> nil) and QueryFormDesigner( D, FD ) then
11215 if not FD.MethodExists( Result ) then Result := '';
11220 //**Windows.Beep( 200, 100 );
11221 if (Result = '') and (Orig <> '') then
11223 FResetting := TRUE;
11225 //Windows.Beep( 100, 200 );
11228 FResetting := FALSE;
11233 Rpt( 'Exception while retrieving property onClick for TKOLToolbarButton' );
11237 procedure TKOLToolButtonOnClickPropEditor.SetValue(const AValue: string);
11238 var Comp: TPersistent;
11243 DB '#$signature$#', 0
11244 DB 'TKOLToolbarButtonOnClickPropEditor.SetValue', 0
11248 for I := 0 to PropCount - 1 do
11250 Comp := GetComponent( I );
11251 if Comp <> nil then
11252 if Comp is TKOLToolbarButton then
11254 (Comp as TKOLToolbarButton).FOnClickMethodName := AValue;
11255 (Comp as TKOLToolbarButton).Change;
11260 { TKOLListViewColumn }
11262 procedure TKOLListViewColumn.Change;
11264 if Assigned( FListView ) then begin
11265 FListView.UpdateColumns; {YS}
11270 constructor TKOLListViewColumn.Create(AOwner: TComponent);
11275 if AOwner <> nil then
11276 if AOwner is TKOLListView then
11278 FListView := AOwner as TKOLListView;
11279 FListView.Cols.Add( Self );
11280 {ShowMessage( 'Parent FListView=' + Int2Hex( DWORD( FListView ), 8 ) + ', ' +
11286 procedure TKOLListViewColumn.DefProps(const Prefix: String; Filer: TFiler);
11288 Filer.DefineProperty( Prefix + 'Name', LoadName, SaveName, True );
11289 Filer.DefineProperty( Prefix + 'Caption', LoadCaption, SaveCaption, True );
11290 Filer.DefineProperty( Prefix + 'TextAlign', LoadTextAlign, SaveTextAlign, True );
11291 Filer.DefineProperty( Prefix + 'Width', LoadWidth, SaveWidth, True );
11292 Filer.DefineProperty( Prefix + 'WidthType', LoadWidthType, SaveWidthType, True );
11293 Filer.DefineProperty( Prefix + 'LVColImage', LoadLVColImage, SaveLVColImage, True );
11294 Filer.DefineProperty( Prefix + 'LVColOrder', LoadLVColOrder, SaveLVColOrder, LVColOrder >= 0 );
11295 Filer.DefineProperty( Prefix + 'LVColRightImg', LoadLVColRightImg, SaveLVColRightImg, LVColRightImg );
11298 destructor TKOLListViewColumn.Destroy;
11300 if FListView <> nil then
11302 FListView.FCols.Remove( Self );
11303 FListView.UpdateColumns;
11309 procedure TKOLListViewColumn.LoadCaption(Reader: TReader);
11311 fCaption := Reader.ReadString;
11314 procedure TKOLListViewColumn.LoadLVColImage(Reader: TReader);
11316 FLVColImage := Reader.ReadInteger;
11319 procedure TKOLListViewColumn.LoadLVColOrder(Reader: TReader);
11321 LVColOrder := Reader.ReadInteger;
11324 procedure TKOLListViewColumn.LoadLVColRightImg(Reader: TReader);
11326 FLVColRightImg := Reader.ReadBoolean;
11329 procedure TKOLListViewColumn.LoadName(Reader: TReader);
11331 Name := Reader.ReadString;
11334 procedure TKOLListViewColumn.LoadTextAlign(Reader: TReader);
11336 FTextAlign := TTextAlign( Reader.ReadInteger );
11339 procedure TKOLListViewColumn.LoadWidth(Reader: TReader);
11341 FWidth := Reader.ReadInteger;
11344 procedure TKOLListViewColumn.LoadWidthType(Reader: TReader);
11346 FWidthType := TKOLListViewColWidthType( Reader.ReadInteger );
11349 procedure TKOLListViewColumn.SaveCaption(Writer: TWriter);
11351 Writer.WriteString( fCaption );
11354 procedure TKOLListViewColumn.SaveLVColImage(Writer: TWriter);
11356 Writer.WriteInteger( FLVColImage );
11359 procedure TKOLListViewColumn.SaveLVColOrder(Writer: TWriter);
11361 Writer.WriteInteger( FLVColOrder );
11364 procedure TKOLListViewColumn.SaveLVColRightImg(Writer: TWriter);
11366 Writer.WriteBoolean( FLVColRightImg );
11369 procedure TKOLListViewColumn.SaveName(Writer: TWriter);
11371 Writer.WriteString( Name );
11374 procedure TKOLListViewColumn.SaveTextAlign(Writer: TWriter);
11376 Writer.WriteInteger( Integer( FTextAlign ) );
11379 procedure TKOLListViewColumn.SaveWidth(Writer: TWriter);
11381 Writer.WriteInteger( FWidth );
11384 procedure TKOLListViewColumn.SaveWidthType(Writer: TWriter);
11386 Writer.WriteInteger( Integer( FWidthType ) );
11389 procedure TKOLListViewColumn.SetCaption(const Value: String);
11395 procedure TKOLListViewColumn.SetLVColImage(const Value: Integer);
11397 FLVColImage := Value;
11401 procedure TKOLListViewColumn.SetLVColOrder(const Value: Integer);
11403 Col: TKOLListViewColumn;
11405 if FListView <> nil then
11407 for I := 0 to FListView.Cols.Count-1 do
11409 Col := FListView.Cols[ I ];
11410 if Col = Self then continue;
11411 if Col.FLVColOrder > FLVColOrder then
11412 Dec( Col.FLVColOrder );
11415 for I := 0 to FListView.Cols.Count-1 do
11417 Col := FListView.Cols[ I ];
11418 if Col = Self then continue;
11419 if Col.FLVColOrder >= Value then
11420 Inc( Col.FLVColOrder );
11423 FLVColOrder := Value;
11427 procedure TKOLListViewColumn.SetLVColRightImg(const Value: Boolean);
11429 FLVColRightImg := Value;
11433 procedure TKOLListViewColumn.SetName(const AName: TComponentName);
11439 procedure TKOLListViewColumn.SetTextAlign(const Value: TTextAlign);
11441 FTextAlign := Value;
11445 procedure TKOLListViewColumn.SetWidth(const Value: Integer);
11451 procedure TKOLListViewColumn.SetWidthType(
11452 const Value: TKOLListViewColWidthType);
11454 FWidthType := Value;
11458 { TKOLLVColumnsPropEditor }
11460 procedure TKOLLVColumnsPropEditor.Edit;
11461 var LV: TKOLListView;
11463 if GetComponent( 0 ) = nil then Exit;
11464 LV := GetComponent( 0 ) as TKOLListView;
11465 if LV.ActiveDesign = nil then
11466 LV.ActiveDesign := TfmLVColumnsEditor.Create( Application );
11467 LV.ActiveDesign.ListView := LV;
11468 LV.ActiveDesign.Visible := TRUE;
11469 SetForegroundWindow( LV.ActiveDesign.Handle );
11470 LV.ActiveDesign.MakeActive( TRUE );
11471 if LV.ParentForm <> nil then
11472 LV.ParentForm.Invalidate;
11475 function TKOLLVColumnsPropEditor.GetAttributes: TPropertyAttributes;
11477 Result := [ paDialog, paReadOnly ];
11480 { TKOLLVColumnsEditor }
11482 procedure TKOLLVColumnsEditor.Edit;
11483 var LV: TKOLListView;
11485 if Component = nil then Exit;
11486 if not(Component is TKOLListView) then Exit;
11487 LV := Component as TKOLListView;
11488 if LV.ActiveDesign = nil then
11489 LV.ActiveDesign := TfmLVColumnsEditor.Create( Application );
11490 LV.ActiveDesign.ListView := LV;
11491 LV.ActiveDesign.Visible := True;
11492 SetForegroundWindow( LV.ActiveDesign.Handle );
11493 LV.ActiveDesign.MakeActive( TRUE );
11494 if LV.ParentForm <> nil then
11495 LV.ParentForm.Invalidate;
11498 procedure TKOLLVColumnsEditor.ExecuteVerb(Index: Integer);
11503 function TKOLLVColumnsEditor.GetVerb(Index: Integer): string;
11505 Result := '&Edit columns';
11508 function TKOLLVColumnsEditor.GetVerbCount: Integer;
11513 { TKOLDateTimePicker }
11515 procedure TKOLDateTimePicker.AssignEvents(SL: TStringList;
11516 const AName: String);
11519 DoAssignEvents( SL, AName, [ 'OnDTPUserString' ], [ @ OnDTPUserString ] );
11522 constructor TKOLDateTimePicker.Create(AOwner: TComponent);
11525 Width := 110; DefaultWidth := Width;
11526 Height := 24; DefaultHeight := Height;
11531 function TKOLDateTimePicker.GenerateTransparentInits: String;
11533 Result := inherited GenerateTransparentInits;
11536 procedure TKOLDateTimePicker.SetFormat(const Value: String);
11542 procedure TKOLDateTimePicker.SetOnDTPUserString(
11543 const Value: TDTParseInputEvent);
11545 FOnDTPUserString := Value;
11549 procedure TKOLDateTimePicker.SetOptions(
11550 const Value: TDateTimePickerOptions);
11552 if ( dtpoTime in Value ) and not( dtpoTime in FOptions ) then
11553 FOptions := Value + [ dtpoUpDown ]
11559 procedure TKOLDateTimePicker.SetupFirst(SL: TStringList; const AName,
11560 AParent, Prefix: String);
11563 if Format <> '' then
11564 SL.Add( Prefix + AName + '.DateTimeFormat := ' +
11565 StringConstant( 'Format', Format ) + ';' );
11566 if not ParentColor then
11567 SL.Add( Prefix + AName + '.DateTimePickerColors[ dtpcBackground ] := ' +
11568 Color2Str( Color ) + ';' );
11571 function TKOLDateTimePicker.SetupParams(const AName,
11572 AParent: String): String;
11576 if dtpoTime in Options then S := S + ',dtpoTime';
11577 if dtpoDateLong in Options then S := S + ',dtpoDateLong';
11578 if dtpoUpDown in Options then S := S + ',dtpoUpDown';
11579 if dtpoRightAlign in Options then S := S + ',dtpoRightAlign';
11580 if dtpoShowNone in Options then S := S + ',dtpoShowNone';
11581 if dtpoParseInput in Options then S := S + ',dtpoParseInput';
11583 Result := AParent + ', [' + S + ']';
11586 function TKOLDateTimePicker.TabStopByDefault: Boolean;