- vary widget default cursors (default edit cursor is IBeam, others are arrow)
- remove unused cursor map global variable and related stuff

git-svn-id: trunk@12039 -
This commit is contained in:
paul 2007-09-16 05:42:37 +00:00
parent 48565b37bf
commit d762d100d9
9 changed files with 39 additions and 16 deletions

View File

@ -299,7 +299,8 @@ type
ExStyle: Integer;
EventMask: TGdkEventMask;
DoubleBuffer: PGdkPixmap;
ControlCursor: HCursor; // cursor, that control contain
ControlCursor: HCursor; // current widget cursor
DefaultCursor: HCursor; // default widget cursor
Flags: TWidgetInfoFlags;
ChangeLock: Integer; // lock events
DataOwner: Boolean; // Set if the UserData should be freed when the info is freed

View File

@ -86,11 +86,6 @@ const
var
LastLeft, LastMiddle, LastRight: TLastMouseClick;
// mouse cursors
var
// Map a TCursor (<= 0 = HCursor) or a HCursor to a PGDKCursor
MMouseCursorMap: TMap;
{$IFDEF Gtk2}
var
im_context: PGtkIMContext = nil;

View File

@ -404,9 +404,6 @@ begin
ClipboardTargetEntryCnt[c]:=0;
end;
// mouse cursors
MMouseCursorMap := TMap.Create(its2, SizeOf(PGDKCursor));
// charset encodings
{$IFDEF Gtk1}
Lang := SysUtils.GetEnvironmentVariable('LC_ALL');
@ -449,8 +446,6 @@ begin
CharSetEncodingList.Free;
CharSetEncodingList:=nil;
end;
FreeAndNil(MMouseCursorMap);
end;

View File

@ -31,6 +31,11 @@ begin
SetWindowCursor(Window, AInfo^.ControlCursor, not (csAcceptsControls in TControl(AInfo^.LCLObject).ControlStyle));
end;
class procedure TGtkPrivateWidget.SetDefaultCursor(AInfo: PWidgetInfo);
begin
AInfo^.DefaultCursor := Screen.Cursors[crDefault];
end;
class procedure TGtkPrivateWidget.SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition);
var
Widget: PGtkWidget;
@ -65,3 +70,11 @@ begin
SetWindowCursor(Window, AInfo^.ControlCursor, False);
end;
{ TGtkPrivateEntry }
class procedure TGtkPrivateEntry.SetDefaultCursor(AInfo: PWidgetInfo);
begin
AInfo^.DefaultCursor := Screen.Cursors[crIBeam];
end;

View File

@ -4153,6 +4153,7 @@ begin
New(Result);
FillChar(Result^, SizeOf(Result^), 0);
gtk_object_set_data(AWidget, 'widgetinfo', Result);
Result^.DefaultCursor := HCursor(-1);
end;
end;

View File

@ -8356,7 +8356,8 @@ var
end;
// no lcl cursor, so reset to default
gdk_window_set_cursor(AWindow, PGdkCursor(DefaultCursor));
//gdk_window_set_cursor(AWindow, PGdkCursor(DefaultCursor));
SetWindowCursor(AWindow, DefaultCursor, True);
end;
procedure Traverse(AWindow: PGDKWindow);

View File

@ -36,7 +36,7 @@ uses
{$ENDIF}
SysUtils, Classes, Controls, LMessages, InterfaceBase,
WSControls, WSLCLClasses, WSProc,
Graphics, ComCtrls, LCLType,
Graphics, ComCtrls, Forms, LCLType,
GTKWSPrivate,
{$ifdef gtk1}
GTK1WSPrivate,
@ -376,8 +376,16 @@ begin
then Exit;
WidgetInfo := GetWidgetInfo(Pointer(AWinControl.Handle));
if WidgetInfo^.ControlCursor = ACursor then Exit;
WidgetInfo^.ControlCursor := ACursor;
if (WidgetInfo^.ControlCursor = ACursor) and
(WidgetInfo^.DefaultCursor <> HCursor(-1)) then Exit;
if ACursor <> Screen.Cursors[crDefault] then
WidgetInfo^.ControlCursor := ACursor
else
begin
if WidgetInfo^.DefaultCursor = HCursor(-1) then
TGtkPrivateWidgetClass(AWinControl.WidgetSetClass.WSPrivate).SetDefaultCursor(WidgetInfo);
WidgetInfo^.ControlCursor := WidgetInfo^.DefaultCursor;
end;
TGtkPrivateWidgetClass(AWinControl.WidgetSetClass.WSPrivate).UpdateCursor(WidgetInfo);
end;

View File

@ -66,10 +66,19 @@ type
public
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual;
class procedure UpdateCursor(AInfo: PWidgetInfo); virtual;
class procedure SetDefaultCursor(AInfo: PWidgetInfo); virtual;
end;
TGtkPrivateWidgetClass = class of TGtkPrivateWidget;
{ TGtkPrivateEntry }
{ Private class for gtkentries (text fields) }
TGtkPrivateEntry = class(TGtkPrivateWidget)
private
protected
public
class procedure SetDefaultCursor(AInfo: PWidgetInfo); override;
end;
{ TGtkPrivateContainer }
{ Private class for gtkcontainers }

View File

@ -1545,7 +1545,7 @@ initialization
// RegisterWSComponent(TComboBox, TGtkWSComboBox);
RegisterWSComponent(TCustomListBox, TGtkWSCustomListBox, TGtkPrivateScrolling);
// RegisterWSComponent(TListBox, TGtkWSListBox);
RegisterWSComponent(TCustomEdit, TGtkWSCustomEdit);
RegisterWSComponent(TCustomEdit, TGtkWSCustomEdit, TGtkPrivateEntry);
RegisterWSComponent(TCustomMemo, TGtkWSCustomMemo, TGtkPrivateScrolling);
// RegisterWSComponent(TButtonControl, TGtkWSButtonControl);
{$ifdef gtk1}