mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 06:39:31 +01:00 
			
		
		
		
	carbon: implement titlebar button measuring by ThemeManager (paul)
git-svn-id: trunk@41874 -
This commit is contained in:
		
							parent
							
								
									de54ab0d89
								
							
						
					
					
						commit
						e4a431af6a
					
				@ -556,6 +556,10 @@ end;
 | 
			
		||||
function TCarbonThemeServices.GetDetailSize(Details: TThemedElementDetails): TSize;
 | 
			
		||||
const
 | 
			
		||||
  DefaultPushButtonWidth = 70;
 | 
			
		||||
var
 | 
			
		||||
  BtnRect: CGRect;
 | 
			
		||||
  WindowDrawInfo: HIThemeWindowDrawInfo;
 | 
			
		||||
  WindowShape: HIShapeRef;
 | 
			
		||||
begin
 | 
			
		||||
  case Details.Element of
 | 
			
		||||
    teTreeView:
 | 
			
		||||
@ -577,6 +581,26 @@ begin
 | 
			
		||||
        );
 | 
			
		||||
      end else
 | 
			
		||||
        Result := inherited GetDetailSize(Details);
 | 
			
		||||
    teWindow:
 | 
			
		||||
      if (Details.Part in [WP_MINBUTTON, WP_MDIMINBUTTON, WP_MAXBUTTON, WP_CLOSEBUTTON, WP_SMALLCLOSEBUTTON, WP_MDICLOSEBUTTON, WP_RESTOREBUTTON, WP_MDIRESTOREBUTTON]) then
 | 
			
		||||
      begin
 | 
			
		||||
        BtnRect := RectToCGRect(Types.Rect(0, 0, 100, 100));
 | 
			
		||||
        WindowDrawInfo.version := 0;
 | 
			
		||||
        WindowDrawInfo.windowType := kThemeDocumentWindow;
 | 
			
		||||
        WindowDrawInfo.attributes := kThemeWindowHasFullZoom or kThemeWindowHasCloseBox or kThemeWindowHasCollapseBox;
 | 
			
		||||
        WindowDrawInfo.state := kThemeStateActive;
 | 
			
		||||
        WindowDrawInfo.titleHeight := 0;
 | 
			
		||||
        WindowDrawInfo.titleWidth := 0;
 | 
			
		||||
 | 
			
		||||
        HIThemeGetWindowShape(BtnRect, WindowDrawInfo, kWindowCloseBoxRgn, WindowShape);
 | 
			
		||||
        HIShapeGetBounds(WindowShape, BtnRect);
 | 
			
		||||
        with BtnRect.size do
 | 
			
		||||
        begin
 | 
			
		||||
          Result.cx := Round(width);
 | 
			
		||||
          Result.cy := Round(height);
 | 
			
		||||
        end;
 | 
			
		||||
      end else
 | 
			
		||||
        Result := inherited GetDetailSize(Details);
 | 
			
		||||
  else
 | 
			
		||||
    Result := inherited GetDetailSize(Details);
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user