You are not logged in.
I am a pretty hardcore plain C programmer but I have only made console applications. I am thinking it's about time I learn to do some GUI programming and I want to do something cross platform.
I read GTK+ is great for C programmers but it's a bit of pain to get up and going on other platforms. I read QT was easy to design with their IDE, but haven't heard much else. I heard wxWidgets is fantastic and cross platform but for C++ programmers. I haven't been able to find out if it's possible to do easily under C alone.
I assume I could code with wxWidgets but use plain C and use very limited C++. Sounds like a nightmare though.
What should I do?!
Offline
I think I'm in a similar situation as you. I wanted to make a GUI application that was super duper cross platform. I decided to use Python + wxPython + wxGlade, all of which I'd never used before. My program is coming along nicely.
wxWidgets apparently has a C implementation called wxC. It looks old and there doesn't seem to be an Arch package for it.
I really don't think using C++ wxWidgets with C style code would be difficult at all. To make things braid-dead simple, use wxGlade and throw together a GUI. When you choose a language in wxGlade, select "C++". (it also has Lisp, Python, XRC, and Perl, which you can switch to at any time) Then write you functionality in C style code, and make the GUI widgets call that code.
Please let me know if you have any questions about wxWidgets or wxGlade. I may be able to help, from one noob to another.
Anyway, I can confirm that my wxWidgets program is as easy to run and looks as nice on both Windows and Linux / GTK.
Offline
Oh thanks, wxGlade looks pretty cool. I will read up on it and I will also check out wxC, but it appears using C within C++ is probably the better more up-to-date route.
The reason I first became interested in Java was for a simple cross-platform GUI interface and code similar to C's syntax. I am interested in learning one of these APIs for C because it's my main language. I do think other languages have it much easier than C does though!
Last edited by Google (2010-11-13 15:52:46)
Offline
GTK+ is great if you are trying to build a cross-platform GUI in C. If you use only C within QT, you lose almost all potential (Polymorphism, especially). I haven't tried wxWidgets however. My final verdict, use GTK+ if you only want to use C.
Arch i686 + KDE4
"I Write Programs, Not Excuses" - Panic! at the Kernel
Offline
Never tried GTK+ because of its sample codes, they are not pretty. But have poking around with wxWidgets and must say that build a GUI with it is straightforward, with a bunch of ready-to-go panels, easy dockable panels, and such. Also, Qt is a full feature framework, which I highlight the multimedia and thread classes, and still provides a great IDE (qt creator and qt designer) and documentation.
Hope my input helps you decide.
Offline
Would you say GTK+ is very "cross platform" friendly? I have found a lot of reviews that say it gave them hell. I would prefer it seeing as how it's in pure C, but if it's not very friendly then it may lead me to wxWidgets. So far I am trying to figure out which of the two is more friendly.
I did check out the sample code and wxWidgets is certainly more 'readable' and prettier. GTK+ looks pretty complicated and hard to follow but that's kind of expected given C was made without a GUI in mind and not object oriented, it feels like it's a rather difficult undertaking for C.
Offline
I did check out the sample code and wxWidgets is certainly more 'readable' and prettier. GTK+ looks pretty complicated and hard to follow but that's kind of expected given C was made without a GUI in mind and not object oriented, it feels like it's a rather difficult undertaking for C.
I agree, wxWidgets is very readable and was quite easy for me to pick up. For reference, the only other GUI programming I've done was in Java Swing, and it's been a few years.
Part of the reason GTK looks so complicated is because (I hope someone will correct me if I'm wrong) it actually is an object oriented design, but is written in C. For example, everything is a child class of "GObject". Now, because C doesn't have a way to natively express object oriented design, GTK has really long function names to make up for not having objects and namespaces.
I'm afraid I don't have any experience with using GTK on different operating systems. You could try throwing together a GUI (that doesn't do anything) in Glade and seeing how it looks.
Offline
I am not sure if it's considered real OOP, but it is at the very least "bootleg OOP." I read about doing OOP within plain C.
http://www.planetpdf.com/codecuts/pdfs/ooc.pdf
This outlines it, pretty complicated but workable. I think it's pretty cool.
Offline
I don't know about the hard cross-plaftrom part on GTK's behalf.. I only know that GiMP does not really seem to have trouble being cross-plaftrom.
Offline
GTK+ is not hard to set up in Window, but does take a little more time than just firing up a package manager.
Part of the reason GTK looks so complicated is because (I hope someone will correct me if I'm wrong) it actually is an object oriented design, but is written in C. For example, everything is a child class of "GObject". Now, because C doesn't have a way to natively express object oriented design, GTK has really long function names to make up for not having objects and namespaces.
Percisely.
Arch i686 + KDE4
"I Write Programs, Not Excuses" - Panic! at the Kernel
Offline
GTK+ . . . . . i have a small program in Python/PyGTK/Gtk+ and just this month started to (re)build C/GTK+ and C++/gtkmm/GTK+.
For the moment i think C: you really get a LOT more (lines)code to do something.
C++ works slightly better but still need a lot of weird functions and extra pointer declarations / instructions to get something.
Note: my GUI is designed with Glade and Python has this nice function: gtk.Builder.connect_signals
i could not find such in C/C++/gtkmm. Hence my C++ program is 40 lines extra.
Suggest: Look around and take the toolkit & language that makes YOU feel confortable and meets your way of working.
Offline
I like GTK+, I've used it on windows and it isn't hard to do so. I also like that it works with so many languages (C, C++, Vala, Python, almost everything it seems)
There is a lot of code writing involved, especially when you write your own widgets, but seeing how it works has taught me a few things about C and object-oriented thinking. But then I'm only a beginner with C
Offline