fixed retrieving TCanvas.Width/Height

git-svn-id: trunk@7181 -
This commit is contained in:
mattias 2005-05-18 09:12:21 +00:00
parent c5808e7584
commit b7d8308bd3
3 changed files with 36 additions and 20 deletions

View File

@ -300,11 +300,12 @@ end;
function TCanvas.GetHeight: integer; function TCanvas.GetHeight: integer;
var var
w: Integer; p: TPoint;
begin begin
if HandleAllocated then if HandleAllocated then begin
GetWindowSize(Handle,w,Result) GetDeviceSize(Handle,p);
else Result:=p.y;
end else
Result:=0; Result:=0;
end; end;
@ -315,11 +316,12 @@ end;
function TCanvas.GetWidth: integer; function TCanvas.GetWidth: integer;
var var
h: Integer; p: TPoint;
begin begin
if HandleAllocated then if HandleAllocated then begin
GetWindowSize(Handle,Result,h) GetDeviceSize(Handle,p);
else Result:=p.y;
end else
Result:=0; Result:=0;
end; end;
@ -1535,6 +1537,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.93 2005/05/18 09:12:21 mattias
fixed retrieving TCanvas.Width/Height
Revision 1.92 2005/03/07 21:59:44 vincents Revision 1.92 2005/03/07 21:59:44 vincents
changed hexstr(cardinal()) for pointers to dbgs() and other 64-bits fixes from Peter Vreman changed hexstr(cardinal()) for pointers to dbgs() and other 64-bits fixes from Peter Vreman

View File

@ -32,9 +32,9 @@ begin
Pen.Style := psDash; Pen.Style := psDash;
Pen.Color:=clBlack; Pen.Color:=clBlack;
Brush.Style := bsClear; Brush.Style := bsClear;
Rectangle(0, 0, Width - 1, Height - 1); Rectangle(0, 0, Self.Width - 1, Self.Height - 1);
Line(0,0,Width-1,Height-1); Line(0,0,Self.Width-1,Self.Height-1);
Line(Width-1,0,0,Height-1); Line(Self.Width-1,0,0,Self.Height-1);
end; end;
exit; exit;
end; end;

View File

@ -5741,7 +5741,8 @@ end;
or a two way Rectangle Gradient, each Vertex point also supports optional or a two way Rectangle Gradient, each Vertex point also supports optional
Alpha/Transparency for more advanced Gradients. Alpha/Transparency for more advanced Gradients.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TGtkWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices : Longint; function TGtkWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex;
NumVertices : Longint;
Meshes: Pointer; NumMeshes : Longint; Mode : Longint): Boolean; Meshes: Pointer; NumMeshes : Longint; Mode : Longint): Boolean;
Function DoFillTriangle : Boolean; Function DoFillTriangle : Boolean;
@ -5867,12 +5868,14 @@ function TGtkWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex; NumVertices :
end; end;
const const
MeshSize : Array[Boolean] of Integer = (SizeOf(tagGradientRect), SizeOf(tagGradientTriangle)); MeshSize: Array[Boolean] of Integer = (
SizeOf(tagGradientRect), SizeOf(tagGradientTriangle));
var var
I : Integer; I : Integer;
begin begin
//Currently Alpha blending is ignored... Ideas anyone? //Currently Alpha blending is ignored... Ideas anyone?
Result := (Meshes <> nil) and (NumMeshes >= 1) and (NumVertices >= 2) and (Vertices <> nil); Result := (Meshes <> nil) and (NumMeshes >= 1) and (NumVertices >= 2)
and (Vertices <> nil);
If Result and DoFillTriangle then If Result and DoFillTriangle then
Result := NumVertices >= 3; Result := NumVertices >= 3;
If Result then begin If Result then begin
@ -6113,13 +6116,15 @@ end;
function MessageButtonClicked(Widget : PGtkWidget; data: gPointer) : GBoolean; cdecl; function MessageButtonClicked(Widget : PGtkWidget; data: gPointer) : GBoolean; cdecl;
begin begin
DebugLn('[MessageButtonClicked] ',dbgs(data),' ',dbgs(gtk_object_get_data(PGtkObject(Widget), 'modal_result'))); //DebugLn('[MessageButtonClicked] ',dbgs(data),' ',dbgs(gtk_object_get_data(PGtkObject(Widget), 'modal_result')));
if Integer(data^) = 0 then if Integer(data^) = 0 then
Integer(data^):= Integer(gtk_object_get_data(PGtkObject(Widget), 'modal_result')); Integer(data^):=
Integer(gtk_object_get_data(PGtkObject(Widget), 'modal_result'));
Result:=false; Result:=false;
end; end;
function MessageBoxClosed(Widget : PGtkWidget; Event : PGdkEvent; data: gPointer) : GBoolean; cdecl; function MessageBoxClosed(Widget : PGtkWidget; Event : PGdkEvent;
data: gPointer) : GBoolean; cdecl;
var ModalResult : integer; var ModalResult : integer;
begin begin
{ We were requested by window manager to close } { We were requested by window manager to close }
@ -6150,8 +6155,10 @@ var Dialog, ALabel : PGtkWidget;
if RetValue = IDCANCEL then begin if RetValue = IDCANCEL then begin
gtk_object_set_data(PGtkObject(Dialog), 'modal_result', Pointer(IDCANCEL)); gtk_object_set_data(PGtkObject(Dialog), 'modal_result', Pointer(IDCANCEL));
end; end;
gtk_object_set_data(PGtkObject(AButton), 'modal_result', Pointer(PtrInt(RetValue))); gtk_object_set_data(PGtkObject(AButton), 'modal_result',
g_signal_connect(PGtkObject(AButton), 'clicked', TGtkSignalFunc(@MessageButtonClicked), @ADialogResult); Pointer(PtrInt(RetValue)));
g_signal_connect(PGtkObject(AButton), 'clicked',
TGtkSignalFunc(@MessageButtonClicked), @ADialogResult);
gtk_container_add (PGtkContainer(PGtkDialog(Dialog)^.action_area), AButton); gtk_container_add (PGtkContainer(PGtkDialog(Dialog)^.action_area), AButton);
end; end;
@ -6225,7 +6232,8 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TGtkWidgetSet.MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; function TGtkWidgetSet.MoveToEx(DC: HDC; X, Y: Integer;
OldPoint: PPoint): Boolean;
begin begin
Assert(False, Format('trace:> [TGtkWidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y])); Assert(False, Format('trace:> [TGtkWidgetSet.MoveToEx] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
Result := IsValidDC(DC); Result := IsValidDC(DC);
@ -8997,6 +9005,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.419 2005/05/18 09:12:21 mattias
fixed retrieving TCanvas.Width/Height
Revision 1.418 2005/03/21 18:59:50 mattias Revision 1.418 2005/03/21 18:59:50 mattias
gtk1 intf no longer moves a focused window to another desktop from Andrew Haines gtk1 intf no longer moves a focused window to another desktop from Andrew Haines