Generic API for multiple platforms

The andlabs UI project provides a generic API that wraps operating-system-native widgets on Windows, Linux, and macOS. Due to this approach, it's largely limited to the lowest common denominator level of functionality, but considering how similar these toolkits are, the resulting API is surprisingly rich.

All widgets inherit from the ui.Control interface, which defines the Show(), Hide(), Enable(), and Disable() methods that all controls must implement (with obvious expected behavior). Additionally, it defines the LibuiControl() and Handle() methods, which provide a pointer to the low-level libui and operating-system widgets, respectively. The use of those methods is generally not recommended and so not covered in this chapter.

When compared to the Qt inspired Walk API of the Chapter 4, Walk - Building Graphical Windows Applications, the layout capabilities of andlabs UI appear limited with fewer controls managing the GUI visual flow. Native controls (while broadly similar) are programmed differently and not necessarily compatible with the same high-level layout definitions. What you will see in the following section is that containers are typically set up to expect one child, which is laid out using a ui.Box control. Many widgets, which could be considered containers in other toolkits, are managed as a single control in andlabs UI (such as ui.RadioButtons) so that the operating-system-specific implementation can be handled internally.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.68.18