lcl: formatting

git-svn-id: trunk@19966 -
This commit is contained in:
paul 2009-05-15 01:57:42 +00:00
parent 2f5429b5b3
commit 3cd340fe31
7 changed files with 52 additions and 44 deletions

View File

@ -2597,13 +2597,14 @@ var
begin begin
Result := nil; Result := nil;
WinControl := FindLCLWindow(Position); WinControl := FindLCLWindow(Position);
if WinControl <> nil if WinControl <> nil then
then begin begin
Result := WinControl; Result := WinControl;
Control := WinControl.ControlAtPos(WinControl.ScreenToClient(Position), Control := WinControl.ControlAtPos(WinControl.ScreenToClient(Position),
[capfAllowDisabled,capfAllowWinControls,capfRecursive]); [capfAllowDisabled,capfAllowWinControls,capfRecursive]);
//debugln(['FindControlAtPosition ',dbgs(Position),' ',DbgSName(WinControl),' ',dbgs(WinControl.ScreenToClient(Position)),' ',DbgSName(Control)]); //debugln(['FindControlAtPosition ',dbgs(Position),' ',DbgSName(WinControl),' ',dbgs(WinControl.ScreenToClient(Position)),' ',DbgSName(Control)]);
if Control <> nil then Result := Control; if Control <> nil then
Result := Control;
end; end;
end; end;

View File

@ -1528,7 +1528,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure NotifyApplicationUserInput(Msg: Cardinal); procedure NotifyApplicationUserInput(Msg: Cardinal);
begin begin
if Application<>nil then if Application <> nil then
Application.NotifyUserInputHandler(Msg); Application.NotifyUserInputHandler(Msg);
end; end;

View File

@ -39,35 +39,38 @@ begin
Result := Control; Result := Control;
while (Result <> nil) and (not Result.ShowHint) do while (Result <> nil) and (not Result.ShowHint) do
Result := Result.Parent; Result := Result.Parent;
if (Result <> nil) if (Result <> nil)and
and ([csDesigning,csDestroying,csLoading]*Result.ComponentState<>[]) then ([csDesigning, csDestroying, csLoading] * Result.ComponentState <> []) then
Result := nil; Result := nil;
end; end;
function GetHintInfoAtMouse: THintInfoAtMouse; function GetHintInfoAtMouse: THintInfoAtMouse;
begin begin
if Mouse<>nil then begin if Mouse <> nil then
Result.MousePos:=Mouse.CursorPos; begin
Result.Control:=GetHintControl(FindControlAtPosition(Result.MousePos, True)); Result.MousePos := Mouse.CursorPos;
Result.Control := GetHintControl(FindControlAtPosition(Result.MousePos, True));
Result.ControlHasHint:= Result.ControlHasHint:=
(Result.Control<>nil) (Result.Control <> nil)
and (Application<>nil) and (Application.ShowHint) and (Application <> nil) and (Application.ShowHint)
and (GetCapture=0) and (GetCapture = 0)
and ((GetKeyState(VK_LBUTTON) and $80)=0) and ((GetKeyState(VK_LBUTTON) and $80) = 0)
and ((GetKeyState(VK_MBUTTON) and $80)=0) and ((GetKeyState(VK_MBUTTON) and $80) = 0)
and ((GetKeyState(VK_RBUTTON) and $80)=0); and ((GetKeyState(VK_RBUTTON) and $80) = 0);
if Result.ControlHasHint then begin if Result.ControlHasHint then
begin
// if there is a modal form, then don't show hints for other forms // if there is a modal form, then don't show hints for other forms
if (Screen.FFocusedForm<>nil) if (Screen.FFocusedForm<>nil)
and (fsModal in Screen.FFocusedForm.FormState) and (fsModal in Screen.FFocusedForm.FormState)
and (GetParentForm(Result.Control)<>Screen.FFocusedForm) and (GetParentForm(Result.Control) <> Screen.FFocusedForm)
then then
Result.ControlHasHint:=false; Result.ControlHasHint := False;
end; end;
end else begin end else
Result.MousePos:=Point(0,0); begin
Result.Control:=nil; Result.MousePos := Point(0, 0);
Result.ControlHasHint:=false; Result.Control := nil;
Result.ControlHasHint := False;
end; end;
end; end;
@ -1405,17 +1408,20 @@ procedure TApplication.NotifyUserInputHandler(Msg: Cardinal);
var var
i: integer; i: integer;
begin begin
FLastMouseControlValid:=false; FLastMouseControlValid := False;
case Msg of case Msg of
LM_MOUSEMOVE: DoOnMouseMove; LM_MOUSEMOVE:
else CancelHint; DoOnMouseMove;
else
CancelHint;
end; end;
if Assigned(FOnUserInput) then FOnUserInput(Self, Msg); if Assigned(FOnUserInput) then
FOnUserInput(Self, Msg);
i:=FApplicationHandlers[ahtUserInput].Count; i := FApplicationHandlers[ahtUserInput].Count;
while FApplicationHandlers[ahtUserInput].NextDownIndex(i) do while FApplicationHandlers[ahtUserInput].NextDownIndex(i) do
TOnUserInputEvent(FApplicationHandlers[ahtUserInput][i])(Self,Msg); TOnUserInputEvent(FApplicationHandlers[ahtUserInput][i])(Self, Msg);
end; end;
procedure TApplication.NotifyKeyDownBeforeHandler(Sender: TObject; procedure TApplication.NotifyKeyDownBeforeHandler(Sender: TObject;

View File

@ -3226,9 +3226,9 @@ begin
{$ENDIF} {$ENDIF}
DoBeforeMouseMessage; DoBeforeMouseMessage;
UpdateMouseCursor(Message.XPos,Message.YPos); UpdateMouseCursor(Message.XPos,Message.YPos);
if not (csNoStdEvents in ControlStyle) if not (csNoStdEvents in ControlStyle) then
then with Message do with Message do
MouseMove(KeystoShiftState(Word(Keys)), XPos, YPos); MouseMove(KeystoShiftState(Word(Keys)), XPos, YPos);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -1074,16 +1074,15 @@ end;
If the mouse is on the top-left pixel of the container widget then the If the mouse is on the top-left pixel of the container widget then the
coordinates can be negative, if there is frame around the client area. coordinates can be negative, if there is frame around the client area.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure DeliverMouseMoveMessage(Widget:PGTKWidget; Event: PGDKEventMotion; procedure DeliverMouseMoveMessage(Widget: PGTKWidget; Event: PGDKEventMotion;
AWinControl: TWinControl); AWinControl: TWinControl);
var var
Msg: TLMMouseMove; Msg: TLMMouseMove;
ShiftState: TShiftState; ShiftState: TShiftState;
MappedXY: TPoint; MappedXY: TPoint;
begin begin
if (Widget=nil) then ; MappedXY := TranslateGdkPointToClientArea(Event^.Window,
MappedXY:=TranslateGdkPointToClientArea(Event^.Window, Point(TruncToInt(Event^.X), TruncToInt(Event^.Y)),
Point(TruncToInt(Event^.X),TruncToInt(Event^.Y)),
PGtkWidget(AWinControl.Handle)); PGtkWidget(AWinControl.Handle));
ShiftState := GTKEventStateToShiftState(Event^.State); ShiftState := GTKEventStateToShiftState(Event^.State);

View File

@ -9727,25 +9727,27 @@ end;
Returns: The handle of the gtkwidget. If none exist, then NULL is returned. Returns: The handle of the gtkwidget. If none exist, then NULL is returned.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TGtkWidgetSet.WindowFromPoint(Point : TPoint) : HWND; function TGtkWidgetSet.WindowFromPoint(Point: TPoint): HWND;
var var
ev : TgdkEvent; ev: TgdkEvent;
Window : PgdkWindow; Window: PgdkWindow;
Widget : PgtkWidget; Widget: PgtkWidget;
p: TPoint; p: TPoint;
begin begin
//DebugLn('WindowFromPoint: ', dbgs(Point));
//DumpStack;
Result := 0; Result := 0;
// !!!gdk_window_at_pointer changes the coordinates!!! // !!!gdk_window_at_pointer changes the coordinates!!!
// -> using local variable p // -> using local variable p
p:=Point; p := Point;
Window := gdk_window_at_pointer(@p.x,@p.Y); Window := gdk_window_at_pointer(@p.x, @p.Y);
if window <> nil then if window <> nil then
begin begin
FillChar(ev,SizeOf(ev),0); FillChar(ev, SizeOf(ev), 0);
ev.any.window := Window; ev.any.window := Window;
Widget := gtk_get_event_widget(@ev); Widget := gtk_get_event_widget(@ev);
Result := PtrUInt(widget); Result := PtrUInt(Widget);
end; end;
end; end;

View File

@ -203,7 +203,7 @@ function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; X
function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override; function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;
function WindowFromPoint(Point : TPoint) : HWND; override; function WindowFromPoint(Point: TPoint): HWND; override;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line //##apiwiz##eps## // Do not remove, no wizard declaration after this line