Question

I'm looking for a reasonably cross-platform way to render windows and widgets and style them the way I want without losing the ability to interface with the OS-preferred ways of doing things like redrawing or text input. I am also keen on knowing how Photoshop did this on Windows, as a concrete example.

I'm writing a program primarily for myself but I want to leave open a possibility to share it with others afterwards if it would be useful for more people. I want to really customize its look-and-feel but would like to keep it using native GUI libraries, such as windows forms or something more specific than just rendering my inerface to X11 windows. As I have to use it both on Windows and X11 the solution would preferably be cross-platform but I'm ready to implement multiple UI front-ends if needed, too, if it would provide reasonably consistent looks on both systems. OSX support is a plus, but really far from mandatory. I don't see myself porting this to OSX quite yet. I have barely started.

The reason I want theming is simple: I like dark themes because they are very relaxing to my eyes. On Windows, Microsoft Visual Studio and Adobe Photoshop (Photoshop as the only one and VS by default) display a dark theme and I find it enjoyable to work with these pieces of software for the sole rest that my eyes get. However, both of these, as it seems, use Windows' native controls (I can get to individual widgets in these using Hawkeye and they seem to have descriptive class names, consistent with what they represent).

I see this done way more on Windows than on X11 systems (GNOME, KDE, XFCE on GNU/Linux), maybe because Windows' theming is as rigid as it can get and on X11 window managers and GUI toolkits (KDE with Qt comes to my mind) are really flexible at that so apps needn't implement their own styles when the user can choose them DE-wide quite freely.

I didn't really do GUI programming at all before so I feel a little lost. I would like to refrain from drawing all GUI in a window with an OpenGL context, because I like the idea of the OS drawing legible, subpixel-level text for me, according to the users' settings, and handling partial window redraws instead of full ones. I would also like to integrate with the operating system with, for example, text input. As I said, I would like to share the software some day, so it'd be nice if I don't have to make fundamental changes beforehand.

I'm using C for core code as I've grown tired of futile OOP (whose most benefits I fail to understand if I'm the only one working on the project) with C++ and just want to write code, but I see that GUI libraries for C are in deficit, so I'm ready to write the GUI front-end in another language and link it against my C object files.

Bottom line, to focus on a multiplatform example, how does Photoshop go about redrawing native Windows widgets? I see it looks very consistent on Windows and Mac. Supporting X11 would be less of a problem, as I wouldn't force my styling in the X11 version, just proxy all through a standard widget library (Gtk+? Qt?) and let the desktop environment/window managers/whatevs style it for me. Though I don't know enough on how window and widget management works on GNU/Linux desktop environments to make assumptions.

Thanks in advance.

Was it helpful?

Solution

NOTE: This is purely anecdotal and based upon my own assumptions.

Due to Photoshop's age, I would assume it uses its own custom, proprietary GUI toolkit. It may use the underlying OS's native toolkit but more than likely it just mimics the look and feel. I know Sublime Text uses a custom toolkit made by the developer.

I have made simple applications with .NET, GTK (PyGTK), and Qt (PySide). If you want to support multiple platforms I'd really recommend using a cross-platform toolkit instead of writing the GUI specific to each OS because of the amount of work involved.

  • I liked .NET but it's not really cross-platform (I'm not sure what all is supported by Mono).

  • GTK2 (via PyGTK) was fairly straight forward to us. It looked good on Linux (Ubuntu) but I could not get some custom styles working properly in Windows (unless Windows 95 looks good). I also found PyGTK's documentation lacking. GTK3 is the way forward, but last I knew it was still under heavy development and isn't stable on Windows (yet).

  • I will say I liked Qt (PySide) the best. I found its documentation and examples better than GTK's. It supports native OS themeing along with custom styles and themes (I don't have personal experience with this though). By default it looks native on both Windows (XP and 7), and Linux (Ubuntu).

  • I have no experience with wxWidgets so I have no say on it, but it is cross-platform.

I would recommend looking into using Qt, though you would have to use C++ (or a higher-level language with available bindings).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top