"Cross OS App for Linux/Windows using GTK" idea really inspired me.
I have created an include file for gtk (gtk.inc) and hll.inc (mostly useful generic macros from nagoa+.inc) in the hope that Gtk programs written using this can be compiled and executed in both platforms without any change.
I have attached the zip file containing
gtkwin.asm
hll.inc
gtk.inc
I have validated these in windows, but i don't have access to linux now, It would be great if Gunner or someone can validate this in linux and update.For windows All you need is nasm, golink and the gtk runtime dlls.
You can visit
http://www.gtk.org/download/win32.phpto get the runtime dlls or download from
http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zipExtract the dlls from the zip file to windows\system32 folder so that golink can find them. It worked for me
(The program displays a window with two controls and a pop up.)
The example program(gtkwin.asm) is translated from the following C Version.
#include <windows.h>
#include <gtk/gtk.h>
static GtkWidget *entry;
GtkWidget *window;
static gboolean kill_window(GtkWidget *widget, GdkEvent *event, gpointer data)
{
gtk_main_quit();
return FALSE;
}
static void button_press(GtkWidget *widget, gpointer data)
{
const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
GtkWidget *msgbox;
msgbox = gtk_message_dialog_new(window,GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_INFO ,GTK_BUTTONS_OK ,text);
gtk_window_set_title(GTK_WINDOW(msgbox), "Info");
gtk_dialog_run(GTK_DIALOG(msgbox));
gtk_widget_destroy(msgbox);
}
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
GtkWidget *button;
GtkWidget *hbox;
gtk_init_abi_check(NULL, NULL,2,sizeof(GtkWindow),sizeof(GtkBox));
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
button = gtk_button_new_with_label("Echo");
entry = gtk_entry_new();
hbox = gtk_hbox_new(FALSE, 2);
gtk_window_set_title(GTK_WINDOW(window), "GTK application");
g_signal_connect_data (window, "delete_event", G_CALLBACK(kill_window), NULL, NULL, (GConnectFlags) 0);
g_signal_connect_data (button, "clicked", G_CALLBACK(button_press), NULL, NULL, (GConnectFlags) 0);
gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 2);
gtk_container_add(GTK_CONTAINER(window), hbox);
gtk_widget_show_all(window);
gtk_main();
gtk_exit(0);
return 0;
}
I have not tried linking gtk programs written in nasm in linux before. i could use someone's help now.
Thanks,
Mathi.