GtkWrap

SourceForge.net Logo

Scope

The goal of this project is to treat the Gtk+ API as a specification and implement its functionality using the win32 API. This is a bit different than Gtk+ for Windows, that implementation does not use native win32 controls.

Why?

I was asked to develop an application that ran on both Linux and Windows. I said to myself, "No problem, I'll just build the GUI with Glade, write portable business logic, and compile on each platform". The customer saw the results and really wanted the GUI to have the Windows native look on Windows and the Gtk look on Linux (don't ask why please).

Anyway, I thought about switching to wxWindows to solve this problem. However, I really like Glade and Gtk. Then I thought, why not implement the Gtk functions myself with the win32 API. That's how this started. So I built the GUI using Glade and began to write each function that Glade produced in win32.

Status

My implementation shares no code with Gtk+. I am simply treating the API definitions from the help pages as a specification. For my purposes, I have implemented enough of Gtk to solve my little problem. However I am looking for help to continue the effort and finish the job.

If you are interested, please contact me and join the sourceforge project, adam@agstools.com.

Screenshots

Native

GtkWrap

Same Source

GtkWidget* create_window1()
{
    GtkWidget* window1;
    GtkWidget* vbox1;
    GtkWidget* hbox1;
    GtkWidget* label1;
    GtkWidget* entry1;
    GtkWidget* button1;
    GtkWidget* notebook1;
    GtkWidget* clist1;
    GtkWidget* label2;
    GtkWidget* text1;
    GtkWidget* label3;
    char* titles[2] = {"col0", "col1"};
    
    window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    vbox1 = gtk_vbox_new(FALSE, 5);
    gtk_widget_show(vbox1);
    gtk_container_add(GTK_CONTAINER(window1), vbox1);
       
    hbox1 = gtk_hbox_new(FALSE, 5);
    gtk_widget_show(hbox1);
    gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 5);
    
    label1 = gtk_label_new("Search:");
    gtk_widget_show(label1);
    gtk_box_pack_start(GTK_BOX(hbox1), label1, FALSE, FALSE, 5);
    
    entry1 = gtk_entry_new();
    gtk_widget_show(entry1);
    gtk_box_pack_start(GTK_BOX(hbox1), entry1, FALSE, FALSE, 5);
    
    button1 = gtk_button_new_with_label("OK");
    gtk_widget_show(button1);
    gtk_box_pack_start(GTK_BOX(hbox1), button1, FALSE, FALSE, 5);
    
    notebook1 = gtk_notebook_new();
    gtk_widget_show(notebook1);
    gtk_box_pack_start(GTK_BOX(vbox1), notebook1, TRUE, TRUE, 5);
    
    clist1 = gtk_clist_new_with_titles(2, titles);
    gtk_widget_show(clist1);
    label2 = gtk_label_new("Label2");
    gtk_widget_show(label2);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), clist1, label2);
    
    text1 = gtk_text_new(NULL, NULL);
    gtk_widget_show(text1);
    label3 = gtk_label_new("Label3");
    gtk_widget_show(label3);
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), text1, label3);

    gtk_window_set_title(GTK_WINDOW(window1), "GtkWrap");
    
    return window1;
}

SourceForge.net Logo