Before someone reports this as a bug. Some methods have been removed from the NSToolBar. This means that there is no longer a "Use Small Size" method and the ToolBar icons are always large.
Link: https://developer.apple.com/forums/thread/696389
Link: https://developer.apple.com/documentati ... guage=objc
Code: Select all
;-TOP
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
#NSWindowToolbarStyleAutomatic = 0 ;
#NSWindowToolbarStyleExpanded = 1 ; Top Left
#NSWindowToolbarStylePreference = 2; Top Center
#NSWindowToolbarStyleUnified = 3 ; TitleBar Large
#NSWindowToolbarStyleUnifiedCompact = 4 ; TitleBar without text
CompilerEndIf
Procedure SetToolBarStyle(Window, Style)
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
If OSVersion() > #PB_OS_MacOSX_10_14
CocoaMessage(0, WindowID(Window), "setToolbarStyle:", Style)
EndIf
CompilerEndIf
EndProcedure
If OpenWindow(0, 0, 0, 350, 25, "ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
; Fix on Big Sur to old style expanded
SetToolBarStyle(0, #NSWindowToolbarStyleExpanded)
CompilerEndIf
CreateImage(0,16,16)
StartDrawing(ImageOutput(0))
Box(0,0,16,16,RGB(255,255,255))
Box(4,4,8,8,RGB(255,0,0))
StopDrawing()
CreateImage(1,16,16)
StartDrawing(ImageOutput(1))
Box(0,0,16,16,RGB(255,0,0))
Box(4,4,8,8,RGB(255,255,255))
StopDrawing()
If CreateToolBar(0, WindowID(0))
ToolBarImageButton(0,ImageID(0))
ToolBarImageButton(1,ImageID(1))
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf