- 64 bit fixes to GetWindowLong and callers from Florian

- SetWindowLong now sets a ptrint

git-svn-id: trunk@7446 -
This commit is contained in:
vincents 2005-07-29 22:44:07 +00:00
parent 1db6e42935
commit d2179bb34b
12 changed files with 40 additions and 40 deletions

View File

@ -913,7 +913,7 @@ begin
Result := False;
end;
function TWidgetSet.GetWindowLong(Handle : hwnd; int : Integer): Longint;
function TWidgetSet.GetWindowLong(Handle : hwnd; int : Integer): PtrInt;
begin
Result := 0;
end;
@ -1356,7 +1356,7 @@ begin
end;
function TWidgetSet.SetWindowLong(Handle: HWND;
Idx: Integer; NewLong : Longint): LongInt;
Idx: Integer; NewLong : PtrInt): PtrInt;
begin
Result := -1;
end;

View File

@ -435,7 +435,7 @@ begin
Result := InterfaceObject.GetTextMetrics(DC, TM);
end;
function GetWindowLong(Handle : hwnd; int : Integer): Longint;
function GetWindowLong(Handle : hwnd; int : Integer): PtrInt;
begin
Result := InterfaceObject.GetWindowLong(Handle, int);
end;
@ -764,7 +764,7 @@ begin
Result := InterfaceObject.SetTextColor(DC, Color);
end;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): LongInt;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : PtrInt): PtrInt;
begin
Result := InterfaceObject.SetWindowLong(handle, Idx, NewLong);
end;

View File

@ -136,7 +136,7 @@ function GetTextExtentExPoint(DC: HDC; Str: PChar; Count, MaxWidth: Integer; Max
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: LCLType.TSize): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetTextExtentPoint32(DC: HDC; Str: PChar; Count: Integer; var Size: LCLType.TSize): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowLong(Handle : hwnd; int : Integer): Longint; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowLong(Handle : hwnd; int : Integer): PtrInt; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowRect(Handle : hwnd; var Rect : TRect): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function GetWindowOrgEx(dc : hdc; P : PPoint): Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -215,7 +215,7 @@ function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues)
function SetTextAlign(DC: HDC; Flags: UINT): UINT; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): Longint;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : PtrInt): PtrInt;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; OldPoint: PPoint): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -519,7 +519,7 @@ begin
Result:=inherited GetTextMetrics(DC, TM);
end;
function TCarbonWidgetSet.GetWindowLong(Handle: hwnd; int: Integer): Longint;
function TCarbonWidgetSet.GetWindowLong(Handle: hwnd; int: Integer): PtrInt;
begin
Result:=inherited GetWindowLong(Handle, int);
end;
@ -849,7 +849,7 @@ begin
end;
function TCarbonWidgetSet.SetWindowLong(Handle: HWND; Idx: Integer;
NewLong: Longint): LongInt;
NewLong: PtrInt): PtrInt;
begin
Result:=inherited SetWindowLong(Handle, Idx, NewLong);
end;

View File

@ -127,7 +127,7 @@ function GetSystemMetrics(nIndex: Integer): Integer; override;
function GetTextColor(DC: HDC) : TColorRef; Override;
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override;
function GetWindowLong(Handle : hwnd; int: Integer): Longint; override;
function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;
function GetWindowOrgEx(dc : hdc; P: PPoint): Integer; override;
function GetWindowRect(Handle : hwnd; var ARect: TRect): Integer; override;
function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boolean; override;
@ -193,7 +193,7 @@ function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo
function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override;
function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; override;
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): LongInt; override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : PtrInt): PtrInt; override;
function SetWindowOrgEx(DC : HDC; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; override;

View File

@ -2100,7 +2100,7 @@ begin
Mess.Msg := LM_NOTIFY;
FillChar(NMHdr,SizeOf(NMHdr),0);
NMHdr.code := TCN_SELCHANGE;
NMHdr.hwndfrom := longint(widget);
NMHdr.hwndfrom := ptrint(widget);
NMHdr.idfrom := pagenum; //use this to set pageindex to the correct page.
Mess.NMHdr := @NMHdr;
DeliverMessage(Data, Mess);

View File

@ -51,7 +51,7 @@ begin
msg.Msg := CN_NOTIFY;
FillChar(NM, SizeOf(NM), 0);
NM.hdr.hwndfrom := longint(AList);
NM.hdr.hwndfrom := PtrInt(AList);
NM.hdr.code := LVN_COLUMNCLICK;
NM.iItem := -1;
NM.iSubItem := AColumn;

View File

@ -3120,7 +3120,7 @@ procedure TGtkWidgetSet.SetDesigning(AComponent: TComponent);
begin
// change cursor
if AComponent is TWinControl then
gtkproc.SetCursor(TWinControl(AComponent), TCursor(cardinal(nil)));
gtkproc.SetCursor(TWinControl(AComponent), TCursor(PtrUInt(nil)));
end;
{------------------------------------------------------------------------------
@ -6876,7 +6876,7 @@ begin
i:=0;
while i<LinesList.Count do begin
// add LineEnd - LineStart + 1 for the #0
LineLen:=Cardinal(LinesList[i+1])-Cardinal(LinesList[i])+1;
LineLen:=PtrUInt(LinesList[i+1])-PtrUInt(LinesList[i])+1;
inc(TotalSize,LineLen);
inc(i,2);
end;
@ -6891,8 +6891,8 @@ begin
// set the pointer to the start of the current line
CurLineEntry[i shr 1]:=CurLineStart;
// copy the line
LineStart:=Integer(LinesList[i]);
LineEnd:=Integer(LinesList[i+1]);
LineStart:=PtrInt(LinesList[i]);
LineEnd:=PtrInt(LinesList[i+1]);
LineLen:=LineEnd-LineStart;
if LineLen>0 then
Move(AText[LineStart],CurLineStart^,LineLen);
@ -6903,7 +6903,7 @@ begin
// next line
inc(i,2);
end;
if Integer(Lines)+TotalSize<>Integer(CurLineStart) then
if PtrInt(Lines)+TotalSize<>PtrInt(CurLineStart) then
RaiseException('TGtkWidgetSet.WordWrap Consistency Error:'
+' Lines+TotalSize<>CurLineStart');
CurLineEntry[i shr 1]:=nil;

View File

@ -830,7 +830,7 @@ var
GdiObject: PGdiObject;
DefGdkWindow: PGdkWindow;
begin
Assert(False, Format('Trace:> [TGtkWidgetSet.CreateBitmap] Width: %d, Height: %d, Planes: %d, BitCount: %d, BitmapBits: 0x%x', [Width, Height, Planes, BitCount, Longint(BitmapBits)]));
Assert(False, Format('Trace:> [TGtkWidgetSet.CreateBitmap] Width: %d, Height: %d, Planes: %d, BitCount: %d, BitmapBits: 0x%x', [Width, Height, Planes, BitCount, PtrInt(BitmapBits)]));
if (BitCount < 1) or (Bitcount > 32)
then begin
@ -5558,7 +5558,7 @@ end;
Params: none
Returns: Nothing
------------------------------------------------------------------------------}
Function TGtkWidgetSet.GetWindowLong(Handle : hwnd; int : Integer): Longint;
Function TGtkWidgetSet.GetWindowLong(Handle : hwnd; int : Integer): PtrInt;
var
//Data : Tobject;
P : Pointer;
@ -5569,23 +5569,23 @@ begin
case int of
GWL_WNDPROC :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'WNDPROC'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'WNDPROC'));
end;
GWL_HINSTANCE :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'HINSTANCE'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'HINSTANCE'));
end;
GWL_HWNDPARENT :
begin
P := gtk_object_get_data(pgtkobject(Handle),'HWNDPARENT');
if P = nil then Result := 0 else Result := LongInt(p);
if P = nil then Result := 0 else Result := PtrInt(p);
end;
{ GWL_WNDPROC :
begin
Data := GetLCLObject(Pointer(Handle));
if Data is TControl
then Result := Longint(@(TControl(Data).WindowProc));
then Result := PtrInt(@(TControl(Data).WindowProc));
// TODO fix this, a method pointer (2 pointers) cant be casted to a longint
end;
}
@ -5593,25 +5593,25 @@ begin
begin
Data := GetLCLObject(Pointer(Handle));
if (Data is TWinControl)
then Result := Longint(TWincontrol(Data).Handle)
then Result := PtrInt(TWincontrol(Data).Handle)
else Result := 0;
end;
}
GWL_STYLE :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'Style'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'Style'));
end;
GWL_EXSTYLE :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'ExStyle'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'ExStyle'));
end;
GWL_USERDATA :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'Userdata'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'Userdata'));
end;
GWL_ID :
begin
Result := Longint(gtk_object_get_data(pgtkobject(Handle),'ID'));
Result := PtrInt(gtk_object_get_data(pgtkobject(Handle),'ID'));
end;
else Result := 0;
end; //case
@ -6833,7 +6833,7 @@ const
begin
if (Item^.Data <> Pointer(hndMenu)) // exclude ourself
and gtk_is_radio_menu_item(Item^.Data)
and (GroupIndex = Integer(gtk_object_get_data(Item^.Data, GROUPIDX_DATANAME)))
and (GroupIndex = PtrInt(gtk_object_get_data(Item^.Data, GROUPIDX_DATANAME)))
then begin
Result := gtk_radio_menu_item_group(PGtkRadioMenuItem(Item^.Data));
Exit;
@ -6876,7 +6876,7 @@ begin
Exit;
end;
CurrentGroupIndex := Integer(gtk_object_get_data(Pointer(hndMenu), GROUPIDX_DATANAME));
CurrentGroupIndex := PtrInt(gtk_object_get_data(Pointer(hndMenu), GROUPIDX_DATANAME));
// Update needed ?
if GroupIndex = CurrentGroupIndex
@ -7798,7 +7798,7 @@ var
FocusObject: PGTKObject;
begin
FocusObject := PGTKObject(GetFocus);
Result:=SetCaretPosEx(LongInt(FocusObject),X,Y);
Result:=SetCaretPosEx(PtrInt(FocusObject),X,Y);
end;
{------------------------------------------------------------------------------
@ -8336,14 +8336,14 @@ end;
------------------------------------------------------------------------------}
function TGtkWidgetSet.SetWindowLong(Handle: HWND; Idx: Integer;
NewLong: Longint): LongInt;
NewLong: PtrInt): PtrInt;
var
Data: Pointer;
begin
//TODO: Finish this;
Assert(False, Format('Trace:> [TGtkWidgetSet.SETWINDOWLONG] HWND: 0x%x, idx: 0x%x(%d), Value: 0x%x(%d)', [Handle, idx, idx, newlong, newlong]));
Result:=0;
Data := Pointer(PtrInt(NewLong));
Data := Pointer(NewLong);
case idx of
GWL_WNDPROC :
@ -8866,7 +8866,7 @@ begin
FillChar(ev,SizeOf(ev),0);
ev.any.window := Window;
Widget := gtk_get_event_widget(@ev);
Result := Longint(widget);
Result := PtrInt(widget);
end;
end;

View File

@ -123,7 +123,7 @@ function GetSystemMetrics(nIndex: Integer): Integer; override;
function GetTextColor(DC: HDC) : TColorRef; Override;
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean; override;
function GetTextMetrics(DC: HDC; var TM: TTextMetric): Boolean; override;
Function GetWindowLong(Handle : hwnd; int: Integer): Longint; override;
Function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;
Function GetWindowOrgEx(dc : hdc; P: PPoint): Integer; override;
Function GetWindowRect(Handle : hwnd; var ARect: TRect): Integer; override;
function GetWindowRelativePosition(Handle : hwnd; var Left, Top: integer): boolean; override;
@ -193,7 +193,7 @@ function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo
function SetSysColors(cElements: Integer; const lpaElements; const lpaRgbValues): Boolean; override;
Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; override;
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): LongInt; override;
function SetWindowLong(Handle: HWND; Idx: Integer; PtrInt : Longint): PtrInt; override;
function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; OldPoint: PPoint) : Boolean; override;
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; override;

View File

@ -1973,7 +1973,7 @@ End;
Retrieves information about the specified window.
------------------------------------------------------------------------------}
Function TWin32WidgetSet.GetWindowLong(Handle: HWND; Int: Integer): LongInt;
Function TWin32WidgetSet.GetWindowLong(Handle: HWND; Int: Integer): PtrInt;
Begin
//TODO:Started but not finished
Assert(False, Format('Trace:> [TWin32WidgetSet.GETWINDOWLONG] HWND: 0x%x, int: 0x%x (%d)', [Handle, int, int]));
@ -2889,7 +2889,7 @@ End;
Changes an attribute of the specified window.
------------------------------------------------------------------------------}
Function TWin32WidgetSet.SetWindowLong(Handle: HWND; Idx: Integer; NewLong: LongInt): LongInt;
Function TWin32WidgetSet.SetWindowLong(Handle: HWND; Idx: Integer; NewLong: PtrInt): PtrInt;
Begin
//TODO: Finish this;
Assert(False, Format('Trace:> [TWin32WidgetSet.SETWINDOWLONG] HWND: 0x%x, Idx: 0x%x(%d), Value: 0x%x(%d)', [Handle, Idx, Idx, NewLong, NewLong]));

View File

@ -115,7 +115,7 @@ function GetSystemMetrics(NIndex: Integer): Integer; Override;
function GetTextColor(DC: HDC): TColorRef; Override;
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; Var Size: TSize): Boolean; Override;
function GetTextMetrics(DC: HDC; Var TM: TTextMetric): Boolean; Override;
function GetWindowLong(Handle: HWND; Int: Integer): LongInt; Override;
function GetWindowLong(Handle: HWND; Int: Integer): PtrInt; Override;
function GetWindowOrgEx(DC: HDC; P: PPoint): Integer; Override;
function GetWindowRect(Handle: HWND; Var Rect: TRect): Integer; Override;
function GetWindowRelativePosition(Handle : HWND; var Left, Top:integer): boolean; Override;
@ -175,7 +175,7 @@ function SetScrollInfo(Handle: HWND; SBStyle: Integer; ScrollInfo: TScrollInfo;
function SetSysColors(CElements: Integer; Const LPAElements; Const LPARgbValues): Boolean; Override;
function SetTextCharacterExtra(_HDC: HDC; NCharExtra: Integer): Integer; Override;
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; Override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong: LongInt): LongInt; Override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong: PtrInt): PtrInt; Override;
function SetWindowOrgEx(DC: HDC; NewX, NewY: Integer; OldPoint: PPoint): Boolean; Override;
function SetWindowPos(HWnd: HWND; HWndInsertAfter: HWND; X, Y, CX, CY: Integer; UFlags: UINT): Boolean; Override;
function ShowCaret(HWnd: HWND): Boolean; Override;