Renombrado de directorios
authordanigm <danigm>
Wed, 16 Dec 2009 13:51:50 +0000 (13:51 +0000)
committerdanigm <danigm@aa302d1f-72b1-406a-902b-8593ca2b2744>
Wed, 16 Dec 2009 13:51:50 +0000 (13:51 +0000)
git-svn-id: https://forja.rediris.es/svn/cusl4-tbo@7 aa302d1f-72b1-406a-902b-8593ca2b2744

26 files changed:
src/Makefile [new file with mode: 0644]
src/icon.png [new file with mode: 0644]
src/tbo.c [new file with mode: 0644]
src/ui-drawing.c [new file with mode: 0644]
src/ui-drawing.h [new file with mode: 0644]
src/ui-menu.c [new file with mode: 0644]
src/ui-menu.h [new file with mode: 0644]
src/ui-toolbar.c [new file with mode: 0644]
src/ui-toolbar.h [new file with mode: 0644]
test/cairosamples/Makefile [new file with mode: 0644]
test/cairosamples/togtk.c [new file with mode: 0644]
test/cairosamples/topdf.c [new file with mode: 0644]
test/cairosamples/topng.c [new file with mode: 0644]
test/ctest/Makefile [deleted file]
test/ctest/cairosamples/Makefile [deleted file]
test/ctest/cairosamples/togtk.c [deleted file]
test/ctest/cairosamples/topdf.c [deleted file]
test/ctest/cairosamples/topng.c [deleted file]
test/ctest/icon.png [deleted file]
test/ctest/tbo.c [deleted file]
test/ctest/ui-drawing.c [deleted file]
test/ctest/ui-drawing.h [deleted file]
test/ctest/ui-menu.c [deleted file]
test/ctest/ui-menu.h [deleted file]
test/ctest/ui-toolbar.c [deleted file]
test/ctest/ui-toolbar.h [deleted file]

diff --git a/src/Makefile b/src/Makefile
new file mode 100644 (file)
index 0000000..f7381a2
--- /dev/null
@@ -0,0 +1,16 @@
+GTK = `pkg-config --cflags --libs gtk+-2.0`
+
+all: tbo
+
+tbo: *.o tbo.c
+       gcc tbo.c -o tbo *.o $(GTK)
+
+ui-menu.o: ui-menu.c ui-menu.h
+       gcc -c ui-menu.c $(GTK)
+
+ui-toolbar.o: ui-toolbar.c ui-toolbar.h
+       gcc -c ui-toolbar.c $(GTK)
+
+ui-drawing.o: ui-drawing.c ui-drawing.h
+       gcc -c ui-drawing.c $(GTK)
+
diff --git a/src/icon.png b/src/icon.png
new file mode 100644 (file)
index 0000000..8700550
Binary files /dev/null and b/src/icon.png differ
diff --git a/src/tbo.c b/src/tbo.c
new file mode 100644 (file)
index 0000000..2b60a6a
--- /dev/null
+++ b/src/tbo.c
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <gtk/gtk.h>
+
+#include "ui-menu.h"
+#include "ui-toolbar.h"
+#include "ui-drawing.h"
+
+GdkPixbuf *create_pixbuf (const gchar * filename)
+{
+   GdkPixbuf *pixbuf;
+   GError *error = NULL;
+   pixbuf = gdk_pixbuf_new_from_file(filename, &error);
+   if(!pixbuf) {
+      fprintf(stderr, "%s\n", error->message);
+      g_error_free(error);
+   }
+
+   return pixbuf;
+}
+
+int main (int argc, char**argv){
+    gtk_init (&argc, &argv);
+
+    GtkWidget *window;
+    GtkWidget *container;
+    GtkWidget *menu;
+    GtkWidget *toolbar;
+    GtkWidget *darea;
+
+    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_default_size (GTK_WINDOW (window), 800, 500);
+    gtk_window_set_icon (GTK_WINDOW (window), create_pixbuf ("icon.png"));
+
+    g_signal_connect (window, "delete-event", G_CALLBACK (close_cb), NULL);
+
+    // El contenedor principal
+    container = gtk_vbox_new (FALSE, 0);
+    gtk_container_add (GTK_CONTAINER (window), container);
+
+    // Generando el menu de la aplicacion
+    menu = generate_menu ();
+    gtk_box_pack_start (GTK_BOX (container), menu, FALSE, FALSE, 0);
+
+    // Generando la barra de herramientas de la aplicacion
+    toolbar = generate_toolbar ();
+    gtk_box_pack_start (GTK_BOX (container), toolbar, FALSE, FALSE, 0);
+
+    //darea = get_drawing_area();
+    darea = gtk_scrolled_window_new(NULL, NULL);
+    gtk_container_add (GTK_CONTAINER (darea), get_drawing_area(800, 450));
+    gtk_container_add (GTK_CONTAINER (container), darea);
+
+    gtk_widget_show_all (window);
+    gtk_main ();
+
+    return 0;
+}
+
diff --git a/src/ui-drawing.c b/src/ui-drawing.c
new file mode 100644 (file)
index 0000000..1fa828a
--- /dev/null
@@ -0,0 +1,88 @@
+#include <stdio.h>
+#include <cairo.h>
+#include <gtk/gtk.h>
+
+#include "ui-drawing.h"
+
+gboolean
+on_expose_cb(GtkWidget      *widget,
+             GdkEventExpose *event,
+             gpointer       data)
+{
+    cairo_t *cr;
+    int width, height;
+    char *text = "TBO rulz!";
+    cairo_text_extents_t extents;
+    int *size = (int *) data;
+
+    width = size[0];
+    height = size[1];
+
+    cr = gdk_cairo_create(GTK_LAYOUT (widget)->bin_window);
+
+    cairo_set_source_rgb(cr, 1, 1, 1);
+    cairo_rectangle(cr, 0, 0, size[0], size[1]);
+    cairo_fill(cr);
+    cairo_set_source_rgb(cr, 0, 0, 0);
+    cairo_rectangle (cr, 0, 0, size[0], size[1]);
+    cairo_stroke (cr);
+
+    cairo_set_source_rgb(cr, 0, 0, 0);
+    cairo_select_font_face(cr, "Courier", CAIRO_FONT_SLANT_NORMAL,
+            CAIRO_FONT_WEIGHT_NORMAL);
+    cairo_set_font_size(cr, 90.0);
+
+    cairo_text_extents(cr, text, &extents);
+    cairo_move_to(cr, (width-extents.width)/2, (height+extents.height)/2);
+    
+    cairo_show_text(cr, text);
+
+    cairo_destroy(cr);
+
+    return FALSE;
+}
+
+gboolean
+on_move_cb (GtkWidget      *widget,
+           GdkEventExpose *event,
+           gpointer       data)
+{
+    printf ("move\n");
+}
+
+gboolean
+on_click_cb (GtkWidget      *widget,
+           GdkEventExpose *event,
+           gpointer       data)
+{
+    printf ("click\n");
+}
+
+GtkWidget *
+get_drawing_area (int width, int height)
+{
+
+    GtkWidget *drawing;
+    static int size[2];
+    
+    size[0] = width;
+    size[1] = height;
+
+    drawing = gtk_layout_new(NULL, NULL);
+    gtk_layout_set_size(GTK_LAYOUT (drawing), size[0], size[1]);
+
+    g_signal_connect(drawing, "expose-event",
+            G_CALLBACK (on_expose_cb),  (gpointer) size);
+
+    gtk_widget_add_events (drawing, GDK_BUTTON_PRESS_MASK |
+                                    GDK_POINTER_MOTION_MASK);
+
+    g_signal_connect (drawing, "button_press_event",
+            G_CALLBACK (on_click_cb), NULL);
+
+    g_signal_connect (drawing, "motion_notify_event",
+            G_CALLBACK (on_move_cb), (gpointer) size);
+
+    return drawing;
+}
+
diff --git a/src/ui-drawing.h b/src/ui-drawing.h
new file mode 100644 (file)
index 0000000..e280c05
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __UI_DRAWING_
+#define __UI_DRAWING_
+
+#include <gtk/gtk.h>
+#include <cairo.h>
+
+
+gboolean on_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
+gboolean on_move_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
+gboolean on_click_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
+GtkWidget * get_drawing_area (int width, int height);
+
+#endif
diff --git a/src/ui-menu.c b/src/ui-menu.c
new file mode 100644 (file)
index 0000000..21a6f12
--- /dev/null
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <gtk/gtk.h>
+
+#include "ui-menu.h"
+
+gboolean menu_handler (GtkWidget *widget, GdkEvent *event, gpointer data){
+    printf ("Menu\n");
+}
+
+gboolean close_cb (GtkWidget *widget, GdkEvent *event, gpointer data){
+    printf ("Ventana cerrada\n");
+    gtk_main_quit ();
+}
+
+void add_new_menu_item (GtkWidget *menu, const char *label, void *cb, gpointer data){
+    GtkWidget *item;
+    item = gtk_menu_item_new_with_label (label);
+    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+    g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK(cb), data);
+}
+
+void add_new_image_menu_item (GtkWidget *menu, const gchar *stock_id, void *cb, gpointer data){
+    GtkWidget *item;
+    item = gtk_image_menu_item_new_from_stock (stock_id, gtk_accel_group_new ());
+    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+    g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK(cb), data);
+}
+
+GtkWidget *generate_menu (){
+    GtkWidget *menu;
+    GtkWidget *file_item, *menu_file;
+    
+    menu = gtk_menu_bar_new ();
+
+    menu_file = gtk_menu_new ();   
+    add_new_image_menu_item(menu_file, GTK_STOCK_NEW, G_CALLBACK(menu_handler), NULL);
+    add_new_image_menu_item(menu_file, GTK_STOCK_OPEN, G_CALLBACK(menu_handler), NULL);
+    add_new_image_menu_item(menu_file, GTK_STOCK_SAVE, G_CALLBACK(menu_handler), NULL);
+    add_new_image_menu_item(menu_file, GTK_STOCK_QUIT, G_CALLBACK(close_cb), NULL);
+
+    file_item = gtk_menu_item_new_with_label ("Archivo");
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_item), menu_file);
+    gtk_menu_bar_append (GTK_MENU_BAR (menu), file_item);
+
+    return menu;
+}
+
diff --git a/src/ui-menu.h b/src/ui-menu.h
new file mode 100644 (file)
index 0000000..fef0d17
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __UI_MENU_
+#define __UI_MENU_
+
+#include <gtk/gtk.h>
+
+gboolean menu_handler (GtkWidget *widget, GdkEvent *event, gpointer data);
+gboolean close_cb (GtkWidget *widget, GdkEvent *event, gpointer data);
+void add_new_menu_item (GtkWidget *menu, const char *label, void *cb, gpointer data);
+void add_new_image_menu_item (GtkWidget *menu, const gchar *stock_id, void *cb, gpointer data);
+GtkWidget *generate_menu ();
+
+#endif
diff --git a/src/ui-toolbar.c b/src/ui-toolbar.c
new file mode 100644 (file)
index 0000000..0cb9f3c
--- /dev/null
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <gtk/gtk.h>
+#include "ui-toolbar.h"
+
+gboolean toolbar_handler (GtkWidget *widget, GdkEvent *event, gpointer data){
+    printf("toolbar\n");
+}
+
+void add_new_image_toolbar_item (GtkWidget *toolbar, const gchar *stock_id, void *cb, gpointer data){
+    GtkToolItem *item;
+    item = gtk_tool_button_new_from_stock (stock_id);
+    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (cb), data);
+}
+
+GtkWidget *generate_toolbar (){
+    GtkWidget *toolbar;
+
+    toolbar = gtk_toolbar_new ();
+    gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+    
+    add_new_image_toolbar_item (toolbar, GTK_STOCK_NEW, G_CALLBACK (toolbar_handler), NULL);
+    add_new_image_toolbar_item (toolbar, GTK_STOCK_OPEN, G_CALLBACK (toolbar_handler), NULL);
+    add_new_image_toolbar_item (toolbar, GTK_STOCK_SAVE, G_CALLBACK (toolbar_handler), NULL);
+
+    return toolbar;
+}
+
diff --git a/src/ui-toolbar.h b/src/ui-toolbar.h
new file mode 100644 (file)
index 0000000..6368164
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __UI_TOOLBAR_
+#define __UI_TOOLBAR_
+
+#include <gtk/gtk.h>
+
+gboolean toolbar_handler (GtkWidget *widget, GdkEvent *event, gpointer data);
+void add_new_image_toolbar_item (GtkWidget *toolbar, const gchar *stock_id, void *cb, gpointer data);
+GtkWidget *generate_toolbar ();
+
+#endif
+
diff --git a/test/cairosamples/Makefile b/test/cairosamples/Makefile
new file mode 100644 (file)
index 0000000..c90d1be
--- /dev/null
@@ -0,0 +1,11 @@
+GTK = `pkg-config --cflags --libs gtk+-2.0`
+
+topng: topng.c
+       gcc topng.c -o topng $(GTK)
+
+topdf: topdf.c
+       gcc topdf.c -o topdf $(GTK)
+
+togtk: 
+       gcc togtk.c -o togtk $(GTK)
+
diff --git a/test/cairosamples/togtk.c b/test/cairosamples/togtk.c
new file mode 100644 (file)
index 0000000..9ab62e5
--- /dev/null
@@ -0,0 +1,54 @@
+#include <cairo.h>
+#include <gtk/gtk.h>
+
+static gboolean
+on_expose_event(GtkWidget *widget,
+        GdkEventExpose *event,
+        gpointer        data)
+{
+    cairo_t *cr;
+
+    cr = gdk_cairo_create(widget->window);
+
+    cairo_set_source_rgb(cr, 255, 255, 255);
+    cairo_rectangle(cr, 0, 0, 400, 90);
+    cairo_fill(cr);
+    cairo_set_source_rgb(cr, 0, 0, 0);
+    cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
+            CAIRO_FONT_WEIGHT_NORMAL);
+    cairo_set_font_size(cr, 40.0);
+
+    cairo_move_to(cr, 10.0, 50.0);
+    cairo_show_text(cr, "Disziplin ist Macht.");
+
+    cairo_destroy(cr);
+
+    return FALSE;
+}
+
+int
+main (int argc, char *argv[])
+{
+
+    GtkWidget *window;
+
+    gtk_init(&argc, &argv);
+
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+    g_signal_connect(window, "expose-event",
+            G_CALLBACK (on_expose_event), NULL);
+    g_signal_connect(window, "destroy",
+            G_CALLBACK (gtk_main_quit), NULL);
+
+    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+    gtk_window_set_default_size(GTK_WINDOW(window), 400, 90); 
+    gtk_widget_set_app_paintable(window, TRUE);
+
+    gtk_widget_show_all(window);
+
+    gtk_main();
+
+    return 0;
+}
+
diff --git a/test/cairosamples/topdf.c b/test/cairosamples/topdf.c
new file mode 100644 (file)
index 0000000..5719ec0
--- /dev/null
@@ -0,0 +1,27 @@
+#include <cairo/cairo.h>
+#include <cairo/cairo-pdf.h>
+
+int main() {
+
+    cairo_surface_t *surface;
+    cairo_t *cr;
+
+    surface = cairo_pdf_surface_create("pdffile.pdf", 504, 648);
+    cr = cairo_create(surface);
+
+    cairo_set_source_rgb(cr, 0, 0, 0);
+    cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
+            CAIRO_FONT_WEIGHT_NORMAL);
+    cairo_set_font_size (cr, 40.0);
+
+    cairo_move_to(cr, 10.0, 50.0);
+    cairo_show_text(cr, "Disziplin ist Macht.");
+
+    cairo_show_page(cr);
+
+    cairo_surface_destroy(surface);
+    cairo_destroy(cr);
+
+    return 0;
+}
+
diff --git a/test/cairosamples/topng.c b/test/cairosamples/topng.c
new file mode 100644 (file)
index 0000000..5783c63
--- /dev/null
@@ -0,0 +1,26 @@
+#include <cairo.h>
+
+int main (int argc, char *argv[])
+{
+    cairo_surface_t *surface;
+    cairo_t *cr;
+
+    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60);
+    cr = cairo_create(surface);
+
+    cairo_set_source_rgb(cr, 0, 0, 0);
+    cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
+            CAIRO_FONT_WEIGHT_NORMAL);
+    cairo_set_font_size(cr, 40.0);
+
+    cairo_move_to(cr, 10.0, 50.0);
+    cairo_show_text(cr, "Disziplin ist Macht.");
+
+    cairo_surface_write_to_png(surface, "image.png");
+
+    cairo_destroy(cr);
+    cairo_surface_destroy(surface);
+
+    return 0;
+}
+
diff --git a/test/ctest/Makefile b/test/ctest/Makefile
deleted file mode 100644 (file)
index f7381a2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-GTK = `pkg-config --cflags --libs gtk+-2.0`
-
-all: tbo
-
-tbo: *.o tbo.c
-       gcc tbo.c -o tbo *.o $(GTK)
-
-ui-menu.o: ui-menu.c ui-menu.h
-       gcc -c ui-menu.c $(GTK)
-
-ui-toolbar.o: ui-toolbar.c ui-toolbar.h
-       gcc -c ui-toolbar.c $(GTK)
-
-ui-drawing.o: ui-drawing.c ui-drawing.h
-       gcc -c ui-drawing.c $(GTK)
-
diff --git a/test/ctest/cairosamples/Makefile b/test/ctest/cairosamples/Makefile
deleted file mode 100644 (file)
index c90d1be..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-GTK = `pkg-config --cflags --libs gtk+-2.0`
-
-topng: topng.c
-       gcc topng.c -o topng $(GTK)
-
-topdf: topdf.c
-       gcc topdf.c -o topdf $(GTK)
-
-togtk: 
-       gcc togtk.c -o togtk $(GTK)
-
diff --git a/test/ctest/cairosamples/togtk.c b/test/ctest/cairosamples/togtk.c
deleted file mode 100644 (file)
index 9ab62e5..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <cairo.h>
-#include <gtk/gtk.h>
-
-static gboolean
-on_expose_event(GtkWidget *widget,
-        GdkEventExpose *event,
-        gpointer        data)
-{
-    cairo_t *cr;
-
-    cr = gdk_cairo_create(widget->window);
-
-    cairo_set_source_rgb(cr, 255, 255, 255);
-    cairo_rectangle(cr, 0, 0, 400, 90);
-    cairo_fill(cr);
-    cairo_set_source_rgb(cr, 0, 0, 0);
-    cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
-            CAIRO_FONT_WEIGHT_NORMAL);
-    cairo_set_font_size(cr, 40.0);
-
-    cairo_move_to(cr, 10.0, 50.0);
-    cairo_show_text(cr, "Disziplin ist Macht.");
-
-    cairo_destroy(cr);
-
-    return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
-
-    GtkWidget *window;
-
-    gtk_init(&argc, &argv);
-
-    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-
-    g_signal_connect(window, "expose-event",
-            G_CALLBACK (on_expose_event), NULL);
-    g_signal_connect(window, "destroy",
-            G_CALLBACK (gtk_main_quit), NULL);
-
-    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-    gtk_window_set_default_size(GTK_WINDOW(window), 400, 90); 
-    gtk_widget_set_app_paintable(window, TRUE);
-
-    gtk_widget_show_all(window);
-
-    gtk_main();
-
-    return 0;
-}
-
diff --git a/test/ctest/cairosamples/topdf.c b/test/ctest/cairosamples/topdf.c
deleted file mode 100644 (file)
index 5719ec0..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <cairo/cairo.h>
-#include <cairo/cairo-pdf.h>
-
-int main() {
-
-    cairo_surface_t *surface;
-    cairo_t *cr;
-
-    surface = cairo_pdf_surface_create("pdffile.pdf", 504, 648);
-    cr = cairo_create(surface);
-
-    cairo_set_source_rgb(cr, 0, 0, 0);
-    cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
-            CAIRO_FONT_WEIGHT_NORMAL);
-    cairo_set_font_size (cr, 40.0);
-
-    cairo_move_to(cr, 10.0, 50.0);
-    cairo_show_text(cr, "Disziplin ist Macht.");
-
-    cairo_show_page(cr);
-
-    cairo_surface_destroy(surface);
-    cairo_destroy(cr);
-
-    return 0;
-}
-
diff --git a/test/ctest/cairosamples/topng.c b/test/ctest/cairosamples/topng.c
deleted file mode 100644 (file)
index 5783c63..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <cairo.h>
-
-int main (int argc, char *argv[])
-{
-    cairo_surface_t *surface;
-    cairo_t *cr;
-
-    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60);
-    cr = cairo_create(surface);
-
-    cairo_set_source_rgb(cr, 0, 0, 0);
-    cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
-            CAIRO_FONT_WEIGHT_NORMAL);
-    cairo_set_font_size(cr, 40.0);
-
-    cairo_move_to(cr, 10.0, 50.0);
-    cairo_show_text(cr, "Disziplin ist Macht.");
-
-    cairo_surface_write_to_png(surface, "image.png");
-
-    cairo_destroy(cr);
-    cairo_surface_destroy(surface);
-
-    return 0;
-}
-
diff --git a/test/ctest/icon.png b/test/ctest/icon.png
deleted file mode 100644 (file)
index 8700550..0000000
Binary files a/test/ctest/icon.png and /dev/null differ
diff --git a/test/ctest/tbo.c b/test/ctest/tbo.c
deleted file mode 100644 (file)
index 2b60a6a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <stdio.h>
-#include <gtk/gtk.h>
-
-#include "ui-menu.h"
-#include "ui-toolbar.h"
-#include "ui-drawing.h"
-
-GdkPixbuf *create_pixbuf (const gchar * filename)
-{
-   GdkPixbuf *pixbuf;
-   GError *error = NULL;
-   pixbuf = gdk_pixbuf_new_from_file(filename, &error);
-   if(!pixbuf) {
-      fprintf(stderr, "%s\n", error->message);
-      g_error_free(error);
-   }
-
-   return pixbuf;
-}
-
-int main (int argc, char**argv){
-    gtk_init (&argc, &argv);
-
-    GtkWidget *window;
-    GtkWidget *container;
-    GtkWidget *menu;
-    GtkWidget *toolbar;
-    GtkWidget *darea;
-
-    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    gtk_window_set_default_size (GTK_WINDOW (window), 800, 500);
-    gtk_window_set_icon (GTK_WINDOW (window), create_pixbuf ("icon.png"));
-
-    g_signal_connect (window, "delete-event", G_CALLBACK (close_cb), NULL);
-
-    // El contenedor principal
-    container = gtk_vbox_new (FALSE, 0);
-    gtk_container_add (GTK_CONTAINER (window), container);
-
-    // Generando el menu de la aplicacion
-    menu = generate_menu ();
-    gtk_box_pack_start (GTK_BOX (container), menu, FALSE, FALSE, 0);
-
-    // Generando la barra de herramientas de la aplicacion
-    toolbar = generate_toolbar ();
-    gtk_box_pack_start (GTK_BOX (container), toolbar, FALSE, FALSE, 0);
-
-    //darea = get_drawing_area();
-    darea = gtk_scrolled_window_new(NULL, NULL);
-    gtk_container_add (GTK_CONTAINER (darea), get_drawing_area(800, 450));
-    gtk_container_add (GTK_CONTAINER (container), darea);
-
-    gtk_widget_show_all (window);
-    gtk_main ();
-
-    return 0;
-}
-
diff --git a/test/ctest/ui-drawing.c b/test/ctest/ui-drawing.c
deleted file mode 100644 (file)
index 1fa828a..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#include <stdio.h>
-#include <cairo.h>
-#include <gtk/gtk.h>
-
-#include "ui-drawing.h"
-
-gboolean
-on_expose_cb(GtkWidget      *widget,
-             GdkEventExpose *event,
-             gpointer       data)
-{
-    cairo_t *cr;
-    int width, height;
-    char *text = "TBO rulz!";
-    cairo_text_extents_t extents;
-    int *size = (int *) data;
-
-    width = size[0];
-    height = size[1];
-
-    cr = gdk_cairo_create(GTK_LAYOUT (widget)->bin_window);
-
-    cairo_set_source_rgb(cr, 1, 1, 1);
-    cairo_rectangle(cr, 0, 0, size[0], size[1]);
-    cairo_fill(cr);
-    cairo_set_source_rgb(cr, 0, 0, 0);
-    cairo_rectangle (cr, 0, 0, size[0], size[1]);
-    cairo_stroke (cr);
-
-    cairo_set_source_rgb(cr, 0, 0, 0);
-    cairo_select_font_face(cr, "Courier", CAIRO_FONT_SLANT_NORMAL,
-            CAIRO_FONT_WEIGHT_NORMAL);
-    cairo_set_font_size(cr, 90.0);
-
-    cairo_text_extents(cr, text, &extents);
-    cairo_move_to(cr, (width-extents.width)/2, (height+extents.height)/2);
-    
-    cairo_show_text(cr, text);
-
-    cairo_destroy(cr);
-
-    return FALSE;
-}
-
-gboolean
-on_move_cb (GtkWidget      *widget,
-           GdkEventExpose *event,
-           gpointer       data)
-{
-    printf ("move\n");
-}
-
-gboolean
-on_click_cb (GtkWidget      *widget,
-           GdkEventExpose *event,
-           gpointer       data)
-{
-    printf ("click\n");
-}
-
-GtkWidget *
-get_drawing_area (int width, int height)
-{
-
-    GtkWidget *drawing;
-    static int size[2];
-    
-    size[0] = width;
-    size[1] = height;
-
-    drawing = gtk_layout_new(NULL, NULL);
-    gtk_layout_set_size(GTK_LAYOUT (drawing), size[0], size[1]);
-
-    g_signal_connect(drawing, "expose-event",
-            G_CALLBACK (on_expose_cb),  (gpointer) size);
-
-    gtk_widget_add_events (drawing, GDK_BUTTON_PRESS_MASK |
-                                    GDK_POINTER_MOTION_MASK);
-
-    g_signal_connect (drawing, "button_press_event",
-            G_CALLBACK (on_click_cb), NULL);
-
-    g_signal_connect (drawing, "motion_notify_event",
-            G_CALLBACK (on_move_cb), (gpointer) size);
-
-    return drawing;
-}
-
diff --git a/test/ctest/ui-drawing.h b/test/ctest/ui-drawing.h
deleted file mode 100644 (file)
index e280c05..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __UI_DRAWING_
-#define __UI_DRAWING_
-
-#include <gtk/gtk.h>
-#include <cairo.h>
-
-
-gboolean on_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
-gboolean on_move_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
-gboolean on_click_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data);
-GtkWidget * get_drawing_area (int width, int height);
-
-#endif
diff --git a/test/ctest/ui-menu.c b/test/ctest/ui-menu.c
deleted file mode 100644 (file)
index 21a6f12..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <gtk/gtk.h>
-
-#include "ui-menu.h"
-
-gboolean menu_handler (GtkWidget *widget, GdkEvent *event, gpointer data){
-    printf ("Menu\n");
-}
-
-gboolean close_cb (GtkWidget *widget, GdkEvent *event, gpointer data){
-    printf ("Ventana cerrada\n");
-    gtk_main_quit ();
-}
-
-void add_new_menu_item (GtkWidget *menu, const char *label, void *cb, gpointer data){
-    GtkWidget *item;
-    item = gtk_menu_item_new_with_label (label);
-    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-    g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK(cb), data);
-}
-
-void add_new_image_menu_item (GtkWidget *menu, const gchar *stock_id, void *cb, gpointer data){
-    GtkWidget *item;
-    item = gtk_image_menu_item_new_from_stock (stock_id, gtk_accel_group_new ());
-    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-    g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK(cb), data);
-}
-
-GtkWidget *generate_menu (){
-    GtkWidget *menu;
-    GtkWidget *file_item, *menu_file;
-    
-    menu = gtk_menu_bar_new ();
-
-    menu_file = gtk_menu_new ();   
-    add_new_image_menu_item(menu_file, GTK_STOCK_NEW, G_CALLBACK(menu_handler), NULL);
-    add_new_image_menu_item(menu_file, GTK_STOCK_OPEN, G_CALLBACK(menu_handler), NULL);
-    add_new_image_menu_item(menu_file, GTK_STOCK_SAVE, G_CALLBACK(menu_handler), NULL);
-    add_new_image_menu_item(menu_file, GTK_STOCK_QUIT, G_CALLBACK(close_cb), NULL);
-
-    file_item = gtk_menu_item_new_with_label ("Archivo");
-    gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_item), menu_file);
-    gtk_menu_bar_append (GTK_MENU_BAR (menu), file_item);
-
-    return menu;
-}
-
diff --git a/test/ctest/ui-menu.h b/test/ctest/ui-menu.h
deleted file mode 100644 (file)
index fef0d17..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __UI_MENU_
-#define __UI_MENU_
-
-#include <gtk/gtk.h>
-
-gboolean menu_handler (GtkWidget *widget, GdkEvent *event, gpointer data);
-gboolean close_cb (GtkWidget *widget, GdkEvent *event, gpointer data);
-void add_new_menu_item (GtkWidget *menu, const char *label, void *cb, gpointer data);
-void add_new_image_menu_item (GtkWidget *menu, const gchar *stock_id, void *cb, gpointer data);
-GtkWidget *generate_menu ();
-
-#endif
diff --git a/test/ctest/ui-toolbar.c b/test/ctest/ui-toolbar.c
deleted file mode 100644 (file)
index 0cb9f3c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include "ui-toolbar.h"
-
-gboolean toolbar_handler (GtkWidget *widget, GdkEvent *event, gpointer data){
-    printf("toolbar\n");
-}
-
-void add_new_image_toolbar_item (GtkWidget *toolbar, const gchar *stock_id, void *cb, gpointer data){
-    GtkToolItem *item;
-    item = gtk_tool_button_new_from_stock (stock_id);
-    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (cb), data);
-}
-
-GtkWidget *generate_toolbar (){
-    GtkWidget *toolbar;
-
-    toolbar = gtk_toolbar_new ();
-    gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
-    
-    add_new_image_toolbar_item (toolbar, GTK_STOCK_NEW, G_CALLBACK (toolbar_handler), NULL);
-    add_new_image_toolbar_item (toolbar, GTK_STOCK_OPEN, G_CALLBACK (toolbar_handler), NULL);
-    add_new_image_toolbar_item (toolbar, GTK_STOCK_SAVE, G_CALLBACK (toolbar_handler), NULL);
-
-    return toolbar;
-}
-
diff --git a/test/ctest/ui-toolbar.h b/test/ctest/ui-toolbar.h
deleted file mode 100644 (file)
index 6368164..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __UI_TOOLBAR_
-#define __UI_TOOLBAR_
-
-#include <gtk/gtk.h>
-
-gboolean toolbar_handler (GtkWidget *widget, GdkEvent *event, gpointer data);
-void add_new_image_toolbar_item (GtkWidget *toolbar, const gchar *stock_id, void *cb, gpointer data);
-GtkWidget *generate_toolbar ();
-
-#endif
-