diff options
author | jestin | 2004-06-25 18:26:19 +0000 |
---|---|---|
committer | jestin | 2004-06-25 18:26:19 +0000 |
commit | cfc602e2408bf90cce7be62f3f1e940cd5af7172 (patch) | |
tree | f3b3078f308ff676acfee099aa3c0a4268e15b9a /examples/gtkIvyButton.c | |
parent | 43eaf35871578ea498e20ed4f945cce14f8f3032 (diff) | |
download | ivy-c-cfc602e2408bf90cce7be62f3f1e940cd5af7172.zip ivy-c-cfc602e2408bf90cce7be62f3f1e940cd5af7172.tar.gz ivy-c-cfc602e2408bf90cce7be62f3f1e940cd5af7172.tar.bz2 ivy-c-cfc602e2408bf90cce7be62f3f1e940cd5af7172.tar.xz |
j'ajoute des exemples de code dans le CVS. il faudra les intégrer à la doc...
Diffstat (limited to 'examples/gtkIvyButton.c')
-rw-r--r-- | examples/gtkIvyButton.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/gtkIvyButton.c b/examples/gtkIvyButton.c new file mode 100644 index 0000000..be8cc4a --- /dev/null +++ b/examples/gtkIvyButton.c @@ -0,0 +1,34 @@ +#include <gtk/gtk.h> +#include <ivy.h> +#include <ivygtkloop.h> +#include <stdio.h> +#include <stdlib.h> + +void hello( GtkWidget *widget, gpointer data ) { + fprintf(stderr,"%s\n",*((char**)data)); + IvySendMsg(*((char**)data)); +} + +void textCallback(IvyClientPtr app, void *user_data, int argc, char *argv[]){ + *((char **)user_data)=argv[0]; +} + +int main( int argc, char *argv[] ) { + GtkWidget *window; + GtkWidget *button; + char *bus=getenv("IVYBUS"); + char *tosend="foo"; + gtk_init (&argc, &argv); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + button = gtk_button_new_with_label ("send message"); + g_signal_connect (G_OBJECT(button),"clicked",G_CALLBACK(hello),&tosend); + gtk_container_add (GTK_CONTAINER(window),button); + gtk_widget_show (button); + gtk_widget_show (window); + IvyInit ("IvyGtkButton", "IvyGtkButton READY",NULL,NULL,NULL,NULL); + IvyBindMsg(textCallback,&tosend,"^Ivy Button text=(.*)"); + IvyStart (bus); + gtk_main (); + return 0; +} |