MG: MoveWindowOrgEx, Splitted FWinControls/FControls, TControl drawing, Better DesignerDrawing, ...

git-svn-id: trunk@2313 -
This commit is contained in:
lazarus 2002-08-17 23:41:15 +00:00
parent 214b874f65
commit f05e7890e9

View File

@ -38,7 +38,7 @@ begin
FGlyph.OnChange := @GlyphChanged; FGlyph.OnChange := @GlyphChanged;
SetBounds(0, 0, 23, 22); SetBounds(0, 0, 23, 22);
ControlStyle := [csCaptureMouse, csDoubleClicks]; ControlStyle := ControlStyle + [csCaptureMouse] - [csSetCaption];
{set default alignment} {set default alignment}
Align := alNone; Align := alNone;
@ -302,7 +302,7 @@ begin
BrushStyle:= bsSolid;} BrushStyle:= bsSolid;}
DrawFlags:=DFCS_BUTTONPUSH; DrawFlags:=DFCS_BUTTONPUSH;
if Flat then inc(DrawFlags,DFCS_FLAT); if Flat and (not (csDesigning in ComponentState)) then inc(DrawFlags,DFCS_FLAT);
if FState in [bsDown, bsExclusive] then inc(DrawFlags,DFCS_PUSHED); if FState in [bsDown, bsExclusive] then inc(DrawFlags,DFCS_PUSHED);
if FMouseInControl then inc(DrawFlags,DFCS_CHECKED); if FMouseInControl then inc(DrawFlags,DFCS_CHECKED);
if not Enabled then inc(DrawFlags,DFCS_INACTIVE); if not Enabled then inc(DrawFlags,DFCS_INACTIVE);
@ -421,13 +421,10 @@ procedure TSpeedButton.UpdateTracking;
var var
P : TPoint; P : TPoint;
begin begin
Assert(False,'Trace:[Update Tracking]');
if FFlat and Enabled if FFlat and Enabled
then begin then begin
GetCursorPos(p); GetCursorPos(p);
FMouseInControl := not (FindDragTarget(P, True) = Self); FMouseInControl := not (FindDragTarget(P, True) = Self);
Assert(False, Format('Trace:[TSpeedButton.UpdateTracking] ParentHandle: 0x%x', [Integer(self.parent.handle)]));
if FMouseInControl if FMouseInControl
then Perform(CM_MOUSELEAVE,0,0) then Perform(CM_MOUSELEAVE,0,0)
else Perform(CM_MOUSEENTER,0,0); else Perform(CM_MOUSEENTER,0,0);
@ -445,13 +442,13 @@ end;
procedure TSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure TSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin begin
inherited MouseDown(Button, Shift, X, Y); inherited MouseDown(Button, Shift, X, Y);
if csDesigning in ComponentState then exit; if csDesigning in ComponentState then exit;
if (Button = mbLeft) and Enabled if (Button = mbLeft) and Enabled
then begin then begin
Assert(False,'Trace:[TSpeedButton.MouseDown] Checking FDown');
if not FDown if not FDown
then begin then begin
Assert(False,'Trace:[TSpeedButton.MouseDown] It wasn''t down, so now it will display it down!');
FState := bsDown; FState := bsDown;
Invalidate; Invalidate;
end; end;
@ -470,23 +467,25 @@ procedure TSpeedButton.MouseMove(Shift: TShiftState; X, Y: Integer);
var var
NewState: TButtonState; NewState: TButtonState;
begin begin
Assert(False,Format('Trace:[TSpeedButton.MouseMove] X:%d Y:%d', [X, Y]));
inherited MouseMove(Shift, X, Y); inherited MouseMove(Shift, X, Y);
if csDesigning in ComponentState then exit; if csDesigning in ComponentState then exit;
if FDragging if FDragging
then begin then begin
Assert(False,'Trace:FDragging is true'); Assert(False,'Trace:FDragging is true');
if not FDown if not FDown then
then NewState := bsUp NewState := bsUp
else NewState := bsExclusive; else
NewState := bsExclusive;
if (X >= 0) and (X < ClientWidth) if (X >= 0) and (X < Width)
and (Y >= 0) and (Y <= ClientHeight) and (Y >= 0) and (Y < Height)
then begin then begin
if FDown if FDown then
then NewState := bsExclusive NewState := bsExclusive
else NewState := bsDown; else
NewState := bsDown;
end; end;
if NewState <> FState if NewState <> FState
@ -518,14 +517,14 @@ procedure TSpeedButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
var var
DoClick: Boolean; DoClick: Boolean;
begin begin
writeln('TSpeedButton.MouseUp A ',Name);
Assert(False,'Trace:TSPEEDBUTTON.MOUSEUP');
inherited MouseUp(Button, Shift, X, Y); inherited MouseUp(Button, Shift, X, Y);
if csDesigning in ComponentState then exit; if csDesigning in ComponentState then exit;
if FDragging if FDragging
then begin then begin
FDragging := False; FDragging := False;
DoClick := (X >= 0) and (X < ClientWidth) and (Y >= 0) and (Y <= ClientHeight); DoClick := (X >= 0) and (X < Width) and (Y >= 0) and (Y <= Height);
if FGroupIndex = 0 if FGroupIndex = 0
then begin then begin
@ -548,7 +547,6 @@ writeln('TSpeedButton.MouseUp A ',Name);
if DoClick then Click; if DoClick then Click;
UpdateTracking; UpdateTracking;
end; end;
writeln('TSpeedButton.MouseUp B ',Name);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -631,11 +629,10 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TSpeedButton.CMMouseEnter(var Message :TLMessage); procedure TSpeedButton.CMMouseEnter(var Message :TLMessage);
begin begin
Assert(False,'Trace:[TSpeedButton.CMMouseEnter]');
inherited CMMouseEnter(Message); inherited CMMouseEnter(Message);
if csDesigning in ComponentState then exit; if csDesigning in ComponentState then exit;
if {FFlat and }not FMouseInControl if {FFlat and }not FMouseInControl
and Enabled and (GetCapture = 0) and Enabled and (GetCapture = 0)
then begin then begin
@ -652,15 +649,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TSpeedButton.CMMouseLeave(var Message :TLMessage); procedure TSpeedButton.CMMouseLeave(var Message :TLMessage);
begin begin
Assert(False,'Trace:[TSpeedButton.CMMouseLeave]');
inherited CMMouseLeave(Message); inherited CMMouseLeave(Message);
if csDesigning in ComponentState then exit; if csDesigning in ComponentState then exit;
if {FFlat and }FMouseInControl if {FFlat and }FMouseInControl
and Enabled and not FDragging and Enabled and not FDragging
then begin then begin
FMouseInCOntrol := False; FMouseInControl := False;
Invalidate; Invalidate;
end; end;
end; end;
@ -674,6 +670,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.21 2002/08/30 12:32:21 lazarus
MG: MoveWindowOrgEx, Splitted FWinControls/FControls, TControl drawing, Better DesignerDrawing, ...
Revision 1.20 2002/08/27 06:34:26 lazarus Revision 1.20 2002/08/27 06:34:26 lazarus
MG: fixed codetools proc collection MG: fixed codetools proc collection