Implemented mouse wheel events on qt widgetset

git-svn-id: trunk@10549 -
This commit is contained in:
sekelsenmat 2007-01-31 15:10:33 +00:00
parent 4ced1d8d15
commit 7751405e34

View File

@ -70,6 +70,7 @@ type
procedure SlotKey(Event: QEventH); cdecl; procedure SlotKey(Event: QEventH); cdecl;
procedure SlotMouse(Event: QEventH); cdecl; procedure SlotMouse(Event: QEventH); cdecl;
procedure SlotMouseMove(Event: QEventH); cdecl; procedure SlotMouseMove(Event: QEventH); cdecl;
procedure SlotMouseWheel(Event: QEventH); cdecl;
procedure SlotPaint(Event: QEventH); cdecl; procedure SlotPaint(Event: QEventH); cdecl;
procedure SlotResize; cdecl; procedure SlotResize; cdecl;
procedure SlotContextMenu; cdecl; procedure SlotContextMenu; cdecl;
@ -648,6 +649,7 @@ begin
QEventMouseButtonRelease: SlotMouse(Event); QEventMouseButtonRelease: SlotMouse(Event);
QEventMouseButtonDblClick: SlotMouse(Event); QEventMouseButtonDblClick: SlotMouse(Event);
QEventMouseMove: SlotMouseMove(Event); QEventMouseMove: SlotMouseMove(Event);
QEventWheel: SlotMouseWheel(Event);
QEventResize: SlotResize; QEventResize: SlotResize;
QEventPaint: SlotPaint(Event); QEventPaint: SlotPaint(Event);
QEventContextMenu: SlotContextMenu; QEventContextMenu: SlotContextMenu;
@ -688,11 +690,7 @@ begin
Msg.Msg := LM_SHOWWINDOW; Msg.Msg := LM_SHOWWINDOW;
Msg.Show := vShow; Msg.Show := vShow;
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -715,11 +713,7 @@ begin
Msg.Msg := LM_CLOSEQUERY; Msg.Msg := LM_CLOSEQUERY;
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -741,11 +735,7 @@ begin
Msg.Msg := LM_DESTROY; Msg.Msg := LM_DESTROY;
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -766,11 +756,8 @@ begin
if FocusIn then Msg.Msg := LM_SETFOCUS if FocusIn then Msg.Msg := LM_SETFOCUS
else Msg.Msg := LM_KILLFOCUS; else Msg.Msg := LM_KILLFOCUS;
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
end;
{$ifdef VerboseFocus} {$ifdef VerboseFocus}
WriteLn('TQtWidget.SlotFocus END'); WriteLn('TQtWidget.SlotFocus END');
{$endif} {$endif}
@ -961,11 +948,37 @@ begin
Msg.Msg := LM_MOUSEMOVE; Msg.Msg := LM_MOUSEMOVE;
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg)); end;
except
Application.HandleException(nil); {------------------------------------------------------------------------------
end; Function: TQtWidget.SlotMouseWheel
Params: None
Returns: Nothing
Qt stores the delta in 1/8 of a degree
Most mouses scroll 15 degrees each time
Msg.WheelData: -1 for up, 1 for down
------------------------------------------------------------------------------}
procedure TQtWidget.SlotMouseWheel(Event: QEventH); cdecl;
var
Msg: TLMMouseEvent;
MousePos: TPoint;
begin
FillChar(Msg, SizeOf(Msg), #0);
MousePos := QWheelEvent_pos(QWheelEventH(Event))^;
Msg.Msg := LM_MOUSEWHEEL;
Msg.X := SmallInt(MousePos.X);
Msg.Y := SmallInt(MousePos.Y);
Msg.WheelDelta := QWheelEvent_delta(QWheelEventH(Event)) div 120;
NotifyApplicationUserInput(Msg.Msg);
DeliverMessage(Msg);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -1045,11 +1058,7 @@ begin
Msg.Width := QWidget_width(Widget); Msg.Width := QWidget_width(Widget);
Msg.Height := QWidget_height(Widget); Msg.Height := QWidget_height(Widget);
try DeliverMessage(Msg);
LCLObject.WindowProc(TLMessage(Msg));
except
Application.HandleException(nil);
end;
end; end;
procedure TQtWidget.SlotContextMenu; cdecl; procedure TQtWidget.SlotContextMenu; cdecl;