1{
2 *****************************************************************************
3 *                            WinCEWSCheckLst.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 WinCEWSCheckLst;
17
18{$mode objfpc}{$H+}
19
20interface
21
22uses
23////////////////////////////////////////////////////
24// I M P O R T A N T
25////////////////////////////////////////////////////
26// To get as little as posible circles,
27// uncomment only when needed for registration
28////////////////////////////////////////////////////
29  Classes, CheckLst, StdCtrls,
30////////////////////////////////////////////////////
31  WSCheckLst, WSLCLClasses, WinCEInt, WinCEProc, Windows;
32
33type
34
35  { TWinCEWSCheckListBox }
36
37  { TWinCEWSCustomCheckListBox }
38
39  TWinCEWSCustomCheckListBox = class(TWSCustomCheckListBox)
40  published
41    class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
42    class function  GetState(const ACheckListBox: TCustomCheckListBox;
43      const AIndex: integer): TCheckBoxState; override;
44    class procedure SetState(const ACheckListBox: TCustomCheckListBox;
45      const AIndex: integer; const AState: TCheckBoxState); override;
46  end;
47
48
49implementation
50
51class function TWinCEWSCustomCheckListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
52var
53  Handle: HWND;
54begin
55  Handle := ACustomListBox.Handle;
56  Result := TWinCECheckListBoxStrings.Create(Handle, ACustomListBox);
57  GetWindowInfo(Handle)^.List := Result;
58end;
59
60class function TWinCEWSCustomCheckListBox.GetState(
61  const ACheckListBox: TCustomCheckListBox; const AIndex: integer
62  ): TCheckBoxState;
63begin
64  Result := TWinCECheckListBoxStrings(ACheckListBox.Items).State[AIndex];
65end;
66
67class procedure TWinCEWSCustomCheckListBox.SetState(
68  const ACheckListBox: TCustomCheckListBox; const AIndex: integer;
69  const AState: TCheckBoxState);
70var
71  SizeRect: Windows.RECT;
72  Handle: HWND;
73begin
74  TWinCECheckListBoxStrings(ACheckListBox.Items).State[AIndex] := AState;
75
76  // redraw control
77  Handle := ACheckListBox.Handle;
78  Windows.SendMessage(Handle, LB_GETITEMRECT, AIndex, LPARAM(@SizeRect));
79  Windows.InvalidateRect(Handle, @SizeRect, false);
80end;
81
82end.
83