1{ $Id: wsforms.pp 64612 2021-02-18 01:23:59Z martin $} 2{ 3 ***************************************************************************** 4 * WSForms.pp * 5 * ---------- * 6 * * 7 * * 8 ***************************************************************************** 9 10 ***************************************************************************** 11 This file is part of the Lazarus Component Library (LCL) 12 13 See the file COPYING.modifiedLGPL.txt, included in this distribution, 14 for details about the license. 15 ***************************************************************************** 16} 17unit WSForms; 18 19{$mode objfpc}{$H+} 20{$I lcl_defines.inc} 21 22interface 23//////////////////////////////////////////////////// 24// I M P O R T A N T 25//////////////////////////////////////////////////// 26// 1) Only class methods allowed 27// 2) Class methods have to be published and virtual 28// 3) To get as little as posible circles, the uses 29// clause should contain only those LCL units 30// needed for registration. WSxxx units are OK 31// 4) To improve speed, register only classes in the 32// initialization section which actually 33// implement something 34// 5) To enable your XXX widgetset units, look at 35// the uses clause of the XXXintf.pp 36//////////////////////////////////////////////////// 37uses 38//////////////////////////////////////////////////// 39// To get as little as posible circles, 40// uncomment only when needed for registration 41//////////////////////////////////////////////////// 42 Graphics, Controls, Forms, LCLType, 43//////////////////////////////////////////////////// 44 WSLCLClasses, WSControls, WSFactory; 45 46type 47 { TWSScrollingWinControl } 48 49 TWSScrollingWinControlClass = class of TWSScrollingWinControl; 50 TWSScrollingWinControl = class(TWSWinControl) 51 published 52 // procedure ScrollBy is moved to TWSWinControl. 53 class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override; 54 end; 55 56 { TWSScrollBox } 57 58 TWSScrollBox = class(TWSScrollingWinControl) 59 published 60 end; 61 62 { TWSCustomFrame } 63 64 TWSCustomFrame = class(TWSScrollingWinControl) 65 published 66 end; 67 68 { TWSFrame } 69 70 TWSFrame = class(TWSCustomFrame) 71 published 72 end; 73 74 { TWSCustomForm } 75 76 TWSCustomForm = class(TWSScrollingWinControl) 77 published 78 class procedure CloseModal(const ACustomForm: TCustomForm); virtual; 79 class procedure SetAllowDropFiles(const AForm: TCustomForm; AValue: Boolean); virtual; 80 class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; 81 const Alpha: Byte); virtual; 82 class procedure SetBorderIcons(const AForm: TCustomForm; 83 const ABorderIcons: TBorderIcons); virtual; 84 class procedure SetFormBorderStyle(const AForm: TCustomForm; 85 const AFormBorderStyle: TFormBorderStyle); virtual; 86 class procedure SetFormStyle(const AForm: TCustomform; const AFormStyle, AOldFormStyle: TFormStyle); virtual; 87 class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); virtual; 88 class procedure ShowModal(const ACustomForm: TCustomForm); virtual; 89 class procedure SetModalResult(const ACustomForm: TCustomForm; ANewValue: TModalResult); virtual; 90 class procedure SetRealPopupParent(const ACustomForm: TCustomForm; 91 const APopupParent: TCustomForm); virtual; 92 class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: TShowInTaskbar); virtual; 93 class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual; 94 class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override; 95 class function GetDefaultDoubleBuffered: Boolean; virtual; 96 97 {mdi support} 98 class function ActiveMDIChild(const AForm: TCustomForm): TCustomForm; virtual; 99 class function Cascade(const AForm: TCustomForm): Boolean; virtual; 100 class function GetClientHandle(const AForm: TCustomForm): HWND; virtual; 101 class function GetMDIChildren(const AForm: TCustomForm; AIndex: Integer): TCustomForm; virtual; 102 class function Next(const AForm: TCustomForm): Boolean; virtual; 103 class function Previous(const AForm: TCustomForm): Boolean; virtual; 104 class function Tile(const AForm: TCustomForm): Boolean; virtual; 105 class function MDIChildCount(const AForm: TCustomForm): Integer; virtual; 106 end; 107 TWSCustomFormClass = class of TWSCustomForm; 108 109 { TWSForm } 110 111 TWSForm = class(TWSCustomForm) 112 published 113 end; 114 115 { TWSHintWindow } 116 117 TWSHintWindow = class(TWSCustomForm) 118 published 119 end; 120 121 { TWSScreen } 122 123 TWSScreen = class(TWSLCLComponent) 124 published 125 end; 126 127 { TWSApplicationProperties } 128 129 TWSApplicationProperties = class(TWSLCLComponent) 130 published 131 end; 132 133 { WidgetSetRegistration } 134 135 procedure RegisterScrollingWinControl; 136 procedure RegisterScrollBox; 137 procedure RegisterCustomFrame; 138 procedure RegisterCustomForm; 139 procedure RegisterHintWindow; 140 141implementation 142 143{ TWSScrollingWinControl } 144 145class function TWSScrollingWinControl.GetDefaultColor(const AControl: TControl; 146 const ADefaultColorType: TDefaultColorType): TColor; 147const 148 DefColors: array[TDefaultColorType] of TColor = ( 149 { dctBrush } clForm, 150 { dctFont } clBtnText 151 ); 152begin 153 Result := DefColors[ADefaultColorType]; 154end; 155 156{ TWSCustomForm } 157 158class procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm); 159begin 160end; 161 162class procedure TWSCustomForm.SetAllowDropFiles(const AForm: TCustomForm; 163 AValue: Boolean); 164begin 165end; 166 167class procedure TWSCustomForm.SetBorderIcons(const AForm: TCustomForm; 168 const ABorderIcons: TBorderIcons); 169begin 170end; 171 172class procedure TWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm; 173 const AFormBorderStyle: TFormBorderStyle); 174begin 175 // will be done in interface override 176end; 177 178class procedure TWSCustomForm.SetFormStyle(const AForm: TCustomform; 179 const AFormStyle, AOldFormStyle: TFormStyle); 180begin 181end; 182 183class procedure TWSCustomForm.SetIcon(const AForm: TCustomForm; const Small, Big: HICON); 184begin 185end; 186 187class procedure TWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm; 188 const AValue: TShowInTaskbar); 189begin 190end; 191 192class procedure TWSCustomForm.SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); 193begin 194end; 195 196class function TWSCustomForm.GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; 197const 198 DefColors: array[TDefaultColorType] of TColor = ( 199 { dctBrush } clForm, 200 { dctFont } clBtnText 201 ); 202begin 203 Result := DefColors[ADefaultColorType]; 204end; 205 206class function TWSCustomForm.GetDefaultDoubleBuffered: Boolean; 207begin 208 Result := False; 209end; 210 211class procedure TWSCustomForm.ShowModal(const ACustomForm: TCustomForm); 212begin 213end; 214 215// This needs implementing only if the TWSCustomForm.ShowModal implementation 216// is fully blocking (which it shouldn't be ideally) 217class procedure TWSCustomForm.SetModalResult(const ACustomForm: TCustomForm; 218 ANewValue: TModalResult); 219begin 220end; 221 222class procedure TWSCustomForm.SetRealPopupParent( 223 const ACustomForm: TCustomForm; const APopupParent: TCustomForm); 224begin 225end; 226 227class procedure TWSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm; 228 const AlphaBlend: Boolean; const Alpha: Byte); 229begin 230end; 231 232{ mdi support } 233 234class function TWSCustomForm.ActiveMDIChild(const AForm: TCustomForm 235 ): TCustomForm; 236begin 237 Result := nil; 238end; 239 240class function TWSCustomForm.Cascade(const AForm: TCustomForm): Boolean; 241begin 242 Result := False; 243end; 244 245class function TWSCustomForm.GetClientHandle(const AForm: TCustomForm): HWND; 246begin 247 Result := 0; 248end; 249 250class function TWSCustomForm.GetMDIChildren(const AForm: TCustomForm; 251 AIndex: Integer): TCustomForm; 252begin 253 Result := nil; 254end; 255 256class function TWSCustomForm.MDIChildCount(const AForm: TCustomForm): Integer; 257begin 258 Result := 0; 259end; 260 261class function TWSCustomForm.Next(const AForm: TCustomForm): Boolean; 262begin 263 Result := False; 264end; 265 266class function TWSCustomForm.Previous(const AForm: TCustomForm): Boolean; 267begin 268 Result := False; 269end; 270 271class function TWSCustomForm.Tile(const AForm: TCustomForm): Boolean; 272begin 273 Result := False; 274end; 275 276 277{ WidgetSetRegistration } 278 279procedure RegisterScrollingWinControl; 280const 281 Done: Boolean = False; 282begin 283 if Done then exit; 284 WSRegisterScrollingWinControl; 285// if not WSRegisterScrollingWinControl then 286// RegisterWSComponent(TScrollingWinControl, TWSScrollingWinControl); 287 Done := True; 288end; 289 290procedure RegisterScrollBox; 291const 292 Done: Boolean = False; 293begin 294 if Done then exit; 295 WSRegisterScrollBox; 296// if not WSRegisterScrollBox then 297// RegisterWSComponent(TScrollBox, TWSScrollBox); 298 Done := True; 299end; 300 301procedure RegisterCustomFrame; 302const 303 Done: Boolean = False; 304begin 305 if Done then exit; 306 WSRegisterCustomFrame; 307// if not WSRegisterCustomFrame then 308// RegisterWSComponent(TCustomFrame, TWSCustomFrame); 309 Done := True; 310end; 311 312procedure RegisterCustomForm; 313const 314 Done: Boolean = False; 315begin 316 if Done then exit; 317 WSRegisterCustomForm; 318// if not WSRegisterCustomForm then 319// RegisterWSComponent(TCustomForm, TWSCustomForm); 320 Done := True; 321end; 322 323procedure RegisterHintWindow; 324const 325 Done: Boolean = False; 326begin 327 if Done then exit; 328 WSRegisterHintWindow; 329// if not WSRegisterHintWindow then 330// RegisterWSComponent(THintWindow, TWSHintWindow); 331 Done := True; 332end; 333 334end. 335