gtk intf: fixed GetClientRect for notebook

git-svn-id: trunk@12694 -
This commit is contained in:
mattias 2007-11-02 10:58:55 +00:00
parent ef2d81ca2c
commit 09342edb8f
6 changed files with 23 additions and 17 deletions

View File

@ -417,7 +417,7 @@ begin
if p.y<1 then exit; if p.y<1 then exit;
CodeBuf:=SrcEdit.CodeToolsBuffer as TCodeBuffer; CodeBuf:=SrcEdit.CodeToolsBuffer as TCodeBuffer;
if CodeBuf=nil then exit; if CodeBuf=nil then exit;
// ToDo
while (p.y<=SrcEdit.LineCount) do begin while (p.y<=SrcEdit.LineCount) do begin
Line:=SrcEdit.Lines[p.y-1]; Line:=SrcEdit.Lines[p.y-1];

View File

@ -45,8 +45,14 @@ end;
function TScrollingWinControl.GetLogicalClientRect: TRect; function TScrollingWinControl.GetLogicalClientRect: TRect;
begin begin
Result:=Rect(0,0,Max(ClientWidth,FHorzScrollBar.Range), Result:=ClientRect;
Max(ClientHeight,FVertScrollBar.Range)); {if (FHorzScrollBar.Range>Result.Right)
or (FVertScrollBar.Range>Result.Bottom) then
DebugLn(['TScrollingWinControl.GetLogicalClientRect Client=',ClientWidth,'x',ClientHeight,' Ranges=',FHorzScrollBar.Range,'x',FVertScrollBar.Range]);}
if (FHorzScrollBar.Range>Result.Right) then
Result.Right:=FHorzScrollBar.Range;
if (FVertScrollBar.Range>Result.Bottom) then
Result.Bottom:=FVertScrollBar.Range;
end; end;
procedure TScrollingWinControl.AlignControls(AControl: TControl; procedure TScrollingWinControl.AlignControls(AControl: TControl;
@ -219,7 +225,7 @@ end;
procedure TScrollingWinControl.WMHScroll(var Message : TLMHScroll); procedure TScrollingWinControl.WMHScroll(var Message : TLMHScroll);
begin begin
DebugLn(['TScrollingWinControl.WMHScroll ',dbgsName(Self)]); //DebugLn(['TScrollingWinControl.WMHScroll ',dbgsName(Self)]);
HorzScrollbar.ScrollHandler(Message); HorzScrollbar.ScrollHandler(Message);
end; end;

View File

@ -30,7 +30,7 @@
{off $DEFINE CHECK_POSITION} {off $DEFINE CHECK_POSITION}
{$IFDEF CHECK_POSITION} {$IFDEF CHECK_POSITION}
const CheckPostionClassName = 'xxxTButtonPanel'; const CheckPostionClassName = 'TPage';
const CheckPostionName = 'xxxBakProjTypeRadioGroup'; const CheckPostionName = 'xxxBakProjTypeRadioGroup';
const CheckPostionParentName = 'xxxInheritedPage'; const CheckPostionParentName = 'xxxInheritedPage';
@ -3435,7 +3435,6 @@ function TWinControl.GetClientRect: TRect;
var var
InterfaceWidth, InterfaceHeight: integer; InterfaceWidth, InterfaceHeight: integer;
begin begin
//DebugLn(['TWinControl.GetClientRect ',DbgSName(Self),' ',DbgSName(Parent)]);
if wcfClientRectNeedsUpdate in FWinControlFlags then begin if wcfClientRectNeedsUpdate in FWinControlFlags then begin
if TWSWinControlClass(WidgetSetClass).GetDefaultClientRect(Self, if TWSWinControlClass(WidgetSetClass).GetDefaultClientRect(Self,
Left, Top, Width, Height, Result) Left, Top, Width, Height, Result)
@ -6480,7 +6479,8 @@ begin
' OldRelBounds=',dbgs(FBoundsRealized), ' OldRelBounds=',dbgs(FBoundsRealized),
' -> NewBounds=',dbgs(BoundsRect)); ' -> NewBounds=',dbgs(BoundsRect));
{$ENDIF} {$ENDIF}
DoSendBoundsToInterface; if (Width>0) and (Height>0) then
DoSendBoundsToInterface;
if wcfColorChanged in FWinControlFlags then begin if wcfColorChanged in FWinControlFlags then begin
// replace by update style call // replace by update style call

View File

@ -8859,7 +8859,6 @@ begin
RealizeGtkStyleColor(Style,Result); RealizeGtkStyleColor(Style,Result);
end; end;
{$IFDEF Gtk2}
function GetStyleGroupboxFrameBorders: TRect; function GetStyleGroupboxFrameBorders: TRect;
const s = 200; const s = 200;
var var
@ -8877,8 +8876,12 @@ begin
allocation.height:=s; allocation.height:=s;
gtk_widget_size_allocate(StyleObject^.Widget,@allocation); gtk_widget_size_allocate(StyleObject^.Widget,@allocation);
FrameWidget:=pGtkFrame(StyleObject^.Widget); FrameWidget:=pGtkFrame(StyleObject^.Widget);
{$IFDEF Gtk1}
allocation:=FrameWidget^.bin.child^.allocation;
{$ELSE}
GTK_FRAME_GET_CLASS(FrameWidget)^.compute_child_allocation( GTK_FRAME_GET_CLASS(FrameWidget)^.compute_child_allocation(
FrameWidget,@allocation); FrameWidget,@allocation);
{$ENDIF}
//DebugLn(['GetStyleGroupboxFrame BBB2 ',dbgs(allocation)]); //DebugLn(['GetStyleGroupboxFrame BBB2 ',dbgs(allocation)]);
f.Left:=Min(s,Max(0,allocation.x)); f.Left:=Min(s,Max(0,allocation.x));
f.Top:=Min(s,Max(0,allocation.y)); f.Top:=Min(s,Max(0,allocation.y));
@ -8921,6 +8924,7 @@ begin
Result:=StyleObject^.FrameBorders; Result:=StyleObject^.FrameBorders;
end; end;
{$IFDEF Gtk2}
function GetStyleFormFrameBorders(WithMenu: boolean): TRect; function GetStyleFormFrameBorders(WithMenu: boolean): TRect;
const s = 400; const s = 400;
var var
@ -8942,13 +8946,13 @@ begin
InnerWidget:=PGTKWidget( InnerWidget:=PGTKWidget(
gtk_object_get_data(PGtkObject(StyleObject^.Widget),'fixedwidget')); gtk_object_get_data(PGtkObject(StyleObject^.Widget),'fixedwidget'));
allocation:=InnerWidget^.allocation; allocation:=InnerWidget^.allocation;
DebugLn(['GetStyleFormFrameBorders BBB2 ',dbgs(allocation),' WithMenu=',WithMenu,' ClientWidget=',GetWidgetDebugReport(InnerWidget)]); //DebugLn(['GetStyleFormFrameBorders BBB2 ',dbgs(allocation),' WithMenu=',WithMenu,' ClientWidget=',GetWidgetDebugReport(InnerWidget)]);
f.Left:=Min(s,Max(0,allocation.x)); f.Left:=Min(s,Max(0,allocation.x));
f.Top:=Min(s,Max(0,allocation.y)); f.Top:=Min(s,Max(0,allocation.y));
f.Right:=Max(0,Min(s-f.Left,s-allocation.x-allocation.width)); f.Right:=Max(0,Min(s-f.Left,s-allocation.x-allocation.width));
f.Bottom:=Max(0,Min(s-f.Top,s-allocation.x-allocation.width)); f.Bottom:=Max(0,Min(s-f.Top,s-allocation.x-allocation.width));
StyleObject^.FrameBorders:=f; StyleObject^.FrameBorders:=f;
DebugLn(['GetStyleFormFrameBorders FrameBorders=',dbgs(StyleObject^.FrameBorders)]); //DebugLn(['GetStyleFormFrameBorders FrameBorders=',dbgs(StyleObject^.FrameBorders)]);
StyleObject^.FrameBordersValid:=true; StyleObject^.FrameBordersValid:=true;
end; end;
@ -8965,7 +8969,7 @@ begin
Result.Top:=Min(Outer.height,Max(0,Inner.y)); Result.Top:=Min(Outer.height,Max(0,Inner.y));
Result.Right:=Max(0,Min(Outer.width-f.Left,Outer.width-Inner.x-Inner.width)); Result.Right:=Max(0,Min(Outer.width-f.Left,Outer.width-Inner.x-Inner.width));
Result.Bottom:=Max(0,Min(Outer.height-f.Top,Outer.height-Inner.x-Inner.width)); Result.Bottom:=Max(0,Min(Outer.height-f.Top,Outer.height-Inner.x-Inner.width));
DebugLn(['GetStyleFormFrameBorders BBB3 Inner=',dbgs(Inner),' Outer=',dbgs(Outer),' WithMenu=',WithMenu,' InnerWidget=',GetWidgetDebugReport(InnerWidget),' Result=',dbgs(Result)]); //DebugLn(['GetStyleFormFrameBorders BBB3 Inner=',dbgs(Inner),' Outer=',dbgs(Outer),' WithMenu=',WithMenu,' InnerWidget=',GetWidgetDebugReport(InnerWidget),' Result=',dbgs(Result)]);
end; end;
{$ENDIF} {$ENDIF}

View File

@ -778,9 +778,9 @@ function GetStyle(aStyle: TLazGtkStyle): PGTKStyle;
function GetStyleWithName(const WName: String): PGTKStyle; function GetStyleWithName(const WName: String): PGTKStyle;
function GetStyleWidget(aStyle: TLazGtkStyle): PGTKWidget; function GetStyleWidget(aStyle: TLazGtkStyle): PGTKWidget;
function GetStyleWidgetWithName(const WName: String): PGTKWidget; function GetStyleWidgetWithName(const WName: String): PGTKWidget;
{$IFDEF Gtk2}
function GetStyleGroupboxFrameBorders: TRect; function GetStyleGroupboxFrameBorders: TRect;
function GetStyleNotebookFrameBorders: TRect; function GetStyleNotebookFrameBorders: TRect;
{$IFDEF Gtk2}
function GetStyleFormFrameBorders(WithMenu: boolean): TRect; function GetStyleFormFrameBorders(WithMenu: boolean): TRect;
{$ENDIF} {$ENDIF}
procedure StyleFillRectangle(drawable: PGDKDrawable; GC: PGDKGC; procedure StyleFillRectangle(drawable: PGDKDrawable; GC: PGDKGC;

View File

@ -4645,7 +4645,6 @@ Function TGtkWidgetSet.GetClientRect(handle : HWND; var ARect : TRect) : Boolean
var var
Widget, ClientWidget: PGtkWidget; Widget, ClientWidget: PGtkWidget;
{$IFDEF Gtk2}
procedure GetNoteBookClientRect(NBWidget: PGtkNotebook); procedure GetNoteBookClientRect(NBWidget: PGtkNotebook);
var var
PageIndex: LongInt; PageIndex: LongInt;
@ -4678,7 +4677,6 @@ var
//DebugLn(['GetNoteBookClientRect using defaults: ',GetWidgetDebugReport(Widget),' ARect=',dbgs(aRect)]); //DebugLn(['GetNoteBookClientRect using defaults: ',GetWidgetDebugReport(Widget),' ARect=',dbgs(aRect)]);
end; end;
end; end;
{$ENDIF}
begin begin
Result := false; Result := false;
@ -4696,10 +4694,8 @@ begin
ARect.Right:=0; ARect.Right:=0;
ARect.Bottom:=0; ARect.Bottom:=0;
end; end;
{$IFDEF Gtk2} if GtkWidgetIsA(Widget,gtk_notebook_get_type) then
if GtkWidgetIsA(Widget,GTK_TYPE_NOTEBOOK) then
GetNoteBookClientRect(PGtkNoteBook(Widget)); GetNoteBookClientRect(PGtkNoteBook(Widget));
{$ENDIF}
{$IfDef VerboseGetClientRect} {$IfDef VerboseGetClientRect}
if ClientWidget<>nil then begin if ClientWidget<>nil then begin
DebugLn('GetClientRect Widget=',DbgS(handle), DebugLn('GetClientRect Widget=',DbgS(handle),