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)
|
do_builder (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
GError *err = NULL;
|
|
||||||
GtkWidget *toolbar;
|
GtkWidget *toolbar;
|
||||||
GActionGroup *actions;
|
GActionGroup *actions;
|
||||||
GtkAccelGroup *accel_group;
|
GtkAccelGroup *accel_group;
|
||||||
@ -56,13 +55,8 @@ do_builder (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
builder = gtk_builder_new ();
|
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
||||||
gtk_builder_add_from_resource (builder, "/builder/demo.ui", &err);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
g_error ("ERROR: %s\n", err->message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
|
@ -56,7 +56,7 @@ do_button_box (GtkWidget *do_widget)
|
|||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
|
@ -242,7 +242,7 @@ open_display_cb (GtkWidget *button,
|
|||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
gchar *error_msg =
|
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);
|
new_screen_name);
|
||||||
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
|
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
|
||||||
g_free (error_msg);
|
g_free (error_msg);
|
||||||
@ -523,12 +523,12 @@ do_changedisplay (GtkWidget *do_widget)
|
|||||||
|
|
||||||
info = g_new0 (ChangeDisplayInfo, 1);
|
info = g_new0 (ChangeDisplayInfo, 1);
|
||||||
|
|
||||||
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
|
info->window = gtk_dialog_new_with_buttons ("Change Display",
|
||||||
GTK_WINDOW (do_widget),
|
GTK_WINDOW (do_widget),
|
||||||
0,
|
0,
|
||||||
_("_Close"), GTK_RESPONSE_CLOSE,
|
"Close", GTK_RESPONSE_CLOSE,
|
||||||
"Change", GTK_RESPONSE_OK,
|
"Change", GTK_RESPONSE_OK,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
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);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
@ -318,7 +318,7 @@ do_combobox (GtkWidget *do_widget)
|
|||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed),
|
G_CALLBACK (gtk_widget_destroyed),
|
||||||
|
@ -23,16 +23,14 @@ do_css_accordion (GtkWidget *do_widget)
|
|||||||
{
|
{
|
||||||
GtkWidget *container, *child;
|
GtkWidget *container, *child;
|
||||||
GtkStyleProvider *provider;
|
GtkStyleProvider *provider;
|
||||||
GBytes *bytes;
|
|
||||||
gsize data_size;
|
|
||||||
const guint8 *data;
|
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
|
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
||||||
@ -57,11 +55,7 @@ do_css_accordion (GtkWidget *do_widget)
|
|||||||
gtk_container_add (GTK_CONTAINER (container), child);
|
gtk_container_add (GTK_CONTAINER (container), child);
|
||||||
|
|
||||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||||
bytes = g_resources_lookup_data ("/css_accordion/css_accordion.css", 0, NULL);
|
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
|
||||||
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);
|
|
||||||
|
|
||||||
apply_css (window, provider);
|
apply_css (window, provider);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
|
|||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
css_text_changed (GtkTextBuffer *buffer,
|
css_text_changed (GtkTextBuffer *buffer,
|
||||||
GtkCssProvider *provider)
|
GtkCssProvider *provider)
|
||||||
@ -70,8 +70,9 @@ do_css_basics (GtkWidget *do_widget)
|
|||||||
GtkStyleProvider *provider;
|
GtkStyleProvider *provider;
|
||||||
GtkTextBuffer *text;
|
GtkTextBuffer *text;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
@ -88,15 +89,13 @@ do_css_basics (GtkWidget *do_widget)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||||
|
|
||||||
container = gtk_scrolled_window_new (NULL, NULL);
|
container = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (window), container);
|
gtk_container_add (GTK_CONTAINER (window), container);
|
||||||
child = gtk_text_view_new_with_buffer (text);
|
child = gtk_text_view_new_with_buffer (text);
|
||||||
gtk_container_add (GTK_CONTAINER (container), child);
|
gtk_container_add (GTK_CONTAINER (container), child);
|
||||||
g_signal_connect (text,
|
g_signal_connect (text, "changed",
|
||||||
"changed",
|
G_CALLBACK (css_text_changed), provider);
|
||||||
G_CALLBACK (css_text_changed),
|
|
||||||
provider);
|
|
||||||
|
|
||||||
bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL);
|
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));
|
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||||
|
@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
|
|||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
css_text_changed (GtkTextBuffer *buffer,
|
css_text_changed (GtkTextBuffer *buffer,
|
||||||
GtkCssProvider *provider)
|
GtkCssProvider *provider)
|
||||||
@ -90,6 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
|||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
|
@ -33,7 +33,7 @@ show_parsing_error (GtkCssProvider *provider,
|
|||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
css_text_changed (GtkTextBuffer *buffer,
|
css_text_changed (GtkTextBuffer *buffer,
|
||||||
GtkCssProvider *provider)
|
GtkCssProvider *provider)
|
||||||
@ -69,8 +69,9 @@ do_css_pixbufs (GtkWidget *do_widget)
|
|||||||
GtkStyleProvider *provider;
|
GtkStyleProvider *provider;
|
||||||
GtkTextBuffer *text;
|
GtkTextBuffer *text;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
|
@ -32,7 +32,7 @@ show_parsing_error (GtkCssProvider *provider,
|
|||||||
|
|
||||||
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
css_text_changed (GtkTextBuffer *buffer,
|
css_text_changed (GtkTextBuffer *buffer,
|
||||||
GtkCssProvider *provider)
|
GtkCssProvider *provider)
|
||||||
@ -92,8 +92,9 @@ do_css_shadows (GtkWidget *do_widget)
|
|||||||
GtkStyleProvider *provider;
|
GtkStyleProvider *provider;
|
||||||
GtkTextBuffer *text;
|
GtkTextBuffer *text;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
</data>
|
</data>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
<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>
|
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||||
<accessibility>
|
<accessibility>
|
||||||
<relation target="window1" type="subwindow-of"/>
|
<relation target="window1" type="subwindow-of"/>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<object class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
<property name="default_height">250</property>
|
<property name="default_height">250</property>
|
||||||
<property name="default_width">440</property>
|
<property name="default_width">440</property>
|
||||||
<property name="title">GtkBuilder demo</property>
|
<property name="title" translatable="yes">Builder</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox1">
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="visible">True</property>
|
<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.
|
* 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);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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);
|
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
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);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/* Entry/Entry Buffer
|
/* Entry/Entry Buffer
|
||||||
*
|
*
|
||||||
* GtkEntryBuffer provides the text content in a GtkEntry.
|
* 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>
|
#include <glib/gi18n.h>
|
||||||
@ -20,7 +21,7 @@ do_entry_buffer (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
|
window = gtk_dialog_new_with_buttons ("Entry Buffer",
|
||||||
GTK_WINDOW (do_widget),
|
GTK_WINDOW (do_widget),
|
||||||
0,
|
0,
|
||||||
_("_Close"),
|
_("_Close"),
|
||||||
|
@ -47,7 +47,7 @@ do_entry_completion (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
|
window = gtk_dialog_new_with_buttons ("Entry Completion",
|
||||||
GTK_WINDOW (do_widget),
|
GTK_WINDOW (do_widget),
|
||||||
0,
|
0,
|
||||||
_("_Close"),
|
_("_Close"),
|
||||||
|
@ -384,6 +384,7 @@ do_event_axes (GtkWidget *toplevel)
|
|||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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);
|
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||||
|
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
|
@ -10,45 +10,85 @@
|
|||||||
|
|
||||||
static GtkWidget *window = NULL;
|
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 *
|
GtkWidget *
|
||||||
do_expander (GtkWidget *do_widget)
|
do_expander (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
GtkWidget *content_area;
|
GtkWidget *toplevel;
|
||||||
GtkWidget *vbox;
|
GtkWidget *area;
|
||||||
GtkWidget *label;
|
GtkWidget *box;
|
||||||
GtkWidget *expander;
|
GtkWidget *expander;
|
||||||
|
GtkWidget *sw;
|
||||||
|
GtkWidget *tv;
|
||||||
|
GtkTextBuffer *buffer;
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_dialog_new_with_buttons ("GtkExpander",
|
toplevel = gtk_widget_get_toplevel (do_widget);
|
||||||
GTK_WINDOW (do_widget),
|
window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel),
|
||||||
0,
|
0,
|
||||||
_("_Close"),
|
GTK_MESSAGE_ERROR,
|
||||||
GTK_RESPONSE_NONE,
|
GTK_BUTTONS_CLOSE,
|
||||||
NULL);
|
"<big><b>%s</b></big>",
|
||||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
"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",
|
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
||||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
box = gtk_widget_get_parent (area);
|
||||||
g_signal_connect (window, "destroy",
|
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
"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);
|
tv = gtk_text_view_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
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.");
|
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
|
||||||
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))
|
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"));
|
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
|
|
||||||
|
g_signal_connect (window, "destroy",
|
||||||
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gtk_widget_get_visible (window))
|
if (!gtk_widget_get_visible (window))
|
||||||
|
@ -139,7 +139,7 @@ do_gestures (GtkWidget *do_widget)
|
|||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ create_glarea_window (GtkWidget *do_widget)
|
|||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
|
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_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
||||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
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_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (close_window), NULL);
|
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.
|
* 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);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
* A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
|
* 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
|
* up when the menu item is selected. Typically, all menu items in a menu bar
|
||||||
* have submenus.
|
* 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 <gtk/gtk.h>
|
||||||
@ -30,7 +26,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_menu (gint depth)
|
create_menu (gint depth)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
GtkRadioMenuItem *last_item;
|
GtkRadioMenuItem *last_item;
|
||||||
@ -120,6 +116,7 @@ do_menus (GtkWidget *do_widget)
|
|||||||
gtk_widget_show (box1);
|
gtk_widget_show (box1);
|
||||||
|
|
||||||
menubar = gtk_menu_bar_new ();
|
menubar = gtk_menu_bar_new ();
|
||||||
|
gtk_widget_set_hexpand (menubar, TRUE);
|
||||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||||
gtk_widget_show (menubar);
|
gtk_widget_show (menubar);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ do_offscreen_window (GtkWidget *do_widget)
|
|||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
/* Paned Widgets
|
/* Paned Widgets
|
||||||
*
|
*
|
||||||
* The GtkHPaned and GtkVPaned Widgets divide their content
|
* The GtkPaned Widget divides its content area into two panes
|
||||||
* area into two panes with a divider in between that the
|
* with a divider in between that the user can adjust. A separate
|
||||||
* user can adjust. A separate child is placed into each
|
* child is placed into each pane. GtkPaned widgets can be split
|
||||||
* pane.
|
* horizontally or vertially.
|
||||||
*
|
*
|
||||||
* There are a number of options that can be set for 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
|
* This test contains both a horizontal and a vertical GtkPaned
|
||||||
* (VPaned) widget, and allows you to adjust the options for
|
* widget, and allows you to adjust the options for each side of
|
||||||
* each side of each widget.
|
* each widget.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@ -141,7 +141,7 @@ do_panes (GtkWidget *do_widget)
|
|||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
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);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
@ -84,7 +84,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
|||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
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_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||||
gtk_widget_set_size_request (window, 200, -1);
|
gtk_widget_set_size_request (window, 200, -1);
|
||||||
|
@ -43,7 +43,7 @@ do_sidebar (GtkWidget *do_widget)
|
|||||||
header = gtk_header_bar_new ();
|
header = gtk_header_bar_new ();
|
||||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
|
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
|
||||||
gtk_window_set_titlebar (GTK_WINDOW(window), header);
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
|
window = gtk_dialog_new_with_buttons ("Size Groups",
|
||||||
GTK_WINDOW (do_widget),
|
GTK_WINDOW (do_widget),
|
||||||
0,
|
0,
|
||||||
_("_Close"),
|
_("_Close"),
|
||||||
|
@ -36,7 +36,7 @@ do_spinner (GtkWidget *do_widget)
|
|||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
window = gtk_dialog_new_with_buttons ("GtkSpinner",
|
window = gtk_dialog_new_with_buttons ("Spinner",
|
||||||
GTK_WINDOW (do_widget),
|
GTK_WINDOW (do_widget),
|
||||||
0,
|
0,
|
||||||
_("_Close"),
|
_("_Close"),
|
||||||
|
@ -14,17 +14,10 @@ GtkWidget *
|
|||||||
do_stack (GtkWidget *do_widget)
|
do_stack (GtkWidget *do_widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *window = NULL;
|
static GtkWidget *window = NULL;
|
||||||
GError *err = NULL;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
builder = gtk_builder_new ();
|
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
||||||
gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
g_error ("ERROR: %s\n", err->message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
gtk_builder_connect_signals (builder, NULL);
|
gtk_builder_connect_signals (builder, NULL);
|
||||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<!-- interface-requires gtk+ 3.6 -->
|
<!-- interface-requires gtk+ 3.6 -->
|
||||||
<object class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="title" translatable="yes">GtkStack</property>
|
<property name="title" translatable="yes">Stack</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="grid1">
|
<object class="GtkGrid" id="grid1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -181,6 +181,7 @@ do_textscroll (GtkWidget *do_widget)
|
|||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
|
||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
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);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||||
|
|
||||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
draw_shadow_box (cairo_t *cr,
|
draw_shadow_box (cairo_t *cr,
|
||||||
GdkRectangle rect,
|
GdkRectangle rect,
|
||||||
double radius,
|
double radius,
|
||||||
double transparency)
|
double transparency)
|
||||||
{
|
{
|
||||||
cairo_pattern_t *pattern;
|
cairo_pattern_t *pattern;
|
||||||
double x0, x1, x2, x3;
|
double x0, x1, x2, x3;
|
||||||
@ -23,140 +23,140 @@ draw_shadow_box (cairo_t *cr,
|
|||||||
x1 = rect.x + radius;
|
x1 = rect.x + radius;
|
||||||
x2 = rect.x + rect.width - radius;
|
x2 = rect.x + rect.width - radius;
|
||||||
x3 = rect.x + rect.width;
|
x3 = rect.x + rect.width;
|
||||||
|
|
||||||
y0 = rect.y;
|
y0 = rect.y;
|
||||||
y1 = rect.y + radius;
|
y1 = rect.y + radius;
|
||||||
y2 = rect.y + rect.height - radius;
|
y2 = rect.y + rect.height - radius;
|
||||||
y3 = rect.y + rect.height;
|
y3 = rect.y + rect.height;
|
||||||
|
|
||||||
/* Fill non-border part */
|
/* Fill non-border part */
|
||||||
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
|
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x1, y1, x2 - x1, y2 - y1);
|
x1, y1, x2 - x1, y2 - y1);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* Upper border */
|
/* Upper border */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
|
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, 0.0, 0.0, 0, 0, 0.0);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x1, y0,
|
x1, y0,
|
||||||
x2 - x1, y1 - y0);
|
x2 - x1, y1 - y0);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* Bottom border */
|
/* Bottom border */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x1, y2,
|
x1, y2,
|
||||||
x2 - x1, y3 - y2);
|
x2 - x1, y3 - y2);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* Left border */
|
/* Left border */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
|
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, 0.0, 0.0, 0, 0, 0.0);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x0, y1,
|
x0, y1,
|
||||||
x1 - x0, y2 - y1);
|
x1 - x0, y2 - y1);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* Right border */
|
/* Right border */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x2, y1,
|
x2, y1,
|
||||||
x3 - x2, y2 - y1);
|
x3 - x2, y2 - y1);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* NW corner */
|
/* NW corner */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_radial (x1, y1, 0,
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x0, y0,
|
x0, y0,
|
||||||
x1 - x0, y1 - y0);
|
x1 - x0, y1 - y0);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* NE corner */
|
/* NE corner */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_radial (x2, y1, 0,
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x2, y0,
|
x2, y0,
|
||||||
x3 - x2, y1 - y0);
|
x3 - x2, y1 - y0);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* SW corner */
|
/* SW corner */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_radial (x1, y2, 0,
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x0, y2,
|
x0, y2,
|
||||||
x1 - x0, y3 - y2);
|
x1 - x0, y3 - y2);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* SE corner */
|
/* SE corner */
|
||||||
|
|
||||||
pattern = cairo_pattern_create_radial (x2, y2, 0,
|
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, 0.0, 0.0, 0, 0, transparency);
|
||||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||||
|
|
||||||
cairo_set_source (cr, pattern);
|
cairo_set_source (cr, pattern);
|
||||||
cairo_pattern_destroy (pattern);
|
cairo_pattern_destroy (pattern);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
x2, y2,
|
x2, y2,
|
||||||
x3 - x2, y3 - y2);
|
x3 - x2, y3 - y2);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +174,8 @@ draw_callback (GtkWidget *widget,
|
|||||||
rect.height -= SHADOW_OFFSET_Y;
|
rect.height -= SHADOW_OFFSET_Y;
|
||||||
|
|
||||||
draw_shadow_box (cr,
|
draw_shadow_box (cr,
|
||||||
rect, SHADOW_RADIUS, 0.4);
|
rect, SHADOW_RADIUS, 0.4);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ do_transparent (GtkWidget *do_widget)
|
|||||||
g_signal_connect (window, "destroy",
|
g_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
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);
|
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||||
|
|
||||||
view = gtk_text_view_new ();
|
view = gtk_text_view_new ();
|
||||||
@ -230,7 +230,6 @@ do_transparent (GtkWidget *do_widget)
|
|||||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
|
||||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||||
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
gtk_widget_set_valign (entry, GTK_ALIGN_START);
|
||||||
|
|
||||||
|
|
||||||
gtk_widget_show_all (overlay);
|
gtk_widget_show_all (overlay);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ do_tree_store (GtkWidget *do_widget)
|
|||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_screen (GTK_WINDOW (window),
|
gtk_window_set_screen (GTK_WINDOW (window),
|
||||||
gtk_widget_get_screen (do_widget));
|
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_signal_connect (window, "destroy",
|
||||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user