Difference between revisions of "macOS extensions"

From Free Pascal wiki
Jump to navigationJump to search
Line 33: Line 33:
  
 
The implementation is checking for the presence of NSAppearance class dynamically.  Thus, if the code is launched on an earlier version of macOS, it would still be able to run, even though will not do anything.
 
The implementation is checking for the presence of NSAppearance class dynamically.  Thus, if the code is launched on an earlier version of macOS, it would still be able to run, even though will not do anything.
 +
 +
This is how the default '''Aqua''' style might look like:
 +
 +
[[Image:macosformprop_aqua.PNG]]
 +
 +
This is how the '''Dark''' style might look like:
 +
 +
[[Image:macosformprop_dark.PNG]]
 +
 +
The actual style look as well style availability depends on a certain macOS version, and might change overtime at Apple's decision
  
 
==See Also==
 
==See Also==

Revision as of 07:50, 15 April 2018

The package is intended to provide additional macOS Cocoa specific features.

Note: It's expected that those features will not work on any other system or as well as for deprecated Carbon API on macOS. However, it's expected that a project using the package would still succeffully compile and run on any other target.

Code

Extensions

After installation a new "macOS" tab is added to the components palette. All additional components are available in this tab:

macosext mainbar.PNG

TmacOSFormProp

The component is introduced to control MacOS NSWindow specific attributes and features, not available via LCL API.

Appearance

macosformprop apppropeditor.PNG

NSAppearance class was introduced in macOS 10.9 for the first time. It's per window appearance options. The fact that it's per window configuration makes it different from Themes - that's system wide configuration.

Appearance property of TmacOSFormProp component is used to adjust the appearance.

Apple suggests that there are 3 appearance styles currently available in the system:

* NSAppearanceNameAqua
* NSAppearanceNameVibrantDark
* NSAppearanceNameVibrantLight

The value of the property can be changed in design time as well as run-time. As soon as the value is changed, it's expected that the appearance of the form, is changed.

Note: if the form that's hosts TmacOSFormProp is embedded into another form, then the behavior is not defined. However, it's expected the parent form appearance would change.

Using TmacOSFormProp is not desired on any component other than form. I.e. it's possible to use it on a frame, but in that case, the appearance of the hosting would be changed.

In case multiple TmacOSFormProp are used, the later action would be used as preference. Multiple TmacOSFormProp are not desired for use, and might forbidden in future versions.


The implementation is checking for the presence of NSAppearance class dynamically. Thus, if the code is launched on an earlier version of macOS, it would still be able to run, even though will not do anything.

This is how the default Aqua style might look like:

macosformprop aqua.PNG

This is how the Dark style might look like:

macosformprop dark.PNG

The actual style look as well style availability depends on a certain macOS version, and might change overtime at Apple's decision

See Also