File: gtk3wsstdctrls.pp

package info (click to toggle)
lazarus 2.0.10%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 219,188 kB
  • sloc: pascal: 1,867,962; xml: 265,716; cpp: 56,595; sh: 3,005; java: 609; makefile: 568; perl: 297; sql: 222; ansic: 137
file content (1101 lines) | stat: -rw-r--r-- 39,798 bytes parent folder | download | duplicates (2)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
{
 *****************************************************************************
 *                               Gtk3WSStdCtrls.pp                           *
 *                               -------------                               * 
 *                                                                           *
 *                                                                           *
 *****************************************************************************

 *****************************************************************************
  This file is part of the Lazarus Component Library (LCL)

  See the file COPYING.modifiedLGPL.txt, included in this distribution,
  for details about the license.
 *****************************************************************************
}
unit Gtk3WSStdCtrls;

{$mode objfpc}{$H+}
{$I gtk3defines.inc}

interface
////////////////////////////////////////////////////
// I M P O R T A N T                                
////////////////////////////////////////////////////
// 1) Only class methods allowed
// 2) Class methods have to be published and virtual
// 3) To get as little as posible circles, the uses
//    clause should contain only those LCL units 
//    needed for registration. WSxxx units are OK
// 4) To improve speed, register only classes in the 
//    initialization section which actually 
//    implement something
// 5) To enable your XXX widgetset units, look at
//    the uses clause of the XXXintf.pp
////////////////////////////////////////////////////
uses
////////////////////////////////////////////////////
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
  Graphics, Controls, StdCtrls, LCLType, LCLProc,
////////////////////////////////////////////////////
  WSLCLClasses, WSControls, WSStdCtrls, WSProc, Classes, WSFactory, Clipbrd,
  gtk3widgets, gtk3procs, LazGdk3;

type
  { TGtk3WSScrollBar }

  TGtk3WSScrollBar = class(TWSScrollBar)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure SetParams(const AScrollBar: TCustomScrollBar); override;
    class procedure SetKind(const AScrollBar: TCustomScrollBar; const AIsHorizontal: Boolean); override;
  end;
  TGtk3WSScrollBarClass = class of TGtk3WSScrollBar;

  { TGtk3WSCustomGroupBox }

  TGtk3WSCustomGroupBox = class(TWSCustomGroupBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;
  end;

  { TGtk3WSGroupBox }

  TGtk3WSGroupBox = class(TGtk3WSCustomGroupBox)
  published
  end;

  { TGtk3WSCustomComboBox }

  TGtk3WSCustomComboBox = class(TWSCustomComboBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;

    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;

    class function GetDroppedDown(const ACustomComboBox: TCustomComboBox): Boolean; override;
    class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; override;
    class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; override;
    class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; override;
    class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; override;
    
    class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox; 
      NewTraverseList: boolean); override;
    class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); override;
    class procedure SetDroppedDown(const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean); override;
    class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); override;
    class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
    class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
    class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
    class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); override;

    class function  GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
    class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;
    
    class function GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer; override;
    class procedure SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer); override;
  end;
  TGtk3WSCustomComboBoxClass = class of TGtk3WSCustomComboBox;

  { TGtk3WSComboBox }

  TGtk3WSComboBox = class(TGtk3WSCustomComboBox)
  published
  end;

  { TGtk3WSCustomListBox }

  TGtk3WSCustomListBox = class(TWSCustomListBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class function GetIndexAtXY(const ACustomListBox: TCustomListBox; X, Y: integer): integer; override;
    class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
    class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
    class function GetScrollWidth(const ACustomListBox: TCustomListBox): Integer; override;
    class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
    class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
    class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
    class procedure FreeStrings(var AStrings: TStrings); override;
    class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;

    class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;

    class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
    class procedure SetColumnCount(const ACustomListBox: TCustomListBox; ACount: Integer); override;
    class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
    class procedure SetScrollWidth(const ACustomListBox: TCustomListBox; const AScrollWidth: Integer); override;
    class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect, 
      AMultiSelect: boolean); override;
    class procedure SetStyle(const ACustomListBox: TCustomListBox); override;
    class procedure SetSorted(const ACustomListBox: TCustomListBox; AList: TStrings; ASorted: boolean); override;
    class procedure SetTopIndex(const ACustomListBox: TCustomListBox; const NewTopIndex: integer); override;
  end;
  TGtk3WSCustomListBoxClass = class of TGtk3WSCustomListBox;
  
  { TWSListBox }

  TGtk3WSListBox = class(TGtk3WSCustomListBox)
  published
  end;

  { TGtk3WSCustomEdit }

  TGtk3WSCustomEdit = class(TWSCustomEdit)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;

    class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; override;
    class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; override;
    class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
    class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;

    class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); override;
    class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); override;
    class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); override;
    class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
    class procedure SetHideSelection(const ACustomEdit: TCustomEdit; NewHideSelection: Boolean); override;
    class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
    class procedure SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); override;
    class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
    class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
    class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;

    class procedure Cut(const ACustomEdit: TCustomEdit); override;
    class procedure Copy(const ACustomEdit: TCustomEdit); override;
    class procedure Paste(const ACustomEdit: TCustomEdit); override;
    class procedure Undo(const ACustomEdit: TCustomEdit); override;
  end;
  TGtk3WSCustomEditClass = class of TGtk3WSCustomEdit;

  { TGtk3WSCustomMemo }

  TGtk3WSCustomMemo = class(TWSCustomMemo)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;

    class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; override;
    class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); override;
    class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); override;
    class procedure SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); override;
    class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); override;

    class function GetCanUndo(const ACustomEdit: TCustomEdit): Boolean; override;
    class function GetCaretPos(const ACustomEdit: TCustomEdit): TPoint; override;
    class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
    class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;

    class procedure SetAlignment(const ACustomEdit: TCustomEdit; const AAlignment: TAlignment); override;
    class procedure SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint); override;
    class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); override;
    class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
    class procedure SetHideSelection(const ACustomEdit: TCustomEdit; NewHideSelection: Boolean); override;
    class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
    class procedure SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char); override;
    class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
    class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
    class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;

  end;
  TGtk3WSCustomMemoClass = class of TGtk3WSCustomMemo;

  { TGtk3WSEdit }

  TGtk3WSEdit = class(TGtk3WSCustomEdit)
  published
  end;

  { TGtk3WSMemo }

  TGtk3WSMemo = class(TGtk3WSCustomMemo)
  published
  end;

  { TGtk3WSCustomStaticText }

  TGtk3WSCustomStaticText = class(TWSCustomStaticText)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;
    class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override;
    class procedure SetStaticBorderStyle(const ACustomStaticText: TCustomStaticText; const NewBorderStyle: TStaticBorderStyle); override;
  end;
  TGtk3WSCustomStaticTextClass = class of TGtk3WSCustomStaticText;

  { TGtk3WSStaticText }

  TGtk3WSStaticText = class(TGtk3WSCustomStaticText)
  published
  end;

  { TGtk3WSButtonControl }

  TGtk3WSButtonControl = class(TWSButtonControl)
  published
    class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
  end;

  { TGtk3WSButton }

  TGtk3WSButton = class(TWSButton)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;
    class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
    class procedure SetShortCut(const AButton: TCustomButton; const ShortCutK1, ShortCutK2: TShortCut); override;
  end;
  TGtk3WSButtonClass = class of TGtk3WSButton;

  { TGtk3WSCustomCheckBox }

  TGtk3WSCustomCheckBox = class(TWSCustomCheckBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
    class procedure GetPreferredSize(const AWinControl: TWinControl;
                        var PreferredWidth, PreferredHeight: integer;
                        WithThemeSpace: Boolean); override;
    class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
    class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; const ShortCutK1, ShortCutK2: TShortCut); override;
    class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
  end;
  TGtk3WSCustomCheckBoxClass = class of TGtk3WSCustomCheckBox;

  { TGtk3WSCheckBox }

  TGtk3WSCheckBox = class(TGtk3WSCustomCheckBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
  end;

  { TWSToggleBox }

  { TGtk3WSToggleBox }

  TGtk3WSToggleBox = class(TGtk3WSCustomCheckBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
  end;

  { TGtk3WSRadioButton }

  TGtk3WSRadioButton = class(TGtk3WSCustomCheckBox)
  published
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
  end;

implementation

uses
  LResources, gtk3private, LazGObject2;

{ TGtk3WSCustomGroupBox }

class function TGtk3WSCustomGroupBox.CreateHandle(
  const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
  AGroupBox: TGtk3GroupBox;
begin
  AGroupBox := TGtk3GroupBox.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AGroupBox);
end;

class procedure TGtk3WSCustomGroupBox.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3GroupBox(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

{ TGtk3WSRadioButton }

class function TGtk3WSRadioButton.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  ARadioButton: TGtk3RadioButton;
begin
  ARadioButton := TGtk3RadioButton.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(ARadioButton);
end;

{ TGtk3WSToggleBox }

class function TGtk3WSToggleBox.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  AToggleBox: TGtk3ToggleButton;
begin
  AToggleBox := TGtk3ToggleButton.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AToggleBox);
end;

{ TGtk3WSCheckBox }

class function TGtk3WSCheckBox.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  ACheckBox: TGtk3CheckBox;
begin
  ACheckBox := TGtk3CheckBox.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(ACheckBox);
end;

{ TGtk3WSScrollBar }

class function TGtk3WSScrollBar.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  AGtkScrollbar: TGtk3ScrollBar;
begin
  AGtkScrollBar := TGtk3ScrollBar.Create(AWinControl, AParams);
  Result:= TLCLIntfHandle(AGtkScrollBar);
end;

class procedure TGtk3WSScrollBar.SetParams(const AScrollBar: TCustomScrollBar);
begin
  if not WSCheckHandleAllocated(AScrollBar, 'SetParams') then
    Exit;
  TGtk3ScrollBar(AScrollBar.Handle).BeginUpdate;
  TGtk3ScrollBar(AScrollBar.Handle).SetParams;
  TGtk3ScrollBar(AScrollBar.Handle).EndUpdate;
end;

class procedure TGtk3WSScrollBar.SetKind(const AScrollBar: TCustomScrollBar;
  const AIsHorizontal: Boolean);
begin
  if not WSCheckHandleAllocated(AScrollBar, 'SetKind') then
    Exit;
  RecreateWnd(AScrollBar);
end;

{ TGtk3WSCustomListBox }

class function TGtk3WSCustomListBox.CreateHandle(
  const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
  AListBox: TGtk3ListBox;
begin
  AListBox := TGtk3ListBox.Create(AWinControl, AParams);
  AListBox.BorderStyle := TCustomListBox(AWinControl).BorderStyle;
  Result := TLCLIntfHandle(AListBox);
end;

class function TGtk3WSCustomListBox.GetIndexAtXY(
  const ACustomListBox: TCustomListBox; X, Y: integer): integer;
begin
  Result := -1;
end;

class function  TGtk3WSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
begin
  Result := 0;
  if not WSCheckHandleAllocated(ACustomListBox, 'GetItemIndex') then
    Exit;
  Result := TGtk3ListBox(ACustomListBox.Handle).ItemIndex;
end;

class function TGtk3WSCustomListBox.GetItemRect(
  const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
  ): boolean;
begin
  FillChar(ARect,SizeOf(ARect),0);
  Result:=false;
end;

class function TGtk3WSCustomListBox.GetScrollWidth(
  const ACustomListBox: TCustomListBox): Integer;
begin
  Result := 0;
end;

class function  TGtk3WSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
begin
  Result := 0;
  if not WSCheckHandleAllocated(ACustomListBox, 'GetSelCount') then
    Exit;
  Result := TGtk3ListBox(ACustomListBox.Handle).GetSelCount;
end;

class function  TGtk3WSCustomListBox.GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean;
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'GetSelected') then
    Exit(False);
  //DebugLn('WARNING: TGtk3WSCustomListBox.GetSelected is not implemented.');
  Result := TGtk3ListBox(ACustomListBox.Handle).GetItemSelected(AIndex);
end;

class function TGtk3WSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'GetStrings') then
    Exit;
  //DebugLn('TGtk3WSCustomListBox.GetStrings creating TGtkListStoreStringList ...');
  Result := TGtkListStoreStringList(g_object_get_data(PGObject(TGtk3ListBox(ACustomListBox.Handle).GetContainerWidget),
                                     GtkListItemLCLListTag));
  TGtkListStoreStringList(Result).Sorted := ACustomListBox.Sorted;
end;

class procedure TGtk3WSCustomListBox.FreeStrings(var AStrings: TStrings);
begin
  AStrings.Free;
  AStrings := nil;
end;

class function  TGtk3WSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox): integer;
begin
  Result := 0;
end;

class procedure TGtk3WSCustomListBox.SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean);
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'SelectItem') then
    Exit;
  TGtk3ListBox(ACustomListBox.Handle).BeginUpdate;
  TGtk3ListBox(ACustomListBox.Handle).SelectItem(AIndex, ASelected);
  TGtk3ListBox(ACustomListBox.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomListBox.SetBorder(const ACustomListBox: TCustomListBox);
begin

end;

class procedure TGtk3WSCustomListBox.SetColumnCount(const ACustomListBox: TCustomListBox;
  ACount: Integer);
begin

end;

class procedure TGtk3WSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer);
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'SetItemIndex') then
    Exit;
  TGtk3ListBox(ACustomListBox.Handle).BeginUpdate;
  TGtk3ListBox(ACustomListBox.Handle).ItemIndex := AIndex;
  TGtk3ListBox(ACustomListBox.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomListBox.SetScrollWidth(
  const ACustomListBox: TCustomListBox; const AScrollWidth: Integer);
begin

end;

class procedure TGtk3WSCustomListBox.SetSelectionMode(const ACustomListBox: TCustomListBox;
  const AExtendedSelect, AMultiSelect: boolean);
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'SetSelectionMode') then
    Exit;
  TGtk3ListBox(ACustomListBox.Handle).MultiSelect := AMultiSelect;
end;

class procedure TGtk3WSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'SetStyle') then
    Exit;
  if TGtk3ListBox(ACustomListBox.Handle).ListBoxStyle <> ACustomListBox.Style then
    RecreateWnd(ACustomListBox);
end;

class procedure TGtk3WSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox;
  AList: TStrings; ASorted: boolean);
begin
end;

class procedure TGtk3WSCustomListBox.SetTopIndex(const ACustomListBox: TCustomListBox;
  const NewTopIndex: integer);
begin
  if not WSCheckHandleAllocated(ACustomListBox, 'SetTopIndex') then
    Exit;
  TGtk3ListBox(ACustomListBox.Handle).SetTopIndex(NewTopIndex);
end;

{ TGtk3WSCustomComboBox }

class function TGtk3WSCustomComboBox.CreateHandle(
  const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
  AGtkCombo: TGtk3ComboBox;
begin
  {$IFDEF GTK3DEBUGCORE}
  DebugLn('TGtk3WSCustomComboBox.CreateHandle');
  {$ENDIF}
  AGtkCombo := TGtk3ComboBox.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AGtkCombo);
  {$IFDEF GTK3DEBUGCORE}
  DebugLn('TGtk3WSCustomComboBox.CreateHandle Handle=',dbgs(Result));
  {$ENDIF}
end;

class procedure TGtk3WSCustomComboBox.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3ComboBox(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class function TGtk3WSCustomComboBox.GetDroppedDown(
  const ACustomComboBox: TCustomComboBox): Boolean;
begin
  Result := False;
  if not WSCheckHandleAllocated(ACustomComboBox, 'GetDroppedDown') then
    Exit;
  Result := TGtk3ComboBox(ACustomComboBox.Handle).DroppedDown;
end;

class function TGtk3WSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox
  ): integer;
begin
  Result := -1;
end;

class function TGtk3WSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox
  ): integer;
begin
  Result := 0;
end;

class function TGtk3WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox
  ): integer;
begin
  Result := -1;
  if not WSCheckHandleAllocated(ACustomComboBox, 'GetItemIndex') then
    Exit;
  Result := TGtk3ComboBox(ACustomComboBox.Handle).ItemIndex;
end;

class function TGtk3WSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox
  ): integer;
begin
  Result := 0;
end;

class procedure TGtk3WSCustomComboBox.SetArrowKeysTraverseList(
  const ACustomComboBox: TCustomComboBox; NewTraverseList: boolean);
begin
end;

class procedure TGtk3WSCustomComboBox.SetDropDownCount(
  const ACustomComboBox: TCustomComboBox; NewCount: Integer);
begin

end;

class procedure TGtk3WSCustomComboBox.SetDroppedDown(
  const ACustomComboBox: TCustomComboBox; ADroppedDown: Boolean);
begin
  if not WSCheckHandleAllocated(ACustomComboBox, 'SetDroppedDown') then
    Exit;
  TGtk3ComboBox(ACustomComboBox.Handle).DroppedDown := ADroppedDown;
end;

class procedure TGtk3WSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox;
  NewLength: integer);
begin

end;

class procedure TGtk3WSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox;
  NewStart: integer);
begin

end;

class procedure TGtk3WSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox;
  NewLength: integer);
begin

end;

class procedure TGtk3WSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox;
  NewIndex: integer);
begin
  if not WSCheckHandleAllocated(ACustomComboBox, 'SetItemIndex') then
    Exit;
  // DebugLn('TGtk3WSCustomComboBox.SetItemIndex ',dbgs(NewIndex));
  TGtk3ComboBox(ACustomComboBox.Handle).BeginUpdate;
  TGtk3ComboBox(ACustomComboBox.Handle).ItemIndex := NewIndex;
  TGtk3ComboBox(ACustomComboBox.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomComboBox.SetStyle(const ACustomComboBox: TCustomComboBox;
  NewStyle: TComboBoxStyle);
begin

end;

class function TGtk3WSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox
  ): TStrings;
begin
  Result := nil;

  if not WSCheckHandleAllocated(ACustomComboBox, 'GetItems') then
  begin
    Exit;
  end;
  // DebugLn('TGtk3WSCustomComboBox.GetItems creating TGtkListStoreStringList ...');
  Result := TGtkListStoreStringList(g_object_get_data(PGObject(TGtk3ComboBox(ACustomComboBox.Handle).GetContainerWidget),
                                     GtkListItemLCLListTag));
end;

class procedure TGtk3WSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox;
  AList: TStrings; IsSorted: boolean);
begin
end;

class function TGtk3WSCustomComboBox.GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer;
begin
  Result := 0;
end;

class procedure TGtk3WSCustomComboBox.SetItemHeight(const ACustomComboBox: TCustomComboBox; const AItemHeight: Integer);
begin
end;

{ TGtk3WSCustomEdit }

class function TGtk3WSCustomEdit.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  AGtkEntry: TGtk3Entry;
begin
  AGtkEntry := TGtk3Entry.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AGtkEntry);
end;

class procedure TGtk3WSCustomEdit.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3Entry(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class function TGtk3WSCustomEdit.GetCanUndo(const ACustomEdit: TCustomEdit
  ): Boolean;
begin
  Result := False;
end;

class function TGtk3WSCustomEdit.GetCaretPos(const ACustomEdit: TCustomEdit): TPoint;
begin
  Result := Point(0, 0);
  if not WSCheckHandleAllocated(ACustomEdit, 'GetCaretPos') then
    Exit;
  Result := TGtk3Editable(ACustomEdit.Handle).CaretPos;
end;

class function  TGtk3WSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
begin
  result := -1;
  if not WSCheckHandleAllocated(ACustomEdit, 'GetSelStart') then
    Exit;
  Result := TGtk3Editable(ACustomEdit.Handle).getSelStart;
end;

class function  TGtk3WSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer;
begin
  result := 0;
  if not WSCheckHandleAllocated(ACustomEdit, 'GetSelLength') then
    Exit;
  Result := TGtk3Editable(ACustomEdit.Handle).getSelLength;
end;

class procedure TGtk3WSCustomEdit.SetAlignment(const ACustomEdit: TCustomEdit;
  const AAlignment: TAlignment);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetAlignment') then
    Exit;
  TGtk3Editable(ACustomEdit.Handle).BeginUpdate;
  TGtk3Entry(ACustomEdit.Handle).Alignment := AAlignment;
  TGtk3Editable(ACustomEdit.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomEdit.SetCaretPos(const ACustomEdit: TCustomEdit; const NewPos: TPoint);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'GetCaretPos') then
    Exit;
  TGtk3Editable(ACustomEdit.Handle).BeginUpdate;
  TGtk3Editable(ACustomEdit.Handle).CaretPos := NewPos;
  TGtk3Editable(ACustomEdit.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomEdit.SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetCharCase') then
    Exit;
end;

class procedure TGtk3WSCustomEdit.SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetEchoMode') then
    Exit;
  if NewMode in [emNone,emPassword] then
  begin
    TGtk3Entry(ACustomEdit.Handle).SetEchoMode(False);
    SetPasswordChar(ACustomEdit, ACustomEdit.PasswordChar);
  end else
  begin
    TGtk3Entry(ACustomEdit.Handle).SetEchoMode(True);
  end;
end;

class procedure TGtk3WSCustomEdit.SetHideSelection(const ACustomEdit: TCustomEdit;
  NewHideSelection: Boolean);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetHideSelection') then
    Exit;
end;

class procedure TGtk3WSCustomEdit.SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetMaxLength') then
    Exit;
  TGtk3Entry(ACustomEdit.Handle).SetMaxLength(NewLength);
end;

class procedure TGtk3WSCustomEdit.SetPasswordChar(const ACustomEdit: TCustomEdit; NewChar: char);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then
    Exit;
  TGtk3Entry(ACustomEdit.Handle).SetPasswordChar(NewChar);
end;

class procedure TGtk3WSCustomEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetReadOnly') then
    Exit;
  TGtk3Editable(ACustomEdit.Handle).ReadOnly := NewReadOnly;
end;

class procedure TGtk3WSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetSelStart') then
    Exit;
  TGtk3Editable(ACustomEdit.Handle).BeginUpdate;
  TGtk3Editable(ACustomEdit.Handle).SetSelStart(NewStart);
  TGtk3Editable(ACustomEdit.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetSelLength') then
    Exit;
  TGtk3Editable(ACustomEdit.Handle).BeginUpdate;
  TGtk3Editable(ACustomEdit.Handle).SetSelLength(NewLength);
  TGtk3Editable(ACustomEdit.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomEdit.Cut(const ACustomEdit: TCustomEdit);
begin
  ACustomEdit.CopyToClipboard;
  ACustomEdit.ClearSelection;
end;

class procedure TGtk3WSCustomEdit.Copy(const ACustomEdit: TCustomEdit);
begin
  if (ACustomEdit.EchoMode = emNormal) and (ACustomEdit.SelLength > 0) then
    Clipboard.AsText := ACustomEdit.SelText;
end;

class procedure TGtk3WSCustomEdit.Paste(const ACustomEdit: TCustomEdit);
begin
  if Clipboard.HasFormat(CF_TEXT) then
    ACustomEdit.SelText := Clipboard.AsText;
end;

class procedure TGtk3WSCustomEdit.Undo(const ACustomEdit: TCustomEdit);
begin
  // nothing
end;

{ TGtk3WSCustomMemo }

class function TGtk3WSCustomMemo.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  AGtkMemo: TGtk3Memo;
begin
  AGtkMemo := TGtk3Memo.Create(AWinControl, AParams);
  AGtkMemo.BorderStyle := TCustomMemo(AWinControl).BorderStyle;
  Result := TLCLIntfHandle(AGtkMemo);
end;

class procedure TGtk3WSCustomMemo.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3Memo(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class function TGtk3WSCustomMemo.GetStrings(const ACustomMemo: TCustomMemo
  ): TStrings;
begin
  Result := TGtk3MemoStrings.Create(ACustomMemo);
end;

class procedure TGtk3WSCustomMemo.SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle);
var
  AScrollStyle: TPoint;
begin
  if not WSCheckHandleAllocated(ACustomMemo, 'SetScrollBars') then
    Exit;
  AScrollStyle := Gtk3TranslateScrollStyle(ACustomMemo.ScrollBars);
  TGtk3Memo(ACustomMemo.Handle).BeginUpdate;
  TGtk3Memo(ACustomMemo.Handle).HScrollBarPolicy := AScrollStyle.X;
  TGtk3Memo(ACustomMemo.Handle).VScrollBarPolicy := AScrollStyle.Y;
  TGtk3Memo(ACustomMemo.Handle).EndUpdate;
end;

class procedure TGtk3WSCustomMemo.SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean);
begin
  if not WSCheckHandleAllocated(ACustomMemo, 'SetWantTabs') then
    Exit;
  TGtk3Memo(ACustomMemo.Handle).WantTabs := NewWantTabs;
end;

class procedure TGtk3WSCustomMemo.SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean);
begin
  // no way
end;

class procedure TGtk3WSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean);
begin
  if not WSCheckHandleAllocated(ACustomMemo, 'SetWordWrap') then
    Exit;
  TGtk3Memo(ACustomMemo.Handle).WordWrap := NewWordWrap;
end;

class function TGtk3WSCustomMemo.GetCanUndo(const ACustomEdit: TCustomEdit
  ): Boolean;
begin
  Result := False;
end;

class function TGtk3WSCustomMemo.GetCaretPos(const ACustomEdit: TCustomEdit
  ): TPoint;
begin
  Result := Point(0, 0);
end;

class function TGtk3WSCustomMemo.GetSelStart(const ACustomEdit: TCustomEdit
  ): integer;
begin
  Result := 0;
end;

class function TGtk3WSCustomMemo.GetSelLength(const ACustomEdit: TCustomEdit
  ): integer;
begin
  Result := 0;
end;

class procedure TGtk3WSCustomMemo.SetAlignment(const ACustomEdit: TCustomEdit;
  const AAlignment: TAlignment);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetAlignment') then
    Exit;
  TGtk3Memo(ACustomEdit.Handle).Alignment := AAlignment;
end;

class procedure TGtk3WSCustomMemo.SetCaretPos(const ACustomEdit: TCustomEdit;
  const NewPos: TPoint);
begin
  // inherited SetCaretPos(ACustomEdit, NewPos);
end;

class procedure TGtk3WSCustomMemo.SetCharCase(const ACustomEdit: TCustomEdit;
  NewCase: TEditCharCase);
begin
  // inherited SetCharCase(ACustomEdit, NewCase);
end;

class procedure TGtk3WSCustomMemo.SetEchoMode(const ACustomEdit: TCustomEdit;
  NewMode: TEchoMode);
begin
  // inherited SetEchoMode(ACustomEdit, NewMode);
end;

class procedure TGtk3WSCustomMemo.SetHideSelection(
  const ACustomEdit: TCustomEdit; NewHideSelection: Boolean);
begin
  // inherited SetHideSelection(ACustomEdit, NewHideSelection);
end;

class procedure TGtk3WSCustomMemo.SetMaxLength(const ACustomEdit: TCustomEdit;
  NewLength: integer);
begin
  // inherited SetMaxLength(ACustomEdit, NewLength);
end;

class procedure TGtk3WSCustomMemo.SetPasswordChar(
  const ACustomEdit: TCustomEdit; NewChar: char);
begin
  // inherited SetPasswordChar(ACustomEdit, NewChar);
end;

class procedure TGtk3WSCustomMemo.SetReadOnly(const ACustomEdit: TCustomEdit;
  NewReadOnly: boolean);
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetReadOnly') then
    Exit;
  TGtk3Memo(ACustomEdit.Handle).ReadOnly := NewReadOnly;
end;

class procedure TGtk3WSCustomMemo.SetSelStart(const ACustomEdit: TCustomEdit;
  NewStart: integer);
begin
  // inherited SetSelStart(ACustomEdit, NewStart);
end;

class procedure TGtk3WSCustomMemo.SetSelLength(const ACustomEdit: TCustomEdit;
  NewLength: integer);
begin
  // inherited SetSelLength(ACustomEdit, NewLength);
end;

{ TGtk3WSCustomStaticText }

class function TGtk3WSCustomStaticText.CreateHandle(
  const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
  AStaticText: TGtk3StaticText;
begin
  AStaticText := TGtk3StaticText.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AStaticText);
end;

class procedure TGtk3WSCustomStaticText.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3StaticText(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class procedure TGtk3WSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment);
begin
  if not WSCheckHandleAllocated(ACustomStaticText, 'SetAlignment') then
    Exit;
  TGtk3StaticText(ACustomStaticText.Handle).Alignment := NewAlignment;
end;

class procedure TGtk3WSCustomStaticText.SetStaticBorderStyle(
  const ACustomStaticText: TCustomStaticText;
  const NewBorderStyle: TStaticBorderStyle);
begin
  if not WSCheckHandleAllocated(ACustomStaticText, 'SetStaticBorderStyle') then
    Exit;
  TGtk3StaticText(ACustomStaticText.Handle).StaticBorderStyle := NewBorderStyle;
end;

{ TGtk3WSButton }

class function TGtk3WSButton.CreateHandle(const AWinControl: TWinControl;
  const AParams: TCreateParams): TLCLIntfHandle;
var
  AButton: TGtk3Button;
begin
  {$IFDEF GTK3DEBUGCORE}
  DebugLn('TGtk3WSButton.CreateHandle');
  {$ENDIF}
  AButton := TGtk3Button.Create(AWinControl, AParams);
  Result := TLCLIntfHandle(AButton);
  {$IFDEF GTK3DEBUGCORE}
  DebugLn('TGtk3WSButton.CreateHandle Handle=',dbgs(Result));
  {$ENDIF}
end;

class procedure TGtk3WSButton.GetPreferredSize(const AWinControl: TWinControl;
  var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3Button(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class procedure TGtk3WSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean);
begin
  if not WSCheckHandleAllocated(AButton, 'SetDefault') then
    Exit;
  TGtk3Button(AButton.Handle).SetDefault(ADefault);
end;

class procedure TGtk3WSButton.SetShortCut(const AButton: TCustomButton;
  const ShortCutK1, ShortCutK2: TShortCut);
begin;
  //TODO:
end;

{ TGtk3WSCustomCheckBox }

class function TGtk3WSCustomCheckBox.CreateHandle(
  const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle;
var
  ACheckBox: TGtk3CheckBox;
begin
  ACheckBox := TGtk3CheckBox.Create(AWinControl, AParams);

  Result := TLCLIntfHandle(ACheckBox);
end;

class procedure TGtk3WSCustomCheckBox.GetPreferredSize(
  const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
  WithThemeSpace: Boolean);
begin
  if not WSCheckHandleAllocated(AWinControl, 'GetPreferredSize') then
    Exit;
  TGtk3CheckBox(AWinControl.Handle).preferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
end;

class function TGtk3WSCustomCheckBox.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
begin
  Result := cbUnchecked;
  if not WSCheckHandleAllocated(ACustomCheckBox, 'RetrieveState') then
    Exit;
  Result := TGtk3CheckBox(ACustomCheckBox.Handle).State;
end;

class procedure TGtk3WSCustomCheckBox.SetShortCut(const ACustomCheckBox: TCustomCheckBox;
  const ShortCutK1, ShortCutK2: TShortCut);
begin
  //TODO:
end;

class procedure TGtk3WSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
begin
  if not WSCheckHandleAllocated(ACustomCheckBox, 'SetState') then
    Exit;
  TGtk3CheckBox(ACustomCheckBox.Handle).State := NewState;
end;

{ TGtk3WSButtonControl }

class function TGtk3WSButtonControl.GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor;
begin
  Result := DefBtnColors[ADefaultColorType];
end;

end.