tags:

views:

189

answers:

6

I don't quite understand when people code in C, how they create their GUI interfaces. I've never seen a GUI implementation in C. I wondered if there is C libraries that allow you to create a GUI such as the one's we use daily in Windows or Linux?

A: 

The basic GUI in Windows is the GDI. It is C.

Didier Trosset
Uh. It's definitely not *CGI*.
Tarydon
True, it is GDI, my mistake.
Didier Trosset
You're looking for "GDI" rather than "CGI". Even then, you're not really correct though. At least according to *Inside Windows NT* (and such) Windows' graphics subsystem is written in C++. It wasn't in C++ in 16-bit Windows, but I'm not at all sure it was in C either. In fact, there's a pretty fair chance that much of it was hand-written assembly language (a lot of 16-bit Windows was).
Jerry Coffin
I don't know, not even care about what GDI is written in. The thing here is that it offers a C interface to be programmed, both on 16 bits and 32 bits versions, and that is still available on Windows 7!
Didier Trosset
A: 

First Google result for 'c gui library': GTK+.

Skilldrick
A: 

GTK+ is one such widget library written entirely in C. See www.gtk.org Major applications such as The GIMP and Inkscape use this, as well as the entire GNOME desktop for *nix.

Matthew Talbert
GTK is the Gimp ToolKit!
James Morris
A: 

C GUIs are created using function calls into specialized APIs to create and position graphical screen elements. There are many such toolkits, including Gtk and Microsoft's MFC-based GUI libraries.

http://www.yolinux.com/TUTORIALS/GTK+ProgrammingTips.html is a tutorial on basic GTK programming that will show you some of the basics of how it is done using that particular API. Most APIs will be similar to some degree.

David Pfeffer
MFC is in C++, albeit a very primitive use C++, but C++ nonetheless.
blwy10
+4  A: 

Many GUI toolkits use C:

  • The basic Win32 API (which itself is an interface to the entire OS, not just for GUIs).
  • GTK+
  • Xlib for the X window system

In fact, many cross-platform GUI toolkits which you might be familiar with are implemented in terms of these lower-level libraries.

Nick Meyer
+1  A: 

X and Motif, pretty much the progenator of all modern GUIs toolkits, were written in C and designed with C-oriented interfaces. Before that we had character-oriented toolkits like curses on Unix and SMG on VMS, both of which are C-oriented interfaces that don't use X-style callbacks.

It wasn't too long ago that C GUIs were considered the standard and C++ interfaces were this new concept that people were toying with. Dang, you make me feel old.

T.E.D.