-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSpkCtrls.pp
More file actions
1573 lines (1466 loc) · 51.7 KB
/
SpkCtrls.pp
File metadata and controls
1573 lines (1466 loc) · 51.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(*
SpkCtrls - Themed Controls.
Copyright (c) 2025 Humberto Teófilo, All Rights Reserved.
Licensed under Modified LGPL.
CREDITS
Some draw code are simply copied from the depending library, to high fidelity of visual aspects.
The credit of this part of code is the third party authors.
* All files included by code definition are subject to the same copyright terms.
TERMS
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
unit SpkCtrls;
{$MODE OBJFPC}
{$H+}
interface
uses
Classes, SysUtils, Controls, Forms, Graphics, StdCtrls, ExtCtrls, Comctrls, ImgList, Types, FPCanvas,
SpkToolbar, SpkMath, SpkGUITools, SpkGraphTools;
const
SPKCTRLS_TRANSPARENT_COLOR: TColor = clWhite;
SPKCTRLS_LARGEBTN_WIDTH = 32;
SPKCTRLS_SMALLBTN_WIDTH = 16;
SPKCTRLS_TRACK_SMALLCHANGE = 10;
type
(*
ISpkControl
The ISpkControl is a common interface for any SpkCtrl, it forces the method to vinculate the
Toolbar and to have redraw. Note the redraw method is only used for redraw controls that keep the
same geometry. For resized controls must recalculate all(See UpdateAppearance() for complete).
*)
ISpkControl = interface['{8AD3B49E-D562-48D8-9800-45911ADEE9FE}']
procedure SetToolbar(const AValue: TSpkToolbar);
procedure ReDraw();
end;
TCustomSpkControl = class(TCustomControl,ISpkControl)
protected
procedure SetToolbar(const AValue: TSpkToolbar); virtual;
procedure DoEnter; override;
procedure DoExit; override;
function CalcRect(): T2DIntRect; virtual;
procedure InvalidateBuffer(); virtual;
procedure SetEnabled(Value: Boolean); override;
procedure RealSetText(const AValue: TCaption); override;
procedure DoOnResize; override;
procedure Paint(); override;
procedure DoDraw(const ABuffer: TBitmap); virtual; abstract;
private
FToolbar : TSpkToolbar;
FBuffer : TBitmap;
FRect : T2DIntRect;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
procedure ReDraw(); virtual;
procedure UpdateAppearance(); virtual;
property InternalRect: T2DIntRect read FRect;
published
property SpkToolbar: TSpkToolbar read FToolbar write SetToolbar;
end;
TCommonSpkContainer = class(TCustomSpkControl)
public
procedure InsertControl(AControl: TControl; Index: integer); override;
end;
TCustomSpkPanel = class(TCommonSpkContainer)
protected
procedure SetToolbar(const AValue: TSpkToolbar); override;
procedure DoOnResize; override;
public
constructor Create(AOwner: TComponent); override;
procedure ReDraw(); override;
end;
TSpkPanel = class(TCustomSpkPanel)
protected
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetInset(Value: Boolean); virtual;
private
FInset : Boolean;
public
constructor Create(AOwner: TComponent); override;
published
property Inset: Boolean read FInset write SetInset default False;
{ TControl }
property Align;
property Autosize;
property Anchors;
property BorderSpacing;
property Constraints;
property ChildSizing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TCustomSpkBackground = class(TCustomSpkPanel)
protected
procedure DoDraw(const ABuffer: TBitmap); override;
public
end;
TSpkBackground = class(TCustomSpkBackground)
published
{ TControl }
property Align;
property Autosize;
property Anchors;
property BorderSpacing;
property Constraints;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TCustomSpkDetail = class(TGraphicControl, ISpkControl)
protected
function CalcRect(): T2DIntRect; virtual; abstract;
procedure InvalidateBuffer(); virtual;
procedure SetToolbar(const AValue: TSpkToolbar); virtual;
procedure SetEnabled(Value: Boolean); override;
procedure DoOnResize; override;
procedure RealSetText(const AValue: TCaption); override;
procedure Paint(); override;
procedure DoDraw(const ABuffer: TBitmap); virtual; abstract;
private
FBuffer : TBitmap;
FRect : T2DIntRect;
FToolbar : TSpkToolbar;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
procedure ReDraw();
procedure UpdateAppearance(); virtual;
published
property SpkToolbar: TSpkToolbar read FToolbar write SetToolbar;
end;
TCustomSpkButton = class(TCustomSpkControl)
protected
procedure DispatchUserClick({%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer); virtual;
private
FButtonState: TSpkButtonState;
FOnUserClick: TNotifyEvent;
protected
procedure MouseLeave(); override;
procedure MouseDown(Button: TMouseButton; {%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer); override;
procedure MouseMove({%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
public
property OnUserClick: TNotifyEvent read FOnUserClick write FOnUserClick;
end;
TCustomSpkAutoSizeButton = class(TCustomSpkButton)
protected
class
function GetControlClassDefaultSize(): TSize; override;
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; {%H-}WithThemeSpace: Boolean); override;
procedure TextChanged; override;
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
procedure Loaded(); override;
public
constructor Create(AOwner: TComponent); override;
end;
TSpkButtonType = (btRegular, btButtonDropdown, btDropdown, btToggle, btSeparator);
TSpkTableBehaviour = (tbBeginsRow, tbBeginsColumn, tbContinuesRow);
TSpkGroupBehaviour = (gbSingleItem, gbBeginsGroup, gbContinuesGroup, gbEndsGroup);
TCustomSpkPushButton = class(TCustomSpkAutoSizeButton)
protected
procedure SetImageIndex(AValue: TImageIndex); virtual;
procedure SetImgsWidth(AValue: Integer); virtual;
procedure SetImages(const AValue: TImageList); virtual;
procedure SetDisabledImages(const AValue: TImageList); virtual;
procedure SetButtonType(AValue: TSpkButtonType); virtual;
procedure SetPushed(AValue: Boolean); virtual;
procedure SetToggleMode(AValue: Boolean); virtual;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
private
FToggleMode ,
FPushed : Boolean;
FDropdownRect: T2DIntRect;
FButtonType : TSpkButtonType;
FImageIndex : TImageIndex;
FImgsWidth : Integer;
FDisImages ,
FImages : TImageList;
procedure DrawDropdownArrow(ABuffer: TBitmap; ARect: TRect; AColor: TColor);
public
constructor Create(AOwner: TComponent); override;
property ImagesWidth: Integer read FImgsWidth write SetImgsWidth;
property ToggleMode: Boolean read FToggleMode write SetToggleMode;
property Pushed: Boolean read FPushed write SetPushed;
published
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
property Images: TImageList read FImages write SetImages;
property DisabledImages: TImageList read FDisImages write SetDisabledImages;
end;
TSpkLargePushButton = class(TCustomSpkPushButton)
protected
class
function GetControlClassDefaultSize(): TSize; override;
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
public
constructor Create(AOwner: TComponent); override;
private
procedure FindBreakPlace(s: string; out Position: integer; out AWidth: integer);
published
property ToggleMode default False;
property Pushed default False;
property ImagesWidth default SPKCTRLS_LARGEBTN_WIDTH;
property OnUserClick;
property Caption;
{ TControl }
property Align;
property Anchors;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TCustomSpkSmallPushButton = class(TCustomSpkPushButton)
protected
function RealGetText: TCaption; override;
procedure SetGroupBehaviour(const AValue: TSpkGroupBehaviour); virtual;
procedure SetUseFrame(const AValue: Boolean); virtual;
procedure SetShowCaption(const AValue: Boolean); virtual;
procedure SetTableBehaviour(const AValue: TSpkTableBehaviour); virtual;
function GetGroupBehaviour(): TSpkGroupBehaviour; virtual;
function GetTableBehaviour(): TSpkTableBehaviour; virtual;
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
private
FTableBehaviour: TSpkTableBehaviour;
FGroupBehaviour: TSPkGroupBehaviour;
FUseFrame : Boolean;
FShowCaption : Boolean;
procedure ConstructRects(out BtnRect, DropRect: T2DIntRect);
public
constructor Create(AOwner: TComponent); override;
function GeItemtWidth: Integer;
property GroupBehaviour: TSpkGroupBehaviour read FGroupBehaviour write SetGroupBehaviour;
property UseFrame: Boolean read FUseFrame write SetUseFrame;
property ShowCaption: Boolean read FShowCaption write SetShowCaption;
property TableBehaviour: TSpkTableBehaviour read FTableBehaviour write SetTableBehaviour;
end;
TSpkPushButton = class(TCustomSpkSmallPushButton)
published
property ShowCaption default True;
property UseFrame default False;
property Pushed default False;
property ToggleMode default False;
property ImagesWidth default SPKCTRLS_SMALLBTN_WIDTH;
property OnUserClick;
property Caption;
{ TControl }
property Align;
property Anchors;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TSpkSegmentButton = class(TSpkPushButton)
published
property GroupBehaviour;
property TableBehaviour;
end;
TSpkUserCheckSwapEvent = function(const AChecked: Boolean): Boolean of object;
TSpkCheckButton = class(TCustomSpkAutoSizeButton)
protected
procedure SetupIntf(); virtual;
procedure DispatchUserClick(Shift: TShiftState; X, Y: Integer); override;
function AllowChangeState(): Boolean; virtual;
procedure SetShowBorder(AValue: Boolean); virtual;
procedure SetChecked(const AValue: Boolean); virtual;
function GetChecked(): Boolean; virtual;
procedure SetCheckState(AValue: TCheckBoxState); virtual;
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
procedure KeyDown(var Key: Word; {%H-}Shift: TShiftState); override;
private
FOnUserCheck: TSpkUserCheckSwapEvent;
FShowBorder : Boolean;
FCheckState : TCheckboxState;
FCheckStyle : TSpkCheckboxStyle;
FOnChanged : TNotifyEvent;
function DefaultUserCheckSwap(const AChecked: Boolean): Boolean;
public
constructor Create(AOwner: TComponent); override;
property UserCheckSwapEvent: TSpkUserCheckSwapEvent read FOnUserCheck write FOnUserCheck;
published
property ShowBorder: Boolean read FShowBorder write SetShowBorder default False;
property Checked: Boolean read GetChecked write SetChecked;
property State: TCheckboxState read FCheckState write SetCheckState default cbUnchecked;
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
property OnUserClick;
{ TControl }
property AutoSize;
property Caption;
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TCustomSpkRadioCheck = class(TSpkCheckButton)
protected
procedure SetupIntf(); override;
procedure SetCheckState(AValue: TCheckBoxState); override;
private
FGroupIndex : Integer;
public
procedure UnckeckGroup(AGroupIndex: Integer); virtual;
property GroupIndex: Integer read FGroupIndex write FGroupIndex;
end;
TSpkRadioCheck = class(TCustomSpkRadioCheck)
published
property GroupIndex default 0;
end;
TSpkFontStyle = (fsElement, fsMenu, fsPane, fsTab);
TSpkTextRole = (trLabel, trExtra, trDetail, trTitle);
TCustomSpkLabel = class(TCustomSpkControl)
protected
class
function GetControlClassDefaultSize(): TSize; override;
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; {%H-}WithThemeSpace: Boolean); override;
function RealGetText: TCaption; override;
procedure TextChanged; override;
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
procedure Loaded(); override;
procedure LoadedAll(); override;
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetAlignment(AValue: TAlignment); virtual;
procedure SetLayout(AValue: TTextLayout); virtual;
procedure SetFontStyle(AValue: TSpkFontStyle); virtual;
procedure SetTextRole(AValue: TSpkTextRole); virtual;
private
FTextRect : T2DIntRect;
FLPad ,
FRPad : Integer;
FRole : TSpkTextRole;
FAlignment : TAlignment;
FLayout : TTextLayout;
FFontStyle : TSpkFontStyle;
FHighlighted: Boolean;
procedure UpdateFontByStyle();
public
constructor Create(AOwner: TComponent); override;
property Alignment: TAlignment read FAlignment write SetAlignment;
property Layout: TTextLayout read FLayout write SetLayout;
property FontStyle: TSpkFontStyle read FFontStyle write SetFontStyle;
property TextRole: TSpkTextRole read FRole write SetTextRole;
property Highlighted: Boolean read FHighlighted write FHighlighted;
end;
TSpkLabel = class(TCustomSpkLabel)
published
property Alignment default taLeftJustify;
property Layout default tlTop;
property FontStyle default fsElement;
property TextRole default trLabel;
{ TControl }
property AutoSize;
property Caption;
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TSpkOrientation = (orHorizontal, orVertical);
TCustomSpkTrack = class(TCustomSpkControl)
protected
procedure SetMin(const AValue: Integer); virtual;
procedure SetMax(const AValue: Integer); virtual;
procedure SetPos(const AValue: Integer); virtual;
procedure SetSmallChange(const AValue: Integer); virtual;
procedure DoChange(); virtual;
procedure SetReversed(AValue: Boolean); virtual;
procedure SetupIntf(); virtual; abstract;
procedure DoRepos(); virtual; abstract;
private
FMin ,
FMax ,
FPos ,
FSmallChange: Integer;
FTrack : T2DIntRect;
FOnChange : TNotifyEvent;
FReversed : Boolean;
public
constructor Create(AOwner: TComponent); override;
property Min: Integer read FMin write SetMin;
property Max: Integer read FMax write SetMax;
property Position: Integer read FPos write SetPos;
property Reversed: Boolean read FReversed write SetReversed;
property SmallChange: Integer read FSmallChange write SetSmallChange;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TCustomSpkTrackbar = class(TCustomSpkTrack)
protected
function CalcRect(): T2DIntRect; override;
procedure SetOrientation(AValue: TSpkOrientation); virtual;
procedure SetupIntf(); override;
procedure DoOnResize; override;
procedure DoRepos(); override;
procedure DoDraw(const ABuffer: TBitmap); override;
function AllowChange(): Boolean; virtual;
procedure SetPos(const AValue: Integer); override;
protected
procedure KeyDown(var Key: Word; {%H-}Shift: TShiftState); override;
procedure MouseLeave(); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
function DoMouseWheelDown({%H-}Shift: TShiftState; {%H-}MousePos: TPoint): Boolean; override;
function DoMouseWheelUp({%H-}Shift: TShiftState; {%H-}MousePos: TPoint): Boolean; override;
private
FOnUChange : TNotifyEvent;
FTrackLen : Integer;
FSlider : T2DIntRect;
FSliderState: TSpkButtonState;
FOrientation: TSpkOrientation;
procedure UserSmallChange(AInc: Boolean);
public
property Orientation: TSpkOrientation read FOrientation write SetOrientation;
property OnUserChange: TNotifyEvent read FOnUChange write FOnUChange;
end;
TSpkTrackbar = class(TCustomSpkTrackbar)
published
property Min;
property Max;
property Position;
property SmallChange;
property Orientation;
property Reversed default False;
property OnChange;
property OnUserChange;
{ TControl }
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnResize;
property OnStartDrag;
end;
TCustomSpkProgressbar = class(TCustomSpkTrack)
protected
procedure Loaded(); override;
function CalcRect(): T2DIntRect; override;
procedure SetupIntf(); override;
procedure DoOnResize; override;
procedure DoRepos(); override;
procedure SetPos(const AValue: Integer); override;
private
FFiller : T2DIntRect;
public
end;
TSpkProgressbar = class(TCustomSpkProgressbar)
protected
procedure DoDraw(const ABuffer: TBitmap); override;
published
property Min;
property Max;
property Position;
property SmallChange;
property Reversed default False;
property OnChange;
{ TControl }
property Align;
property Anchors;
property BidiMode;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnResize;
property OnStartDrag;
end;
TSpkSwitch = class(TCustomSpkLabel)
protected
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
function DoAllowChange(): Boolean; virtual;
procedure SetChecked(const AValue: Boolean); virtual;
procedure MouseLeave(); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure KeyDown(var Key: Word; {%H-}Shift: TShiftState); override;
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetToolbar(const AValue: TSpkToolbar); override;
private
FSwitcher ,
FTrack : T2DIntRect;
FChecked : Boolean;
FOnUserClick,
FOnChange : TNotifyEvent;
procedure SetCheckChanges();
function GetCalcPad(): Integer;
public
constructor Create(AOwner: TComponent); override;
published
property Checked: Boolean read FChecked write SetChecked default False;
property OnUserClick: TNotifyEvent read FOnUserClick write FOnUserClick;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
{ TControl }
property AutoSize;
property Caption;
property Align;
property Anchors;
property BorderSpacing;
property Enabled;
property Visible;
property ShowHint;
property Hint;
property DragCursor;
property DragKind;
property DragMode;
property PopupMenu;
property OnChangeBounds;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnMouseWheelHorz;
property OnMouseWheelLeft;
property OnMouseWheelRight;
property OnResize;
property OnStartDrag;
end;
TSpkStyledBorder = (sbNone, sbEtched, sbFlat, sbRaised);
TCustomSpkCard = class(TCustomSpkPanel)
protected
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetConcave(AValue: Boolean); virtual;
procedure SetBorder(AValue: TSpkStyledBorder); virtual;
procedure SetToolbar(const AValue: TSpkToolbar); override;
private
FConcave : Boolean;
FBorder : TSpkStyledBorder;
public
constructor Create(AOwner: TComponent); override;
property Concave: Boolean read FConcave write SetConcave;
property Border: TSpkStyledBorder read FBorder write SetBorder;
end;
TSpkCard = class(TCustomSpkCard)
published
property Concave default True;
property Border default sbEtched;
{ TWinControl }
property Align;
property Anchors;
property AutoSize;
property BorderSpacing;
property ChildSizing;
property ClientHeight;
property ClientWidth;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDockDrop;
property OnDockOver;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
property OnUTF8KeyPress;
end;
TCustomSpkGroupBox = class(TCustomSpkPanel)
protected
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetBorder(AValue: TSpkStyledBorder); virtual;
procedure SetToolbar(const AValue: TSpkToolbar); override;
private
FTitleAlign : Boolean;
FTitlebar ,
FTitle : T2DIntRect;
FBorder : TSpkStyledBorder;
public
constructor Create(AOwner: TComponent); override;
property Border: TSpkStyledBorder read FBorder write SetBorder;
end;
TSpkGroupBox = class(TCustomSpkGroupBox)
published
property Border;
{ TWinControl }
property Align;
property Anchors;
property AutoSize;
property BorderSpacing;
property Caption;
property ChildSizing;
property ClientHeight;
property ClientWidth;
property Constraints;
property DockSite;
property DoubleBuffered;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDockDrop;
property OnDockOver;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
property OnUTF8KeyPress;
end;
TCustomSpkExpander = class(TCustomSpkGroupBox)
protected
function AllowUserChangeExpansion(): Boolean; virtual;
procedure MouseMove(Shift: TShiftState; X,Y: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseLeave; override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure DoOnResize; override;
procedure KeyDown(var Key: Word; {%H-}Shift: TShiftState); override;
procedure SetExpanded(const AValue: Boolean); virtual;
procedure DoCollapse();
procedure DoExpand();
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
private
FExpandSize : Integer;
FExpanded : Boolean;
FButtonState: TSpkButtonState;
FButtonRect : T2DIntRect;
FOnExpanded ,
FOnCollapsed: TNotifyEvent;
public
constructor Create(AOwner: TComponent); override;
procedure Collapse(); virtual;
property Expanded: Boolean read FExpanded write SetExpanded;
property OnExpanded: TNotifyEvent read FOnExpanded write FOnExpanded;
property OnCollapsed: TNotifyEvent read FOnCollapsed write FOnCollapsed;
end;
TSpkExpander = class(TCustomSpkExpander)
published
property Expanded default true;
property OnExpanded;
property OnCollapsed;
property Border;
{ TWinControl }
property Align;
property Anchors;
property AutoSize;
property BorderSpacing;
property Caption;
property ChildSizing;
property ClientHeight;
property ClientWidth;
property Constraints;
property DockSite;
property DoubleBuffered;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDockDrop;
property OnDockOver;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
property OnUTF8KeyPress;
end;
TCustomSpkCombobox = class(TCustomSpkButton)
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
function DoMouseWheelDown({%H-}Shift: TShiftState; {%H-}MousePos: TPoint): Boolean; override;
function DoMouseWheelUp({%H-}Shift: TShiftState; {%H-}MousePos: TPoint): Boolean; override;
function CalcRect(): T2DIntRect; override;
procedure DoDraw(const ABuffer: TBitmap); override;
procedure SetAllowAdd(AValue: Boolean); virtual;
procedure SetItemIndex(AValue: Integer); virtual;
function GetItems(): TStrings; virtual;
procedure SetItems(const AValue: TStrings); virtual;
procedure KeyDown(var Key: Word; {%H-}Shift: TShiftState); override;
procedure DoUserAdd(); virtual;
procedure DoPopupCtrl(); virtual;
procedure DoUpdateItem(const ANewItem: Integer); virtual;
function CreateStrings(): TStrings; dynamic;