carbon: change preferred size for groupbox and custompanel to return size excluding clientarea. bug #16337

git-svn-id: trunk@26295 -
This commit is contained in:
dmitry 2010-06-27 14:29:29 +00:00
parent 5ec928bb45
commit 3962bb560c
3 changed files with 33 additions and 1 deletions

View File

@ -266,6 +266,7 @@ type
procedure CreateWidget(const AParams: TCreateParams); override;
procedure DestroyWidget; override;
function GetContent: ControlRef; override;
function GetPreferredSize: TPoint; override;
public
function GetClientRect(var ARect: TRect): Boolean; override;
function SetBounds(const ARect: TRect): Boolean; override;
@ -1227,6 +1228,18 @@ begin
Result := FUserPane;
end;
function TCarbonGroupBox.GetPreferredSize:TPoint;
var
ContentRect: TRect;
begin
Result:=inherited;
if GetClientRect(ContentRect) then
begin
Dec(Result.X, ContentRect.Right - ContentRect.Left);
Dec(Result.Y, ContentRect.Bottom - ContentRect.Top);
end;
end;
{------------------------------------------------------------------------------
Method: TCarbonGroupBox.GetClientRect
Params: ARect - Record for client area coordinates

View File

@ -167,6 +167,7 @@ type
TCarbonWSCustomPanel = class(TWSCustomPanel)
published
class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
end;
{ TCarbonWSPanel }
@ -352,6 +353,23 @@ begin
TCarbonTabsControl(ANotebook.Handle).ShowTabs(AShowTabs);
end;
{ TCarbonWSCustomPanel }
{------------------------------------------------------------------------------
Method: TCarbonWSCustomNotebook.ShowTabs
Params: ANotebook - LCL custom notebook
AShowTabs - Tabs visibility
TCustomPanel should return preferred size (0,0)
bugs #16337, and Mattias in comment 0036957 of #16323
------------------------------------------------------------------------------}
class procedure TCarbonWSCustomPanel.GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
begin
PreferredWidth:=0;
PreferredHeight:=0;
end;
{$include carbontrayicon.inc}
end.

View File

@ -375,7 +375,8 @@ end;
function RegisterCustomPanel: Boolean; alias : 'WSRegisterCustomPanel';
begin
Result := False;
RegisterWSComponent(TCustomPanel, TCarbonWSCustomPanel);
Result := True;
end;
function RegisterCustomTrayIcon: Boolean; alias : 'WSRegisterCustomTrayIcon';