"-------------------------------------------------- " GTK-server demo with the LIB interface " " tested with GVim 7 and GTK-server 2.1.3 on Linux " (c) PvE - march 19, 2007 " " Run standalone with: " vim -u script.in " " Console output may not function properly. "-------------------------------------------------- function! Gtk(args) return libcall(g:library, "gtk", a:args) endfunction function! Demo() if has("win32") || has("win64") let g:library = "gtk-server.dll" else let g:library = "/usr/lib/libgtk-server.so" endif call Gtk("gtk_init NULL NULL") let win = Gtk("gtk_window_new 0") call Gtk("gtk_window_set_title " . win . " 'A very cool VIM GTK demo'") call Gtk("gtk_window_set_default_size " . win . " 100 100") call Gtk("gtk_window_set_position " . win . " 1") let table = Gtk("gtk_table_new 30 30 1") call Gtk("gtk_container_add " . win . " " . table) let button1 = Gtk("gtk_button_new_with_label Exit") call Gtk("gtk_table_attach_defaults " . table . " " . button1 . " 17 28 20 25") let button2 = Gtk("gtk_button_new_with_label 'Print text'") call Gtk("gtk_table_attach_defaults " . table . " " . button2 . " 2 13 20 25") let entry = Gtk("gtk_entry_new") call Gtk("gtk_table_attach_defaults " . table . " " . entry . " 2 28 5 15") call Gtk("gtk_widget_show_all " . win) " Mainloop let event = "0" while event != button1 && event != win let event = Gtk("gtk_server_callback wait") if event == button2 let result = Gtk("gtk_entry_get_text " . entry) echo result endif endwhile endfunction " Run demo in standalone mode call Demo() quit