forked from AuroraMiddleware/gtk
gtk-demo: Many cosmetic fixes
Mostly update window titles, and some addition to descriptions.
This commit is contained in:
parent
2f8e4f2685
commit
0a601b093c
@ -48,7 +48,6 @@ GtkWidget *
|
||||
do_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GError *err = NULL;
|
||||
GtkWidget *toolbar;
|
||||
GActionGroup *actions;
|
||||
GtkAccelGroup *accel_group;
|
||||
@ -56,13 +55,8 @@ do_builder (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/builder/demo.ui", &err);
|
||||
if (err)
|
||||
{
|
||||
g_error ("ERROR: %s\n", err->message);
|
||||
return NULL;
|
||||
}
|
||||
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
|
@ -56,7 +56,7 @@ do_button_box (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
|
@ -242,7 +242,7 @@ open_display_cb (GtkWidget *button,
|
||||
if (!result)
|
||||
{
|
||||
gchar *error_msg =
|
||||
g_strdup_printf ("Can't open display :\n\t%s\nplease try another one\n",
|
||||
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);
|
||||
@ -523,12 +523,12 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
|
||||
info = g_new0 (ChangeDisplayInfo, 1);
|
||||
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"), GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
info->window = gtk_dialog_new_with_buttons ("Change Display",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
"Close", GTK_RESPONSE_CLOSE,
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
||||
|
||||
|
@ -213,7 +213,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@ -318,7 +318,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
|
@ -23,11 +23,9 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *container, *child;
|
||||
GtkStyleProvider *provider;
|
||||
GBytes *bytes;
|
||||
gsize data_size;
|
||||
const guint8 *data;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
|
||||
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",
|
||||
@ -57,11 +55,7 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
bytes = g_resources_lookup_data ("/css_accordion/css_accordion.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);
|
||||
g_bytes_unref (bytes);
|
||||
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
|
||||
|
||||
apply_css (window, provider);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ do_css_basics (GtkWidget *do_widget)
|
||||
GBytes *bytes;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
|
||||
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",
|
||||
@ -93,10 +94,8 @@ do_css_basics (GtkWidget *do_widget)
|
||||
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);
|
||||
g_signal_connect (text, "changed",
|
||||
G_CALLBACK (css_text_changed), provider);
|
||||
|
||||
bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL);
|
||||
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
|
@ -90,6 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
||||
GBytes *bytes;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
|
||||
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",
|
||||
|
@ -71,6 +71,7 @@ do_css_pixbufs (GtkWidget *do_widget)
|
||||
GBytes *bytes;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
|
||||
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",
|
||||
|
@ -94,6 +94,7 @@ do_css_shadows (GtkWidget *do_widget)
|
||||
GBytes *bytes;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
|
||||
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",
|
||||
|
@ -24,7 +24,7 @@
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||
<property name="program-name" translatable="yes">GtkBuilder demo</property>
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
@ -33,7 +33,7 @@
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_width">440</property>
|
||||
<property name="title">GtkBuilder demo</property>
|
||||
<property name="title" translatable="yes">Builder</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Dialog and Message Boxes
|
||||
/* Dialogs and Message Boxes
|
||||
*
|
||||
* Dialog widgets are used to pop up a transient window for user feedback.
|
||||
*/
|
||||
@ -109,7 +109,7 @@ do_dialog (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
@ -349,7 +349,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
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_window_set_title (GTK_WINDOW (window), "Editable Cells");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* Entry/Entry Buffer
|
||||
*
|
||||
* GtkEntryBuffer provides the text content in a GtkEntry.
|
||||
*
|
||||
* Applications can provide their own buffer implementation,
|
||||
* e.g. to provide secure handling for passwords in memory.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@ -20,7 +21,7 @@ do_entry_buffer (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
|
||||
window = gtk_dialog_new_with_buttons ("Entry Buffer",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
@ -47,7 +47,7 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
|
||||
window = gtk_dialog_new_with_buttons ("Entry Completion",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
@ -384,6 +384,7 @@ do_event_axes (GtkWidget *toplevel)
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Event Axes");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
|
@ -10,45 +10,85 @@
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog)
|
||||
{
|
||||
gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander));
|
||||
}
|
||||
|
||||
static void
|
||||
do_not_expand (GtkWidget *child, gpointer data)
|
||||
{
|
||||
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child,
|
||||
"expand", FALSE, "fill", FALSE, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_expander (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *content_area;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *area;
|
||||
GtkWidget *box;
|
||||
GtkWidget *expander;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkExpander",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
GTK_RESPONSE_NONE,
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
{
|
||||
toplevel = gtk_widget_get_toplevel (do_widget);
|
||||
window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel),
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"<big><b>%s</b></big>",
|
||||
"Something went wrong");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window),
|
||||
"Here are some more details "
|
||||
"but not the full story.");
|
||||
|
||||
g_signal_connect (window, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
||||
box = gtk_widget_get_parent (area);
|
||||
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
|
||||
"expand", TRUE, "fill", TRUE, NULL);
|
||||
gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
expander = gtk_expander_new ("Details:");
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
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);
|
||||
tv = gtk_text_view_new ();
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
|
||||
"Finally, the full story with all details. "
|
||||
"And all the inside information, including "
|
||||
"error codes, etc etc. Pages of information, "
|
||||
"you might have to scroll down to read it all, "
|
||||
"or even resize the window - it works !\n"
|
||||
"A second paragraph will contain even more "
|
||||
"innuendo, just to make you scroll down or "
|
||||
"resize the window. Do it already !", -1);
|
||||
gtk_container_add (GTK_CONTAINER (sw), tv);
|
||||
gtk_container_add (GTK_CONTAINER (expander), sw);
|
||||
gtk_box_pack_end (GTK_BOX (area), expander, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (expander);
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
G_CALLBACK (expander_cb), window);
|
||||
|
||||
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);
|
||||
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -186,6 +186,9 @@ do_font_features (GtkWidget *do_widget)
|
||||
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
|
||||
|
||||
update ();
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -139,7 +139,7 @@ do_gestures (GtkWidget *do_widget)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gestures demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gestures");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
|
@ -373,7 +373,7 @@ create_glarea_window (GtkWidget *do_widget)
|
||||
|
||||
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), "GtkGLArea - Golden Triangle");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
@ -255,7 +255,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Icon View Basics");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Info bar
|
||||
/* Info Bars
|
||||
*
|
||||
* Info bar widgets are used to report important messages to the user.
|
||||
*/
|
||||
|
@ -258,7 +258,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "List Store");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@ -18,10 +18,6 @@
|
||||
* 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>
|
||||
@ -30,7 +26,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_menu (gint depth)
|
||||
create_menu (gint depth)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkRadioMenuItem *last_item;
|
||||
@ -120,6 +116,7 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_widget_show (box1);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_widget_set_hexpand (menubar, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
|
@ -577,7 +577,7 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated Button");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* 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.
|
||||
* The GtkPaned Widget divides its content area into two panes
|
||||
* with a divider in between that the user can adjust. A separate
|
||||
* child is placed into each pane. GtkPaned widgets can be split
|
||||
* horizontally or vertially.
|
||||
*
|
||||
* 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.
|
||||
* This test contains both a horizontal and a vertical GtkPaned
|
||||
* widget, and allows you to adjust the options for each side of
|
||||
* each widget.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@ -141,7 +141,7 @@ do_panes (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Panes");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
@ -84,7 +84,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Search Entry #2");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_widget_set_size_request (window, 200, -1);
|
||||
|
@ -43,7 +43,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW(window), header);
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar demo");
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
|
||||
window = gtk_dialog_new_with_buttons ("Size Groups",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
@ -36,7 +36,7 @@ do_spinner (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_dialog_new_with_buttons ("GtkSpinner",
|
||||
window = gtk_dialog_new_with_buttons ("Spinner",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
_("_Close"),
|
||||
|
@ -14,17 +14,10 @@ GtkWidget *
|
||||
do_stack (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GError *err = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err);
|
||||
if (err)
|
||||
{
|
||||
g_error ("ERROR: %s\n", err->message);
|
||||
return NULL;
|
||||
}
|
||||
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
|
@ -3,7 +3,7 @@
|
||||
<!-- interface-requires gtk+ 3.6 -->
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">GtkStack</property>
|
||||
<property name="title" translatable="yes">Stack</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -181,6 +181,7 @@ do_textscroll (GtkWidget *do_widget)
|
||||
GtkWidget *hbox;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
|
@ -480,7 +480,7 @@ do_textview (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "TextView");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
static void
|
||||
draw_shadow_box (cairo_t *cr,
|
||||
GdkRectangle rect,
|
||||
double radius,
|
||||
double transparency)
|
||||
GdkRectangle rect,
|
||||
double radius,
|
||||
double transparency)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
double x0, x1, x2, x3;
|
||||
@ -32,7 +32,7 @@ draw_shadow_box (cairo_t *cr,
|
||||
/* Fill non-border part */
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
|
||||
cairo_rectangle (cr,
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Upper border */
|
||||
@ -46,8 +46,8 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y0,
|
||||
x2 - x1, y1 - y0);
|
||||
x1, y0,
|
||||
x2 - x1, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Bottom border */
|
||||
@ -61,8 +61,8 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y2,
|
||||
x2 - x1, y3 - y2);
|
||||
x1, y2,
|
||||
x2 - x1, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Left border */
|
||||
@ -76,8 +76,8 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y1,
|
||||
x1 - x0, y2 - y1);
|
||||
x0, y1,
|
||||
x1 - x0, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Right border */
|
||||
@ -91,14 +91,14 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y1,
|
||||
x3 - x2, y2 - y1);
|
||||
x2, y1,
|
||||
x3 - x2, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NW corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y1, 0,
|
||||
x1, y1, radius);
|
||||
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);
|
||||
@ -107,14 +107,14 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y0,
|
||||
x1 - x0, y1 - y0);
|
||||
x0, y0,
|
||||
x1 - x0, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NE corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y1, 0,
|
||||
x2, y1, radius);
|
||||
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);
|
||||
@ -123,14 +123,14 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y0,
|
||||
x3 - x2, y1 - y0);
|
||||
x2, y0,
|
||||
x3 - x2, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SW corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y2, 0,
|
||||
x1, y2, radius);
|
||||
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);
|
||||
@ -139,14 +139,14 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y2,
|
||||
x1 - x0, y3 - y2);
|
||||
x0, y2,
|
||||
x1 - x0, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SE corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y2, 0,
|
||||
x2, y2, radius);
|
||||
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);
|
||||
@ -155,8 +155,8 @@ draw_shadow_box (cairo_t *cr,
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y2,
|
||||
x3 - x2, y3 - y2);
|
||||
x2, y2,
|
||||
x3 - x2, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ draw_callback (GtkWidget *widget,
|
||||
rect.height -= SHADOW_OFFSET_Y;
|
||||
|
||||
draw_shadow_box (cr,
|
||||
rect, SHADOW_RADIUS, 0.4);
|
||||
rect, SHADOW_RADIUS, 0.4);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -202,7 +202,7 @@ do_transparent (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparent");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
@ -231,7 +231,6 @@ do_transparent (GtkWidget *do_widget)
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||
|
||||
|
||||
gtk_widget_show_all (overlay);
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
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");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user