fix (lm_)setcursor changes for gtk target

git-svn-id: trunk@5402 -
This commit is contained in:
micha 2004-04-11 18:58:26 +00:00
parent 2601703379
commit b4c61fa97d
7 changed files with 33 additions and 21 deletions

View File

@ -281,8 +281,8 @@ type
procedure WMMouseWheel(var Msg: TLMMouseEvent); message LM_MOUSEWHEEL;
{$ELSE}
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
{$ENDIF}
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
{$ENDIF}
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
@ -7031,6 +7031,9 @@ begin
Result := FALSE;
end;
{$IFNDEF SYN_LAZARUS}
{ LCL never sends WM_SETCURSOR messages, use OnMouseMove and then set cursor }
procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor);
var
ptCursor, ptLineCol: TPoint;
@ -7038,29 +7041,23 @@ begin
GetCursorPos(ptCursor);
ptCursor := ScreenToClient(ptCursor);
if (ptCursor.X < fGutterWidth) then
{$IFNDEF SYN_LAZARUS}
// ToDo TStreenCursors
SetCursor(Screen.Cursors[fGutter.Cursor])
{$ENDIF}
else begin
ptLineCol.X := (LeftChar * fCharWidth + ptCursor.X - fGutterWidth - 2)
div fCharWidth;
ptLineCol.Y := TopLine + ptCursor.Y div fTextHeight;
if (eoDragDropEditing in fOptions) and IsPointInSelection(ptLineCol) then
{$IFNDEF SYN_LAZARUS}
// ToDo TStreenCursors
SetCursor(Screen.Cursors[crDefault])
{$ENDIF}
else
{$IFNDEF SYN_LAZARUS}
// ToDo WMSetCursor
inherited WMSetCursor(Msg);
{$ELSE}
;
{$ENDIF}
end;
end;
{$endif}
procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject);
begin
InvalidateGutter;

View File

@ -1369,8 +1369,8 @@ begin
FHintTimer.Enabled := False;
// hide hint
FHintTimer.Enabled :=
(TheMessage.keys or (MK_LButton and MK_RButton and MK_MButton) = 0);
// FHintTimer.Enabled :=
// (TheMessage.keys or (MK_LButton and MK_RButton and MK_MButton) = 0);
if FHintWindow.Visible then
FHintWindow.Visible := False;
end;

View File

@ -245,7 +245,7 @@ begin
end;
if TheWinControl<>nil then begin
SetCursor(TheWinControl, nil);
SetCursor(TheWinControl, crDefault);
ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
{$IFDEF CustomFonts}
ModifyWidgetStyle(TheWinControl,Widget);
@ -3070,6 +3070,9 @@ end;
{ =============================================================================
$Log$
Revision 1.226 2004/04/11 18:58:25 micha
fix (lm_)setcursor changes for gtk target
Revision 1.225 2004/04/09 11:25:20 mattias
changed OnKeyPress keys are not delegated back to the gtk

View File

@ -3147,8 +3147,6 @@ begin
ShowHide(Sender);
end;
LM_SetCursor : gtkproc.SetCursor(TWinControl(Sender), Data);
LM_SetLabel : SetLabel(Sender,Data);
LM_GETVALUE : Result := GetValue(Sender, data);
@ -3163,7 +3161,7 @@ begin
begin
// change cursor
if Sender is TWinControl then
gtkproc.SetCursor(TWinControl(Sender), Data);
gtkproc.SetCursor(TWinControl(Sender), TCursor(Data));
end;
LM_RECREATEWND : Result := RecreateWnd(sender);
@ -9384,6 +9382,9 @@ end;
{ =============================================================================
$Log$
Revision 1.494 2004/04/11 18:58:25 micha
fix (lm_)setcursor changes for gtk target
Revision 1.493 2004/04/09 22:59:09 mattias
fixed mem leak in CreateFilter menu items for file dialog

View File

@ -3412,7 +3412,7 @@ end;
Sets the cursor for a widget.
------------------------------------------------------------------------------}
procedure SetCursor(AWinControl : TWinControl; Data: Pointer);
procedure SetCursor(AWinControl : TWinControl; ACursor: TCursor);
procedure DoSetCursor(AWindow: PGdkWindow; Cursor: pGDKCursor);
begin
@ -3451,10 +3451,10 @@ begin
AWindow:=GetControlWindow(AWidget);
if AWindow = nil then exit;
if Data = nil then
if ACursor = crDefault then
SetCursorRecursive(AWindow, GetGDKMouseCursor(crDefault))
else begin
NewCursor:= GetGDKMouseCursor(Integer(Data));
NewCursor:= GetGDKMouseCursor(ACursor);
if NewCursor <> nil then SetCursorRecursive(AWindow, NewCursor);
end;
@ -6747,6 +6747,9 @@ end;
{ =============================================================================
$Log$
Revision 1.275 2004/04/11 18:58:26 micha
fix (lm_)setcursor changes for gtk target
Revision 1.274 2004/04/08 18:27:51 mattias
fixed memleak in TDefaultComponentEditor.Edit

View File

@ -416,7 +416,7 @@ function GetWidgetOrigin(TheWidget: PGtkWidget): TPoint;
function GetWidgetClientOrigin(TheWidget: PGtkWidget): TPoint;
function TranslateGdkPointToClientArea(SourceWindow: PGdkWindow;
SourcePos: TPoint; DestinationWidget: PGtkWidget): TPoint;
procedure SetCursor(AWinControl: TWinControl; Data: Pointer);
procedure SetCursor(AWinControl: TWinControl; ACursor: TCursor);
// mouse capturing
procedure CaptureMouseForWidget(Widget: PGtkWidget; Owner: TMouseCaptureType);

View File

@ -34,7 +34,7 @@ uses
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
// Controls,
Controls,
////////////////////////////////////////////////////
Classes, LMessages,
WSControls, WSLCLClasses;
@ -55,6 +55,7 @@ type
private
protected
public
class procedure SetCursor(AControl: TControl; ACursor: TCursor); override;
end;
{ TGtkWSWinControl }
@ -96,6 +97,13 @@ implementation
uses
GtkProc, GtkDef, GtkInt;
{ TGtkWSControl }
procedure TGtkWSControl.SetCursor(AControl: TControl; ACursor: TCursor);
begin
{ TODO: Dangerous cast here! TControl.SetCursor exists }
gtkproc.SetCursor(AControl as TWinControl, ACursor);
end;
{ TGtkWSWinControl }
@ -131,7 +139,7 @@ initialization
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TDragImageList, TGtkWSDragImageList);
// RegisterWSComponent(TControl, TGtkWSControl);
RegisterWSComponent(TControl, TGtkWSControl);
// RegisterWSComponent(TWinControl, TGtkWSWinControl);
// RegisterWSComponent(TGraphicControl, TGtkWSGraphicControl);
// RegisterWSComponent(TCustomControl, TGtkWSCustomControl);