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
|
{
/***************************************************************************
wsproc.pp
---------
Widgetset Utility Code
***************************************************************************/
*****************************************************************************
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.
*****************************************************************************
Useful lower level helper functions and classes for implementing widgetsets.
}
unit WSProc;
{$mode objfpc}{$H+}
{$I lcl_defines.inc}
interface
uses
LCLClasses, LCLProc, Controls, Menus, LazLoggerBase;
function WSCheckReferenceAllocated(const AComponent: TLCLReferenceComponent;
const AProcName: String): Boolean;
function WSCheckHandleAllocated(const AWincontrol: TWinControl;
const AProcName: String): Boolean;
function WSCheckHandleAllocated(const AMenu: TMenu;
const AProcName: String): Boolean;
implementation
function WSCheckReferenceAllocated(const AComponent: TLCLReferenceComponent;
const AProcName: String): Boolean;
procedure Warn;
begin
LazLoggerBase.DebugLn('[WARNING] %s called without reference for %s(%s)', [AProcName, AComponent.Name, AComponent.ClassName]);
end;
begin
Result := AComponent.ReferenceAllocated;
if Result then Exit;
Warn;
end;
function WSCheckHandleAllocated(const AWincontrol: TWinControl;
const AProcName: String): Boolean;
procedure Warn;
begin
LazLoggerBase.DebugLn('[WARNING] %s called without handle for %s(%s)', [AProcName, AWincontrol.Name, AWincontrol.ClassName]);
end;
begin
Result := AWinControl.HandleAllocated;
if Result then Exit;
Warn;
end;
function WSCheckHandleAllocated(const AMenu: TMenu;
const AProcName: String): Boolean;
procedure Warn;
begin
LazLoggerBase.DebugLn('[WARNING] %s called without handle for %s(%s)', [AProcName, AMenu.Name, AMenu.ClassName]);
end;
begin
Result := AMenu.HandleAllocated;
if Result then Exit;
Warn;
end;
end.
|