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
Result := nil;
WinControl := FindLCLWindow(Position);
if WinControl <> nil
then begin
if WinControl <> nil then
begin
Result := WinControl;
Control := WinControl.ControlAtPos(WinControl.ScreenToClient(Position),
[capfAllowDisabled,capfAllowWinControls,capfRecursive]);
//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;

View File

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

View File

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

View File

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

View File

@ -1074,16 +1074,15 @@ end;
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.
-------------------------------------------------------------------------------}
procedure DeliverMouseMoveMessage(Widget:PGTKWidget; Event: PGDKEventMotion;
procedure DeliverMouseMoveMessage(Widget: PGTKWidget; Event: PGDKEventMotion;
AWinControl: TWinControl);
var
Msg: TLMMouseMove;
ShiftState: TShiftState;
MappedXY: TPoint;
begin
if (Widget=nil) then ;
MappedXY:=TranslateGdkPointToClientArea(Event^.Window,
Point(TruncToInt(Event^.X),TruncToInt(Event^.Y)),
MappedXY := TranslateGdkPointToClientArea(Event^.Window,
Point(TruncToInt(Event^.X), TruncToInt(Event^.Y)),
PGtkWidget(AWinControl.Handle));
ShiftState := GTKEventStateToShiftState(Event^.State);

View File

@ -9727,25 +9727,27 @@ end;
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
ev : TgdkEvent;
Window : PgdkWindow;
Widget : PgtkWidget;
ev: TgdkEvent;
Window: PgdkWindow;
Widget: PgtkWidget;
p: TPoint;
begin
//DebugLn('WindowFromPoint: ', dbgs(Point));
//DumpStack;
Result := 0;
// !!!gdk_window_at_pointer changes the coordinates!!!
// -> using local variable p
p:=Point;
Window := gdk_window_at_pointer(@p.x,@p.Y);
p := Point;
Window := gdk_window_at_pointer(@p.x, @p.Y);
if window <> nil then
begin
FillChar(ev,SizeOf(ev),0);
FillChar(ev, SizeOf(ev), 0);
ev.any.window := Window;
Widget := gtk_get_event_widget(@ev);
Result := PtrUInt(widget);
Result := PtrUInt(Widget);
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 WindowFromPoint(Point : TPoint) : HWND; override;
function WindowFromPoint(Point: TPoint): HWND; override;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line