Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

C - Simple Example GTK (See related posts)

// gcc file.c -o file.o `pkg-config --libs --cflags gtk+-2.0`

#include <gtk/gtk.h>
#include <stdlib.h>

void displayUI()
{
	GtkWidget* mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	gtk_window_set_default_size(GTK_WINDOW(mainWindow), 400, 300);
	gtk_window_set_title(GTK_WINDOW(mainWindow), "GTK Simple Example");
	gtk_window_set_position(GTK_WINDOW(mainWindow), GTK_WIN_POS_CENTER_ALWAYS);

	gtk_signal_connect(GTK_OBJECT(mainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);

	gtk_widget_show_all(mainWindow);
}

int main(int argc, char *argv[])
{
	gtk_init(&argc, &argv);

	displayUI();

	gtk_main();

	return EXIT_SUCCESS;
}

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts