lazarus/lcl/include/customcontrol.inc
2004-01-03 23:15:00 +00:00

160 lines
5.2 KiB
PHP

// included by controls.pp
{******************************************************************************
TCustomControl
******************************************************************************
*****************************************************************************
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.LCL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
}
{------------------------------------------------------------------------------
Method: TCustomControl.Create
Params: none
Returns: Nothing
Constructor for the class.
------------------------------------------------------------------------------}
constructor TCustomControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FCanvas := TControlCanvas.Create;
TControlCanvas(FCanvas).Control := Self;
end;
{------------------------------------------------------------------------------
Method: TCustomControl.Destroy
Params: None
Returns: Nothing
Destructor for the class.
------------------------------------------------------------------------------}
Destructor TCustomControl.Destroy;
begin
FCanvas.Free;
FCanvas:=nil;
inherited Destroy;
end;
procedure TCustomControl.DestroyComponent;
begin
if FCanvas<>nil then
TControlCanvas(FCanvas).FreeHandle;
inherited DestroyComponent;
end;
{------------------------------------------------------------------------------
Method: TCustomControl.Paint
Params: none
Returns: nothing
Default paint handler. Derived classed should paint themselves
------------------------------------------------------------------------------}
Procedure TCustomControl.Paint;
begin
end;
{------------------------------------------------------------------------------
Method: TCustomControl.LMPaint
Params: Msg: The paint message
Returns: nothing
Paint event handler.
------------------------------------------------------------------------------}
procedure TCustomControl.WMPaint(var Message: TLMPaint);
begin
if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
Include(FControlState, csCustomPaint);
inherited WMPaint(Message);
Exclude(FControlState, csCustomPaint);
end;
{------------------------------------------------------------------------------
Method: TCustomControl.PaintWindow
Params: DC: The device context to paint on
Returns: nothing
This is a plug-in in TWinControl to get the DC, assign it to our canvas and
call the paint method for descendents to do the actual painting
------------------------------------------------------------------------------}
procedure TCustomControl.PaintWindow(DC: HDC);
var
DCChanged: boolean;
begin
DCChanged:=(FCanvas.Handle<>DC);
if DCChanged then
FCanvas.Handle := DC;
try
Paint;
finally
if DCChanged then FCanvas.Handle := 0;
end;
end;
// included by controls.pp
{ =============================================================================
$Log$
Revision 1.8 2004/01/03 23:14:59 mattias
default font can now change height and fixed gtk crash
Revision 1.7 2004/01/03 21:06:05 micha
- fix win32/checklistbox
- implement proper lcl to interface move/size notify via setwindowpos
- fix treeview to use inherited canvas from customcontrol
- implement double buffering in win32
Revision 1.6 2003/06/20 12:56:53 mattias
reduced paint messages on destroy
Revision 1.5 2002/08/25 14:32:10 lazarus
MG: calendar now ignores double clicks
Revision 1.4 2002/05/17 10:45:23 lazarus
MG: finddeclaration for stupid things like var a:a;
Revision 1.3 2002/05/10 06:05:51 lazarus
MG: changed license to LGPL
Revision 1.2 2001/03/21 00:20:29 lazarus
MG: fixed memory leaks
Revision 1.1 2000/07/13 10:28:25 michael
+ Initial import
Revision 1.1 2000/04/02 20:49:56 lazarus
MWE:
Moved lazarus/lcl/*.inc files to lazarus/lcl/include
Revision 1.8 1999/12/14 00:16:43 lazarus
MWE:
Renamed LM... message handlers to WM... to be compatible and to
get more edit parts to compile
Started to implement GetSystemMetrics
Removed some Lazarus specific parts from mwEdit
Revision 1.7 1999/12/07 01:19:25 lazarus
MWE:
Removed some double events
Changed location of SetCallBack
Added call to remove signals
Restructured somethings
Started to add default handlers in TWinControl
Made some parts of TControl and TWinControl more delphi compatible
... and lots more ...
}