Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Simple cross-platform C GUI library

Credits go to le_y_mistar and Matthew Leverton for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2 
Simple cross-platform C GUI library
axilmar
Member #1,204
April 2001

Qt should be adopted by the C++ community as the defacto C++ SDK.

Archon
Member #4,195
January 2004
avatar

Quote:

Qt should be adopted by the C++ community as the defacto C++ SDK.

Unfortunately, that'd GPL everything done with C++. Unless Tomasu can purchase us all licences.

Thomas Fjellstrom
Member #476
June 2000
avatar

Heh, I wish. I can't afford my own licence at the moment.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

BAF
Member #2,981
December 2002
avatar

C# still beats Qt, IMO as far as RAD goes. I've not used Qt much, but I don't think it has a fully integrated GUI designer and kick ass IDE. Of course, the caveat there is that its primarily Windows target audience. :-/

Thomas Fjellstrom
Member #476
June 2000
avatar

The Qt designer fully integrates into MSVC and Eclipse.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

MiquelFire
Member #3,110
January 2003
avatar

Though, for MSVC (unless they changed recently) you have to pay anyway. (MSVC IDE was not free when it went dual license between their pay and GPL)

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

Thomas Fjellstrom
Member #476
June 2000
avatar

Pretty much. But you have to pay for the good C# ide anyhow.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Archon
Member #4,195
January 2004
avatar

Quote:

Pretty much. But you have to pay for the good C# ide anyhow.

...or be a part of a university course that is linked with Microsoft :)

Actually, I suggested to one of my lecturers to ask if he could discuss about the .odf standard -- perhaps to replace the widespread .doc standard (it was a far shot, I know). He said that it may be difficult because of my university's ties with Microsoft. :-X

axilmar
Member #1,204
April 2001

Getting back to the original topic, there is not a simple GUI library for C. My emphasis on simplicity...I think the simplest interface for a C-based GUI is to use message passing, ala Allegro. The GTK object-orientation mechanism bolted onto C is horrible. In other words, a really simple C GUI would be something like this:

#include <gui.h>

int main() {
    Widget window = create_widget(&window_class, NULL,
        PROPERTY_TEXT, "a window",
        NULL);
    Widget button = create_widget(&button_class, NULL,
        PROPERTY_TEXT, "Click me",
        EVENT_CLICK, event(&window, MESSAGE_CLOSE, NULL),
        NULL);
    do_event_loop(window);
}

Making new widgets should be as simple as:

1enum MY_WIDGET_PROPERTIES {
2 PROPERTY_DATA = WIDGET_PROPERTY_LAST,
3 MY_WIDGET_PROPERTY_LAST
4};
5 
6 
7struct _MY_WIDGET {
8 _WIDGET widget;
9 int data;
10};
11 
12static int _my_widget_proc(_WIDGET *wgt, int msg, void *data) {
13 _MY_WIDGET *m = (_MY_WIDGET *)wgt;
14 
15 switch (msg) {
16 case MESSAGE_PAINT:
17 ...bla bla paint widget
18 break;
19 
20 case MESSAGE_SET_PROPERTY:
21 ...bla bla set property
22 break;
23 }
24 
25 etc
26}
27 
28WIDGET_CLASS my_widget_class = {
29 "my_widget",
30 sizeof(_MY_WIDGET),
31 _my_widget_proc
32};

This style of object orientation is much more preferrable than the style of GTK. Unfortunately there is no such cross platform GUI for C. The QNX's Photon GUI uses this design. Motif/Lesstif uses this design as well, but there are lots of horrible things in them.

X-G
Member #856
December 2000
avatar

I can honestly say this is why I try to do as much of my GUI stuff as possible in Python with wxPython these days. It's so much more comfortable.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

BAF
Member #2,981
December 2002
avatar

What's wrong with the express versions of VC# or VC?

HoHo
Member #4,534
April 2004
avatar

Officially QT doesn't support express versions, also they lack profiler, a thing I really need for my work.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

juvinious
Member #5,145
October 2004
avatar

Well it seems that might change

__________________________________________
Paintown

MiquelFire
Member #3,110
January 2003
avatar

Sweet! I'm so going to use that! Though I'll still use MinGW to make the release copy however.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

 1   2 


Go to: