summaryrefslogtreecommitdiff
path: root/gtk+-mingw/share/gtk-3.0/demo
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2018-08-20 21:12:06 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2018-08-20 21:12:06 -0400
commit63e87c2d0c9d263f14c77b68f85c67d46ece82a9 (patch)
tree6260365cbf7d24f37d27669e8538227fcb72e243 /gtk+-mingw/share/gtk-3.0/demo
parenta4460f6d9453bbd7e584937686449cef3e19f052 (diff)
Removed gtk+ docsHEADmaster
Diffstat (limited to 'gtk+-mingw/share/gtk-3.0/demo')
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/alphatest.pngbin26529 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/apple-red.pngbin3545 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/application.c485
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/application.ui104
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/appwindow.c570
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/assistant.c201
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/background.jpgbin22219 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/builder.c74
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/button_box.c127
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/changedisplay.c654
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/clipboard.c326
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/colorsel.c133
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/combobox.c473
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_accordion.c77
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_accordion.css52
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_basics.c121
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_basics.css22
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.c170
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.css136
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/cssview.css41
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/demo.ui266
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/dialog.c175
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/drawingarea.c296
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/editable_cells.c392
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/entry_buffer.c66
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/entry_completion.c98
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/expander.c59
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/fancy.css24
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/floppybuddy.gifbin5216 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-applets.pngbin3090 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-calendar.pngbin2755 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-foot.pngbin2916 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-fs-directory.pngbin2044 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-fs-regular.pngbin1795 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-gimp.pngbin3410 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-gmush.pngbin3244 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnome-gsame.pngbin4263 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gnu-keys.pngbin3852 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gtk-logo-24.pngbin674 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gtk-logo-48.pngbin2405 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/gtk-logo-rgb.gifbin6427 -> 0 bytes
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/hypertext.c291
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/iconview.c371
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/iconview_edit.c158
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/images.c472
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/infobar.c109
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/links.c90
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/list_store.c325
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/menus.c171
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/menus.ui107
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/offscreen_window.c615
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/offscreen_window2.c526
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/overlay.c181
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/panes.c205
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/pickers.c89
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/pixbufs.c263
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/printing.c212
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/reset.css68
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/rotated_text.c236
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/search_entry.c345
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/sizegroup.c164
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/spinner.c95
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/stock_browser.c535
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/textscroll.c201
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/textview.c634
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/theming.ui319
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/theming_custom_css.c66
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/theming_style_classes.c58
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/toolpalette.c794
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/transparent.c248
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/tree_store.c450
-rw-r--r--gtk+-mingw/share/gtk-3.0/demo/ui_manager.c235
72 files changed, 0 insertions, 13775 deletions
diff --git a/gtk+-mingw/share/gtk-3.0/demo/alphatest.png b/gtk+-mingw/share/gtk-3.0/demo/alphatest.png
deleted file mode 100644
index eb5885f..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/alphatest.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/apple-red.png b/gtk+-mingw/share/gtk-3.0/demo/apple-red.png
deleted file mode 100644
index b0a24e9..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/apple-red.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/application.c b/gtk+-mingw/share/gtk-3.0/demo/application.c
deleted file mode 100644
index 6889e61..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/application.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/* Application class :: menus.ui application.ui
- *
- * Demonstrates a simple application.
- *
- * This examples uses GtkApplication, GtkApplicationWindow, GtkBuilder
- * as well as GMenu and GResource. Due to the way GtkApplication is structured,
- * it is run as a separate process.
- */
-
-#include "config.h"
-
-#include <gtk/gtk.h>
-
-#ifdef STANDALONE
-
-static void
-show_action_dialog (GSimpleAction *action)
-{
- const gchar *name;
- GtkWidget *dialog;
-
- name = g_action_get_name (G_ACTION (action));
-
- dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE,
- "You activated action: \"%s\"",
- name);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
-}
-
-static void
-show_action_infobar (GSimpleAction *action,
- GVariant *parameter,
- gpointer window)
-{
- GtkWidget *infobar;
- GtkWidget *message;
- gchar *text;
- const gchar *name;
- const gchar *value;
-
- name = g_action_get_name (G_ACTION (action));
- value = g_variant_get_string (parameter, NULL);
-
- message = g_object_get_data (G_OBJECT (window), "message");
- infobar = g_object_get_data (G_OBJECT (window), "infobar");
- text = g_strdup_printf ("You activated radio action: \"%s\".\n"
- "Current value: %s", name, value);
- gtk_label_set_text (GTK_LABEL (message), text);
- gtk_widget_show (infobar);
- g_free (text);
-}
-
-static void
-activate_action (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- show_action_dialog (action);
-}
-
-static void
-activate_toggle (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GVariant *state;
-
- show_action_dialog (action);
-
- state = g_action_get_state (G_ACTION (action));
- g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
- g_variant_unref (state);
-}
-
-static void
-activate_radio (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- show_action_infobar (action, parameter, user_data);
-
- g_action_change_state (G_ACTION (action), parameter);
-}
-
-static void
-activate_about (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GtkWidget *window = user_data;
- GdkPixbuf *pixbuf;
-
- const gchar *authors[] = {
- "Peter Mattis",
- "Spencer Kimball",
- "Josh MacDonald",
- "and many more...",
- NULL
- };
-
- const gchar *documentors[] = {
- "Owen Taylor",
- "Tony Gale",
- "Matthias Clasen <mclasen@redhat.com>",
- "and many more...",
- NULL
- };
-
- pixbuf = gdk_pixbuf_new_from_resource ("/application/logos/gtk-logo-48.png", NULL);
-
- gtk_show_about_dialog (GTK_WINDOW (window),
- "program-name", "GTK+ Code Demos",
- "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
- PACKAGE_VERSION,
- gtk_get_major_version (),
- gtk_get_minor_version (),
- gtk_get_micro_version ()),
- "copyright", "(C) 1997-2009 The GTK+ Team",
- "license-type", GTK_LICENSE_LGPL_2_1,
- "website", "http://www.gtk.org",
- "comments", "Program to demonstrate GTK+ functions.",
- "authors", authors,
- "documenters", documentors,
- "logo", pixbuf,
- "title", "About GTK+ Code Demos",
- NULL);
- g_object_unref (pixbuf);
-}
-
-static void
-activate_quit (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- GtkApplication *app = user_data;
- GtkWidget *win;
- GList *list, *next;
-
- list = gtk_application_get_windows (app);
- while (list)
- {
- win = list->data;
- next = list->next;
-
- gtk_widget_destroy (GTK_WIDGET (win));
-
- list = next;
- }
-}
-
-static void
-register_stock_icons (void)
-{
- static gboolean registered = FALSE;
-
- if (!registered)
- {
- GdkPixbuf *pixbuf;
- GtkIconFactory *factory;
- GtkIconSet *icon_set;
-
- static GtkStockItem items[] = {
- { "demo-gtk-logo", "_GTK!", 0, 0, NULL }
- };
-
- registered = TRUE;
-
- gtk_stock_add (items, G_N_ELEMENTS (items));
-
- factory = gtk_icon_factory_new ();
- gtk_icon_factory_add_default (factory);
-
- pixbuf = gdk_pixbuf_new_from_resource ("/application/logos/gtk-logo-24.png", NULL);
-
- icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
- gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
- gtk_icon_set_unref (icon_set);
- g_object_unref (pixbuf);
-
- /* Drop our reference to the factory, GTK will hold a reference. */
- g_object_unref (factory);
- }
-}
-
-static void
-update_statusbar (GtkTextBuffer *buffer,
- GtkStatusbar *statusbar)
-{
- gchar *msg;
- gint row, col;
- gint count;
- GtkTextIter iter;
-
- /* clear any previous message, underflow is allowed */
- gtk_statusbar_pop (statusbar, 0);
-
- count = gtk_text_buffer_get_char_count (buffer);
-
- gtk_text_buffer_get_iter_at_mark (buffer,
- &iter,
- gtk_text_buffer_get_insert (buffer));
-
- row = gtk_text_iter_get_line (&iter);
- col = gtk_text_iter_get_line_offset (&iter);
-
- msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
- row, col, count);
-
- gtk_statusbar_push (statusbar, 0, msg);
-
- g_free (msg);
-}
-
-static void
-mark_set_callback (GtkTextBuffer *buffer,
- const GtkTextIter *new_location,
- GtkTextMark *mark,
- gpointer data)
-{
- update_statusbar (buffer, GTK_STATUSBAR (data));
-}
-
-static void
-change_theme_state (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- GtkSettings *settings = gtk_settings_get_default ();
-
- g_object_set (G_OBJECT (settings),
- "gtk-application-prefer-dark-theme",
- g_variant_get_boolean (state),
- NULL);
-
- g_simple_action_set_state (action, state);
-}
-
-static void
-change_titlebar_state (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- GtkWindow *window = user_data;
-
- gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window),
- g_variant_get_boolean (state));
-
- g_simple_action_set_state (action, state);
-}
-
-static void
-change_radio_state (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (action, state);
-}
-
-static GActionEntry app_entries[] = {
- { "new", activate_action, NULL, NULL, NULL },
- { "open", activate_action, NULL, NULL, NULL },
- { "save", activate_action, NULL, NULL, NULL },
- { "save-as", activate_action, NULL, NULL, NULL },
- { "quit", activate_quit, NULL, NULL, NULL },
- { "dark", activate_toggle, NULL, "false", change_theme_state }
-};
-
-static GActionEntry win_entries[] = {
- { "titlebar", activate_toggle, NULL, "false", change_titlebar_state },
- { "shape", activate_radio, "s", "'oval'", change_radio_state },
- { "bold", activate_toggle, NULL, "false", NULL },
- { "about", activate_about, NULL, NULL, NULL },
- { "file1", activate_action, NULL, NULL, NULL },
- { "logo", activate_action, NULL, NULL, NULL }
-};
-
-static void
-clicked_cb (GtkWidget *widget, GtkWidget *info)
-{
- gtk_widget_hide (info);
-}
-
-static void
-startup (GApplication *app)
-{
- GtkBuilder *builder;
- GMenuModel *appmenu;
- GMenuModel *menubar;
-
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/application/ui/menus.ui", NULL);
-
- appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
- menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar");
-
- gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu);
- gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
-
- g_object_unref (builder);
-}
-
-static void
-activate (GApplication *app)
-{
- GtkBuilder *builder;
- GtkWidget *window;
- GtkWidget *grid;
- GtkWidget *contents;
- GtkWidget *status;
- GtkWidget *message;
- GtkWidget *button;
- GtkWidget *infobar;
- GtkWidget *menutool;
- GMenuModel *toolmenu;
- GtkTextBuffer *buffer;
-
- window = gtk_application_window_new (GTK_APPLICATION (app));
- gtk_window_set_title (GTK_WINDOW (window), "Application Class");
- gtk_window_set_icon_name (GTK_WINDOW (window), "document-open");
- gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
-
- g_action_map_add_action_entries (G_ACTION_MAP (window),
- win_entries, G_N_ELEMENTS (win_entries),
- window);
-
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/application/ui/application.ui", NULL);
-
- grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
- contents = (GtkWidget *)gtk_builder_get_object (builder, "contents");
- status = (GtkWidget *)gtk_builder_get_object (builder, "status");
- message = (GtkWidget *)gtk_builder_get_object (builder, "message");
- button = (GtkWidget *)gtk_builder_get_object (builder, "button");
- infobar = (GtkWidget *)gtk_builder_get_object (builder, "infobar");
- menutool = (GtkWidget *)gtk_builder_get_object (builder, "menutool");
- toolmenu = (GMenuModel *)gtk_builder_get_object (builder, "toolmenu");
-
- g_object_set_data (G_OBJECT (window), "message", message);
- g_object_set_data (G_OBJECT (window), "infobar", infobar);
-
- gtk_container_add (GTK_CONTAINER (window), grid);
-
- gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menutool),
- gtk_menu_new_from_model (toolmenu));
-
- gtk_widget_grab_focus (contents);
- g_signal_connect (button, "clicked", G_CALLBACK (clicked_cb), infobar);
-
- /* Show text widget info in the statusbar */
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
- g_signal_connect_object (buffer, "changed",
- G_CALLBACK (update_statusbar), status, 0);
- g_signal_connect_object (buffer, "mark-set",
- G_CALLBACK (mark_set_callback), status, 0);
-
- update_statusbar (buffer, GTK_STATUSBAR (status));
-
- gtk_widget_show_all (window);
-
- g_object_unref (builder);
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkApplication *app;
- GSettings *settings;
- GAction *action;
-
- gtk_init (NULL, NULL);
-
- register_stock_icons ();
-
- app = gtk_application_new ("org.gtk.Demo", 0);
- settings = g_settings_new ("org.gtk.Demo");
-
- g_action_map_add_action_entries (G_ACTION_MAP (app),
- app_entries, G_N_ELEMENTS (app_entries),
- app);
-
- action = g_settings_create_action (settings, "color");
-
- g_action_map_add_action (G_ACTION_MAP (app), action);
-
- g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
- g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
-
- g_application_run (G_APPLICATION (app), 0, NULL);
-
- return 0;
-}
-
-#else /* !STANDALONE */
-
-static gboolean name_seen;
-static GtkWidget *placeholder;
-
-static void
-on_name_appeared (GDBusConnection *connection,
- const gchar *name,
- const gchar *name_owner,
- gpointer user_data)
-{
- name_seen = TRUE;
-}
-
-static void
-on_name_vanished (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- if (!name_seen)
- return;
-
- if (placeholder)
- {
- gtk_widget_destroy (placeholder);
- g_object_unref (placeholder);
- placeholder = NULL;
- }
-}
-
-#ifdef G_OS_WIN32
-#define APP_EXTENSION ".exe"
-#else
-#define APP_EXTENSION
-#endif
-
-GtkWidget *
-do_application (GtkWidget *toplevel)
-{
- static guint watch = 0;
-
- if (watch == 0)
- watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
- "org.gtk.Demo",
- 0,
- on_name_appeared,
- on_name_vanished,
- NULL, NULL);
-
- if (placeholder == NULL)
- {
- const gchar *command;
- GError *error = NULL;
-
- if (g_file_test ("./gtk3-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
- command = "./gtk3-demo-application" APP_EXTENSION;
- else
- command = "gtk3-demo-application";
-
- if (!g_spawn_command_line_async (command, &error))
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- placeholder = gtk_label_new ("");
- g_object_ref_sink (placeholder);
- }
- else
- {
- g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
- "org.gtk.Demo",
- "/org/gtk/Demo",
- "org.gtk.Actions",
- "Activate",
- g_variant_new ("(sava{sv})", "quit", NULL, NULL),
- NULL,
- 0,
- G_MAXINT,
- NULL, NULL);
- }
-
- return placeholder;
-}
-
-#endif
diff --git a/gtk+-mingw/share/gtk-3.0/demo/application.ui b/gtk+-mingw/share/gtk-3.0/demo/application.ui
deleted file mode 100644
index 7085134..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/application.ui
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<interface>
- <object class="GtkGrid" id="grid">
- <child>
- <object class="GtkToolbar" id="toolbar">
- <property name="orientation">horizontal</property>
- <property name="halign">fill</property>
- <property name="hexpand">True</property>
- <child>
- <object class="GtkMenuToolButton" id="menutool">
- <property name="stock-id">gtk-open</property>
- </object>
- </child>
- <child>
- <object class="GtkToolButton" id="quit">
- <property name="stock-id">gtk-quit</property>
- <property name="action-name">app.quit</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="sep"/>
- </child>
- <child>
- <object class="GtkToolButton" id="logo">
- <property name="stock-id">demo-gtk-logo</property>
- <property name="action-name">win.logo</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkInfoBar" id="infobar">
- <property name="no-show-all">True</property>
- <property name="halign">fill</property>
- <property name="hexpand">True</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="content_area">
- <child>
- <object class="GtkLabel" id="message">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="halign">fill</property>
- </object>
- </child>
- </object>
- </child>
- <child internal-child="action_area">
- <object class="GtkBox" id="action_area">
- <child>
- <object class="GtkButton" id="button">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="label">gtk-ok</property>
- <property name="use-stock">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="sw">
- <property name="shadow-type">in</property>
- <child>
- <object class="GtkTextView" id="contents">
- <property name="halign">fill</property>
- <property name="valign">fill</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkStatusbar" id="status">
- <property name="halign">fill</property>
- <property name="hexpand">True</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- </packing>
- </child>
- </object>
- <menu id="toolmenu">
- <item>
- <attribute name="label">File1</attribute>
- <attribute name="action">win.file1</attribute>
- </item>
- </menu>
-</interface>
diff --git a/gtk+-mingw/share/gtk-3.0/demo/appwindow.c b/gtk+-mingw/share/gtk-3.0/demo/appwindow.c
deleted file mode 100644
index 648c2ab..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/appwindow.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/* Application window
- *
- * Demonstrates a typical application window with menubar, toolbar, statusbar.
- *
- * This example uses GtkUIManager and GtkActionGroup.
- */
-
-#include <gtk/gtk.h>
-#include "config.h"
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-static GtkWidget *infobar = NULL;
-static GtkWidget *messagelabel = NULL;
-
-static void
-activate_action (GtkAction *action)
-{
- const gchar *name = gtk_action_get_name (action);
- const gchar *typename = G_OBJECT_TYPE_NAME (action);
-
- GtkWidget *dialog;
-
- if (g_str_equal (name, "DarkTheme"))
- {
- gboolean value = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- GtkSettings *settings = gtk_settings_get_default ();
-
- g_object_set (G_OBJECT (settings),
- "gtk-application-prefer-dark-theme", value,
- NULL);
- return;
- }
-
- if (g_str_equal (name, "HideTitlebar"))
- {
- gboolean value = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), value);
- return;
- }
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_CLOSE,
- "You activated action: \"%s\" of type \"%s\"",
- name, typename);
-
- /* Close dialog on user response */
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- gtk_widget_show (dialog);
-}
-
-static void
-activate_radio_action (GtkAction *action, GtkRadioAction *current)
-{
- const gchar *name = gtk_action_get_name (GTK_ACTION (current));
- const gchar *typename = G_OBJECT_TYPE_NAME (GTK_ACTION (current));
- gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current));
- gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
-
- if (active)
- {
- gchar *text;
-
- text = g_strdup_printf ("You activated radio action: \"%s\" of type \"%s\".\n"
- "Current value: %d",
- name, typename, value);
- gtk_label_set_text (GTK_LABEL (messagelabel), text);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), (GtkMessageType)value);
- gtk_widget_show (infobar);
- g_free (text);
- }
-}
-
-static void
-about_cb (GtkAction *action,
- GtkWidget *window)
-{
- GdkPixbuf *pixbuf, *transparent;
- gchar *filename;
-
- const gchar *authors[] = {
- "Peter Mattis",
- "Spencer Kimball",
- "Josh MacDonald",
- "and many more...",
- NULL
- };
-
- const gchar *documentors[] = {
- "Owen Taylor",
- "Tony Gale",
- "Matthias Clasen <mclasen@redhat.com>",
- "and many more...",
- NULL
- };
-
- pixbuf = NULL;
- transparent = NULL;
- filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
- if (filename)
- {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- g_free (filename);
- transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
- g_object_unref (pixbuf);
- }
-
- gtk_show_about_dialog (GTK_WINDOW (window),
- "program-name", "GTK+ Code Demos",
- "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
- PACKAGE_VERSION,
- gtk_get_major_version (),
- gtk_get_minor_version (),
- gtk_get_micro_version ()),
- "copyright", "(C) 1997-2009 The GTK+ Team",
- "license-type", GTK_LICENSE_LGPL_2_1,
- "website", "http://www.gtk.org",
- "comments", "Program to demonstrate GTK+ functions.",
- "authors", authors,
- "documenters", documentors,
- "logo", transparent,
- "title", "About GTK+ Code Demos",
- NULL);
-
- g_object_unref (transparent);
-}
-
-typedef struct
-{
- GtkAction action;
-} ToolMenuAction;
-
-typedef struct
-{
- GtkActionClass parent_class;
-} ToolMenuActionClass;
-
-G_DEFINE_TYPE(ToolMenuAction, tool_menu_action, GTK_TYPE_ACTION)
-
-static void
-tool_menu_action_class_init (ToolMenuActionClass *class)
-{
- GTK_ACTION_CLASS (class)->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
-}
-
-static void
-tool_menu_action_init (ToolMenuAction *action)
-{
-}
-
-static GtkActionEntry entries[] = {
- { "FileMenu", NULL, "_File" }, /* name, stock id, label */
- { "OpenMenu", NULL, "_Open" }, /* name, stock id, label */
- { "PreferencesMenu", NULL, "_Preferences" }, /* name, stock id, label */
- { "ColorMenu", NULL, "_Color" }, /* name, stock id, label */
- { "ShapeMenu", NULL, "_Shape" }, /* name, stock id, label */
- { "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
- { "New", GTK_STOCK_NEW, /* name, stock id */
- "_New", "<control>N", /* label, accelerator */
- "Create a new file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "File1", NULL, /* name, stock id */
- "File1", NULL, /* label, accelerator */
- "Open first file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Save", GTK_STOCK_SAVE, /* name, stock id */
- "_Save","<control>S", /* label, accelerator */
- "Save current file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
- "Save _As...", NULL, /* label, accelerator */
- "Save to a file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Quit", GTK_STOCK_QUIT, /* name, stock id */
- "_Quit", "<control>Q", /* label, accelerator */
- "Quit", /* tooltip */
- G_CALLBACK (activate_action) },
- { "About", NULL, /* name, stock id */
- "_About", "<control>A", /* label, accelerator */
- "About", /* tooltip */
- G_CALLBACK (about_cb) },
- { "Logo", "demo-gtk-logo", /* name, stock id */
- NULL, NULL, /* label, accelerator */
- "GTK+", /* tooltip */
- G_CALLBACK (activate_action) },
-};
-static guint n_entries = G_N_ELEMENTS (entries);
-
-
-static GtkToggleActionEntry toggle_entries[] = {
- { "Bold", GTK_STOCK_BOLD, /* name, stock id */
- "_Bold", "<control>B", /* label, accelerator */
- "Bold", /* tooltip */
- G_CALLBACK (activate_action),
- TRUE }, /* is_active */
- { "DarkTheme", NULL, /* name, stock id */
- "_Prefer Dark Theme", NULL, /* label, accelerator */
- "Prefer Dark Theme", /* tooltip */
- G_CALLBACK (activate_action),
- FALSE }, /* is_active */
- { "HideTitlebar", NULL,
- "_Hide Titlebar when maximized", NULL,
- "Hide Titlebar when maximized",
- G_CALLBACK (activate_action),
- FALSE }
-};
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
-enum {
- COLOR_RED,
- COLOR_GREEN,
- COLOR_BLUE
-};
-
-static GtkRadioActionEntry color_entries[] = {
- { "Red", NULL, /* name, stock id */
- "_Red", "<control>R", /* label, accelerator */
- "Blood", COLOR_RED }, /* tooltip, value */
- { "Green", NULL, /* name, stock id */
- "_Green", "<control>G", /* label, accelerator */
- "Grass", COLOR_GREEN }, /* tooltip, value */
- { "Blue", NULL, /* name, stock id */
- "_Blue", "<control>B", /* label, accelerator */
- "Sky", COLOR_BLUE }, /* tooltip, value */
-};
-static guint n_color_entries = G_N_ELEMENTS (color_entries);
-
-enum {
- SHAPE_SQUARE,
- SHAPE_RECTANGLE,
- SHAPE_OVAL
-};
-
-static GtkRadioActionEntry shape_entries[] = {
- { "Square", NULL, /* name, stock id */
- "_Square", "<control>S", /* label, accelerator */
- "Square", SHAPE_SQUARE }, /* tooltip, value */
- { "Rectangle", NULL, /* name, stock id */
- "_Rectangle", "<control>R", /* label, accelerator */
- "Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
- { "Oval", NULL, /* name, stock id */
- "_Oval", "<control>O", /* label, accelerator */
- "Egg", SHAPE_OVAL }, /* tooltip, value */
-};
-static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
-
-static const gchar *ui_info =
-"<ui>"
-" <menubar name='MenuBar'>"
-" <menu action='FileMenu'>"
-" <menuitem action='New'/>"
-" <menuitem action='Open'/>"
-" <menuitem action='Save'/>"
-" <menuitem action='SaveAs'/>"
-" <separator/>"
-" <menuitem action='Quit'/>"
-" </menu>"
-" <menu action='PreferencesMenu'>"
-" <menuitem action='DarkTheme'/>"
-" <menuitem action='HideTitlebar'/>"
-" <menu action='ColorMenu'>"
-" <menuitem action='Red'/>"
-" <menuitem action='Green'/>"
-" <menuitem action='Blue'/>"
-" </menu>"
-" <menu action='ShapeMenu'>"
-" <menuitem action='Square'/>"
-" <menuitem action='Rectangle'/>"
-" <menuitem action='Oval'/>"
-" </menu>"
-" <menuitem action='Bold'/>"
-" </menu>"
-" <menu action='HelpMenu'>"
-" <menuitem action='About'/>"
-" </menu>"
-" </menubar>"
-" <toolbar name='ToolBar'>"
-" <toolitem action='Open'>"
-" <menu action='OpenMenu'>"
-" <menuitem action='File1'/>"
-" </menu>"
-" </toolitem>"
-" <toolitem action='Quit'/>"
-" <separator action='Sep1'/>"
-" <toolitem action='Logo'/>"
-" </toolbar>"
-"</ui>";
-
-
-
-/* This function registers our custom toolbar icons, so they can be themed.
- *
- * It's totally optional to do this, you could just manually insert icons
- * and have them not be themeable, especially if you never expect people
- * to theme your app.
- */
-static void
-register_stock_icons (void)
-{
- static gboolean registered = FALSE;
-
- if (!registered)
- {
- GdkPixbuf *pixbuf;
- GtkIconFactory *factory;
- char *filename;
-
- static GtkStockItem items[] = {
- { "demo-gtk-logo",
- "_GTK!",
- 0, 0, NULL }
- };
-
- registered = TRUE;
-
- /* Register our stock items */
- gtk_stock_add (items, G_N_ELEMENTS (items));
-
- /* Add our custom icon factory to the list of defaults */
- factory = gtk_icon_factory_new ();
- gtk_icon_factory_add_default (factory);
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- pixbuf = NULL;
- filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
- if (filename)
- {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- g_free (filename);
- }
-
- /* Register icon to accompany stock item */
- if (pixbuf != NULL)
- {
- GtkIconSet *icon_set;
- GdkPixbuf *transparent;
-
- /* The gtk-logo-rgb icon has a white background, make it transparent */
- transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
-
- icon_set = gtk_icon_set_new_from_pixbuf (transparent);
- gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
- gtk_icon_set_unref (icon_set);
- g_object_unref (pixbuf);
- g_object_unref (transparent);
- }
- else
- g_warning ("failed to load GTK logo for toolbar");
-
- /* Drop our reference to the factory, GTK will hold a reference. */
- g_object_unref (factory);
- }
-}
-
-static void
-update_statusbar (GtkTextBuffer *buffer,
- GtkStatusbar *statusbar)
-{
- gchar *msg;
- gint row, col;
- gint count;
- GtkTextIter iter;
-
- gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
- * underflow is allowed
- */
-
- count = gtk_text_buffer_get_char_count (buffer);
-
- gtk_text_buffer_get_iter_at_mark (buffer,
- &iter,
- gtk_text_buffer_get_insert (buffer));
-
- row = gtk_text_iter_get_line (&iter);
- col = gtk_text_iter_get_line_offset (&iter);
-
- msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
- row, col, count);
-
- gtk_statusbar_push (statusbar, 0, msg);
-
- g_free (msg);
-}
-
-static void
-mark_set_callback (GtkTextBuffer *buffer,
- const GtkTextIter *new_location,
- GtkTextMark *mark,
- gpointer data)
-{
- update_statusbar (buffer, GTK_STATUSBAR (data));
-}
-
-GtkWidget *
-do_appwindow (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *table;
- GtkWidget *statusbar;
- GtkWidget *contents;
- GtkWidget *sw;
- GtkWidget *bar;
- GtkTextBuffer *buffer;
- GtkActionGroup *action_group;
- GtkAction *open_action;
- GtkUIManager *merge;
- GError *error = NULL;
-
- register_stock_icons ();
-
- /* Create the toplevel window
- */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Application Window");
- gtk_window_set_icon_name (GTK_WINDOW (window), "document-open");
-
- /* NULL window variable when window is closed */
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- table = gtk_grid_new ();
-
- gtk_container_add (GTK_CONTAINER (window), table);
-
- /* Create the menubar and toolbar
- */
-
- action_group = gtk_action_group_new ("AppWindowActions");
- open_action = g_object_new (tool_menu_action_get_type (),
- "name", "Open",
- "label", "_Open",
- "tooltip", "Open a file",
- "stock-id", GTK_STOCK_OPEN,
- NULL);
- gtk_action_group_add_action (action_group, open_action);
- g_object_unref (open_action);
- gtk_action_group_add_actions (action_group,
- entries, n_entries,
- window);
- gtk_action_group_add_toggle_actions (action_group,
- toggle_entries, n_toggle_entries,
- NULL);
- gtk_action_group_add_radio_actions (action_group,
- color_entries, n_color_entries,
- COLOR_RED,
- G_CALLBACK (activate_radio_action),
- NULL);
- gtk_action_group_add_radio_actions (action_group,
- shape_entries, n_shape_entries,
- SHAPE_SQUARE,
- G_CALLBACK (activate_radio_action),
- NULL);
-
- merge = gtk_ui_manager_new ();
- g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
- g_object_unref);
- gtk_ui_manager_insert_action_group (merge, action_group, 0);
- gtk_window_add_accel_group (GTK_WINDOW (window),
- gtk_ui_manager_get_accel_group (merge));
-
- if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
- {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
-
- bar = gtk_ui_manager_get_widget (merge, "/MenuBar");
- gtk_widget_show (bar);
- gtk_widget_set_halign (bar, GTK_ALIGN_FILL);
- gtk_grid_attach (GTK_GRID (table), bar, 0, 0, 1, 1);
-
- bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
- gtk_widget_show (bar);
- gtk_widget_set_halign (bar, GTK_ALIGN_FILL);
- gtk_grid_attach (GTK_GRID (table), bar, 0, 1, 1, 1);
-
- /* Create document
- */
-
- infobar = gtk_info_bar_new ();
- gtk_widget_set_no_show_all (infobar, TRUE);
- messagelabel = gtk_label_new ("");
- gtk_widget_show (messagelabel);
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar))),
- messagelabel,
- TRUE, TRUE, 0);
- gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
- GTK_STOCK_OK, GTK_RESPONSE_OK);
- g_signal_connect (infobar, "response",
- G_CALLBACK (gtk_widget_hide), NULL);
-
- gtk_widget_set_halign (infobar, GTK_ALIGN_FILL);
- gtk_grid_attach (GTK_GRID (table), infobar, 0, 2, 1, 1);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_IN);
-
- gtk_widget_set_halign (sw, GTK_ALIGN_FILL);
- gtk_widget_set_valign (sw, GTK_ALIGN_FILL);
- gtk_widget_set_hexpand (sw, TRUE);
- gtk_widget_set_vexpand (sw, TRUE);
- gtk_grid_attach (GTK_GRID (table), sw, 0, 3, 1, 1);
-
- gtk_window_set_default_size (GTK_WINDOW (window),
- 200, 200);
-
- contents = gtk_text_view_new ();
- gtk_widget_grab_focus (contents);
-
- gtk_container_add (GTK_CONTAINER (sw),
- contents);
-
- /* Create statusbar */
-
- statusbar = gtk_statusbar_new ();
- gtk_widget_set_halign (sw, GTK_ALIGN_FILL);
- gtk_grid_attach (GTK_GRID (table), statusbar, 0, 4, 1, 1);
-
- /* Show text widget info in the statusbar */
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
-
- g_signal_connect_object (buffer,
- "changed",
- G_CALLBACK (update_statusbar),
- statusbar,
- 0);
-
- g_signal_connect_object (buffer,
- "mark_set", /* cursor moved */
- G_CALLBACK (mark_set_callback),
- statusbar,
- 0);
-
- update_statusbar (buffer, GTK_STATUSBAR (statusbar));
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- infobar = NULL;
- messagelabel = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/assistant.c b/gtk+-mingw/share/gtk-3.0/demo/assistant.c
deleted file mode 100644
index 7d7fbcd..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/assistant.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Assistant
- *
- * Demonstrates a sample multi-step assistant. Assistants are used to divide
- * an operation into several simpler sequential steps, and to guide the user
- * through these steps.
- */
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-static GtkWidget *assistant = NULL;
-static GtkWidget *progress_bar = NULL;
-
-static gboolean
-apply_changes_gradually (gpointer data)
-{
- gdouble fraction;
-
- /* Work, work, work... */
- fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
- fraction += 0.05;
-
- if (fraction < 1.0)
- {
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
- return G_SOURCE_CONTINUE;
- }
- else
- {
- /* Close automatically once changes are fully applied. */
- gtk_widget_destroy (assistant);
- assistant = NULL;
- return G_SOURCE_REMOVE;
- }
-}
-
-static void
-on_assistant_apply (GtkWidget *widget, gpointer data)
-{
- /* Start a timer to simulate changes taking a few seconds to apply. */
- g_timeout_add (100, apply_changes_gradually, NULL);
-}
-
-static void
-on_assistant_close_cancel (GtkWidget *widget, gpointer data)
-{
- GtkWidget **assistant = (GtkWidget **) data;
-
- gtk_widget_destroy (*assistant);
- *assistant = NULL;
-}
-
-static void
-on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
-{
- gint current_page, n_pages;
- gchar *title;
-
- current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
- n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
-
- title = g_strdup_printf ("Sample assistant (%d of %d)", current_page + 1, n_pages);
- gtk_window_set_title (GTK_WINDOW (widget), title);
- g_free (title);
-
- /* The fourth page (counting from zero) is the progress page. The
- * user clicked Apply to get here so we tell the assistant to commit,
- * which means the changes up to this point are permanent and cannot
- * be cancelled or revisited. */
- if (current_page == 3)
- gtk_assistant_commit (GTK_ASSISTANT (widget));
-}
-
-static void
-on_entry_changed (GtkWidget *widget, gpointer data)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (data);
- GtkWidget *current_page;
- gint page_number;
- const gchar *text;
-
- page_number = gtk_assistant_get_current_page (assistant);
- current_page = gtk_assistant_get_nth_page (assistant, page_number);
- text = gtk_entry_get_text (GTK_ENTRY (widget));
-
- if (text && *text)
- gtk_assistant_set_page_complete (assistant, current_page, TRUE);
- else
- gtk_assistant_set_page_complete (assistant, current_page, FALSE);
-}
-
-static void
-create_page1 (GtkWidget *assistant)
-{
- GtkWidget *box, *label, *entry;
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_container_set_border_width (GTK_CONTAINER (box), 12);
-
- label = gtk_label_new ("You must fill out this entry to continue:");
- gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
-
- entry = gtk_entry_new ();
- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
- g_signal_connect (G_OBJECT (entry), "changed",
- G_CALLBACK (on_entry_changed), assistant);
-
- gtk_widget_show_all (box);
- gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
- gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 1");
- gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);
-}
-
-static void
-create_page2 (GtkWidget *assistant)
-{
- GtkWidget *box, *checkbutton;
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_container_set_border_width (GTK_CONTAINER (box), 12);
-
- checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
- "even if you do not check this");
- gtk_box_pack_start (GTK_BOX (box), checkbutton, FALSE, FALSE, 0);
-
- gtk_widget_show_all (box);
- gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
- gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
- gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");
-}
-
-static void
-create_page3 (GtkWidget *assistant)
-{
- GtkWidget *label;
-
- label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");
-
- gtk_widget_show (label);
- gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
- gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
- gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
- gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");
-}
-
-static void
-create_page4 (GtkWidget *assistant)
-{
- progress_bar = gtk_progress_bar_new ();
- gtk_widget_set_halign (progress_bar, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (progress_bar, GTK_ALIGN_CENTER);
-
- gtk_widget_show (progress_bar);
- gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
- gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
- gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
-
- /* This prevents the assistant window from being
- * closed while we're "busy" applying changes.
- */
- gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), progress_bar, FALSE);
-}
-
-GtkWidget*
-do_assistant (GtkWidget *do_widget)
-{
- if (!assistant)
- {
- assistant = gtk_assistant_new ();
-
- gtk_window_set_default_size (GTK_WINDOW (assistant), -1, 300);
-
- gtk_window_set_screen (GTK_WINDOW (assistant),
- gtk_widget_get_screen (do_widget));
-
- create_page1 (assistant);
- create_page2 (assistant);
- create_page3 (assistant);
- create_page4 (assistant);
-
- g_signal_connect (G_OBJECT (assistant), "cancel",
- G_CALLBACK (on_assistant_close_cancel), &assistant);
- g_signal_connect (G_OBJECT (assistant), "close",
- G_CALLBACK (on_assistant_close_cancel), &assistant);
- g_signal_connect (G_OBJECT (assistant), "apply",
- G_CALLBACK (on_assistant_apply), NULL);
- g_signal_connect (G_OBJECT (assistant), "prepare",
- G_CALLBACK (on_assistant_prepare), NULL);
- }
-
- if (!gtk_widget_get_visible (assistant))
- gtk_widget_show (assistant);
- else
- {
- gtk_widget_destroy (assistant);
- assistant = NULL;
- }
-
- return assistant;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/background.jpg b/gtk+-mingw/share/gtk-3.0/demo/background.jpg
deleted file mode 100644
index 86c006a..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/background.jpg
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/builder.c b/gtk+-mingw/share/gtk-3.0/demo/builder.c
deleted file mode 100644
index f0691af..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/builder.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Builder :: demo.ui
- *
- * Demonstrates an interface loaded from a XML description.
- */
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-static GtkBuilder *builder;
-
-G_MODULE_EXPORT void
-quit_activate (GtkAction *action)
-{
- GtkWidget *window;
-
- window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
- gtk_widget_destroy (window);
-}
-
-G_MODULE_EXPORT void
-about_activate (GtkAction *action)
-{
- GtkWidget *about_dlg;
-
- about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
- gtk_dialog_run (GTK_DIALOG (about_dlg));
- gtk_widget_hide (about_dlg);
-}
-
-G_MODULE_EXPORT void
-help_activate (GtkAction *action)
-{
- g_print ("Help not available\n");
-}
-
-GtkWidget *
-do_builder (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- GError *err = NULL;
- gchar *filename;
-
- if (!window)
- {
- builder = gtk_builder_new ();
- filename = demo_find_file ("demo.ui", NULL);
- gtk_builder_add_from_file (builder, filename, &err);
- g_free (filename);
- if (err)
- {
- g_error ("ERROR: %s\n", err->message);
- return NULL;
- }
- gtk_builder_connect_signals (builder, NULL);
- window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/button_box.c b/gtk+-mingw/share/gtk-3.0/demo/button_box.c
deleted file mode 100644
index 798dc7c..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/button_box.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Button Boxes
- *
- * The Button Box widgets are used to arrange buttons with padding.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *
-create_bbox (gint horizontal,
- char *title,
- gint spacing,
- gint layout)
-{
- GtkWidget *frame;
- GtkWidget *bbox;
- GtkWidget *button;
-
- frame = gtk_frame_new (title);
-
- if (horizontal)
- bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
- else
- bbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);
-
- gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), bbox);
-
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
- gtk_box_set_spacing (GTK_BOX (bbox), spacing);
-
- button = gtk_button_new_from_stock (GTK_STOCK_OK);
- gtk_container_add (GTK_CONTAINER (bbox), button);
-
- button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_container_add (GTK_CONTAINER (bbox), button);
-
- button = gtk_button_new_from_stock (GTK_STOCK_HELP);
- gtk_container_add (GTK_CONTAINER (bbox), button);
-
- return frame;
-}
-
-GtkWidget *
-do_button_box (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *main_vbox;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *frame_horz;
- GtkWidget *frame_vert;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
- main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
- frame_horz = gtk_frame_new ("Horizontal Button Boxes");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
- gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
- TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
- TRUE, TRUE, 5);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
- TRUE, TRUE, 5);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
- TRUE, TRUE, 5);
-
- frame_vert = gtk_frame_new ("Vertical Button Boxes");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
- gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
- TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
- TRUE, TRUE, 5);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
- TRUE, TRUE, 5);
-
- gtk_box_pack_start (GTK_BOX (hbox),
- create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
- TRUE, TRUE, 5);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/changedisplay.c b/gtk+-mingw/share/gtk-3.0/demo/changedisplay.c
deleted file mode 100644
index f38819d..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/changedisplay.c
+++ /dev/null
@@ -1,654 +0,0 @@
-/* Change Display
- *
- * Demonstrates migrating a window between different displays and
- * screens. A display is a mouse and keyboard with some number of
- * associated monitors. A screen is a set of monitors grouped
- * into a single physical work area. The neat thing about having
- * multiple displays is that they can be on a completely separate
- * computers, as long as there is a network connection to the
- * computer where the application is running.
- *
- * Only some of the windowing systems where GTK+ runs have the
- * concept of multiple displays and screens. (The X Window System
- * is the main example.) Other windowing systems can only
- * handle one keyboard and mouse, and combine all monitors into
- * a single screen.
- *
- * This is a moderately complex example, and demonstrates:
- *
- * - Tracking the currently open displays and screens
- *
- * - Changing the screen for a window
- *
- * - Letting the user choose a window by clicking on it
- *
- * - Using GtkListStore and GtkTreeView
- *
- * - Using GtkDialog
- */
-#include <string.h>
-
-#undef GDK_DISABLE_DEPRECATED
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-/* The ChangeDisplayInfo structure corresponds to a toplevel window and
- * holds pointers to widgets inside the toplevel window along with other
- * information about the contents of the window.
- * This is a common organizational structure in real applications.
- */
-typedef struct _ChangeDisplayInfo ChangeDisplayInfo;
-
-struct _ChangeDisplayInfo
-{
- GtkWidget *window;
- GtkSizeGroup *size_group;
-
- GtkTreeModel *display_model;
- GtkTreeModel *screen_model;
- GtkTreeSelection *screen_selection;
-
- GdkDisplay *current_display;
- GdkScreen *current_screen;
-};
-
-/* These enumerations provide symbolic names for the columns
- * in the two GtkListStore models.
- */
-enum
-{
- DISPLAY_COLUMN_NAME,
- DISPLAY_COLUMN_DISPLAY,
- DISPLAY_NUM_COLUMNS
-};
-
-enum
-{
- SCREEN_COLUMN_NUMBER,
- SCREEN_COLUMN_SCREEN,
- SCREEN_NUM_COLUMNS
-};
-
-/* Finds the toplevel window under the mouse pointer, if any.
- */
-static GtkWidget *
-find_toplevel_at_pointer (GdkDisplay *display)
-{
- GdkWindow *pointer_window;
- GtkWidget *widget = NULL;
-
- pointer_window = gdk_device_get_window_at_position (gtk_get_current_event_device (),
- NULL, NULL);
-
- /* The user data field of a GdkWindow is used to store a pointer
- * to the widget that created it.
- */
- if (pointer_window)
- {
- gpointer widget_ptr;
- gdk_window_get_user_data (pointer_window, &widget_ptr);
- widget = widget_ptr;
- }
-
- return widget ? gtk_widget_get_toplevel (widget) : NULL;
-}
-
-static gboolean
-button_release_event_cb (GtkWidget *widget,
- GdkEventButton *event,
- gboolean *clicked)
-{
- *clicked = TRUE;
- return TRUE;
-}
-
-/* Asks the user to click on a window, then waits for them click
- * the mouse. When the mouse is released, returns the toplevel
- * window under the pointer, or NULL, if there is none.
- */
-static GtkWidget *
-query_for_toplevel (GdkScreen *screen,
- const char *prompt)
-{
- GdkDisplay *display = gdk_screen_get_display (screen);
- GtkWidget *popup, *label, *frame;
- GdkCursor *cursor;
- GtkWidget *toplevel = NULL;
-
- popup = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_window_set_screen (GTK_WINDOW (popup), screen);
- gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
- gtk_window_set_position (GTK_WINDOW (popup), GTK_WIN_POS_CENTER);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
- gtk_container_add (GTK_CONTAINER (popup), frame);
-
- label = gtk_label_new (prompt);
- g_object_set (label, "margin", 10, NULL);
- gtk_container_add (GTK_CONTAINER (frame), label);
-
- gtk_widget_show_all (popup);
- cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
-
- if (gdk_device_grab (gtk_get_current_event_device (),
- gtk_widget_get_window (popup),
- GDK_OWNERSHIP_NONE,
- FALSE,
- GDK_BUTTON_RELEASE_MASK,
- cursor,
- GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
- {
- gboolean clicked = FALSE;
-
- g_signal_connect (popup, "button-release-event",
- G_CALLBACK (button_release_event_cb), &clicked);
-
- /* Process events until clicked is set by button_release_event_cb.
- * We pass in may_block=TRUE since we want to wait if there
- * are no events currently.
- */
- while (!clicked)
- g_main_context_iteration (NULL, TRUE);
-
- toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
- if (toplevel == popup)
- toplevel = NULL;
- }
-
- g_object_unref (cursor);
- gtk_widget_destroy (popup);
- gdk_flush (); /* Really release the grab */
-
- return toplevel;
-}
-
-/* Prompts the user for a toplevel window to move, and then moves
- * that window to the currently selected display
- */
-static void
-query_change_display (ChangeDisplayInfo *info)
-{
- GdkScreen *screen = gtk_widget_get_screen (info->window);
- GtkWidget *toplevel;
-
- toplevel = query_for_toplevel (screen,
- "Please select the toplevel\n"
- "to move to the new screen");
-
- if (toplevel)
- gtk_window_set_screen (GTK_WINDOW (toplevel), info->current_screen);
- else
- gdk_display_beep (gdk_screen_get_display (screen));
-}
-
-/* Fills in the screen list based on the current display
- */
-static void
-fill_screens (ChangeDisplayInfo *info)
-{
- gtk_list_store_clear (GTK_LIST_STORE (info->screen_model));
-
- if (info->current_display)
- {
- gint n_screens = gdk_display_get_n_screens (info->current_display);
- gint i;
-
- for (i = 0; i < n_screens; i++)
- {
- GdkScreen *screen = gdk_display_get_screen (info->current_display, i);
- GtkTreeIter iter;
-
- gtk_list_store_append (GTK_LIST_STORE (info->screen_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (info->screen_model), &iter,
- SCREEN_COLUMN_NUMBER, i,
- SCREEN_COLUMN_SCREEN, screen,
- -1);
-
- if (i == 0)
- gtk_tree_selection_select_iter (info->screen_selection, &iter);
- }
- }
-}
-
-/* Called when the user clicks on a button in our dialog or
- * closes the dialog through the window manager. Unless the
- * "Change" button was clicked, we destroy the dialog.
- */
-static void
-response_cb (GtkDialog *dialog,
- gint response_id,
- ChangeDisplayInfo *info)
-{
- if (response_id == GTK_RESPONSE_OK)
- query_change_display (info);
- else
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-/* Called when the user clicks on "Open..." in the display
- * frame. Prompts for a new display, and then opens a connection
- * to that display.
- */
-static void
-open_display_cb (GtkWidget *button,
- ChangeDisplayInfo *info)
-{
- GtkWidget *content_area;
- GtkWidget *dialog;
- GtkWidget *display_entry;
- GtkWidget *dialog_label;
- gchar *new_screen_name = NULL;
- GdkDisplay *result = NULL;
-
- dialog = gtk_dialog_new_with_buttons ("Open Display",
- GTK_WINDOW (info->window),
- GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- display_entry = gtk_entry_new ();
- gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
- dialog_label =
- gtk_label_new ("Please enter the name of\nthe new display\n");
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
- gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
- gtk_container_add (GTK_CONTAINER (content_area), display_entry);
-
- gtk_widget_grab_focus (display_entry);
- gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
-
- while (!result)
- {
- gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response_id != GTK_RESPONSE_OK)
- break;
-
- new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
- 0, -1);
-
- if (strcmp (new_screen_name, "") != 0)
- {
- result = gdk_display_open (new_screen_name);
- if (!result)
- {
- gchar *error_msg =
- g_strdup_printf ("Can't open display :\n\t%s\nplease try another one\n",
- new_screen_name);
- gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
- g_free (error_msg);
- }
-
- g_free (new_screen_name);
- }
- }
-
- gtk_widget_destroy (dialog);
-}
-
-/* Called when the user clicks on the "Close" button in the
- * "Display" frame. Closes the selected display.
- */
-static void
-close_display_cb (GtkWidget *button,
- ChangeDisplayInfo *info)
-{
- if (info->current_display)
- gdk_display_close (info->current_display);
-}
-
-/* Called when the selected row in the display list changes.
- * Updates info->current_display, then refills the list of
- * screens.
- */
-static void
-display_changed_cb (GtkTreeSelection *selection,
- ChangeDisplayInfo *info)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (info->current_display)
- g_object_unref (info->current_display);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- gtk_tree_model_get (model, &iter,
- DISPLAY_COLUMN_DISPLAY, &info->current_display,
- -1);
- else
- info->current_display = NULL;
-
- fill_screens (info);
-}
-
-/* Called when the selected row in the sceen list changes.
- * Updates info->current_screen.
- */
-static void
-screen_changed_cb (GtkTreeSelection *selection,
- ChangeDisplayInfo *info)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (info->current_screen)
- g_object_unref (info->current_screen);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- gtk_tree_model_get (model, &iter,
- SCREEN_COLUMN_SCREEN, &info->current_screen,
- -1);
- else
- info->current_screen = NULL;
-}
-
-/* This function is used both for creating the "Display" and
- * "Screen" frames, since they have a similar structure. The
- * caller hooks up the right context for the value returned
- * in tree_view, and packs any relevant buttons into button_vbox.
- */
-static void
-create_frame (ChangeDisplayInfo *info,
- const char *title,
- GtkWidget **frame,
- GtkWidget **tree_view,
- GtkWidget **button_vbox)
-{
- GtkTreeSelection *selection;
- GtkWidget *scrollwin;
- GtkWidget *hbox;
-
- *frame = gtk_frame_new (title);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
- gtk_container_add (GTK_CONTAINER (*frame), hbox);
-
- scrollwin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
- GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0);
-
- *tree_view = gtk_tree_view_new ();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
- gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
-
- *button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE, 0);
-
- if (!info->size_group)
- info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
-}
-
-/* If we have a stack of buttons, it often looks better if their contents
- * are left-aligned, rather than centered. This function creates a button
- * and left-aligns it contents.
- */
-GtkWidget *
-left_align_button_new (const char *label)
-{
- GtkWidget *button = gtk_button_new_with_mnemonic (label);
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (button));
-
- gtk_widget_set_halign (child, GTK_ALIGN_START);
- gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
-
- return button;
-}
-
-/* Creates the "Display" frame in the main window.
- */
-GtkWidget *
-create_display_frame (ChangeDisplayInfo *info)
-{
- GtkWidget *frame;
- GtkWidget *tree_view;
- GtkWidget *button_vbox;
- GtkTreeViewColumn *column;
- GtkTreeSelection *selection;
- GtkWidget *button;
-
- create_frame (info, "Display", &frame, &tree_view, &button_vbox);
-
- button = left_align_button_new ("_Open...");
- g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
- gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
-
- button = left_align_button_new ("_Close");
- g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
- gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
-
- info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
- G_TYPE_STRING,
- GDK_TYPE_DISPLAY);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->display_model);
-
- column = gtk_tree_view_column_new_with_attributes ("Name",
- gtk_cell_renderer_text_new (),
- "text", DISPLAY_COLUMN_NAME,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
- g_signal_connect (selection, "changed",
- G_CALLBACK (display_changed_cb), info);
-
- return frame;
-}
-
-/* Creates the "Screen" frame in the main window.
- */
-GtkWidget *
-create_screen_frame (ChangeDisplayInfo *info)
-{
- GtkWidget *frame;
- GtkWidget *tree_view;
- GtkWidget *button_vbox;
- GtkTreeViewColumn *column;
-
- create_frame (info, "Screen", &frame, &tree_view, &button_vbox);
-
- info->screen_model = (GtkTreeModel *)gtk_list_store_new (SCREEN_NUM_COLUMNS,
- G_TYPE_INT,
- GDK_TYPE_SCREEN);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->screen_model);
-
- column = gtk_tree_view_column_new_with_attributes ("Number",
- gtk_cell_renderer_text_new (),
- "text", SCREEN_COLUMN_NUMBER,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
-
- info->screen_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
- g_signal_connect (info->screen_selection, "changed",
- G_CALLBACK (screen_changed_cb), info);
-
- return frame;
-}
-
-/* Called when one of the currently open displays is closed.
- * Remove it from our list of displays.
- */
-static void
-display_closed_cb (GdkDisplay *display,
- gboolean is_error,
- ChangeDisplayInfo *info)
-{
- GtkTreeIter iter;
- gboolean valid;
-
- for (valid = gtk_tree_model_get_iter_first (info->display_model, &iter);
- valid;
- valid = gtk_tree_model_iter_next (info->display_model, &iter))
- {
- GdkDisplay *tmp_display;
-
- gtk_tree_model_get (info->display_model, &iter,
- DISPLAY_COLUMN_DISPLAY, &tmp_display,
- -1);
- if (tmp_display == display)
- {
- gtk_list_store_remove (GTK_LIST_STORE (info->display_model), &iter);
- break;
- }
- }
-}
-
-/* Adds a new display to our list of displays, and connects
- * to the "closed" signal so that we can remove it from the
- * list of displays again.
- */
-static void
-add_display (ChangeDisplayInfo *info,
- GdkDisplay *display)
-{
- const gchar *name = gdk_display_get_name (display);
- GtkTreeIter iter;
-
- gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
- DISPLAY_COLUMN_NAME, name,
- DISPLAY_COLUMN_DISPLAY, display,
- -1);
-
- g_signal_connect (display, "closed",
- G_CALLBACK (display_closed_cb), info);
-}
-
-/* Called when a new display is opened
- */
-static void
-display_opened_cb (GdkDisplayManager *manager,
- GdkDisplay *display,
- ChangeDisplayInfo *info)
-{
- add_display (info, display);
-}
-
-/* Adds all currently open displays to our list of displays,
- * and set up a signal connection so that we'll be notified
- * when displays are opened in the future as well.
- */
-static void
-initialize_displays (ChangeDisplayInfo *info)
-{
- GdkDisplayManager *manager = gdk_display_manager_get ();
- GSList *displays = gdk_display_manager_list_displays (manager);
- GSList *tmp_list;
-
- for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
- add_display (info, tmp_list->data);
-
- g_slist_free (tmp_list);
-
- g_signal_connect (manager, "display-opened",
- G_CALLBACK (display_opened_cb), info);
-}
-
-/* Cleans up when the toplevel is destroyed; we remove the
- * connections we use to track currently open displays, then
- * free the ChangeDisplayInfo structure.
- */
-static void
-destroy_info (ChangeDisplayInfo *info)
-{
- GdkDisplayManager *manager = gdk_display_manager_get ();
- GSList *displays = gdk_display_manager_list_displays (manager);
- GSList *tmp_list;
-
- g_signal_handlers_disconnect_by_func (manager,
- display_opened_cb,
- info);
-
- for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
- g_signal_handlers_disconnect_by_func (tmp_list->data,
- display_closed_cb,
- info);
-
- g_slist_free (tmp_list);
-
- g_object_unref (info->size_group);
- g_object_unref (info->display_model);
- g_object_unref (info->screen_model);
-
- if (info->current_display)
- g_object_unref (info->current_display);
- if (info->current_screen)
- g_object_unref (info->current_screen);
-
- g_free (info);
-}
-
-static void
-destroy_cb (GObject *object,
- ChangeDisplayInfo **info)
-{
- destroy_info (*info);
- *info = NULL;
-}
-
-/* Main entry point. If the dialog for this demo doesn't yet exist, creates
- * it. Otherwise, destroys it.
- */
-GtkWidget *
-do_changedisplay (GtkWidget *do_widget)
-{
- static ChangeDisplayInfo *info = NULL;
-
- if (!info)
- {
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *frame;
-
- info = g_new0 (ChangeDisplayInfo, 1);
-
- info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- "Change", GTK_RESPONSE_OK,
- NULL);
-
- gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
-
- g_signal_connect (info->window, "response",
- G_CALLBACK (response_cb), info);
- g_signal_connect (info->window, "destroy",
- G_CALLBACK (destroy_cb), &info);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (info->window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
-
- frame = create_display_frame (info);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- frame = create_screen_frame (info);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- initialize_displays (info);
-
- gtk_widget_show_all (info->window);
- return info->window;
- }
- else
- {
- gtk_widget_destroy (info->window);
- return NULL;
- }
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/clipboard.c b/gtk+-mingw/share/gtk-3.0/demo/clipboard.c
deleted file mode 100644
index 9497403..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/clipboard.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/* Clipboard
- *
- * GtkClipboard is used for clipboard handling. This demo shows how to
- * copy and paste text to and from the clipboard.
- *
- * It also shows how to transfer images via the clipboard or via
- * drag-and-drop, and how to make clipboard contents persist after
- * the application exits. Clipboard persistence requires a clipboard
- * manager to run.
- */
-
-#include <gtk/gtk.h>
-#include <string.h>
-
-static GtkWidget *window = NULL;
-
-void
-copy_button_clicked (GtkWidget *button,
- gpointer user_data)
-{
- GtkWidget *entry;
- GtkClipboard *clipboard;
-
- entry = GTK_WIDGET (user_data);
-
- /* Get the clipboard object */
- clipboard = gtk_widget_get_clipboard (entry,
- GDK_SELECTION_CLIPBOARD);
-
- /* Set clipboard text */
- gtk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)), -1);
-}
-
-void
-paste_received (GtkClipboard *clipboard,
- const gchar *text,
- gpointer user_data)
-{
- GtkWidget *entry;
-
- entry = GTK_WIDGET (user_data);
-
- /* Set the entry text */
- if(text)
- gtk_entry_set_text (GTK_ENTRY (entry), text);
-}
-
-void
-paste_button_clicked (GtkWidget *button,
- gpointer user_data)
-{
- GtkWidget *entry;
- GtkClipboard *clipboard;
-
- entry = GTK_WIDGET (user_data);
-
- /* Get the clipboard object */
- clipboard = gtk_widget_get_clipboard (entry,
- GDK_SELECTION_CLIPBOARD);
-
- /* Request the contents of the clipboard, contents_received will be
- called when we do get the contents.
- */
- gtk_clipboard_request_text (clipboard,
- paste_received, entry);
-}
-
-static GdkPixbuf *
-get_image_pixbuf (GtkImage *image)
-{
- gchar *stock_id;
- GtkIconSize size;
-
- switch (gtk_image_get_storage_type (image))
- {
- case GTK_IMAGE_PIXBUF:
- return g_object_ref (gtk_image_get_pixbuf (image));
- case GTK_IMAGE_STOCK:
- gtk_image_get_stock (image, &stock_id, &size);
- return gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
- stock_id, size);
- default:
- g_warning ("Image storage type %d not handled",
- gtk_image_get_storage_type (image));
- return NULL;
- }
-}
-
-static void
-drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- gpointer data)
-{
- GdkPixbuf *pixbuf;
-
- pixbuf = get_image_pixbuf (GTK_IMAGE (data));
- gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
- g_object_unref (pixbuf);
-}
-
-void
-drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
-{
- GdkPixbuf *pixbuf;
-
- pixbuf = get_image_pixbuf (GTK_IMAGE (data));
- gtk_selection_data_set_pixbuf (selection_data, pixbuf);
- g_object_unref (pixbuf);
-}
-
-static void
-drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint32 time,
- gpointer data)
-{
- GdkPixbuf *pixbuf;
-
- if (gtk_selection_data_get_length (selection_data) > 0)
- {
- pixbuf = gtk_selection_data_get_pixbuf (selection_data);
- gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
- g_object_unref (pixbuf);
- }
-}
-
-static void
-copy_image (GtkMenuItem *item,
- gpointer data)
-{
- GtkClipboard *clipboard;
- GdkPixbuf *pixbuf;
-
- clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- pixbuf = get_image_pixbuf (GTK_IMAGE (data));
-
- gtk_clipboard_set_image (clipboard, pixbuf);
- g_object_unref (pixbuf);
-}
-
-static void
-paste_image (GtkMenuItem *item,
- gpointer data)
-{
- GtkClipboard *clipboard;
- GdkPixbuf *pixbuf;
-
- clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- pixbuf = gtk_clipboard_wait_for_image (clipboard);
-
- if (pixbuf)
- {
- gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
- g_object_unref (pixbuf);
- }
-}
-
-static gboolean
-button_press (GtkWidget *widget,
- GdkEventButton *button,
- gpointer data)
-{
- GtkWidget *menu;
- GtkWidget *item;
-
- if (button->button != GDK_BUTTON_SECONDARY)
- return FALSE;
-
- menu = gtk_menu_new ();
-
- item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
- g_signal_connect (item, "activate", G_CALLBACK (copy_image), data);
- gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, NULL);
- g_signal_connect (item, "activate", G_CALLBACK (paste_image), data);
- gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 3, button->time);
- return TRUE;
-}
-
-GtkWidget *
-do_clipboard (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *vbox, *hbox;
- GtkWidget *label;
- GtkWidget *entry, *button;
- GtkWidget *ebox, *image;
- GtkClipboard *clipboard;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
-
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- /* Create the first entry */
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-
- /* Create the button */
- button = gtk_button_new_from_stock (GTK_STOCK_COPY);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (copy_button_clicked), entry);
-
- label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- /* Create the second entry */
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-
- /* Create the button */
- button = gtk_button_new_from_stock (GTK_STOCK_PASTE);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (paste_button_clicked), entry);
-
- label = gtk_label_new ("Images can be transferred via the clipboard, too");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- /* Create the first image */
- image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
- GTK_ICON_SIZE_BUTTON);
- ebox = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (ebox), image);
- gtk_container_add (GTK_CONTAINER (hbox), ebox);
-
- /* make ebox a drag source */
- gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
- gtk_drag_source_add_image_targets (ebox);
- g_signal_connect (ebox, "drag-begin",
- G_CALLBACK (drag_begin), image);
- g_signal_connect (ebox, "drag-data-get",
- G_CALLBACK (drag_data_get), image);
-
- /* accept drops on ebox */
- gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
- NULL, 0, GDK_ACTION_COPY);
- gtk_drag_dest_add_image_targets (ebox);
- g_signal_connect (ebox, "drag-data-received",
- G_CALLBACK (drag_data_received), image);
-
- /* context menu on ebox */
- g_signal_connect (ebox, "button-press-event",
- G_CALLBACK (button_press), image);
-
- /* Create the second image */
- image = gtk_image_new_from_stock (GTK_STOCK_STOP,
- GTK_ICON_SIZE_BUTTON);
- ebox = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (ebox), image);
- gtk_container_add (GTK_CONTAINER (hbox), ebox);
-
- /* make ebox a drag source */
- gtk_drag_source_set (ebox, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
- gtk_drag_source_add_image_targets (ebox);
- g_signal_connect (ebox, "drag-begin",
- G_CALLBACK (drag_begin), image);
- g_signal_connect (ebox, "drag-data-get",
- G_CALLBACK (drag_data_get), image);
-
- /* accept drops on ebox */
- gtk_drag_dest_set (ebox, GTK_DEST_DEFAULT_ALL,
- NULL, 0, GDK_ACTION_COPY);
- gtk_drag_dest_add_image_targets (ebox);
- g_signal_connect (ebox, "drag-data-received",
- G_CALLBACK (drag_data_received), image);
-
- /* context menu on ebox */
- g_signal_connect (ebox, "button-press-event",
- G_CALLBACK (button_press), image);
-
- /* tell the clipboard manager to make the data persistent */
- clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_can_store (clipboard, NULL, 0);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/colorsel.c b/gtk+-mingw/share/gtk-3.0/demo/colorsel.c
deleted file mode 100644
index 73042f9..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/colorsel.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Color Chooser
- *
- * A GtkColorChooser lets the user choose a color. There are several
- * implementations of the GtkColorChooser interface in GTK+. The
- * GtkColorChooserDialog is a prebuilt dialog containing a
- * GtkColorChooserWidget.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-static GtkWidget *da;
-static GdkRGBA color;
-static GtkWidget *frame;
-
-/* draw callback for the drawing area
- */
-static gboolean
-draw_callback (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- GtkStyleContext *context;
- GdkRGBA rgba;
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
- gdk_cairo_set_source_rgba (cr, &rgba);
- cairo_paint (cr);
-
- return TRUE;
-}
-
-static void
-response_cb (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- if (response_id == GTK_RESPONSE_OK)
- {
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
- gtk_widget_override_background_color (da, 0, &color);
- }
-
- gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-static void
-change_color_callback (GtkWidget *button,
- gpointer data)
-{
- GtkWidget *dialog;
-
- dialog = gtk_color_chooser_dialog_new ("Changing color", GTK_WINDOW (window));
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
-
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (response_cb),
- NULL);
-
- gtk_widget_show_all (dialog);
-}
-
-GtkWidget *
-do_colorsel (GtkWidget *do_widget)
-{
- GtkWidget *vbox;
- GtkWidget *button;
-
- if (!window)
- {
- color.red = 0;
- color.blue = 1;
- color.green = 0;
- color.alpha = 1;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Color Chooser");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /*
- * Create the color swatch area
- */
-
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- da = gtk_drawing_area_new ();
-
- g_signal_connect (da, "draw", G_CALLBACK (draw_callback), NULL);
-
- /* set a minimum size */
- gtk_widget_set_size_request (da, 200, 200);
- /* set the color */
- gtk_widget_override_background_color (da, 0, &color);
-
- gtk_container_add (GTK_CONTAINER (frame), da);
-
- button = gtk_button_new_with_mnemonic ("_Change the above color");
- gtk_widget_set_halign (button, GTK_ALIGN_END);
- gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
-
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (change_color_callback), NULL);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/combobox.c b/gtk+-mingw/share/gtk-3.0/demo/combobox.c
deleted file mode 100644
index 354fcab..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/combobox.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* Combo boxes
- *
- * The ComboBox widget allows to select one option out of a list.
- * The ComboBoxEntry additionally allows the user to enter a value
- * that is not in the list of options.
- *
- * How the options are displayed is controlled by cell renderers.
- */
-
-#include <gtk/gtk.h>
-
-enum
-{
- PIXBUF_COL,
- TEXT_COL
-};
-
-static gchar *
-strip_underscore (const gchar *text)
-{
- gchar *p, *q;
- gchar *result;
-
- result = g_strdup (text);
- p = q = result;
- while (*p)
- {
- if (*p != '_')
- {
- *q = *p;
- q++;
- }
- p++;
- }
- *q = '\0';
-
- return result;
-}
-
-static GtkTreeModel *
-create_stock_icon_store (void)
-{
- gchar *stock_id[6] = {
- GTK_STOCK_DIALOG_WARNING,
- GTK_STOCK_STOP,
- GTK_STOCK_NEW,
- GTK_STOCK_CLEAR,
- NULL,
- GTK_STOCK_OPEN
- };
-
- GtkStockItem item;
- GdkPixbuf *pixbuf;
- GtkWidget *cellview;
- GtkTreeIter iter;
- GtkListStore *store;
- gchar *label;
- gint i;
-
- cellview = gtk_cell_view_new ();
-
- store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
-
- for (i = 0; i < G_N_ELEMENTS (stock_id); i++)
- {
- if (stock_id[i])
- {
- pixbuf = gtk_widget_render_icon_pixbuf (cellview, stock_id[i],
- GTK_ICON_SIZE_BUTTON);
- gtk_stock_lookup (stock_id[i], &item);
- label = strip_underscore (item.label);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- PIXBUF_COL, pixbuf,
- TEXT_COL, label,
- -1);
- g_object_unref (pixbuf);
- g_free (label);
- }
- else
- {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- PIXBUF_COL, NULL,
- TEXT_COL, "separator",
- -1);
- }
- }
-
- gtk_widget_destroy (cellview);
-
- return GTK_TREE_MODEL (store);
-}
-
-/* A GtkCellLayoutDataFunc that demonstrates how one can control
- * sensitivity of rows. This particular function does nothing
- * useful and just makes the second row insensitive.
- */
-static void
-set_sensitive (GtkCellLayout *cell_layout,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- GtkTreePath *path;
- gint *indices;
- gboolean sensitive;
-
- path = gtk_tree_model_get_path (tree_model, iter);
- indices = gtk_tree_path_get_indices (path);
- sensitive = indices[0] != 1;
- gtk_tree_path_free (path);
-
- g_object_set (cell, "sensitive", sensitive, NULL);
-}
-
-/* A GtkTreeViewRowSeparatorFunc that demonstrates how rows can be
- * rendered as separators. This particular function does nothing
- * useful and just turns the fourth row into a separator.
- */
-static gboolean
-is_separator (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- GtkTreePath *path;
- gboolean result;
-
- path = gtk_tree_model_get_path (model, iter);
- result = gtk_tree_path_get_indices (path)[0] == 4;
- gtk_tree_path_free (path);
-
- return result;
-}
-
-static GtkTreeModel *
-create_capital_store (void)
-{
- struct {
- gchar *group;
- gchar *capital;
- } capitals[] = {
- { "A - B", NULL },
- { NULL, "Albany" },
- { NULL, "Annapolis" },
- { NULL, "Atlanta" },
- { NULL, "Augusta" },
- { NULL, "Austin" },
- { NULL, "Baton Rouge" },
- { NULL, "Bismarck" },
- { NULL, "Boise" },
- { NULL, "Boston" },
- { "C - D", NULL },
- { NULL, "Carson City" },
- { NULL, "Charleston" },
- { NULL, "Cheyenne" },
- { NULL, "Columbia" },
- { NULL, "Columbus" },
- { NULL, "Concord" },
- { NULL, "Denver" },
- { NULL, "Des Moines" },
- { NULL, "Dover" },
- { "E - J", NULL },
- { NULL, "Frankfort" },
- { NULL, "Harrisburg" },
- { NULL, "Hartford" },
- { NULL, "Helena" },
- { NULL, "Honolulu" },
- { NULL, "Indianapolis" },
- { NULL, "Jackson" },
- { NULL, "Jefferson City" },
- { NULL, "Juneau" },
- { "K - O" },
- { NULL, "Lansing" },
- { NULL, "Lincoln" },
- { NULL, "Little Rock" },
- { NULL, "Madison" },
- { NULL, "Montgomery" },
- { NULL, "Montpelier" },
- { NULL, "Nashville" },
- { NULL, "Oklahoma City" },
- { NULL, "Olympia" },
- { NULL, "P - S" },
- { NULL, "Phoenix" },
- { NULL, "Pierre" },
- { NULL, "Providence" },
- { NULL, "Raleigh" },
- { NULL, "Richmond" },
- { NULL, "Sacramento" },
- { NULL, "Salem" },
- { NULL, "Salt Lake City" },
- { NULL, "Santa Fe" },
- { NULL, "Springfield" },
- { NULL, "St. Paul" },
- { "T - Z", NULL },
- { NULL, "Tallahassee" },
- { NULL, "Topeka" },
- { NULL, "Trenton" },
- { NULL, NULL }
- };
-
- GtkTreeIter iter, iter2;
- GtkTreeStore *store;
- gint i;
-
- store = gtk_tree_store_new (1, G_TYPE_STRING);
-
- for (i = 0; capitals[i].group || capitals[i].capital; i++)
- {
- if (capitals[i].group)
- {
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter, 0, capitals[i].group, -1);
- }
- else if (capitals[i].capital)
- {
- gtk_tree_store_append (store, &iter2, &iter);
- gtk_tree_store_set (store, &iter2, 0, capitals[i].capital, -1);
- }
- }
-
- return GTK_TREE_MODEL (store);
-}
-
-static void
-is_capital_sensitive (GtkCellLayout *cell_layout,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- gboolean sensitive;
-
- sensitive = !gtk_tree_model_iter_has_child (tree_model, iter);
-
- g_object_set (cell, "sensitive", sensitive, NULL);
-}
-
-static void
-fill_combo_entry (GtkWidget *combo)
-{
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "One");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Two");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "2\302\275");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Three");
-}
-
-
-/* A simple validating entry */
-
-#define TYPE_MASK_ENTRY (mask_entry_get_type ())
-#define MASK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MASK_ENTRY, MaskEntry))
-#define MASK_ENTRY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TYPE_MASK_ENTRY, MaskEntryClass))
-#define IS_MASK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MASK_ENTRY))
-#define IS_MASK_ENTRY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TYPE_MASK_ENTRY))
-#define MASK_ENTRY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TYPE_MASK_ENTRY, MaskEntryClass))
-
-
-typedef struct _MaskEntry MaskEntry;
-struct _MaskEntry
-{
- GtkEntry entry;
- gchar *mask;
-};
-
-typedef struct _MaskEntryClass MaskEntryClass;
-struct _MaskEntryClass
-{
- GtkEntryClass parent_class;
-};
-
-
-static void mask_entry_editable_init (GtkEditableInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
- mask_entry_editable_init));
-
-
-static void
-mask_entry_set_background (MaskEntry *entry)
-{
- static const GdkRGBA error_color = { 1.0, 0.9, 0.9, 1.0 };
-
- if (entry->mask)
- {
- if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
- {
- gtk_widget_override_color (GTK_WIDGET (entry), 0, &error_color);
- return;
- }
- }
-
- gtk_widget_override_color (GTK_WIDGET (entry), 0, NULL);
-}
-
-
-static void
-mask_entry_changed (GtkEditable *editable)
-{
- mask_entry_set_background (MASK_ENTRY (editable));
-}
-
-
-static void
-mask_entry_init (MaskEntry *entry)
-{
- entry->mask = NULL;
-}
-
-
-static void
-mask_entry_class_init (MaskEntryClass *klass)
-{ }
-
-
-static void
-mask_entry_editable_init (GtkEditableInterface *iface)
-{
- iface->changed = mask_entry_changed;
-}
-
-
-GtkWidget *
-do_combobox (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *vbox, *frame, *box, *combo, *entry;
- GtkTreeModel *model;
- GtkCellRenderer *renderer;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Combo boxes");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /* A combobox demonstrating cell renderers, separators and
- * insensitive rows
- */
- frame = gtk_frame_new ("Some stock icons");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (box), 5);
- gtk_container_add (GTK_CONTAINER (frame), box);
-
- model = create_stock_icon_store ();
- combo = gtk_combo_box_new_with_model (model);
- g_object_unref (model);
- gtk_container_add (GTK_CONTAINER (box), combo);
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
- "pixbuf", PIXBUF_COL,
- NULL);
-
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
- renderer,
- set_sensitive,
- NULL, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
- "text", TEXT_COL,
- NULL);
-
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
- renderer,
- set_sensitive,
- NULL, NULL);
-
- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
- is_separator, NULL, NULL);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
-
- /* A combobox demonstrating trees.
- */
- frame = gtk_frame_new ("Where are we ?");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (box), 5);
- gtk_container_add (GTK_CONTAINER (frame), box);
-
- model = create_capital_store ();
- combo = gtk_combo_box_new_with_model (model);
- g_object_unref (model);
- gtk_container_add (GTK_CONTAINER (box), combo);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
- "text", 0,
- NULL);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
- renderer,
- is_capital_sensitive,
- NULL, NULL);
-
- path = gtk_tree_path_new_from_indices (0, 8, -1);
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter);
-
- /* A GtkComboBoxEntry with validation.
- */
- frame = gtk_frame_new ("Editable");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (box), 5);
- gtk_container_add (GTK_CONTAINER (frame), box);
-
- combo = gtk_combo_box_text_new_with_entry ();
- fill_combo_entry (combo);
- gtk_container_add (GTK_CONTAINER (box), combo);
-
- entry = g_object_new (TYPE_MASK_ENTRY, NULL);
- MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
-
- gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
- gtk_container_add (GTK_CONTAINER (combo), entry);
-
- /* A combobox with string IDs */
- frame = gtk_frame_new ("String IDs");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (box), 5);
- gtk_container_add (GTK_CONTAINER (frame), box);
-
- combo = gtk_combo_box_text_new ();
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active");
- gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible");
- gtk_container_add (GTK_CONTAINER (box), combo);
-
- entry = gtk_entry_new ();
- g_object_bind_property (combo, "active-id",
- entry, "text",
- G_BINDING_BIDIRECTIONAL);
- gtk_container_add (GTK_CONTAINER (box), entry);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_accordion.c b/gtk+-mingw/share/gtk-3.0/demo/css_accordion.c
deleted file mode 100644
index 57a35b6..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_accordion.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* CSS Theming/CSS Accordion :: css_accordion.css
- *
- * A simple accordion demo written using CSS transitions and multiple backgrounds
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
-{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
-}
-
-GtkWidget *
-do_css_accordion (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *container, *child;
- GtkStyleProvider *provider;
- GBytes *bytes;
- gsize data_size;
- const guint8 *data;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
- gtk_container_add (GTK_CONTAINER (window), container);
-
- child = gtk_button_new_with_label ("This");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new_with_label ("Is");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new_with_label ("A");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new_with_label ("CSS");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new_with_label ("Accordion");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new_with_label (":-)");
- gtk_container_add (GTK_CONTAINER (container), child);
-
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
- bytes = g_resources_lookup_data ("/css_accordion/gtk.css", 0, NULL);
- data = g_bytes_get_data (bytes, &data_size);
-
- gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), (gchar *)data, data_size, NULL);
-
- apply_css (window, provider);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_accordion.css b/gtk+-mingw/share/gtk-3.0/demo/css_accordion.css
deleted file mode 100644
index ffca895..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_accordion.css
+++ /dev/null
@@ -1,52 +0,0 @@
-@import url("reset.css");
-
-* {
- transition-property: color, background-color, border-color, background-image, padding, border-width;
- transition-duration: 1s;
-
- font: Cantarell 20px;
-}
-
-GtkWindow {
- background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
- linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
- linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
- linear-gradient(333deg, #222, #222 5px, transparent 5px) 10px 10px,
- linear-gradient(90deg, #1b1b1b, #1b1b1b 10px, transparent 10px),
- linear-gradient(#1d1d1d, #1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
- background-color: #131313;
- background-size: 20px 20px;
-}
-
-.button {
- color: black;
- background-color: #bbb;
- border-style: solid;
- border-width: 2px 0 2px 2px;
- border-color: #333;
-
- padding: 12px 4px;
-}
-
-.button:first-child {
- border-radius: 5px 0 0 5px;
-}
-
-.button:last-child {
- border-radius: 0 5px 5px 0;
- border-width: 2px;
-}
-
-.button:hover {
- padding: 12px 48px;
- background-color: #4870bc;
-}
-
-.button *:hover {
- color: white;
-}
-
-.button:hover:active,
-.button:active {
- background-color: #993401;
-} \ No newline at end of file
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_basics.c b/gtk+-mingw/share/gtk-3.0/demo/css_basics.c
deleted file mode 100644
index b8ee668..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_basics.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* CSS Theming/CSS Basics :: css_basics.css
- *
- * Gtk themes are written using CSS. Every widget is build of multiple items
- * that you can style very similarly to a regular website.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-static void
-show_parsing_error (GtkCssProvider *provider,
- GtkCssSection *section,
- const GError *error,
- GtkTextBuffer *buffer)
-{
- GtkTextIter start, end;
- const char *tag_name;
-
- gtk_text_buffer_get_iter_at_line_index (buffer,
- &start,
- gtk_css_section_get_start_line (section),
- gtk_css_section_get_start_position (section));
- gtk_text_buffer_get_iter_at_line_index (buffer,
- &end,
- gtk_css_section_get_end_line (section),
- gtk_css_section_get_end_position (section));
-
- if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
- tag_name = "warning";
- else
- tag_name = "error";
-
- gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
-}
-
-static void
-css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
-{
- GtkTextIter start, end;
- char *text;
-
- gtk_text_buffer_get_start_iter (buffer, &start);
- gtk_text_buffer_get_end_iter (buffer, &end);
- gtk_text_buffer_remove_all_tags (buffer, &start, &end);
-
- text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1, NULL);
- g_free (text);
-
- gtk_style_context_reset_widgets (gdk_screen_get_default ());
-}
-
-static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
-{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
-}
-
-GtkWidget *
-do_css_basics (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *container, *child;
- GtkStyleProvider *provider;
- GtkTextBuffer *text;
- GBytes *bytes;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- text = gtk_text_buffer_new (NULL);
- gtk_text_buffer_create_tag (text,
- "warning",
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
- gtk_text_buffer_create_tag (text,
- "error",
- "underline", PANGO_UNDERLINE_ERROR,
- NULL);
-
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
-
- container = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (window), container);
- child = gtk_text_view_new_with_buffer (text);
- gtk_container_add (GTK_CONTAINER (container), child);
- g_signal_connect (text,
- "changed",
- G_CALLBACK (css_text_changed),
- provider);
-
- bytes = g_resources_lookup_data ("/css_basics/gtk.css", 0, NULL);
- gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
-
- g_signal_connect (provider,
- "parsing-error",
- G_CALLBACK (show_parsing_error),
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
-
- apply_css (window, provider);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_basics.css b/gtk+-mingw/share/gtk-3.0/demo/css_basics.css
deleted file mode 100644
index bd6a694..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_basics.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/* You can edit the text in this window to change the
- * appearance of this Window.
- * Be careful, if you screw it up, nothing might be visible
- * anymore. :)
- */
-
-/* This CSS resets all properties to their defaults values
- * and overrides all user settings and the theme in use */
-@import url("reset.css");
-
-/* Set a very futuristic style by default */
-* {
- color: green;
- font-family: Monospace;
- border: 1px solid;
-}
-
-/* Make sure selections are visible */
-:selected {
- background-color: darkGreen;
- color: black;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.c b/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.c
deleted file mode 100644
index e05961f..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* CSS Theming/Multiple Backgrounds :: css_multiplebgs.css cssview.css
- *
- * Gtk themes are written using CSS. Every widget is build of multiple items
- * that you can style very similarly to a regular website.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-static void
-show_parsing_error (GtkCssProvider *provider,
- GtkCssSection *section,
- const GError *error,
- GtkTextBuffer *buffer)
-{
- GtkTextIter start, end;
- const char *tag_name;
-
- gtk_text_buffer_get_iter_at_line_index (buffer,
- &start,
- gtk_css_section_get_start_line (section),
- gtk_css_section_get_start_position (section));
- gtk_text_buffer_get_iter_at_line_index (buffer,
- &end,
- gtk_css_section_get_end_line (section),
- gtk_css_section_get_end_position (section));
-
- if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
- tag_name = "warning";
- else
- tag_name = "error";
-
- gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
-}
-
-static void
-css_text_changed (GtkTextBuffer *buffer,
- GtkCssProvider *provider)
-{
- GtkTextIter start, end;
- char *text;
-
- gtk_text_buffer_get_start_iter (buffer, &start);
- gtk_text_buffer_get_end_iter (buffer, &end);
- gtk_text_buffer_remove_all_tags (buffer, &start, &end);
-
- text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
- gtk_css_provider_load_from_data (provider, text, -1, NULL);
- g_free (text);
-
- gtk_style_context_reset_widgets (gdk_screen_get_default ());
-}
-
-static gboolean
-drawing_area_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkStyleContext *context = gtk_widget_get_style_context (widget);
-
- gtk_render_background (context, cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
- gtk_render_frame (context, cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
-
- return FALSE;
-}
-
-static void
-apply_css (GtkWidget *widget, GtkStyleProvider *provider)
-{
- gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) apply_css, provider);
-}
-
-GtkWidget *
-do_css_multiplebgs (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *paned, *container, *child;
- GtkStyleProvider *provider;
- GtkTextBuffer *text;
- GBytes *bytes;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- container = gtk_overlay_new ();
- gtk_widget_add_events (container,
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_POINTER_MOTION_MASK);
- gtk_container_add (GTK_CONTAINER (window), container);
-
- child = gtk_drawing_area_new ();
- gtk_widget_set_name (child, "canvas");
- g_signal_connect (child, "draw",
- G_CALLBACK (drawing_area_draw), NULL);
- gtk_container_add (GTK_CONTAINER (container), child);
-
- child = gtk_button_new ();
- gtk_widget_add_events (child,
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_POINTER_MOTION_MASK);
- gtk_overlay_add_overlay (GTK_OVERLAY (container), child);
- gtk_widget_set_name (child, "bricks-button");
- gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
- gtk_widget_set_size_request (child, 200, 80);
-
- paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_overlay_add_overlay (GTK_OVERLAY (container), paned);
-
- /* Need a filler so we get a handle */
- child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (paned), child);
-
- text = gtk_text_buffer_new (NULL);
- gtk_text_buffer_create_tag (text,
- "warning",
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
- gtk_text_buffer_create_tag (text,
- "error",
- "underline", PANGO_UNDERLINE_ERROR,
- NULL);
-
- provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
-
- container = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (paned), container);
- child = gtk_text_view_new_with_buffer (text);
- gtk_container_add (GTK_CONTAINER (container), child);
- g_signal_connect (text,
- "changed",
- G_CALLBACK (css_text_changed),
- provider);
-
- bytes = g_resources_lookup_data ("/css_multiplebgs/gtk.css", 0, NULL);
- gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
-
- g_signal_connect (provider,
- "parsing-error",
- G_CALLBACK (show_parsing_error),
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (child)));
-
- apply_css (window, provider);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.css b/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.css
deleted file mode 100644
index f950d32..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/css_multiplebgs.css
+++ /dev/null
@@ -1,136 +0,0 @@
-/* You can edit the text in this window to change the
- * appearance of this Window.
- * Be careful, if you screw it up, nothing might be visible
- * anymore. :)
- */
-
-/* This CSS resets all properties to their defaults values
- * and overrides all user settings and the theme in use */
-@import url("reset.css");
-@import url("cssview.css");
-
-#canvas {
- transition-property: background-color, background-image;
- transition-duration: 0.5s;
-
- background-color: #4870bc;
-}
-
-/* The gradients below are adapted versions of Lea Verou's CSS3 patterns,
- * licensed under the MIT license:
- * Copyright (c) 2011 Lea Verou, http://lea.verou.me/
- *
- * See https://github.com/LeaVerou/CSS3-Patterns-Gallery
- */
-
-/**********
- * Bricks *
- **********/
-/*
-@define-color brick_hi #d42;
-@define-color brick_lo #b42;
-@define-color brick_hi_backdrop #888;
-@define-color brick_lo_backdrop #999;
-
-#canvas {
- background-color: #999;
- background-image: linear-gradient(205deg, @brick_lo, @brick_lo 23px, transparent 23px),
- linear-gradient(25deg, @brick_hi, @brick_hi 23px, transparent 23px),
- linear-gradient(205deg, @brick_lo, @brick_lo 23px, transparent 23px),
- linear-gradient(25deg, @brick_hi, @brick_hi 23px, transparent 23px);
- background-size: 58px 58px;
- background-position: 0px 6px, 4px 31px, 29px 35px, 34px 2px;
-}
-
-#canvas:backdrop {
- background-color: #444;
- background-image: linear-gradient(205deg, @brick_lo_backdrop, @brick_lo_backdrop 23px, transparent 23px),
- linear-gradient(25deg, @brick_hi_backdrop, @brick_hi_backdrop 23px, transparent 23px),
- linear-gradient(205deg, @brick_lo_backdrop, @brick_lo_backdrop 23px, transparent 23px),
- linear-gradient(25deg, @brick_hi_backdrop, @brick_hi_backdrop 23px, transparent 23px);
- background-size: 58px 58px;
- background-position: 0px 6px, 4px 31px, 29px 35px, 34px 2px;
-}
-*/
-
-/*
-#bricks-button {
- background-color: #eef;
- background-image: url('brick.png');
- background-repeat: no-repeat;
- background-position: center;
-}
-
-*/
-/**********
- * Tartan *
- **********/
-/*
-@define-color tartan_bg #662e2c;
-@define-color tartan_bg_backdrop #333;
-
-#canvas {
- background-color: @tartan_bg;
- background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px,
- rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px,
- rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px,
- transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px,
- rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px,
- rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px,
- rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),
- repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px,
- transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px,
- transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px,
- rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px,
- rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px,
- rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),
- repeating-linear-gradient(-55deg, transparent, transparent 1px, rgba(0,0,0,.2) 1px, rgba(0,0,0,.2) 4px,
- transparent 4px, transparent 19px, rgba(0,0,0,.2) 19px,
- rgba(0,0,0,.2) 24px, transparent 24px, transparent 51px, rgba(0,0,0,.2) 51px,
- rgba(0,0,0,.2) 54px, transparent 54px, transparent 74px);
-}
-
-#canvas:backdrop {
- background-color: @tartan_bg_backdrop;
-}
-*/
-
-/***********
- * Stripes *
- ***********/
-
-/*
-@define-color base_bg #4870bc;
-@define-color backdrop_bg #555;
-
-#canvas {
- background-color: @base_bg;
- background-image: linear-gradient(to left, transparent, rgba(255,255,255,.07) 50%, transparent 50%),
- linear-gradient(to left, transparent, rgba(255,255,255,.13) 50%, transparent 50%),
- linear-gradient(to left, transparent, transparent 50%, rgba(255,255,255,.17) 50%),
- linear-gradient(to left, transparent, transparent 50%, rgba(255,255,255,.19) 50%);
- background-size: 29px, 59px, 73px, 109px;
-}
-
-#canvas:backdrop {
- background-color: @backdrop_bg;
-}
-*/
-
-/***************
- * Lined Paper *
- ***************/
-/*
-#canvas {
- background-color: #fff;
- background-image: linear-gradient(90deg, transparent 79px, alpha(#f98195, 0.40) 79px, #f98195 80px, alpha(#f98195, 0.40) 81px, transparent 81px),
- linear-gradient(alpha(#77c5cf, 0.60), alpha(#77c5cf, 0.60) 1px, transparent 1px);
- background-size: 100% 36px;
-}
-
-#canvas:backdrop {
- background-color: #f1f2f4;
- background-image: linear-gradient(90deg, transparent 79px, alpha(#999, 0.40) 79px, #999 80px, alpha(#999, 0.40) 81px, transparent 81px),
- linear-gradient(alpha(#bbb, 0.60), alpha(#bbb, 0.60) 1px, transparent 1px);
-}
-*/ \ No newline at end of file
diff --git a/gtk+-mingw/share/gtk-3.0/demo/cssview.css b/gtk+-mingw/share/gtk-3.0/demo/cssview.css
deleted file mode 100644
index 5060c39..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/cssview.css
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Make the text editor has a nice style */
-.view {
- color: #2e3436;
- font: Monospace;
- background-color: alpha(white, 0.30);
-}
-
-.view:selected {
- color: white;
- background-color: #4a90d9;
-}
-
-.scrollbar.trough,
-.scrollbars-junction {
- background-color: alpha(white, 0.80);
-}
-
-.scrollbar.slider {
- border-width: 3px;
- border-style: solid;
- border-radius: 10px;
- border-color: transparent;
- background-clip: padding-box;
- background-color: #999;
-}
-
-.scrollbar.slider:prelight {
- background-color: #555;
-}
-
-.pane-separator {
- background-color: alpha(white, 0.80);
- background-image: linear-gradient(transparent, transparent 1px, #999 1px, #999 4px, transparent 4px);
- background-size: 40px auto;
- background-repeat: no-repeat;
- background-position: center;
-}
-
-.pane-separator:prelight {
- background-image: linear-gradient(transparent, transparent 1px, #555 1px, #555 4px, transparent 4px);
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/demo.ui b/gtk+-mingw/share/gtk-3.0/demo/demo.ui
deleted file mode 100644
index 0a21789..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/demo.ui
+++ /dev/null
@@ -1,266 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<interface domain="gtk20">
- <object class="GtkListStore" id="liststore1">
- <columns>
- <column type="gchararray"/>
- <column type="gchararray"/>
- <column type="gint"/>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">John</col>
- <col id="1" translatable="yes">Doe</col>
- <col id="2">25</col>
- <col id="3" translatable="yes">This is the John Doe row</col>
- </row>
- <row>
- <col id="0" translatable="yes">Mary</col>
- <col id="1" translatable="yes">Unknown</col>
- <col id="2">50</col>
- <col id="3" translatable="yes">This is the Mary Unknown row</col>
- </row>
- </data>
- </object>
- <object class="GtkUIManager" id="uimanager">
- <child>
- <object class="GtkActionGroup" id="DefaultActions">
- <child>
- <object class="GtkAction" id="Copy">
- <property name="name">Copy</property>
- <property name="tooltip" translatable="yes">Copy selected object into the clipboard</property>
- <property name="stock_id">gtk-copy</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="Cut">
- <property name="name">Cut</property>
- <property name="tooltip" translatable="yes">Cut selected object into the clipboard</property>
- <property name="stock_id">gtk-cut</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="EditMenu">
- <property name="name">EditMenu</property>
- <property name="label" translatable="yes">_Edit</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="FileMenu">
- <property name="name">FileMenu</property>
- <property name="label" translatable="yes">_File</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="New">
- <property name="name">New</property>
- <property name="tooltip" translatable="yes">Create a new file</property>
- <property name="stock_id">gtk-new</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="Open">
- <property name="name">Open</property>
- <property name="tooltip" translatable="yes">Open a file</property>
- <property name="stock_id">gtk-open</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="Paste">
- <property name="name">Paste</property>
- <property name="tooltip" translatable="yes">Paste object from the Clipboard</property>
- <property name="stock_id">gtk-paste</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="Quit">
- <property name="name">Quit</property>
- <property name="tooltip" translatable="yes">Quit the program</property>
- <property name="stock_id">gtk-quit</property>
- <signal handler="quit_activate" name="activate"/>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="Save">
- <property name="name">Save</property>
- <property name="is_important">True</property>
- <property name="tooltip" translatable="yes">Save a file</property>
- <property name="stock_id">gtk-save</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="SaveAs">
- <property name="name">SaveAs</property>
- <property name="tooltip" translatable="yes">Save with a different name</property>
- <property name="stock_id">gtk-save-as</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="HelpMenu">
- <property name="name">HelpMenu</property>
- <property name="label" translatable="yes">_Help</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="About">
- <property name="name">About</property>
- <property name="stock_id">gtk-about</property>
- <signal handler="about_activate" name="activate"/>
- </object>
- <accelerator key="F7"/>
- </child>
- <child>
- <object class="GtkAction" id="Help">
- <property name="name">Help</property>
- <property name="stock_id">gtk-help</property>
- <signal handler="help_activate" name="activate"/>
- </object>
- </child>
- </object>
- </child>
- <ui>
- <menubar name="menubar1">
- <menu action="FileMenu" name="FileMenu">
- <menuitem action="New" name="New"/>
- <menuitem action="Open" name="Open"/>
- <menuitem action="Save" name="Save"/>
- <menuitem action="SaveAs" name="SaveAs"/>
- <separator/>
- <menuitem action="Quit" name="Quit"/>
- </menu>
- <menu action="EditMenu">
- <menuitem action="Copy" name="Copy"/>
- <menuitem action="Cut" name="Cut"/>
- <menuitem action="Paste" name="Paste"/>
- </menu>
- <menu action="HelpMenu" name="HelpMenu">
- <menuitem action="Help" name="Help"/>
- <menuitem action="About" name="About"/>
- </menu>
- </menubar>
- <toolbar name="toolbar1">
- <toolitem action="New" name="New"/>
- <toolitem action="Open" name="Open"/>
- <toolitem action="Save" name="Save"/>
- <separator/>
- <toolitem action="Copy" name="Copy"/>
- <toolitem action="Cut" name="Cut"/>
- <toolitem action="Paste" name="Paste"/>
- </toolbar>
- </ui>
- </object>
- <object class="GtkAboutDialog" id="aboutdialog1">
- <property name="program-name" translatable="yes">GtkBuilder demo</property>
- <accessibility>
- <relation target="window1" type="subwindow-of"/>
- </accessibility>
- </object>
- <object class="GtkWindow" id="window1">
- <property name="default_height">250</property>
- <property name="default_width">440</property>
- <property name="title">GtkBuilder demo</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <child>
- <object constructor="uimanager" class="GtkMenuBar" id="menubar1">
- <property name="visible">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-menubar">
- <property name="AtkObject::accessible-name">The menubar</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object constructor="uimanager" class="GtkToolbar" id="toolbar1">
- <property name="visible">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-toolbar">
- <property name="AtkObject::accessible-name">The toolbar</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="hscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <property name="visible">True</property>
- <property name="vscrollbar_policy">automatic</property>
- <child>
- <object class="GtkTreeView" id="treeview1">
- <property name="visible">True</property>
- <property name="model">liststore1</property>
- <property name="tooltip-column">3</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-treeview">
- <property name="AtkObject::accessible-name">Name list</property>
- <property name="AtkObject::accessible-description">
- A list of person with name, surname and age columns
- </property>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="column1">
- <property name="title">Name</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="column2">
- <property name="title">Surname</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="column3">
- <property name="title">Age</property>
- <child>
- <object class="GtkCellRendererText" id="renderer3"/>
- <attributes>
- <attribute name="text">2</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
- </child>
- <accessibility>
- <action action_name="move-cursor" description="Move the cursor to select another person."/>
- </accessibility>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkStatusbar" id="statusbar1">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/gtk+-mingw/share/gtk-3.0/demo/dialog.c b/gtk+-mingw/share/gtk-3.0/demo/dialog.c
deleted file mode 100644
index d9bc98d..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/dialog.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Dialog and Message Boxes
- *
- * Dialog widgets are used to pop up a transient window for user feedback.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-static GtkWidget *entry1 = NULL;
-static GtkWidget *entry2 = NULL;
-
-static void
-message_dialog_clicked (GtkButton *button,
- gpointer user_data)
-{
- GtkWidget *dialog;
- static gint i = 1;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- "This message box has been popped up the following\n"
- "number of times:");
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- "%d", i);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- i++;
-}
-
-static void
-interactive_dialog_clicked (GtkButton *button,
- gpointer user_data)
-{
- GtkWidget *content_area;
- GtkWidget *dialog;
- GtkWidget *hbox;
- GtkWidget *stock;
- GtkWidget *table;
- GtkWidget *local_entry1;
- GtkWidget *local_entry2;
- GtkWidget *label;
- gint response;
-
- dialog = gtk_dialog_new_with_buttons ("Interactive Dialog",
- GTK_WINDOW (window),
- GTK_DIALOG_MODAL| GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
- GTK_RESPONSE_OK,
- "_Non-stock Button",
- GTK_RESPONSE_CANCEL,
- NULL);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
- gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
-
- stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
- gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0);
-
- table = gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID (table), 4);
- gtk_grid_set_column_spacing (GTK_GRID (table), 4);
- gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
- label = gtk_label_new_with_mnemonic ("_Entry 1");
- gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
- local_entry1 = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
- gtk_grid_attach (GTK_GRID (table), local_entry1, 1, 0, 1, 1);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry1);
-
- label = gtk_label_new_with_mnemonic ("E_ntry 2");
- gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
-
- local_entry2 = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
- gtk_grid_attach (GTK_GRID (table), local_entry2, 1, 1, 1, 1);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
-
- gtk_widget_show_all (hbox);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- if (response == GTK_RESPONSE_OK)
- {
- gtk_entry_set_text (GTK_ENTRY (entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1)));
- gtk_entry_set_text (GTK_ENTRY (entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2)));
- }
-
- gtk_widget_destroy (dialog);
-}
-
-GtkWidget *
-do_dialog (GtkWidget *do_widget)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *vbox2;
- GtkWidget *hbox;
- GtkWidget *button;
- GtkWidget *table;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
-
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- frame = gtk_frame_new ("Dialogs");
- gtk_container_add (GTK_CONTAINER (window), frame);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- /* Standard message dialog */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- button = gtk_button_new_with_mnemonic ("_Message Dialog");
- g_signal_connect (button, "clicked",
- G_CALLBACK (message_dialog_clicked), NULL);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
- FALSE, FALSE, 0);
-
- /* Interactive dialog*/
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- button = gtk_button_new_with_mnemonic ("_Interactive Dialog");
- g_signal_connect (button, "clicked",
- G_CALLBACK (interactive_dialog_clicked), NULL);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
-
- table = gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID (table), 4);
- gtk_grid_set_column_spacing (GTK_GRID (table), 4);
- gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
-
- label = gtk_label_new_with_mnemonic ("_Entry 1");
- gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
-
- entry1 = gtk_entry_new ();
- gtk_grid_attach (GTK_GRID (table), entry1, 1, 0, 1, 1);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry1);
-
- label = gtk_label_new_with_mnemonic ("E_ntry 2");
- gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
-
- entry2 = gtk_entry_new ();
- gtk_grid_attach (GTK_GRID (table), entry2, 1, 1, 1, 1);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/drawingarea.c b/gtk+-mingw/share/gtk-3.0/demo/drawingarea.c
deleted file mode 100644
index c7bbcae..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/drawingarea.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* Drawing Area
- *
- * GtkDrawingArea is a blank area where you can draw custom displays
- * of various kinds.
- *
- * This demo has two drawing areas. The checkerboard area shows
- * how you can just draw something; all you have to do is write
- * a signal handler for expose_event, as shown here.
- *
- * The "scribble" area is a bit more advanced, and shows how to handle
- * events such as button presses and mouse motion. Click the mouse
- * and drag in the scribble area to draw squiggles. Resize the window
- * to clear the area.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-/* Pixmap for scribble area, to store current scribbles */
-static cairo_surface_t *surface = NULL;
-
-/* Create a new surface of the appropriate size to store our scribbles */
-static gboolean
-scribble_configure_event (GtkWidget *widget,
- GdkEventConfigure *event,
- gpointer data)
-{
- GtkAllocation allocation;
- cairo_t *cr;
-
- if (surface)
- cairo_surface_destroy (surface);
-
- gtk_widget_get_allocation (widget, &allocation);
- surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
- CAIRO_CONTENT_COLOR,
- allocation.width,
- allocation.height);
-
- /* Initialize the surface to white */
- cr = cairo_create (surface);
-
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_paint (cr);
-
- cairo_destroy (cr);
-
- /* We've handled the configure event, no need for further processing. */
- return TRUE;
-}
-
-/* Redraw the screen from the surface */
-static gboolean
-scribble_draw (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- cairo_set_source_surface (cr, surface, 0, 0);
- cairo_paint (cr);
-
- return FALSE;
-}
-
-/* Draw a rectangle on the screen */
-static void
-draw_brush (GtkWidget *widget,
- gdouble x,
- gdouble y)
-{
- GdkRectangle update_rect;
- cairo_t *cr;
-
- update_rect.x = x - 3;
- update_rect.y = y - 3;
- update_rect.width = 6;
- update_rect.height = 6;
-
- /* Paint to the surface, where we store our state */
- cr = cairo_create (surface);
-
- gdk_cairo_rectangle (cr, &update_rect);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-
- /* Now invalidate the affected region of the drawing area. */
- gdk_window_invalidate_rect (gtk_widget_get_window (widget),
- &update_rect,
- FALSE);
-}
-
-static gboolean
-scribble_button_press_event (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- if (surface == NULL)
- return FALSE; /* paranoia check, in case we haven't gotten a configure event */
-
- if (event->button == GDK_BUTTON_PRIMARY)
- draw_brush (widget, event->x, event->y);
-
- /* We've handled the event, stop processing */
- return TRUE;
-}
-
-static gboolean
-scribble_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event,
- gpointer data)
-{
- int x, y;
- GdkModifierType state;
-
- if (surface == NULL)
- return FALSE; /* paranoia check, in case we haven't gotten a configure event */
-
- /* This call is very important; it requests the next motion event.
- * If you don't call gdk_window_get_pointer() you'll only get
- * a single motion event. The reason is that we specified
- * GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events().
- * If we hadn't specified that, we could just use event->x, event->y
- * as the pointer location. But we'd also get deluged in events.
- * By requesting the next event as we handle the current one,
- * we avoid getting a huge number of events faster than we
- * can cope.
- */
-
- gdk_window_get_device_position (event->window, event->device, &x, &y, &state);
-
- if (state & GDK_BUTTON1_MASK)
- draw_brush (widget, x, y);
-
- /* We've handled it, stop processing */
- return TRUE;
-}
-
-
-static gboolean
-checkerboard_draw (GtkWidget *da,
- cairo_t *cr,
- gpointer data)
-{
- gint i, j, xcount, ycount, width, height;
-
-#define CHECK_SIZE 10
-#define SPACING 2
-
- /* At the start of a draw handler, a clip region has been set on
- * the Cairo context, and the contents have been cleared to the
- * widget's background color. The docs for
- * gdk_window_begin_paint_region() give more details on how this
- * works.
- */
-
- xcount = 0;
- width = gtk_widget_get_allocated_width (da);
- height = gtk_widget_get_allocated_height (da);
- i = SPACING;
- while (i < width)
- {
- j = SPACING;
- ycount = xcount % 2; /* start with even/odd depending on row */
- while (j < height)
- {
- if (ycount % 2)
- cairo_set_source_rgb (cr, 0.45777, 0, 0.45777);
- else
- cairo_set_source_rgb (cr, 1, 1, 1);
-
- /* If we're outside the clip, this will do nothing.
- */
- cairo_rectangle (cr, i, j, CHECK_SIZE, CHECK_SIZE);
- cairo_fill (cr);
-
- j += CHECK_SIZE + SPACING;
- ++ycount;
- }
-
- i += CHECK_SIZE + SPACING;
- ++xcount;
- }
-
- /* return TRUE because we've handled this event, so no
- * further processing is required.
- */
- return TRUE;
-}
-
-static void
-close_window (void)
-{
- window = NULL;
-
- if (surface)
- cairo_surface_destroy (surface);
- surface = NULL;
-}
-
-GtkWidget *
-do_drawingarea (GtkWidget *do_widget)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *da;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
-
- g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /*
- * Create the checkerboard area
- */
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Checkerboard pattern</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- da = gtk_drawing_area_new ();
- /* set a minimum size */
- gtk_widget_set_size_request (da, 100, 100);
-
- gtk_container_add (GTK_CONTAINER (frame), da);
-
- g_signal_connect (da, "draw",
- G_CALLBACK (checkerboard_draw), NULL);
-
- /*
- * Create the scribble area
- */
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Scribble area</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- da = gtk_drawing_area_new ();
- /* set a minimum size */
- gtk_widget_set_size_request (da, 100, 100);
-
- gtk_container_add (GTK_CONTAINER (frame), da);
-
- /* Signals used to handle backing surface */
-
- g_signal_connect (da, "draw",
- G_CALLBACK (scribble_draw), NULL);
- g_signal_connect (da,"configure-event",
- G_CALLBACK (scribble_configure_event), NULL);
-
- /* Event signals */
-
- g_signal_connect (da, "motion-notify-event",
- G_CALLBACK (scribble_motion_notify_event), NULL);
- g_signal_connect (da, "button-press-event",
- G_CALLBACK (scribble_button_press_event), NULL);
-
-
- /* Ask to receive events the drawing area doesn't normally
- * subscribe to
- */
- gtk_widget_set_events (da, gtk_widget_get_events (da)
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
-
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/editable_cells.c b/gtk+-mingw/share/gtk-3.0/demo/editable_cells.c
deleted file mode 100644
index debdb8e..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/editable_cells.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* Tree View/Editable Cells
- *
- * This demo demonstrates the use of editable cells in a GtkTreeView. If
- * you're new to the GtkTreeView widgets and associates, look into
- * the GtkListStore example first. It also shows how to use the
- * GtkCellRenderer::editing-started signal to do custom setup of the
- * editable widget.
- *
- * The cell renderers used in this demo are GtkCellRendererText,
- * GtkCellRendererCombo and GtkCellRendererProgress.
- */
-
-#include <gtk/gtk.h>
-#include <string.h>
-#include <stdlib.h>
-
-static GtkWidget *window = NULL;
-
-typedef struct
-{
- gint number;
- gchar *product;
- gint yummy;
-}
-Item;
-
-enum
-{
- COLUMN_ITEM_NUMBER,
- COLUMN_ITEM_PRODUCT,
- COLUMN_ITEM_YUMMY,
- NUM_ITEM_COLUMNS
-};
-
-enum
-{
- COLUMN_NUMBER_TEXT,
- NUM_NUMBER_COLUMNS
-};
-
-static GArray *articles = NULL;
-
-static void
-add_items (void)
-{
- Item foo;
-
- g_return_if_fail (articles != NULL);
-
- foo.number = 3;
- foo.product = g_strdup ("bottles of coke");
- foo.yummy = 20;
- g_array_append_vals (articles, &foo, 1);
-
- foo.number = 5;
- foo.product = g_strdup ("packages of noodles");
- foo.yummy = 50;
- g_array_append_vals (articles, &foo, 1);
-
- foo.number = 2;
- foo.product = g_strdup ("packages of chocolate chip cookies");
- foo.yummy = 90;
- g_array_append_vals (articles, &foo, 1);
-
- foo.number = 1;
- foo.product = g_strdup ("can vanilla ice cream");
- foo.yummy = 60;
- g_array_append_vals (articles, &foo, 1);
-
- foo.number = 6;
- foo.product = g_strdup ("eggs");
- foo.yummy = 10;
- g_array_append_vals (articles, &foo, 1);
-}
-
-static GtkTreeModel *
-create_items_model (void)
-{
- gint i = 0;
- GtkListStore *model;
- GtkTreeIter iter;
-
- /* create array */
- articles = g_array_sized_new (FALSE, FALSE, sizeof (Item), 1);
-
- add_items ();
-
- /* create list store */
- model = gtk_list_store_new (NUM_ITEM_COLUMNS, G_TYPE_INT, G_TYPE_STRING,
- G_TYPE_INT, G_TYPE_BOOLEAN);
-
- /* add items */
- for (i = 0; i < articles->len; i++)
- {
- gtk_list_store_append (model, &iter);
-
- gtk_list_store_set (model, &iter,
- COLUMN_ITEM_NUMBER,
- g_array_index (articles, Item, i).number,
- COLUMN_ITEM_PRODUCT,
- g_array_index (articles, Item, i).product,
- COLUMN_ITEM_YUMMY,
- g_array_index (articles, Item, i).yummy,
- -1);
- }
-
- return GTK_TREE_MODEL (model);
-}
-
-static GtkTreeModel *
-create_numbers_model (void)
-{
-#define N_NUMBERS 10
- gint i = 0;
- GtkListStore *model;
- GtkTreeIter iter;
-
- /* create list store */
- model = gtk_list_store_new (NUM_NUMBER_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
-
- /* add numbers */
- for (i = 0; i < N_NUMBERS; i++)
- {
- char str[2];
-
- str[0] = '0' + i;
- str[1] = '\0';
-
- gtk_list_store_append (model, &iter);
-
- gtk_list_store_set (model, &iter,
- COLUMN_NUMBER_TEXT, str,
- -1);
- }
-
- return GTK_TREE_MODEL (model);
-
-#undef N_NUMBERS
-}
-
-static void
-add_item (GtkWidget *button, gpointer data)
-{
- Item foo;
- GtkTreeIter iter;
- GtkTreeModel *model = (GtkTreeModel *)data;
-
- g_return_if_fail (articles != NULL);
-
- foo.number = 0;
- foo.product = g_strdup ("Description here");
- foo.yummy = 50;
- g_array_append_vals (articles, &foo, 1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- COLUMN_ITEM_NUMBER, foo.number,
- COLUMN_ITEM_PRODUCT, foo.product,
- COLUMN_ITEM_YUMMY, foo.yummy,
- -1);
-}
-
-static void
-remove_item (GtkWidget *widget, gpointer data)
-{
- GtkTreeIter iter;
- GtkTreeView *treeview = (GtkTreeView *)data;
- GtkTreeModel *model = gtk_tree_view_get_model (treeview);
- GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
-
- if (gtk_tree_selection_get_selected (selection, NULL, &iter))
- {
- gint i;
- GtkTreePath *path;
-
- path = gtk_tree_model_get_path (model, &iter);
- i = gtk_tree_path_get_indices (path)[0];
- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-
- g_array_remove_index (articles, i);
-
- gtk_tree_path_free (path);
- }
-}
-
-static gboolean
-separator_row (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- GtkTreePath *path;
- gint idx;
-
- path = gtk_tree_model_get_path (model, iter);
- idx = gtk_tree_path_get_indices (path)[0];
-
- gtk_tree_path_free (path);
-
- return idx == 5;
-}
-
-static void
-editing_started (GtkCellRenderer *cell,
- GtkCellEditable *editable,
- const gchar *path,
- gpointer data)
-{
- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
- separator_row, NULL, NULL);
-}
-
-static void
-cell_edited (GtkCellRendererText *cell,
- const gchar *path_string,
- const gchar *new_text,
- gpointer data)
-{
- GtkTreeModel *model = (GtkTreeModel *)data;
- GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
- GtkTreeIter iter;
-
- gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
-
- gtk_tree_model_get_iter (model, &iter, path);
-
- switch (column)
- {
- case COLUMN_ITEM_NUMBER:
- {
- gint i;
-
- i = gtk_tree_path_get_indices (path)[0];
- g_array_index (articles, Item, i).number = atoi (new_text);
-
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
- g_array_index (articles, Item, i).number, -1);
- }
- break;
-
- case COLUMN_ITEM_PRODUCT:
- {
- gint i;
- gchar *old_text;
-
- gtk_tree_model_get (model, &iter, column, &old_text, -1);
- g_free (old_text);
-
- i = gtk_tree_path_get_indices (path)[0];
- g_free (g_array_index (articles, Item, i).product);
- g_array_index (articles, Item, i).product = g_strdup (new_text);
-
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
- g_array_index (articles, Item, i).product, -1);
- }
- break;
- }
-
- gtk_tree_path_free (path);
-}
-
-static void
-add_columns (GtkTreeView *treeview,
- GtkTreeModel *items_model,
- GtkTreeModel *numbers_model)
-{
- GtkCellRenderer *renderer;
-
- /* number column */
- renderer = gtk_cell_renderer_combo_new ();
- g_object_set (renderer,
- "model", numbers_model,
- "text-column", COLUMN_NUMBER_TEXT,
- "has-entry", FALSE,
- "editable", TRUE,
- NULL);
- g_signal_connect (renderer, "edited",
- G_CALLBACK (cell_edited), items_model);
- g_signal_connect (renderer, "editing-started",
- G_CALLBACK (editing_started), NULL);
- g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COLUMN_ITEM_NUMBER));
-
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Number", renderer,
- "text", COLUMN_ITEM_NUMBER,
- NULL);
-
- /* product column */
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "editable", TRUE,
- NULL);
- g_signal_connect (renderer, "edited",
- G_CALLBACK (cell_edited), items_model);
- g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COLUMN_ITEM_PRODUCT));
-
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Product", renderer,
- "text", COLUMN_ITEM_PRODUCT,
- NULL);
-
- /* yummy column */
- renderer = gtk_cell_renderer_progress_new ();
- g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (COLUMN_ITEM_YUMMY));
-
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Yummy", renderer,
- "value", COLUMN_ITEM_YUMMY,
- NULL);
-}
-
-GtkWidget *
-do_editable_cells (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *sw;
- GtkWidget *treeview;
- GtkWidget *button;
- GtkTreeModel *items_model;
- GtkTreeModel *numbers_model;
-
- /* create window, etc */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
- gtk_container_set_border_width (GTK_CONTAINER (window), 5);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- gtk_label_new ("Shopping list (you can edit the cells!)"),
- FALSE, FALSE, 0);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_ETCHED_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
-
- /* create models */
- items_model = create_items_model ();
- numbers_model = create_numbers_model ();
-
- /* create tree view */
- treeview = gtk_tree_view_new_with_model (items_model);
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
- GTK_SELECTION_SINGLE);
-
- add_columns (GTK_TREE_VIEW (treeview), items_model, numbers_model);
-
- g_object_unref (numbers_model);
- g_object_unref (items_model);
-
- gtk_container_add (GTK_CONTAINER (sw), treeview);
-
- /* some buttons */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
- gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- button = gtk_button_new_with_label ("Add item");
- g_signal_connect (button, "clicked",
- G_CALLBACK (add_item), items_model);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("Remove item");
- g_signal_connect (button, "clicked",
- G_CALLBACK (remove_item), treeview);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
-
- gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/entry_buffer.c b/gtk+-mingw/share/gtk-3.0/demo/entry_buffer.c
deleted file mode 100644
index 4d7b704..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/entry_buffer.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Entry/Entry Buffer
- *
- * GtkEntryBuffer provides the text content in a GtkEntry.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_entry_buffer (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *entry;
- GtkEntryBuffer *buffer;
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "Entries share a buffer. Typing in one is reflected in the other.");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- /* Create a buffer */
- buffer = gtk_entry_buffer_new (NULL, 0);
-
- /* Create our first entry */
- entry = gtk_entry_new_with_buffer (buffer);
- gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
-
- /* Create the second entry */
- entry = gtk_entry_new_with_buffer (buffer);
- gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
-
- g_object_unref (buffer);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/entry_completion.c b/gtk+-mingw/share/gtk-3.0/demo/entry_completion.c
deleted file mode 100644
index ce218ed..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/entry_completion.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Entry/Entry Completion
- *
- * GtkEntryCompletion provides a mechanism for adding support for
- * completion in GtkEntry.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-/* Creates a tree model containing the completions */
-GtkTreeModel *
-create_completion_model (void)
-{
- GtkListStore *store;
- GtkTreeIter iter;
-
- store = gtk_list_store_new (1, G_TYPE_STRING);
-
- /* Append one word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "GNOME", -1);
-
- /* Append another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "total", -1);
-
- /* And another word */
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, "totally", -1);
-
- return GTK_TREE_MODEL (store);
-}
-
-
-GtkWidget *
-do_entry_completion (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *entry;
- GtkEntryCompletion *completion;
- GtkTreeModel *completion_model;
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- /* Create our entry */
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
-
- /* Create the completion object */
- completion = gtk_entry_completion_new ();
-
- /* Assign the completion to the entry */
- gtk_entry_set_completion (GTK_ENTRY (entry), completion);
- g_object_unref (completion);
-
- /* Create a tree model and use it as the completion model */
- completion_model = create_completion_model ();
- gtk_entry_completion_set_model (completion, completion_model);
- g_object_unref (completion_model);
-
- /* Use model column 0 as the text column */
- gtk_entry_completion_set_text_column (completion, 0);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/expander.c b/gtk+-mingw/share/gtk-3.0/demo/expander.c
deleted file mode 100644
index 423a813..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/expander.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Expander
- *
- * GtkExpander allows to provide additional content that is initially hidden.
- * This is also known as "disclosure triangle".
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-
-GtkWidget *
-do_expander (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *expander;
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("GtkExpander",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- label = gtk_label_new ("Expander demo. Click on the triangle for details.");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- /* Create the expander */
- expander = gtk_expander_new ("Details");
- gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
-
- label = gtk_label_new ("Details can be shown or hidden.");
- gtk_container_add (GTK_CONTAINER (expander), label);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/fancy.css b/gtk+-mingw/share/gtk-3.0/demo/fancy.css
deleted file mode 100644
index a3d2ac3..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/fancy.css
+++ /dev/null
@@ -1,24 +0,0 @@
-GtkButton#fancy {
- font-weight: bold;
- background-image: linear-gradient(135deg, yellow, blue);
- border-radius: 20px;
- color: white;
-}
-
-GtkButton#fancy:hover {
- font-weight: bold;
- background-image: linear-gradient(135deg, blue, yellow);
- border-radius: 20px;
- color: white;
-}
-
-GtkButton#fancy:active {
- font-weight: bold;
- background-image: linear-gradient(yellow, yellow);
- border-radius: 20px;
- color: black;
-}
-
-GtkButton#fancy * {
- color: inherit;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/floppybuddy.gif b/gtk+-mingw/share/gtk-3.0/demo/floppybuddy.gif
deleted file mode 100644
index ac986c8..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/floppybuddy.gif
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-applets.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-applets.png
deleted file mode 100644
index 8d3549e..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-applets.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-calendar.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-calendar.png
deleted file mode 100644
index 889f329..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-calendar.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-foot.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-foot.png
deleted file mode 100644
index 0476658..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-foot.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-directory.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-directory.png
deleted file mode 100644
index 05921a6..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-directory.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-regular.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-regular.png
deleted file mode 100644
index 0f5019c..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-fs-regular.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-gimp.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-gimp.png
deleted file mode 100644
index f6bbc6d..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-gimp.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-gmush.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-gmush.png
deleted file mode 100644
index 0a4b0d0..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-gmush.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnome-gsame.png b/gtk+-mingw/share/gtk-3.0/demo/gnome-gsame.png
deleted file mode 100644
index 01c0611..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnome-gsame.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gnu-keys.png b/gtk+-mingw/share/gtk-3.0/demo/gnu-keys.png
deleted file mode 100644
index 58a3377..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gnu-keys.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-24.png b/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-24.png
deleted file mode 100644
index 54e3ba0..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-24.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-48.png b/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-48.png
deleted file mode 100644
index 5fed8f6..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-48.png
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-rgb.gif b/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-rgb.gif
deleted file mode 100644
index 63c622b..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/gtk-logo-rgb.gif
+++ /dev/null
Binary files differ
diff --git a/gtk+-mingw/share/gtk-3.0/demo/hypertext.c b/gtk+-mingw/share/gtk-3.0/demo/hypertext.c
deleted file mode 100644
index 534a62d..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/hypertext.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Text Widget/Hypertext
- *
- * Usually, tags modify the appearance of text in the view, e.g. making it
- * bold or colored or underlined. But tags are not restricted to appearance.
- * They can also affect the behavior of mouse and key presses, as this demo
- * shows.
- */
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-/* Inserts a piece of text into the buffer, giving it the usual
- * appearance of a hyperlink in a web browser: blue and underlined.
- * Additionally, attaches some data on the tag, to make it recognizable
- * as a link.
- */
-static void
-insert_link (GtkTextBuffer *buffer,
- GtkTextIter *iter,
- gchar *text,
- gint page)
-{
- GtkTextTag *tag;
-
- tag = gtk_text_buffer_create_tag (buffer, NULL,
- "foreground", "blue",
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
- g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));
- gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL);
-}
-
-/* Fills the buffer with text and interspersed links. In any real
- * hypertext app, this method would parse a file to identify the links.
- */
-static void
-show_page (GtkTextBuffer *buffer,
- gint page)
-{
- GtkTextIter iter;
-
- gtk_text_buffer_set_text (buffer, "", 0);
- gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
- if (page == 1)
- {
- gtk_text_buffer_insert (buffer, &iter, "Some text to show that simple ", -1);
- insert_link (buffer, &iter, "hypertext", 3);
- gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
- insert_link (buffer, &iter, "tags", 2);
- gtk_text_buffer_insert (buffer, &iter, ".", -1);
- }
- else if (page == 2)
- {
- gtk_text_buffer_insert (buffer, &iter,
- "A tag is an attribute that can be applied to some range of text. "
- "For example, a tag might be called \"bold\" and make the text inside "
- "the tag bold. However, the tag concept is more general than that; "
- "tags don't have to affect appearance. They can instead affect the "
- "behavior of mouse and key presses, \"lock\" a range of text so the "
- "user can't edit it, or countless other things.\n", -1);
- insert_link (buffer, &iter, "Go back", 1);
- }
- else if (page == 3)
- {
- GtkTextTag *tag;
-
- tag = gtk_text_buffer_create_tag (buffer, NULL,
- "weight", PANGO_WEIGHT_BOLD,
- NULL);
- gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext:\n", -1, tag, NULL);
- gtk_text_buffer_insert (buffer, &iter,
- "machine-readable text that is not sequential but is organized "
- "so that related items of information are connected.\n", -1);
- insert_link (buffer, &iter, "Go back", 1);
- }
-}
-
-/* Looks at all tags covering the position of iter in the text view,
- * and if one of them is a link, follow it by showing the page identified
- * by the data attached to it.
- */
-static void
-follow_if_link (GtkWidget *text_view,
- GtkTextIter *iter)
-{
- GSList *tags = NULL, *tagp = NULL;
-
- tags = gtk_text_iter_get_tags (iter);
- for (tagp = tags; tagp != NULL; tagp = tagp->next)
- {
- GtkTextTag *tag = tagp->data;
- gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
-
- if (page != 0)
- {
- show_page (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)), page);
- break;
- }
- }
-
- if (tags)
- g_slist_free (tags);
-}
-
-/* Links can be activated by pressing Enter.
- */
-static gboolean
-key_press_event (GtkWidget *text_view,
- GdkEventKey *event)
-{
- GtkTextIter iter;
- GtkTextBuffer *buffer;
-
- switch (event->keyval)
- {
- case GDK_KEY_Return:
- case GDK_KEY_KP_Enter:
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
- gtk_text_buffer_get_iter_at_mark (buffer, &iter,
- gtk_text_buffer_get_insert (buffer));
- follow_if_link (text_view, &iter);
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Links can also be activated by clicking.
- */
-static gboolean
-event_after (GtkWidget *text_view,
- GdkEvent *ev)
-{
- GtkTextIter start, end, iter;
- GtkTextBuffer *buffer;
- GdkEventButton *event;
- gint x, y;
-
- if (ev->type != GDK_BUTTON_RELEASE)
- return FALSE;
-
- event = (GdkEventButton *)ev;
-
- if (event->button != GDK_BUTTON_PRIMARY)
- return FALSE;
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
-
- /* we shouldn't follow a link if the user has selected something */
- gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
- if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
- return FALSE;
-
- gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
- GTK_TEXT_WINDOW_WIDGET,
- event->x, event->y, &x, &y);
-
- gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
-
- follow_if_link (text_view, &iter);
-
- return FALSE;
-}
-
-static gboolean hovering_over_link = FALSE;
-static GdkCursor *hand_cursor = NULL;
-static GdkCursor *regular_cursor = NULL;
-
-/* Looks at all tags covering the position (x, y) in the text view,
- * and if one of them is a link, change the cursor to the "hands" cursor
- * typically used by web browsers.
- */
-static void
-set_cursor_if_appropriate (GtkTextView *text_view,
- gint x,
- gint y)
-{
- GSList *tags = NULL, *tagp = NULL;
- GtkTextIter iter;
- gboolean hovering = FALSE;
-
- gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
-
- tags = gtk_text_iter_get_tags (&iter);
- for (tagp = tags; tagp != NULL; tagp = tagp->next)
- {
- GtkTextTag *tag = tagp->data;
- gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
-
- if (page != 0)
- {
- hovering = TRUE;
- break;
- }
- }
-
- if (hovering != hovering_over_link)
- {
- hovering_over_link = hovering;
-
- if (hovering_over_link)
- gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
- else
- gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
- }
-
- if (tags)
- g_slist_free (tags);
-}
-
-/* Update the cursor image if the pointer moved.
- */
-static gboolean
-motion_notify_event (GtkWidget *text_view,
- GdkEventMotion *event)
-{
- gint x, y;
-
- gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
- GTK_TEXT_WINDOW_WIDGET,
- event->x, event->y, &x, &y);
-
- set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
-
- return FALSE;
-}
-
-GtkWidget *
-do_hypertext (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *view;
- GtkWidget *sw;
- GtkTextBuffer *buffer;
-
- hand_cursor = gdk_cursor_new (GDK_HAND2);
- regular_cursor = gdk_cursor_new (GDK_XTERM);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window),
- 450, 450);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- view = gtk_text_view_new ();
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
- g_signal_connect (view, "key-press-event",
- G_CALLBACK (key_press_event), NULL);
- g_signal_connect (view, "event-after",
- G_CALLBACK (event_after), NULL);
- g_signal_connect (view, "motion-notify-event",
- G_CALLBACK (motion_notify_event), NULL);
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (window), sw);
- gtk_container_add (GTK_CONTAINER (sw), view);
-
- show_page (buffer, 1);
-
- gtk_widget_show_all (sw);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/iconview.c b/gtk+-mingw/share/gtk-3.0/demo/iconview.c
deleted file mode 100644
index a94b484..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/iconview.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* Icon View/Icon View Basics
- *
- * The GtkIconView widget is used to display and manipulate icons.
- * It uses a GtkTreeModel for data storage, so the list store
- * example might be helpful.
- */
-
-#include <gtk/gtk.h>
-#include <string.h>
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-
-#define FOLDER_NAME "gnome-fs-directory.png"
-#define FILE_NAME "gnome-fs-regular.png"
-
-enum
-{
- COL_PATH,
- COL_DISPLAY_NAME,
- COL_PIXBUF,
- COL_IS_DIRECTORY,
- NUM_COLS
-};
-
-
-static GdkPixbuf *file_pixbuf, *folder_pixbuf;
-gchar *parent;
-GtkToolItem *up_button;
-
-/* Loads the images for the demo and returns whether the operation succeeded */
-static gboolean
-load_pixbufs (GError **error)
-{
- char *filename;
-
- if (file_pixbuf)
- return TRUE; /* already loaded earlier */
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- filename = demo_find_file (FILE_NAME, error);
- if (!filename)
- return FALSE; /* note that "error" was filled in and returned */
-
- file_pixbuf = gdk_pixbuf_new_from_file (filename, error);
- g_free (filename);
-
- if (!file_pixbuf)
- return FALSE; /* Note that "error" was filled with a GError */
-
- filename = demo_find_file (FOLDER_NAME, error);
- if (!filename)
- return FALSE; /* note that "error" was filled in and returned */
-
- folder_pixbuf = gdk_pixbuf_new_from_file (filename, error);
- g_free (filename);
-
- return TRUE;
-}
-
-static void
-fill_store (GtkListStore *store)
-{
- GDir *dir;
- const gchar *name;
- GtkTreeIter iter;
-
- /* First clear the store */
- gtk_list_store_clear (store);
-
- /* Now go through the directory and extract all the file
- * information */
- dir = g_dir_open (parent, 0, NULL);
- if (!dir)
- return;
-
- name = g_dir_read_name (dir);
- while (name != NULL)
- {
- gchar *path, *display_name;
- gboolean is_dir;
-
- /* We ignore hidden files that start with a '.' */
- if (name[0] != '.')
- {
- path = g_build_filename (parent, name, NULL);
-
- is_dir = g_file_test (path, G_FILE_TEST_IS_DIR);
-
- display_name = g_filename_to_utf8 (name, -1, NULL, NULL, NULL);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_PATH, path,
- COL_DISPLAY_NAME, display_name,
- COL_IS_DIRECTORY, is_dir,
- COL_PIXBUF, is_dir ? folder_pixbuf : file_pixbuf,
- -1);
- g_free (path);
- g_free (display_name);
- }
-
- name = g_dir_read_name (dir);
- }
- g_dir_close (dir);
-}
-
-static gint
-sort_func (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- gboolean is_dir_a, is_dir_b;
- gchar *name_a, *name_b;
- int ret;
-
- /* We need this function because we want to sort
- * folders before files.
- */
-
-
- gtk_tree_model_get (model, a,
- COL_IS_DIRECTORY, &is_dir_a,
- COL_DISPLAY_NAME, &name_a,
- -1);
-
- gtk_tree_model_get (model, b,
- COL_IS_DIRECTORY, &is_dir_b,
- COL_DISPLAY_NAME, &name_b,
- -1);
-
- if (!is_dir_a && is_dir_b)
- ret = 1;
- else if (is_dir_a && !is_dir_b)
- ret = -1;
- else
- {
- ret = g_utf8_collate (name_a, name_b);
- }
-
- g_free (name_a);
- g_free (name_b);
-
- return ret;
-}
-
-static GtkListStore *
-create_store (void)
-{
- GtkListStore *store;
-
- store = gtk_list_store_new (NUM_COLS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- GDK_TYPE_PIXBUF,
- G_TYPE_BOOLEAN);
-
- /* Set sort column and function */
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
- sort_func,
- NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
- GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
- GTK_SORT_ASCENDING);
-
- return store;
-}
-
-static void
-item_activated (GtkIconView *icon_view,
- GtkTreePath *tree_path,
- gpointer user_data)
-{
- GtkListStore *store;
- gchar *path;
- GtkTreeIter iter;
- gboolean is_dir;
-
- store = GTK_LIST_STORE (user_data);
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (store),
- &iter, tree_path);
- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
- COL_PATH, &path,
- COL_IS_DIRECTORY, &is_dir,
- -1);
-
- if (!is_dir)
- {
- g_free (path);
- return;
- }
-
- /* Replace parent with path and re-fill the model*/
- g_free (parent);
- parent = path;
-
- fill_store (store);
-
- /* Sensitize the up button */
- gtk_widget_set_sensitive (GTK_WIDGET (up_button), TRUE);
-}
-
-static void
-up_clicked (GtkToolItem *item,
- gpointer user_data)
-{
- GtkListStore *store;
- gchar *dir_name;
-
- store = GTK_LIST_STORE (user_data);
-
- dir_name = g_path_get_dirname (parent);
- g_free (parent);
-
- parent = dir_name;
-
- fill_store (store);
-
- /* Maybe de-sensitize the up button */
- gtk_widget_set_sensitive (GTK_WIDGET (up_button),
- strcmp (parent, "/") != 0);
-}
-
-static void
-home_clicked (GtkToolItem *item,
- gpointer user_data)
-{
- GtkListStore *store;
-
- store = GTK_LIST_STORE (user_data);
-
- g_free (parent);
- parent = g_strdup (g_get_home_dir ());
-
- fill_store (store);
-
- /* Sensitize the up button */
- gtk_widget_set_sensitive (GTK_WIDGET (up_button),
- TRUE);
-}
-
-static void close_window(void)
-{
- gtk_widget_destroy (window);
- window = NULL;
-
- g_object_unref (file_pixbuf);
- file_pixbuf = NULL;
-
- g_object_unref (folder_pixbuf);
- folder_pixbuf = NULL;
-}
-
-GtkWidget *
-do_iconview (GtkWidget *do_widget)
-{
- if (!window)
- {
- GError *error;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
-
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (close_window), NULL);
-
- error = NULL;
- if (!load_pixbufs (&error))
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Failed to load an image: %s",
- error->message);
-
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
- }
- else
- {
- GtkWidget *sw;
- GtkWidget *icon_view;
- GtkListStore *store;
- GtkWidget *vbox;
- GtkWidget *tool_bar;
- GtkToolItem *home_button;
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- tool_bar = gtk_toolbar_new ();
- gtk_box_pack_start (GTK_BOX (vbox), tool_bar, FALSE, FALSE, 0);
-
- up_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);
- gtk_tool_item_set_is_important (up_button, TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
- gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), up_button, -1);
-
- home_button = gtk_tool_button_new_from_stock (GTK_STOCK_HOME);
- gtk_tool_item_set_is_important (home_button, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), home_button, -1);
-
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_ETCHED_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
-
- /* Create the store and fill it with the contents of '/' */
- parent = g_strdup ("/");
- store = create_store ();
- fill_store (store);
-
- icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
- gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
- GTK_SELECTION_MULTIPLE);
- g_object_unref (store);
-
- /* Connect to the "clicked" signal of the "Up" tool button */
- g_signal_connect (up_button, "clicked",
- G_CALLBACK (up_clicked), store);
-
- /* Connect to the "clicked" signal of the "Home" tool button */
- g_signal_connect (home_button, "clicked",
- G_CALLBACK (home_clicked), store);
-
- /* We now set which model columns that correspond to the text
- * and pixbuf of each item
- */
- gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), COL_DISPLAY_NAME);
- gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);
-
- /* Connect to the "item-activated" signal */
- g_signal_connect (icon_view, "item-activated",
- G_CALLBACK (item_activated), store);
- gtk_container_add (GTK_CONTAINER (sw), icon_view);
-
- gtk_widget_grab_focus (icon_view);
- }
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/iconview_edit.c b/gtk+-mingw/share/gtk-3.0/demo/iconview_edit.c
deleted file mode 100644
index 2e7d4a0..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/iconview_edit.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Icon View/Editing and Drag-and-Drop
- *
- * The GtkIconView widget supports Editing and Drag-and-Drop.
- * This example also demonstrates using the generic GtkCellLayout
- * interface to set up cell renderers in an icon view.
- */
-
-#include <gtk/gtk.h>
-#include <string.h>
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-
-enum
-{
- COL_TEXT,
- NUM_COLS
-};
-
-
-static void
-fill_store (GtkListStore *store)
-{
- GtkTreeIter iter;
- const gchar *text[] = { "Red", "Green", "Blue", "Yellow" };
- gint i;
-
- /* First clear the store */
- gtk_list_store_clear (store);
-
- for (i = 0; i < 4; i++)
- {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, COL_TEXT, text[i], -1);
- }
-}
-
-static GtkListStore *
-create_store (void)
-{
- GtkListStore *store;
-
- store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING);
-
- return store;
-}
-
-static void
-set_cell_color (GtkCellLayout *cell_layout,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- gchar *text;
- GdkColor color;
- guint32 pixel = 0;
- GdkPixbuf *pixbuf;
-
- gtk_tree_model_get (tree_model, iter, COL_TEXT, &text, -1);
- if (gdk_color_parse (text, &color))
- pixel =
- (color.red >> 8) << 24 |
- (color.green >> 8) << 16 |
- (color.blue >> 8) << 8;
-
- g_free (text);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 24, 24);
- gdk_pixbuf_fill (pixbuf, pixel);
-
- g_object_set (cell, "pixbuf", pixbuf, NULL);
-
- g_object_unref (pixbuf);
-}
-
-static void
-edited (GtkCellRendererText *cell,
- gchar *path_string,
- gchar *text,
- gpointer data)
-{
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- model = gtk_icon_view_get_model (GTK_ICON_VIEW (data));
- path = gtk_tree_path_new_from_string (path_string);
-
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- COL_TEXT, text, -1);
-
- gtk_tree_path_free (path);
-}
-
-GtkWidget *
-do_iconview_edit (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *icon_view;
- GtkListStore *store;
- GtkCellRenderer *renderer;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Editing and Drag-and-Drop");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- store = create_store ();
- fill_store (store);
-
- icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
- g_object_unref (store);
-
- gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
- GTK_SELECTION_SINGLE);
- gtk_icon_view_set_item_orientation (GTK_ICON_VIEW (icon_view),
- GTK_ORIENTATION_HORIZONTAL);
- gtk_icon_view_set_columns (GTK_ICON_VIEW (icon_view), 2);
- gtk_icon_view_set_reorderable (GTK_ICON_VIEW (icon_view), TRUE);
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (icon_view),
- renderer, TRUE);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (icon_view),
- renderer,
- set_cell_color,
- NULL, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (icon_view),
- renderer, TRUE);
- g_object_set (renderer, "editable", TRUE, NULL);
- g_signal_connect (renderer, "edited", G_CALLBACK (edited), icon_view);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (icon_view),
- renderer,
- "text", COL_TEXT,
- NULL);
-
- gtk_container_add (GTK_CONTAINER (window), icon_view);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/images.c b/gtk+-mingw/share/gtk-3.0/demo/images.c
deleted file mode 100644
index 2a8fea9..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/images.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* Images
- *
- * GtkImage is used to display an image; the image can be in a number of formats.
- * Typically, you load an image into a GdkPixbuf, then display the pixbuf.
- *
- * This demo code shows some of the more obscure cases, in the simple
- * case a call to gtk_image_new_from_file() is all you need.
- *
- * If you want to put image data in your program as a C variable,
- * use the make-inline-pixbuf program that comes with GTK+.
- * This way you won't need to depend on loading external files, your
- * application binary can be self-contained.
- */
-
-#include <gtk/gtk.h>
-#include <glib/gstdio.h>
-#include <stdio.h>
-#include <errno.h>
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-static GdkPixbufLoader *pixbuf_loader = NULL;
-static guint load_timeout = 0;
-static FILE* image_stream = NULL;
-
-static void
-progressive_prepared_callback (GdkPixbufLoader *loader,
- gpointer data)
-{
- GdkPixbuf *pixbuf;
- GtkWidget *image;
-
- image = GTK_WIDGET (data);
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-
- /* Avoid displaying random memory contents, since the pixbuf
- * isn't filled in yet.
- */
- gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
-
- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
-}
-
-static void
-progressive_updated_callback (GdkPixbufLoader *loader,
- gint x,
- gint y,
- gint width,
- gint height,
- gpointer data)
-{
- GtkWidget *image;
-
- image = GTK_WIDGET (data);
-
- /* We know the pixbuf inside the GtkImage has changed, but the image
- * itself doesn't know this; so queue a redraw. If we wanted to be
- * really efficient, we could use a drawing area or something
- * instead of a GtkImage, so we could control the exact position of
- * the pixbuf on the display, then we could queue a draw for only
- * the updated area of the image.
- */
-
- gtk_widget_queue_draw (image);
-}
-
-static gint
-progressive_timeout (gpointer data)
-{
- GtkWidget *image;
-
- image = GTK_WIDGET (data);
-
- /* This shows off fully-paranoid error handling, so looks scary.
- * You could factor out the error handling code into a nice separate
- * function to make things nicer.
- */
-
- if (image_stream)
- {
- size_t bytes_read;
- guchar buf[256];
- GError *error = NULL;
-
- bytes_read = fread (buf, 1, 256, image_stream);
-
- if (ferror (image_stream))
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Failure reading image file 'alphatest.png': %s",
- g_strerror (errno));
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- fclose (image_stream);
- image_stream = NULL;
-
- gtk_widget_show (dialog);
-
- load_timeout = 0;
-
- return FALSE; /* uninstall the timeout */
- }
-
- if (!gdk_pixbuf_loader_write (pixbuf_loader,
- buf, bytes_read,
- &error))
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Failed to load image: %s",
- error->message);
-
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- fclose (image_stream);
- image_stream = NULL;
-
- gtk_widget_show (dialog);
-
- load_timeout = 0;
-
- return FALSE; /* uninstall the timeout */
- }
-
- if (feof (image_stream))
- {
- fclose (image_stream);
- image_stream = NULL;
-
- /* Errors can happen on close, e.g. if the image
- * file was truncated we'll know on close that
- * it was incomplete.
- */
- error = NULL;
- if (!gdk_pixbuf_loader_close (pixbuf_loader,
- &error))
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Failed to load image: %s",
- error->message);
-
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
-
- g_object_unref (pixbuf_loader);
- pixbuf_loader = NULL;
-
- load_timeout = 0;
-
- return FALSE; /* uninstall the timeout */
- }
-
- g_object_unref (pixbuf_loader);
- pixbuf_loader = NULL;
- }
- }
- else
- {
- gchar *filename;
- gchar *error_message = NULL;
- GError *error = NULL;
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- filename = demo_find_file ("alphatest.png", &error);
- if (error)
- {
- error_message = g_strdup (error->message);
- g_error_free (error);
- }
- else
- {
- image_stream = g_fopen (filename, "rb");
- g_free (filename);
-
- if (!image_stream)
- error_message = g_strdup_printf ("Unable to open image file 'alphatest.png': %s",
- g_strerror (errno));
- }
-
- if (image_stream == NULL)
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s", error_message);
- g_free (error_message);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
-
- load_timeout = 0;
-
- return FALSE; /* uninstall the timeout */
- }
-
- if (pixbuf_loader)
- {
- gdk_pixbuf_loader_close (pixbuf_loader, NULL);
- g_object_unref (pixbuf_loader);
- pixbuf_loader = NULL;
- }
-
- pixbuf_loader = gdk_pixbuf_loader_new ();
-
- g_signal_connect (pixbuf_loader, "area-prepared",
- G_CALLBACK (progressive_prepared_callback), image);
-
- g_signal_connect (pixbuf_loader, "area-updated",
- G_CALLBACK (progressive_updated_callback), image);
- }
-
- /* leave timeout installed */
- return TRUE;
-}
-
-static void
-start_progressive_loading (GtkWidget *image)
-{
- /* This is obviously totally contrived (we slow down loading
- * on purpose to show how incremental loading works).
- * The real purpose of incremental loading is the case where
- * you are reading data from a slow source such as the network.
- * The timeout simply simulates a slow data source by inserting
- * pauses in the reading process.
- */
- load_timeout = gdk_threads_add_timeout (150,
- progressive_timeout,
- image);
-}
-
-static void
-cleanup_callback (GObject *object,
- gpointer data)
-{
- if (load_timeout)
- {
- g_source_remove (load_timeout);
- load_timeout = 0;
- }
-
- if (pixbuf_loader)
- {
- gdk_pixbuf_loader_close (pixbuf_loader, NULL);
- g_object_unref (pixbuf_loader);
- pixbuf_loader = NULL;
- }
-
- if (image_stream)
- fclose (image_stream);
- image_stream = NULL;
-}
-
-static void
-toggle_sensitivity_callback (GtkWidget *togglebutton,
- gpointer user_data)
-{
- GtkContainer *container = user_data;
- GList *list;
- GList *tmp;
-
- list = gtk_container_get_children (container);
-
- tmp = list;
- while (tmp != NULL)
- {
- /* don't disable our toggle */
- if (GTK_WIDGET (tmp->data) != togglebutton)
- gtk_widget_set_sensitive (GTK_WIDGET (tmp->data),
- !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)));
-
- tmp = tmp->next;
- }
-
- g_list_free (list);
-}
-
-
-GtkWidget *
-do_images (GtkWidget *do_widget)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *image;
- GtkWidget *label;
- GtkWidget *button;
- GdkPixbuf *pixbuf;
- GIcon *gicon;
- GError *error = NULL;
- char *filename;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Images");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- g_signal_connect (window, "destroy",
- G_CALLBACK (cleanup_callback), NULL);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Image loaded from a file</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- pixbuf = NULL;
- filename = demo_find_file ("gtk-logo-rgb.gif", &error);
- if (filename)
- {
- pixbuf = gdk_pixbuf_new_from_file (filename, &error);
- g_free (filename);
- }
-
- if (error)
- {
- /* This code shows off error handling. You can just use
- * gtk_image_new_from_file() instead if you don't want to report
- * errors to the user. If the file doesn't load when using
- * gtk_image_new_from_file(), a "missing image" icon will
- * be displayed instead.
- */
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Unable to open image file 'gtk-logo-rgb.gif': %s",
- error->message);
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
- }
-
- image = gtk_image_new_from_pixbuf (pixbuf);
-
- gtk_container_add (GTK_CONTAINER (frame), image);
-
-
- /* Animation */
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Animation loaded from a file</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- filename = demo_find_file ("floppybuddy.gif", NULL);
- image = gtk_image_new_from_file (filename);
- g_free (filename);
-
- gtk_container_add (GTK_CONTAINER (frame), image);
-
- /* Symbolic icon */
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Symbolic themed icon</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
- image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DIALOG);
-
- gtk_container_add (GTK_CONTAINER (frame), image);
-
- /* Progressive */
-
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label),
- "<u>Progressive image loading</u>");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- /* Create an empty image for now; the progressive loader
- * will create the pixbuf and fill it in.
- */
- image = gtk_image_new_from_pixbuf (NULL);
- gtk_container_add (GTK_CONTAINER (frame), image);
-
- start_progressive_loading (image);
-
- /* Sensitivity control */
- button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (button, "toggled",
- G_CALLBACK (toggle_sensitivity_callback),
- vbox);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/infobar.c b/gtk+-mingw/share/gtk-3.0/demo/infobar.c
deleted file mode 100644
index 0cb58e6..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/infobar.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Info bar
- *
- * Info bar widgets are used to report important messages to the user.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-static void
-on_bar_response (GtkInfoBar *info_bar,
- gint response_id,
- gpointer user_data)
-{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- "You clicked a button on an info bar");
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- "Your response has id %d", response_id);
-
- g_signal_connect_swapped (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-
- gtk_widget_show_all (dialog);
-}
-
-GtkWidget *
-do_infobar (GtkWidget *do_widget)
-{
- GtkWidget *frame;
- GtkWidget *bar;
- GtkWidget *vbox;
- GtkWidget *vbox2;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Info Bars");
-
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- bar = gtk_info_bar_new ();
- gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
- label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
-
- bar = gtk_info_bar_new ();
- gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
- label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
-
- bar = gtk_info_bar_new_with_buttons (GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- g_signal_connect (bar, "response", G_CALLBACK (on_bar_response), window);
- gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
- label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
-
- bar = gtk_info_bar_new ();
- gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
- label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
-
- bar = gtk_info_bar_new ();
- gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
- gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
- label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
- gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label, FALSE, FALSE, 0);
-
- frame = gtk_frame_new ("Info bars");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 8);
-
- vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
- gtk_container_add (GTK_CONTAINER (frame), vbox2);
-
- /* Standard message dialog */
- label = gtk_label_new ("An example of different info bars");
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/links.c b/gtk+-mingw/share/gtk-3.0/demo/links.c
deleted file mode 100644
index d4f6ddd..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/links.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Links
- *
- * GtkLabel can show hyperlinks. The default action is to call
- * gtk_show_uri() on their URI, but it is possible to override
- * this with a custom handler.
- */
-
-#include <gtk/gtk.h>
-
-static void
-response_cb (GtkWidget *dialog,
- gint response_id,
- gpointer data)
-{
- gtk_widget_destroy (dialog);
-}
-
-static gboolean
-activate_link (GtkWidget *label,
- const gchar *uri,
- gpointer data)
-{
- if (g_strcmp0 (uri, "keynav") == 0)
- {
- GtkWidget *dialog;
- GtkWidget *parent;
-
- parent = gtk_widget_get_toplevel (label);
- dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- "The term <i>keynav</i> is a shorthand for "
- "keyboard navigation and refers to the process of using "
- "a program (exclusively) via keyboard input.");
-
- gtk_window_present (GTK_WINDOW (dialog));
- g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_links (GtkWidget *do_widget)
-{
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Links");
- gtk_container_set_border_width (GTK_CONTAINER (window), 12);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
- "title=\"plain text\">text</a> may be marked up\n"
- "as hyperlinks, which can be clicked\n"
- "or activated via <a href=\"keynav\">keynav</a>\n"
- "and they work fine with other markup, like when\n"
- "searching on <a href=\"http://www.google.com/\">"
- "<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
- "<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
- "<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
- "</a>.");
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
- gtk_container_add (GTK_CONTAINER (window), label);
- gtk_widget_show (label);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/list_store.c b/gtk+-mingw/share/gtk-3.0/demo/list_store.c
deleted file mode 100644
index e5d2dff..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/list_store.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/* Tree View/List Store
- *
- * The GtkListStore is used to store data in list form, to be used
- * later on by a GtkTreeView to display it. This demo builds a
- * simple GtkListStore and displays it. See the Stock Browser
- * demo for a more advanced example.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-static GtkTreeModel *model = NULL;
-static guint timeout = 0;
-
-typedef struct
-{
- const gboolean fixed;
- const guint number;
- const gchar *severity;
- const gchar *description;
-}
-Bug;
-
-enum
-{
- COLUMN_FIXED,
- COLUMN_NUMBER,
- COLUMN_SEVERITY,
- COLUMN_DESCRIPTION,
- COLUMN_PULSE,
- COLUMN_ICON,
- COLUMN_ACTIVE,
- COLUMN_SENSITIVE,
- NUM_COLUMNS
-};
-
-static Bug data[] =
-{
- { FALSE, 60482, "Normal", "scrollable notebooks and hidden tabs" },
- { FALSE, 60620, "Critical", "gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe" },
- { FALSE, 50214, "Major", "Xft support does not clean up correctly" },
- { TRUE, 52877, "Major", "GtkFileSelection needs a refresh method. " },
- { FALSE, 56070, "Normal", "Can't click button after setting in sensitive" },
- { TRUE, 56355, "Normal", "GtkLabel - Not all changes propagate correctly" },
- { FALSE, 50055, "Normal", "Rework width/height computations for TreeView" },
- { FALSE, 58278, "Normal", "gtk_dialog_set_response_sensitive () doesn't work" },
- { FALSE, 55767, "Normal", "Getters for all setters" },
- { FALSE, 56925, "Normal", "Gtkcalender size" },
- { FALSE, 56221, "Normal", "Selectable label needs right-click copy menu" },
- { TRUE, 50939, "Normal", "Add shift clicking to GtkTextView" },
- { FALSE, 6112, "Enhancement","netscape-like collapsable toolbars" },
- { FALSE, 1, "Normal", "First bug :=)" },
-};
-
-static gboolean
-spinner_timeout (gpointer data)
-{
- GtkTreeIter iter;
- guint pulse;
-
- if (model == NULL)
- return G_SOURCE_REMOVE;
-
- gtk_tree_model_get_iter_first (model, &iter);
- gtk_tree_model_get (model, &iter,
- COLUMN_PULSE, &pulse,
- -1);
- if (pulse == G_MAXUINT)
- pulse = 0;
- else
- pulse++;
-
- gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- COLUMN_PULSE, pulse,
- COLUMN_ACTIVE, TRUE,
- -1);
-
- return G_SOURCE_CONTINUE;
-}
-
-static GtkTreeModel *
-create_model (void)
-{
- gint i = 0;
- GtkListStore *store;
- GtkTreeIter iter;
-
- /* create list store */
- store = gtk_list_store_new (NUM_COLUMNS,
- G_TYPE_BOOLEAN,
- G_TYPE_UINT,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_UINT,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN);
-
- /* add data to the list store */
- for (i = 0; i < G_N_ELEMENTS (data); i++)
- {
- gchar *icon_name;
- gboolean sensitive;
-
- if (i == 1 || i == 3)
- icon_name = "battery-caution-charging-symbolic";
- else
- icon_name = NULL;
- if (i == 3)
- sensitive = FALSE;
- else
- sensitive = TRUE;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COLUMN_FIXED, data[i].fixed,
- COLUMN_NUMBER, data[i].number,
- COLUMN_SEVERITY, data[i].severity,
- COLUMN_DESCRIPTION, data[i].description,
- COLUMN_PULSE, 0,
- COLUMN_ICON, icon_name,
- COLUMN_ACTIVE, FALSE,
- COLUMN_SENSITIVE, sensitive,
- -1);
- }
-
- return GTK_TREE_MODEL (store);
-}
-
-static void
-fixed_toggled (GtkCellRendererToggle *cell,
- gchar *path_str,
- gpointer data)
-{
- GtkTreeModel *model = (GtkTreeModel *)data;
- GtkTreeIter iter;
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- gboolean fixed;
-
- /* get toggled iter */
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, COLUMN_FIXED, &fixed, -1);
-
- /* do something with the value */
- fixed ^= 1;
-
- /* set new value */
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_FIXED, fixed, -1);
-
- /* clean up */
- gtk_tree_path_free (path);
-}
-
-static void
-add_columns (GtkTreeView *treeview)
-{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-
- /* column for fixed toggles */
- renderer = gtk_cell_renderer_toggle_new ();
- g_signal_connect (renderer, "toggled",
- G_CALLBACK (fixed_toggled), model);
-
- column = gtk_tree_view_column_new_with_attributes ("Fixed?",
- renderer,
- "active", COLUMN_FIXED,
- NULL);
-
- /* set this column to a fixed sizing (of 50 pixels) */
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for bug numbers */
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Bug number",
- renderer,
- "text",
- COLUMN_NUMBER,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for severities */
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Severity",
- renderer,
- "text",
- COLUMN_SEVERITY,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, COLUMN_SEVERITY);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for description */
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Description",
- renderer,
- "text",
- COLUMN_DESCRIPTION,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, COLUMN_DESCRIPTION);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for spinner */
- renderer = gtk_cell_renderer_spinner_new ();
- column = gtk_tree_view_column_new_with_attributes ("Spinning",
- renderer,
- "pulse",
- COLUMN_PULSE,
- "active",
- COLUMN_ACTIVE,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, COLUMN_PULSE);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for symbolic icon */
- renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (G_OBJECT (renderer), "follow-state", TRUE, NULL);
- column = gtk_tree_view_column_new_with_attributes ("Symbolic icon",
- renderer,
- "icon-name",
- COLUMN_ICON,
- "sensitive",
- COLUMN_SENSITIVE,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, COLUMN_ICON);
- gtk_tree_view_append_column (treeview, column);
-}
-
-static gboolean
-window_closed (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
-{
- model = NULL;
- window = NULL;
- if (timeout != 0)
- {
- g_source_remove (timeout);
- timeout = 0;
- }
- return FALSE;
-}
-
-GtkWidget *
-do_list_store (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *vbox;
- GtkWidget *label;
- GtkWidget *sw;
- GtkWidget *treeview;
-
- /* create window, etc */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_ETCHED_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
-
- /* create tree model */
- model = create_model ();
-
- /* create tree view */
- treeview = gtk_tree_view_new_with_model (model);
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
- COLUMN_DESCRIPTION);
-
- g_object_unref (model);
-
- gtk_container_add (GTK_CONTAINER (sw), treeview);
-
- /* add columns to the tree view */
- add_columns (GTK_TREE_VIEW (treeview));
-
- /* finish & show */
- gtk_window_set_default_size (GTK_WINDOW (window), 280, 250);
- g_signal_connect (window, "delete-event",
- G_CALLBACK (window_closed), NULL);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- if (timeout == 0) {
- /* FIXME this should use the animation-duration instead */
- timeout = g_timeout_add (80, spinner_timeout, NULL);
- }
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- if (timeout != 0)
- {
- g_source_remove (timeout);
- timeout = 0;
- }
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/menus.c b/gtk+-mingw/share/gtk-3.0/demo/menus.c
deleted file mode 100644
index 7fd9553..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/menus.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Menus
- *
- * There are several widgets involved in displaying menus. The
- * GtkMenuBar widget is a menu bar, which normally appears horizontally
- * at the top of an application, but can also be layed out vertically.
- * The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
- * and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
- * menu items (GtkMenuItem). Each menu item contains text and/or images
- * and can be selected by the user.
- *
- * There are several kinds of menu item, including plain GtkMenuItem,
- * GtkCheckMenuItem which can be checked/unchecked, GtkRadioMenuItem
- * which is a check menu item that's in a mutually exclusive group,
- * GtkSeparatorMenuItem which is a separator bar, GtkTearoffMenuItem
- * which allows a GtkMenu to be torn off, and GtkImageMenuItem which
- * can place a GtkImage or other widget next to the menu text.
- *
- * A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
- * up when the menu item is selected. Typically, all menu items in a menu bar
- * have submenus.
- *
- * GtkUIManager provides a higher-level interface for creating menu bars
- * and menus; while you can construct menus manually, most people don't
- * do that. There's a separate demo for GtkUIManager.
- */
-
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-
-#include <stdio.h>
-
-static GtkWidget *
-create_menu (gint depth)
-{
- GtkWidget *menu;
- GtkWidget *menuitem;
- GSList *group;
- char buf[32];
- int i, j;
-
- if (depth < 1)
- return NULL;
-
- menu = gtk_menu_new ();
- group = NULL;
-
- for (i = 0, j = 1; i < 5; i++, j++)
- {
- sprintf (buf, "item %2d - %d", depth, j);
- menuitem = gtk_radio_menu_item_new_with_label (group, buf);
- group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
- gtk_widget_show (menuitem);
- if (i == 3)
- gtk_widget_set_sensitive (menuitem, FALSE);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
- }
-
- return menu;
-}
-
-static void
-change_orientation (GtkWidget *button,
- GtkWidget *menubar)
-{
- GtkWidget *parent;
- GtkOrientation orientation;
-
- parent = gtk_widget_get_parent (menubar);
- orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
- gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
-
- if (orientation == GTK_ORIENTATION_VERTICAL)
- g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_TTB, NULL);
- else
- g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_LTR, NULL);
-
-}
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_menus (GtkWidget *do_widget)
-{
- GtkWidget *box;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
-
- if (!window)
- {
- GtkWidget *menubar;
- GtkWidget *menu;
- GtkWidget *menuitem;
- GtkAccelGroup *accel_group;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Menus");
- g_signal_connect (window, "destroy",
- G_CALLBACK(gtk_widget_destroyed), &window);
-
- accel_group = gtk_accel_group_new ();
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (window), box);
- gtk_widget_show (box);
-
- box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (box), box1);
- gtk_widget_show (box1);
-
- menubar = gtk_menu_bar_new ();
- gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
- gtk_widget_show (menubar);
-
- menu = create_menu (2);
-
- menuitem = gtk_menu_item_new_with_label ("test\nline2");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
- gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("foo");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
- gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("bar");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
- gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("Flip");
- g_signal_connect (button, "clicked",
- G_CALLBACK (change_orientation), menubar);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Close");
- g_signal_connect_swapped (button, "clicked",
- G_CALLBACK(gtk_widget_destroy), window);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_set_can_default (button, TRUE);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/menus.ui b/gtk+-mingw/share/gtk-3.0/demo/menus.ui
deleted file mode 100644
index 0bbe11a..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/menus.ui
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0"?>
-<interface>
- <menu id="appmenu">
- <section>
- <item>
- <attribute name="label" translatable="yes">_New</attribute>
- <attribute name="action">app.new</attribute>
- <attribute name="accel">&lt;Primary&gt;n</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Open</attribute>
- <attribute name="action">app.open</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Save</attribute>
- <attribute name="action">app.save</attribute>
- <attribute name="accel">&lt;Primary&gt;s</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Save _As...</attribute>
- <attribute name="action">app.save-as</attribute>
- <attribute name="accel">&lt;Primary&gt;s</attribute>
- </item>
- </section>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Quit</attribute>
- <attribute name="action">app.quit</attribute>
- <attribute name="accel">&lt;Primary&gt;q</attribute>
- </item>
- </section>
- </menu>
- <menu id="menubar">
- <submenu>
- <attribute name="label" translatable="yes">_Preferences</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
- <attribute name="action">app.dark</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Hide Titlebar when maximized</attribute>
- <attribute name="action">win.titlebar</attribute>
- </item>
- <submenu>
- <attribute name="label" translatable="yes">_Color</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Red</attribute>
- <attribute name="action">app.color</attribute>
- <attribute name="target">red</attribute>
- <attribute name="accel">&lt;Primary&gt;r</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Green</attribute>
- <attribute name="action">app.color</attribute>
- <attribute name="target">green</attribute>
- <attribute name="accel">&lt;Primary&gt;g</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Blue</attribute>
- <attribute name="action">app.color</attribute>
- <attribute name="target">blue</attribute>
- <attribute name="accel">&lt;Primary&gt;b</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name="label" translatable="yes">_Shape</attribute>
- <section>
- <item>
- <attribute name="label" translatable="yes">_Square</attribute>
- <attribute name="action">win.shape</attribute>
- <attribute name="target">square</attribute>
- <attribute name="accel">&lt;Primary&gt;s</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Rectangle</attribute>
- <attribute name="action">win.shape</attribute>
- <attribute name="target">rectangle</attribute>
- <attribute name="accel">&lt;Primary&gt;r</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Oval</attribute>
- <attribute name="action">win.shape</attribute>
- <attribute name="target">oval</attribute>
- <attribute name="accel">&lt;Primary&gt;o</attribute>
- </item>
- </section>
- </submenu>
- <item>
- <attribute name="label" translatable="yes">_Bold</attribute>
- <attribute name="action">win.bold</attribute>
- <attribute name="accel">&lt;Primary&gt;b</attribute>
- </item>
- </section>
- </submenu>
- <submenu>
- <attribute name="label" translatable="yes">_Help</attribute>
- <item>
- <attribute name="label" translatable="yes">_About</attribute>
- <attribute name="action">win.about</attribute>
- <attribute name="accel">&lt;Primary&gt;a</attribute>
- </item>
- </submenu>
- </menu>
-</interface>
diff --git a/gtk+-mingw/share/gtk-3.0/demo/offscreen_window.c b/gtk+-mingw/share/gtk-3.0/demo/offscreen_window.c
deleted file mode 100644
index d0e4511..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/offscreen_window.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/* Offscreen windows/Rotated button
- *
- * Offscreen windows can be used to transform parts of a widget
- * hierarchy. Note that the rotated button is fully functional.
- */
-#include <math.h>
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_ROTATED_BIN (gtk_rotated_bin_get_type ())
-#define GTK_ROTATED_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ROTATED_BIN, GtkRotatedBin))
-#define GTK_ROTATED_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ROTATED_BIN, GtkRotatedBinClass))
-#define GTK_IS_ROTATED_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ROTATED_BIN))
-#define GTK_IS_ROTATED_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ROTATED_BIN))
-#define GTK_ROTATED_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ROTATED_BIN, GtkRotatedBinClass))
-
-typedef struct _GtkRotatedBin GtkRotatedBin;
-typedef struct _GtkRotatedBinClass GtkRotatedBinClass;
-
-struct _GtkRotatedBin
-{
- GtkContainer container;
-
- GtkWidget *child;
- GdkWindow *offscreen_window;
- gdouble angle;
-};
-
-struct _GtkRotatedBinClass
-{
- GtkContainerClass parent_class;
-};
-
-GType gtk_rotated_bin_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_rotated_bin_new (void);
-void gtk_rotated_bin_set_angle (GtkRotatedBin *bin,
- gdouble angle);
-
-/*** implementation ***/
-
-static void gtk_rotated_bin_realize (GtkWidget *widget);
-static void gtk_rotated_bin_unrealize (GtkWidget *widget);
-static void gtk_rotated_bin_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_rotated_bin_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_rotated_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gboolean gtk_rotated_bin_damage (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean gtk_rotated_bin_draw (GtkWidget *widget,
- cairo_t *cr);
-
-static void gtk_rotated_bin_add (GtkContainer *container,
- GtkWidget *child);
-static void gtk_rotated_bin_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_rotated_bin_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static GType gtk_rotated_bin_child_type (GtkContainer *container);
-
-G_DEFINE_TYPE (GtkRotatedBin, gtk_rotated_bin, GTK_TYPE_CONTAINER);
-
-static void
-to_child (GtkRotatedBin *bin,
- double widget_x,
- double widget_y,
- double *x_out,
- double *y_out)
-{
- GtkAllocation child_area;
- double x, y, xr, yr;
- double c, s;
- double w, h;
-
- s = sin (bin->angle);
- c = cos (bin->angle);
- gtk_widget_get_allocation (bin->child, &child_area);
-
- w = c * child_area.width + s * child_area.height;
- h = s * child_area.width + c * child_area.height;
-
- x = widget_x;
- y = widget_y;
-
- x -= (w - child_area.width) / 2;
- y -= (h - child_area.height) / 2;
-
- x -= child_area.width / 2;
- y -= child_area.height / 2;
-
- xr = x * c + y * s;
- yr = y * c - x * s;
- x = xr;
- y = yr;
-
- x += child_area.width / 2;
- y += child_area.height / 2;
-
- *x_out = x;
- *y_out = y;
-}
-
-static void
-to_parent (GtkRotatedBin *bin,
- double offscreen_x,
- double offscreen_y,
- double *x_out,
- double *y_out)
-{
- GtkAllocation child_area;
- double x, y, xr, yr;
- double c, s;
- double w, h;
-
- s = sin (bin->angle);
- c = cos (bin->angle);
- gtk_widget_get_allocation (bin->child, &child_area);
-
- w = c * child_area.width + s * child_area.height;
- h = s * child_area.width + c * child_area.height;
-
- x = offscreen_x;
- y = offscreen_y;
-
- x -= child_area.width / 2;
- y -= child_area.height / 2;
-
- xr = x * c - y * s;
- yr = x * s + y * c;
- x = xr;
- y = yr;
-
- x += child_area.width / 2;
- y += child_area.height / 2;
-
- x -= (w - child_area.width) / 2;
- y -= (h - child_area.height) / 2;
-
- *x_out = x;
- *y_out = y;
-}
-
-static void
-gtk_rotated_bin_class_init (GtkRotatedBinClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- widget_class->realize = gtk_rotated_bin_realize;
- widget_class->unrealize = gtk_rotated_bin_unrealize;
- widget_class->get_preferred_width = gtk_rotated_bin_get_preferred_width;
- widget_class->get_preferred_height = gtk_rotated_bin_get_preferred_height;
- widget_class->size_allocate = gtk_rotated_bin_size_allocate;
- widget_class->draw = gtk_rotated_bin_draw;
-
- g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
- GTK_TYPE_ROTATED_BIN,
- g_cclosure_new (G_CALLBACK (gtk_rotated_bin_damage),
- NULL, NULL));
-
- container_class->add = gtk_rotated_bin_add;
- container_class->remove = gtk_rotated_bin_remove;
- container_class->forall = gtk_rotated_bin_forall;
- container_class->child_type = gtk_rotated_bin_child_type;
-}
-
-static void
-gtk_rotated_bin_init (GtkRotatedBin *bin)
-{
- gtk_widget_set_has_window (GTK_WIDGET (bin), TRUE);
-}
-
-GtkWidget *
-gtk_rotated_bin_new (void)
-{
- return g_object_new (GTK_TYPE_ROTATED_BIN, NULL);
-}
-
-static GdkWindow *
-pick_offscreen_child (GdkWindow *offscreen_window,
- double widget_x,
- double widget_y,
- GtkRotatedBin *bin)
-{
- GtkAllocation child_area;
- double x, y;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- to_child (bin, widget_x, widget_y, &x, &y);
-
- gtk_widget_get_allocation (bin->child, &child_area);
-
- if (x >= 0 && x < child_area.width &&
- y >= 0 && y < child_area.height)
- return bin->offscreen_window;
- }
-
- return NULL;
-}
-
-static void
-offscreen_window_to_parent (GdkWindow *offscreen_window,
- double offscreen_x,
- double offscreen_y,
- double *parent_x,
- double *parent_y,
- GtkRotatedBin *bin)
-{
- to_parent (bin, offscreen_x, offscreen_y, parent_x, parent_y);
-}
-
-static void
-offscreen_window_from_parent (GdkWindow *window,
- double parent_x,
- double parent_y,
- double *offscreen_x,
- double *offscreen_y,
- GtkRotatedBin *bin)
-{
- to_child (bin, parent_x, parent_y, offscreen_x, offscreen_y);
-}
-
-static void
-gtk_rotated_bin_realize (GtkWidget *widget)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
- GtkAllocation allocation;
- GtkStyleContext *context;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
- guint border_width;
- GtkRequisition child_requisition;
-
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- attributes.x = allocation.x + border_width;
- attributes.y = allocation.y + border_width;
- attributes.width = allocation.width - 2 * border_width;
- attributes.height = allocation.height - 2 * border_width;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_SCROLL_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK;
-
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.wclass = GDK_INPUT_OUTPUT;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gtk_widget_set_window (widget, window);
- gdk_window_set_user_data (window, widget);
- g_signal_connect (window, "pick-embedded-child",
- G_CALLBACK (pick_offscreen_child), bin);
-
- attributes.window_type = GDK_WINDOW_OFFSCREEN;
-
- child_requisition.width = child_requisition.height = 0;
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- GtkAllocation child_allocation;
-
- gtk_widget_get_allocation (bin->child, &child_allocation);
- attributes.width = child_allocation.width;
- attributes.height = child_allocation.height;
- }
- bin->offscreen_window = gdk_window_new (gtk_widget_get_root_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (bin->offscreen_window, widget);
- if (bin->child)
- gtk_widget_set_parent_window (bin->child, bin->offscreen_window);
- gdk_offscreen_window_set_embedder (bin->offscreen_window, window);
- g_signal_connect (bin->offscreen_window, "to-embedder",
- G_CALLBACK (offscreen_window_to_parent), bin);
- g_signal_connect (bin->offscreen_window, "from-embedder",
- G_CALLBACK (offscreen_window_from_parent), bin);
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_background (context, window);
- gtk_style_context_set_background (context, bin->offscreen_window);
- gdk_window_show (bin->offscreen_window);
-}
-
-static void
-gtk_rotated_bin_unrealize (GtkWidget *widget)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
-
- gdk_window_set_user_data (bin->offscreen_window, NULL);
- gdk_window_destroy (bin->offscreen_window);
- bin->offscreen_window = NULL;
-
- GTK_WIDGET_CLASS (gtk_rotated_bin_parent_class)->unrealize (widget);
-}
-
-static GType
-gtk_rotated_bin_child_type (GtkContainer *container)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
-
- if (bin->child)
- return G_TYPE_NONE;
-
- return GTK_TYPE_WIDGET;
-}
-
-static void
-gtk_rotated_bin_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
-
- if (!bin->child)
- {
- gtk_widget_set_parent_window (widget, bin->offscreen_window);
- gtk_widget_set_parent (widget, GTK_WIDGET (bin));
- bin->child = widget;
- }
- else
- g_warning ("GtkRotatedBin cannot have more than one child\n");
-}
-
-static void
-gtk_rotated_bin_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
- gboolean was_visible;
-
- was_visible = gtk_widget_get_visible (widget);
-
- if (bin->child == widget)
- {
- gtk_widget_unparent (widget);
-
- bin->child = NULL;
-
- if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
-}
-
-static void
-gtk_rotated_bin_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (container);
-
- g_return_if_fail (callback != NULL);
-
- if (bin->child)
- (*callback) (bin->child, callback_data);
-}
-
-void
-gtk_rotated_bin_set_angle (GtkRotatedBin *bin,
- gdouble angle)
-{
- g_return_if_fail (GTK_IS_ROTATED_BIN (bin));
-
- bin->angle = angle;
- gtk_widget_queue_resize (GTK_WIDGET (bin));
-
- gdk_window_geometry_changed (bin->offscreen_window);
-}
-
-static void
-gtk_rotated_bin_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
- GtkRequisition child_requisition;
- double s, c;
- double w, h;
- guint border_width;
-
- child_requisition.width = 0;
- child_requisition.height = 0;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- gtk_widget_get_preferred_size ( (bin->child),
- &child_requisition, NULL);
-
- s = sin (bin->angle);
- c = cos (bin->angle);
- w = c * child_requisition.width + s * child_requisition.height;
- h = s * child_requisition.width + c * child_requisition.height;
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width = border_width * 2 + w;
- requisition->height = border_width * 2 + h;
-}
-
-static void
-gtk_rotated_bin_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_rotated_bin_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.width;
-}
-
-static void
-gtk_rotated_bin_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_rotated_bin_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.height;
-}
-
-static void
-gtk_rotated_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
- guint border_width;
- gint w, h;
- gdouble s, c;
-
- gtk_widget_set_allocation (widget, allocation);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- w = allocation->width - border_width * 2;
- h = allocation->height - border_width * 2;
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x + border_width,
- allocation->y + border_width,
- w, h);
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- GtkRequisition child_requisition;
- GtkAllocation child_allocation;
-
- s = sin (bin->angle);
- c = cos (bin->angle);
-
- gtk_widget_get_preferred_size (bin->child,
- &child_requisition, NULL);
- child_allocation.x = 0;
- child_allocation.y = 0;
- child_allocation.height = child_requisition.height;
- if (c == 0.0)
- child_allocation.width = h / s;
- else if (s == 0.0)
- child_allocation.width = w / c;
- else
- child_allocation.width = MIN ((w - s * child_allocation.height) / c,
- (h - c * child_allocation.height) / s);
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (bin->offscreen_window,
- child_allocation.x,
- child_allocation.y,
- child_allocation.width,
- child_allocation.height);
-
- child_allocation.x = child_allocation.y = 0;
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static gboolean
-gtk_rotated_bin_damage (GtkWidget *widget,
- GdkEventExpose *event)
-{
- gdk_window_invalidate_rect (gtk_widget_get_window (widget),
- NULL, FALSE);
-
- return TRUE;
-}
-
-static gboolean
-gtk_rotated_bin_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
- GdkWindow *window;
- gdouble s, c;
- gdouble w, h;
-
- window = gtk_widget_get_window (widget);
- if (gtk_cairo_should_draw_window (cr, window))
- {
- cairo_surface_t *surface;
- GtkAllocation child_area;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
- gtk_widget_get_allocation (bin->child, &child_area);
-
- /* transform */
- s = sin (bin->angle);
- c = cos (bin->angle);
- w = c * child_area.width + s * child_area.height;
- h = s * child_area.width + c * child_area.height;
-
- cairo_translate (cr, (w - child_area.width) / 2, (h - child_area.height) / 2);
- cairo_translate (cr, child_area.width / 2, child_area.height / 2);
- cairo_rotate (cr, bin->angle);
- cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
-
- /* clip */
- cairo_rectangle (cr,
- 0, 0,
- gdk_window_get_width (bin->offscreen_window),
- gdk_window_get_height (bin->offscreen_window));
- cairo_clip (cr);
- /* paint */
- cairo_set_source_surface (cr, surface, 0, 0);
- cairo_paint (cr);
- }
- }
- if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
- {
- gtk_render_background (gtk_widget_get_style_context (widget),
- cr,
- 0, 0,
- gdk_window_get_width (bin->offscreen_window),
- gdk_window_get_height (bin->offscreen_window));
-
- if (bin->child)
- gtk_container_propagate_draw (GTK_CONTAINER (widget),
- bin->child,
- cr);
- }
-
- return FALSE;
-}
-
-/*** ***/
-
-static void
-scale_changed (GtkRange *range,
- GtkRotatedBin *bin)
-{
- gtk_rotated_bin_set_angle (bin, gtk_range_get_value (range));
-}
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_offscreen_window (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *bin, *vbox, *scale, *button;
- GdkRGBA black;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Rotated widget");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gdk_rgba_parse (&black, "black");
- gtk_widget_override_background_color (window, 0, &black);
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
- 0, G_PI/2, 0.01);
- gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
-
- button = gtk_button_new_with_label ("A Button");
- bin = gtk_rotated_bin_new ();
-
- g_signal_connect (scale, "value-changed", G_CALLBACK (scale_changed), bin);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), bin, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (bin), button);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/offscreen_window2.c b/gtk+-mingw/share/gtk-3.0/demo/offscreen_window2.c
deleted file mode 100644
index b282704..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/offscreen_window2.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/* Offscreen windows/Effects
- *
- * Offscreen windows can be used to render elements multiple times to achieve
- * various effects.
- */
-#include <gtk/gtk.h>
-
-#define GTK_TYPE_MIRROR_BIN (gtk_mirror_bin_get_type ())
-#define GTK_MIRROR_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MIRROR_BIN, GtkMirrorBin))
-#define GTK_MIRROR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MIRROR_BIN, GtkMirrorBinClass))
-#define GTK_IS_MIRROR_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MIRROR_BIN))
-#define GTK_IS_MIRROR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MIRROR_BIN))
-#define GTK_MIRROR_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MIRROR_BIN, GtkMirrorBinClass))
-
-typedef struct _GtkMirrorBin GtkMirrorBin;
-typedef struct _GtkMirrorBinClass GtkMirrorBinClass;
-
-struct _GtkMirrorBin
-{
- GtkContainer container;
-
- GtkWidget *child;
- GdkWindow *offscreen_window;
-};
-
-struct _GtkMirrorBinClass
-{
- GtkContainerClass parent_class;
-};
-
-GType gtk_mirror_bin_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_mirror_bin_new (void);
-
-/*** implementation ***/
-
-static void gtk_mirror_bin_realize (GtkWidget *widget);
-static void gtk_mirror_bin_unrealize (GtkWidget *widget);
-static void gtk_mirror_bin_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural);
-static void gtk_mirror_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gboolean gtk_mirror_bin_damage (GtkWidget *widget,
- GdkEventExpose *event);
-static gboolean gtk_mirror_bin_draw (GtkWidget *widget,
- cairo_t *cr);
-
-static void gtk_mirror_bin_add (GtkContainer *container,
- GtkWidget *child);
-static void gtk_mirror_bin_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_mirror_bin_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static GType gtk_mirror_bin_child_type (GtkContainer *container);
-
-G_DEFINE_TYPE (GtkMirrorBin, gtk_mirror_bin, GTK_TYPE_CONTAINER);
-
-static void
-to_child (GtkMirrorBin *bin,
- double widget_x,
- double widget_y,
- double *x_out,
- double *y_out)
-{
- *x_out = widget_x;
- *y_out = widget_y;
-}
-
-static void
-to_parent (GtkMirrorBin *bin,
- double offscreen_x,
- double offscreen_y,
- double *x_out,
- double *y_out)
-{
- *x_out = offscreen_x;
- *y_out = offscreen_y;
-}
-
-static void
-gtk_mirror_bin_class_init (GtkMirrorBinClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- widget_class->realize = gtk_mirror_bin_realize;
- widget_class->unrealize = gtk_mirror_bin_unrealize;
- widget_class->get_preferred_width = gtk_mirror_bin_get_preferred_width;
- widget_class->get_preferred_height = gtk_mirror_bin_get_preferred_height;
- widget_class->size_allocate = gtk_mirror_bin_size_allocate;
- widget_class->draw = gtk_mirror_bin_draw;
-
- g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
- GTK_TYPE_MIRROR_BIN,
- g_cclosure_new (G_CALLBACK (gtk_mirror_bin_damage),
- NULL, NULL));
-
- container_class->add = gtk_mirror_bin_add;
- container_class->remove = gtk_mirror_bin_remove;
- container_class->forall = gtk_mirror_bin_forall;
- container_class->child_type = gtk_mirror_bin_child_type;
-}
-
-static void
-gtk_mirror_bin_init (GtkMirrorBin *bin)
-{
- gtk_widget_set_has_window (GTK_WIDGET (bin), TRUE);
-}
-
-GtkWidget *
-gtk_mirror_bin_new (void)
-{
- return g_object_new (GTK_TYPE_MIRROR_BIN, NULL);
-}
-
-static GdkWindow *
-pick_offscreen_child (GdkWindow *offscreen_window,
- double widget_x,
- double widget_y,
- GtkMirrorBin *bin)
-{
- GtkAllocation child_area;
- double x, y;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- to_child (bin, widget_x, widget_y, &x, &y);
-
- gtk_widget_get_allocation (bin->child, &child_area);
-
- if (x >= 0 && x < child_area.width &&
- y >= 0 && y < child_area.height)
- return bin->offscreen_window;
- }
-
- return NULL;
-}
-
-static void
-offscreen_window_to_parent (GdkWindow *offscreen_window,
- double offscreen_x,
- double offscreen_y,
- double *parent_x,
- double *parent_y,
- GtkMirrorBin *bin)
-{
- to_parent (bin, offscreen_x, offscreen_y, parent_x, parent_y);
-}
-
-static void
-offscreen_window_from_parent (GdkWindow *window,
- double parent_x,
- double parent_y,
- double *offscreen_x,
- double *offscreen_y,
- GtkMirrorBin *bin)
-{
- to_child (bin, parent_x, parent_y, offscreen_x, offscreen_y);
-}
-
-static void
-gtk_mirror_bin_realize (GtkWidget *widget)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
- GtkAllocation allocation;
- GtkStyleContext *context;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
- guint border_width;
- GtkRequisition child_requisition;
-
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- attributes.x = allocation.x + border_width;
- attributes.y = allocation.y + border_width;
- attributes.width = allocation.width - 2 * border_width;
- attributes.height = allocation.height - 2 * border_width;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_SCROLL_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK;
-
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.wclass = GDK_INPUT_OUTPUT;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-
- window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gtk_widget_set_window (widget, window);
- gdk_window_set_user_data (window, widget);
- g_signal_connect (window, "pick-embedded-child",
- G_CALLBACK (pick_offscreen_child), bin);
-
- attributes.window_type = GDK_WINDOW_OFFSCREEN;
-
- child_requisition.width = child_requisition.height = 0;
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- GtkAllocation child_allocation;
-
- gtk_widget_get_allocation (bin->child, &child_allocation);
- attributes.width = child_allocation.width;
- attributes.height = child_allocation.height;
- }
- bin->offscreen_window = gdk_window_new (gtk_widget_get_root_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (bin->offscreen_window, widget);
- if (bin->child)
- gtk_widget_set_parent_window (bin->child, bin->offscreen_window);
- gdk_offscreen_window_set_embedder (bin->offscreen_window, window);
- g_signal_connect (bin->offscreen_window, "to-embedder",
- G_CALLBACK (offscreen_window_to_parent), bin);
- g_signal_connect (bin->offscreen_window, "from-embedder",
- G_CALLBACK (offscreen_window_from_parent), bin);
-
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_background (context, window);
- gtk_style_context_set_background (context, bin->offscreen_window);
- gdk_window_show (bin->offscreen_window);
-}
-
-static void
-gtk_mirror_bin_unrealize (GtkWidget *widget)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
-
- gdk_window_set_user_data (bin->offscreen_window, NULL);
- gdk_window_destroy (bin->offscreen_window);
- bin->offscreen_window = NULL;
-
- GTK_WIDGET_CLASS (gtk_mirror_bin_parent_class)->unrealize (widget);
-}
-
-static GType
-gtk_mirror_bin_child_type (GtkContainer *container)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
-
- if (bin->child)
- return G_TYPE_NONE;
-
- return GTK_TYPE_WIDGET;
-}
-
-static void
-gtk_mirror_bin_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
-
- if (!bin->child)
- {
- gtk_widget_set_parent_window (widget, bin->offscreen_window);
- gtk_widget_set_parent (widget, GTK_WIDGET (bin));
- bin->child = widget;
- }
- else
- g_warning ("GtkMirrorBin cannot have more than one child\n");
-}
-
-static void
-gtk_mirror_bin_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
- gboolean was_visible;
-
- was_visible = gtk_widget_get_visible (widget);
-
- if (bin->child == widget)
- {
- gtk_widget_unparent (widget);
-
- bin->child = NULL;
-
- if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
-}
-
-static void
-gtk_mirror_bin_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (container);
-
- g_return_if_fail (callback != NULL);
-
- if (bin->child)
- (*callback) (bin->child, callback_data);
-}
-
-static void
-gtk_mirror_bin_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
- GtkRequisition child_requisition;
- guint border_width;
-
- child_requisition.width = 0;
- child_requisition.height = 0;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- gtk_widget_get_preferred_size ( (bin->child),
- &child_requisition, NULL);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width = border_width * 2 + child_requisition.width + 10;
- requisition->height = border_width * 2 + child_requisition.height * 2 + 10;
-}
-
-static void
-gtk_mirror_bin_get_preferred_width (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_mirror_bin_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.width;
-}
-
-static void
-gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
- gint *minimum,
- gint *natural)
-{
- GtkRequisition requisition;
-
- gtk_mirror_bin_size_request (widget, &requisition);
-
- *minimum = *natural = requisition.width;
-}
-
-static void
-gtk_mirror_bin_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
- gint w, h;
- guint border_width;
-
- gtk_widget_set_allocation (widget, allocation);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- w = allocation->width - border_width * 2;
- h = allocation->height - border_width * 2;
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x + border_width,
- allocation->y + border_width,
- w, h);
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- GtkRequisition child_requisition;
- GtkAllocation child_allocation;
-
- gtk_widget_get_preferred_size (bin->child,
- &child_requisition, NULL);
- child_allocation.x = 0;
- child_allocation.y = 0;
- child_allocation.height = child_requisition.height;
- child_allocation.width = child_requisition.width;
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (bin->offscreen_window,
- allocation->x + border_width,
- allocation->y + border_width,
- child_allocation.width, child_allocation.height);
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static gboolean
-gtk_mirror_bin_damage (GtkWidget *widget,
- GdkEventExpose *event)
-{
- gdk_window_invalidate_rect (gtk_widget_get_window (widget),
- NULL, FALSE);
-
- return TRUE;
-}
-
-static gboolean
-gtk_mirror_bin_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
- GdkWindow *window;
-
- window = gtk_widget_get_window (widget);
- if (gtk_cairo_should_draw_window (cr, window))
- {
- cairo_surface_t *surface;
- cairo_matrix_t matrix;
- cairo_pattern_t *mask;
- int height;
-
- if (bin->child && gtk_widget_get_visible (bin->child))
- {
- surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
- height = gdk_window_get_height (bin->offscreen_window);
-
- /* paint the offscreen child */
- cairo_set_source_surface (cr, surface, 0, 0);
- cairo_paint (cr);
-
- cairo_matrix_init (&matrix, 1.0, 0.0, 0.3, 1.0, 0.0, 0.0);
- cairo_matrix_scale (&matrix, 1.0, -1.0);
- cairo_matrix_translate (&matrix, -10, - 3 * height - 10);
- cairo_transform (cr, &matrix);
-
- cairo_set_source_surface (cr, surface, 0, height);
-
- /* create linear gradient as mask-pattern to fade out the source */
- mask = cairo_pattern_create_linear (0.0, height, 0.0, 2*height);
- cairo_pattern_add_color_stop_rgba (mask, 0.0, 0.0, 0.0, 0.0, 0.0);
- cairo_pattern_add_color_stop_rgba (mask, 0.25, 0.0, 0.0, 0.0, 0.01);
- cairo_pattern_add_color_stop_rgba (mask, 0.5, 0.0, 0.0, 0.0, 0.25);
- cairo_pattern_add_color_stop_rgba (mask, 0.75, 0.0, 0.0, 0.0, 0.5);
- cairo_pattern_add_color_stop_rgba (mask, 1.0, 0.0, 0.0, 0.0, 1.0);
-
- /* paint the reflection */
- cairo_mask (cr, mask);
-
- cairo_pattern_destroy (mask);
- }
- }
- else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
- {
- gtk_render_background (gtk_widget_get_style_context (widget),
- cr,
- 0, 0,
- gdk_window_get_width (bin->offscreen_window),
- gdk_window_get_height (bin->offscreen_window));
-
- if (bin->child)
- gtk_container_propagate_draw (GTK_CONTAINER (widget),
- bin->child,
- cr);
- }
-
- return FALSE;
-}
-
-/*** ***/
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_offscreen_window2 (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *bin, *vbox;
- GtkWidget *hbox, *entry, *applybutton, *backbutton;
- GtkSizeGroup *group;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Effects");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- bin = gtk_mirror_bin_new ();
-
- group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- backbutton = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (backbutton),
- gtk_image_new_from_stock (GTK_STOCK_GO_BACK, 4));
- gtk_size_group_add_widget (group, backbutton);
- entry = gtk_entry_new ();
- gtk_size_group_add_widget (group, entry);
- applybutton = gtk_button_new ();
- gtk_size_group_add_widget (group, applybutton);
- gtk_container_add (GTK_CONTAINER (applybutton),
- gtk_image_new_from_stock (GTK_STOCK_APPLY, 4));
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_box_pack_start (GTK_BOX (vbox), bin, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (bin), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), backbutton, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), applybutton, FALSE, FALSE, 0);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/overlay.c b/gtk+-mingw/share/gtk-3.0/demo/overlay.c
deleted file mode 100644
index b291ac1..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/overlay.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Overlay
- *
- * Stack widgets in static positions over a main widget
- */
-
-#include <gtk/gtk.h>
-
-GtkWidget *
-do_overlay (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *view;
- GtkWidget *sw;
- GtkWidget *overlay;
- GtkWidget *entry;
- GtkWidget *label;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window),
- 450, 450);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Overlay");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- view = gtk_text_view_new ();
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), view);
-
- overlay = gtk_overlay_new ();
- gtk_container_add (GTK_CONTAINER (overlay), sw);
- gtk_container_add (GTK_CONTAINER (window), overlay);
-
- entry = gtk_entry_new ();
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
- gtk_widget_set_halign (entry, GTK_ALIGN_END);
- gtk_widget_set_valign (entry, GTK_ALIGN_END);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_END);
- gtk_widget_set_valign (label, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_START);
- gtk_widget_set_valign (entry, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_END);
- gtk_widget_set_valign (entry, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_END);
- gtk_widget_set_valign (label, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_START);
- gtk_widget_set_valign (entry, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_END);
- gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_END);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_START);
- gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (entry, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_START);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 20);
- gtk_widget_set_margin_right (label, 20);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (entry, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_END);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
- gtk_widget_set_margin_left (label, 10);
- gtk_widget_set_margin_right (label, 10);
- gtk_widget_set_margin_top (label, 5);
- gtk_widget_set_margin_bottom (label, 5);
-
- entry = gtk_entry_new ();
- gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
-
- label = gtk_label_new ("Hello world");
- gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
-
- gtk_widget_show_all (overlay);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/panes.c b/gtk+-mingw/share/gtk-3.0/demo/panes.c
deleted file mode 100644
index 2811b36..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/panes.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Paned Widgets
- *
- * The GtkHPaned and GtkVPaned Widgets divide their content
- * area into two panes with a divider in between that the
- * user can adjust. A separate child is placed into each
- * pane.
- *
- * There are a number of options that can be set for each pane.
- * This test contains both a horizontal (HPaned) and a vertical
- * (VPaned) widget, and allows you to adjust the options for
- * each side of each widget.
- */
-
-#include <gtk/gtk.h>
-
-void
-toggle_resize (GtkWidget *widget,
- GtkWidget *child)
-{
- GtkWidget *parent;
- GtkPaned *paned;
- gboolean is_child1;
- gboolean resize, shrink;
-
- parent = gtk_widget_get_parent (child);
- paned = GTK_PANED (parent);
-
- is_child1 = (child == gtk_paned_get_child1 (paned));
-
- gtk_container_child_get (GTK_CONTAINER (paned), child,
- "resize", &resize,
- "shrink", &shrink,
- NULL);
-
- g_object_ref (child);
- gtk_container_remove (GTK_CONTAINER (parent), child);
- if (is_child1)
- gtk_paned_pack1 (paned, child, !resize, shrink);
- else
- gtk_paned_pack2 (paned, child, !resize, shrink);
- g_object_unref (child);
-}
-
-void
-toggle_shrink (GtkWidget *widget,
- GtkWidget *child)
-{
- GtkWidget *parent;
- GtkPaned *paned;
- gboolean is_child1;
- gboolean resize, shrink;
-
- parent = gtk_widget_get_parent (child);
- paned = GTK_PANED (parent);
-
- is_child1 = (child == gtk_paned_get_child1 (paned));
-
- gtk_container_child_get (GTK_CONTAINER (paned), child,
- "resize", &resize,
- "shrink", &shrink,
- NULL);
-
- g_object_ref (child);
- gtk_container_remove (GTK_CONTAINER (parent), child);
- if (is_child1)
- gtk_paned_pack1 (paned, child, resize, !shrink);
- else
- gtk_paned_pack2 (paned, child, resize, !shrink);
- g_object_unref (child);
-}
-
-GtkWidget *
-create_pane_options (GtkPaned *paned,
- const gchar *frame_label,
- const gchar *label1,
- const gchar *label2)
-{
- GtkWidget *child1, *child2;
- GtkWidget *frame;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *check_button;
-
- child1 = gtk_paned_get_child1 (paned);
- child2 = gtk_paned_get_child2 (paned);
-
- frame = gtk_frame_new (frame_label);
- gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
-
- table = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (frame), table);
-
- label = gtk_label_new (label1);
- gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
-
- check_button = gtk_check_button_new_with_mnemonic ("_Resize");
- gtk_grid_attach (GTK_GRID (table), check_button, 0, 1, 1, 1);
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (toggle_resize), child1);
-
- check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
- gtk_grid_attach (GTK_GRID (table), check_button, 0, 2, 1, 1);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (toggle_shrink), child1);
-
- label = gtk_label_new (label2);
- gtk_grid_attach (GTK_GRID (table), label, 1, 0, 1, 1);
-
- check_button = gtk_check_button_new_with_mnemonic ("_Resize");
- gtk_grid_attach (GTK_GRID (table), check_button, 1, 1, 1, 1);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (toggle_resize), child2);
-
- check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
- gtk_grid_attach (GTK_GRID (table), check_button, 1, 2, 1, 1);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (toggle_shrink), child2);
-
- return frame;
-}
-
-GtkWidget *
-do_panes (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *frame;
- GtkWidget *hpaned;
- GtkWidget *vpaned;
- GtkWidget *button;
- GtkWidget *vbox;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Panes");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
-
- hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_size_request (frame, 60, 60);
- gtk_paned_add1 (GTK_PANED (hpaned), frame);
-
- button = gtk_button_new_with_mnemonic ("_Hi there");
- gtk_container_add (GTK_CONTAINER(frame), button);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_size_request (frame, 80, 60);
- gtk_paned_add2 (GTK_PANED (hpaned), frame);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_size_request (frame, 60, 80);
- gtk_paned_add2 (GTK_PANED (vpaned), frame);
-
- /* Now create toggle buttons to control sizing */
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_pane_options (GTK_PANED (hpaned),
- "Horizontal",
- "Left",
- "Right"),
- FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- create_pane_options (GTK_PANED (vpaned),
- "Vertical",
- "Top",
- "Bottom"),
- FALSE, FALSE, 0);
-
- gtk_widget_show_all (vbox);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/pickers.c b/gtk+-mingw/share/gtk-3.0/demo/pickers.c
deleted file mode 100644
index 46826b5..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/pickers.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Pickers
- *
- * These widgets are mainly intended for use in preference dialogs.
- * They allow to select colors, fonts, files, directories and applications.
- */
-
-#include <gtk/gtk.h>
-
-GtkWidget *
-do_pickers (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *table, *label, *picker;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Pickers");
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
- table = gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID (table), 3);
- gtk_grid_set_column_spacing (GTK_GRID (table), 10);
- gtk_container_add (GTK_CONTAINER (window), table);
-
- gtk_container_set_border_width (GTK_CONTAINER (table), 10);
-
- label = gtk_label_new ("Color:");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (label, TRUE);
- picker = gtk_color_button_new ();
- gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
- gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
-
- label = gtk_label_new ("Font:");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (label, TRUE);
- picker = gtk_font_button_new ();
- gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
- gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
-
- label = gtk_label_new ("File:");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (label, TRUE);
- picker = gtk_file_chooser_button_new ("Pick a File",
- GTK_FILE_CHOOSER_ACTION_OPEN);
- gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
- gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
-
- label = gtk_label_new ("Folder:");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- picker = gtk_file_chooser_button_new ("Pick a Folder",
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
- gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
- gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
-
- label = gtk_label_new ("Mail:");
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (label, TRUE);
- picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
- gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
- gtk_grid_attach (GTK_GRID (table), label, 0, 4, 1, 1);
- gtk_grid_attach (GTK_GRID (table), picker, 1, 4, 1, 1);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/pixbufs.c b/gtk+-mingw/share/gtk-3.0/demo/pixbufs.c
deleted file mode 100644
index 9b29b5a..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/pixbufs.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* Pixbufs
- *
- * A GdkPixbuf represents an image, normally in RGB or RGBA format.
- * Pixbufs are normally used to load files from disk and perform
- * image scaling.
- *
- * This demo is not all that educational, but looks cool. It was written
- * by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows
- * off how to use GtkDrawingArea to do a simple animation.
- *
- * Look at the Image demo for additional pixbuf usage examples.
- *
- */
-
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <math.h>
-
-#include "demo-common.h"
-
-#define FRAME_DELAY 50
-
-#define BACKGROUND_NAME "background.jpg"
-
-static const char *image_names[] = {
- "apple-red.png",
- "gnome-applets.png",
- "gnome-calendar.png",
- "gnome-foot.png",
- "gnome-gmush.png",
- "gnome-gimp.png",
- "gnome-gsame.png",
- "gnu-keys.png"
-};
-
-#define N_IMAGES G_N_ELEMENTS (image_names)
-
-/* demo window */
-static GtkWidget *window = NULL;
-
-/* Current frame */
-static GdkPixbuf *frame;
-
-/* Background image */
-static GdkPixbuf *background;
-static gint back_width, back_height;
-
-/* Images */
-static GdkPixbuf *images[N_IMAGES];
-
-/* Widgets */
-static GtkWidget *da;
-
-/* Loads the images for the demo and returns whether the operation succeeded */
-static gboolean
-load_pixbufs (GError **error)
-{
- gint i;
- char *filename;
-
- if (background)
- return TRUE; /* already loaded earlier */
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- filename = demo_find_file (BACKGROUND_NAME, error);
- if (!filename)
- return FALSE; /* note that "error" was filled in and returned */
-
- background = gdk_pixbuf_new_from_file (filename, error);
- g_free (filename);
-
- if (!background)
- return FALSE; /* Note that "error" was filled with a GError */
-
- back_width = gdk_pixbuf_get_width (background);
- back_height = gdk_pixbuf_get_height (background);
-
- for (i = 0; i < N_IMAGES; i++)
- {
- filename = demo_find_file (image_names[i], error);
- if (!filename)
- return FALSE; /* Note that "error" was filled with a GError */
-
- images[i] = gdk_pixbuf_new_from_file (filename, error);
- g_free (filename);
-
- if (!images[i])
- return FALSE; /* Note that "error" was filled with a GError */
- }
-
- return TRUE;
-}
-
-/* Expose callback for the drawing area */
-static gint
-draw_cb (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
- cairo_paint (cr);
-
- return TRUE;
-}
-
-#define CYCLE_LEN 60
-
-static int frame_num;
-
-/* Timeout handler to regenerate the frame */
-static gint
-timeout (gpointer data)
-{
- double f;
- int i;
- double xmid, ymid;
- double radius;
-
- gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
- frame, 0, 0);
-
- f = (double) (frame_num % CYCLE_LEN) / CYCLE_LEN;
-
- xmid = back_width / 2.0;
- ymid = back_height / 2.0;
-
- radius = MIN (xmid, ymid) / 2.0;
-
- for (i = 0; i < N_IMAGES; i++)
- {
- double ang;
- int xpos, ypos;
- int iw, ih;
- double r;
- GdkRectangle r1, r2, dest;
- double k;
-
- ang = 2.0 * G_PI * (double) i / N_IMAGES - f * 2.0 * G_PI;
-
- iw = gdk_pixbuf_get_width (images[i]);
- ih = gdk_pixbuf_get_height (images[i]);
-
- r = radius + (radius / 3.0) * sin (f * 2.0 * G_PI);
-
- xpos = floor (xmid + r * cos (ang) - iw / 2.0 + 0.5);
- ypos = floor (ymid + r * sin (ang) - ih / 2.0 + 0.5);
-
- k = (i & 1) ? sin (f * 2.0 * G_PI) : cos (f * 2.0 * G_PI);
- k = 2.0 * k * k;
- k = MAX (0.25, k);
-
- r1.x = xpos;
- r1.y = ypos;
- r1.width = iw * k;
- r1.height = ih * k;
-
- r2.x = 0;
- r2.y = 0;
- r2.width = back_width;
- r2.height = back_height;
-
- if (gdk_rectangle_intersect (&r1, &r2, &dest))
- gdk_pixbuf_composite (images[i],
- frame,
- dest.x, dest.y,
- dest.width, dest.height,
- xpos, ypos,
- k, k,
- GDK_INTERP_NEAREST,
- ((i & 1)
- ? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
- : MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
- }
-
- GDK_THREADS_ENTER ();
- gtk_widget_queue_draw (da);
- GDK_THREADS_LEAVE ();
-
- frame_num++;
- return G_SOURCE_CONTINUE;
-}
-
-static guint timeout_id;
-
-static void
-cleanup_callback (GObject *object,
- gpointer data)
-{
- g_source_remove (timeout_id);
- timeout_id = 0;
-}
-
-GtkWidget *
-do_pixbufs (GtkWidget *do_widget)
-{
- if (!window)
- {
- GError *error;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- g_signal_connect (window, "destroy",
- G_CALLBACK (cleanup_callback), NULL);
-
-
- error = NULL;
- if (!load_pixbufs (&error))
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "Failed to load an image: %s",
- error->message);
-
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
- }
- else
- {
- gtk_widget_set_size_request (window, back_width, back_height);
-
- frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
-
- da = gtk_drawing_area_new ();
-
- g_signal_connect (da, "draw",
- G_CALLBACK (draw_cb), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), da);
-
- timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
- }
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- g_object_unref (frame);
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/printing.c b/gtk+-mingw/share/gtk-3.0/demo/printing.c
deleted file mode 100644
index 59835ea..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/printing.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Printing
- *
- * GtkPrintOperation offers a simple API to support printing
- * in a cross-platform way.
- *
- */
-
-#include <math.h>
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-/* In points */
-#define HEADER_HEIGHT (10*72/25.4)
-#define HEADER_GAP (3*72/25.4)
-
-typedef struct
-{
- gchar *filename;
- gdouble font_size;
-
- gint lines_per_page;
- gchar **lines;
- gint num_lines;
- gint num_pages;
-} PrintData;
-
-static void
-begin_print (GtkPrintOperation *operation,
- GtkPrintContext *context,
- gpointer user_data)
-{
- PrintData *data = (PrintData *)user_data;
- char *contents;
- int i;
- double height;
-
- height = gtk_print_context_get_height (context) - HEADER_HEIGHT - HEADER_GAP;
-
- data->lines_per_page = floor (height / data->font_size);
-
- g_file_get_contents (data->filename, &contents, NULL, NULL);
-
- data->lines = g_strsplit (contents, "\n", 0);
- g_free (contents);
-
- i = 0;
- while (data->lines[i] != NULL)
- i++;
-
- data->num_lines = i;
- data->num_pages = (data->num_lines - 1) / data->lines_per_page + 1;
-
- gtk_print_operation_set_n_pages (operation, data->num_pages);
-}
-
-static void
-draw_page (GtkPrintOperation *operation,
- GtkPrintContext *context,
- gint page_nr,
- gpointer user_data)
-{
- PrintData *data = (PrintData *)user_data;
- cairo_t *cr;
- PangoLayout *layout;
- gint text_width, text_height;
- gdouble width;
- gint line, i;
- PangoFontDescription *desc;
- gchar *page_str;
-
- cr = gtk_print_context_get_cairo_context (context);
- width = gtk_print_context_get_width (context);
-
- cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
-
- cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
- cairo_fill_preserve (cr);
-
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_set_line_width (cr, 1);
- cairo_stroke (cr);
-
- layout = gtk_print_context_create_pango_layout (context);
-
- desc = pango_font_description_from_string ("sans 14");
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
-
- pango_layout_set_text (layout, data->filename, -1);
- pango_layout_get_pixel_size (layout, &text_width, &text_height);
-
- if (text_width > width)
- {
- pango_layout_set_width (layout, width);
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_START);
- pango_layout_get_pixel_size (layout, &text_width, &text_height);
- }
-
- cairo_move_to (cr, (width - text_width) / 2, (HEADER_HEIGHT - text_height) / 2);
- pango_cairo_show_layout (cr, layout);
-
- page_str = g_strdup_printf ("%d/%d", page_nr + 1, data->num_pages);
- pango_layout_set_text (layout, page_str, -1);
- g_free (page_str);
-
- pango_layout_set_width (layout, -1);
- pango_layout_get_pixel_size (layout, &text_width, &text_height);
- cairo_move_to (cr, width - text_width - 4, (HEADER_HEIGHT - text_height) / 2);
- pango_cairo_show_layout (cr, layout);
-
- g_object_unref (layout);
-
- layout = gtk_print_context_create_pango_layout (context);
-
- desc = pango_font_description_from_string ("monospace");
- pango_font_description_set_size (desc, data->font_size * PANGO_SCALE);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
-
- cairo_move_to (cr, 0, HEADER_HEIGHT + HEADER_GAP);
- line = page_nr * data->lines_per_page;
- for (i = 0; i < data->lines_per_page && line < data->num_lines; i++)
- {
- pango_layout_set_text (layout, data->lines[line], -1);
- pango_cairo_show_layout (cr, layout);
- cairo_rel_move_to (cr, 0, data->font_size);
- line++;
- }
-
- g_object_unref (layout);
-}
-
-static void
-end_print (GtkPrintOperation *operation,
- GtkPrintContext *context,
- gpointer user_data)
-{
- PrintData *data = (PrintData *)user_data;
-
- g_free (data->filename);
- g_strfreev (data->lines);
- g_free (data);
-}
-
-
-GtkWidget *
-do_printing (GtkWidget *do_widget)
-{
- GtkPrintOperation *operation;
- GtkPrintSettings *settings;
- PrintData *data;
- gchar *uri, *ext;
- const gchar *dir;
- GError *error = NULL;
-
- operation = gtk_print_operation_new ();
- data = g_new0 (PrintData, 1);
- data->filename = demo_find_file ("printing.c", NULL);
- data->font_size = 12.0;
-
- g_signal_connect (G_OBJECT (operation), "begin-print",
- G_CALLBACK (begin_print), data);
- g_signal_connect (G_OBJECT (operation), "draw-page",
- G_CALLBACK (draw_page), data);
- g_signal_connect (G_OBJECT (operation), "end-print",
- G_CALLBACK (end_print), data);
-
- gtk_print_operation_set_use_full_page (operation, FALSE);
- gtk_print_operation_set_unit (operation, GTK_UNIT_POINTS);
- gtk_print_operation_set_embed_page_setup (operation, TRUE);
-
- settings = gtk_print_settings_new ();
- dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
- if (dir == NULL)
- dir = g_get_home_dir ();
- if (g_strcmp0 (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT), "ps") == 0)
- ext = ".ps";
- else if (g_strcmp0 (gtk_print_settings_get (settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT), "svg") == 0)
- ext = ".svg";
- else
- ext = ".pdf";
-
- uri = g_strconcat ("file://", dir, "/", "gtk-demo", ext, NULL);
- gtk_print_settings_set (settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri);
- gtk_print_operation_set_print_settings (operation, settings);
-
- gtk_print_operation_run (operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW (do_widget), &error);
-
- g_object_unref (operation);
- g_object_unref (settings);
- g_free (uri);
-
- if (error)
- {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (do_widget),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s", error->message);
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
- }
-
-
- return NULL;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/reset.css b/gtk+-mingw/share/gtk-3.0/demo/reset.css
deleted file mode 100644
index 1c27a8e..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/reset.css
+++ /dev/null
@@ -1,68 +0,0 @@
-/* @import this colorsheet to get the default values for every property.
- * This is useful when writing special CSS tests that should not be
- * inluenced by themes - not even the default ones.
- * Keep in mind that the output will be very ugly and not look like
- * anything GTK.
- * Also, when adding new style properties, please add them here.
- */
-
-* {
- color: inherit;
- font-size: inherit;
- background-color: initial;
- font-family: inherit;
- font-style: inherit;
- font-variant: inherit;
- font-weight: inherit;
- text-shadow: inherit;
- icon-shadow: inherit;
- box-shadow: initial;
- margin-top: initial;
- margin-left: initial;
- margin-bottom: initial;
- margin-right: initial;
- padding-top: initial;
- padding-left: initial;
- padding-bottom: initial;
- padding-right: initial;
- border-top-style: initial;
- border-top-width: initial;
- border-left-style: initial;
- border-left-width: initial;
- border-bottom-style: initial;
- border-bottom-width: initial;
- border-right-style: initial;
- border-right-width: initial;
- border-top-left-radius: initial;
- border-top-right-radius: initial;
- border-bottom-right-radius: initial;
- border-bottom-left-radius: initial;
- outline-style: initial;
- outline-width: initial;
- outline-offset: initial;
- background-clip: initial;
- background-origin: initial;
- background-size: initial;
- background-position: initial;
- border-top-color: initial;
- border-right-color: initial;
- border-bottom-color: initial;
- border-left-color: initial;
- outline-color: initial;
- background-repeat: initial;
- background-image: initial;
- border-image-source: initial;
- border-image-repeat: initial;
- border-image-slice: initial;
- border-image-width: initial;
- transition-property: initial;
- transition-duration: initial;
- transition-timing-function: initial;
- transition-delay: initial;
- engine: initial;
- gtk-key-bindings: initial;
-
- -GtkWidget-focus-line-width: 0;
- -GtkWidget-focus-padding: 0;
- -GtkNotebook-initial-gap: 0;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/rotated_text.c b/gtk+-mingw/share/gtk-3.0/demo/rotated_text.c
deleted file mode 100644
index c83030f..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/rotated_text.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Rotated Text
- *
- * This demo shows how to use PangoCairo to draw rotated and transformed
- * text. The right pane shows a rotated GtkLabel widget.
- *
- * In both cases, a custom PangoCairo shape renderer is installed to draw
- * a red heard using cairo drawing operations instead of the Unicode heart
- * character.
- */
-
-#include <gtk/gtk.h>
-#include <string.h>
-
-static GtkWidget *window = NULL;
-
-#define HEART "♥"
-const char text[] = "I ♥ GTK+";
-
-static void
-fancy_shape_renderer (cairo_t *cr,
- PangoAttrShape *attr,
- gboolean do_path,
- gpointer data)
-{
- double x, y;
- cairo_get_current_point (cr, &x, &y);
- cairo_translate (cr, x, y);
-
- cairo_scale (cr,
- (double) attr->ink_rect.width / PANGO_SCALE,
- (double) attr->ink_rect.height / PANGO_SCALE);
-
- switch (GPOINTER_TO_UINT (attr->data))
- {
- case 0x2665: /* U+2665 BLACK HEART SUIT */
- {
- cairo_move_to (cr, .5, .0);
- cairo_line_to (cr, .9, -.4);
- cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
- cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
- cairo_close_path (cr);
- }
- break;
- }
-
- if (!do_path) {
- cairo_set_source_rgb (cr, 1., 0., 0.);
- cairo_fill (cr);
- }
-}
-
-PangoAttrList *
-create_fancy_attr_list_for_layout (PangoLayout *layout)
-{
- PangoAttrList *attrs;
- PangoFontMetrics *metrics;
- int ascent;
- PangoRectangle ink_rect, logical_rect;
- const char *p;
-
- /* Get font metrics and prepare fancy shape size */
- metrics = pango_context_get_metrics (pango_layout_get_context (layout),
- pango_layout_get_font_description (layout),
- NULL);
- ascent = pango_font_metrics_get_ascent (metrics);
- logical_rect.x = 0;
- logical_rect.width = ascent;
- logical_rect.y = -ascent;
- logical_rect.height = ascent;
- ink_rect = logical_rect;
- pango_font_metrics_unref (metrics);
-
- /* Set fancy shape attributes for all hearts */
- attrs = pango_attr_list_new ();
- for (p = text; (p = strstr (p, HEART)); p += strlen (HEART))
- {
- PangoAttribute *attr;
-
- attr = pango_attr_shape_new_with_data (&ink_rect,
- &logical_rect,
- GUINT_TO_POINTER (g_utf8_get_char (p)),
- NULL, NULL);
-
- attr->start_index = p - text;
- attr->end_index = attr->start_index + strlen (HEART);
-
- pango_attr_list_insert (attrs, attr);
- }
-
- return attrs;
-}
-
-static gboolean
-rotated_text_draw (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
-#define RADIUS 150
-#define N_WORDS 5
-#define FONT "Serif 18"
-
- PangoContext *context;
- PangoLayout *layout;
- PangoFontDescription *desc;
-
- cairo_pattern_t *pattern;
-
- PangoAttrList *attrs;
-
- double device_radius;
- int width, height;
- int i;
-
- /* Create a cairo context and set up a transformation matrix so that the user
- * space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
- * [-RADIUS, RADIUS].
- * We first center, then change the scale. */
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
- device_radius = MIN (width, height) / 2.;
- cairo_translate (cr,
- device_radius + (width - 2 * device_radius) / 2,
- device_radius + (height - 2 * device_radius) / 2);
- cairo_scale (cr, device_radius / RADIUS, device_radius / RADIUS);
-
- /* Create and a subtle gradient source and use it. */
- pattern = cairo_pattern_create_linear (-RADIUS, -RADIUS, RADIUS, RADIUS);
- cairo_pattern_add_color_stop_rgb (pattern, 0., .5, .0, .0);
- cairo_pattern_add_color_stop_rgb (pattern, 1., .0, .0, .5);
- cairo_set_source (cr, pattern);
-
- /* Create a PangoContext and set up our shape renderer */
- context = gtk_widget_create_pango_context (widget);
- pango_cairo_context_set_shape_renderer (context,
- fancy_shape_renderer,
- NULL, NULL);
-
- /* Create a PangoLayout, set the text, font, and attributes */
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, text, -1);
- desc = pango_font_description_from_string (FONT);
- pango_layout_set_font_description (layout, desc);
-
- attrs = create_fancy_attr_list_for_layout (layout);
- pango_layout_set_attributes (layout, attrs);
- pango_attr_list_unref (attrs);
-
- /* Draw the layout N_WORDS times in a circle */
- for (i = 0; i < N_WORDS; i++)
- {
- int width, height;
-
- /* Inform Pango to re-layout the text with the new transformation matrix */
- pango_cairo_update_layout (cr, layout);
-
- pango_layout_get_pixel_size (layout, &width, &height);
- cairo_move_to (cr, - width / 2, - RADIUS * .9);
- pango_cairo_show_layout (cr, layout);
-
- /* Rotate for the next turn */
- cairo_rotate (cr, G_PI*2 / N_WORDS);
- }
-
- /* free the objects we created */
- pango_font_description_free (desc);
- g_object_unref (layout);
- g_object_unref (context);
- cairo_pattern_destroy (pattern);
-
- return FALSE;
-}
-
-GtkWidget *
-do_rotated_text (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *box;
- GtkWidget *drawing_area;
- GtkWidget *label;
- PangoLayout *layout;
- PangoAttrList *attrs;
-
- const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
- gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
- gtk_container_add (GTK_CONTAINER (window), box);
-
- /* Add a drawing area */
-
- drawing_area = gtk_drawing_area_new ();
- gtk_container_add (GTK_CONTAINER (box), drawing_area);
-
- /* This overrides the background color from the theme */
- gtk_widget_override_background_color (drawing_area, 0, &white);
-
- g_signal_connect (drawing_area, "draw",
- G_CALLBACK (rotated_text_draw), NULL);
-
- /* And a label */
-
- label = gtk_label_new (text);
- gtk_container_add (GTK_CONTAINER (box), label);
-
- gtk_label_set_angle (GTK_LABEL (label), 45);
-
- /* Set up fancy stuff on the label */
- layout = gtk_label_get_layout (GTK_LABEL (label));
- pango_cairo_context_set_shape_renderer (pango_layout_get_context (layout),
- fancy_shape_renderer,
- NULL, NULL);
- attrs = create_fancy_attr_list_for_layout (layout);
- gtk_label_set_attributes (GTK_LABEL (label), attrs);
- pango_attr_list_unref (attrs);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/search_entry.c b/gtk+-mingw/share/gtk-3.0/demo/search_entry.c
deleted file mode 100644
index 03b7288..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/search_entry.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* Entry/Search Entry
- *
- * GtkEntry allows to display icons and progress information.
- * This demo shows how to use these features in a search entry.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-static GtkWidget *menu = NULL;
-static GtkWidget *notebook = NULL;
-
-static guint search_progress_id = 0;
-static guint finish_search_id = 0;
-
-static void
-show_find_button (void)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
-}
-
-static void
-show_cancel_button (void)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
-}
-
-static gboolean
-search_progress (gpointer data)
-{
- gtk_entry_progress_pulse (GTK_ENTRY (data));
- return G_SOURCE_CONTINUE;
-}
-
-static void
-search_progress_done (GtkEntry *entry)
-{
- gtk_entry_set_progress_fraction (entry, 0.0);
-}
-
-static gboolean
-finish_search (GtkButton *button)
-{
- show_find_button ();
- g_source_remove (search_progress_id);
- search_progress_id = 0;
-
- return FALSE;
-}
-
-static gboolean
-start_search_feedback (gpointer data)
-{
- search_progress_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 100,
- (GSourceFunc)search_progress, data,
- (GDestroyNotify)search_progress_done);
- return FALSE;
-}
-
-static void
-start_search (GtkButton *button,
- GtkEntry *entry)
-{
- show_cancel_button ();
- search_progress_id = g_timeout_add_seconds (1, (GSourceFunc)start_search_feedback, entry);
- finish_search_id = g_timeout_add_seconds (15, (GSourceFunc)finish_search, button);
-}
-
-
-static void
-stop_search (GtkButton *button,
- gpointer data)
-{
- g_source_remove (finish_search_id);
- finish_search (button);
-}
-
-static void
-clear_entry (GtkEntry *entry)
-{
- gtk_entry_set_text (entry, "");
-}
-
-static void
-search_by_name (GtkWidget *item,
- GtkEntry *entry)
-{
- gtk_entry_set_icon_from_stock (entry,
- GTK_ENTRY_ICON_PRIMARY,
- GTK_STOCK_FIND);
- gtk_entry_set_icon_tooltip_text (entry,
- GTK_ENTRY_ICON_PRIMARY,
- "Search by name\n"
- "Click here to change the search type");
- gtk_entry_set_placeholder_text (entry, "name");
-}
-
-static void
-search_by_description (GtkWidget *item,
- GtkEntry *entry)
-{
- gtk_entry_set_icon_from_stock (entry,
- GTK_ENTRY_ICON_PRIMARY,
- GTK_STOCK_EDIT);
- gtk_entry_set_icon_tooltip_text (entry,
- GTK_ENTRY_ICON_PRIMARY,
- "Search by description\n"
- "Click here to change the search type");
- gtk_entry_set_placeholder_text (entry, "description");
-}
-
-static void
-search_by_file (GtkWidget *item,
- GtkEntry *entry)
-{
- gtk_entry_set_icon_from_stock (entry,
- GTK_ENTRY_ICON_PRIMARY,
- GTK_STOCK_OPEN);
- gtk_entry_set_icon_tooltip_text (entry,
- GTK_ENTRY_ICON_PRIMARY,
- "Search by file name\n"
- "Click here to change the search type");
- gtk_entry_set_placeholder_text (entry, "file name");
-}
-
-GtkWidget *
-create_search_menu (GtkWidget *entry)
-{
- GtkWidget *menu;
- GtkWidget *item;
- GtkWidget *image;
-
- menu = gtk_menu_new ();
-
- item = gtk_image_menu_item_new_with_mnemonic ("Search by _name");
- image = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
- g_signal_connect (item, "activate",
- G_CALLBACK (search_by_name), entry);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_image_menu_item_new_with_mnemonic ("Search by _description");
- image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
- g_signal_connect (item, "activate",
- G_CALLBACK (search_by_description), entry);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_image_menu_item_new_with_mnemonic ("Search by _file name");
- image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
- g_signal_connect (item, "activate",
- G_CALLBACK (search_by_file), entry);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- gtk_widget_show_all (menu);
-
- return menu;
-}
-
-static void
-icon_press_cb (GtkEntry *entry,
- gint position,
- GdkEventButton *event,
- gpointer data)
-{
- if (position == GTK_ENTRY_ICON_PRIMARY)
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
- else
- clear_entry (entry);
-}
-
-static void
-text_changed_cb (GtkEntry *entry,
- GParamSpec *pspec,
- GtkWidget *button)
-{
- gboolean has_text;
-
- has_text = gtk_entry_get_text_length (entry) > 0;
- gtk_entry_set_icon_sensitive (entry,
- GTK_ENTRY_ICON_SECONDARY,
- has_text);
- gtk_widget_set_sensitive (button, has_text);
-}
-
-static void
-activate_cb (GtkEntry *entry,
- GtkButton *button)
-{
- if (search_progress_id != 0)
- return;
-
- start_search (button, entry);
-
-}
-
-static void
-search_entry_destroyed (GtkWidget *widget)
-{
- if (finish_search_id != 0)
- g_source_remove (finish_search_id);
-
- if (search_progress_id != 0)
- g_source_remove (search_progress_id);
-
- window = NULL;
-}
-
-static void
-entry_populate_popup (GtkEntry *entry,
- GtkMenu *menu,
- gpointer user_data)
-{
- GtkWidget *item;
- GtkWidget *search_menu;
- gboolean has_text;
-
- has_text = gtk_entry_get_text_length (entry) > 0;
-
- item = gtk_separator_menu_item_new ();
- gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- item = gtk_menu_item_new_with_mnemonic ("C_lear");
- gtk_widget_show (item);
- g_signal_connect_swapped (item, "activate",
- G_CALLBACK (clear_entry), entry);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_set_sensitive (item, has_text);
-
- search_menu = create_search_menu (GTK_WIDGET (entry));
- item = gtk_menu_item_new_with_label ("Search by");
- gtk_widget_show (item);
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), search_menu);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-}
-
-GtkWidget *
-do_search_entry (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *button;
- GtkWidget *find_button;
- GtkWidget *cancel_button;
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("Search Entry",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (search_entry_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
-
- /* Create our entry */
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
-
- /* Create the find and cancel buttons */
- notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), notebook, FALSE, FALSE, 0);
-
- find_button = gtk_button_new_with_label ("Find");
- g_signal_connect (find_button, "clicked",
- G_CALLBACK (start_search), entry);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), find_button, NULL);
- gtk_widget_show (find_button);
-
- cancel_button = gtk_button_new_with_label ("Cancel");
- g_signal_connect (cancel_button, "clicked",
- G_CALLBACK (stop_search), NULL);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), cancel_button, NULL);
- gtk_widget_show (cancel_button);
-
- /* Set up the search icon */
- search_by_name (NULL, GTK_ENTRY (entry));
-
- /* Set up the clear icon */
- gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
- GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_CLEAR);
- text_changed_cb (GTK_ENTRY (entry), NULL, find_button);
-
- g_signal_connect (entry, "icon-press",
- G_CALLBACK (icon_press_cb), NULL);
- g_signal_connect (entry, "notify::text",
- G_CALLBACK (text_changed_cb), find_button);
- g_signal_connect (entry, "activate",
- G_CALLBACK (activate_cb), NULL);
-
- /* Create the menu */
- menu = create_search_menu (entry);
- gtk_menu_attach_to_widget (GTK_MENU (menu), entry, NULL);
-
- /* add accessible alternatives for icon functionality */
- g_signal_connect (entry, "populate-popup",
- G_CALLBACK (entry_populate_popup), NULL);
-
- /* Give the focus to the close button */
- button = gtk_dialog_get_widget_for_response (GTK_DIALOG (window), GTK_RESPONSE_NONE);
- gtk_widget_grab_focus (button);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (menu);
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/sizegroup.c b/gtk+-mingw/share/gtk-3.0/demo/sizegroup.c
deleted file mode 100644
index a031396..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/sizegroup.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Size Groups
- *
- * GtkSizeGroup provides a mechanism for grouping a number of
- * widgets together so they all request the same amount of space.
- * This is typically useful when you want a column of widgets to
- * have the same size, but you can't use a GtkTable widget.
- *
- * Note that size groups only affect the amount of space requested,
- * not the size that the widgets finally receive. If you want the
- * widgets in a GtkSizeGroup to actually be the same size, you need
- * to pack them in such a way that they get the size they request
- * and not more. For example, if you are packing your widgets
- * into a table, you would not include the GTK_FILL flag.
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-/* Convenience function to create a combo box holding a number of strings
- */
-GtkWidget *
-create_combo_box (const char **strings)
-{
- GtkWidget *combo_box;
- const char **str;
-
- combo_box = gtk_combo_box_text_new ();
-
- for (str = strings; *str; str++)
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
-
- return combo_box;
-}
-
-static void
-add_row (GtkGrid *table,
- int row,
- GtkSizeGroup *size_group,
- const char *label_text,
- const char **options)
-{
- GtkWidget *combo_box;
- GtkWidget *label;
-
- label = gtk_label_new_with_mnemonic (label_text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_widget_set_valign (label, GTK_ALIGN_END);
- gtk_widget_set_hexpand (label, TRUE);
- gtk_grid_attach (table, label, 0, row, 1, 1);
-
- combo_box = create_combo_box (options);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
- gtk_size_group_add_widget (size_group, combo_box);
- gtk_grid_attach (table, combo_box, 1, row, 1, 1);
-}
-
-static void
-toggle_grouping (GtkToggleButton *check_button,
- GtkSizeGroup *size_group)
-{
- GtkSizeGroupMode new_mode;
-
- /* GTK_SIZE_GROUP_NONE is not generally useful, but is useful
- * here to show the effect of GTK_SIZE_GROUP_HORIZONTAL by
- * contrast.
- */
- if (gtk_toggle_button_get_active (check_button))
- new_mode = GTK_SIZE_GROUP_HORIZONTAL;
- else
- new_mode = GTK_SIZE_GROUP_NONE;
-
- gtk_size_group_set_mode (size_group, new_mode);
-}
-
-GtkWidget *
-do_sizegroup (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *table;
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *check_button;
- GtkSizeGroup *size_group;
-
- static const char *color_options[] = {
- "Red", "Green", "Blue", NULL
- };
-
- static const char *dash_options[] = {
- "Solid", "Dashed", "Dotted", NULL
- };
-
- static const char *end_options[] = {
- "Square", "Round", "Arrow", NULL
- };
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- /* Create one frame holding color options */
- frame = gtk_frame_new ("Color Options");
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
-
- table = gtk_grid_new ();
- gtk_container_set_border_width (GTK_CONTAINER (table), 5);
- gtk_grid_set_row_spacing (GTK_GRID (table), 5);
- gtk_grid_set_column_spacing (GTK_GRID (table), 10);
- gtk_container_add (GTK_CONTAINER (frame), table);
-
- add_row (GTK_GRID (table), 0, size_group, "_Foreground", color_options);
- add_row (GTK_GRID (table), 1, size_group, "_Background", color_options);
-
- /* And another frame holding line style options */
- frame = gtk_frame_new ("Line Options");
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- table = gtk_grid_new ();
- gtk_container_set_border_width (GTK_CONTAINER (table), 5);
- gtk_grid_set_row_spacing (GTK_GRID (table), 5);
- gtk_grid_set_column_spacing (GTK_GRID (table), 10);
- gtk_container_add (GTK_CONTAINER (frame), table);
-
- add_row (GTK_GRID (table), 0, size_group, "_Dashing", dash_options);
- add_row (GTK_GRID (table), 1, size_group, "_Line ends", end_options);
-
- /* And a check button to turn grouping on and off */
- check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping");
- gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (toggle_grouping), size_group);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/spinner.c b/gtk+-mingw/share/gtk-3.0/demo/spinner.c
deleted file mode 100644
index 8aa5173..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/spinner.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Spinner
- *
- * GtkSpinner allows to show that background activity is on-going.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-static GtkWidget *spinner_sensitive = NULL;
-static GtkWidget *spinner_unsensitive = NULL;
-
-static void
-on_play_clicked (GtkButton *button, gpointer user_data)
-{
- gtk_spinner_start (GTK_SPINNER (spinner_sensitive));
- gtk_spinner_start (GTK_SPINNER (spinner_unsensitive));
-}
-
-static void
-on_stop_clicked (GtkButton *button, gpointer user_data)
-{
- gtk_spinner_stop (GTK_SPINNER (spinner_sensitive));
- gtk_spinner_stop (GTK_SPINNER (spinner_unsensitive));
-}
-
-GtkWidget *
-do_spinner (GtkWidget *do_widget)
-{
- GtkWidget *content_area;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *button;
- GtkWidget *spinner;
-
- if (!window)
- {
- window = gtk_dialog_new_with_buttons ("GtkSpinner",
- GTK_WINDOW (do_widget),
- 0,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_NONE,
- NULL);
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-
- /* Sensitive */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- spinner = gtk_spinner_new ();
- gtk_container_add (GTK_CONTAINER (hbox), spinner);
- gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- spinner_sensitive = spinner;
-
- /* Disabled */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- spinner = gtk_spinner_new ();
- gtk_container_add (GTK_CONTAINER (hbox), spinner);
- gtk_container_add (GTK_CONTAINER (hbox), gtk_entry_new ());
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- spinner_unsensitive = spinner;
- gtk_widget_set_sensitive (hbox, FALSE);
-
- button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (on_play_clicked), spinner);
- gtk_container_add (GTK_CONTAINER (vbox), button);
-
- button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (on_stop_clicked), spinner);
- gtk_container_add (GTK_CONTAINER (vbox), button);
-
- /* Start by default to test for:
- * https://bugzilla.gnome.org/show_bug.cgi?id=598496 */
- on_play_clicked (NULL, NULL);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/stock_browser.c b/gtk+-mingw/share/gtk-3.0/demo/stock_browser.c
deleted file mode 100644
index 06ccb8c..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/stock_browser.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/* Stock Item and Icon Browser
- *
- * This source code for this demo doesn't demonstrate anything
- * particularly useful in applications. The purpose of the "demo" is
- * just to provide a handy place to browse the available stock icons
- * and stock items.
- */
-
-#include <string.h>
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-typedef struct _StockItemInfo StockItemInfo;
-struct _StockItemInfo
-{
- gchar *id;
- GtkStockItem item;
- GdkPixbuf *small_icon;
- gchar *macro;
- gchar *accel_str;
-};
-
-/* Make StockItemInfo a boxed type so we can automatically
- * manage memory
- */
-#define STOCK_ITEM_INFO_TYPE stock_item_info_get_type ()
-
-static void
-stock_item_info_free (StockItemInfo *info)
-{
- g_free (info->id);
- g_free (info->macro);
- g_free (info->accel_str);
- if (info->small_icon)
- g_object_unref (info->small_icon);
-
- g_free (info);
-}
-
-static StockItemInfo*
-stock_item_info_copy (StockItemInfo *src)
-{
- StockItemInfo *info;
-
- info = g_new (StockItemInfo, 1);
- info->id = g_strdup (src->id);
- info->macro = g_strdup (src->macro);
- info->accel_str = g_strdup (src->accel_str);
-
- info->item = src->item;
-
- info->small_icon = src->small_icon;
- if (info->small_icon)
- g_object_ref (info->small_icon);
-
- return info;
-}
-
-static
-G_DEFINE_BOXED_TYPE (StockItemInfo, stock_item_info,
- stock_item_info_copy,
- stock_item_info_free)
-
-typedef struct _StockItemDisplay StockItemDisplay;
-struct _StockItemDisplay
-{
- GtkWidget *type_label;
- GtkWidget *macro_label;
- GtkWidget *id_label;
- GtkWidget *label_accel_label;
- GtkWidget *icon_image;
-};
-
-static gchar*
-id_to_macro (const gchar *id)
-{
- GString *macro = NULL;
- const gchar *cp;
-
- /* gtk-foo-bar -> GTK_STOCK_FOO_BAR */
-
- macro = g_string_new (NULL);
-
- cp = id;
-
- if (strncmp (cp, "gtk-", 4) == 0)
- {
- g_string_append (macro, "GTK_STOCK_");
- cp += 4;
- }
-
- while (*cp)
- {
- if (*cp == '-')
- g_string_append_c (macro, '_');
- else if (g_ascii_islower (*cp))
- g_string_append_c (macro, g_ascii_toupper (*cp));
- else
- g_string_append_c (macro, *cp);
-
- cp++;
- }
-
- return g_string_free (macro, FALSE);
-}
-
-static GtkTreeModel*
-create_model (void)
-{
- GtkListStore *store;
- GSList *ids;
- GSList *tmp_list;
-
- store = gtk_list_store_new (2, STOCK_ITEM_INFO_TYPE, G_TYPE_STRING);
-
- ids = gtk_stock_list_ids ();
- ids = g_slist_sort (ids, (GCompareFunc) strcmp);
- tmp_list = ids;
- while (tmp_list != NULL)
- {
- StockItemInfo info;
- GtkStockItem item;
- GtkTreeIter iter;
- GtkIconSet *icon_set;
-
- info.id = tmp_list->data;
-
- if (gtk_stock_lookup (info.id, &item))
- {
- info.item = item;
- }
- else
- {
- info.item.label = NULL;
- info.item.stock_id = NULL;
- info.item.modifier = 0;
- info.item.keyval = 0;
- info.item.translation_domain = NULL;
- }
-
- /* only show icons for stock IDs that have default icons */
- icon_set = gtk_icon_factory_lookup_default (info.id);
- if (icon_set)
- {
- GtkIconSize *sizes = NULL;
- gint n_sizes = 0;
- gint i;
- GtkIconSize size;
-
- /* See what sizes this stock icon really exists at */
- gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
-
- /* Use menu size if it exists, otherwise first size found */
- size = sizes[0];
- i = 0;
- while (i < n_sizes)
- {
- if (sizes[i] == GTK_ICON_SIZE_MENU)
- {
- size = GTK_ICON_SIZE_MENU;
- break;
- }
- ++i;
- }
- g_free (sizes);
-
- info.small_icon = gtk_widget_render_icon_pixbuf (window,
- info.id,
- size);
-
- if (size != GTK_ICON_SIZE_MENU)
- {
- /* Make the result the proper size for our thumbnail */
- gint w, h;
- GdkPixbuf *scaled;
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
-
- scaled = gdk_pixbuf_scale_simple (info.small_icon,
- w, h,
- GDK_INTERP_BILINEAR);
-
- g_object_unref (info.small_icon);
- info.small_icon = scaled;
- }
- }
- else
- info.small_icon = NULL;
-
- if (info.item.keyval != 0)
- {
- info.accel_str = gtk_accelerator_name (info.item.keyval,
- info.item.modifier);
- }
- else
- {
- info.accel_str = g_strdup ("");
- }
-
- info.macro = id_to_macro (info.id);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, &info, 1, info.id, -1);
-
- g_free (info.macro);
- g_free (info.accel_str);
- if (info.small_icon)
- g_object_unref (info.small_icon);
-
- tmp_list = g_slist_next (tmp_list);
- }
-
- g_slist_foreach (ids, (GFunc)g_free, NULL);
- g_slist_free (ids);
-
- return GTK_TREE_MODEL (store);
-}
-
-/* Finds the largest size at which the given image stock id is
- * available. This would not be useful for a normal application
- */
-static GtkIconSize
-get_largest_size (const char *id)
-{
- GtkIconSet *set = gtk_icon_factory_lookup_default (id);
- GtkIconSize *sizes;
- gint n_sizes, i;
- GtkIconSize best_size = GTK_ICON_SIZE_INVALID;
- gint best_pixels = 0;
-
- gtk_icon_set_get_sizes (set, &sizes, &n_sizes);
-
- for (i = 0; i < n_sizes; i++)
- {
- gint width, height;
-
- gtk_icon_size_lookup (sizes[i], &width, &height);
-
- if (width * height > best_pixels)
- {
- best_size = sizes[i];
- best_pixels = width * height;
- }
- }
-
- g_free (sizes);
-
- return best_size;
-}
-
-static void
-selection_changed (GtkTreeSelection *selection)
-{
- GtkTreeView *treeview;
- StockItemDisplay *display;
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- treeview = gtk_tree_selection_get_tree_view (selection);
- display = g_object_get_data (G_OBJECT (treeview), "stock-display");
-
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- StockItemInfo *info;
- gchar *str;
-
- gtk_tree_model_get (model, &iter,
- 0, &info,
- -1);
-
- if (info->small_icon && info->item.label)
- gtk_label_set_text (GTK_LABEL (display->type_label), "Icon and Item");
- else if (info->small_icon)
- gtk_label_set_text (GTK_LABEL (display->type_label), "Icon Only");
- else if (info->item.label)
- gtk_label_set_text (GTK_LABEL (display->type_label), "Item Only");
- else
- gtk_label_set_text (GTK_LABEL (display->type_label), "???????");
-
- gtk_label_set_text (GTK_LABEL (display->macro_label), info->macro);
- gtk_label_set_text (GTK_LABEL (display->id_label), info->id);
-
- if (info->item.label)
- {
- str = g_strdup_printf ("%s %s", info->item.label, info->accel_str);
- gtk_label_set_text_with_mnemonic (GTK_LABEL (display->label_accel_label), str);
- g_free (str);
- }
- else
- {
- gtk_label_set_text (GTK_LABEL (display->label_accel_label), "");
- }
-
- if (info->small_icon)
- gtk_image_set_from_stock (GTK_IMAGE (display->icon_image), info->id,
- get_largest_size (info->id));
- else
- gtk_image_set_from_pixbuf (GTK_IMAGE (display->icon_image), NULL);
-
- stock_item_info_free (info);
- }
- else
- {
- gtk_label_set_text (GTK_LABEL (display->type_label), "No selected item");
- gtk_label_set_text (GTK_LABEL (display->macro_label), "");
- gtk_label_set_text (GTK_LABEL (display->id_label), "");
- gtk_label_set_text (GTK_LABEL (display->label_accel_label), "");
- gtk_image_set_from_pixbuf (GTK_IMAGE (display->icon_image), NULL);
- }
-}
-
-static void
-macro_set_func_text (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- StockItemInfo *info;
-
- gtk_tree_model_get (model, iter,
- 0, &info,
- -1);
-
- g_object_set (GTK_CELL_RENDERER (cell),
- "text", info->macro,
- NULL);
-
- stock_item_info_free (info);
-}
-
-static void
-id_set_func (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- StockItemInfo *info;
-
- gtk_tree_model_get (model, iter,
- 0, &info,
- -1);
-
- g_object_set (GTK_CELL_RENDERER (cell),
- "text", info->id,
- NULL);
-
- stock_item_info_free (info);
-}
-
-static void
-accel_set_func (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- StockItemInfo *info;
-
- gtk_tree_model_get (model, iter,
- 0, &info,
- -1);
-
- g_object_set (GTK_CELL_RENDERER (cell),
- "text", info->accel_str,
- NULL);
-
- stock_item_info_free (info);
-}
-
-static void
-label_set_func (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- StockItemInfo *info;
-
- gtk_tree_model_get (model, iter,
- 0, &info,
- -1);
-
- g_object_set (GTK_CELL_RENDERER (cell),
- "text", info->item.label,
- NULL);
-
- stock_item_info_free (info);
-}
-
-GtkWidget *
-do_stock_browser (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *sw;
- GtkWidget *treeview;
- GtkTreeModel *model;
- GtkCellRenderer *cell_renderer;
- StockItemDisplay *display;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items");
- gtk_window_set_default_size (GTK_WINDOW (window), -1, 500);
-
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_container_add (GTK_CONTAINER (window), hbox);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (hbox), sw, FALSE, FALSE, 0);
-
- model = create_model ();
-
- treeview = gtk_tree_view_new_with_model (model);
-
- g_object_unref (model);
-
- gtk_container_add (GTK_CONTAINER (sw), treeview);
-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_title (column, "Macro");
-
- cell_renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column,
- cell_renderer,
- FALSE);
- gtk_tree_view_column_set_attributes (column, cell_renderer,
- "stock_id", 1, NULL);
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column,
- cell_renderer,
- TRUE);
- gtk_tree_view_column_set_cell_data_func (column, cell_renderer,
- macro_set_func_text, NULL, NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview),
- column);
-
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
- -1,
- "Label",
- cell_renderer,
- label_set_func,
- NULL,
- NULL);
-
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
- -1,
- "Accel",
- cell_renderer,
- accel_set_func,
- NULL,
- NULL);
-
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
- -1,
- "ID",
- cell_renderer,
- id_set_func,
- NULL,
- NULL);
-
- frame = gtk_frame_new ("Selected Item");
- gtk_widget_set_valign (frame, GTK_ALIGN_START);
- gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- display = g_new (StockItemDisplay, 1);
- g_object_set_data_full (G_OBJECT (treeview),
- "stock-display",
- display,
- g_free); /* free display with treeview */
-
- display->type_label = gtk_label_new (NULL);
- display->macro_label = gtk_label_new (NULL);
- display->id_label = gtk_label_new (NULL);
- display->label_accel_label = gtk_label_new (NULL);
- display->icon_image = gtk_image_new_from_pixbuf (NULL); /* empty image */
-
- gtk_box_pack_start (GTK_BOX (vbox), display->type_label,
- FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), display->icon_image,
- FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), display->label_accel_label,
- FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), display->macro_label,
- FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), display->id_label,
- FALSE, FALSE, 0);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- g_signal_connect (selection,
- "changed",
- G_CALLBACK (selection_changed),
- NULL);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/textscroll.c b/gtk+-mingw/share/gtk-3.0/demo/textscroll.c
deleted file mode 100644
index dae9b43..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/textscroll.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Text Widget/Automatic scrolling
- *
- * This example demonstrates how to use the gravity of
- * GtkTextMarks to keep a text view scrolled to the bottom
- * while appending text.
- */
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-/* Scroll to the end of the buffer.
- */
-static gboolean
-scroll_to_end (GtkTextView *textview)
-{
- GtkTextBuffer *buffer;
- GtkTextIter iter;
- GtkTextMark *mark;
- char *spaces;
- static int count;
-
- buffer = gtk_text_view_get_buffer (textview);
-
- /* Get "end" mark. It's located at the end of buffer because
- * of right gravity
- */
- mark = gtk_text_buffer_get_mark (buffer, "end");
- gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
-
- /* and insert some text at its position, the iter will be
- * revalidated after insertion to point to the end of inserted text
- */
- spaces = g_strnfill (count++, ' ');
- gtk_text_buffer_insert (buffer, &iter, "\n", -1);
- gtk_text_buffer_insert (buffer, &iter, spaces, -1);
- gtk_text_buffer_insert (buffer, &iter,
- "Scroll to end scroll to end scroll "
- "to end scroll to end ",
- -1);
- g_free (spaces);
-
- /* Now scroll the end mark onscreen.
- */
- gtk_text_view_scroll_mark_onscreen (textview, mark);
-
- /* Emulate typewriter behavior, shift to the left if we
- * are far enough to the right.
- */
- if (count > 150)
- count = 0;
-
- return G_SOURCE_CONTINUE;
-}
-
-/* Scroll to the bottom of the buffer.
- */
-static gboolean
-scroll_to_bottom (GtkTextView *textview)
-{
- GtkTextBuffer *buffer;
- GtkTextIter iter;
- GtkTextMark *mark;
- char *spaces;
- static int count;
-
- buffer = gtk_text_view_get_buffer (textview);
-
- /* Get end iterator */
- gtk_text_buffer_get_end_iter (buffer, &iter);
-
- /* and insert some text at it, the iter will be revalidated
- * after insertion to point to the end of inserted text
- */
- spaces = g_strnfill (count++, ' ');
- gtk_text_buffer_insert (buffer, &iter, "\n", -1);
- gtk_text_buffer_insert (buffer, &iter, spaces, -1);
- gtk_text_buffer_insert (buffer, &iter,
- "Scroll to bottom scroll to bottom scroll "
- "to bottom scroll to bottom",
- -1);
- g_free (spaces);
-
- /* Move the iterator to the beginning of line, so we don't scroll
- * in horizontal direction
- */
- gtk_text_iter_set_line_offset (&iter, 0);
-
- /* and place the mark at iter. the mark will stay there after we
- * insert some text at the end because it has right gravity.
- */
- mark = gtk_text_buffer_get_mark (buffer, "scroll");
- gtk_text_buffer_move_mark (buffer, mark, &iter);
-
- /* Scroll the mark onscreen.
- */
- gtk_text_view_scroll_mark_onscreen (textview, mark);
-
- /* Shift text back if we got enough to the right.
- */
- if (count > 40)
- count = 0;
-
- return G_SOURCE_CONTINUE;
-}
-
-static guint
-setup_scroll (GtkTextView *textview,
- gboolean to_end)
-{
- GtkTextBuffer *buffer;
- GtkTextIter iter;
-
- buffer = gtk_text_view_get_buffer (textview);
- gtk_text_buffer_get_end_iter (buffer, &iter);
-
- if (to_end)
- {
- /* If we want to scroll to the end, including horizontal scrolling,
- * then we just create a mark with right gravity at the end of the
- * buffer. It will stay at the end unless explicitely moved with
- * gtk_text_buffer_move_mark.
- */
- gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
-
- /* Add scrolling timeout. */
- return g_timeout_add (50, (GSourceFunc) scroll_to_end, textview);
- }
- else
- {
- /* If we want to scroll to the bottom, but not scroll horizontally,
- * then an end mark won't do the job. Just create a mark so we can
- * use it with gtk_text_view_scroll_mark_onscreen, we'll position it
- * explicitely when needed. Use left gravity so the mark stays where
- * we put it after inserting new text.
- */
- gtk_text_buffer_create_mark (buffer, "scroll", &iter, TRUE);
-
- /* Add scrolling timeout. */
- return g_timeout_add (100, (GSourceFunc) scroll_to_bottom, textview);
- }
-}
-
-static void
-remove_timeout (GtkWidget *window,
- gpointer timeout)
-{
- g_source_remove (GPOINTER_TO_UINT (timeout));
-}
-
-static void
-create_text_view (GtkWidget *hbox,
- gboolean to_end)
-{
- GtkWidget *swindow;
- GtkWidget *textview;
- guint timeout;
-
- swindow = gtk_scrolled_window_new (NULL, NULL);
- gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0);
- textview = gtk_text_view_new ();
- gtk_container_add (GTK_CONTAINER (swindow), textview);
-
- timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
-
- /* Remove the timeout in destroy handler, so we don't try to
- * scroll destroyed widget.
- */
- g_signal_connect (textview, "destroy",
- G_CALLBACK (remove_timeout),
- GUINT_TO_POINTER (timeout));
-}
-
-GtkWidget *
-do_textscroll (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *hbox;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
- gtk_container_add (GTK_CONTAINER (window), hbox);
-
- create_text_view (hbox, TRUE);
- create_text_view (hbox, FALSE);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/textview.c b/gtk+-mingw/share/gtk-3.0/demo/textview.c
deleted file mode 100644
index dd966f7..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/textview.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/* Text Widget/Multiple Views
- *
- * The GtkTextView widget displays a GtkTextBuffer. One GtkTextBuffer
- * can be displayed by multiple GtkTextViews. This demo has two views
- * displaying a single buffer, and shows off the widget's text
- * formatting features.
- *
- */
-
-#include <gtk/gtk.h>
-#include <stdlib.h> /* for exit() */
-
-#include "demo-common.h"
-
-static void easter_egg_callback (GtkWidget *button, gpointer data);
-
-static void
-create_tags (GtkTextBuffer *buffer)
-{
- /* Create a bunch of tags. Note that it's also possible to
- * create tags with gtk_text_tag_new() then add them to the
- * tag table for the buffer, gtk_text_buffer_create_tag() is
- * just a convenience function. Also note that you don't have
- * to give tags a name; pass NULL for the name to create an
- * anonymous tag.
- *
- * In any real app, another useful optimization would be to create
- * a GtkTextTagTable in advance, and reuse the same tag table for
- * all the buffers with the same tag set, instead of creating
- * new copies of the same tags for every buffer.
- *
- * Tags are assigned default priorities in order of addition to the
- * tag table. That is, tags created later that affect the same text
- * property affected by an earlier tag will override the earlier
- * tag. You can modify tag priorities with
- * gtk_text_tag_set_priority().
- */
-
- gtk_text_buffer_create_tag (buffer, "heading",
- "weight", PANGO_WEIGHT_BOLD,
- "size", 15 * PANGO_SCALE,
- NULL);
-
- gtk_text_buffer_create_tag (buffer, "italic",
- "style", PANGO_STYLE_ITALIC, NULL);
-
- gtk_text_buffer_create_tag (buffer, "bold",
- "weight", PANGO_WEIGHT_BOLD, NULL);
-
- gtk_text_buffer_create_tag (buffer, "big",
- /* points times the PANGO_SCALE factor */
- "size", 20 * PANGO_SCALE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "xx-small",
- "scale", PANGO_SCALE_XX_SMALL, NULL);
-
- gtk_text_buffer_create_tag (buffer, "x-large",
- "scale", PANGO_SCALE_X_LARGE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "monospace",
- "family", "monospace", NULL);
-
- gtk_text_buffer_create_tag (buffer, "blue_foreground",
- "foreground", "blue", NULL);
-
- gtk_text_buffer_create_tag (buffer, "red_background",
- "background", "red", NULL);
-
- gtk_text_buffer_create_tag (buffer, "big_gap_before_line",
- "pixels_above_lines", 30, NULL);
-
- gtk_text_buffer_create_tag (buffer, "big_gap_after_line",
- "pixels_below_lines", 30, NULL);
-
- gtk_text_buffer_create_tag (buffer, "double_spaced_line",
- "pixels_inside_wrap", 10, NULL);
-
- gtk_text_buffer_create_tag (buffer, "not_editable",
- "editable", FALSE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "word_wrap",
- "wrap_mode", GTK_WRAP_WORD, NULL);
-
- gtk_text_buffer_create_tag (buffer, "char_wrap",
- "wrap_mode", GTK_WRAP_CHAR, NULL);
-
- gtk_text_buffer_create_tag (buffer, "no_wrap",
- "wrap_mode", GTK_WRAP_NONE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "center",
- "justification", GTK_JUSTIFY_CENTER, NULL);
-
- gtk_text_buffer_create_tag (buffer, "right_justify",
- "justification", GTK_JUSTIFY_RIGHT, NULL);
-
- gtk_text_buffer_create_tag (buffer, "wide_margins",
- "left_margin", 50, "right_margin", 50,
- NULL);
-
- gtk_text_buffer_create_tag (buffer, "strikethrough",
- "strikethrough", TRUE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "underline",
- "underline", PANGO_UNDERLINE_SINGLE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "double_underline",
- "underline", PANGO_UNDERLINE_DOUBLE, NULL);
-
- gtk_text_buffer_create_tag (buffer, "superscript",
- "rise", 10 * PANGO_SCALE, /* 10 pixels */
- "size", 8 * PANGO_SCALE, /* 8 points */
- NULL);
-
- gtk_text_buffer_create_tag (buffer, "subscript",
- "rise", -10 * PANGO_SCALE, /* 10 pixels */
- "size", 8 * PANGO_SCALE, /* 8 points */
- NULL);
-
- gtk_text_buffer_create_tag (buffer, "rtl_quote",
- "wrap_mode", GTK_WRAP_WORD,
- "direction", GTK_TEXT_DIR_RTL,
- "indent", 30,
- "left_margin", 20,
- "right_margin", 20,
- NULL);
-}
-
-static void
-insert_text (GtkTextBuffer *buffer)
-{
- GtkTextIter iter;
- GtkTextIter start, end;
- GdkPixbuf *pixbuf;
- GdkPixbuf *scaled;
- char *filename;
-
- /* demo_find_file() looks in the current directory first,
- * so you can run gtk-demo without installing GTK, then looks
- * in the location where the file is installed.
- */
- pixbuf = NULL;
- filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
- if (filename)
- {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- g_free (filename);
- }
-
- if (pixbuf == NULL)
- {
- g_printerr ("Failed to load image file gtk-logo-rgb.gif\n");
- exit (1);
- }
-
- scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
- pixbuf = scaled;
-
- /* get start of buffer; each insertion will revalidate the
- * iterator to point to just after the inserted text.
- */
- gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
-
- gtk_text_buffer_insert (buffer, &iter,
- "The text widget can display text with all kinds of nifty attributes. "
- "It also supports multiple views of the same buffer; this demo is "
- "showing the same buffer in two places.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Font styles. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter, "For example, you can have ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "italic", -1,
- "italic", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "bold", -1,
- "bold", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", or ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "monospace (typewriter)", -1,
- "monospace", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", or ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "big", -1,
- "big", NULL);
- gtk_text_buffer_insert (buffer, &iter, " text. ", -1);
- gtk_text_buffer_insert (buffer, &iter,
- "It's best not to hardcode specific text sizes; you can use relative "
- "sizes as with CSS, such as ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "xx-small", -1,
- "xx-small", NULL);
- gtk_text_buffer_insert (buffer, &iter, " or ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "x-large", -1,
- "x-large", NULL);
- gtk_text_buffer_insert (buffer, &iter,
- " to ensure that your program properly adapts if the user changes the "
- "default font size.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Colors. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter, "Colors such as ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "a blue foreground", -1,
- "blue_foreground", NULL);
- gtk_text_buffer_insert (buffer, &iter, " or ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "a red background", -1,
- "red_background", NULL);
- gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "a blue foreground on red background", -1,
- "blue_foreground",
- "red_background",
- NULL);
- gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Underline, strikethrough, and rise. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Strikethrough", -1,
- "strikethrough", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "underline", -1,
- "underline", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "double underline", -1,
- "double_underline", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "superscript", -1,
- "superscript", NULL);
- gtk_text_buffer_insert (buffer, &iter, ", and ", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "subscript", -1,
- "subscript", NULL);
- gtk_text_buffer_insert (buffer, &iter, " are all supported.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Images. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
- gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
- gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
- gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
- gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Spacing. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter,
- "You can adjust the amount of space before each line.\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "This line has a whole lot of space before it.\n", -1,
- "big_gap_before_line", "wide_margins", NULL);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "You can also adjust the amount of space after each line; "
- "this line has a whole lot of space after it.\n", -1,
- "big_gap_after_line", "wide_margins", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "You can also adjust the amount of space between wrapped lines; "
- "this line has extra space between each wrapped line in the same "
- "paragraph. To show off wrapping, some filler text: the quick "
- "brown fox jumped over the lazy dog. Blah blah blah blah blah "
- "blah blah blah blah.\n", -1,
- "double_spaced_line", "wide_margins", NULL);
-
- gtk_text_buffer_insert (buffer, &iter,
- "Also note that those lines have extra-wide margins.\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Editability. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "This line is 'locked down' and can't be edited by the user - just "
- "try it! You can't delete this line.\n\n", -1,
- "not_editable", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Wrapping. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter,
- "This line (and most of the others in this buffer) is word-wrapped, "
- "using the proper Unicode algorithm. Word wrap should work in all "
- "scripts and languages that GTK+ supports. Let's make this a long "
- "paragraph to demonstrate: blah blah blah blah blah blah blah blah "
- "blah blah blah blah blah blah blah blah blah blah blah\n\n", -1);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "This line has character-based wrapping, and can wrap between any two "
- "character glyphs. Let's make this a long paragraph to demonstrate: "
- "blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
- "blah blah blah blah blah\n\n", -1, "char_wrap", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "This line has all wrapping turned off, so it makes the horizontal "
- "scrollbar appear.\n\n\n", -1, "no_wrap", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Justification. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "\nThis line has center justification.\n", -1,
- "center", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "This line has right justification.\n", -1,
- "right_justify", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "\nThis line has big wide margins. Text text text text text text text "
- "text text text text text text text text text text text text text text "
- "text text text text text text text text text text text text text text "
- "text.\n", -1, "wide_margins", NULL);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "Internationalization. ", -1,
- "heading", NULL);
-
- gtk_text_buffer_insert (buffer, &iter,
- "You can put all sorts of Unicode text in the buffer.\n\nGerman "
- "(Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek "
- "(\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) "
- "\316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew "
- "\327\251\327\234\327\225\327\235\nJapanese "
- "(\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles "
- "bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, "
- "grapheme boundaries, and so on using the Pango internationalization "
- "framework.\n", -1);
-
- gtk_text_buffer_insert (buffer, &iter,
- "Here's a word-wrapped quote in a right-to-left language:\n", -1);
- gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
- "\331\210\331\202\330\257 \330\250\330\257\330\243 "
- "\330\253\331\204\330\247\330\253 \331\205\331\206 "
- "\330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 "
- "\330\252\331\202\330\257\331\205\330\247 \331\201\331\212 "
- "\330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 "
- "\330\250\330\261\330\247\331\205\330\254\331\207\330\247 "
- "\331\203\331\205\331\206\330\270\331\205\330\247\330\252 "
- "\331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 "
- "\330\253\331\205 \330\252\330\255\331\210\331\204\330\252 "
- "\331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 "
- "\330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 "
- "\330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 "
- "\331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 "
- "\331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 "
- "\331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 "
- "\330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 "
- "\330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 "
- "\331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 "
- "\331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 "
- "\330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 "
- "\330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 "
- "\330\243\331\203\330\253\330\261 \331\207\330\260\331\207 "
- "\330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 "
- "\331\206\330\254\330\247\330\255\330\247 \331\207\331\210 "
- "\302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 "
- "\331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", -1,
- "rtl_quote", NULL);
-
- gtk_text_buffer_insert (buffer, &iter,
- "You can put widgets in the buffer: Here's a button: ", -1);
- gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, " and a menu: ", -1);
- gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, " and a scale: ", -1);
- gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, " and an animation: ", -1);
- gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, " finally a text entry: ", -1);
- gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
-
- gtk_text_buffer_insert (buffer, &iter,
- "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; "
- "it leaves out, for example: invisible/hidden text, tab stops, "
- "application-drawn areas on the sides of the widget for displaying "
- "breakpoints and such...", -1);
-
- /* Apply word_wrap tag to whole buffer */
- gtk_text_buffer_get_bounds (buffer, &start, &end);
- gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
-
- g_object_unref (pixbuf);
-}
-
-static gboolean
-find_anchor (GtkTextIter *iter)
-{
- while (gtk_text_iter_forward_char (iter))
- {
- if (gtk_text_iter_get_child_anchor (iter))
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-attach_widgets (GtkTextView *text_view)
-{
- GtkTextIter iter;
- GtkTextBuffer *buffer;
- int i;
-
- buffer = gtk_text_view_get_buffer (text_view);
-
- gtk_text_buffer_get_start_iter (buffer, &iter);
-
- i = 0;
- while (find_anchor (&iter))
- {
- GtkTextChildAnchor *anchor;
- GtkWidget *widget;
-
- anchor = gtk_text_iter_get_child_anchor (&iter);
-
- if (i == 0)
- {
- widget = gtk_button_new_with_label ("Click Me");
-
- g_signal_connect (widget, "clicked",
- G_CALLBACK (easter_egg_callback),
- NULL);
- }
- else if (i == 1)
- {
- widget = gtk_combo_box_text_new ();
-
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
- }
- else if (i == 2)
- {
- widget = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
- gtk_range_set_range (GTK_RANGE (widget), 0, 100);
- gtk_widget_set_size_request (widget, 70, -1);
- }
- else if (i == 3)
- {
- gchar *filename = demo_find_file ("floppybuddy.gif", NULL);
- widget = gtk_image_new_from_file (filename);
- g_free (filename);
- }
- else if (i == 4)
- {
- widget = gtk_entry_new ();
- }
- else
- {
- widget = NULL; /* avoids a compiler warning */
- g_assert_not_reached ();
- }
-
- gtk_text_view_add_child_at_anchor (text_view,
- widget,
- anchor);
-
- gtk_widget_show_all (widget);
-
- ++i;
- }
-}
-
-GtkWidget *
-do_textview (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *vpaned;
- GtkWidget *view1;
- GtkWidget *view2;
- GtkWidget *sw;
- GtkTextBuffer *buffer;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window),
- 450, 450);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "TextView");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
- gtk_container_add (GTK_CONTAINER (window), vpaned);
-
- /* For convenience, we just use the autocreated buffer from
- * the first text view; you could also create the buffer
- * by itself with gtk_text_buffer_new(), then later create
- * a view widget.
- */
- view1 = gtk_text_view_new ();
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view1));
- view2 = gtk_text_view_new_with_buffer (buffer);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_paned_add1 (GTK_PANED (vpaned), sw);
-
- gtk_container_add (GTK_CONTAINER (sw), view1);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_paned_add2 (GTK_PANED (vpaned), sw);
-
- gtk_container_add (GTK_CONTAINER (sw), view2);
-
- create_tags (buffer);
- insert_text (buffer);
-
- attach_widgets (GTK_TEXT_VIEW (view1));
- attach_widgets (GTK_TEXT_VIEW (view2));
-
- gtk_widget_show_all (vpaned);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
-
-static void
-recursive_attach_view (int depth,
- GtkTextView *view,
- GtkTextChildAnchor *anchor)
-{
- GtkWidget *child_view;
- GtkWidget *event_box;
- GdkRGBA color;
-
- if (depth > 4)
- return;
-
- child_view = gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view));
-
- /* Event box is to add a black border around each child view */
- event_box = gtk_event_box_new ();
- gdk_rgba_parse (&color, "black");
- gtk_widget_override_background_color (event_box, 0, &color);
-
- gtk_widget_set_halign (child_view, GTK_ALIGN_FILL);
- gtk_widget_set_valign (child_view, GTK_ALIGN_FILL);
-
- gtk_container_add (GTK_CONTAINER (event_box), child_view);
-
- gtk_text_view_add_child_at_anchor (view, event_box, anchor);
-
- recursive_attach_view (depth + 1, GTK_TEXT_VIEW (child_view), anchor);
-}
-
-static void
-easter_egg_callback (GtkWidget *button,
- gpointer data)
-{
- static GtkWidget *window = NULL;
- gpointer window_ptr;
- GtkTextBuffer *buffer;
- GtkWidget *view;
- GtkTextIter iter;
- GtkTextChildAnchor *anchor;
- GtkWidget *sw;
-
- if (window)
- {
- gtk_window_present (GTK_WINDOW (window));
- return;
- }
-
- buffer = gtk_text_buffer_new (NULL);
-
- gtk_text_buffer_get_start_iter (buffer, &iter);
-
- gtk_text_buffer_insert (buffer, &iter,
- "This buffer is shared by a set of nested text views.\n Nested view:\n", -1);
- anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
- gtk_text_buffer_insert (buffer, &iter,
- "\nDon't do this in real applications, please.\n", -1);
-
- view = gtk_text_view_new_with_buffer (buffer);
-
- recursive_attach_view (0, GTK_TEXT_VIEW (view), anchor);
-
- g_object_unref (buffer);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (window), sw);
- gtk_container_add (GTK_CONTAINER (sw), view);
-
- window_ptr = &window;
- g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
-
- gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
-
- gtk_widget_show_all (window);
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/theming.ui b/gtk+-mingw/share/gtk-3.0/demo/theming.ui
deleted file mode 100644
index 728b1d1..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/theming.ui
+++ /dev/null
@@ -1,319 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <object class="GtkGrid" id="grid">
- <property name="row-spacing">6</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkToolbar" id="toolbar1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="show-arrow">False</property>
- <style>
- <class name="primary-toolbar"/>
- </style>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton1">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Normal</property>
- <property name="use_underline">True</property>
- <property name="is_important">True</property>
- <property name="icon_name">edit-find</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton2">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Active</property>
- <property name="use_underline">True</property>
- <property name="is_important">True</property>
- <property name="icon_name">edit-find</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton3">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Insensitive</property>
- <property name="use_underline">True</property>
- <property name="is_important">True</property>
- <property name="icon_name">edit-find</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton5">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Raised</property>
- <property name="use_underline">True</property>
- <property name="is_important">True</property>
- <property name="icon_name">edit-find-symbolic</property>
- <style>
- <class name="raised"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton6">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Raised Active</property>
- <property name="use_underline">True</property>
- <property name="is_important">True</property>
- <property name="icon_name">edit-find-symbolic</property>
- <property name="active">True</property>
- <style>
- <class name="raised"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="toolbutton4">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Insensitive Active</property>
- <property name="use_underline">True</property>
- <property name="icon_name">edit-find</property>
- <property name="is_important">True</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="toolitementry">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkEntry" id="entry1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- <property name="placeholder-text" translatable="yes">Search...</property>
- <property name="secondary-icon-name">edit-find-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="toolitemswitch">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkSwitch" id="switch1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">horizontal</property>
- <property name="valign">center</property>
- <property name="halign">center</property>
- <style>
- <class name="linked"/>
- </style>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label" translatable="yes">Hi, I am a button</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label" translatable="yes">And I'm another button</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button3">
- <property name="label" translatable="yes">This is a button party!</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkToolbar" id="itoolbar1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="icon_size">1</property>
- <style>
- <class name="inline-toolbar"/>
- </style>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton1">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Normal</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-add-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton2">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Normal</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-add-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton3">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Active</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-remove-symbolic</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton4">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Active</property>
- <property name="use_underline">True</property>
- <property name="icon_name">list-remove-symbolic</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton5">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Insensitive</property>
- <property name="use_underline">True</property>
- <property name="icon_name">edit-find-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleToolButton" id="itoolbutton6">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Insensitive Active</property>
- <property name="use_underline">True</property>
- <property name="icon_name">go-up-symbolic</property>
- <property name="active">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
-</interface>
diff --git a/gtk+-mingw/share/gtk-3.0/demo/theming_custom_css.c b/gtk+-mingw/share/gtk-3.0/demo/theming_custom_css.c
deleted file mode 100644
index 5b5871a..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/theming_custom_css.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* CSS Theming/Custom CSS :: fancy.css
- *
- * GTK+ uses CSS for theming. If required, applications can
- * install their own custom CSS style provider to achieve
- * special effects.
- *
- * Doing this has the downside that your application will no
- * longer react to the users theme preferences, so this should
- * be used sparingly.
- */
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_theming_custom_css (GtkWidget *do_widget)
-{
- GtkWidget *box;
- GtkWidget *button;
- GtkCssProvider *provider;
- GBytes *bytes;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Custom CSS");
- gtk_container_set_border_width (GTK_CONTAINER (window), 18);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_container_add (GTK_CONTAINER (window), box);
- button = gtk_button_new_with_label ("Plain");
- gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
- button = gtk_button_new_with_label ("Fancy");
- gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
- gtk_widget_set_name (button, "fancy");
-
- provider = gtk_css_provider_new ();
- bytes = g_resources_lookup_data ("/theming_custom_css/gtk.css", 0, NULL);
- gtk_css_provider_load_from_data (provider, g_bytes_get_data (bytes, NULL),
- g_bytes_get_size (bytes), NULL);
- gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (do_widget),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
- g_bytes_unref (bytes);
-
- gtk_widget_show_all (box);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/theming_style_classes.c b/gtk+-mingw/share/gtk-3.0/demo/theming_style_classes.c
deleted file mode 100644
index a70d73f..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/theming_style_classes.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* CSS Theming/Style Classes :: theming.ui
- *
- * GTK+ uses CSS for theming. Style classes can be associated
- * with widgets to inform the theme about intended rendering.
- *
- * This demo shows some common examples where theming features
- * of GTK+ are used for certain effects: primary toolbars,
- * inline toolbars and linked buttons.
- */
-
-#include <gtk/gtk.h>
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-
-GtkWidget *
-do_theming_style_classes (GtkWidget *do_widget)
-{
- GtkWidget *grid;
- GtkBuilder *builder;
- GError *err = NULL;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
- gtk_container_set_border_width (GTK_CONTAINER (window), 12);
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/theming_style_classes/theming.ui", NULL);
- if (err)
- {
- g_error ("ERROR: %s\n", err->message);
- return NULL;
- }
-
- grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
- gtk_widget_show_all (grid);
- gtk_container_add (GTK_CONTAINER (window), grid);
- g_object_unref (builder);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/toolpalette.c b/gtk+-mingw/share/gtk-3.0/demo/toolpalette.c
deleted file mode 100644
index 95ece8d..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/toolpalette.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/* Tool Palette
- *
- * A tool palette widget shows groups of toolbar items as a grid of icons
- * or a list of names.
- */
-
-#include <string.h>
-#include <gtk/gtk.h>
-#include "config.h"
-#include "demo-common.h"
-
-static GtkWidget *window = NULL;
-
-static void load_stock_items (GtkToolPalette *palette);
-static void load_toggle_items (GtkToolPalette *palette);
-static void load_special_items (GtkToolPalette *palette);
-
-typedef struct _CanvasItem CanvasItem;
-
-struct _CanvasItem
-{
- GdkPixbuf *pixbuf;
- gdouble x, y;
-};
-
-static CanvasItem *drop_item = NULL;
-static GList *canvas_items = NULL;
-
-/********************************/
-/* ====== Canvas drawing ====== */
-/********************************/
-
-static CanvasItem*
-canvas_item_new (GtkWidget *widget,
- GtkToolButton *button,
- gdouble x,
- gdouble y)
-{
- CanvasItem *item = NULL;
- const gchar *stock_id;
- GdkPixbuf *pixbuf;
-
- stock_id = gtk_tool_button_get_stock_id (button);
- pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, GTK_ICON_SIZE_DIALOG);
-
- if (pixbuf)
- {
- item = g_slice_new0 (CanvasItem);
- item->pixbuf = pixbuf;
- item->x = x;
- item->y = y;
- }
-
- return item;
-}
-
-static void
-canvas_item_free (CanvasItem *item)
-{
- g_object_unref (item->pixbuf);
- g_slice_free (CanvasItem, item);
-}
-
-static void
-canvas_item_draw (const CanvasItem *item,
- cairo_t *cr,
- gboolean preview)
-{
- gdouble cx = gdk_pixbuf_get_width (item->pixbuf);
- gdouble cy = gdk_pixbuf_get_height (item->pixbuf);
-
- gdk_cairo_set_source_pixbuf (cr,
- item->pixbuf,
- item->x - cx * 0.5,
- item->y - cy * 0.5);
-
- if (preview)
- cairo_paint_with_alpha (cr, 0.6);
- else
- cairo_paint (cr);
-}
-
-static gboolean
-canvas_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GList *iter;
-
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_paint (cr);
-
- for (iter = canvas_items; iter; iter = iter->next)
- canvas_item_draw (iter->data, cr, FALSE);
-
- if (drop_item)
- canvas_item_draw (drop_item, cr, TRUE);
-
- return TRUE;
-}
-
-/*****************************/
-/* ====== Palette DnD ====== */
-/*****************************/
-
-static void
-palette_drop_item (GtkToolItem *drag_item,
- GtkToolItemGroup *drop_group,
- gint x,
- gint y)
-{
- GtkWidget *drag_group = gtk_widget_get_parent (GTK_WIDGET (drag_item));
- GtkToolItem *drop_item = gtk_tool_item_group_get_drop_item (drop_group, x, y);
- gint drop_position = -1;
-
- if (drop_item)
- drop_position = gtk_tool_item_group_get_item_position (GTK_TOOL_ITEM_GROUP (drop_group), drop_item);
-
- if (GTK_TOOL_ITEM_GROUP (drag_group) != drop_group)
- {
- gboolean homogeneous, expand, fill, new_row;
-
- g_object_ref (drag_item);
- gtk_container_child_get (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item),
- "homogeneous", &homogeneous,
- "expand", &expand,
- "fill", &fill,
- "new-row", &new_row,
- NULL);
- gtk_container_remove (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item));
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (drop_group),
- drag_item, drop_position);
- gtk_container_child_set (GTK_CONTAINER (drop_group), GTK_WIDGET (drag_item),
- "homogeneous", homogeneous,
- "expand", expand,
- "fill", fill,
- "new-row", new_row,
- NULL);
- g_object_unref (drag_item);
- }
- else
- gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (drop_group),
- drag_item, drop_position);
-}
-
-static void
-palette_drop_group (GtkToolPalette *palette,
- GtkToolItemGroup *drag_group,
- GtkToolItemGroup *drop_group)
-{
- gint drop_position = -1;
-
- if (drop_group)
- drop_position = gtk_tool_palette_get_group_position (palette, drop_group);
-
- gtk_tool_palette_set_group_position (palette, drag_group, drop_position);
-}
-
-static void
-palette_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection,
- guint info,
- guint time,
- gpointer data)
-{
- GtkAllocation allocation;
- GtkToolItemGroup *drop_group = NULL;
- GtkWidget *drag_palette = gtk_drag_get_source_widget (context);
- GtkWidget *drag_item = NULL;
-
- while (drag_palette && !GTK_IS_TOOL_PALETTE (drag_palette))
- drag_palette = gtk_widget_get_parent (drag_palette);
-
- if (drag_palette)
- {
- drag_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (drag_palette),
- selection);
- drop_group = gtk_tool_palette_get_drop_group (GTK_TOOL_PALETTE (widget),
- x, y);
- }
-
- if (GTK_IS_TOOL_ITEM_GROUP (drag_item))
- palette_drop_group (GTK_TOOL_PALETTE (drag_palette),
- GTK_TOOL_ITEM_GROUP (drag_item),
- drop_group);
- else if (GTK_IS_TOOL_ITEM (drag_item) && drop_group)
- {
- gtk_widget_get_allocation (GTK_WIDGET (drop_group), &allocation);
- palette_drop_item (GTK_TOOL_ITEM (drag_item),
- drop_group,
- x - allocation.x,
- y - allocation.y);
- }
-}
-
-/********************************/
-/* ====== Passive Canvas ====== */
-/********************************/
-
-static void
-passive_canvas_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection,
- guint info,
- guint time,
- gpointer data)
-{
- /* find the tool button, which is the source of this DnD operation */
-
- GtkWidget *palette = gtk_drag_get_source_widget (context);
- CanvasItem *canvas_item = NULL;
- GtkWidget *tool_item = NULL;
-
- while (palette && !GTK_IS_TOOL_PALETTE (palette))
- palette = gtk_widget_get_parent (palette);
-
- if (palette)
- tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
- selection);
-
- g_assert (NULL == drop_item);
-
- /* append a new canvas item when a tool button was found */
-
- if (GTK_IS_TOOL_ITEM (tool_item))
- canvas_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
-
- if (canvas_item)
- {
- canvas_items = g_list_append (canvas_items, canvas_item);
- gtk_widget_queue_draw (widget);
- }
-}
-
-/************************************/
-/* ====== Interactive Canvas ====== */
-/************************************/
-
-static gboolean
-interactive_canvas_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- gpointer data)
-{
- if (drop_item)
- {
- /* already have a drop indicator - just update position */
-
- drop_item->x = x;
- drop_item->y = y;
-
- gtk_widget_queue_draw (widget);
- gdk_drag_status (context, GDK_ACTION_COPY, time);
- }
- else
- {
- /* request DnD data for creating a drop indicator */
-
- GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
-
- if (!target)
- return FALSE;
-
- gtk_drag_get_data (widget, context, target, time);
- }
-
- return TRUE;
-}
-
-static void
-interactive_canvas_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection,
- guint info,
- guint time,
- gpointer data)
-
-{
- /* find the tool button which is the source of this DnD operation */
-
- GtkWidget *palette = gtk_drag_get_source_widget (context);
- GtkWidget *tool_item = NULL;
-
- while (palette && !GTK_IS_TOOL_PALETTE (palette))
- palette = gtk_widget_get_parent (palette);
-
- if (palette)
- tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
- selection);
-
- /* create a drop indicator when a tool button was found */
-
- g_assert (NULL == drop_item);
-
- if (GTK_IS_TOOL_ITEM (tool_item))
- {
- drop_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
- gdk_drag_status (context, GDK_ACTION_COPY, time);
- gtk_widget_queue_draw (widget);
- }
-}
-
-static gboolean
-interactive_canvas_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- gpointer data)
-{
- if (drop_item)
- {
- /* turn the drop indicator into a real canvas item */
-
- drop_item->x = x;
- drop_item->y = y;
-
- canvas_items = g_list_append (canvas_items, drop_item);
- drop_item = NULL;
-
- /* signal the item was accepted and redraw */
-
- gtk_drag_finish (context, TRUE, FALSE, time);
- gtk_widget_queue_draw (widget);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-interactive_canvas_real_drag_leave (gpointer data)
-{
- if (drop_item)
- {
- GtkWidget *widget = GTK_WIDGET (data);
-
- canvas_item_free (drop_item);
- drop_item = NULL;
-
- gtk_widget_queue_draw (widget);
- }
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-interactive_canvas_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- gpointer data)
-{
- /* defer cleanup until a potential "drag-drop" signal was received */
- g_idle_add (interactive_canvas_real_drag_leave, widget);
-}
-
-static void
-on_combo_orientation_changed (GtkComboBox *combo_box,
- gpointer user_data)
-{
- GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
- GtkScrolledWindow *sw;
- GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
- GtkTreeIter iter;
- gint val = 0;
-
- sw = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (palette)));
-
- if (!gtk_combo_box_get_active_iter (combo_box, &iter))
- return;
-
- gtk_tree_model_get (model, &iter, 1, &val, -1);
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
-
- if (val == GTK_ORIENTATION_HORIZONTAL)
- gtk_scrolled_window_set_policy (sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
- else
- gtk_scrolled_window_set_policy (sw, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-}
-
-static void
-on_combo_style_changed (GtkComboBox *combo_box,
- gpointer user_data)
-{
- GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
- GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
- GtkTreeIter iter;
- gint val = 0;
-
- if (!gtk_combo_box_get_active_iter (combo_box, &iter))
- return;
-
- gtk_tree_model_get (model, &iter, 1, &val, -1);
-
- if (val == -1)
- gtk_tool_palette_unset_style (palette);
- else
- gtk_tool_palette_set_style (palette, val);
-}
-
-GtkWidget *
-do_toolpalette (GtkWidget *do_widget)
-{
- GtkWidget *box = NULL;
- GtkWidget *hbox = NULL;
- GtkWidget *combo_orientation = NULL;
- GtkListStore *orientation_model = NULL;
- GtkWidget *combo_style = NULL;
- GtkListStore *style_model = NULL;
- GtkCellRenderer *cell_renderer = NULL;
- GtkTreeIter iter;
- GtkWidget *palette = NULL;
- GtkWidget *palette_scroller = NULL;
- GtkWidget *notebook = NULL;
- GtkWidget *contents = NULL;
- GtkWidget *contents_scroller = NULL;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Tool Palette");
- gtk_window_set_default_size (GTK_WINDOW (window), 200, 600);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-
- /* Add widgets to control the ToolPalette appearance: */
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_container_add (GTK_CONTAINER (window), box);
-
- /* Orientation combo box: */
- orientation_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
- gtk_list_store_append (orientation_model, &iter);
- gtk_list_store_set (orientation_model, &iter,
- 0, "Horizontal",
- 1, GTK_ORIENTATION_HORIZONTAL,
- -1);
- gtk_list_store_append (orientation_model, &iter);
- gtk_list_store_set (orientation_model, &iter,
- 0, "Vertical",
- 1, GTK_ORIENTATION_VERTICAL,
- -1);
-
- combo_orientation =
- gtk_combo_box_new_with_model (GTK_TREE_MODEL (orientation_model));
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_orientation),
- cell_renderer,
- TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_orientation),
- cell_renderer,
- "text", 0,
- NULL);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_orientation), &iter);
- gtk_box_pack_start (GTK_BOX (box), combo_orientation, FALSE, FALSE, 0);
-
- /* Style combo box: */
- style_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
- gtk_list_store_append (style_model, &iter);
- gtk_list_store_set (style_model, &iter,
- 0, "Text",
- 1, GTK_TOOLBAR_TEXT,
- -1);
- gtk_list_store_append (style_model, &iter);
- gtk_list_store_set (style_model, &iter,
- 0, "Both",
- 1, GTK_TOOLBAR_BOTH,
- -1);
- gtk_list_store_append (style_model, &iter);
- gtk_list_store_set (style_model, &iter,
- 0, "Both: Horizontal",
- 1, GTK_TOOLBAR_BOTH_HORIZ,
- -1);
- gtk_list_store_append (style_model, &iter);
- gtk_list_store_set (style_model, &iter,
- 0, "Icons",
- 1, GTK_TOOLBAR_ICONS,
- -1);
- gtk_list_store_append (style_model, &iter);
- gtk_list_store_set (style_model, &iter,
- 0, "Default",
- 1, -1, /* A custom meaning for this demo. */
- -1);
- combo_style = gtk_combo_box_new_with_model (GTK_TREE_MODEL (style_model));
- cell_renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_style),
- cell_renderer,
- TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_style),
- cell_renderer,
- "text", 0,
- NULL);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_style), &iter);
- gtk_box_pack_start (GTK_BOX (box), combo_style, FALSE, FALSE, 0);
-
- /* Add hbox */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);
-
- /* Add and fill the ToolPalette: */
- palette = gtk_tool_palette_new ();
-
- load_stock_items (GTK_TOOL_PALETTE (palette));
- load_toggle_items (GTK_TOOL_PALETTE (palette));
- load_special_items (GTK_TOOL_PALETTE (palette));
-
- palette_scroller = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (palette_scroller),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_container_set_border_width (GTK_CONTAINER (palette_scroller), 6);
- gtk_widget_set_hexpand (palette_scroller, TRUE);
-
- gtk_container_add (GTK_CONTAINER (palette_scroller), palette);
- gtk_container_add (GTK_CONTAINER (hbox), palette_scroller);
-
- gtk_widget_show_all (box);
-
- /* Connect signals: */
- g_signal_connect (combo_orientation, "changed",
- G_CALLBACK (on_combo_orientation_changed), palette);
- g_signal_connect (combo_style, "changed",
- G_CALLBACK (on_combo_style_changed), palette);
-
- /* Keep the widgets in sync: */
- on_combo_orientation_changed (GTK_COMBO_BOX (combo_orientation), palette);
-
- /* ===== notebook ===== */
-
- notebook = gtk_notebook_new ();
- gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
- gtk_box_pack_end (GTK_BOX(hbox), notebook, FALSE, FALSE, 0);
-
- /* ===== DnD for tool items ===== */
-
- g_signal_connect (palette, "drag-data-received",
- G_CALLBACK (palette_drag_data_received), NULL);
-
- gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
- palette,
- GTK_DEST_DEFAULT_ALL,
- GTK_TOOL_PALETTE_DRAG_ITEMS |
- GTK_TOOL_PALETTE_DRAG_GROUPS,
- GDK_ACTION_MOVE);
-
- /* ===== passive DnD dest ===== */
-
- contents = gtk_drawing_area_new ();
- gtk_widget_set_app_paintable (contents, TRUE);
-
- g_object_connect (contents,
- "signal::draw", canvas_draw, NULL,
- "signal::drag-data-received", passive_canvas_drag_data_received, NULL,
- NULL);
-
- gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
- contents,
- GTK_DEST_DEFAULT_ALL,
- GTK_TOOL_PALETTE_DRAG_ITEMS,
- GDK_ACTION_COPY);
-
- contents_scroller = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_ALWAYS);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller),
- contents);
- gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- contents_scroller,
- gtk_label_new ("Passive DnD Mode"));
-
- /* ===== interactive DnD dest ===== */
-
- contents = gtk_drawing_area_new ();
- gtk_widget_set_app_paintable (contents, TRUE);
-
- g_object_connect (contents,
- "signal::draw", canvas_draw, NULL,
- "signal::drag-motion", interactive_canvas_drag_motion, NULL,
- "signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
- "signal::drag-leave", interactive_canvas_drag_leave, NULL,
- "signal::drag-drop", interactive_canvas_drag_drop, NULL,
- NULL);
-
- gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
- contents,
- GTK_DEST_DEFAULT_HIGHLIGHT,
- GTK_TOOL_PALETTE_DRAG_ITEMS,
- GDK_ACTION_COPY);
-
- contents_scroller = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_ALWAYS);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (contents_scroller),
- contents);
- gtk_container_set_border_width (GTK_CONTAINER (contents_scroller), 6);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller,
- gtk_label_new ("Interactive DnD Mode"));
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show_all (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
-
-
-static void
-load_stock_items (GtkToolPalette *palette)
-{
- GtkWidget *group_af = gtk_tool_item_group_new ("Stock Icons (A-F)");
- GtkWidget *group_gn = gtk_tool_item_group_new ("Stock Icons (G-N)");
- GtkWidget *group_or = gtk_tool_item_group_new ("Stock Icons (O-R)");
- GtkWidget *group_sz = gtk_tool_item_group_new ("Stock Icons (S-Z)");
- GtkWidget *group = NULL;
-
- GtkToolItem *item;
- GSList *stock_ids;
- GSList *iter;
-
- stock_ids = gtk_stock_list_ids ();
- stock_ids = g_slist_sort (stock_ids, (GCompareFunc) strcmp);
-
- gtk_container_add (GTK_CONTAINER (palette), group_af);
- gtk_container_add (GTK_CONTAINER (palette), group_gn);
- gtk_container_add (GTK_CONTAINER (palette), group_or);
- gtk_container_add (GTK_CONTAINER (palette), group_sz);
-
- for (iter = stock_ids; iter; iter = g_slist_next (iter))
- {
- GtkStockItem stock_item;
- gchar *id = iter->data;
-
- switch (id[4])
- {
- case 'a':
- group = group_af;
- break;
-
- case 'g':
- group = group_gn;
- break;
-
- case 'o':
- group = group_or;
- break;
-
- case 's':
- group = group_sz;
- break;
- }
-
- item = gtk_tool_button_new_from_stock (id);
- gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
-
- if (!gtk_stock_lookup (id, &stock_item) || !stock_item.label)
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), id);
-
- g_free (id);
- }
-
- g_slist_free (stock_ids);
-}
-
-static void
-load_toggle_items (GtkToolPalette *palette)
-{
- GSList *toggle_group = NULL;
- GtkToolItem *item;
- GtkWidget *group;
- char *label;
- int i;
-
- group = gtk_tool_item_group_new ("Radio Item");
- gtk_container_add (GTK_CONTAINER (palette), group);
-
- for (i = 1; i <= 10; ++i)
- {
- label = g_strdup_printf ("#%d", i);
- item = gtk_radio_tool_button_new (toggle_group);
- gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), label);
- g_free (label);
-
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- toggle_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
- }
-}
-
-static GtkToolItem *
-create_entry_item (const char *text)
-{
- GtkToolItem *item;
- GtkWidget *entry;
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), text);
- gtk_entry_set_width_chars (GTK_ENTRY (entry), 5);
-
- item = gtk_tool_item_new ();
- gtk_container_add (GTK_CONTAINER (item), entry);
-
- return item;
-}
-
-static void
-load_special_items (GtkToolPalette *palette)
-{
- GtkToolItem *item;
- GtkWidget *group;
- GtkWidget *label_button;
-
- group = gtk_tool_item_group_new (NULL);
- label_button = gtk_button_new_with_label ("Advanced Features");
- gtk_widget_show (label_button);
- gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group),
- label_button);
- gtk_container_add (GTK_CONTAINER (palette), group);
-
- item = create_entry_item ("homogeneous=FALSE");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
- "homogeneous", FALSE, NULL);
-
- item = create_entry_item ("homogeneous=FALSE, expand=TRUE");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
- "homogeneous", FALSE, "expand", TRUE,
- NULL);
-
- item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
- "homogeneous", FALSE, "expand", TRUE,
- "fill", FALSE, NULL);
-
- item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
- "homogeneous", FALSE, "expand", TRUE,
- "new-row", TRUE, NULL);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);
- gtk_tool_item_set_tooltip_text (item, "Show on vertical palettes only");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_tool_item_set_visible_horizontal (item, FALSE);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
- gtk_tool_item_set_tooltip_text (item, "Show on horizontal palettes only");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_tool_item_set_visible_vertical (item, FALSE);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
- gtk_tool_item_set_tooltip_text (item, "Do not show at all");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_widget_set_no_show_all (GTK_WIDGET (item), TRUE);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);
- gtk_tool_item_set_tooltip_text (item, "Expanded this item");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
- gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
- "homogeneous", FALSE,
- "expand", TRUE,
- NULL);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_HELP);
- gtk_tool_item_set_tooltip_text (item, "A regular item");
- gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/transparent.c b/gtk+-mingw/share/gtk-3.0/demo/transparent.c
deleted file mode 100644
index 21c6a0b..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/transparent.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Transparent
- *
- * Use transparent background on GdkWindows to create a shadow effect on a GtkOverlay widget.
- */
-
-#include <gtk/gtk.h>
-
-#define SHADOW_OFFSET_X 7
-#define SHADOW_OFFSET_Y 7
-#define SHADOW_RADIUS 5
-
-static void
-draw_shadow_box (cairo_t *cr,
- GdkRectangle rect,
- double radius,
- double transparency)
-{
- cairo_pattern_t *pattern;
- double x0, x1, x2, x3;
- double y0, y1, y2, y3;
-
- x0 = rect.x;
- x1 = rect.x + radius;
- x2 = rect.x + rect.width - radius;
- x3 = rect.x + rect.width;
-
- y0 = rect.y;
- y1 = rect.y + radius;
- y2 = rect.y + rect.height - radius;
- y3 = rect.y + rect.height;
-
- /* Fill non-border part */
- cairo_set_source_rgba (cr, 0, 0, 0, transparency);
- cairo_rectangle (cr,
- x1, y1, x2 - x1, y2 - y1);
- cairo_fill (cr);
-
- /* Upper border */
-
- pattern = cairo_pattern_create_linear (0, y0, 0, y1);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x1, y0,
- x2 - x1, y1 - y0);
- cairo_fill (cr);
-
- /* Bottom border */
-
- pattern = cairo_pattern_create_linear (0, y2, 0, y3);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x1, y2,
- x2 - x1, y3 - y2);
- cairo_fill (cr);
-
- /* Left border */
-
- pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x0, y1,
- x1 - x0, y2 - y1);
- cairo_fill (cr);
-
- /* Right border */
-
- pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x2, y1,
- x3 - x2, y2 - y1);
- cairo_fill (cr);
-
- /* NW corner */
-
- pattern = cairo_pattern_create_radial (x1, y1, 0,
- x1, y1, radius);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x0, y0,
- x1 - x0, y1 - y0);
- cairo_fill (cr);
-
- /* NE corner */
-
- pattern = cairo_pattern_create_radial (x2, y1, 0,
- x2, y1, radius);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x2, y0,
- x3 - x2, y1 - y0);
- cairo_fill (cr);
-
- /* SW corner */
-
- pattern = cairo_pattern_create_radial (x1, y2, 0,
- x1, y2, radius);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x0, y2,
- x1 - x0, y3 - y2);
- cairo_fill (cr);
-
- /* SE corner */
-
- pattern = cairo_pattern_create_radial (x2, y2, 0,
- x2, y2, radius);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
- cairo_rectangle (cr,
- x2, y2,
- x3 - x2, y3 - y2);
- cairo_fill (cr);
-}
-
-static gboolean
-draw_callback (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- GdkRectangle rect;
-
- gtk_widget_get_allocation (widget, &rect);
- rect.x += SHADOW_OFFSET_X;
- rect.y += SHADOW_OFFSET_Y;
- rect.width -= SHADOW_OFFSET_X;
- rect.height -= SHADOW_OFFSET_Y;
-
- draw_shadow_box (cr,
- rect, SHADOW_RADIUS, 0.4);
-
- return FALSE;
-}
-
-GtkWidget *
-do_transparent (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *view;
- GtkWidget *sw;
- GtkWidget *overlay;
- GtkWidget *align;
- GtkWidget *entry;
- GdkRGBA transparent = {0, 0, 0, 0};
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_default_size (GTK_WINDOW (window),
- 450, 450);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Transparent");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- view = gtk_text_view_new ();
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (sw), view);
-
- overlay = gtk_overlay_new ();
- gtk_container_add (GTK_CONTAINER (overlay), sw);
- gtk_container_add (GTK_CONTAINER (window), overlay);
-
- gtk_widget_override_background_color (overlay, 0, &transparent);
-
- align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (align),
- 0, SHADOW_OFFSET_Y, 0, SHADOW_OFFSET_X);
- g_signal_connect (align, "draw", G_CALLBACK (draw_callback), NULL);
-
- entry = gtk_entry_new ();
- gtk_container_add (GTK_CONTAINER (align), entry);
-
- gtk_overlay_add_overlay (GTK_OVERLAY (overlay), align);
- gtk_widget_set_halign (align, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (align, GTK_ALIGN_START);
-
- gtk_widget_show_all (overlay);
- }
-
- if (!gtk_widget_get_visible (window))
- {
- gtk_widget_show (window);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/tree_store.c b/gtk+-mingw/share/gtk-3.0/demo/tree_store.c
deleted file mode 100644
index feeaff3..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/tree_store.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/* Tree View/Tree Store
- *
- * The GtkTreeStore is used to store data in tree form, to be
- * used later on by a GtkTreeView to display it. This demo builds
- * a simple GtkTreeStore and displays it. If you're new to the
- * GtkTreeView widgets and associates, look into the GtkListStore
- * example first.
- *
- */
-
-#include <gtk/gtk.h>
-
-static GtkWidget *window = NULL;
-
-/* TreeItem structure */
-typedef struct _TreeItem TreeItem;
-struct _TreeItem
-{
- const gchar *label;
- gboolean alex;
- gboolean havoc;
- gboolean tim;
- gboolean owen;
- gboolean dave;
- gboolean world_holiday; /* shared by the European hackers */
- TreeItem *children;
-};
-
-/* columns */
-enum
-{
- HOLIDAY_NAME_COLUMN = 0,
- ALEX_COLUMN,
- HAVOC_COLUMN,
- TIM_COLUMN,
- OWEN_COLUMN,
- DAVE_COLUMN,
-
- VISIBLE_COLUMN,
- WORLD_COLUMN,
- NUM_COLUMNS
-};
-
-/* tree data */
-static TreeItem january[] =
-{
- {"New Years Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
- {"Presidential Inauguration", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- {"Martin Luther King Jr. day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem february[] =
-{
- { "Presidents' Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { "Groundhog Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Valentine's Day", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, NULL },
- { NULL }
-};
-
-static TreeItem march[] =
-{
- { "National Tree Planting Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "St Patrick's Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { NULL }
-};
-static TreeItem april[] =
-{
- { "April Fools' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Army Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Earth Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Administrative Professionals' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem may[] =
-{
- { "Nurses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "National Day of Prayer", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Mothers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Armed Forces Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Memorial Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
- { NULL }
-};
-
-static TreeItem june[] =
-{
- { "June Fathers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Juneteenth (Liberation of Slaves)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Flag Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem july[] =
-{
- { "Parents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Independence Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem august[] =
-{
- { "Air Force Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Coast Guard Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Friendship Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem september[] =
-{
- { "Grandparents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { "Citizenship Day or Constitution Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Labor Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
- { NULL }
-};
-
-static TreeItem october[] =
-{
- { "National Children's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Bosses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Sweetest Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Mother-in-Law's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Navy Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Columbus Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { "Halloween", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
- { NULL }
-};
-
-static TreeItem november[] =
-{
- { "Marine Corps Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Veterans' Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
- { "Thanksgiving", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-static TreeItem december[] =
-{
- { "Pearl Harbor Remembrance Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { "Christmas", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
- { "Kwanzaa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { NULL }
-};
-
-
-static TreeItem toplevel[] =
-{
- {"January", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, january},
- {"February", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, february},
- {"March", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, march},
- {"April", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, april},
- {"May", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, may},
- {"June", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, june},
- {"July", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, july},
- {"August", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, august},
- {"September", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, september},
- {"October", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, october},
- {"November", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, november},
- {"December", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, december},
- {NULL}
-};
-
-
-static GtkTreeModel *
-create_model (void)
-{
- GtkTreeStore *model;
- GtkTreeIter iter;
- TreeItem *month = toplevel;
-
- /* create tree store */
- model = gtk_tree_store_new (NUM_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN);
-
- /* add data to the tree store */
- while (month->label)
- {
- TreeItem *holiday = month->children;
-
- gtk_tree_store_append (model, &iter, NULL);
- gtk_tree_store_set (model, &iter,
- HOLIDAY_NAME_COLUMN, month->label,
- ALEX_COLUMN, FALSE,
- HAVOC_COLUMN, FALSE,
- TIM_COLUMN, FALSE,
- OWEN_COLUMN, FALSE,
- DAVE_COLUMN, FALSE,
- VISIBLE_COLUMN, FALSE,
- WORLD_COLUMN, FALSE,
- -1);
-
- /* add children */
- while (holiday->label)
- {
- GtkTreeIter child_iter;
-
- gtk_tree_store_append (model, &child_iter, &iter);
- gtk_tree_store_set (model, &child_iter,
- HOLIDAY_NAME_COLUMN, holiday->label,
- ALEX_COLUMN, holiday->alex,
- HAVOC_COLUMN, holiday->havoc,
- TIM_COLUMN, holiday->tim,
- OWEN_COLUMN, holiday->owen,
- DAVE_COLUMN, holiday->dave,
- VISIBLE_COLUMN, TRUE,
- WORLD_COLUMN, holiday->world_holiday,
- -1);
-
- holiday++;
- }
-
- month++;
- }
-
- return GTK_TREE_MODEL (model);
-}
-
-static void
-item_toggled (GtkCellRendererToggle *cell,
- gchar *path_str,
- gpointer data)
-{
- GtkTreeModel *model = (GtkTreeModel *)data;
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- GtkTreeIter iter;
- gboolean toggle_item;
-
- gint *column;
-
- column = g_object_get_data (G_OBJECT (cell), "column");
-
- /* get toggled iter */
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, column, &toggle_item, -1);
-
- /* do something with the value */
- toggle_item ^= 1;
-
- /* set new value */
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column,
- toggle_item, -1);
-
- /* clean up */
- gtk_tree_path_free (path);
-}
-
-static void
-add_columns (GtkTreeView *treeview)
-{
- gint col_offset;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkTreeModel *model = gtk_tree_view_get_model (treeview);
-
- /* column for holiday names */
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Holiday",
- renderer, "text",
- HOLIDAY_NAME_COLUMN,
- NULL);
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-
- /* alex column */
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
- g_object_set_data (G_OBJECT (renderer), "column", (gint *)ALEX_COLUMN);
-
- g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Alex",
- renderer,
- "active",
- ALEX_COLUMN,
- "visible",
- VISIBLE_COLUMN,
- "activatable",
- WORLD_COLUMN, NULL);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-
- /* havoc column */
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
- g_object_set_data (G_OBJECT (renderer), "column", (gint *)HAVOC_COLUMN);
-
- g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Havoc",
- renderer,
- "active",
- HAVOC_COLUMN,
- "visible",
- VISIBLE_COLUMN,
- NULL);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-
- /* tim column */
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
- g_object_set_data (G_OBJECT (renderer), "column", (gint *)TIM_COLUMN);
-
- g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Tim",
- renderer,
- "active",
- TIM_COLUMN,
- "visible",
- VISIBLE_COLUMN,
- "activatable",
- WORLD_COLUMN, NULL);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-
- /* owen column */
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
- g_object_set_data (G_OBJECT (renderer), "column", (gint *)OWEN_COLUMN);
-
- g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Owen",
- renderer,
- "active",
- OWEN_COLUMN,
- "visible",
- VISIBLE_COLUMN,
- NULL);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-
- /* dave column */
- renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (renderer, "xalign", 0.0, NULL);
- g_object_set_data (G_OBJECT (renderer), "column", (gint *)DAVE_COLUMN);
-
- g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
-
- col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
- -1, "Dave",
- renderer,
- "active",
- DAVE_COLUMN,
- "visible",
- VISIBLE_COLUMN,
- NULL);
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
- gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
- GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-}
-
-GtkWidget *
-do_tree_store (GtkWidget *do_widget)
-{
- if (!window)
- {
- GtkWidget *vbox;
- GtkWidget *sw;
- GtkWidget *treeview;
- GtkTreeModel *model;
-
- /* create window, etc */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet");
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- gtk_box_pack_start (GTK_BOX (vbox),
- gtk_label_new ("Jonathan's Holiday Card Planning Sheet"),
- FALSE, FALSE, 0);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_ETCHED_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
-
- /* create model */
- model = create_model ();
-
- /* create tree view */
- treeview = gtk_tree_view_new_with_model (model);
- g_object_unref (model);
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
- GTK_SELECTION_MULTIPLE);
-
- add_columns (GTK_TREE_VIEW (treeview));
-
- gtk_container_add (GTK_CONTAINER (sw), treeview);
-
- /* expand all rows after the treeview widget has been realized */
- g_signal_connect (treeview, "realize",
- G_CALLBACK (gtk_tree_view_expand_all), NULL);
- gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}
diff --git a/gtk+-mingw/share/gtk-3.0/demo/ui_manager.c b/gtk+-mingw/share/gtk-3.0/demo/ui_manager.c
deleted file mode 100644
index 48c3f45..0000000
--- a/gtk+-mingw/share/gtk-3.0/demo/ui_manager.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* UI Manager
- *
- * The GtkUIManager object allows the easy creation of menus
- * from an array of actions and a description of the menu hierarchy.
- */
-
-#include <gtk/gtk.h>
-
-static void
-activate_action (GtkAction *action)
-{
- g_message ("Action \"%s\" activated", gtk_action_get_name (action));
-}
-
-static void
-activate_radio_action (GtkAction *action, GtkRadioAction *current)
-{
- g_message ("Radio action \"%s\" selected",
- gtk_action_get_name (GTK_ACTION (current)));
-}
-
-static GtkActionEntry entries[] = {
- { "FileMenu", NULL, "_File" }, /* name, stock id, label */
- { "PreferencesMenu", NULL, "_Preferences" }, /* name, stock id, label */
- { "ColorMenu", NULL, "_Color" }, /* name, stock id, label */
- { "ShapeMenu", NULL, "_Shape" }, /* name, stock id, label */
- { "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
- { "New", GTK_STOCK_NEW, /* name, stock id */
- "_New", "<control>N", /* label, accelerator */
- "Create a new file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Open", GTK_STOCK_OPEN, /* name, stock id */
- "_Open","<control>O", /* label, accelerator */
- "Open a file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Save", GTK_STOCK_SAVE, /* name, stock id */
- "_Save","<control>S", /* label, accelerator */
- "Save current file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
- "Save _As...", NULL, /* label, accelerator */
- "Save to a file", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Quit", GTK_STOCK_QUIT, /* name, stock id */
- "_Quit", "<control>Q", /* label, accelerator */
- "Quit", /* tooltip */
- G_CALLBACK (activate_action) },
- { "About", NULL, /* name, stock id */
- "_About", "<control>A", /* label, accelerator */
- "About", /* tooltip */
- G_CALLBACK (activate_action) },
- { "Logo", "demo-gtk-logo", /* name, stock id */
- NULL, NULL, /* label, accelerator */
- "GTK+", /* tooltip */
- G_CALLBACK (activate_action) },
-};
-static guint n_entries = G_N_ELEMENTS (entries);
-
-
-static GtkToggleActionEntry toggle_entries[] = {
- { "Bold", GTK_STOCK_BOLD, /* name, stock id */
- "_Bold", "<control>B", /* label, accelerator */
- "Bold", /* tooltip */
- G_CALLBACK (activate_action),
- TRUE }, /* is_active */
-};
-static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
-
-enum {
- COLOR_RED,
- COLOR_GREEN,
- COLOR_BLUE
-};
-
-static GtkRadioActionEntry color_entries[] = {
- { "Red", NULL, /* name, stock id */
- "_Red", "<control>R", /* label, accelerator */
- "Blood", COLOR_RED }, /* tooltip, value */
- { "Green", NULL, /* name, stock id */
- "_Green", "<control>G", /* label, accelerator */
- "Grass", COLOR_GREEN }, /* tooltip, value */
- { "Blue", NULL, /* name, stock id */
- "_Blue", "<control>B", /* label, accelerator */
- "Sky", COLOR_BLUE }, /* tooltip, value */
-};
-static guint n_color_entries = G_N_ELEMENTS (color_entries);
-
-enum {
- SHAPE_SQUARE,
- SHAPE_RECTANGLE,
- SHAPE_OVAL
-};
-
-static GtkRadioActionEntry shape_entries[] = {
- { "Square", NULL, /* name, stock id */
- "_Square", "<control>S", /* label, accelerator */
- "Square", SHAPE_SQUARE }, /* tooltip, value */
- { "Rectangle", NULL, /* name, stock id */
- "_Rectangle", "<control>R", /* label, accelerator */
- "Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
- { "Oval", NULL, /* name, stock id */
- "_Oval", "<control>O", /* label, accelerator */
- "Egg", SHAPE_OVAL }, /* tooltip, value */
-};
-static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
-
-static const gchar *ui_info =
-"<ui>"
-" <menubar name='MenuBar'>"
-" <menu action='FileMenu'>"
-" <menuitem action='New'/>"
-" <menuitem action='Open'/>"
-" <menuitem action='Save'/>"
-" <menuitem action='SaveAs'/>"
-" <separator/>"
-" <menuitem action='Quit'/>"
-" </menu>"
-" <menu action='PreferencesMenu'>"
-" <menu action='ColorMenu'>"
-" <menuitem action='Red'/>"
-" <menuitem action='Green'/>"
-" <menuitem action='Blue'/>"
-" </menu>"
-" <menu action='ShapeMenu'>"
-" <menuitem action='Square'/>"
-" <menuitem action='Rectangle'/>"
-" <menuitem action='Oval'/>"
-" </menu>"
-" <menuitem action='Bold'/>"
-" </menu>"
-" <menu action='HelpMenu'>"
-" <menuitem action='About'/>"
-" </menu>"
-" </menubar>"
-" <toolbar name='ToolBar'>"
-" <toolitem action='Open'/>"
-" <toolitem action='Quit'/>"
-" <separator action='Sep1'/>"
-" <toolitem action='Logo'/>"
-" </toolbar>"
-"</ui>";
-
-GtkWidget *
-do_ui_manager (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *separator;
- GtkWidget *label;
- GtkWidget *button;
- GtkUIManager *ui;
- GtkActionGroup *actions;
- GError *error = NULL;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (do_widget));
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed), &window);
- g_signal_connect (window, "delete-event",
- G_CALLBACK (gtk_true), NULL);
-
- actions = gtk_action_group_new ("Actions");
- gtk_action_group_add_actions (actions, entries, n_entries, NULL);
- gtk_action_group_add_toggle_actions (actions,
- toggle_entries, n_toggle_entries,
- NULL);
- gtk_action_group_add_radio_actions (actions,
- color_entries, n_color_entries,
- COLOR_RED,
- G_CALLBACK (activate_radio_action),
- NULL);
- gtk_action_group_add_radio_actions (actions,
- shape_entries, n_shape_entries,
- SHAPE_OVAL,
- G_CALLBACK (activate_radio_action),
- NULL);
-
- ui = gtk_ui_manager_new ();
- gtk_ui_manager_insert_action_group (ui, actions, 0);
- g_object_unref (actions);
- gtk_window_add_accel_group (GTK_WINDOW (window),
- gtk_ui_manager_get_accel_group (ui));
- gtk_window_set_title (GTK_WINDOW (window), "UI Manager");
- gtk_container_set_border_width (GTK_CONTAINER (window), 0);
-
- if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, -1, &error))
- {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
-
- box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
-
- gtk_box_pack_start (GTK_BOX (box1),
- gtk_ui_manager_get_widget (ui, "/MenuBar"),
- FALSE, FALSE, 0);
-
- label = gtk_label_new ("Type\n<alt>\nto start");
- gtk_widget_set_size_request (label, 200, 200);
- gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
-
- separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
-
- box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
-
- button = gtk_button_new_with_label ("close");
- g_signal_connect_swapped (button, "clicked",
- G_CALLBACK (gtk_widget_destroy), window);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_set_can_default (button, TRUE);
- gtk_widget_grab_default (button);
-
- gtk_widget_show_all (window);
- g_object_unref (ui);
- }
- else
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- return window;
-}