[cairo-commit] goocanvas/demo .cvsignore, 1.5, 1.6 Makefile.am, 1.7, 1.8 table-demo.c, NONE, 1.1

Damon Chaplin commit at pdx.freedesktop.org
Sat Dec 9 04:08:42 PST 2006


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv17933/demo

Modified Files:
	.cvsignore Makefile.am 
Added Files:
	table-demo.c 
Log Message:
2006-12-09  Damon Chaplin  <damon at gnome.org>

	* docs/goocanvas-sections.txt: 
	* docs/goocanvas-docs.sgml: use separate sections for model objects,
	as gtk-doc doesn't support multiple objects per section.

	* docs/Makefile.am (SCANGOBJ_OPTIONS): added --query-child-properties
	argument to document child properties (needs cvs gtk-doc).

	* demo/table-demo.c: beginnings of demo for GooCanvasTable.



Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- .cvsignore	29 Nov 2006 20:45:47 -0000	1.5
+++ .cvsignore	9 Dec 2006 12:08:38 -0000	1.6
@@ -8,6 +8,7 @@
 demo
 simple-demo
 scalability-demo
+table-demo
 units-demo
 widgets-demo
 mv-demo

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile.am	29 Nov 2006 20:44:58 -0000	1.7
+++ Makefile.am	9 Dec 2006 12:08:38 -0000	1.8
@@ -7,7 +7,7 @@
 	-I$(top_srcdir)/src \
 	@PACKAGE_CFLAGS@
 
-noinst_PROGRAMS = demo simple-demo scalability-demo units-demo widgets-demo mv-demo mv-simple-demo
+noinst_PROGRAMS = demo simple-demo scalability-demo units-demo widgets-demo table-demo mv-demo mv-simple-demo
 
 demo_SOURCES = \
 	demo.c demo-fifteen.c demo-scalability.c demo-grabs.c \
@@ -48,5 +48,10 @@
 
 widgets_demo_LDADD = $(top_builddir)/src/libgoocanvas.la @PACKAGE_LIBS@ $(INTLLIBS)
 
+table_demo_SOURCES = \
+	table-demo.c
+
+table_demo_LDADD = $(top_builddir)/src/libgoocanvas.la @PACKAGE_LIBS@ $(INTLLIBS)
+
 EXTRA_DIST = flower.png toroid.png
 

--- NEW FILE: table-demo.c ---
#include <stdlib.h>
#include <goocanvas.h>


GtkWidget *canvas;
GooCanvasItem *move_item;
int num_added_widgets = 0;
GList *added_widget_items;

static gboolean
on_delete_event (GtkWidget *window,
		 GdkEvent  *event,
		 gpointer   unused_data)
{
  exit (0);
}


int
main (int argc, char *argv[])
{
  GtkWidget *window, *vbox, *hbox, *scrolled_win;
  GtkWidget *label, *entry, *textview;
  GtkTextBuffer *buffer;
  GooCanvasItem *root, *table, *witem, *item;

  /* Initialize GTK+. */
  gtk_set_locale ();
  gtk_init (&argc, &argv);

  /* Create the window and widgets. */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 640, 600);
  gtk_widget_show (window);
  g_signal_connect (window, "delete_event", (GtkSignalFunc) on_delete_event,
		    NULL);

  vbox = gtk_vbox_new (FALSE, 4);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
  gtk_widget_show (vbox);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  hbox = gtk_hbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

#if 0
  w = gtk_button_new_with_label ("Add Widget");
  gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
  gtk_widget_show (w);
  g_signal_connect (w, "clicked", (GtkSignalFunc) add_widget_clicked, NULL);
#endif

  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
				       GTK_SHADOW_IN);
  gtk_widget_show (scrolled_win);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);

  canvas = goo_canvas_new ();
  GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
  gtk_widget_set_size_request (canvas, 600, 450);
  goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 1000, 1000);
  gtk_container_add (GTK_CONTAINER (scrolled_win), canvas);

  root = goo_canvas_get_root_item (GOO_CANVAS (canvas));

  /* Add a few simple items. */
  table = goo_canvas_table_new (root, NULL);

  item = goo_canvas_rect_new (table, 100, 100, 50, 50, NULL);
  goo_canvas_item_set_child_properties (table, item,
					"row", 1,
					"column", 2,
					"x-align", 1.0,
					"y-align", 1.0,
					NULL);

  label = gtk_label_new ("Hello World");
  witem = goo_canvas_widget_new (table, label, 50, 50, 200, 100, NULL);

  entry = gtk_entry_new ();
  gtk_entry_set_text (GTK_ENTRY (entry), "Entry 1");
  witem = goo_canvas_widget_new (table, entry, 50, 300, -1, -1, NULL);

  entry = gtk_entry_new ();
  gtk_entry_set_text (GTK_ENTRY (entry), "Entry 2");
  witem = goo_canvas_widget_new (table, entry, 50, 350, 100, -1, NULL);

  /* Use a textview so we can see the width & height of the widget. */
  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
				       GTK_SHADOW_IN);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
				  GTK_POLICY_NEVER, GTK_POLICY_NEVER);
  textview = gtk_text_view_new ();
  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
  gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), "Textview", -1);
  gtk_widget_show (textview);
  gtk_container_add (GTK_CONTAINER (scrolled_win), textview);
  gtk_widget_set_size_request (scrolled_win, 160, 50);
  witem = goo_canvas_widget_new (table, scrolled_win, 50, 400, -1, 100, NULL);

  /* Create a vbox item with several child entry widgets to check focus
     traversal.*/
  vbox = gtk_vbox_new (FALSE, 4);

  entry = gtk_entry_new ();
  gtk_widget_show (entry);
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  entry = gtk_entry_new ();
  gtk_widget_show (entry);
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  entry = gtk_entry_new ();
  gtk_widget_show (entry);
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  witem = goo_canvas_widget_new (table, vbox, 50, 600, -1, -1, NULL);


  gtk_widget_show (canvas);

  /* Pass control to the GTK+ main event loop. */
  gtk_main ();

  return 0;
}





More information about the cairo-commit mailing list