diff --git a/lcl/interfaces/carbon/carbontabs.pp b/lcl/interfaces/carbon/carbontabs.pp index 48ebc75929..be8e4df19c 100644 --- a/lcl/interfaces/carbon/carbontabs.pp +++ b/lcl/interfaces/carbon/carbontabs.pp @@ -53,6 +53,7 @@ type procedure Attach(AParent: TCarbonTabsControl); procedure UpdateTab; function SetText(const S: String): Boolean; override; + procedure ShowHide(AVisible: Boolean); override; end; { TCarbonTabsControl } @@ -93,6 +94,8 @@ type function GetClientRect(var ARect: TRect): Boolean; override; function SetBounds(const ARect: TRect): Boolean; override; + function IsDesignInteractive(const P: TPoint): Boolean; + procedure ScrollTabsLeft; procedure ScrollTabsRight; procedure StartScrollingTabsLeft; @@ -180,6 +183,27 @@ begin Result := True; end; +{------------------------------------------------------------------------------ + Method: TCarbonTab.ShowHide + Params: AVisible - if show + + Shows or hides control + ------------------------------------------------------------------------------} +procedure TCarbonTab.ShowHide(AVisible: Boolean); +begin + if not (csDesigning in LCLObject.ComponentState) then + inherited ShowHide(AVisible) + else + begin + if FParent <> nil then + AVisible := + (LCLObject as TCustomPage).PageIndex = (FParent.LCLObject as TCustomNotebook).PageIndex; + + OSError(HIViewSetVisible(Frames[0], AVisible), + Self, 'ShowHide', SViewVisible); + end; +end; + { TCarbonTabsControl } {------------------------------------------------------------------------------ @@ -727,6 +751,26 @@ begin UpdateTabs; end; +{------------------------------------------------------------------------------ + Method: TCarbonTabsControl.IsDesignInteractive + Params: P + Returns: If the pos is design interactive + ------------------------------------------------------------------------------} +function TCarbonTabsControl.IsDesignInteractive(const P: TPoint): Boolean; +var + R: TRect; +begin + GetClientRect(R); + Offsetrect(R, -R.Left, -R.Top); + + case FTabPosition of + tpTop: Result := P.Y < R.Top; + tpBottom: Result := P.Y > R.Bottom; + tpLeft: Result := P.X < R.Left; + tpRight: Result := P.X > R.Right; + end; +end; + {------------------------------------------------------------------------------ Method: TCarbonTabsControl.ScrollTabsLeft; ------------------------------------------------------------------------------} diff --git a/lcl/interfaces/carbon/carbonwsextctrls.pp b/lcl/interfaces/carbon/carbonwsextctrls.pp index 8272991ee9..0de2b5131e 100644 --- a/lcl/interfaces/carbon/carbonwsextctrls.pp +++ b/lcl/interfaces/carbon/carbonwsextctrls.pp @@ -63,6 +63,7 @@ type class procedure MovePage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const NewIndex: integer); override; class procedure RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer); override; + class function GetDesignInteractive(const AWinControl: TWinControl; AClientPos: TPoint): Boolean; override; //class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override; //class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override; //class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; override; @@ -309,6 +310,20 @@ begin TCarbonTabsControl(ANotebook.Handle).Remove(AIndex); end; +{------------------------------------------------------------------------------ + Method: TCarbonWSCustomNotebook.GetDesignInteractive + Params: AWinControl - LCL win control + AClientPos - Pos + Returns: If client pos should be interactive in designer + ------------------------------------------------------------------------------} +class function TCarbonWSCustomNotebook.GetDesignInteractive( + const AWinControl: TWinControl; AClientPos: TPoint): Boolean; +begin + Result := False; + if not CheckHandle(AWinControl, Self, 'GetDesignInteractive') then Exit; + Result := TCarbonTabsControl(AWinControl.Handle).IsDesignInteractive(AClientPos); +end; + {------------------------------------------------------------------------------ Method: TCarbonWSCustomNotebook.SetPageIndex Params: ANotebook - LCL custom notebook