aboutsummaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-07-16 10:05:09 +0200
committerThomas White <taw@bitwiz.org.uk>2011-07-16 10:05:09 +0200
commit33a08e17fada81e6998576c21c166fb20365c214 (patch)
treee12da317bd75aceedd4732d3a86b964f2e5ddb09 /src/stylesheet.c
parente39907fc0e1e908c9daef17c4f7fb83040953bb7 (diff)
Menu layout and initial stylesheet window stuff
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
new file mode 100644
index 0000000..3e3ba80
--- /dev/null
+++ b/src/stylesheet.c
@@ -0,0 +1,124 @@
+/*
+ * stylesheet.c
+ *
+ * Colloquium - A tiny presentation program
+ *
+ * Copyright (c) 2011 Thomas White <taw@bitwiz.org.uk>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <gtk/gtk.h>
+#include <assert.h>
+
+#include "presentation.h"
+#include "stylesheet.h"
+
+
+struct _stylesheetwindow
+{
+ struct presentation *p;
+ GtkWidget *window;
+};
+
+
+static void do_text(struct _stylesheetwindow *s, GtkWidget *b)
+{
+ GtkWidget *table;
+ GtkWidget *box;
+ GtkWidget *label;
+ GtkWidget *combo;
+ GtkWidget *font;
+ GtkWidget *colour;
+
+ table = gtk_table_new(3, 2, FALSE);
+ gtk_box_pack_start(GTK_BOX(b), table, TRUE, TRUE, 5);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 5.0);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 5.0);
+
+ label = gtk_label_new("Style:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
+ combo = gtk_combo_box_new_text();
+ gtk_table_attach_defaults(GTK_TABLE(table), combo, 1, 2, 0, 1);
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Running text");
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Label");
+ gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Title");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+ gtk_widget_set_size_request(GTK_WIDGET(combo), 200, -1);
+
+ label = gtk_label_new("Font:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
+ font = gtk_font_button_new_with_font("Sans 12");
+ gtk_table_attach_defaults(GTK_TABLE(table), font, 1, 2, 1, 2);
+
+ label = gtk_label_new("Colour:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
+ colour = gtk_color_button_new();
+ box = gtk_hbox_new(FALSE, 0);
+ gtk_table_attach_defaults(GTK_TABLE(table), box, 1, 2, 2, 3);
+ gtk_box_pack_start(GTK_BOX(box), colour, FALSE, FALSE, 0);
+
+
+}
+
+
+StylesheetWindow *open_stylesheet(struct presentation *p)
+{
+ struct _stylesheetwindow *s;
+ GtkWidget *nb;
+ GtkWidget *text_box;
+ GtkWidget *background_box;
+
+ s = malloc(sizeof(*s));
+ if ( s == NULL ) return NULL;
+
+ s->p = p;
+
+ s->window = gtk_dialog_new_with_buttons("Stylesheet",
+ GTK_WINDOW(p->window), 0,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_dialog_set_has_separator(GTK_DIALOG(s->window), FALSE);
+
+ nb = gtk_notebook_new();
+ gtk_notebook_set_tab_pos(GTK_NOTEBOOK(nb), GTK_POS_TOP);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(s->window)->vbox), nb,
+ TRUE, TRUE, 0);
+
+ text_box = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(text_box), 12);
+ gtk_notebook_append_page(GTK_NOTEBOOK(nb), text_box,
+ gtk_label_new("Text"));
+ do_text(s, text_box);
+
+ background_box = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(background_box), 12);
+ gtk_notebook_append_page(GTK_NOTEBOOK(nb), background_box,
+ gtk_label_new("Background"));
+
+ gtk_widget_show_all(s->window);
+
+ return s;
+}