forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2746
This commit is contained in:
commit
b2d6011679
BIN
docs/reference/gtk/images/box.png
Normal file
BIN
docs/reference/gtk/images/box.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
docs/reference/gtk/images/centerbox.png
Normal file
BIN
docs/reference/gtk/images/centerbox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
docs/reference/gtk/images/grid.png
Normal file
BIN
docs/reference/gtk/images/grid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
BIN
docs/reference/gtk/images/overlay.png
Normal file
BIN
docs/reference/gtk/images/overlay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
@ -240,12 +240,14 @@ images = [
|
|||||||
'images/border1.png',
|
'images/border1.png',
|
||||||
'images/border2.png',
|
'images/border2.png',
|
||||||
'images/border3.png',
|
'images/border3.png',
|
||||||
|
'images/box.png',
|
||||||
'images/box-expand.png',
|
'images/box-expand.png',
|
||||||
'images/box-packing.png',
|
'images/box-packing.png',
|
||||||
'images/builder-shortcuts.png',
|
'images/builder-shortcuts.png',
|
||||||
'images/button.png',
|
'images/button.png',
|
||||||
'images/calendar.png',
|
'images/calendar.png',
|
||||||
'images/capture-bubble.png',
|
'images/capture-bubble.png',
|
||||||
|
'images/centerbox.png',
|
||||||
'images/check-button.png',
|
'images/check-button.png',
|
||||||
'images/checks.png',
|
'images/checks.png',
|
||||||
'images/clocks-shortcuts.png',
|
'images/clocks-shortcuts.png',
|
||||||
@ -297,6 +299,7 @@ images = [
|
|||||||
'images/gradient2.png',
|
'images/gradient2.png',
|
||||||
'images/gradient3.png',
|
'images/gradient3.png',
|
||||||
'images/gradient4.png',
|
'images/gradient4.png',
|
||||||
|
'images/grid.png',
|
||||||
'images/grid-packing.png',
|
'images/grid-packing.png',
|
||||||
'images/handles.png',
|
'images/handles.png',
|
||||||
'images/headerbar.png',
|
'images/headerbar.png',
|
||||||
@ -335,6 +338,7 @@ images = [
|
|||||||
'images/multiline-text.png',
|
'images/multiline-text.png',
|
||||||
'images/notebook.png',
|
'images/notebook.png',
|
||||||
'images/options.png',
|
'images/options.png',
|
||||||
|
'images/overlay.png',
|
||||||
'images/pagesetupdialog.png',
|
'images/pagesetupdialog.png',
|
||||||
'images/panes.png',
|
'images/panes.png',
|
||||||
'images/password-entry.png',
|
'images/password-entry.png',
|
||||||
|
@ -64,6 +64,11 @@
|
|||||||
|
|
||||||
<section id="visual-containers">
|
<section id="visual-containers">
|
||||||
<title>Containers</title>
|
<title>Containers</title>
|
||||||
|
<para role="gallery">
|
||||||
|
<link linkend="GtkBox"><inlinegraphic fileref="box.png" format="PNG"></inlinegraphic></link>
|
||||||
|
<link linkend="GtkGrid"><inlinegraphic fileref="grid.png" format="PNG"></inlinegraphic></link>
|
||||||
|
<link linkend="GtkCenterBox"><inlinegraphic fileref="centerbox.png" format="PNG"></inlinegraphic></link>
|
||||||
|
</para>
|
||||||
<para role="gallery">
|
<para role="gallery">
|
||||||
<link linkend="GtkScrolledWindow"><inlinegraphic fileref="scrolledwindow.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkScrolledWindow"><inlinegraphic fileref="scrolledwindow.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkPaned"><inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkPaned"><inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic></link>
|
||||||
@ -77,6 +82,7 @@
|
|||||||
<link linkend="GtkFlowBox"><inlinegraphic fileref="flow-box.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkFlowBox"><inlinegraphic fileref="flow-box.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkTreeView"><inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkTreeView"><inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkIconView"><inlinegraphic fileref="icon-view.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkIconView"><inlinegraphic fileref="icon-view.png" format="PNG"></inlinegraphic></link>
|
||||||
|
<link linkend="GtkOverlay"><inlinegraphic fileref="overlay.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkStack"><inlinegraphic fileref="stack.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkStack"><inlinegraphic fileref="stack.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkStackSwitcher"><inlinegraphic fileref="stackswitcher.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkStackSwitcher"><inlinegraphic fileref="stackswitcher.png" format="PNG"></inlinegraphic></link>
|
||||||
<link linkend="GtkStackSidebar"><inlinegraphic fileref="sidebar.png" format="PNG"></inlinegraphic></link>
|
<link linkend="GtkStackSidebar"><inlinegraphic fileref="sidebar.png" format="PNG"></inlinegraphic></link>
|
||||||
|
@ -681,6 +681,7 @@ create_editable_label (void)
|
|||||||
|
|
||||||
return new_widget_info ("editable-label", vbox, SMALL);
|
return new_widget_info ("editable-label", vbox, SMALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WidgetInfo *
|
static WidgetInfo *
|
||||||
create_separator (void)
|
create_separator (void)
|
||||||
{
|
{
|
||||||
@ -1924,10 +1925,208 @@ create_drawing_area (void)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static WidgetInfo *
|
||||||
|
create_box (void)
|
||||||
|
{
|
||||||
|
GtkWidget *hbox;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||||
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40);
|
||||||
|
gtk_widget_set_margin_top (hbox, 20);
|
||||||
|
gtk_widget_set_margin_bottom (hbox, 20);
|
||||||
|
gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
|
||||||
|
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
GtkWidget *button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_box_append (GTK_BOX (widget), button);
|
||||||
|
}
|
||||||
|
gtk_box_append (GTK_BOX (widget), gtk_label_new ("⋯"));
|
||||||
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_box_append (GTK_BOX (hbox), widget);
|
||||||
|
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
GtkWidget *button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_box_append (GTK_BOX (widget), button);
|
||||||
|
}
|
||||||
|
gtk_box_append (GTK_BOX (widget), gtk_label_new ("⋮"));
|
||||||
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_box_append (GTK_BOX (hbox), widget);
|
||||||
|
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||||
|
gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL,
|
||||||
|
"label", "Horizontal and Vertical Boxes",
|
||||||
|
"justify", GTK_JUSTIFY_CENTER,
|
||||||
|
NULL));
|
||||||
|
add_margin (vbox);
|
||||||
|
|
||||||
|
return new_widget_info ("box", vbox, MEDIUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
static WidgetInfo *
|
||||||
|
create_center_box (void)
|
||||||
|
{
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||||
|
widget = gtk_center_box_new ();
|
||||||
|
gtk_widget_set_margin_top (widget, 10);
|
||||||
|
gtk_widget_set_margin_bottom (widget, 10);
|
||||||
|
gtk_widget_set_margin_start (widget, 20);
|
||||||
|
gtk_widget_set_margin_end (widget, 20);
|
||||||
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
||||||
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_center_box_set_start_widget (GTK_CENTER_BOX (widget), button);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_center_box_set_center_widget (GTK_CENTER_BOX (widget), button);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
|
||||||
|
|
||||||
|
gtk_box_append (GTK_BOX (vbox), widget);
|
||||||
|
gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL,
|
||||||
|
"label", "Center Box",
|
||||||
|
"justify", GTK_JUSTIFY_CENTER,
|
||||||
|
NULL));
|
||||||
|
add_margin (vbox);
|
||||||
|
|
||||||
|
return new_widget_info ("centerbox", vbox, SMALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static WidgetInfo *
|
||||||
|
create_grid (void)
|
||||||
|
{
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
||||||
|
widget = gtk_grid_new ();
|
||||||
|
gtk_grid_set_row_spacing (GTK_GRID (widget), 4);
|
||||||
|
gtk_grid_set_column_spacing (GTK_GRID (widget), 4);
|
||||||
|
gtk_widget_set_margin_top (widget, 20);
|
||||||
|
gtk_widget_set_margin_bottom (widget, 20);
|
||||||
|
gtk_widget_set_margin_start (widget, 20);
|
||||||
|
gtk_widget_set_margin_end (widget, 20);
|
||||||
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), button, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), button, 0, 1, 1, 1);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), button, 1, 0, 1, 1);
|
||||||
|
|
||||||
|
button = gtk_button_new ();
|
||||||
|
gtk_widget_add_css_class (button, "small");
|
||||||
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), button, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), gtk_label_new ("⋯"), 2, 0, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (widget), gtk_label_new ("⋮"), 0, 2, 1, 1);
|
||||||
|
|
||||||
|
gtk_box_append (GTK_BOX (vbox), widget);
|
||||||
|
gtk_box_append (GTK_BOX (vbox), g_object_new (GTK_TYPE_LABEL,
|
||||||
|
"label", "Grid",
|
||||||
|
"justify", GTK_JUSTIFY_CENTER,
|
||||||
|
NULL));
|
||||||
|
add_margin (vbox);
|
||||||
|
|
||||||
|
return new_widget_info ("grid", vbox, MEDIUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
static WidgetInfo *
|
||||||
|
create_overlay (void)
|
||||||
|
{
|
||||||
|
GtkWidget *vbox;
|
||||||
|
WidgetInfo *info;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GtkWidget *overlay;
|
||||||
|
GtkWidget *label;
|
||||||
|
GtkWidget *child;
|
||||||
|
|
||||||
|
widget = gtk_frame_new (NULL);
|
||||||
|
overlay = gtk_overlay_new ();
|
||||||
|
gtk_widget_add_css_class (widget, "view");
|
||||||
|
label = gtk_label_new ("Content");
|
||||||
|
gtk_widget_set_vexpand (label, TRUE);
|
||||||
|
gtk_frame_set_child (GTK_FRAME (widget), overlay);
|
||||||
|
gtk_overlay_set_child (GTK_OVERLAY (overlay), label);
|
||||||
|
|
||||||
|
child = gtk_frame_new (NULL);
|
||||||
|
gtk_widget_add_css_class (child, "app-notification");
|
||||||
|
gtk_frame_set_child (GTK_FRAME (child), gtk_label_new ("Overlay"));
|
||||||
|
gtk_widget_set_valign (child, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_halign (child, GTK_ALIGN_CENTER);
|
||||||
|
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), child);
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||||
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
||||||
|
gtk_widget_set_valign (widget, GTK_ALIGN_FILL);
|
||||||
|
|
||||||
|
gtk_box_append (GTK_BOX (vbox), widget);
|
||||||
|
gtk_box_append (GTK_BOX (vbox), gtk_label_new ("Overlay"));
|
||||||
|
|
||||||
|
add_margin (vbox);
|
||||||
|
|
||||||
|
info = new_widget_info ("overlay", vbox, MEDIUM);
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
get_all_widgets (void)
|
get_all_widgets (void)
|
||||||
{
|
{
|
||||||
GList *retval = NULL;
|
GList *retval = NULL;
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (provider,
|
||||||
|
"button.small {\n"
|
||||||
|
" min-width: 16px;\n"
|
||||||
|
" min-height: 16px;\n"
|
||||||
|
" padding: 0;\n"
|
||||||
|
"}", -1);
|
||||||
|
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
800);
|
||||||
|
|
||||||
retval = g_list_prepend (retval, create_search_bar ());
|
retval = g_list_prepend (retval, create_search_bar ());
|
||||||
retval = g_list_prepend (retval, create_action_bar ());
|
retval = g_list_prepend (retval, create_action_bar ());
|
||||||
@ -1997,7 +2196,11 @@ get_all_widgets (void)
|
|||||||
retval = g_list_prepend (retval, create_popover ());
|
retval = g_list_prepend (retval, create_popover ());
|
||||||
retval = g_list_prepend (retval, create_menu ());
|
retval = g_list_prepend (retval, create_menu ());
|
||||||
retval = g_list_prepend (retval, create_shortcuts_window ());
|
retval = g_list_prepend (retval, create_shortcuts_window ());
|
||||||
retval = g_list_prepend (retval, create_drawing_area());
|
retval = g_list_prepend (retval, create_drawing_area ());
|
||||||
|
retval = g_list_prepend (retval, create_box ());
|
||||||
|
retval = g_list_prepend (retval, create_center_box ());
|
||||||
|
retval = g_list_prepend (retval, create_grid ());
|
||||||
|
retval = g_list_prepend (retval, create_overlay ());
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -681,6 +681,11 @@ gtk_model_button_set_text (GtkModelButton *button,
|
|||||||
gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label),
|
gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label),
|
||||||
text ? text : "");
|
text ? text : "");
|
||||||
update_visibility (button);
|
update_visibility (button);
|
||||||
|
|
||||||
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, button->label),
|
||||||
|
-1);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user