1{
2 *****************************************************************************
3 *                               WSCheckLst.pp                               *
4 *                               -------------                               *
5 *                                                                           *
6 *                                                                           *
7 *****************************************************************************
8
9 *****************************************************************************
10  This file is part of the Lazarus Component Library (LCL)
11
12  See the file COPYING.modifiedLGPL.txt, included in this distribution,
13  for details about the license.
14 *****************************************************************************
15}
16unit WSCheckLst;
17
18{$mode objfpc}{$H+}
19{$I lcl_defines.inc}
20
21interface
22////////////////////////////////////////////////////
23// I M P O R T A N T
24////////////////////////////////////////////////////
25// 1) Only class methods allowed
26// 2) Class methods have to be published and virtual
27// 3) To get as little as posible circles, the uses
28//    clause should contain only those LCL units
29//    needed for registration. WSxxx units are OK
30// 4) To improve speed, register only classes in the
31//    initialization section which actually
32//    implement something
33// 5) To enable your XXX widgetset units, look at
34//    the uses clause of the XXXintf.pp
35////////////////////////////////////////////////////
36uses
37////////////////////////////////////////////////////
38// To get as little as posible circles,
39// uncomment only when needed for registration
40////////////////////////////////////////////////////
41  StdCtrls, CheckLst,
42////////////////////////////////////////////////////
43  WSLCLClasses, WSStdCtrls, Classes, WSFactory;
44
45type
46  { TWSCustomCheckListBox }
47
48  TWSCustomCheckListBox = class(TWSCustomListBox)
49  published
50    class function GetCheckWidth(const ACheckListBox: TCustomCheckListBox):
51      integer; virtual;
52    class function GetItemEnabled(const ACheckListBox: TCustomCheckListBox;
53      const AIndex: integer): Boolean; virtual;
54    class function GetHeader(const ACheckListBox: TCustomCheckListBox;
55      const AIndex: integer): Boolean; virtual;
56    class function GetState(const ACheckListBox: TCustomCheckListBox;
57      const AIndex: integer): TCheckBoxState; virtual;
58    class procedure SetItemEnabled(const ACheckListBox: TCustomCheckListBox;
59      const AIndex: integer; const AEnabled: Boolean); virtual;
60    class procedure SetHeader(const ACheckListBox: TCustomCheckListBox;
61      const AIndex: integer; const AHeader: Boolean); virtual;
62    class procedure SetState(const ACheckListBox: TCustomCheckListBox;
63      const AIndex: integer; const AState: TCheckBoxState); virtual;
64  end;
65  TWSCustomCheckListBoxClass = class of TWSCustomCheckListBox;
66
67  { WidgetSetRegistration }
68
69  procedure RegisterCustomCheckListBox;
70
71implementation
72
73class function TWSCustomCheckListBox.GetCheckWidth(
74  const ACheckListBox: TCustomCheckListBox): Integer;
75begin
76  Result := 0;
77end;
78
79class function TWSCustomCheckListBox.GetHeader(
80  const ACheckListBox: TCustomCheckListBox; const AIndex: integer): Boolean;
81begin
82  Result := False;
83end;
84
85class function TWSCustomCheckListBox.GetItemEnabled(
86  const ACheckListBox: TCustomCheckListBox; const AIndex: integer): Boolean;
87begin
88  Result := True;
89end;
90
91class function TWSCustomCheckListBox.GetState(
92  const ACheckListBox: TCustomCheckListBox; const AIndex: integer
93  ): TCheckBoxState;
94begin
95  Result := cbUnchecked;
96end;
97
98class procedure TWSCustomCheckListBox.SetHeader(
99  const ACheckListBox: TCustomCheckListBox; const AIndex: integer;
100  const AHeader: Boolean);
101begin
102end;
103
104class procedure TWSCustomCheckListBox.SetItemEnabled(
105  const ACheckListBox: TCustomCheckListBox; const AIndex: integer;
106  const AEnabled: Boolean);
107begin
108end;
109
110class procedure TWSCustomCheckListBox.SetState(
111  const ACheckListBox: TCustomCheckListBox; const AIndex: integer;
112  const AState: TCheckBoxState);
113begin
114end;
115
116{ WidgetSetRegistration }
117
118procedure RegisterCustomCheckListBox;
119const
120  Done: Boolean = False;
121begin
122  if Done then exit;
123  WSRegisterCustomCheckListBox;
124//  if not WSRegisterCustomCheckListBox then
125//    RegisterWSComponent(TCustomCheckListBox, TWSCustomCheckListBox);
126  Done := True;
127end;
128
129end.
130