1{
2 *****************************************************************************
3 *                               WSExtCtrls.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 WSExtCtrls;
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  LCLProc, Controls, ExtCtrls, Classes, ImgList, Graphics, LResources,
42////////////////////////////////////////////////////
43  WSLCLClasses, WSControls, WSStdCtrls, WSFactory;
44
45type
46  { TWSPage }
47
48  TWSPage = class(TWSCustomControl)
49  published
50  end;
51
52  { TWSNotebook }
53
54  TWSNotebook = class(TWSCustomControl)
55  published
56    class function GetDefaultColor(const AControl: TControl;
57      const ADefaultColorType: TDefaultColorType): TColor; override;
58  end;
59
60  { TWSShape }
61
62  TWSShape = class(TWSGraphicControl)
63  published
64  end;
65
66  { TWSCustomSplitter }
67
68  TWSCustomSplitter = class(TWSCustomControl)
69  published
70  end;
71
72  { TWSSplitter }
73
74  TWSSplitter = class(TWSCustomSplitter)
75  published
76  end;
77
78  { TWSPaintBox }
79
80  TWSPaintBox = class(TWSGraphicControl)
81  published
82  end;
83
84  { TWSCustomImage }
85
86  TWSCustomImage = class(TWSGraphicControl)
87  published
88  end;
89
90  { TWSImage }
91
92  TWSImage = class(TWSCustomImage)
93  published
94  end;
95
96  { TWSBevel }
97
98  TWSBevel = class(TWSGraphicControl)
99  published
100  end;
101
102  { TWSCustomRadioGroup }
103
104  TWSCustomRadioGroup = class(TWSCustomGroupBox)
105  published
106  end;
107
108  { TWSRadioGroup }
109
110  TWSRadioGroup = class(TWSCustomRadioGroup)
111  published
112  end;
113
114  { TWSCustomCheckGroup }
115
116  TWSCustomCheckGroup = class(TWSCustomGroupBox)
117  published
118  end;
119
120  { TWSCheckGroup }
121
122  TWSCheckGroup = class(TWSCustomCheckGroup)
123  published
124  end;
125
126  { TWSCustomLabeledEdit }
127
128  TWSCustomLabeledEdit = class(TWSCustomEdit)
129  published
130  end;
131
132  { TWSLabeledEdit }
133
134  TWSLabeledEdit = class(TWSCustomLabeledEdit)
135  published
136  end;
137
138  { TWSCustomPanel }
139
140  TWSCustomPanel = class(TWSCustomControl)
141  published
142    class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
143  end;
144
145  { TWSPanel }
146
147  TWSPanel = class(TWSCustomPanel)
148  end;
149
150  { TWSCustomTrayIcon }
151
152  TWSCustomTrayIcon = class(TWSLCLComponent)
153  published
154    class function Hide(const ATrayIcon: TCustomTrayIcon): Boolean; virtual;
155    class function Show(const ATrayIcon: TCustomTrayIcon): Boolean; virtual;
156    class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); virtual;
157    class function ShowBalloonHint(const ATrayIcon: TCustomTrayIcon): Boolean; virtual;
158    class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; virtual;
159    class function GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas; virtual;
160  end;
161  TWSCustomTrayIconClass = class of TWSCustomTrayIcon;
162
163  { WidgetSetRegistration }
164
165  procedure RegisterShape;
166  procedure RegisterCustomSplitter;
167  procedure RegisterPaintBox;
168  procedure RegisterCustomImage;
169  procedure RegisterBevel;
170  procedure RegisterCustomRadioGroup;
171  procedure RegisterCustomCheckGroup;
172  procedure RegisterCustomLabeledEdit;
173  procedure RegisterCustomPanel;
174  procedure RegisterCustomTrayIcon;
175
176implementation
177
178{ TWSNotebook }
179
180class function TWSNotebook.GetDefaultColor(const AControl: TControl;
181  const ADefaultColorType: TDefaultColorType): TColor;
182begin
183  Result:=DefBtnColors[ADefaultColorType];
184end;
185
186{ TWSCustomTrayIcon }
187
188class function TWSCustomTrayIcon.Hide(const ATrayIcon: TCustomTrayIcon): Boolean;
189begin
190  Result := False;
191end;
192
193class function TWSCustomTrayIcon.Show(const ATrayIcon: TCustomTrayIcon): Boolean;
194begin
195  Result := False;
196end;
197
198class procedure TWSCustomTrayIcon.InternalUpdate(const ATrayIcon: TCustomTrayIcon);
199begin
200
201end;
202
203{*******************************************************************
204*  TWSCustomTrayIcon.ShowBalloonHint ()
205*
206*  RETURNS:        False if we should use the popupnotifier to implement this method
207*                  True if a platform-specific baloon is implemented
208*
209*******************************************************************}
210class function TWSCustomTrayIcon.ShowBalloonHint(const ATrayIcon: TCustomTrayIcon): Boolean;
211begin
212  Result := False;
213end;
214
215class function TWSCustomTrayIcon.GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint;
216begin
217  Result := Point(0, 0);
218end;
219
220class function TWSCustomTrayIcon.GetCanvas(const ATrayIcon: TCustomTrayIcon): TCanvas;
221begin
222  Result := ATrayIcon.Icon.Canvas;
223end;
224
225{ WidgetSetRegistration }
226
227procedure RegisterShape;
228const
229  Done: Boolean = False;
230begin
231  if Done then exit;
232  WSRegisterShape;
233//  if not WSRegisterShape then
234//    RegisterWSComponent(TShape, TWSShape);
235  Done := True;
236end;
237
238procedure RegisterCustomSplitter;
239const
240  Done: Boolean = False;
241begin
242  if Done then exit;
243  WSRegisterCustomSplitter;
244//  if not WSRegisterCustomSplitter then
245//    RegisterWSComponent(TCustomSplitter, TWSCustomSplitter);
246  Done := True;
247end;
248
249procedure RegisterPaintBox;
250const
251  Done: Boolean = False;
252begin
253  if Done then exit;
254  WSRegisterPaintBox;
255//  if not WSRegisterPaintBox then
256//    RegisterWSComponent(TPaintBox, TWSPaintBox);
257  Done := True;
258end;
259
260procedure RegisterCustomImage;
261const
262  Done: Boolean = False;
263begin
264  if Done then exit;
265  WSRegisterCustomImage;
266//  if not WSRegisterCustomImage then
267//    RegisterWSComponent(TCustomImage, TWSCustomImage);
268  Done := True;
269end;
270
271procedure RegisterBevel;
272const
273  Done: Boolean = False;
274begin
275  if Done then exit;
276  WSRegisterBevel;
277//  if not WSRegisterBevel then
278//    RegisterWSComponent(TBevel, TWSBevel);
279  Done := True;
280end;
281
282procedure RegisterCustomRadioGroup;
283const
284  Done: Boolean = False;
285begin
286  if Done then exit;
287  WSRegisterCustomRadioGroup;
288//  if not WSRegisterCustomRadioGroup then
289//    RegisterWSComponent(TCustomRadioGroup, TWSCustomRadioGroup);
290  Done := True;
291end;
292
293procedure RegisterCustomCheckGroup;
294const
295  Done: Boolean = False;
296begin
297  if Done then exit;
298  WSRegisterCustomCheckGroup;
299//  if not WSRegisterCustomCheckGroup then
300//    RegisterWSComponent(TCustomCheckGroup, TWSCustomCheckGroup);
301  Done := True;
302end;
303
304procedure RegisterCustomLabeledEdit;
305const
306  Done: Boolean = False;
307begin
308  if Done then exit;
309  WSRegisterCustomLabeledEdit;
310//  if not WSRegisterCustomLabeledEdit then
311//    RegisterWSComponent(TCustomLabeledEdit, TWSCustomLabeledEdit);
312  Done := True;
313end;
314
315procedure RegisterCustomPanel;
316const
317  Done: Boolean = False;
318begin
319  if Done then exit;
320  WSRegisterCustomPanel;
321  RegisterPropertyToSkip(TCustomPanel, 'VerticalAlignment', 'VCL compatibility property', '');
322  RegisterPropertyToSkip(TCustomPanel, 'ExplicitWidth', 'VCL compatibility property', '');
323  RegisterPropertyToSkip(TCustomPanel, 'ShowCaption', 'VCL compatibility property', '');
324  RegisterPropertyToSkip(TCustomPanel, 'ParentBackground', 'VCL compatibility property', '');
325  RegisterPropertyToSkip(TCustomPanel, 'BevelEdges', 'VCL compatibility property', '');
326  RegisterPropertyToSkip(TCustomPanel, 'BevelKind', 'VCL compatibility property', '');
327//  if not WSRegisterCustomPanel then
328//    RegisterWSComponent(TCustomPanel, TWSCustomPanel);
329  Done := True;
330end;
331
332procedure RegisterCustomTrayIcon;
333const
334  Done: Boolean = False;
335begin
336  if Done then exit;
337  if not WSRegisterCustomTrayIcon then
338    RegisterWSComponent(TCustomTrayIcon, TWSCustomTrayIcon);
339  Done := True;
340end;
341
342{ TWSCustomPanel }
343
344class function TWSCustomPanel.GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor;
345begin
346  Result := DefBtnColors[ADefaultColorType];
347end;
348
349end.
350