mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:39:09 +02:00
+ added track progress
git-svn-id: trunk@7939 -
This commit is contained in:
parent
0ca23e391d
commit
ddb2cdee81
@ -53,6 +53,13 @@ begin
|
|||||||
DeliverMessage(AInfo^.LCLObject, Msg);
|
DeliverMessage(AInfo^.LCLObject, Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CarbonPrivateHIView_MouseMove(ANextHandler: EventHandlerCallRef;
|
||||||
|
AEvent: EventRef;
|
||||||
|
AInfo: PWidgetInfo): OSStatus; mwpascal;
|
||||||
|
begin
|
||||||
|
WriteLN('MouseMove');
|
||||||
|
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
@ -88,6 +95,12 @@ begin
|
|||||||
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_Hit),
|
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_Hit),
|
||||||
1, @TmpSpec, Pointer(AInfo), nil);
|
1, @TmpSpec, Pointer(AInfo), nil);
|
||||||
|
|
||||||
|
MouseSpec[0] := MakeEventSpec(kEventClassMouse, kEventMouseMoved);
|
||||||
|
MouseSpec[1] := MakeEventSpec(kEventClassMouse, kEventMouseDragged);
|
||||||
|
|
||||||
|
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_MouseMove),
|
||||||
|
2, @MouseSpec[0], Pointer(AInfo), nil);
|
||||||
|
|
||||||
// InstallControlHandler(AInfo, kEventClassControl, kEventControlDispose, RegisterEventHandler(@CarbonWSWinControl_Dispose));
|
// InstallControlHandler(AInfo, kEventClassControl, kEventControlDispose, RegisterEventHandler(@CarbonWSWinControl_Dispose));
|
||||||
// InstallControlHandler(AInfo, kEventClassControl, kEventControlHit, @CarbonWSWinControl_Hit, MCarbonWSWinControl_Hit_UPP);
|
// InstallControlHandler(AInfo, kEventClassControl, kEventControlHit, @CarbonWSWinControl_Hit, MCarbonWSWinControl_Hit_UPP);
|
||||||
DebugLN(TWinControl(Ainfo^.LCLObject).Name,':', TWinControl(Ainfo^.LCLObject).ClassName ,' Events set')
|
DebugLN(TWinControl(Ainfo^.LCLObject).Name,':', TWinControl(Ainfo^.LCLObject).ClassName ,' Events set')
|
||||||
|
@ -60,19 +60,46 @@ end;
|
|||||||
|
|
||||||
//Generic function that handles all types of mouse events
|
//Generic function that handles all types of mouse events
|
||||||
|
|
||||||
|
procedure TrackProgress(AControl: ControlRef; APartCode: ControlPartCode); mwpascal;
|
||||||
|
var
|
||||||
|
Modifiers, ButtonState: UInt32;
|
||||||
|
MousePoint: HIPoint;
|
||||||
|
pt: FPCMacOSAll.Point;
|
||||||
|
|
||||||
|
begin
|
||||||
|
GetGlobalMouse(Pt);
|
||||||
|
MousePoint.X := pt.h;
|
||||||
|
MousePoint.Y := pt.v;
|
||||||
|
// todo, convert to correct co-ordinates
|
||||||
|
HIViewConvertPoint(MousePoint, nil, AControl);
|
||||||
|
Modifiers := GetCurrentKeyModifiers;
|
||||||
|
ButtonState := GetCurrentButtonState;
|
||||||
|
|
||||||
|
DebugLn('-- track, x:%d, y:%d, m:0x%x, b:0x%x', [Round(MousePoint.X), Round(MousePoint.Y), Modifiers, ButtonState]);
|
||||||
|
end;
|
||||||
|
|
||||||
function CarbonPrivateWindow_ControlTrack(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateWindow_ControlTrack(ANextHandler: EventHandlerCallRef;
|
||||||
AEvent: EventRef;
|
AEvent: EventRef;
|
||||||
AInfo: PWidgetInfo): OSStatus; mwpascal;
|
AInfo: PWidgetInfo): OSStatus; mwpascal;
|
||||||
var
|
var
|
||||||
Modifiers: UInt32;
|
Modifiers, ButtonState: UInt32;
|
||||||
MousePoint: HIPoint;//QDPoint;
|
MousePoint: HIPoint;//QDPoint;
|
||||||
|
ActionUPP, OldActionUPP: ControlActionUPP;
|
||||||
begin
|
begin
|
||||||
|
DebugLn('-- Control track A');
|
||||||
GetEventParameter(AEvent, kEventParamKeyModifiers, typeUInt32, nil, SizeOf(Modifiers), nil, @Modifiers);
|
GetEventParameter(AEvent, kEventParamKeyModifiers, typeUInt32, nil, SizeOf(Modifiers), nil, @Modifiers);
|
||||||
GetEventParameter(AEvent, kEventParamMouseLocation, typeHIPoint, nil, SizeOf(MousePoint), nil, @MousePoint);
|
GetEventParameter(AEvent, kEventParamWindowMouseLocation, typeHIPoint, nil, SizeOf(MousePoint), nil, @MousePoint);
|
||||||
|
GetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, nil, sizeof(ActionUPP), nil, @OldActionUPP);
|
||||||
|
ButtonState := GetCurrentEventButtonState;
|
||||||
|
|
||||||
|
ActionUPP := NewControlActionUPP(@TrackProgress);
|
||||||
|
SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, sizeof(ActionUPP), @ActionUPP);
|
||||||
|
|
||||||
Result := CallNextEventHandler(ANextHandler, AEvent);
|
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||||
DebugLn('Control track, x:%d, y:%d, m:0x%x', [Round(MousePoint.X), Round(MousePoint.Y), Modifiers]);
|
SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, sizeof(OldActionUPP), @OldActionUPP);
|
||||||
|
DisposeControlActionUPP(ActionUPP);
|
||||||
|
|
||||||
|
DebugLn('-- Control track B, x:%d, y:%d, m:0x%x, b:0x%x', [Round(MousePoint.X), Round(MousePoint.Y), Modifiers, ButtonState]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CarbonPrivateWindow_MouseProc(ANextHandler: EventHandlerCallRef;
|
function CarbonPrivateWindow_MouseProc(ANextHandler: EventHandlerCallRef;
|
||||||
@ -131,6 +158,7 @@ var
|
|||||||
pt: FPCMacOSAll.Point;
|
pt: FPCMacOSAll.Point;
|
||||||
mtr: MouseTrackingResult;
|
mtr: MouseTrackingResult;
|
||||||
begin
|
begin
|
||||||
|
DebugLN('-- mouse down --');
|
||||||
Msg := @AMsg;
|
Msg := @AMsg;
|
||||||
|
|
||||||
ClickCount := GetClickCount;
|
ClickCount := GetClickCount;
|
||||||
@ -151,14 +179,14 @@ var
|
|||||||
//LMMouse.Keys;
|
//LMMouse.Keys;
|
||||||
{$Warning CarbonPrivateWindow_MouseProc LMMouse.Keys TODO}
|
{$Warning CarbonPrivateWindow_MouseProc LMMouse.Keys TODO}
|
||||||
|
|
||||||
// Spec := MakeEventSpec(kEventClassControl, kEventControlTrack);
|
Spec := MakeEventSpec(kEventClassControl, kEventControlTrack);
|
||||||
// InstallControlEventHandler(Control, RegisterEventHandler(@CarbonPrivateWindow_ControlTrack),
|
InstallControlEventHandler(Control, RegisterEventHandler(@CarbonPrivateWindow_ControlTrack),
|
||||||
// 1, @Spec, nil, nil);
|
1, @Spec, nil, nil);
|
||||||
|
|
||||||
repeat
|
// repeat
|
||||||
TrackMouseLocation(nil, Pt, mtr);
|
// TrackMouseLocation(nil, Pt, mtr);
|
||||||
DebugLn('Mouse track, x:%d, y:%d, m:0x%x', [Round(pt.h), Round(pt.v), mtr]);
|
// DebugLn('Mouse track, x:%d, y:%d, m:0x%x', [Round(pt.h), Round(pt.v), mtr]);
|
||||||
until mtr = kMouseTrackingMouseUp;
|
// until mtr = kMouseTrackingMouseUp;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -170,6 +198,7 @@ var
|
|||||||
MousePoint: TPoint;
|
MousePoint: TPoint;
|
||||||
Msg: ^TLMMouse;
|
Msg: ^TLMMouse;
|
||||||
begin
|
begin
|
||||||
|
DebugLN('-- mouse up --');
|
||||||
// this is not called if NextHandler is called on MouseDown
|
// this is not called if NextHandler is called on MouseDown
|
||||||
// perhaps mousetracking can fix this
|
// perhaps mousetracking can fix this
|
||||||
Msg := @AMsg;
|
Msg := @AMsg;
|
||||||
@ -192,6 +221,7 @@ var
|
|||||||
MousePoint: TPoint;
|
MousePoint: TPoint;
|
||||||
MSg: ^TLMMouseMove;
|
MSg: ^TLMMouseMove;
|
||||||
begin
|
begin
|
||||||
|
DebugLN('-- mouse move --');
|
||||||
Msg := @AMsg;
|
Msg := @AMsg;
|
||||||
|
|
||||||
MousePoint := GetMousePoint;
|
MousePoint := GetMousePoint;
|
||||||
@ -203,11 +233,13 @@ var
|
|||||||
|
|
||||||
procedure HandleMouseDraggedEvent(var AMsg);
|
procedure HandleMouseDraggedEvent(var AMsg);
|
||||||
begin
|
begin
|
||||||
|
DebugLN('-- mouse dragged --');
|
||||||
//TODO
|
//TODO
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure HandleMouseWheelEvent(var AMsg);
|
procedure HandleMouseWheelEvent(var AMsg);
|
||||||
begin
|
begin
|
||||||
|
DebugLN('-- mouse wheel --');
|
||||||
//TODO should be simple
|
//TODO should be simple
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user