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
James Stanley
Member #7,275
May 2006
avatar

I am looking for a GUI library with some very strict requirements:

- It must run on at least Linux and Windows
- It must be possible to use in C
- It must not interrupt execution of the program
EDIT: - It should be fairly simple to incorporate into an existing program

The third requirement means that the program can continue to handle network traffic whilst asking the user to enter some information.

Matthew Leverton
Supreme Loser
January 1999
avatar

"Not ugly" wasn't a requirement, so why not use Allegro's?

James Stanley
Member #7,275
May 2006
avatar

Allegro's isn't simple for this task since it's not an allegro-based program.
It is currently a text-based tunneling proxy, but I wanted to put a GUI on the client to make it look nicer.

EDIT:
But I would be willing to use it if it's the only option

EDIT2:
I forgot to mention fairly simple as a requirement.

le_y_mistar
Member #8,251
January 2007
avatar

i believe QT is crossplatform, so is GTK..just learn GUIs and event handling, that's the most straightforward way.

-----------------
I'm hell of an awesome guy :)

James Stanley
Member #7,275
May 2006
avatar

Qt is C++, so I wouldn't consider using it (although I like how it looks). I'll see the GTK docs some time to see if I'd get on with it. Thanks.

kronoman
Member #2,911
November 2002
avatar

what about using a text GUI? like ncurses based or something... good old conio.h? :P

X-G
Member #856
December 2000
avatar

wxWidgets.

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

Vanneto
Member #8,643
May 2007

I tried to download wxWidgets, but I couldnt find any binary packages for Windows. Compiling would take all night I reckon. Can anyone tell me where to get binary packages?

In capitalist America bank robs you.

Goalie Ca
Member #2,579
July 2002
avatar

Quote:

The third requirement means that the program can continue to handle network traffic whilst asking the user to enter some information.

this is commonly known as threading :P

I recommend GTK but wxWidgets should fit the bill. I haven't found a wxWidgets bin for windows though. It is not too hard to compile.

-------------
Bah weep granah weep nini bong!

Thomas Fjellstrom
Member #476
June 2000
avatar

Wx is also C++.

--
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

GTK is horrid looking. Compiling wx doesn't take too long, it took probably 3 hours on my old 366mhz box. What's wrong with C++?

kazzmir
Member #1,786
December 2001
avatar

Quote:

GTK is horrid looking.

Well.. I like it. At least how it looks. I tried my hand at writing a GTK app once but the whole framework just seems to cumbersome.

Archon
Member #4,195
January 2004
avatar

I think that GTK with the Ubuntu theme looks quite nice.

MiquelFire
Member #3,110
January 2003
avatar

I tend to not like GTK apps on Windows. It's one of the two reasons I was running XChat via NX during Speedhack. (Other being that last I checked, you needed to pay to get a precompiled version for Windows from the developers, or hope someone has a binary that may not crash often because of a plugin that happens to only work well with the official binary, or something stupid like that.)

---
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

Mokkan
Member #4,355
February 2004
avatar

Quote:

What's wrong with C++?

Didn't you hear what Linus Torvalds said? >:(

But seriously, if you're hellbent on using C, GTK is really your main option.

James Stanley
Member #7,275
May 2006
avatar

Quote:

What's wrong with C++?

I don't and have never liked the C++ way. Presumably, as Qt is a C++ library, it does things the C++ way.

EDIT:
By that I mean I dislike the STL and classes.

Jonatan Hedborg
Member #4,886
July 2004
avatar

Let's just leave it at "he wants to use C" and not start yet another C vs. C++ thread...

James Stanley
Member #7,275
May 2006
avatar

The thread can be closed now, anyway, since I have more or less decided on GTK.

Carrus85
Member #2,633
August 2002
avatar

Quote:

I don't and have never liked the C++ way. Presumably, as Qt is a C++ library, it does things the C++ way.

Well, in that case, you can use the "C++ way" for everything Qt/wx provides, but do everything else the C way (with extra nitpicks provided to you courtesy of C++!) to just stick to the man!

I guess I don't get the whole "I want to use C because the C++ way of doing things is annoying" when "The C++ way of doing things is (almost; there are a handful of corner cases) a strict superset of the C way of doing things."

Seriously, there is no reason why you cannot use malloc/free, no exceptions, only functions, and use the wonky (type_to_cast_to_here) syntax.

James Stanley
Member #7,275
May 2006
avatar

You don't seem to understand.
I am not happy to use C++ just because that's what library X uses. Even if I only use it to interface with the library (and there is no point in writing a C wrapper).
I am happy to go with GTK.
Thank you to everone.

Carrus85
Member #2,633
August 2002
avatar

Suit yourself. (I'm not trying to be condescending or anything, I'm just saying, in most cases, you can compile C code as C++ code just fine with minimal "fixup" work (or so my experiences seem to indicate)).

James Stanley
Member #7,275
May 2006
avatar

Sorry to be so harsh in my reply.
I was getting a little frustrated because I thought the thread should have ended by now.
I've compiled C code as C++ before, so I knew that. I just think that if I'd be happy using the GUI as C++ I'd do the rest of the program in C++.

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

as Qt is a C++ library, it does things the C++ way.

Actually, it does things the Qt way. It provides its own sane platform to work from, so you don't even have to touch the stl or stdlibc++.

The only reason I decided to work with C++ more often was because Qt is C++, and has un-stupid classes (like a String class that's actually usefull), and a kick ass GUI component.

Qt 4 is much more than just GUI, it has several modules, including the following:

QtCore      Core non-GUI classes used by other modules
QtGui       Graphical user interface components
QtNetwork   Classes for network programming
QtOpenGL    OpenGL support classes
QtSql       Classes for database integration using SQL
QtScript    Classes for evaluating Qt Scripts
QtSvg       Classes for displaying the contents of SVG files
QtXml       Classes for handling XML
QtDesigner  Classes for extending Qt Designer
QtUiTools   Classes for handling Qt Designer forms in applications
QtAssistant Support for online help
Qt3Support  Qt 3 compatibility classes
QtTest      Tool classes for unit testing

Its quite the inclusive platform. It also supports Windows, X, and MacOS. As well as most Qt code can work under QTopia (mobile device version, ie phones and tablets) possibly with some changes.

--
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

Qt4 is like the Java class library for C++.

Thomas Fjellstrom
Member #476
June 2000
avatar

Qt4 is like the CPAN for C++ ;)

Qt4 actually makes C++ feel a little like Perl for me, in the RAD department that is.

--
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

 1   2 


Go to: