Repository navigation
Expand file tree
/
Copy pathSCLinkedControls.pas
More file actions
1297 lines (1106 loc) · 34.2 KB
/
Copy pathSCLinkedControls.pas
File metadata and controls
1297 lines (1106 loc) · 34.2 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
{*******************************************************}
{ }
{ CA SweetControls Component Library }
{ }
{ Copyright (c) 1996,2004 CodeAccelerate Corporation }
{ }
{*******************************************************}
unit SCLinkedControls;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Menus, SCCommon, SCConsts, SCControl, SCScrollbars;
type
TSCMemoScrollbar = class(TSCControlScrollbar)
protected
property Visible default True;
public
constructor Create(AOwner: TSCCustomControl; AKind: TSCScrollbarKind); override;
published
property Background;
property ButtonColors;
property ExtraButton;
property Icons;
property SlideLine;
property Style default scssFlatEx;
property Thumb;
property ThumbLines;
end;
TSCCustomMemo = class;
TSCLinkedMemo = class(TCustomMemo)
private
FContainer: TSCCustomMemo;
protected
procedure CreateParams(var Params: TCreateParams); override;
function GetPopupMenu: TPopupMenu; override;
property Container: TSCCustomMemo read FContainer;
public
constructor Create(AOwner: TComponent); override;
end;
TSCMemoEditorClass = class of TSCLinkedMemo;
TSCCustomMemo = class(TSCCustomControl)
private
FMemo: TCustomMemo;
FMemoChanged: Integer;
FEnterAsTab: Boolean;
FUpdatingBars: Boolean;
FScrollBars: TScrollStyle;
FScrollbarStyles: TSCMemoScrollbar;
FScrollbarHorz: TSCScrollbar;
FScrollbarVert: TSCScrollbar;
FOldWindowProc: TWndMethod;
function GetAlignment: TAlignment;
function GetBiDiMode: TBiDiMode;
function GetHideSelection: Boolean;
procedure SetHideSelection(const Value: Boolean);
function GetImeMode: TImeMode;
procedure SetImeMode(Value: TImeMode);
function GetImeName: TImeName;
procedure SetImeName(Value: TImeName);
function GetLines: TStrings;
function GetMaxLength: Integer;
procedure SetMaxLength(Value: Integer);
function GetOEMConvert: Boolean;
procedure SetOEMConvert(Value: Boolean);
function GetParentBiDiMode: Boolean;
function GetReadOnly: Boolean;
procedure SetReadOnly(Value: Boolean);
procedure SetScrollBars(Value: TScrollStyle);
procedure SetScrollbarStyles(Value: TSCMemoScrollbar);
function GetWantReturns: Boolean;
procedure SetWantReturns(Value: Boolean);
function GetWantTabs: Boolean;
procedure SetWantTabs(Value: Boolean);
function GetWordWrap: Boolean;
procedure SetWordWrap(Value: Boolean);
procedure MemoWindowProc(var Message: TMessage);
procedure UpdateScrollbars;
procedure ScrollbarChanged(Sender: TObject);
procedure ConvertMemoPos(var X, Y: Integer);
function IsCaptionStored: Boolean;
function GetCanUndo: Boolean;
function GetModified: Boolean;
procedure SetModified(Value: Boolean);
procedure SetSelText(const Value: string);
function GetMemoChanged: Boolean;
procedure MemoChange(Sender: TObject);
procedure MemoClick(Sender: TObject);
procedure MemoDblClick(Sender: TObject);
procedure MemoDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure MemoDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure MemoEndDock(Sender, Target: TObject; X, Y: Integer);
procedure MemoEndDrag(Sender, Target: TObject; X, Y: Integer);
procedure MemoEnter(Sender: TObject);
procedure MemoExit(Sender: TObject);
procedure MemoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure MemoKeyPress(Sender: TObject; var Key: Char);
procedure MemoKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure MemoMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MemoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure MemoMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MemoStartDock(Sender: TObject; var DragObject: TDragDockObject);
procedure MemoStartDrag(Sender: TObject; var DragObject: TDragObject);
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure CMParentColorChanged(var Message: TWMNoParams); message CM_PARENTCOLORCHANGED;
procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
procedure CMJumpToNext(var Message: TMessage); message CM_SCJUMPTONEXT;
procedure CMWinIniChange(var Message: TWMWinIniChange); message CM_WININICHANGE;
procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED;
procedure WMCommand(var Message: TWMCommand); message WM_COMMAND;
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
procedure WMCut(var Message: TMessage); message WM_CUT;
procedure WMPaste(var Message: TMessage); message WM_PASTE;
procedure WMClear(var Message: TMessage); message WM_CLEAR;
procedure WMUndo(var Message: TMessage); message WM_UNDO;
procedure WMMouseWheel(var Message: TMessage); message WM_MOUSEWHEEL;
procedure WMSetText(var Message:TWMSetText); message WM_SETTEXT;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
protected
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Loaded; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure SetAlignment(Value: TAlignment);
function GetCaretPos: TPoint; virtual;
procedure SetBiDiMode(Value: TBiDiMode); override;
procedure SetLines(Value: TStrings);
procedure SetParentBiDiMode(Value: Boolean); override;
function GetMemoEditorClass: TSCMemoEditorClass; dynamic;
function IsVisibleChild(C: TControl): Boolean; override;
function CanAlignText(var Value: TAlignment): Boolean; virtual;
procedure Change; override;
procedure DoSetMaxLength(Value: Integer); virtual;
function GetSelLength: Integer; virtual;
function GetSelStart: Integer; virtual;
function GetSelText: string; virtual;
procedure SetSelLength(Value: Integer); virtual;
procedure SetSelStart(Value: Integer); virtual;
procedure ScrollerChanged(Sender: TSCCustomControlScrollbar); override;
function GetText: TCaption;
procedure SetText(const Value: TCaption);
property Memo: TCustomMemo read FMemo;
property MemoChanged: Boolean read GetMemoChanged;
property Alignment: TAlignment read GetAlignment write SetAlignment;
property BiDiMode: TBiDiMode read GetBiDiMode write SetBiDiMode default bdLeftToRight;
property Border default sccbFlat;
property Caption: TCaption read GetText write SetText stored IsCaptionStored;
property Color default clWindow;
property EnterAsTab: Boolean read FEnterAsTab write FEnterAsTab default False;
property HideSelection: Boolean read GetHideSelection write SetHideSelection default True;
property ImeMode: TImeMode read GetImeMode write SetImeMode default imDontCare;
property ImeName: TImeName read GetImeName write SetImeName;
property MaxLength: Integer read GetMaxLength write SetMaxLength default 0;
property OEMConvert: Boolean read GetOEMConvert write SetOEMConvert default False;
property ParentBiDiMode: Boolean read GetParentBiDiMode write SetParentBiDiMode default True;
property ParentColor default False;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssNone;
property ScrollbarStyles: TSCMemoScrollbar read FScrollbarStyles write SetScrollbarStyles;
property Text: TCaption read GetText write SetText;
property WantReturns: Boolean read GetWantReturns write SetWantReturns default True;
property WantTabs: Boolean read GetWantTabs write SetWantTabs default False;
property WordWrap: Boolean read GetWordWrap write SetWordWrap default True;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
function GetControlsAlignment: TAlignment; override;
procedure Clear; virtual;
procedure ClearSelection;
procedure CopyToClipboard;
procedure CutToClipboard;
procedure DefaultHandler(var Message); override;
procedure PasteFromClipboard;
procedure Undo;
procedure ClearUndo;
function GetSelTextBuf(Buffer: PChar; BufSize: Integer): Integer; virtual;
procedure SelectAll;
procedure SetSelTextBuf(Buffer: PChar);
property CanUndo: Boolean read GetCanUndo;
property CaretPos: TPoint read GetCaretPos;
property Lines: TStrings read GetLines write SetLines;
property Modified: Boolean read GetModified write SetModified;
property SelLength: Integer read GetSelLength write SetSelLength;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelText: string read GetSelText write SetSelText;
end;
TSCMemo = class(TSCCustomMemo)
public
property Text;
published
property Align;
property Alignment;
property Anchors;
property BiDiMode;
property BorderProps;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property EnterAsTab;
property Font;
property HideSelection;
property ImeMode;
property ImeName;
property Lines;
property MaxLength;
property OEMConvert;
property ParentBiDiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ScrollBars;
property ScrollbarStyles;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property WantReturns;
property WantTabs;
property WordWrap;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
implementation
type
TFakeScrollbar = class(TSCControlScrollbar);
TFakeScrollbarPart = class(TSCScrollbarPart);
TFakeActionLink = class(TControlActionLink);
{ TSCLinkedMemo }
constructor TSCLinkedMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable];
end;
procedure TSCLinkedMemo.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params.WindowClass do
begin
Style := Style and not CS_VREDRAW;
if (ScrollBars in [ssHorizontal, ssBoth]) or not WordWrap then
Style := Style and not CS_HREDRAW;
end;
end;
function TSCLinkedMemo.GetPopupMenu: TPopupMenu;
begin
Result := nil;
if FContainer <> nil then
Result := FContainer.PopupMenu;
end;
{ TSCCustomMemo }
procedure TSCCustomMemo.Assign(Source: TPersistent);
begin
inherited Assign(Source);
if Source is TSCCustomMemo then
begin
with TSCCustomMemo(Source) do
begin
Self.Alignment := Alignment;
Self.EnterAsTab := EnterAsTab;
Self.HideSelection := HideSelection;
Self.MaxLength := MaxLength;
Self.OEMConvert := OEMConvert;
Self.ReadOnly := ReadOnly;
Self.ScrollBars := ScrollBars;
Self.ScrollbarStyles := ScrollbarStyles;
Self.Text := Text;
Self.WantReturns := WantReturns;
Self.WantTabs := WantTabs;
Self.WordWrap := WordWrap;
end;
end;
end;
function TSCCustomMemo.CanAlignText(var Value: TAlignment): Boolean;
begin
Result := True;
end;
procedure TSCCustomMemo.Change;
begin
if FMemoChanged > 0 then
inherited Change;
end;
procedure TSCCustomMemo.Clear;
begin
if FMemo <> nil then
FMemo.Clear;
end;
procedure TSCCustomMemo.ClearSelection;
begin
if FMemo <> nil then
FMemo.ClearSelection;
end;
procedure TSCCustomMemo.ClearUndo;
begin
if FMemo <> nil then
FMemo.ClearUndo;
end;
procedure TSCCustomMemo.CMColorChanged(var Message: TMessage);
begin
inherited;
if FMemo <> nil then
TSCLinkedMemo(FMemo).Color := Self.Color;
end;
procedure TSCCustomMemo.CMEnabledChanged(var Message: TMessage);
begin
inherited;
if FMemo <> nil then
TSCLinkedMemo(FMemo).Enabled := Self.Enabled;
end;
procedure TSCCustomMemo.CMFocusChanged(var Message: TCMFocusChanged);
begin
inherited;
end;
procedure TSCCustomMemo.CMFontChanged(var Message: TMessage);
begin
inherited;
if FMemo <> nil then
TSCLinkedMemo(FMemo).Font := Self.Font;
end;
procedure TSCCustomMemo.CMJumpToNext(var Message: TMessage);
begin
Message.Result := 0;
if FEnterAsTab and (Message.WParam = VK_RETURN) then
Message.Result := 1;
end;
procedure TSCCustomMemo.CMParentColorChanged(var Message: TWMNoParams);
begin
inherited;
if FMemo <> nil then
TSCLinkedMemo(FMemo).Color := Self.Color;
end;
procedure TSCCustomMemo.CMSysColorChange(var Message: TMessage);
begin
inherited;
if FMemo <> nil then
TSCLinkedMemo(FMemo).Color := Self.Color;
end;
procedure TSCCustomMemo.CMWinIniChange(var Message: TWMWinIniChange);
begin
inherited;
UpdateScrollbars;
end;
procedure TSCCustomMemo.ConvertMemoPos(var X, Y: Integer);
var
Bs: Integer;
begin
Bs := GetBorderSize + GetInnerBorderSize + BorderWidth;
if Bs < 0 then Bs := 0;
Inc(X, Bs);
Inc(Y, Bs);
end;
procedure TSCCustomMemo.CopyToClipboard;
begin
end;
constructor TSCCustomMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable];
Border := sccbFlat;
Color := clWindow;
ParentColor := False;
FScrollBars := ssNone;
ClickFocus := True;
FMemo := GetMemoEditorClass.Create(Self);
FMemo.Parent := Self;
with TSCLinkedMemo(FMemo) do
begin
FContainer := Self;
FOldWindowProc := WindowProc;
WindowProc := MemoWindowProc;
ParentColor := True;
BorderStyle := bsNone;
Align := alClient;
OnChange := MemoChange;
OnClick := MemoClick;
OnDblClick := MemoDblClick;
OnDragDrop := MemoDragDrop;
OnDragOver := MemoDragOver;
OnEndDock := MemoEndDock;
OnEndDrag := MemoEndDrag;
OnEnter := MemoEnter;
OnExit := MemoExit;
OnKeyDown := MemoKeyDown;
OnKeyPress := MemoKeyPress;
OnKeyUp := MemoKeyUp;
OnMouseDown := MemoMouseDown;
OnMouseMove := MemoMouseMove;
OnMouseUp := MemoMouseUp;
OnStartDock := MemoStartDock;
OnStartDrag := MemoStartDrag;
end;
FScrollbarStyles := TSCMemoScrollbar.Create(Self, scskVertical);
FScrollbarHorz := TSCScrollbar.Create(Self);
with FScrollbarHorz do
begin
Parent := Self;
Kind := scskHorizontal;
Visible := False;
TabStop := False;
ClickFocus := False;
Style := scssFlatEx;
OnChange := ScrollbarChanged;
SetBounds(0, 0, 0, 0);
end;
FScrollbarVert := TSCScrollbar.Create(Self);
with FScrollbarVert do
begin
Parent := Self;
Kind := scskVertical;
Visible := False;
TabStop := False;
ClickFocus := False;
Style := scssFlatEx;
OnChange := ScrollbarChanged;
SetBounds(0, 0, 0, 0);
end;
SetBounds(Left, Top, 185, 89);
end;
procedure TSCCustomMemo.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or WS_CLIPCHILDREN;
with Params.WindowClass do
begin
Style := Style and not CS_VREDRAW;
if (FScrollBars in [ssHorizontal, ssBoth]) or WordWrap then
Style := Style and not CS_HREDRAW;
end;
end;
procedure TSCCustomMemo.CutToClipboard;
begin
end;
procedure TSCCustomMemo.DefaultHandler(var Message);
begin
inherited;
end;
destructor TSCCustomMemo.Destroy;
begin
Destroying;
FreeAndNil(FScrollbarHorz);
FreeAndNil(FScrollbarVert);
with TSCLinkedMemo(FMemo) do
begin
OnChange := nil;
OnClick := nil;
OnDblClick := nil;
OnDragDrop := nil;
OnDragOver := nil;
OnEndDock := nil;
OnEndDrag := nil;
OnEnter := nil;
OnExit := nil;
OnKeyDown := nil;
OnKeyPress := nil;
OnKeyUp := nil;
OnMouseDown := nil;
OnMouseMove := nil;
OnMouseUp := nil;
OnStartDock := nil;
OnStartDrag := nil;
FContainer := nil;
WindowProc := FOldWindowProc;
end;
FreeAndNil(FMemo);
FreeAndNil(FScrollbarStyles);
inherited Destroy;
end;
procedure TSCCustomMemo.DoSetMaxLength(Value: Integer);
begin
if FMemo <> nil then
TSCLinkedMemo(FMemo).DoSetMaxLength(Value);
end;
function TSCCustomMemo.GetAlignment: TAlignment;
begin
Result := taLeftJustify;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).Alignment;
end;
function TSCCustomMemo.GetBiDiMode: TBiDiMode;
begin
Result := inherited BiDiMode;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).BiDiMode;
end;
function TSCCustomMemo.GetCanUndo: Boolean;
begin
Result := False;
if FMemo <> nil then Result := FMemo.CanUndo;
end;
function TSCCustomMemo.GetCaretPos: TPoint;
begin
Result := Point(0, 0);
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).GetCaretPos;
end;
procedure TSCCustomMemo.GetChildren(Proc: TGetChildProc; Root: TComponent);
begin
end;
function TSCCustomMemo.GetControlsAlignment: TAlignment;
begin
Result := GetAlignment;
end;
function TSCCustomMemo.GetHideSelection: Boolean;
begin
Result := True;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).HideSelection;
end;
function TSCCustomMemo.GetImeMode: TImeMode;
begin
Result := inherited ImeMode;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).ImeMode;
end;
function TSCCustomMemo.GetImeName: TImeName;
begin
Result := inherited ImeName;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).ImeName;
end;
function TSCCustomMemo.GetLines: TStrings;
begin
Result := nil;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).Lines;
end;
function TSCCustomMemo.GetMaxLength: Integer;
begin
Result := 0;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).MaxLength;
end;
function TSCCustomMemo.GetMemoChanged: Boolean;
begin
Result := FMemoChanged > 0;
end;
function TSCCustomMemo.GetMemoEditorClass: TSCMemoEditorClass;
begin
Result := TSCLinkedMemo;
end;
function TSCCustomMemo.GetModified: Boolean;
begin
Result := False;
if FMemo <> nil then Result := FMemo.Modified;
end;
function TSCCustomMemo.GetOEMConvert: Boolean;
begin
Result := False;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).OEMConvert;
end;
function TSCCustomMemo.GetParentBiDiMode: Boolean;
begin
Result := inherited ParentBiDiMode;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).ParentBiDiMode;
end;
function TSCCustomMemo.GetReadOnly: Boolean;
begin
Result := False;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).ReadOnly;
end;
function TSCCustomMemo.GetSelLength: Integer;
begin
Result := 0;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).GetSelLength;
end;
function TSCCustomMemo.GetSelStart: Integer;
begin
Result := 0;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).GetSelStart;
end;
function TSCCustomMemo.GetSelText: string;
begin
Result := '';
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).GetSelText;
end;
function TSCCustomMemo.GetSelTextBuf(Buffer: PChar;
BufSize: Integer): Integer;
begin
Result := 0;
if FMemo <> nil then
FMemo.GetSelTextBuf(Buffer, BufSize);
end;
function TSCCustomMemo.GetText: TCaption;
begin
Result := '';
if FMemo <> nil then Result := FMemo.Text;
end;
function TSCCustomMemo.GetWantReturns: Boolean;
begin
Result := True;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).WantReturns;
end;
function TSCCustomMemo.GetWantTabs: Boolean;
begin
Result := False;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).WantTabs;
end;
function TSCCustomMemo.GetWordWrap: Boolean;
begin
Result := True;
if FMemo <> nil then
Result := TSCLinkedMemo(FMemo).WordWrap;
end;
function TSCCustomMemo.IsCaptionStored: Boolean;
begin
Result := (ActionLink = nil) or not TFakeActionLink(ActionLink).IsCaptionLinked;
end;
function TSCCustomMemo.IsVisibleChild(C: TControl): Boolean;
begin
Result := (C <> nil) and (C <> FMemo) and (C <> FScrollbarHorz) and
(C <> FScrollbarVert);
end;
procedure TSCCustomMemo.Loaded;
begin
inherited Loaded;
UpdateScrollbars;
end;
procedure TSCCustomMemo.MemoChange(Sender: TObject);
begin
Inc(FMemoChanged);
try
UpdateScrollbars;
Change;
finally
Dec(FMemoChanged);
end;
end;
procedure TSCCustomMemo.MemoClick(Sender: TObject);
begin
Click;
end;
procedure TSCCustomMemo.MemoDblClick(Sender: TObject);
begin
DblClick;
end;
procedure TSCCustomMemo.MemoDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
ConvertMemoPos(X, Y);
DragDrop(Source, X, Y);
end;
procedure TSCCustomMemo.MemoDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
ConvertMemoPos(X, Y);
DragOver(Source, X, Y, State, Accept);
end;
procedure TSCCustomMemo.MemoEndDock(Sender, Target: TObject; X,
Y: Integer);
begin
ConvertMemoPos(X, Y);
DoEndDock(Target, X, Y);
end;
procedure TSCCustomMemo.MemoEndDrag(Sender, Target: TObject; X,
Y: Integer);
begin
ConvertMemoPos(X, Y);
DoEndDrag(Target, X, Y);
end;
procedure TSCCustomMemo.MemoEnter(Sender: TObject);
begin
DoEnter;
end;
procedure TSCCustomMemo.MemoExit(Sender: TObject);
begin
DoExit;
end;
procedure TSCCustomMemo.MemoKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if not DoNextControl(Key, Shift) then
KeyDown(Key, Shift);
end;
procedure TSCCustomMemo.MemoKeyPress(Sender: TObject; var Key: Char);
begin
KeyPress(Key);
end;
procedure TSCCustomMemo.MemoKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
KeyUp(Key, Shift);
end;
procedure TSCCustomMemo.MemoMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ConvertMemoPos(X, Y);
MouseDown(Button, Shift, X, Y);
end;
procedure TSCCustomMemo.MemoMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
ConvertMemoPos(X, Y);
MouseMove(Shift, X, Y);
end;
procedure TSCCustomMemo.MemoMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ConvertMemoPos(X, Y);
MouseUp(Button, Shift, X, Y);
end;
procedure TSCCustomMemo.MemoStartDock(Sender: TObject;
var DragObject: TDragDockObject);
begin
DoStartDock(TDragObject(DragObject));
end;
procedure TSCCustomMemo.MemoStartDrag(Sender: TObject;
var DragObject: TDragObject);
begin
DoStartDrag(DragObject);
end;
procedure TSCCustomMemo.MemoWindowProc(var Message: TMessage);
begin
if FMemo <> nil then
begin
FOldWindowProc(Message);
case Message.Msg of
WM_NCCALCSIZE, WM_WINDOWPOSCHANGED,
WM_CUT, WM_PASTE, WM_CLEAR, WM_UNDO,
WM_SETTEXT, WM_KEYDOWN, WM_SIZE,
CM_ENABLEDCHANGED, CM_WININICHANGE:
UpdateScrollbars;
end;
end;
end;
procedure TSCCustomMemo.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (FMemo <> nil) and
(AComponent = FMemo) then FMemo := nil;
end;
procedure TSCCustomMemo.PasteFromClipboard;
begin
end;
procedure TSCCustomMemo.ScrollbarChanged(Sender: TObject);
var
WParam, LParam: LongInt;
Scrollbar: TSCScrollbar;
begin
if not FUpdatingBars and (FMemo <> nil) and (Sender is TSCScrollbar) then
begin
Scrollbar := TSCScrollbar(Sender);
LParam := WM_HSCROLL;
if Scrollbar.Kind = scskVertical then LParam := WM_VSCROLL;
WParam := MakeWParam(SB_THUMBPOSITION, Scrollbar.Position);
SendMessage(FMemo.Handle, LParam, WParam, 0);
end;
end;
procedure TSCCustomMemo.ScrollerChanged(Sender: TSCCustomControlScrollbar);
procedure UpdateColors(Barcolors: TSCScrollbarColors; Part: TFakeScrollbarPart);
begin
with BarColors do
begin
ActiveColor := Part.DownColor;
DefaultColor := Part.Color;
HotColor := Part.HotColor;
DisabledColor := Part.DisabledColor;
end;
end;
procedure UpdateScrollbar(Scrollbar: TSCScrollbar; Barinfo: TSCMemoScrollbar);
var
Part: TFakeScrollbarPart;
begin
if Scrollbar <> nil then
begin
Scrollbar.Style := Barinfo.Style;
Part := TFakeScrollbarPart(Barinfo.Background);
Scrollbar.BackColors.BlendColors := Part.Blend;
UpdateColors(Scrollbar.BackColors, Part);
Part := TFakeScrollbarPart(Barinfo.ButtonColors);
UpdateColors(Scrollbar.ButtonColors, Part);
Part := TFakeScrollbarPart(Barinfo.Icons);
UpdateColors(Scrollbar.ButtonIconColors, Part);
Part := TFakeScrollbarPart(Barinfo.Thumb);
UpdateColors(Scrollbar.ThumbColors, Part);
Scrollbar.ShowExtraButton := Barinfo.ExtraButton;
Scrollbar.ThumbLines := Barinfo.ThumbLines;
Scrollbar.ShowSlideLine := Barinfo.SlideLine;
end;
end;
var
Barinfo: TSCMemoScrollbar;
begin
if Sender is TSCMemoScrollbar then
begin
Barinfo := TSCMemoScrollbar(Sender);
UpdateScrollbar(FScrollbarHorz, Barinfo);
UpdateScrollbar(FScrollbarVert, Barinfo);
end;
end;
procedure TSCCustomMemo.SelectAll;
begin
if FMemo <> nil then
FMemo.SelectAll;
end;
procedure TSCCustomMemo.SetAlignment(Value: TAlignment);
begin
if (FMemo <> nil) and CanAlignText(Value) then
TSCLinkedMemo(FMemo).Alignment := Value;
end;
procedure TSCCustomMemo.SetBiDiMode(Value: TBiDiMode);
begin
inherited SetBiDiMode(Value);
if FMemo <> nil then
TSCLinkedMemo(FMemo).BiDiMode := Value;
end;
procedure TSCCustomMemo.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
UpdateScrollbars;
end;
procedure TSCCustomMemo.SetHideSelection(const Value: Boolean);
begin
if FMemo <> nil then
TSCLinkedMemo(FMemo).HideSelection := Value;
end;
procedure TSCCustomMemo.SetImeMode(Value: TImeMode);
begin
inherited ImeMode := Value;
if FMemo <> nil then
TSCLinkedMemo(FMemo).ImeMode := Value;
end;