Photon Micro is an open-source, lightweight and modular GUI, which comprises of fine-grained and flyweight ‘elements’. It uses a declarative C++ code with a heavy emphasis on reuse, to form deep element hierarchies.
Photon has its own HTML5 inspired canvas drawing engine and uses Cairo as a 2D graphics library. Cairo supports the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG file output.
Joel de Guzman, the creator of Photon Micro GUI, and the main author of the Boost.Spirit Parser library, the Boost.Fusion library and the Boost.Phoenix library says, “One of the main projects I got involved with when I was working in Japan in the 90s, was a lightweight GUI library named Pica. So I went ahead, dusted off the old code and rewrote it from the ground up using modern C++.”
The Photon Micro GUI client can use the following gallery code:
Image Source: Cycfi
This pops up a warning:
Image Source: Cycfi
Some highlights of Photon Micro GUI
Modularity and reuse are two important design aspects of the Photon Micro GUI. It is supported by the following functionalities:
Photon Micro GUI can be shared using std::shared_ptr.
Hold can be used to share an element somewhere in the view hierarchy.
It is a delegate element that intercepts key-presses.
Elements are extremely lightweight, fixed_size fixes the size of the GUI contained element.
These are two of the many margins, including right_margin, top_margin, etc. It adds padding around the element like the margin adds 20 pixels all around the contained element. The left_margin adds a padding of 20 pixels to separate the icon and the text box.
Vertical and horizontal fluid layout elements allocate sufficient space to contained elements. This enables stretchiness, fixed sizing, and vertical and horizontal alignment, to place elements in a grid. Stretchiness is the ability of elements to stretch within a defined minimum and maximum size limit.
Guzman adds, “While it is usable, and based on very solid architecture and design, there is still a lot of work to do. First, the Windows and Linux ports are currently in an unusable state due to recent low-level refactoring.”
Some developers have shown interest in the elements of Photon Micro GUI.
Just saw this blog post highlighting the Photon Micro GUI C++ Library, the latest open source project inspired by Joel de Guzman, the guy that gave us the Spirit parser in Boost! Worth keeping an eye on, and perhaps collaborating if it hits your need: https://t.co/00ex6vQ4nJ
— Alisdair Meredith (@AlisdairMered) July 8, 2019
A user on Hacker News comments, “Awesome, that looks like an attempt to replace QML by native C++. Would be great if there was a SwiftUI inspired C++ UI framework (well, of course C++ might not lend itself so well for the job, but I’m just very curious what it would look like if someone makes a real attempt).”
Some users feel that more work needs to be done to make this GUI more accessible and less skeuomorphic.
A user says, “Too many skeuomorphic elements. He needs to take the controls people know and understand and replace them with cryptic methods that require new learning, and are hidden from view by default. Otherwise, no one will take it seriously as a modern UI.”
Another user on Hacker News adds, “don’t use a GUI toolkit like this, that draws its own widgets rather than using platform standard ones when developing a plugin for a digital audio workstation (e.g. VST or Audio Unit), as this author is apparently doing. Unless someone puts in all the extra effort to implement platform-specific accessibility APIs for said toolkit.”
For details about the other highlights, head over to Joel de Guzman’s post.