On 2010-07-02 03:33, Marc Weber wrote:
> Excerpts from Aljosa Mohorovic's message of Fri Jul 02 01:26:37 +0200 2010:
> > i think it's been discussed before but yes, i want a buffer/window/
> > anything inside vim that can render more advanced gui elements.
> > since gvim uses gtk is it possible to display other gtk elements
> > inside gvim window?
>
> If you hack gvim then yes.
> However I think you can't touch the main typing area easily because it
> basically is a terminal or such.
Agreed, if I remember correctly, even the GTK "tabs" aren't really tabs,
but more like buttons that tell the main vim window which "tab" it
should display.
On 2010-07-02 16:26, Aljosa Mohorovic wrote:
> On Jul 1, 6:10?pm, Marc Weber <[email protected]> wrote:
> > The other way should be easy: create a window and embed Vim and your
> > other X application.
>
> could you point me to an existing example?
This will work, and it's pretty easy to do, I've attached a simple
example using GtkSocket. What you won't be able to do is treat your GUI
as a "vim window", e.g.:
+========================+
| TITLE |
+========================+
| | YOUR |
| VIM | GUI |
| |------------|
| | |
|-----------| VIM |
| VIM | |
+========================+
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
#include <gtk/gtk.h>
#define EXPR "'GoHello, World!<Esc><C-O>'"
void send_hello(GtkButton *btn, gint id)
{
gchar *command = g_strdup_printf(
"gvim --servername %d --remote-send " EXPR, id);
g_spawn_command_line_async(command, NULL);
}
gint main(gint argc, gchar **argv)
{
gtk_init(&argc, &argv);
/* Create window */
GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
GtkWidget *sock = gtk_socket_new();
GtkWidget *btn = gtk_button_new_with_label("Hello, World!");
g_signal_connect(sock, "plug-removed", gtk_main_quit, NULL);
g_signal_connect(sock, "plug-removed", gtk_main_quit, NULL);
g_signal_connect(win, "delete-event", gtk_main_quit, NULL);
gtk_widget_set_size_request(sock, 200, 200);
gtk_box_pack_start(GTK_BOX(vbox), sock, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), btn, FALSE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(win), vbox);
gtk_widget_show_all(win);
/* Embed vim */
GdkNativeWindow id = gtk_socket_get_id(GTK_SOCKET(sock));
gchar *command = g_strdup_printf(
"gvim --servername %d --socketid %d", id, id);
g_spawn_command_line_async(command, NULL);
g_signal_connect(btn, "clicked", G_CALLBACK(send_hello), (gpointer)id);
/* Run */
gtk_main();
return 0;
}