MG: fixed get widget position for inherited gdkwindows

git-svn-id: trunk@1791 -
This commit is contained in:
lazarus 2002-07-23 07:40:52 +00:00
parent f51257b9c9
commit a7c6ec0711
6 changed files with 102 additions and 92 deletions

View File

@ -1147,7 +1147,7 @@ begin
Add(C,'Jump forward',ecJumpForward,VK_H,[ssCtrl,ssShift],VK_UNKNOWN,[]); Add(C,'Jump forward',ecJumpForward,VK_H,[ssCtrl,ssShift],VK_UNKNOWN,[]);
Add(C,'Add jump point',ecAddJumpPoint,VK_UNKNOWN,[],VK_UNKNOWN,[]); Add(C,'Add jump point',ecAddJumpPoint,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add(C,'View jump history',ecViewJumpHistory,VK_UNKNOWN,[],VK_UNKNOWN,[]); Add(C,'View jump history',ecViewJumpHistory,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add(C,'Open file at cursor',ecOpenFileAtCursor,VK_UNKNOWN,[],VK_UNKNOWN,[]); Add(C,'Open file at cursor',ecOpenFileAtCursor,VK_RETURN,[ssCtrl],VK_UNKNOWN,[]);
// marker // marker
C:=Categories[AddCategory('Marker','Marker commands')]; C:=Categories[AddCategory('Marker','Marker commands')];

View File

@ -20,7 +20,7 @@ begin
if assigned(AOwner) then if assigned(AOwner) then
begin begin
inherited Create(AOwner); inherited Create(AOwner);
fCompStyle := csCHECKBOX; fCompStyle := csCheckbox;
end; end;
end; end;
@ -28,6 +28,9 @@ end;
{ {
$Log$ $Log$
Revision 1.4 2002/07/23 07:40:51 lazarus
MG: fixed get widget position for inherited gdkwindows
Revision 1.3 2002/05/10 06:05:51 lazarus Revision 1.3 2002/05/10 06:05:51 lazarus
MG: changed license to LGPL MG: changed license to LGPL

View File

@ -134,7 +134,7 @@ begin
begin begin
ApplyChanges; ApplyChanges;
if assigned (OnClick) if assigned (OnClick)
then OnCLick (self); then OnClick (self);
end; end;
end; end;
@ -168,6 +168,9 @@ end;
{ {
$Log$ $Log$
Revision 1.5 2002/07/23 07:40:51 lazarus
MG: fixed get widget position for inherited gdkwindows
Revision 1.4 2002/05/10 06:05:51 lazarus Revision 1.4 2002/05/10 06:05:51 lazarus
MG: changed license to LGPL MG: changed license to LGPL

View File

@ -107,7 +107,7 @@ end;
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
function GTKRealizeAfterCB(Widget: PGtkWidget; Data: Pointer): GBoolean; cdecl; function GTKRealizeAfterCB(Widget: PGtkWidget; Data: Pointer): GBoolean; cdecl;
var var
WinWidgetInfo, ClientWidgetInfo: PWinWidgetInfo; WinWidgetInfo: PWinWidgetInfo;
HiddenLCLObject, LCLObject: TObject; HiddenLCLObject, LCLObject: TObject;
NewEventMask: TGdkEventMask; NewEventMask: TGdkEventMask;
TheWinControl: TWinControl; TheWinControl: TWinControl;
@ -138,13 +138,11 @@ begin
NewEventMask:=gdk_window_get_events(Widget^.Window) NewEventMask:=gdk_window_get_events(Widget^.Window)
or WinWidgetInfo^.EventMask; or WinWidgetInfo^.EventMask;
gdk_window_set_events(Widget^.Window,NewEventMask); gdk_window_set_events(Widget^.Window,NewEventMask);
if (ClientWidget<>nil) and (ClientWidget^.Window<>nil) then begin if (ClientWidget<>nil) and (ClientWidget^.Window<>nil)
ClientWidgetInfo:=GetWidgetInfo(ClientWidget,false); and (ClientWidget^.Window<>Widget^.Window) then begin
if ClientWidgetInfo<>nil then begin NewEventMask:=gdk_window_get_events(ClientWidget^.Window)
NewEventMask:=gdk_window_get_events(ClientWidget^.Window) or WinWidgetInfo^.EventMask;
or ClientWidgetInfo^.EventMask; gdk_window_set_events(ClientWidget^.Window,NewEventMask);
gdk_window_set_events(ClientWidget^.Window,NewEventMask);
end;
end; end;
//writeln('BBB1 ',HexStr(Cardinal(NewEventMask),8),' ',HexStr(Cardinal(gdk_window_get_events(Widget^.Window)),8)); //writeln('BBB1 ',HexStr(Cardinal(NewEventMask),8),' ',HexStr(Cardinal(gdk_window_get_events(Widget^.Window)),8));
end else begin end else begin
@ -2157,6 +2155,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.92 2002/07/23 07:40:51 lazarus
MG: fixed get widget position for inherited gdkwindows
Revision 1.91 2002/07/22 18:25:12 lazarus Revision 1.91 2002/07/22 18:25:12 lazarus
MG: reduced output MG: reduced output

View File

@ -301,27 +301,23 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Function TgtkObject.ClientToScreen(Handle : HWND; var P : TPoint) : Boolean; Function TgtkObject.ClientToScreen(Handle : HWND; var P : TPoint) : Boolean;
var var
X, Y: Integer; Position: TPoint;
Widget: PGTKWidget;
Begin Begin
if Handle = 0 if Handle = 0
then begin then begin
X := 0; Position.X := 0;
Y := 0; Position.Y := 0;
end end
else begin else begin
Widget := GetFixedWidget(pgtkwidget(Handle)); Position:=GetWidgetClientOrigin(PGtkWidget(Handle));
if Widget = nil then Widget := pgtkwidget(Handle);
gdk_window_get_origin(Widget^.Window, @X, @Y);
end; end;
// Todo: calculate offset, since platform specific // Todo: calculate offset, since platform specific
Inc(P.X, X); Inc(P.X, Position.X);
Inc(P.Y, Y); Inc(P.Y, Position.Y);
Assert(False, Format('Trace: [GTKObject.ClientToScreen] Handle: 0x%x --> (%d, %d)', [Integer(Handle), P.X, P.y])); Assert(False, Format('Trace: [GTKObject.ClientToScreen] Handle: 0x%x --> (%d, %d)', [Integer(Handle), P.X, P.y]));
Result := True; Result := True;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -4824,6 +4820,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.83 2002/07/23 07:40:52 lazarus
MG: fixed get widget position for inherited gdkwindows
Revision 1.82 2002/07/20 13:47:04 lazarus Revision 1.82 2002/07/20 13:47:04 lazarus
MG: fixed eventmask for realized windows MG: fixed eventmask for realized windows

View File

@ -341,6 +341,9 @@ type
property OnChange; property OnChange;
end; end;
{ TCustomLabel }
TCustomLabel = class(TWinControl) TCustomLabel = class(TWinControl)
private private
FAlignment : TAlignment; FAlignment : TAlignment;
@ -359,6 +362,8 @@ type
end; end;
{ TLabel }
TLabel = class(TCustomLabel) TLabel = class(TCustomLabel)
published published
property Alignment; property Alignment;
@ -371,80 +376,78 @@ type
end; end;
TButtonControl = class(TWinControl) { TButtonControl }
private
FClicksDisabled: Boolean; TButtonControl = class(TWinControl)
protected private
function GetChecked: Boolean; virtual; FClicksDisabled: Boolean;
procedure SetChecked(Value: Boolean); virtual; protected
property Checked: Boolean read GetChecked write SetChecked;// stored IsCheckedStored default False; function GetChecked: Boolean; virtual;
property ClicksDisabled: Boolean read FClicksDisabled write FClicksDisabled; procedure SetChecked(Value: Boolean); virtual;
public property Checked: Boolean read GetChecked write SetChecked;// stored IsCheckedStored default False;
constructor Create(AOwner: TComponent); override; property ClicksDisabled: Boolean read FClicksDisabled write FClicksDisabled;
end; public
constructor Create(AOwner: TComponent); override;
end;
{ TCHECKBOX }
{TCHECKBOX} // ToDo: delete TLeftRight when in classesh.inc
TLeftRight = taLeftJustify..taRightJustify;
// ToDo: delete TLeftRight when in classesh.inc TCheckBoxState = (cbUnchecked, cbChecked, cbGrayed);
TLeftRight = taLeftJustify..taRightJustify;
TCheckBoxState = (cbUnchecked, cbChecked, cbGrayed); TCustomCheckBox = class(TButtonControl)
private
// FAlignment: TLeftRight;
FAllowGrayed: Boolean;
FState: TCheckBoxState;
procedure SetState(Value: TCheckBoxState);
function GetState : TCheckBoxState;
protected
procedure InitializeWnd; override;
procedure Toggle; virtual;
function GetChecked: Boolean; override;
procedure SetChecked(Value: Boolean); override;
procedure ApplyChanges; virtual;
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed;
property State: TCheckBoxState read GetState write SetState;
public
constructor Create(AOwner: TComponent); override;
end;
TCustomCheckBox = class(TButtonControl) TCheckBox = class(TCustomCheckBox)
private private
// FAlignment: TLeftRight; public
FAllowGrayed: Boolean; constructor Create(AOwner: TComponent); override;
FState: TCheckBoxState; published
procedure SetState(Value: TCheckBoxState); property AllowGrayed;
function GetState : TCheckBoxState; property Caption;
protected property Checked;
procedure InitializeWnd; override; property State;
// procedure Click; override; property Visible;
procedure Toggle; virtual; property Enabled;
function GetChecked: Boolean; override; property OnEnter;
procedure SetChecked(Value: Boolean); override; property OnExit;
procedure ApplyChanges; virtual; property DragCursor;
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed; property DragKind;
property State: TCheckBoxState read GetState write SetState; property DragMode;
property Hint;
public property ParentShowHint;
constructor Create(AOwner: TComponent); override; property PopupMenu;
property ShowHint;
end; property TabOrder;
property TabStop;
TCheckBox = class(TCustomCheckBox) property OnClick;
private property OnDragDrop;
public property OnDragOver;
constructor Create(AOwner: TComponent); override; property OnEndDrag;
published property OnMouseDown;
property AllowGrayed; property OnMouseMove;
property Caption; property OnMouseUp;
property Checked; property OnStartDrag;
property State; end;
property Visible;
property Enabled;
property OnEnter;
property OnExit;
property DragCursor;
property DragKind;
property DragMode;
property Hint;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property OnClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
@ -452,7 +455,6 @@ type
private private
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
published published
property AllowGrayed; property AllowGrayed;
property Caption; property Caption;
@ -524,8 +526,7 @@ type
implementation
implementation {*******}
uses LCLLinux, LCLType; uses LCLLinux, LCLType;
@ -593,6 +594,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.31 2002/07/23 07:40:51 lazarus
MG: fixed get widget position for inherited gdkwindows
Revision 1.30 2002/05/20 14:19:03 lazarus Revision 1.30 2002/05/20 14:19:03 lazarus
MG: activated the clientrect bugfixes MG: activated the clientrect bugfixes