Compare commits
94 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cf75fc899 | |||
| 2c59c98b39 | |||
| 9f8013ef95 | |||
| ddf41dc993 | |||
| f5801794dd | |||
| dfb71eadd5 | |||
| 1711baad58 | |||
| b8c3395baa | |||
| 82612ba291 | |||
| 28a1759230 | |||
| 5a386accc0 | |||
| 2fca8c83b4 | |||
| a7c410c0c2 | |||
| 3596f5b6c8 | |||
| b06fa99e99 | |||
| d9b9ba5da0 | |||
| 8ca13c4679 | |||
| 316d450421 | |||
| c7b4dd5f9d | |||
| e8d4bfd04b | |||
| e253a414b0 | |||
| ac8817d34b | |||
| c630804647 | |||
| 43f1ac2b8f | |||
| ebbc7791dd | |||
| 2b4c9983da | |||
| f354cef61b | |||
| 8fbd6e2edc | |||
| e64c1f8929 | |||
| 1df8d18ad2 | |||
| 433c0c2134 | |||
| 627685e2a2 | |||
| 72cd8b4dab | |||
| d6684b5748 | |||
| 7523b25942 | |||
| 6acc8c0817 | |||
| 9a42942afb | |||
| 1e1cf89e4f | |||
| 5ad618cb95 | |||
| 77e0f18eda | |||
| 852cbb62b8 | |||
| f15bc7818e | |||
| 655c781b6e | |||
| f0f07ad6d8 | |||
| 179004f0a7 | |||
| e58b19db04 | |||
| 315261260c | |||
| 3450388ff0 | |||
| 009aadf378 | |||
| 7bbbb01ff5 | |||
| a44d6816d3 | |||
| 7846bedebd | |||
| 87922575d3 | |||
| 0c1423d962 | |||
| ca0a18918c | |||
| 5322420145 | |||
| 66007d0ab6 | |||
| 15bba87e9a | |||
| 8ff96b3bb2 | |||
| 86688c6fde | |||
| aec62e1c10 | |||
| d7f43c30a3 | |||
| 0bd173e3d8 | |||
| 443459b52e | |||
| d82257e1c8 | |||
| b88c0d7387 | |||
| 6d77bf66ac | |||
| b8e4adfff9 | |||
| 361754b063 | |||
| b5912e61fd | |||
| e5b384f537 | |||
| b164df7450 | |||
| 6186429f5f | |||
| a8123bf95e | |||
| af6f874060 | |||
| b0cf4d057d | |||
| 71f1f768cc | |||
| 49511c7f42 | |||
| 85ccb93b9f | |||
| 24bac24602 | |||
| f83ba08f7f | |||
| c37b30f317 | |||
| 88cd26575d | |||
| e72a78c4e6 | |||
| 8ca73e3258 | |||
| 06f5b1e572 | |||
| 2e39c4bab8 | |||
| 57c4bcb369 | |||
| 9b91e06513 | |||
| 44ba055d03 | |||
| 32abb29b32 | |||
| a25e0a97d5 | |||
| 9d8e3be6d7 | |||
| 9ded1c0c99 |
@@ -39,6 +39,7 @@ demos = \
|
|||||||
pickers.c \
|
pickers.c \
|
||||||
pixbufs.c \
|
pixbufs.c \
|
||||||
printing.c \
|
printing.c \
|
||||||
|
revealer.c \
|
||||||
rotated_text.c \
|
rotated_text.c \
|
||||||
search_entry.c \
|
search_entry.c \
|
||||||
sizegroup.c \
|
sizegroup.c \
|
||||||
@@ -86,7 +87,7 @@ gsettings_SCHEMAS = \
|
|||||||
@GSETTINGS_RULES@
|
@GSETTINGS_RULES@
|
||||||
|
|
||||||
demos.h: @REBUILD@ $(demos) geninclude.pl
|
demos.h: @REBUILD@ $(demos) geninclude.pl
|
||||||
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
||||||
|
|
||||||
gtk3_demo_SOURCES = \
|
gtk3_demo_SOURCES = \
|
||||||
$(demos) \
|
$(demos) \
|
||||||
@@ -112,6 +113,7 @@ RESOURCES= $(demos) \
|
|||||||
demo.ui \
|
demo.ui \
|
||||||
menus.ui \
|
menus.ui \
|
||||||
stack.ui \
|
stack.ui \
|
||||||
|
revealer.ui \
|
||||||
theming.ui \
|
theming.ui \
|
||||||
alphatest.png \
|
alphatest.png \
|
||||||
apple-red.png \
|
apple-red.png \
|
||||||
|
|||||||
@@ -58,6 +58,9 @@
|
|||||||
<gresource prefix="/stack">
|
<gresource prefix="/stack">
|
||||||
<file>stack.ui</file>
|
<file>stack.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/revealer">
|
||||||
|
<file>revealer.ui</file>
|
||||||
|
</gresource>
|
||||||
<gresource prefix="/images">
|
<gresource prefix="/images">
|
||||||
<file>alphatest.png</file>
|
<file>alphatest.png</file>
|
||||||
<file>floppybuddy.gif</file>
|
<file>floppybuddy.gif</file>
|
||||||
@@ -110,6 +113,7 @@
|
|||||||
<file>pickers.c</file>
|
<file>pickers.c</file>
|
||||||
<file>pixbufs.c</file>
|
<file>pixbufs.c</file>
|
||||||
<file>printing.c</file>
|
<file>printing.c</file>
|
||||||
|
<file>revealer.c</file>
|
||||||
<file>rotated_text.c</file>
|
<file>rotated_text.c</file>
|
||||||
<file>search_entry.c</file>
|
<file>search_entry.c</file>
|
||||||
<file>sizegroup.c</file>
|
<file>sizegroup.c</file>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/* Revealer
|
||||||
|
*
|
||||||
|
* GtkRevealer is a container that animates showing and hiding
|
||||||
|
* of its sole child with nice transitions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static GtkBuilder *builder;
|
||||||
|
static gint count = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
|
change_direction (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
gboolean revealed;
|
||||||
|
|
||||||
|
revealed = gtk_revealer_get_child_revealed (revealer);
|
||||||
|
gtk_revealer_set_reveal_child (revealer, !revealed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
reveal_one (gpointer data)
|
||||||
|
{
|
||||||
|
gchar *name;
|
||||||
|
GtkRevealer *revealer;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("revealer%d", count);
|
||||||
|
revealer = (GtkRevealer *)gtk_builder_get_object (builder, name);
|
||||||
|
|
||||||
|
gtk_revealer_set_reveal_child (revealer, TRUE);
|
||||||
|
|
||||||
|
g_signal_connect (revealer, "notify::child-revealed",
|
||||||
|
G_CALLBACK (change_direction), NULL);
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return count < 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
response_cb (GtkWidget *dialog,
|
||||||
|
gint response_id,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy (dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
do_revealer (GtkWidget *do_widget)
|
||||||
|
{
|
||||||
|
static GtkWidget *window = NULL;
|
||||||
|
GError *err = NULL;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
builder = gtk_builder_new ();
|
||||||
|
gtk_builder_add_from_resource (builder, "/revealer/revealer.ui", &err);
|
||||||
|
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, "dialog1"));
|
||||||
|
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, "response", G_CALLBACK (response_cb), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gtk_widget_get_visible (window))
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
g_timeout_add (690, reveal_one, NULL);
|
||||||
|
gtk_widget_show_all (window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 3.6 -->
|
||||||
|
<object class="GtkDialog" id="dialog1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<property name="default_width">300</property>
|
||||||
|
<property name="default_height">300</property>
|
||||||
|
<property name="title">Revealer</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button1">
|
||||||
|
<property name="label">gtk-close</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">end</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="grid1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer0">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">crossfade</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image0">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-up</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-right</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">3</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-down</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-left</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-up</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-right</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">4</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-down</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-duration">2000</property>
|
||||||
|
<property name="transition-type">slide-left</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="image8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">face-cool-symbolic</property>
|
||||||
|
<property name="icon-size">6</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="0">button1</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
@@ -237,6 +237,7 @@
|
|||||||
<xi:include href="xml/gtkstack.xml" />
|
<xi:include href="xml/gtkstack.xml" />
|
||||||
<xi:include href="xml/gtkstackswitcher.xml" />
|
<xi:include href="xml/gtkstackswitcher.xml" />
|
||||||
<xi:include href="xml/gtkexpander.xml" />
|
<xi:include href="xml/gtkexpander.xml" />
|
||||||
|
<xi:include href="xml/gtkrevealer.xml" />
|
||||||
<xi:include href="xml/gtkoverlay.xml" />
|
<xi:include href="xml/gtkoverlay.xml" />
|
||||||
<xi:include href="xml/gtkheaderbar.xml" />
|
<xi:include href="xml/gtkheaderbar.xml" />
|
||||||
<xi:include href="xml/gtkorientable.xml" />
|
<xi:include href="xml/gtkorientable.xml" />
|
||||||
|
|||||||
@@ -486,6 +486,8 @@ gtk_box_set_spacing
|
|||||||
gtk_box_reorder_child
|
gtk_box_reorder_child
|
||||||
gtk_box_query_child_packing
|
gtk_box_query_child_packing
|
||||||
gtk_box_set_child_packing
|
gtk_box_set_child_packing
|
||||||
|
gtk_box_get_baseline_position
|
||||||
|
gtk_box_set_baseline_position
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GTK_BOX
|
GTK_BOX
|
||||||
GTK_IS_BOX
|
GTK_IS_BOX
|
||||||
@@ -5188,6 +5190,7 @@ gtk_widget_remove_tick_callback
|
|||||||
gtk_widget_size_request
|
gtk_widget_size_request
|
||||||
gtk_widget_get_child_requisition
|
gtk_widget_get_child_requisition
|
||||||
gtk_widget_size_allocate
|
gtk_widget_size_allocate
|
||||||
|
gtk_widget_size_allocate_with_baseline
|
||||||
gtk_widget_add_accelerator
|
gtk_widget_add_accelerator
|
||||||
gtk_widget_remove_accelerator
|
gtk_widget_remove_accelerator
|
||||||
gtk_widget_set_accel_path
|
gtk_widget_set_accel_path
|
||||||
@@ -5320,6 +5323,7 @@ gtk_widget_get_allocated_width
|
|||||||
gtk_widget_get_allocated_height
|
gtk_widget_get_allocated_height
|
||||||
gtk_widget_get_allocation
|
gtk_widget_get_allocation
|
||||||
gtk_widget_set_allocation
|
gtk_widget_set_allocation
|
||||||
|
gtk_widget_get_allocated_baseline
|
||||||
gtk_widget_get_app_paintable
|
gtk_widget_get_app_paintable
|
||||||
gtk_widget_get_can_default
|
gtk_widget_get_can_default
|
||||||
gtk_widget_set_can_default
|
gtk_widget_set_can_default
|
||||||
@@ -5380,8 +5384,10 @@ gtk_widget_get_preferred_height
|
|||||||
gtk_widget_get_preferred_width
|
gtk_widget_get_preferred_width
|
||||||
gtk_widget_get_preferred_height_for_width
|
gtk_widget_get_preferred_height_for_width
|
||||||
gtk_widget_get_preferred_width_for_height
|
gtk_widget_get_preferred_width_for_height
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width
|
||||||
gtk_widget_get_request_mode
|
gtk_widget_get_request_mode
|
||||||
gtk_widget_get_preferred_size
|
gtk_widget_get_preferred_size
|
||||||
|
gtk_widget_get_preferred_size_and_baseline
|
||||||
gtk_distribute_natural_allocation
|
gtk_distribute_natural_allocation
|
||||||
|
|
||||||
<SUBSECTION Alignment and Margins>
|
<SUBSECTION Alignment and Margins>
|
||||||
@@ -5389,6 +5395,7 @@ GtkAlign
|
|||||||
gtk_widget_get_halign
|
gtk_widget_get_halign
|
||||||
gtk_widget_set_halign
|
gtk_widget_set_halign
|
||||||
gtk_widget_get_valign
|
gtk_widget_get_valign
|
||||||
|
gtk_widget_get_valign_with_baseline
|
||||||
gtk_widget_set_valign
|
gtk_widget_set_valign
|
||||||
gtk_widget_get_margin_left
|
gtk_widget_get_margin_left
|
||||||
gtk_widget_set_margin_left
|
gtk_widget_set_margin_left
|
||||||
@@ -7290,6 +7297,10 @@ gtk_grid_set_column_homogeneous
|
|||||||
gtk_grid_get_column_homogeneous
|
gtk_grid_get_column_homogeneous
|
||||||
gtk_grid_set_column_spacing
|
gtk_grid_set_column_spacing
|
||||||
gtk_grid_get_column_spacing
|
gtk_grid_get_column_spacing
|
||||||
|
gtk_grid_get_baseline_row
|
||||||
|
gtk_grid_set_baseline_row
|
||||||
|
gtk_grid_get_row_baseline_position
|
||||||
|
gtk_grid_set_row_baseline_position
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GtkGridClass
|
GtkGridClass
|
||||||
@@ -7594,3 +7605,18 @@ gtk_stack_switcher_new
|
|||||||
gtk_stack_switcher_set_stack
|
gtk_stack_switcher_set_stack
|
||||||
gtk_stack_switcher_get_stack
|
gtk_stack_switcher_get_stack
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>gtkrevealer</FILE>
|
||||||
|
<TITLE>GtkRevealer</TITLE>
|
||||||
|
GtkRevealer
|
||||||
|
gtk_revealer_new
|
||||||
|
gtk_revealer_get_reveal_child
|
||||||
|
gtk_revealer_set_reveal_child
|
||||||
|
gtk_revealer_get_child_revealed
|
||||||
|
gtk_revealer_get_transition_duration
|
||||||
|
gtk_revealer_set_transition_duration
|
||||||
|
GtkRevealerTransitionType
|
||||||
|
gtk_revealer_get_transition_type
|
||||||
|
gtk_revealer_set_transition_type
|
||||||
|
</SECTION>
|
||||||
|
|||||||
+2
-1
@@ -174,6 +174,7 @@ libgdk_3_la_LIBADD += x11/libgdk-x11.la
|
|||||||
endif # USE_X11
|
endif # USE_X11
|
||||||
|
|
||||||
if USE_QUARTZ
|
if USE_QUARTZ
|
||||||
|
libgdk_3_la_CFLAGS = -xobjective-c
|
||||||
libgdk_3_la_LIBADD += quartz/libgdk-quartz.la
|
libgdk_3_la_LIBADD += quartz/libgdk-quartz.la
|
||||||
endif # USE_QUARTZ
|
endif # USE_QUARTZ
|
||||||
|
|
||||||
@@ -370,7 +371,7 @@ dist-hook: ../build/win32/vs9/gdk.vcproj ../build/win32/vs10/gdk.vcxproj ../buil
|
|||||||
done >libgdk.sourcefiles
|
done >libgdk.sourcefiles
|
||||||
$(CPP) -P - <$(top_srcdir)/build/win32/vs9/gdk.vcprojin >$@
|
$(CPP) -P - <$(top_srcdir)/build/win32/vs9/gdk.vcprojin >$@
|
||||||
rm libgdk.sourcefiles
|
rm libgdk.sourcefiles
|
||||||
|
|
||||||
../build/win32/vs10/gdk.vcxproj: ../build/win32/vs10/gdk.vcxprojin
|
../build/win32/vs10/gdk.vcxproj: ../build/win32/vs10/gdk.vcxprojin
|
||||||
for F in $(libgdk_3_la_SOURCES); do \
|
for F in $(libgdk_3_la_SOURCES); do \
|
||||||
case $$F in \
|
case $$F in \
|
||||||
|
|||||||
@@ -38,11 +38,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_QUARTZ
|
#ifdef GDK_WINDOWING_QUARTZ
|
||||||
/* We immediately include gdkquartzdisplaymanager.h here instead of
|
/* When the gdk_quartz_display_open function is removed We can
|
||||||
* gdkquartz.h so that we do not have to enable -xobjective-c for the
|
* immediately include gdkquartzdisplaymanager.h here instead of
|
||||||
* "generic" GDK source code.
|
* gdkprivate-quartz.h so that we won't have to enable -xobjective-c
|
||||||
|
* for the "generic" GDK source code.
|
||||||
|
* #include "quartz/gdkquartzdisplaymanager.h"
|
||||||
*/
|
*/
|
||||||
#include "quartz/gdkquartzdisplaymanager.h"
|
|
||||||
#include "quartz/gdkprivate-quartz.h"
|
#include "quartz/gdkprivate-quartz.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define __GDK_QUARTZ_DEVICE_MANAGER_CORE__
|
#define __GDK_QUARTZ_DEVICE_MANAGER_CORE__
|
||||||
|
|
||||||
#include <gdkdevicemanagerprivate.h>
|
#include <gdkdevicemanagerprivate.h>
|
||||||
#include <gdkquartzdevicemanager-core.h>
|
#include "gdkquartzdevicemanager-core.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,4 @@ gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
|
|||||||
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
|
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
|
||||||
|
|
||||||
object_class->finalize = gdk_quartz_display_manager_finalize;
|
object_class->finalize = gdk_quartz_display_manager_finalize;
|
||||||
|
|
||||||
manager_class->atom_intern = _gdk_quartz_display_manager_atom_intern;
|
|
||||||
manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define __GDK_QUARTZ_DND__
|
#define __GDK_QUARTZ_DND__
|
||||||
|
|
||||||
#include <gdkdndprivate.h>
|
#include <gdkdndprivate.h>
|
||||||
#include <gdkquartzdnd.h>
|
#include "gdkquartzdnd.h"
|
||||||
|
|
||||||
#include <AppKit/AppKit.h>
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
|||||||
@@ -154,14 +154,6 @@ gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *disp
|
|||||||
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
|
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
|
||||||
const gchar *str);
|
const gchar *str);
|
||||||
|
|
||||||
|
|
||||||
/* Display manager methods - events */
|
|
||||||
GdkAtom _gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
|
|
||||||
const gchar *atom_name,
|
|
||||||
gboolean copy_name);
|
|
||||||
gchar * _gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
|
|
||||||
GdkAtom atom);
|
|
||||||
|
|
||||||
/* Screen */
|
/* Screen */
|
||||||
GdkScreen *_gdk_quartz_screen_new (void);
|
GdkScreen *_gdk_quartz_screen_new (void);
|
||||||
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
|
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
|
||||||
|
|||||||
@@ -148,26 +148,6 @@ intern_atom_internal (const gchar *atom_name, gboolean allocate)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkAtom
|
|
||||||
_gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
|
|
||||||
const gchar *atom_name,
|
|
||||||
gboolean copy_name)
|
|
||||||
{
|
|
||||||
return intern_atom_internal (atom_name, copy_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
gchar *
|
|
||||||
_gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
|
|
||||||
GdkAtom atom)
|
|
||||||
{
|
|
||||||
ensure_atom_tables ();
|
|
||||||
|
|
||||||
if (GPOINTER_TO_INT (atom) >= atoms_to_names->len)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_strdup (g_ptr_array_index (atoms_to_names, GPOINTER_TO_INT (atom)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_quartz_window_delete_property (GdkWindow *window,
|
_gdk_quartz_window_delete_property (GdkWindow *window,
|
||||||
GdkAtom property)
|
GdkAtom property)
|
||||||
|
|||||||
+3
-1
@@ -295,6 +295,7 @@ gtk_public_h_sources = \
|
|||||||
gtkpagesetup.h \
|
gtkpagesetup.h \
|
||||||
gtkpaned.h \
|
gtkpaned.h \
|
||||||
gtkpapersize.h \
|
gtkpapersize.h \
|
||||||
|
gtkpathbar.h \
|
||||||
gtkplacessidebar.h \
|
gtkplacessidebar.h \
|
||||||
gtkplug.h \
|
gtkplug.h \
|
||||||
gtkprintcontext.h \
|
gtkprintcontext.h \
|
||||||
@@ -314,6 +315,7 @@ gtk_public_h_sources = \
|
|||||||
gtkrecentchooserwidget.h \
|
gtkrecentchooserwidget.h \
|
||||||
gtkrecentfilter.h \
|
gtkrecentfilter.h \
|
||||||
gtkrecentmanager.h \
|
gtkrecentmanager.h \
|
||||||
|
gtkrevealer.h \
|
||||||
gtkscale.h \
|
gtkscale.h \
|
||||||
gtkscalebutton.h \
|
gtkscalebutton.h \
|
||||||
gtkscrollable.h \
|
gtkscrollable.h \
|
||||||
@@ -513,7 +515,6 @@ gtk_private_h_sources = \
|
|||||||
gtknumerableiconprivate.h \
|
gtknumerableiconprivate.h \
|
||||||
gtkorientableprivate.h \
|
gtkorientableprivate.h \
|
||||||
gtkpango.h \
|
gtkpango.h \
|
||||||
gtkpathbar.h \
|
|
||||||
gtkpressandholdprivate.h \
|
gtkpressandholdprivate.h \
|
||||||
gtkprintoperation-private.h \
|
gtkprintoperation-private.h \
|
||||||
gtkprintutils.h \
|
gtkprintutils.h \
|
||||||
@@ -815,6 +816,7 @@ gtk_base_c_sources = \
|
|||||||
gtkrecentfilter.c \
|
gtkrecentfilter.c \
|
||||||
gtkrecentmanager.c \
|
gtkrecentmanager.c \
|
||||||
gtkresources.c \
|
gtkresources.c \
|
||||||
|
gtkrevealer.c \
|
||||||
gtkroundedbox.c \
|
gtkroundedbox.c \
|
||||||
gtkscale.c \
|
gtkscale.c \
|
||||||
gtkscalebutton.c \
|
gtkscalebutton.c \
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
<glade-widget-class name="GtkColorPlane" generic-name="colorplane" title="Color Plane" icon-name="widget-gtk-colorselection"/>
|
<glade-widget-class name="GtkColorPlane" generic-name="colorplane" title="Color Plane" icon-name="widget-gtk-colorselection"/>
|
||||||
<glade-widget-class name="GtkColorScale" generic-name="colorscale" title="Color Scale" icon-name="widget-gtk-colorselection"/>
|
<glade-widget-class name="GtkColorScale" generic-name="colorscale" title="Color Scale" icon-name="widget-gtk-colorselection"/>
|
||||||
<glade-widget-class name="GtkScaleButtonScale" generic-name="scalebuttonscale" title="Scale Button Scale"/>
|
<glade-widget-class name="GtkScaleButtonScale" generic-name="scalebuttonscale" title="Scale Button Scale"/>
|
||||||
<glade-widget-class name="ShortcutsPaneModelFilter" generic-name="shortcutsfilter" title="Shortcuts Filter"
|
|
||||||
icon-name="widget-gtk-treemodelfilter"/>
|
|
||||||
|
|
||||||
<!-- gtkunixprint private widgets -->
|
<!-- gtkunixprint private widgets -->
|
||||||
<glade-widget-class name="GtkPrinterOptionWidget" generic-name="printeroptionwidget" title="Printer Option Widget"
|
<glade-widget-class name="GtkPrinterOptionWidget" generic-name="printeroptionwidget" title="Printer Option Widget"
|
||||||
@@ -22,7 +20,6 @@
|
|||||||
<property id="size" disabled="True"/>
|
<property id="size" disabled="True"/>
|
||||||
</properties>
|
</properties>
|
||||||
</glade-widget-class>
|
</glade-widget-class>
|
||||||
<glade-widget-class name="GtkPlacesSidebar" generic-name="placessidebar" title="Places Sidebar"/>
|
|
||||||
</glade-widget-classes>
|
</glade-widget-classes>
|
||||||
|
|
||||||
<glade-widget-group name="gtk-private" title="Private GTK+ Classes">
|
<glade-widget-group name="gtk-private" title="Private GTK+ Classes">
|
||||||
@@ -31,8 +28,6 @@
|
|||||||
<glade-widget-class-ref name="GtkColorPlane"/>
|
<glade-widget-class-ref name="GtkColorPlane"/>
|
||||||
<glade-widget-class-ref name="GtkColorScale"/>
|
<glade-widget-class-ref name="GtkColorScale"/>
|
||||||
<glade-widget-class-ref name="GtkScaleButtonScale"/>
|
<glade-widget-class-ref name="GtkScaleButtonScale"/>
|
||||||
<glade-widget-class-ref name="ShortcutsPaneModelFilter"/>
|
|
||||||
<glade-widget-class-ref name="GtkPrinterOptionWidget"/>
|
<glade-widget-class-ref name="GtkPrinterOptionWidget"/>
|
||||||
<glade-widget-class-ref name="GtkPlacesSidebar"/>
|
|
||||||
</glade-widget-group>
|
</glade-widget-group>
|
||||||
</glade-catalog>
|
</glade-catalog>
|
||||||
|
|||||||
@@ -145,6 +145,7 @@
|
|||||||
#include <gtk/gtkpagesetup.h>
|
#include <gtk/gtkpagesetup.h>
|
||||||
#include <gtk/gtkpapersize.h>
|
#include <gtk/gtkpapersize.h>
|
||||||
#include <gtk/gtkpaned.h>
|
#include <gtk/gtkpaned.h>
|
||||||
|
#include <gtk/gtkpathbar.h>
|
||||||
#include <gtk/gtkplacessidebar.h>
|
#include <gtk/gtkplacessidebar.h>
|
||||||
#include <gtk/gtkprintcontext.h>
|
#include <gtk/gtkprintcontext.h>
|
||||||
#include <gtk/gtkprintoperation.h>
|
#include <gtk/gtkprintoperation.h>
|
||||||
@@ -163,6 +164,7 @@
|
|||||||
#include <gtk/gtkrecentchooserwidget.h>
|
#include <gtk/gtkrecentchooserwidget.h>
|
||||||
#include <gtk/gtkrecentfilter.h>
|
#include <gtk/gtkrecentfilter.h>
|
||||||
#include <gtk/gtkrecentmanager.h>
|
#include <gtk/gtkrecentmanager.h>
|
||||||
|
#include <gtk/gtkrevealer.h>
|
||||||
#include <gtk/gtkscale.h>
|
#include <gtk/gtkscale.h>
|
||||||
#include <gtk/gtkscalebutton.h>
|
#include <gtk/gtkscalebutton.h>
|
||||||
#include <gtk/gtkscrollable.h>
|
#include <gtk/gtkscrollable.h>
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ gtk_assistant_set_page_title
|
|||||||
gtk_assistant_set_page_type
|
gtk_assistant_set_page_type
|
||||||
gtk_assistant_update_buttons_state
|
gtk_assistant_update_buttons_state
|
||||||
gtk_attach_options_get_type
|
gtk_attach_options_get_type
|
||||||
|
gtk_baseline_position_get_type
|
||||||
gtk_binding_entry_add_signal
|
gtk_binding_entry_add_signal
|
||||||
gtk_binding_entry_add_signall
|
gtk_binding_entry_add_signall
|
||||||
gtk_binding_entry_add_signal_from_string
|
gtk_binding_entry_add_signal_from_string
|
||||||
@@ -308,6 +309,7 @@ gtk_border_free
|
|||||||
gtk_border_get_type
|
gtk_border_get_type
|
||||||
gtk_border_new
|
gtk_border_new
|
||||||
gtk_border_style_get_type
|
gtk_border_style_get_type
|
||||||
|
gtk_box_get_baseline_position
|
||||||
gtk_box_get_homogeneous
|
gtk_box_get_homogeneous
|
||||||
gtk_box_get_spacing
|
gtk_box_get_spacing
|
||||||
gtk_box_get_type
|
gtk_box_get_type
|
||||||
@@ -316,6 +318,7 @@ gtk_box_pack_end
|
|||||||
gtk_box_pack_start
|
gtk_box_pack_start
|
||||||
gtk_box_query_child_packing
|
gtk_box_query_child_packing
|
||||||
gtk_box_reorder_child
|
gtk_box_reorder_child
|
||||||
|
gtk_box_set_baseline_position
|
||||||
gtk_box_set_child_packing
|
gtk_box_set_child_packing
|
||||||
gtk_box_set_homogeneous
|
gtk_box_set_homogeneous
|
||||||
gtk_box_set_spacing
|
gtk_box_set_spacing
|
||||||
@@ -1199,9 +1202,11 @@ gtk_grab_get_current
|
|||||||
gtk_grab_remove
|
gtk_grab_remove
|
||||||
gtk_grid_attach
|
gtk_grid_attach
|
||||||
gtk_grid_attach_next_to
|
gtk_grid_attach_next_to
|
||||||
|
gtk_grid_get_baseline_row
|
||||||
gtk_grid_get_child_at
|
gtk_grid_get_child_at
|
||||||
gtk_grid_get_column_homogeneous
|
gtk_grid_get_column_homogeneous
|
||||||
gtk_grid_get_column_spacing
|
gtk_grid_get_column_spacing
|
||||||
|
gtk_grid_get_row_baseline_position
|
||||||
gtk_grid_get_row_homogeneous
|
gtk_grid_get_row_homogeneous
|
||||||
gtk_grid_get_row_spacing
|
gtk_grid_get_row_spacing
|
||||||
gtk_grid_get_type
|
gtk_grid_get_type
|
||||||
@@ -1211,8 +1216,10 @@ gtk_grid_insert_row
|
|||||||
gtk_grid_new
|
gtk_grid_new
|
||||||
gtk_grid_remove_column
|
gtk_grid_remove_column
|
||||||
gtk_grid_remove_row
|
gtk_grid_remove_row
|
||||||
|
gtk_grid_set_baseline_row
|
||||||
gtk_grid_set_column_homogeneous
|
gtk_grid_set_column_homogeneous
|
||||||
gtk_grid_set_column_spacing
|
gtk_grid_set_column_spacing
|
||||||
|
gtk_grid_set_row_baseline_position
|
||||||
gtk_grid_set_row_homogeneous
|
gtk_grid_set_row_homogeneous
|
||||||
gtk_grid_set_row_spacing
|
gtk_grid_set_row_spacing
|
||||||
gtk_handle_box_get_child_detached
|
gtk_handle_box_get_child_detached
|
||||||
@@ -1895,6 +1902,19 @@ gtk_parse_args
|
|||||||
gtk_path_bar_get_type
|
gtk_path_bar_get_type
|
||||||
gtk_path_priority_type_get_type
|
gtk_path_priority_type_get_type
|
||||||
gtk_path_type_get_type
|
gtk_path_type_get_type
|
||||||
|
gtk_places_open_flags_get_type
|
||||||
|
gtk_places_sidebar_add_shortcut
|
||||||
|
gtk_places_sidebar_get_location
|
||||||
|
gtk_places_sidebar_get_nth_bookmark
|
||||||
|
gtk_places_sidebar_get_open_flags
|
||||||
|
gtk_places_sidebar_get_show_desktop
|
||||||
|
gtk_places_sidebar_get_type
|
||||||
|
gtk_places_sidebar_list_shortcuts
|
||||||
|
gtk_places_sidebar_new
|
||||||
|
gtk_places_sidebar_remove_shortcut
|
||||||
|
gtk_places_sidebar_set_location
|
||||||
|
gtk_places_sidebar_set_open_flags
|
||||||
|
gtk_places_sidebar_set_show_desktop
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
gtk_plug_construct
|
gtk_plug_construct
|
||||||
gtk_plug_construct_for_display
|
gtk_plug_construct_for_display
|
||||||
@@ -2424,6 +2444,14 @@ gtk_requisition_get_type
|
|||||||
gtk_requisition_new
|
gtk_requisition_new
|
||||||
gtk_resize_mode_get_type
|
gtk_resize_mode_get_type
|
||||||
gtk_response_type_get_type
|
gtk_response_type_get_type
|
||||||
|
gtk_revealer_new
|
||||||
|
gtk_revealer_get_reveal_child
|
||||||
|
gtk_revealer_set_reveal_child
|
||||||
|
gtk_revealer_get_child_revealed
|
||||||
|
gtk_revealer_get_transition_duration
|
||||||
|
gtk_revealer_set_transition_duration
|
||||||
|
gtk_revealer_get_transition_type
|
||||||
|
gtk_revealer_set_transition_type
|
||||||
gtk_rgb_to_hsv
|
gtk_rgb_to_hsv
|
||||||
gtk_scale_accessible_get_type
|
gtk_scale_accessible_get_type
|
||||||
gtk_scale_add_mark
|
gtk_scale_add_mark
|
||||||
@@ -3737,6 +3765,7 @@ gtk_widget_error_bell
|
|||||||
gtk_widget_event
|
gtk_widget_event
|
||||||
gtk_widget_freeze_child_notify
|
gtk_widget_freeze_child_notify
|
||||||
gtk_widget_get_accessible
|
gtk_widget_get_accessible
|
||||||
|
gtk_widget_get_allocated_baseline
|
||||||
gtk_widget_get_allocated_height
|
gtk_widget_get_allocated_height
|
||||||
gtk_widget_get_allocated_width
|
gtk_widget_get_allocated_width
|
||||||
gtk_widget_get_allocation
|
gtk_widget_get_allocation
|
||||||
@@ -3779,8 +3808,10 @@ gtk_widget_get_parent_window
|
|||||||
gtk_widget_get_path
|
gtk_widget_get_path
|
||||||
gtk_widget_get_pointer
|
gtk_widget_get_pointer
|
||||||
gtk_widget_get_preferred_height
|
gtk_widget_get_preferred_height
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width
|
||||||
gtk_widget_get_preferred_height_for_width
|
gtk_widget_get_preferred_height_for_width
|
||||||
gtk_widget_get_preferred_size
|
gtk_widget_get_preferred_size
|
||||||
|
gtk_widget_get_preferred_size_and_baseline
|
||||||
gtk_widget_get_preferred_width
|
gtk_widget_get_preferred_width
|
||||||
gtk_widget_get_preferred_width_for_height
|
gtk_widget_get_preferred_width_for_height
|
||||||
gtk_widget_get_realized
|
gtk_widget_get_realized
|
||||||
@@ -3803,6 +3834,7 @@ gtk_widget_get_tooltip_window
|
|||||||
gtk_widget_get_toplevel
|
gtk_widget_get_toplevel
|
||||||
gtk_widget_get_type
|
gtk_widget_get_type
|
||||||
gtk_widget_get_valign
|
gtk_widget_get_valign
|
||||||
|
gtk_widget_get_valign_with_baseline
|
||||||
gtk_widget_get_vexpand
|
gtk_widget_get_vexpand
|
||||||
gtk_widget_get_vexpand_set
|
gtk_widget_get_vexpand_set
|
||||||
gtk_widget_get_visible
|
gtk_widget_get_visible
|
||||||
@@ -3956,6 +3988,7 @@ gtk_widget_show
|
|||||||
gtk_widget_show_all
|
gtk_widget_show_all
|
||||||
gtk_widget_show_now
|
gtk_widget_show_now
|
||||||
gtk_widget_size_allocate
|
gtk_widget_size_allocate
|
||||||
|
gtk_widget_size_allocate_with_baseline
|
||||||
gtk_widget_size_request
|
gtk_widget_size_request
|
||||||
gtk_widget_style_attach
|
gtk_widget_style_attach
|
||||||
gtk_widget_style_get
|
gtk_widget_style_get
|
||||||
|
|||||||
+70
-12
@@ -108,6 +108,12 @@ static void gtk_alignment_get_preferred_height_for_width (GtkWidget *w
|
|||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
|
static void gtk_alignment_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN)
|
G_DEFINE_TYPE (GtkAlignment, gtk_alignment, GTK_TYPE_BIN)
|
||||||
|
|
||||||
@@ -128,6 +134,7 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
|||||||
widget_class->get_preferred_height = gtk_alignment_get_preferred_height;
|
widget_class->get_preferred_height = gtk_alignment_get_preferred_height;
|
||||||
widget_class->get_preferred_width_for_height = gtk_alignment_get_preferred_width_for_height;
|
widget_class->get_preferred_width_for_height = gtk_alignment_get_preferred_width_for_height;
|
||||||
widget_class->get_preferred_height_for_width = gtk_alignment_get_preferred_height_for_width;
|
widget_class->get_preferred_height_for_width = gtk_alignment_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_alignment_get_preferred_height_and_baseline_for_width;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_XALIGN,
|
PROP_XALIGN,
|
||||||
@@ -507,6 +514,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
gint width, height;
|
gint width, height;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
gint padding_horizontal, padding_vertical;
|
gint padding_horizontal, padding_vertical;
|
||||||
|
gint baseline;
|
||||||
|
|
||||||
padding_horizontal = 0;
|
padding_horizontal = 0;
|
||||||
padding_vertical = 0;
|
padding_vertical = 0;
|
||||||
@@ -520,6 +528,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
gint child_nat_width;
|
gint child_nat_width;
|
||||||
gint child_nat_height;
|
gint child_nat_height;
|
||||||
gint child_width, child_height;
|
gint child_width, child_height;
|
||||||
|
double yalign, yscale;
|
||||||
|
|
||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (alignment));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (alignment));
|
||||||
|
|
||||||
@@ -529,6 +538,25 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
|
width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
|
||||||
height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
|
height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
|
||||||
|
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (baseline != -1)
|
||||||
|
baseline -= border_width + priv->padding_top;
|
||||||
|
|
||||||
|
/* If we get a baseline set that means we're baseline aligned, and the parent
|
||||||
|
honored that. In that case we have to ignore yalign/yscale as we need
|
||||||
|
yalign based on the baseline and always FILL mode to ensure we can place
|
||||||
|
the baseline anywhere */
|
||||||
|
if (baseline != -1)
|
||||||
|
{
|
||||||
|
yalign = 0;
|
||||||
|
yscale = 1.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yalign = priv->yalign;
|
||||||
|
yscale = priv->yscale;
|
||||||
|
}
|
||||||
|
|
||||||
if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
||||||
{
|
{
|
||||||
gtk_widget_get_preferred_width (child, NULL, &child_nat_width);
|
gtk_widget_get_preferred_width (child, NULL, &child_nat_width);
|
||||||
@@ -559,8 +587,8 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
if (height > child_height)
|
if (height > child_height)
|
||||||
child_allocation.height = (child_height *
|
child_allocation.height = (child_height *
|
||||||
(1.0 - priv->yscale) +
|
(1.0 - yscale) +
|
||||||
height * priv->yscale);
|
height * yscale);
|
||||||
else
|
else
|
||||||
child_allocation.height = height;
|
child_allocation.height = height;
|
||||||
|
|
||||||
@@ -569,9 +597,9 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
child_allocation.x = priv->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
child_allocation.x = priv->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
||||||
|
|
||||||
child_allocation.y = priv->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
child_allocation.y = yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,18 +609,30 @@ gtk_alignment_get_preferred_size (GtkWidget *widget,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
||||||
GtkAlignmentPrivate *priv = alignment->priv;
|
GtkAlignmentPrivate *priv = alignment->priv;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
guint minimum, natural;
|
guint minimum, natural;
|
||||||
|
guint top_offset;
|
||||||
|
guint border;
|
||||||
|
|
||||||
natural = minimum = gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
|
|
||||||
|
border = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
natural = minimum = border * 2;
|
||||||
|
top_offset = border;
|
||||||
|
|
||||||
if ((child = gtk_bin_get_child (GTK_BIN (widget))) && gtk_widget_get_visible (child))
|
if ((child = gtk_bin_get_child (GTK_BIN (widget))) && gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
gint child_min, child_nat;
|
gint child_min, child_nat;
|
||||||
|
gint child_min_baseline = -1, child_nat_baseline = -1;
|
||||||
|
|
||||||
/* Request extra space for the padding: */
|
/* Request extra space for the padding: */
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
@@ -619,9 +659,10 @@ gtk_alignment_get_preferred_size (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
minimum += (priv->padding_top + priv->padding_bottom);
|
minimum += (priv->padding_top + priv->padding_bottom);
|
||||||
|
top_offset += priv->padding_top;
|
||||||
|
|
||||||
if (for_size < 0)
|
if (for_size < 0)
|
||||||
gtk_widget_get_preferred_height (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_height_and_baseline_for_width (child, -1, &child_min, &child_nat, &child_min_baseline, &child_nat_baseline);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gint min_width;
|
gint min_width;
|
||||||
@@ -634,8 +675,13 @@ gtk_alignment_get_preferred_size (GtkWidget *widget,
|
|||||||
for_size = (min_width * (1.0 - priv->xscale) +
|
for_size = (min_width * (1.0 - priv->xscale) +
|
||||||
for_size * priv->xscale);
|
for_size * priv->xscale);
|
||||||
|
|
||||||
gtk_widget_get_preferred_height_for_width (child, for_size, &child_min, &child_nat);
|
gtk_widget_get_preferred_height_and_baseline_for_width (child, for_size, &child_min, &child_nat, &child_min_baseline, &child_nat_baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (minimum_baseline && child_min_baseline >= 0)
|
||||||
|
*minimum_baseline = child_min_baseline + top_offset;
|
||||||
|
if (natural_baseline && child_nat_baseline >= 0)
|
||||||
|
*natural_baseline = child_nat_baseline + top_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
natural = minimum;
|
natural = minimum;
|
||||||
@@ -656,7 +702,7 @@ gtk_alignment_get_preferred_width (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, -1, minimum_size, natural_size);
|
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, -1, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -664,7 +710,7 @@ gtk_alignment_get_preferred_height (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, -1, minimum_size, natural_size);
|
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, -1, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -674,7 +720,7 @@ gtk_alignment_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, for_size, minimum_size, natural_size);
|
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, for_size, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -683,9 +729,21 @@ gtk_alignment_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, for_size, minimum_size, natural_size);
|
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, for_size, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_alignment_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
gtk_alignment_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, for_size, minimum_size, natural_size, minimum_baseline, natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_alignment_set_padding:
|
* gtk_alignment_set_padding:
|
||||||
* @alignment: a #GtkAlignment
|
* @alignment: a #GtkAlignment
|
||||||
|
|||||||
+161
-23
@@ -101,6 +101,12 @@ static void gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
gint width,
|
gint width,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_button_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
static void gtk_button_box_size_allocate (GtkWidget *widget,
|
static void gtk_button_box_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
@@ -143,6 +149,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
|||||||
widget_class->get_preferred_height = gtk_button_box_get_preferred_height;
|
widget_class->get_preferred_height = gtk_button_box_get_preferred_height;
|
||||||
widget_class->get_preferred_width_for_height = gtk_button_box_get_preferred_width_for_height;
|
widget_class->get_preferred_width_for_height = gtk_button_box_get_preferred_width_for_height;
|
||||||
widget_class->get_preferred_height_for_width = gtk_button_box_get_preferred_height_for_width;
|
widget_class->get_preferred_height_for_width = gtk_button_box_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_button_box_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->size_allocate = gtk_button_box_size_allocate;
|
widget_class->size_allocate = gtk_button_box_size_allocate;
|
||||||
|
|
||||||
container_class->remove = gtk_button_box_remove;
|
container_class->remove = gtk_button_box_remove;
|
||||||
@@ -438,7 +445,10 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
gint *nvis_children,
|
gint *nvis_children,
|
||||||
gint *nvis_secondaries,
|
gint *nvis_secondaries,
|
||||||
gint **widths,
|
gint **widths,
|
||||||
gint **heights)
|
gint **heights,
|
||||||
|
gint **baselines,
|
||||||
|
gint *baseline,
|
||||||
|
gint *baseline_height)
|
||||||
{
|
{
|
||||||
GtkButtonBox *bbox;
|
GtkButtonBox *bbox;
|
||||||
GList *children, *list;
|
GList *children, *list;
|
||||||
@@ -446,6 +456,7 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
gint nsecondaries;
|
gint nsecondaries;
|
||||||
gint needed_width;
|
gint needed_width;
|
||||||
gint needed_height;
|
gint needed_height;
|
||||||
|
gint needed_above, needed_below;
|
||||||
gint avg_w, avg_h;
|
gint avg_w, avg_h;
|
||||||
GtkRequisition child_requisition;
|
GtkRequisition child_requisition;
|
||||||
gint ipad_w;
|
gint ipad_w;
|
||||||
@@ -456,11 +467,15 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
gint ipad_y;
|
gint ipad_y;
|
||||||
gboolean homogeneous;
|
gboolean homogeneous;
|
||||||
gint i;
|
gint i;
|
||||||
|
gint max_above, max_below, child_baseline;
|
||||||
|
GtkOrientation orientation;
|
||||||
|
gboolean have_baseline;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||||
|
|
||||||
bbox = GTK_BUTTON_BOX (widget);
|
bbox = GTK_BUTTON_BOX (widget);
|
||||||
|
|
||||||
|
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||||
homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
|
homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
@@ -475,22 +490,33 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
list = children = _gtk_box_get_children (GTK_BOX (bbox));
|
list = children = _gtk_box_get_children (GTK_BOX (bbox));
|
||||||
needed_width = child_min_width;
|
needed_width = child_min_width;
|
||||||
needed_height = child_min_height;
|
needed_height = child_min_height;
|
||||||
|
needed_above = 0;
|
||||||
|
needed_below = 0;
|
||||||
ipad_w = ipad_x * 2;
|
ipad_w = ipad_x * 2;
|
||||||
ipad_h = ipad_y * 2;
|
ipad_h = ipad_y * 2;
|
||||||
|
|
||||||
|
have_baseline = FALSE;
|
||||||
|
max_above = max_below = 0;
|
||||||
avg_w = avg_h = 0;
|
avg_w = avg_h = 0;
|
||||||
while (children)
|
for (children = list; children != NULL; children = children->next)
|
||||||
{
|
{
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
child = children->data;
|
child = children->data;
|
||||||
children = children->next;
|
|
||||||
|
|
||||||
if (gtk_widget_get_visible (child))
|
if (gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
nchildren += 1;
|
nchildren += 1;
|
||||||
gtk_widget_get_preferred_size (child,
|
gtk_widget_get_preferred_size_and_baseline (child,
|
||||||
&child_requisition, NULL);
|
&child_requisition, NULL, &child_baseline, NULL);
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
|
gtk_widget_get_valign_with_baseline (child) == GTK_ALIGN_BASELINE &&
|
||||||
|
child_baseline != -1)
|
||||||
|
{
|
||||||
|
have_baseline = TRUE;
|
||||||
|
max_above = MAX (max_above, child_baseline + ipad_y);
|
||||||
|
max_below = MAX (max_below , child_requisition.height + ipad_h - (child_baseline + ipad_y));
|
||||||
|
}
|
||||||
avg_w += child_requisition.width + ipad_w;
|
avg_w += child_requisition.width + ipad_w;
|
||||||
avg_h += child_requisition.height + ipad_h;
|
avg_h += child_requisition.height + ipad_h;
|
||||||
}
|
}
|
||||||
@@ -498,8 +524,14 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
avg_w /= MAX (nchildren, 1);
|
avg_w /= MAX (nchildren, 1);
|
||||||
avg_h /= MAX (nchildren, 1);
|
avg_h /= MAX (nchildren, 1);
|
||||||
|
|
||||||
|
if (baseline)
|
||||||
|
*baseline = have_baseline ? max_above : -1;
|
||||||
|
if (baseline_height)
|
||||||
|
*baseline_height = max_above + max_below;
|
||||||
|
|
||||||
*widths = g_new (gint, nchildren);
|
*widths = g_new (gint, nchildren);
|
||||||
*heights = g_new (gint, nchildren);
|
*heights = g_new (gint, nchildren);
|
||||||
|
*baselines = g_new (gint, nchildren);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
children = list;
|
children = list;
|
||||||
@@ -520,7 +552,8 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
if (is_secondary)
|
if (is_secondary)
|
||||||
nsecondaries++;
|
nsecondaries++;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
gtk_widget_get_preferred_size_and_baseline (child,
|
||||||
|
&child_requisition, NULL, &child_baseline, NULL);
|
||||||
|
|
||||||
if (homogeneous ||
|
if (homogeneous ||
|
||||||
(!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
|
(!non_homogeneous && (child_requisition.width + ipad_w < avg_w * 1.5)))
|
||||||
@@ -534,16 +567,38 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
(*widths)[i] = child_requisition.width + ipad_w;
|
(*widths)[i] = child_requisition.width + ipad_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*baselines)[i] = -1;
|
||||||
|
|
||||||
if (homogeneous ||
|
if (homogeneous ||
|
||||||
(!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
|
(!non_homogeneous && (child_requisition.height + ipad_h < avg_h * 1.5)))
|
||||||
{
|
{
|
||||||
(*heights)[i] = -1;
|
(*heights)[i] = -1;
|
||||||
if (child_requisition.height + ipad_h > needed_height)
|
|
||||||
needed_height = child_requisition.height + ipad_h;
|
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
|
gtk_widget_get_valign_with_baseline (child) == GTK_ALIGN_BASELINE &&
|
||||||
|
child_baseline != -1)
|
||||||
|
{
|
||||||
|
(*baselines)[i] = child_baseline + ipad_y;
|
||||||
|
|
||||||
|
if (child_baseline + ipad_y > needed_above)
|
||||||
|
needed_above = child_baseline + ipad_y;
|
||||||
|
if (child_requisition.height - child_baseline + ipad_y > needed_below)
|
||||||
|
needed_below = child_requisition.height - child_baseline + ipad_y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (child_requisition.height + ipad_h > needed_height)
|
||||||
|
needed_height = child_requisition.height + ipad_h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*heights)[i] = child_requisition.height + ipad_h;
|
(*heights)[i] = child_requisition.height + ipad_h;
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
|
gtk_widget_get_valign_with_baseline (child) == GTK_ALIGN_BASELINE &&
|
||||||
|
child_baseline != -1)
|
||||||
|
(*baselines)[i] = child_baseline + ipad_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@@ -552,12 +607,18 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
|
|
||||||
g_list_free (list);
|
g_list_free (list);
|
||||||
|
|
||||||
|
needed_height = MAX (needed_height, needed_above + needed_below);
|
||||||
|
|
||||||
for (i = 0; i < nchildren; i++)
|
for (i = 0; i < nchildren; i++)
|
||||||
{
|
{
|
||||||
if ((*widths)[i] == -1)
|
if ((*widths)[i] == -1)
|
||||||
(*widths)[i] = needed_width;
|
(*widths)[i] = needed_width;
|
||||||
if ((*heights)[i] == -1)
|
if ((*heights)[i] == -1)
|
||||||
(*heights)[i] = needed_height;
|
{
|
||||||
|
(*heights)[i] = needed_height;
|
||||||
|
if ((*baselines)[i] != -1)
|
||||||
|
(*baselines)[i] = needed_above;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nvis_children)
|
if (nvis_children)
|
||||||
@@ -569,19 +630,24 @@ gtk_button_box_child_requisition (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_button_box_size_request (GtkWidget *widget,
|
gtk_button_box_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
GtkRequisition *requisition,
|
||||||
|
gint *baseline)
|
||||||
{
|
{
|
||||||
GtkButtonBoxPrivate *priv;
|
GtkButtonBoxPrivate *priv;
|
||||||
GtkButtonBox *bbox;
|
GtkButtonBox *bbox;
|
||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
gint max_size;
|
gint max_size, max_above, max_below;
|
||||||
gint total_size;
|
gint total_size;
|
||||||
gint spacing;
|
gint spacing;
|
||||||
GtkOrientation orientation;
|
GtkOrientation orientation;
|
||||||
gint *widths;
|
gint *widths;
|
||||||
gint *heights;
|
gint *heights;
|
||||||
|
gint *baselines;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
if (baseline)
|
||||||
|
*baseline = -1;
|
||||||
|
|
||||||
bbox = GTK_BUTTON_BOX (widget);
|
bbox = GTK_BUTTON_BOX (widget);
|
||||||
priv = bbox->priv;
|
priv = bbox->priv;
|
||||||
|
|
||||||
@@ -591,16 +657,22 @@ gtk_button_box_size_request (GtkWidget *widget,
|
|||||||
gtk_button_box_child_requisition (widget,
|
gtk_button_box_child_requisition (widget,
|
||||||
&nvis_children,
|
&nvis_children,
|
||||||
NULL,
|
NULL,
|
||||||
&widths, &heights);
|
&widths, &heights, &baselines, baseline, NULL);
|
||||||
|
|
||||||
max_size = 0;
|
max_size = max_above = max_below = 0;
|
||||||
total_size = 0;
|
total_size = 0;
|
||||||
for (i = 0; i < nvis_children; i++)
|
for (i = 0; i < nvis_children; i++)
|
||||||
{
|
{
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
total_size += widths[i];
|
total_size += widths[i];
|
||||||
max_size = MAX (max_size, heights[i]);
|
if (baselines[i] == -1)
|
||||||
|
max_size = MAX (max_size, heights[i]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
max_above = MAX (max_above, baselines[i]);
|
||||||
|
max_below = MAX (max_below, heights[i] - baselines[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -610,6 +682,23 @@ gtk_button_box_size_request (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
g_free (widths);
|
g_free (widths);
|
||||||
g_free (heights);
|
g_free (heights);
|
||||||
|
g_free (baselines);
|
||||||
|
|
||||||
|
max_size = MAX (max_size, max_above + max_below);
|
||||||
|
|
||||||
|
switch (gtk_box_get_baseline_position (GTK_BOX (widget)))
|
||||||
|
{
|
||||||
|
case GTK_BASELINE_POSITION_TOP:
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
|
if (baseline != NULL && *baseline != -1)
|
||||||
|
*baseline += (max_size - (max_above + max_below)) / 2;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
|
if (baseline != NULL && *baseline != -1)
|
||||||
|
*baseline += max_size - (max_above + max_below);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (nvis_children == 0)
|
if (nvis_children == 0)
|
||||||
{
|
{
|
||||||
@@ -656,7 +745,7 @@ gtk_button_box_get_preferred_width (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
|
|
||||||
gtk_button_box_size_request (widget, &requisition);
|
gtk_button_box_size_request (widget, &requisition, NULL);
|
||||||
|
|
||||||
*minimum = *natural = requisition.width;
|
*minimum = *natural = requisition.width;
|
||||||
}
|
}
|
||||||
@@ -666,11 +755,9 @@ gtk_button_box_get_preferred_height (GtkWidget *widget,
|
|||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural)
|
gint *natural)
|
||||||
{
|
{
|
||||||
GtkRequisition requisition;
|
gtk_button_box_get_preferred_height_and_baseline_for_width (widget, -1,
|
||||||
|
minimum, natural,
|
||||||
gtk_button_box_size_request (widget, &requisition);
|
NULL, NULL);
|
||||||
|
|
||||||
*minimum = *natural = requisition.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -691,6 +778,26 @@ gtk_button_box_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
gtk_button_box_get_preferred_height (widget, minimum, natural);
|
gtk_button_box_get_preferred_height (widget, minimum, natural);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_button_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
GtkRequisition requisition;
|
||||||
|
gint baseline;
|
||||||
|
|
||||||
|
gtk_button_box_size_request (widget, &requisition, &baseline);
|
||||||
|
|
||||||
|
*minimum = *natural = requisition.height;
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = baseline;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = baseline;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_button_box_size_allocate (GtkWidget *widget,
|
gtk_button_box_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
@@ -714,10 +821,13 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
gint ipad_x, ipad_y;
|
gint ipad_x, ipad_y;
|
||||||
gint *widths;
|
gint *widths;
|
||||||
gint *heights;
|
gint *heights;
|
||||||
|
gint *baselines;
|
||||||
gint *sizes;
|
gint *sizes;
|
||||||
gint primary_size;
|
gint primary_size;
|
||||||
gint secondary_size;
|
gint secondary_size;
|
||||||
gint total_size;
|
gint total_size;
|
||||||
|
gint baseline, baseline_height;
|
||||||
|
gint child_baseline, allocated_baseline;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
bbox = GTK_BUTTON_BOX (widget);
|
bbox = GTK_BUTTON_BOX (widget);
|
||||||
@@ -733,7 +843,27 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
gtk_button_box_child_requisition (widget,
|
gtk_button_box_child_requisition (widget,
|
||||||
&nvis_children,
|
&nvis_children,
|
||||||
&n_secondaries,
|
&n_secondaries,
|
||||||
&widths, &heights);
|
&widths, &heights, &baselines, &baseline, &baseline_height);
|
||||||
|
|
||||||
|
allocated_baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (allocated_baseline != -1)
|
||||||
|
baseline = allocated_baseline;
|
||||||
|
else if (baseline != -1)
|
||||||
|
{
|
||||||
|
/* TODO: modify baseline based on baseline_pos && allocated_baseline*/
|
||||||
|
switch (gtk_box_get_baseline_position (GTK_BOX (widget)))
|
||||||
|
{
|
||||||
|
case GTK_BASELINE_POSITION_TOP:
|
||||||
|
baseline = baseline;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
|
baseline = baseline + (allocation->height - baseline_height) / 2;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
|
baseline = allocation->height - (baseline_height - baseline);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
n_primaries = nvis_children - n_secondaries;
|
n_primaries = nvis_children - n_secondaries;
|
||||||
primary_size = 0;
|
primary_size = 0;
|
||||||
@@ -917,10 +1047,17 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
child_allocation.width = widths[i];
|
child_allocation.width = widths[i];
|
||||||
child_allocation.height = heights[i];
|
child_allocation.height = heights[i];
|
||||||
|
child_baseline = -1;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
|
if (baselines[i] != -1)
|
||||||
|
{
|
||||||
|
child_allocation.y = allocation->y + baseline - baselines[i];
|
||||||
|
child_baseline = baselines[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
child_allocation.y = allocation->y + (allocation->height - child_allocation.height) / 2;
|
||||||
|
|
||||||
if (gtk_button_box_get_child_secondary (bbox, child))
|
if (gtk_button_box_get_child_secondary (bbox, child))
|
||||||
{
|
{
|
||||||
@@ -953,7 +1090,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -961,6 +1098,7 @@ gtk_button_box_size_allocate (GtkWidget *widget,
|
|||||||
g_list_free (list);
|
g_list_free (list);
|
||||||
g_free (widths);
|
g_free (widths);
|
||||||
g_free (heights);
|
g_free (heights);
|
||||||
|
g_free (baselines);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+336
-50
@@ -94,7 +94,8 @@ enum {
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_ORIENTATION,
|
PROP_ORIENTATION,
|
||||||
PROP_SPACING,
|
PROP_SPACING,
|
||||||
PROP_HOMOGENEOUS
|
PROP_HOMOGENEOUS,
|
||||||
|
PROP_BASELINE_POSITION
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -116,6 +117,7 @@ struct _GtkBoxPrivate
|
|||||||
guint default_expand : 1;
|
guint default_expand : 1;
|
||||||
guint homogeneous : 1;
|
guint homogeneous : 1;
|
||||||
guint spacing_set : 1;
|
guint spacing_set : 1;
|
||||||
|
guint baseline_pos : 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _GtkBoxChild GtkBoxChild;
|
typedef struct _GtkBoxChild GtkBoxChild;
|
||||||
@@ -200,6 +202,12 @@ static void gtk_box_get_preferred_height_for_width (GtkWidget
|
|||||||
gint width,
|
gint width,
|
||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height);
|
gint *natural_height);
|
||||||
|
static void gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
|
G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
|
||||||
@@ -220,6 +228,7 @@ gtk_box_class_init (GtkBoxClass *class)
|
|||||||
widget_class->get_preferred_width = gtk_box_get_preferred_width;
|
widget_class->get_preferred_width = gtk_box_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_box_get_preferred_height;
|
widget_class->get_preferred_height = gtk_box_get_preferred_height;
|
||||||
widget_class->get_preferred_height_for_width = gtk_box_get_preferred_height_for_width;
|
widget_class->get_preferred_height_for_width = gtk_box_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_box_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->get_preferred_width_for_height = gtk_box_get_preferred_width_for_height;
|
widget_class->get_preferred_width_for_height = gtk_box_get_preferred_width_for_height;
|
||||||
widget_class->compute_expand = gtk_box_compute_expand;
|
widget_class->compute_expand = gtk_box_compute_expand;
|
||||||
widget_class->direction_changed = gtk_box_direction_changed;
|
widget_class->direction_changed = gtk_box_direction_changed;
|
||||||
@@ -255,6 +264,15 @@ gtk_box_class_init (GtkBoxClass *class)
|
|||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_BASELINE_POSITION,
|
||||||
|
g_param_spec_enum ("baseline-position",
|
||||||
|
P_("Baseline position"),
|
||||||
|
P_("The position of the baseline aligned widgets if extra space is availible"),
|
||||||
|
GTK_TYPE_BASELINE_POSITION,
|
||||||
|
GTK_BASELINE_POSITION_CENTER,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkBox:expand:
|
* GtkBox:expand:
|
||||||
*
|
*
|
||||||
@@ -340,6 +358,7 @@ gtk_box_init (GtkBox *box)
|
|||||||
private->homogeneous = FALSE;
|
private->homogeneous = FALSE;
|
||||||
private->spacing = 0;
|
private->spacing = 0;
|
||||||
private->spacing_set = FALSE;
|
private->spacing_set = FALSE;
|
||||||
|
private->baseline_pos = GTK_BASELINE_POSITION_CENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -361,6 +380,9 @@ gtk_box_set_property (GObject *object,
|
|||||||
case PROP_SPACING:
|
case PROP_SPACING:
|
||||||
gtk_box_set_spacing (box, g_value_get_int (value));
|
gtk_box_set_spacing (box, g_value_get_int (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_BASELINE_POSITION:
|
||||||
|
gtk_box_set_baseline_position (box, g_value_get_enum (value));
|
||||||
|
break;
|
||||||
case PROP_HOMOGENEOUS:
|
case PROP_HOMOGENEOUS:
|
||||||
gtk_box_set_homogeneous (box, g_value_get_boolean (value));
|
gtk_box_set_homogeneous (box, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
@@ -387,6 +409,9 @@ gtk_box_get_property (GObject *object,
|
|||||||
case PROP_SPACING:
|
case PROP_SPACING:
|
||||||
g_value_set_int (value, private->spacing);
|
g_value_set_int (value, private->spacing);
|
||||||
break;
|
break;
|
||||||
|
case PROP_BASELINE_POSITION:
|
||||||
|
g_value_set_enum (value, private->baseline_pos);
|
||||||
|
break;
|
||||||
case PROP_HOMOGENEOUS:
|
case PROP_HOMOGENEOUS:
|
||||||
g_value_set_boolean (value, private->homogeneous);
|
g_value_set_boolean (value, private->homogeneous);
|
||||||
break;
|
break;
|
||||||
@@ -435,6 +460,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
GtkTextDirection direction;
|
GtkTextDirection direction;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
GtkRequestedSize *sizes;
|
GtkRequestedSize *sizes;
|
||||||
|
gint child_minimum_baseline, child_natural_baseline;
|
||||||
|
gint minimum_above, natural_above;
|
||||||
|
gint minimum_below, natural_below;
|
||||||
|
gboolean have_baseline;
|
||||||
|
gint baseline;
|
||||||
|
|
||||||
GtkPackType packing;
|
GtkPackType packing;
|
||||||
|
|
||||||
@@ -461,6 +491,10 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
else
|
else
|
||||||
size = allocation->height - (nvis_children - 1) * private->spacing;
|
size = allocation->height - (nvis_children - 1) * private->spacing;
|
||||||
|
|
||||||
|
have_baseline = FALSE;
|
||||||
|
minimum_above = natural_above = 0;
|
||||||
|
minimum_below = natural_below = 0;
|
||||||
|
|
||||||
/* Retrieve desired size for visible children. */
|
/* Retrieve desired size for visible children. */
|
||||||
for (i = 0, children = private->children; children; children = children->next)
|
for (i = 0, children = private->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
@@ -475,11 +509,11 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
&sizes[i].minimum_size,
|
&sizes[i].minimum_size,
|
||||||
&sizes[i].natural_size);
|
&sizes[i].natural_size);
|
||||||
else
|
else
|
||||||
gtk_widget_get_preferred_height_for_width (child->widget,
|
gtk_widget_get_preferred_height_and_baseline_for_width (child->widget,
|
||||||
allocation->width,
|
allocation->width,
|
||||||
&sizes[i].minimum_size,
|
&sizes[i].minimum_size,
|
||||||
&sizes[i].natural_size);
|
&sizes[i].natural_size,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
/* Assert the api is working properly */
|
/* Assert the api is working properly */
|
||||||
if (sizes[i].minimum_size < 0)
|
if (sizes[i].minimum_size < 0)
|
||||||
@@ -537,28 +571,9 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
extra = 0;
|
extra = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate child positions. */
|
/* Allocate child sizes. */
|
||||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||||
{
|
{
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
{
|
|
||||||
child_allocation.y = allocation->y;
|
|
||||||
child_allocation.height = MAX (1, allocation->height);
|
|
||||||
if (packing == GTK_PACK_START)
|
|
||||||
x = allocation->x;
|
|
||||||
else
|
|
||||||
x = allocation->x + allocation->width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
child_allocation.x = allocation->x;
|
|
||||||
child_allocation.width = MAX (1, allocation->width);
|
|
||||||
if (packing == GTK_PACK_START)
|
|
||||||
y = allocation->y;
|
|
||||||
else
|
|
||||||
y = allocation->y + allocation->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, children = private->children;
|
for (i = 0, children = private->children;
|
||||||
children;
|
children;
|
||||||
children = children->next)
|
children = children->next)
|
||||||
@@ -605,6 +620,105 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sizes[i].natural_size = child_size;
|
||||||
|
|
||||||
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
|
gtk_widget_get_valign_with_baseline (child->widget) == GTK_ALIGN_BASELINE)
|
||||||
|
{
|
||||||
|
int child_allocation_width;
|
||||||
|
int child_minimum_height, child_natural_height;
|
||||||
|
|
||||||
|
if (child->fill)
|
||||||
|
child_allocation_width = MAX (1, child_size - child->padding * 2);
|
||||||
|
else
|
||||||
|
child_allocation_width = sizes[i].minimum_size;
|
||||||
|
|
||||||
|
child_minimum_baseline = -1;
|
||||||
|
child_natural_baseline = -1;
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width (child->widget,
|
||||||
|
child_allocation_width,
|
||||||
|
&child_minimum_height, &child_natural_height,
|
||||||
|
&child_minimum_baseline, &child_natural_baseline);
|
||||||
|
|
||||||
|
if (child_minimum_baseline >= 0)
|
||||||
|
{
|
||||||
|
have_baseline = TRUE;
|
||||||
|
minimum_below = MAX (minimum_below, child_minimum_height - child_minimum_baseline);
|
||||||
|
natural_below = MAX (natural_below, child_natural_height - child_natural_baseline);
|
||||||
|
minimum_above = MAX (minimum_above, child_minimum_baseline);
|
||||||
|
natural_above = MAX (natural_above, child_natural_baseline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (baseline == -1 && have_baseline)
|
||||||
|
{
|
||||||
|
gint height = MAX (1, allocation->height);
|
||||||
|
|
||||||
|
/* TODO: This is purely based on the minimum baseline, when things fit we should
|
||||||
|
use the natural one? */
|
||||||
|
|
||||||
|
switch (private->baseline_pos)
|
||||||
|
{
|
||||||
|
case GTK_BASELINE_POSITION_TOP:
|
||||||
|
baseline = minimum_above;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
|
baseline = minimum_above + (height - (minimum_above + minimum_below)) / 2;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
|
baseline = height - minimum_below;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate child positions. */
|
||||||
|
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||||
|
{
|
||||||
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
child_allocation.y = allocation->y;
|
||||||
|
child_allocation.height = MAX (1, allocation->height);
|
||||||
|
if (packing == GTK_PACK_START)
|
||||||
|
x = allocation->x;
|
||||||
|
else
|
||||||
|
x = allocation->x + allocation->width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child_allocation.x = allocation->x;
|
||||||
|
child_allocation.width = MAX (1, allocation->width);
|
||||||
|
if (packing == GTK_PACK_START)
|
||||||
|
y = allocation->y;
|
||||||
|
else
|
||||||
|
y = allocation->y + allocation->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, children = private->children;
|
||||||
|
children;
|
||||||
|
children = children->next)
|
||||||
|
{
|
||||||
|
child = children->data;
|
||||||
|
|
||||||
|
/* If widget is not visible, skip it. */
|
||||||
|
if (!gtk_widget_get_visible (child->widget))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* If widget is packed differently skip it, but still increment i,
|
||||||
|
* since widget is visible and will be handled in next loop iteration.
|
||||||
|
*/
|
||||||
|
if (child->pack != packing)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
child_size = sizes[i].natural_size;
|
||||||
|
|
||||||
/* Assign the child's position. */
|
/* Assign the child's position. */
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
@@ -658,7 +772,7 @@ gtk_box_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.y -= child_size;
|
child_allocation.y -= child_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -1015,18 +1129,28 @@ static void
|
|||||||
gtk_box_get_size (GtkWidget *widget,
|
gtk_box_get_size (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkBox *box;
|
GtkBox *box;
|
||||||
GtkBoxPrivate *private;
|
GtkBoxPrivate *private;
|
||||||
GList *children;
|
GList *children;
|
||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
gint minimum, natural;
|
gint minimum, natural;
|
||||||
|
gint minimum_above, natural_above;
|
||||||
|
gint minimum_below, natural_below;
|
||||||
|
gboolean have_baseline;
|
||||||
|
gint min_baseline, nat_baseline;
|
||||||
|
|
||||||
box = GTK_BOX (widget);
|
box = GTK_BOX (widget);
|
||||||
private = box->priv;
|
private = box->priv;
|
||||||
|
|
||||||
|
have_baseline = FALSE;
|
||||||
minimum = natural = 0;
|
minimum = natural = 0;
|
||||||
|
minimum_above = natural_above = 0;
|
||||||
|
minimum_below = natural_below = 0;
|
||||||
|
min_baseline = nat_baseline = -1;
|
||||||
|
|
||||||
nvis_children = 0;
|
nvis_children = 0;
|
||||||
|
|
||||||
@@ -1037,13 +1161,15 @@ gtk_box_get_size (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_visible (child->widget))
|
if (gtk_widget_get_visible (child->widget))
|
||||||
{
|
{
|
||||||
gint child_minimum, child_natural;
|
gint child_minimum, child_natural;
|
||||||
|
gint child_minimum_baseline = -1, child_natural_baseline = -1;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
gtk_widget_get_preferred_width (child->widget,
|
gtk_widget_get_preferred_width (child->widget,
|
||||||
&child_minimum, &child_natural);
|
&child_minimum, &child_natural);
|
||||||
else
|
else
|
||||||
gtk_widget_get_preferred_height (child->widget,
|
gtk_widget_get_preferred_height_and_baseline_for_width (child->widget, -1,
|
||||||
&child_minimum, &child_natural);
|
&child_minimum, &child_natural,
|
||||||
|
&child_minimum_baseline, &child_natural_baseline);
|
||||||
|
|
||||||
if (private->orientation == orientation)
|
if (private->orientation == orientation)
|
||||||
{
|
{
|
||||||
@@ -1065,9 +1191,20 @@ gtk_box_get_size (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The biggest mins and naturals in the opposing orientation */
|
if (child_minimum_baseline >= 0)
|
||||||
minimum = MAX (minimum, child_minimum);
|
{
|
||||||
natural = MAX (natural, child_natural);
|
have_baseline = TRUE;
|
||||||
|
minimum_below = MAX (minimum_below, child_minimum - child_minimum_baseline);
|
||||||
|
natural_below = MAX (natural_below, child_natural - child_natural_baseline);
|
||||||
|
minimum_above = MAX (minimum_above, child_minimum_baseline);
|
||||||
|
natural_above = MAX (natural_above, child_natural_baseline);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The biggest mins and naturals in the opposing orientation */
|
||||||
|
minimum = MAX (minimum, child_minimum);
|
||||||
|
natural = MAX (natural, child_natural);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nvis_children += 1;
|
nvis_children += 1;
|
||||||
@@ -1085,11 +1222,39 @@ gtk_box_get_size (GtkWidget *widget,
|
|||||||
natural += (nvis_children - 1) * private->spacing;
|
natural += (nvis_children - 1) * private->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minimum = MAX (minimum, minimum_below + minimum_above);
|
||||||
|
natural = MAX (natural, natural_below + natural_above);
|
||||||
|
|
||||||
|
if (have_baseline)
|
||||||
|
{
|
||||||
|
switch (private->baseline_pos)
|
||||||
|
{
|
||||||
|
case GTK_BASELINE_POSITION_TOP:
|
||||||
|
min_baseline = minimum_above;
|
||||||
|
nat_baseline = natural_above;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
|
min_baseline = minimum_above + (minimum - (minimum_above + minimum_below)) / 2;
|
||||||
|
nat_baseline = natural_above + (natural - (natural_above + natural_below)) / 2;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
|
min_baseline = minimum - minimum_below;
|
||||||
|
nat_baseline = natural - natural_below;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (minimum_size)
|
if (minimum_size)
|
||||||
*minimum_size = minimum;
|
*minimum_size = minimum;
|
||||||
|
|
||||||
if (natural_size)
|
if (natural_size)
|
||||||
*natural_size = natural;
|
*natural_size = natural;
|
||||||
|
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = min_baseline;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = nat_baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1097,7 +1262,7 @@ gtk_box_get_preferred_width (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
|
gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1105,14 +1270,16 @@ gtk_box_get_preferred_height (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
|
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
||||||
gint avail_size,
|
gint avail_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkBoxPrivate *private = box->priv;
|
GtkBoxPrivate *private = box->priv;
|
||||||
GtkBoxChild *child;
|
GtkBoxChild *child;
|
||||||
@@ -1120,11 +1287,16 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
gint nvis_children;
|
gint nvis_children;
|
||||||
gint nexpand_children;
|
gint nexpand_children;
|
||||||
gint computed_minimum = 0, computed_natural = 0;
|
gint computed_minimum = 0, computed_natural = 0;
|
||||||
|
gint computed_minimum_above = 0, computed_natural_above = 0;
|
||||||
|
gint computed_minimum_below = 0, computed_natural_below = 0;
|
||||||
|
gint computed_minimum_baseline = -1, computed_natural_baseline = -1;
|
||||||
GtkRequestedSize *sizes;
|
GtkRequestedSize *sizes;
|
||||||
GtkPackType packing;
|
GtkPackType packing;
|
||||||
gint size, extra, i;
|
gint size, extra, i;
|
||||||
gint child_size, child_minimum, child_natural;
|
gint child_size, child_minimum, child_natural;
|
||||||
|
gint child_minimum_baseline, child_natural_baseline;
|
||||||
gint n_extra_widgets = 0;
|
gint n_extra_widgets = 0;
|
||||||
|
gboolean have_baseline;
|
||||||
|
|
||||||
count_expand_children (box, &nvis_children, &nexpand_children);
|
count_expand_children (box, &nvis_children, &nexpand_children);
|
||||||
|
|
||||||
@@ -1199,6 +1371,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
extra = 0;
|
extra = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
have_baseline = FALSE;
|
||||||
/* Allocate child positions. */
|
/* Allocate child positions. */
|
||||||
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
|
||||||
{
|
{
|
||||||
@@ -1260,26 +1433,64 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
child_minimum_baseline = child_natural_baseline = -1;
|
||||||
/* Assign the child's position. */
|
/* Assign the child's position. */
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
gtk_widget_get_preferred_height_for_width (child->widget,
|
gtk_widget_get_preferred_height_and_baseline_for_width (child->widget, child_size,
|
||||||
child_size, &child_minimum, &child_natural);
|
&child_minimum, &child_natural,
|
||||||
|
&child_minimum_baseline, &child_natural_baseline);
|
||||||
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
else /* (private->orientation == GTK_ORIENTATION_VERTICAL) */
|
||||||
gtk_widget_get_preferred_width_for_height (child->widget,
|
gtk_widget_get_preferred_width_for_height (child->widget,
|
||||||
child_size, &child_minimum, &child_natural);
|
child_size, &child_minimum, &child_natural);
|
||||||
|
|
||||||
|
if (child_minimum_baseline >= 0)
|
||||||
computed_minimum = MAX (computed_minimum, child_minimum);
|
{
|
||||||
computed_natural = MAX (computed_natural, child_natural);
|
have_baseline = TRUE;
|
||||||
|
computed_minimum_below = MAX (computed_minimum_below, child_minimum - child_minimum_baseline);
|
||||||
|
computed_natural_below = MAX (computed_natural_below, child_natural - child_natural_baseline);
|
||||||
|
computed_minimum_above = MAX (computed_minimum_above, child_minimum_baseline);
|
||||||
|
computed_natural_above = MAX (computed_natural_above, child_natural_baseline);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
computed_minimum = MAX (computed_minimum, child_minimum);
|
||||||
|
computed_natural = MAX (computed_natural, child_natural);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (have_baseline)
|
||||||
|
{
|
||||||
|
computed_minimum = MAX (computed_minimum, computed_minimum_below + computed_minimum_above);
|
||||||
|
computed_natural = MAX (computed_natural, computed_natural_below + computed_natural_above);
|
||||||
|
switch (private->baseline_pos)
|
||||||
|
{
|
||||||
|
case GTK_BASELINE_POSITION_TOP:
|
||||||
|
computed_minimum_baseline = computed_minimum_above;
|
||||||
|
computed_natural_baseline = computed_natural_above;
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_CENTER:
|
||||||
|
computed_minimum_baseline = computed_minimum_above + MAX((computed_minimum - (computed_minimum_above + computed_minimum_below)) / 2, 0);
|
||||||
|
computed_natural_baseline = computed_natural_above + MAX((computed_natural - (computed_natural_above + computed_natural_below)) / 2, 0);
|
||||||
|
break;
|
||||||
|
case GTK_BASELINE_POSITION_BOTTOM:
|
||||||
|
computed_minimum_baseline = computed_minimum - computed_minimum_below;
|
||||||
|
computed_natural_baseline = computed_natural - computed_natural_below;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = computed_minimum_baseline;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = computed_natural_baseline;
|
||||||
|
|
||||||
if (minimum_size)
|
if (minimum_size)
|
||||||
*minimum_size = computed_minimum;
|
*minimum_size = computed_minimum;
|
||||||
if (natural_size)
|
if (natural_size)
|
||||||
*natural_size = computed_natural;
|
*natural_size = MAX (computed_natural, computed_natural_below + computed_natural_above);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1355,24 +1566,46 @@ gtk_box_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
GtkBoxPrivate *private = box->priv;
|
GtkBoxPrivate *private = box->priv;
|
||||||
|
|
||||||
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
if (private->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
|
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width, NULL, NULL);
|
||||||
else
|
else
|
||||||
gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width);
|
gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
GtkBox *box = GTK_BOX (widget);
|
||||||
|
GtkBoxPrivate *private = box->priv;
|
||||||
|
|
||||||
|
if (width < 0)
|
||||||
|
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_height, natural_height, minimum_baseline, natural_baseline);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height, minimum_baseline, natural_baseline);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
|
gtk_box_compute_size_for_orientation (box, width, minimum_height, natural_height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_box_get_preferred_height_for_width (GtkWidget *widget,
|
gtk_box_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
gint width,
|
gint width,
|
||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height)
|
gint *natural_height)
|
||||||
{
|
{
|
||||||
GtkBox *box = GTK_BOX (widget);
|
gtk_box_get_preferred_height_and_baseline_for_width (widget, width, minimum_height, natural_height, NULL, NULL);
|
||||||
GtkBoxPrivate *private = box->priv;
|
|
||||||
|
|
||||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height);
|
|
||||||
else
|
|
||||||
gtk_box_compute_size_for_orientation (box, width, minimum_height, natural_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1550,6 +1783,59 @@ gtk_box_get_spacing (GtkBox *box)
|
|||||||
return box->priv->spacing;
|
return box->priv->spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_box_set_baseline_position:
|
||||||
|
* @box: a #GtkBox
|
||||||
|
* @position: a #GtkBaselinePosition
|
||||||
|
*
|
||||||
|
* Sets the baseline position of a box. This affects
|
||||||
|
* only horizontal boxes with at least one baseline aligned
|
||||||
|
* child. If there is more vertical space availible than requested,
|
||||||
|
* and the baseline is not allocated by the parent then
|
||||||
|
* @position is used to allocate the baseline wrt the
|
||||||
|
* extra space available.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_box_set_baseline_position (GtkBox *box,
|
||||||
|
GtkBaselinePosition position)
|
||||||
|
{
|
||||||
|
GtkBoxPrivate *private;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_BOX (box));
|
||||||
|
|
||||||
|
private = box->priv;
|
||||||
|
|
||||||
|
if (position != private->baseline_pos)
|
||||||
|
{
|
||||||
|
private->baseline_pos = position;
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (box), "baseline-position");
|
||||||
|
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_box_get_baseline_position:
|
||||||
|
* @box: a #GtkBox
|
||||||
|
*
|
||||||
|
* Gets the value set by gtk_box_set_baseline_position().
|
||||||
|
*
|
||||||
|
* Return value: the baseline position
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
**/
|
||||||
|
GtkBaselinePosition
|
||||||
|
gtk_box_get_baseline_position (GtkBox *box)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_BOX (box), GTK_BASELINE_POSITION_CENTER);
|
||||||
|
|
||||||
|
return box->priv->baseline_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_box_set_spacing_set (GtkBox *box,
|
_gtk_box_set_spacing_set (GtkBox *box,
|
||||||
gboolean spacing_set)
|
gboolean spacing_set)
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ gboolean gtk_box_get_homogeneous (GtkBox *box);
|
|||||||
void gtk_box_set_spacing (GtkBox *box,
|
void gtk_box_set_spacing (GtkBox *box,
|
||||||
gint spacing);
|
gint spacing);
|
||||||
gint gtk_box_get_spacing (GtkBox *box);
|
gint gtk_box_get_spacing (GtkBox *box);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_box_set_baseline_position (GtkBox *box,
|
||||||
|
GtkBaselinePosition position);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
GtkBaselinePosition gtk_box_get_baseline_position (GtkBox *box);
|
||||||
|
|
||||||
void gtk_box_reorder_child (GtkBox *box,
|
void gtk_box_reorder_child (GtkBox *box,
|
||||||
GtkWidget *child,
|
GtkWidget *child,
|
||||||
|
|||||||
+91
-14
@@ -164,12 +164,26 @@ static void gtk_button_set_related_action (GtkButton *button,
|
|||||||
static void gtk_button_set_use_action_appearance (GtkButton *button,
|
static void gtk_button_set_use_action_appearance (GtkButton *button,
|
||||||
gboolean use_appearance);
|
gboolean use_appearance);
|
||||||
|
|
||||||
static void gtk_button_get_preferred_width (GtkWidget *widget,
|
static void gtk_button_get_preferred_width (GtkWidget *widget,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
static void gtk_button_get_preferred_height (GtkWidget *widget,
|
static void gtk_button_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
|
static void gtk_button_get_preferred_width_for_height (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size);
|
||||||
|
static void gtk_button_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size);
|
||||||
|
static void gtk_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
static guint button_signals[LAST_SIGNAL] = { 0 };
|
static guint button_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
@@ -194,8 +208,11 @@ gtk_button_class_init (GtkButtonClass *klass)
|
|||||||
gobject_class->set_property = gtk_button_set_property;
|
gobject_class->set_property = gtk_button_set_property;
|
||||||
gobject_class->get_property = gtk_button_get_property;
|
gobject_class->get_property = gtk_button_get_property;
|
||||||
|
|
||||||
widget_class->get_preferred_width = gtk_button_get_preferred_width;
|
widget_class->get_preferred_width = gtk_button_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_button_get_preferred_height;
|
widget_class->get_preferred_height = gtk_button_get_preferred_height;
|
||||||
|
widget_class->get_preferred_width_for_height = gtk_button_get_preferred_width_for_height;
|
||||||
|
widget_class->get_preferred_height_for_width = gtk_button_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_button_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->destroy = gtk_button_destroy;
|
widget_class->destroy = gtk_button_destroy;
|
||||||
widget_class->screen_changed = gtk_button_screen_changed;
|
widget_class->screen_changed = gtk_button_screen_changed;
|
||||||
widget_class->realize = gtk_button_realize;
|
widget_class->realize = gtk_button_realize;
|
||||||
@@ -1150,11 +1167,16 @@ gtk_button_construct_child (GtkButton *button)
|
|||||||
else
|
else
|
||||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, image_spacing);
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, image_spacing);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (image, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_widget_set_valign (box, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
if (priv->align_set)
|
if (priv->align_set)
|
||||||
align = gtk_alignment_new (priv->xalign, priv->yalign, 0.0, 0.0);
|
align = gtk_alignment_new (priv->xalign, priv->yalign, 0.0, 0.0);
|
||||||
else
|
else
|
||||||
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (align, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
if (priv->image_position == GTK_POS_LEFT ||
|
if (priv->image_position == GTK_POS_LEFT ||
|
||||||
priv->image_position == GTK_POS_TOP)
|
priv->image_position == GTK_POS_TOP)
|
||||||
gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
|
||||||
@@ -1172,6 +1194,8 @@ gtk_button_construct_child (GtkButton *button)
|
|||||||
else
|
else
|
||||||
label = gtk_label_new (label_text);
|
label = gtk_label_new (label_text);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
if (priv->image_position == GTK_POS_RIGHT ||
|
if (priv->image_position == GTK_POS_RIGHT ||
|
||||||
priv->image_position == GTK_POS_BOTTOM)
|
priv->image_position == GTK_POS_BOTTOM)
|
||||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||||
@@ -1196,6 +1220,8 @@ gtk_button_construct_child (GtkButton *button)
|
|||||||
else
|
else
|
||||||
label = gtk_label_new (priv->label_text);
|
label = gtk_label_new (priv->label_text);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
if (priv->align_set)
|
if (priv->align_set)
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
|
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
|
||||||
|
|
||||||
@@ -1584,6 +1610,7 @@ gtk_button_size_allocate (GtkWidget *widget,
|
|||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
|
gint baseline;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
@@ -1635,6 +1662,10 @@ gtk_button_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.height = child_allocation.height - (focus_width + focus_pad) * 2;
|
child_allocation.height = child_allocation.height - (focus_width + focus_pad) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (baseline != -1)
|
||||||
|
baseline -= child_allocation.y - allocation->y;
|
||||||
|
|
||||||
if (priv->depressed)
|
if (priv->depressed)
|
||||||
{
|
{
|
||||||
gint child_displacement_x;
|
gint child_displacement_x;
|
||||||
@@ -1651,7 +1682,7 @@ gtk_button_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.width = MAX (1, child_allocation.width);
|
child_allocation.width = MAX (1, child_allocation.width);
|
||||||
child_allocation.height = MAX (1, child_allocation.height);
|
child_allocation.height = MAX (1, child_allocation.height);
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2062,8 +2093,11 @@ gtk_button_finish_activate (GtkButton *button,
|
|||||||
static void
|
static void
|
||||||
gtk_button_get_size (GtkWidget *widget,
|
gtk_button_get_size (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
|
gint for_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkButton *button = GTK_BUTTON (widget);
|
GtkButton *button = GTK_BUTTON (widget);
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
@@ -2074,6 +2108,7 @@ gtk_button_get_size (GtkWidget *widget,
|
|||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
gint minimum, natural;
|
gint minimum, natural;
|
||||||
|
gint top_offset;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
@@ -2084,6 +2119,8 @@ gtk_button_get_size (GtkWidget *widget,
|
|||||||
"focus-padding", &focus_pad,
|
"focus-padding", &focus_pad,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
top_offset = 0;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
minimum = padding.left + padding.right +
|
minimum = padding.left + padding.right +
|
||||||
@@ -2097,9 +2134,14 @@ gtk_button_get_size (GtkWidget *widget,
|
|||||||
minimum = padding.top + padding.bottom +
|
minimum = padding.top + padding.bottom +
|
||||||
border.top + border.bottom;
|
border.top + border.bottom;
|
||||||
|
|
||||||
|
top_offset = padding.top + border.top + focus_width + focus_pad;
|
||||||
|
|
||||||
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
|
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
|
||||||
minimum += default_border.top + default_border.bottom;
|
{
|
||||||
}
|
minimum += default_border.top + default_border.bottom;
|
||||||
|
top_offset += default_border.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
minimum += 2 * (focus_width + focus_pad);
|
minimum += 2 * (focus_width + focus_pad);
|
||||||
natural = minimum;
|
natural = minimum;
|
||||||
@@ -2108,11 +2150,17 @@ gtk_button_get_size (GtkWidget *widget,
|
|||||||
gtk_widget_get_visible (child))
|
gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
gint child_min, child_nat;
|
gint child_min, child_nat;
|
||||||
|
gint child_min_baseline = -1, child_nat_baseline = -1;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
||||||
else
|
else
|
||||||
gtk_widget_get_preferred_height (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_height_and_baseline_for_width (child, -1, &child_min, &child_nat, &child_min_baseline, &child_nat_baseline);
|
||||||
|
|
||||||
|
if (minimum_baseline && child_min_baseline >= 0)
|
||||||
|
*minimum_baseline = child_min_baseline + top_offset;
|
||||||
|
if (natural_baseline && child_nat_baseline >= 0)
|
||||||
|
*natural_baseline = child_nat_baseline + top_offset;
|
||||||
|
|
||||||
minimum += child_min;
|
minimum += child_min;
|
||||||
natural += child_nat;
|
natural += child_nat;
|
||||||
@@ -2130,7 +2178,7 @@ gtk_button_get_preferred_width (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_button_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
|
gtk_button_get_size (widget, GTK_ORIENTATION_HORIZONTAL, -1, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2138,7 +2186,36 @@ gtk_button_get_preferred_height (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_button_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
|
gtk_button_get_size (widget, GTK_ORIENTATION_VERTICAL, -1, minimum_size, natural_size, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_button_get_preferred_width_for_height (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size)
|
||||||
|
{
|
||||||
|
gtk_button_get_size (widget, GTK_ORIENTATION_HORIZONTAL, for_size, minimum_size, natural_size, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_button_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
|
gint for_size,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size)
|
||||||
|
{
|
||||||
|
gtk_button_get_size (widget, GTK_ORIENTATION_VERTICAL, for_size, minimum_size, natural_size, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_size,
|
||||||
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
gtk_button_get_size (widget, GTK_ORIENTATION_VERTICAL, width, minimum_size, natural_size, minimum_baseline, natural_baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ struct _GtkButtonPrivate
|
|||||||
gfloat xalign;
|
gfloat xalign;
|
||||||
gfloat yalign;
|
gfloat yalign;
|
||||||
|
|
||||||
|
/* This is only used by checkbox and subclasses */
|
||||||
|
gfloat baseline_align;
|
||||||
|
|
||||||
guint activate_timeout;
|
guint activate_timeout;
|
||||||
guint32 grab_time;
|
guint32 grab_time;
|
||||||
|
|
||||||
|
|||||||
+69
-7
@@ -58,6 +58,12 @@ static void gtk_check_button_get_preferred_width (GtkWidget *widget,
|
|||||||
static void gtk_check_button_get_preferred_height (GtkWidget *widget,
|
static void gtk_check_button_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_check_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_check_button_size_allocate (GtkWidget *widget,
|
static void gtk_check_button_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gboolean gtk_check_button_draw (GtkWidget *widget,
|
static gboolean gtk_check_button_draw (GtkWidget *widget,
|
||||||
@@ -80,6 +86,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
|||||||
|
|
||||||
widget_class->get_preferred_width = gtk_check_button_get_preferred_width;
|
widget_class->get_preferred_width = gtk_check_button_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_check_button_get_preferred_height;
|
widget_class->get_preferred_height = gtk_check_button_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_check_button_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->size_allocate = gtk_check_button_size_allocate;
|
widget_class->size_allocate = gtk_check_button_size_allocate;
|
||||||
widget_class->draw = gtk_check_button_draw;
|
widget_class->draw = gtk_check_button_draw;
|
||||||
|
|
||||||
@@ -287,9 +294,12 @@ gtk_check_button_get_preferred_width (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_button_get_preferred_height (GtkWidget *widget,
|
gtk_check_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint width,
|
||||||
gint *natural)
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (widget);
|
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (widget);
|
||||||
|
|
||||||
@@ -301,6 +311,7 @@ gtk_check_button_get_preferred_height (GtkWidget *widget,
|
|||||||
gint indicator_spacing;
|
gint indicator_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
|
gint old_minimum, old_natural;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
|
|
||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
@@ -320,29 +331,61 @@ gtk_check_button_get_preferred_height (GtkWidget *widget,
|
|||||||
if (child && gtk_widget_get_visible (child))
|
if (child && gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
gint child_min, child_nat;
|
gint child_min, child_nat;
|
||||||
|
gint child_min_baseline = -1, child_nat_baseline = -1;
|
||||||
|
|
||||||
gtk_widget_get_preferred_height (child, &child_min, &child_nat);
|
gtk_widget_get_preferred_height_and_baseline_for_width (child, -1,
|
||||||
|
&child_min, &child_nat,
|
||||||
|
&child_min_baseline, &child_nat_baseline);
|
||||||
|
|
||||||
|
if (minimum_baseline && child_min_baseline >= 0)
|
||||||
|
*minimum_baseline = child_min_baseline + border_width;
|
||||||
|
if (natural_baseline && child_nat_baseline >= 0)
|
||||||
|
*natural_baseline = child_nat_baseline + border_width;
|
||||||
|
|
||||||
*minimum += child_min;
|
*minimum += child_min;
|
||||||
*natural += child_nat;
|
*natural += child_nat;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
old_minimum = *minimum;
|
||||||
|
old_natural = *natural;
|
||||||
|
|
||||||
temp = indicator_size + indicator_spacing * 2;
|
temp = indicator_size + indicator_spacing * 2;
|
||||||
*minimum = MAX (*minimum, temp) + 2 * (focus_width + focus_pad);
|
*minimum = MAX (*minimum, temp) + 2 * (focus_width + focus_pad);
|
||||||
*natural = MAX (*natural, temp) + 2 * (focus_width + focus_pad);
|
*natural = MAX (*natural, temp) + 2 * (focus_width + focus_pad);
|
||||||
|
|
||||||
|
if (minimum_baseline && *minimum_baseline != -1)
|
||||||
|
minimum_baseline += (*minimum - old_minimum) / 2;
|
||||||
|
if (natural_baseline && *natural_baseline != -1)
|
||||||
|
natural_baseline += (*natural - old_natural) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->get_preferred_height (widget, minimum, natural);
|
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->get_preferred_height_and_baseline_for_width (widget, width,
|
||||||
|
minimum, natural,
|
||||||
|
minimum_baseline, natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_check_button_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_check_button_get_preferred_height_and_baseline_for_width (widget, -1,
|
||||||
|
minimum, natural,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_check_button_size_allocate (GtkWidget *widget,
|
gtk_check_button_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
|
PangoContext *pango_context;
|
||||||
|
PangoFontMetrics *metrics;
|
||||||
GtkCheckButton *check_button;
|
GtkCheckButton *check_button;
|
||||||
GtkToggleButton *toggle_button;
|
GtkToggleButton *toggle_button;
|
||||||
GtkButton *button;
|
GtkButton *button;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
|
gint baseline;
|
||||||
|
|
||||||
button = GTK_BUTTON (widget);
|
button = GTK_BUTTON (widget);
|
||||||
check_button = GTK_CHECK_BUTTON (widget);
|
check_button = GTK_CHECK_BUTTON (widget);
|
||||||
@@ -389,8 +432,21 @@ gtk_check_button_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.x = allocation->x + allocation->width
|
child_allocation.x = allocation->x + allocation->width
|
||||||
- (child_allocation.x - allocation->x + child_allocation.width);
|
- (child_allocation.x - allocation->x + child_allocation.width);
|
||||||
|
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (baseline != -1)
|
||||||
|
baseline -= child_allocation.y - allocation->y;
|
||||||
|
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pango_context = gtk_widget_get_pango_context (widget);
|
||||||
|
metrics = pango_context_get_metrics (pango_context,
|
||||||
|
pango_context_get_font_description (pango_context),
|
||||||
|
pango_context_get_language (pango_context));
|
||||||
|
button->priv->baseline_align =
|
||||||
|
(double)pango_font_metrics_get_ascent (metrics) /
|
||||||
|
(pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
|
||||||
|
pango_font_metrics_unref (metrics);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->size_allocate (widget, allocation);
|
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->size_allocate (widget, allocation);
|
||||||
@@ -448,6 +504,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
gint indicator_spacing;
|
gint indicator_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
|
gint baseline;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
gboolean interior_focus;
|
gboolean interior_focus;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
@@ -458,6 +515,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
toggle_button = GTK_TOGGLE_BUTTON (check_button);
|
toggle_button = GTK_TOGGLE_BUTTON (check_button);
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
state = gtk_widget_get_state_flags (widget);
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
|
||||||
@@ -472,7 +530,11 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
|
||||||
x = indicator_spacing + border_width;
|
x = indicator_spacing + border_width;
|
||||||
y = (allocation.height - indicator_size) / 2;
|
if (baseline == -1)
|
||||||
|
y = (allocation.height - indicator_size) / 2;
|
||||||
|
else
|
||||||
|
y = CLAMP (baseline - indicator_size * button->priv->baseline_align,
|
||||||
|
0, allocation.height - indicator_size);
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (check_button));
|
child = gtk_bin_get_child (GTK_BIN (check_button));
|
||||||
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
|
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
|
||||||
|
|||||||
@@ -309,12 +309,17 @@ static void gtk_container_adjust_size_request (GtkWidget *widget,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
|
static void gtk_container_adjust_baseline_request (GtkWidget *widget,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_container_adjust_size_allocation (GtkWidget *widget,
|
static void gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size,
|
gint *natural_size,
|
||||||
gint *allocated_pos,
|
gint *allocated_pos,
|
||||||
gint *allocated_size);
|
gint *allocated_size);
|
||||||
|
static void gtk_container_adjust_baseline_allocation (GtkWidget *widget,
|
||||||
|
gint *baseline);
|
||||||
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
|
static GtkSizeRequestMode gtk_container_get_request_mode (GtkWidget *widget);
|
||||||
|
|
||||||
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
|
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
|
||||||
@@ -444,7 +449,9 @@ gtk_container_class_init (GtkContainerClass *class)
|
|||||||
widget_class->focus = gtk_container_focus;
|
widget_class->focus = gtk_container_focus;
|
||||||
|
|
||||||
widget_class->adjust_size_request = gtk_container_adjust_size_request;
|
widget_class->adjust_size_request = gtk_container_adjust_size_request;
|
||||||
|
widget_class->adjust_baseline_request = gtk_container_adjust_baseline_request;
|
||||||
widget_class->adjust_size_allocation = gtk_container_adjust_size_allocation;
|
widget_class->adjust_size_allocation = gtk_container_adjust_size_allocation;
|
||||||
|
widget_class->adjust_baseline_allocation = gtk_container_adjust_baseline_allocation;
|
||||||
widget_class->get_request_mode = gtk_container_get_request_mode;
|
widget_class->get_request_mode = gtk_container_get_request_mode;
|
||||||
|
|
||||||
class->add = gtk_container_add_unimplemented;
|
class->add = gtk_container_add_unimplemented;
|
||||||
@@ -1917,6 +1924,28 @@ gtk_container_adjust_size_request (GtkWidget *widget,
|
|||||||
minimum_size, natural_size);
|
minimum_size, natural_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_container_adjust_baseline_request (GtkWidget *widget,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
GtkContainer *container;
|
||||||
|
|
||||||
|
container = GTK_CONTAINER (widget);
|
||||||
|
|
||||||
|
if (GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
|
||||||
|
{
|
||||||
|
int border_width;
|
||||||
|
|
||||||
|
border_width = container->priv->border_width;
|
||||||
|
|
||||||
|
*minimum_baseline += border_width;
|
||||||
|
*natural_baseline += border_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent_class->adjust_baseline_request (widget, minimum_baseline, natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_container_adjust_size_allocation (GtkWidget *widget,
|
gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
@@ -1952,6 +1981,27 @@ gtk_container_adjust_size_allocation (GtkWidget *widget,
|
|||||||
allocated_size);
|
allocated_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_container_adjust_baseline_allocation (GtkWidget *widget,
|
||||||
|
gint *baseline)
|
||||||
|
{
|
||||||
|
GtkContainer *container;
|
||||||
|
int border_width;
|
||||||
|
|
||||||
|
container = GTK_CONTAINER (widget);
|
||||||
|
|
||||||
|
if (GTK_CONTAINER_GET_CLASS (widget)->_handle_border_width)
|
||||||
|
{
|
||||||
|
border_width = container->priv->border_width;
|
||||||
|
|
||||||
|
if (*baseline >= 0)
|
||||||
|
*baseline -= border_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent_class->adjust_baseline_allocation (widget, baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gint hfw;
|
gint hfw;
|
||||||
gint wfh;
|
gint wfh;
|
||||||
|
|||||||
@@ -300,3 +300,37 @@ _gtk_css_shadows_value_paint_box (const GtkCssValue *shadows,
|
|||||||
_gtk_css_shadow_value_paint_box (shadows->values[i], cr, padding_box);
|
_gtk_css_shadow_value_paint_box (shadows->values[i], cr, padding_box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
|
||||||
|
GtkBorder *border)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
GtkBorder b = { 0 };
|
||||||
|
const GtkCssValue *shadow;
|
||||||
|
gdouble hoffset, voffset, spread, radius;
|
||||||
|
|
||||||
|
g_return_if_fail (shadows->class == >K_CSS_VALUE_SHADOWS);
|
||||||
|
|
||||||
|
for (i = 0; i < shadows->len; i++)
|
||||||
|
{
|
||||||
|
shadow = shadows->values[i];
|
||||||
|
|
||||||
|
if (_gtk_css_shadow_value_get_inset (shadow))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_gtk_css_shadow_value_get_geometry (shadow,
|
||||||
|
&hoffset, &voffset,
|
||||||
|
&radius, &spread);
|
||||||
|
|
||||||
|
b.top = MAX (0, radius + spread - voffset);
|
||||||
|
b.right = MAX (0, radius + spread + hoffset);
|
||||||
|
b.bottom = MAX (0, radius + spread + voffset);
|
||||||
|
b.left = MAX (0, radius + spread - hoffset);
|
||||||
|
|
||||||
|
border->top = MAX (border->top, b.top);
|
||||||
|
border->right = MAX (border->right, b.right);
|
||||||
|
border->bottom = MAX (border->bottom, b.bottom);
|
||||||
|
border->left = MAX (border->left, b.left);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ void _gtk_css_shadows_value_paint_box (const GtkCssValue
|
|||||||
const GtkRoundedBox *padding_box,
|
const GtkRoundedBox *padding_box,
|
||||||
gboolean inset);
|
gboolean inset);
|
||||||
|
|
||||||
|
void _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
|
||||||
|
GtkBorder *border);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_CSS_SHADOWS_VALUE_H__ */
|
#endif /* __GTK_CSS_SHADOWS_VALUE_H__ */
|
||||||
|
|||||||
@@ -453,6 +453,26 @@ _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow)
|
|||||||
return shadow->inset;
|
return shadow->inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
|
||||||
|
gdouble *hoffset,
|
||||||
|
gdouble *voffset,
|
||||||
|
gdouble *radius,
|
||||||
|
gdouble *spread)
|
||||||
|
{
|
||||||
|
g_return_if_fail (shadow->class == >K_CSS_VALUE_SHADOW);
|
||||||
|
|
||||||
|
if (hoffset != NULL)
|
||||||
|
*hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||||
|
if (voffset != NULL)
|
||||||
|
*voffset = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||||
|
|
||||||
|
if (radius != NULL)
|
||||||
|
*radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||||
|
if (spread != NULL)
|
||||||
|
*spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
_gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ GtkCssValue * _gtk_css_shadow_value_parse (GtkCssParser
|
|||||||
|
|
||||||
gboolean _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow);
|
gboolean _gtk_css_shadow_value_get_inset (const GtkCssValue *shadow);
|
||||||
|
|
||||||
|
void _gtk_css_shadow_value_get_geometry (const GtkCssValue *shadow,
|
||||||
|
gdouble *hoffset,
|
||||||
|
gdouble *voffset,
|
||||||
|
gdouble *radius,
|
||||||
|
gdouble *spread);
|
||||||
|
|
||||||
void _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
|
void _gtk_css_shadow_value_paint_layout (const GtkCssValue *shadow,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
PangoLayout *layout);
|
PangoLayout *layout);
|
||||||
|
|||||||
+2
-1
@@ -47,7 +47,8 @@ typedef enum {
|
|||||||
GTK_DEBUG_PRINTING = 1 << 10,
|
GTK_DEBUG_PRINTING = 1 << 10,
|
||||||
GTK_DEBUG_BUILDER = 1 << 11,
|
GTK_DEBUG_BUILDER = 1 << 11,
|
||||||
GTK_DEBUG_SIZE_REQUEST = 1 << 12,
|
GTK_DEBUG_SIZE_REQUEST = 1 << 12,
|
||||||
GTK_DEBUG_NO_CSS_CACHE = 1 << 13
|
GTK_DEBUG_NO_CSS_CACHE = 1 << 13,
|
||||||
|
GTK_DEBUG_BASELINES = 1 << 14
|
||||||
} GtkDebugFlag;
|
} GtkDebugFlag;
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
|||||||
@@ -744,6 +744,7 @@ gtk_dialog_add_button (GtkDialog *dialog,
|
|||||||
button = gtk_button_new_from_stock (button_text);
|
button = gtk_button_new_from_stock (button_text);
|
||||||
|
|
||||||
gtk_widget_set_can_default (button, TRUE);
|
gtk_widget_set_can_default (button, TRUE);
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
|
|||||||
+48
-5
@@ -367,6 +367,12 @@ static void gtk_entry_get_preferred_width (GtkWidget *widget,
|
|||||||
static void gtk_entry_get_preferred_height (GtkWidget *widget,
|
static void gtk_entry_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_entry_size_allocate (GtkWidget *widget,
|
static void gtk_entry_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static void gtk_entry_draw_frame (GtkWidget *widget,
|
static void gtk_entry_draw_frame (GtkWidget *widget,
|
||||||
@@ -682,6 +688,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
|||||||
widget_class->unrealize = gtk_entry_unrealize;
|
widget_class->unrealize = gtk_entry_unrealize;
|
||||||
widget_class->get_preferred_width = gtk_entry_get_preferred_width;
|
widget_class->get_preferred_width = gtk_entry_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_entry_get_preferred_height;
|
widget_class->get_preferred_height = gtk_entry_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_entry_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->size_allocate = gtk_entry_size_allocate;
|
widget_class->size_allocate = gtk_entry_size_allocate;
|
||||||
widget_class->draw = gtk_entry_draw;
|
widget_class->draw = gtk_entry_draw;
|
||||||
widget_class->enter_notify_event = gtk_entry_enter_notify;
|
widget_class->enter_notify_event = gtk_entry_enter_notify;
|
||||||
@@ -3305,16 +3312,19 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_entry_get_preferred_height (GtkWidget *widget,
|
gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint width,
|
||||||
gint *natural)
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkEntry *entry = GTK_ENTRY (widget);
|
GtkEntry *entry = GTK_ENTRY (widget);
|
||||||
GtkEntryPrivate *priv = entry->priv;
|
GtkEntryPrivate *priv = entry->priv;
|
||||||
PangoFontMetrics *metrics;
|
PangoFontMetrics *metrics;
|
||||||
GtkBorder borders;
|
GtkBorder borders;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
gint height;
|
gint height, baseline;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
|
||||||
layout = gtk_entry_ensure_layout (entry, TRUE);
|
layout = gtk_entry_ensure_layout (entry, TRUE);
|
||||||
@@ -3333,8 +3343,27 @@ gtk_entry_get_preferred_height (GtkWidget *widget,
|
|||||||
|
|
||||||
height += borders.top + borders.bottom;
|
height += borders.top + borders.bottom;
|
||||||
|
|
||||||
|
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
|
||||||
|
baseline += borders.top;
|
||||||
|
|
||||||
*minimum = height;
|
*minimum = height;
|
||||||
*natural = height;
|
*natural = height;
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = baseline;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_entry_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_entry_get_preferred_height_and_baseline_for_width (widget,
|
||||||
|
-1,
|
||||||
|
minimum,
|
||||||
|
natural,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3452,13 +3481,17 @@ gtk_entry_get_frame_size (GtkEntry *entry,
|
|||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkWidget *widget = GTK_WIDGET (entry);
|
GtkWidget *widget = GTK_WIDGET (entry);
|
||||||
|
gint area_height, y_pos;
|
||||||
|
gint baseline;
|
||||||
gint req_height;
|
gint req_height;
|
||||||
|
GtkBorder borders;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||||
|
|
||||||
req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
|
req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
*x = allocation.x;
|
*x = allocation.x;
|
||||||
@@ -3468,7 +3501,17 @@ gtk_entry_get_frame_size (GtkEntry *entry,
|
|||||||
if (priv->is_cell_renderer)
|
if (priv->is_cell_renderer)
|
||||||
*y = 0;
|
*y = 0;
|
||||||
else
|
else
|
||||||
*y = (allocation.height - req_height) / 2;
|
{
|
||||||
|
if (baseline == -1)
|
||||||
|
*y = (allocation.height - req_height) / 2;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_gtk_entry_get_borders (entry, &borders);
|
||||||
|
area_height = req_height - borders.top - borders.bottom;
|
||||||
|
y_pos = ((area_height * PANGO_SCALE - priv->ascent - priv->descent) / 2 + priv->ascent) / PANGO_SCALE;
|
||||||
|
*y = baseline - y_pos - borders.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*y += allocation.y;
|
*y += allocation.y;
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-1
@@ -51,6 +51,7 @@ G_BEGIN_DECLS
|
|||||||
* or top
|
* or top
|
||||||
* @GTK_ALIGN_CENTER: center natural width of widget inside the
|
* @GTK_ALIGN_CENTER: center natural width of widget inside the
|
||||||
* allocation
|
* allocation
|
||||||
|
* @GTK_ALIGN_BASELINE: align the widget according to the baseline. Since 3.10.
|
||||||
*
|
*
|
||||||
* Controls how a widget deals with extra space in a single (x or y)
|
* Controls how a widget deals with extra space in a single (x or y)
|
||||||
* dimension.
|
* dimension.
|
||||||
@@ -64,13 +65,18 @@ G_BEGIN_DECLS
|
|||||||
*
|
*
|
||||||
* Note that in horizontal context @GTK_ALIGN_START and @GTK_ALIGN_END
|
* Note that in horizontal context @GTK_ALIGN_START and @GTK_ALIGN_END
|
||||||
* are interpreted relative to text direction.
|
* are interpreted relative to text direction.
|
||||||
|
*
|
||||||
|
* GTK_ALIGN_BASELINE support for it is optional for containers and widgets, and
|
||||||
|
* it is only supported for vertical alignment. When its not supported by
|
||||||
|
* a child or a container it is treated as @GTK_ALIGN_FILL.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GTK_ALIGN_FILL,
|
GTK_ALIGN_FILL,
|
||||||
GTK_ALIGN_START,
|
GTK_ALIGN_START,
|
||||||
GTK_ALIGN_END,
|
GTK_ALIGN_END,
|
||||||
GTK_ALIGN_CENTER
|
GTK_ALIGN_CENTER,
|
||||||
|
GTK_ALIGN_BASELINE
|
||||||
} GtkAlign;
|
} GtkAlign;
|
||||||
|
|
||||||
|
|
||||||
@@ -125,6 +131,28 @@ typedef enum
|
|||||||
GTK_FILL = 1 << 2
|
GTK_FILL = 1 << 2
|
||||||
} GtkAttachOptions;
|
} GtkAttachOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkBaselinePosition:
|
||||||
|
* @GTK_BASELINE_POSITION_TOP: Align the baseline at the top
|
||||||
|
* @GTK_BASELINE_POSITION_CENTER: Center the baseline
|
||||||
|
* @GTK_BASELINE_POSITION_BOTTOM: Align the baseline at the bottom
|
||||||
|
*
|
||||||
|
* Whenever a container has some form of natural row it may align
|
||||||
|
* children in that row along a common typographical baseline. If
|
||||||
|
* the amount of verical space in the row is taller than the total
|
||||||
|
* requested height of the baseline-aligned children then it can use a
|
||||||
|
* #GtkBaselinePosition to select where to put the baseline inside the
|
||||||
|
* extra availible space.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GTK_BASELINE_POSITION_TOP,
|
||||||
|
GTK_BASELINE_POSITION_CENTER,
|
||||||
|
GTK_BASELINE_POSITION_BOTTOM
|
||||||
|
} GtkBaselinePosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkButtonBoxStyle:
|
* GtkButtonBoxStyle:
|
||||||
* @GTK_BUTTONBOX_DEFAULT_STYLE: Default packing.
|
* @GTK_BUTTONBOX_DEFAULT_STYLE: Default packing.
|
||||||
|
|||||||
+38
-5
@@ -65,6 +65,12 @@ static void gtk_event_box_get_preferred_width (GtkWidget *widget,
|
|||||||
static void gtk_event_box_get_preferred_height (GtkWidget *widget,
|
static void gtk_event_box_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_event_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_event_box_size_allocate (GtkWidget *widget,
|
static void gtk_event_box_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gboolean gtk_event_box_draw (GtkWidget *widget,
|
static gboolean gtk_event_box_draw (GtkWidget *widget,
|
||||||
@@ -96,6 +102,7 @@ gtk_event_box_class_init (GtkEventBoxClass *class)
|
|||||||
widget_class->unmap = gtk_event_box_unmap;
|
widget_class->unmap = gtk_event_box_unmap;
|
||||||
widget_class->get_preferred_width = gtk_event_box_get_preferred_width;
|
widget_class->get_preferred_width = gtk_event_box_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_event_box_get_preferred_height;
|
widget_class->get_preferred_height = gtk_event_box_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_event_box_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->size_allocate = gtk_event_box_size_allocate;
|
widget_class->size_allocate = gtk_event_box_size_allocate;
|
||||||
widget_class->draw = gtk_event_box_draw;
|
widget_class->draw = gtk_event_box_draw;
|
||||||
|
|
||||||
@@ -515,9 +522,12 @@ gtk_event_box_get_preferred_width (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_event_box_get_preferred_height (GtkWidget *widget,
|
gtk_event_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint width,
|
||||||
gint *natural)
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkBin *bin = GTK_BIN (widget);
|
GtkBin *bin = GTK_BIN (widget);
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
@@ -528,9 +538,30 @@ gtk_event_box_get_preferred_height (GtkWidget *widget,
|
|||||||
if (natural)
|
if (natural)
|
||||||
*natural = 0;
|
*natural = 0;
|
||||||
|
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
|
|
||||||
child = gtk_bin_get_child (bin);
|
child = gtk_bin_get_child (bin);
|
||||||
if (child && gtk_widget_get_visible (child))
|
if (child && gtk_widget_get_visible (child))
|
||||||
gtk_widget_get_preferred_height (child, minimum, natural);
|
gtk_widget_get_preferred_height_and_baseline_for_width (child,
|
||||||
|
-1,
|
||||||
|
minimum,
|
||||||
|
natural,
|
||||||
|
minimum_baseline,
|
||||||
|
natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_event_box_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_event_box_get_preferred_height_and_baseline_for_width (widget, -1,
|
||||||
|
minimum, natural,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -539,6 +570,7 @@ gtk_event_box_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkBin *bin;
|
GtkBin *bin;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
|
gint baseline;
|
||||||
GtkEventBoxPrivate *priv;
|
GtkEventBoxPrivate *priv;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
|
|
||||||
@@ -578,9 +610,10 @@ gtk_event_box_size_allocate (GtkWidget *widget,
|
|||||||
child_allocation.height);
|
child_allocation.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
child = gtk_bin_get_child (bin);
|
child = gtk_bin_get_child (bin);
|
||||||
if (child)
|
if (child)
|
||||||
gtk_widget_size_allocate (child, &child_allocation);
|
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
+13
-13
@@ -504,11 +504,11 @@ static void list_row_activated (GtkTreeView *tree_view,
|
|||||||
GtkTreeViewColumn *column,
|
GtkTreeViewColumn *column,
|
||||||
GtkFileChooserDefault *impl);
|
GtkFileChooserDefault *impl);
|
||||||
|
|
||||||
static void path_bar_clicked (GtkPathBar *path_bar,
|
static void path_bar_open_location_cb (GtkPathBar *path_bar,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GFile *child,
|
GFile *child,
|
||||||
gboolean child_is_hidden,
|
gboolean child_is_hidden,
|
||||||
GtkFileChooserDefault *impl);
|
GtkFileChooserDefault *impl);
|
||||||
|
|
||||||
static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
|
static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
|
||||||
|
|
||||||
@@ -2522,7 +2522,7 @@ put_recent_folder_in_pathbar (GtkFileChooserDefault *impl, GtkTreeIter *iter)
|
|||||||
gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter,
|
gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter,
|
||||||
MODEL_COL_FILE, &file,
|
MODEL_COL_FILE, &file,
|
||||||
-1);
|
-1);
|
||||||
_gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
|
gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4615,7 +4615,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
|
|||||||
if (! _gtk_file_info_consider_as_directory (info))
|
if (! _gtk_file_info_consider_as_directory (info))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
_gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
|
gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
|
||||||
|
|
||||||
if (priv->current_folder != data->file)
|
if (priv->current_folder != data->file)
|
||||||
{
|
{
|
||||||
@@ -7014,11 +7014,11 @@ list_row_activated (GtkTreeView *tree_view,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
path_bar_clicked (GtkPathBar *path_bar,
|
path_bar_open_location_cb (GtkPathBar *path_bar,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GFile *child_file,
|
GFile *child_file,
|
||||||
gboolean child_is_hidden,
|
gboolean child_is_hidden,
|
||||||
GtkFileChooserDefault *impl)
|
GtkFileChooserDefault *impl)
|
||||||
{
|
{
|
||||||
if (child_file)
|
if (child_file)
|
||||||
pending_select_files_add (impl, child_file);
|
pending_select_files_add (impl, child_file);
|
||||||
@@ -7507,7 +7507,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
|
|||||||
gtk_widget_class_bind_callback (widget_class, filter_combo_changed);
|
gtk_widget_class_bind_callback (widget_class, filter_combo_changed);
|
||||||
gtk_widget_class_bind_callback (widget_class, location_button_toggled_cb);
|
gtk_widget_class_bind_callback (widget_class, location_button_toggled_cb);
|
||||||
gtk_widget_class_bind_callback (widget_class, new_folder_button_clicked);
|
gtk_widget_class_bind_callback (widget_class, new_folder_button_clicked);
|
||||||
gtk_widget_class_bind_callback (widget_class, path_bar_clicked);
|
gtk_widget_class_bind_callback (widget_class, path_bar_open_location_cb);
|
||||||
gtk_widget_class_bind_callback (widget_class, places_sidebar_open_location_cb);
|
gtk_widget_class_bind_callback (widget_class, places_sidebar_open_location_cb);
|
||||||
gtk_widget_class_bind_callback (widget_class, places_sidebar_show_error_message_cb);
|
gtk_widget_class_bind_callback (widget_class, places_sidebar_show_error_message_cb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<object class="GtkPathBar" id="browse_path_bar">
|
<object class="GtkPathBar" id="browse_path_bar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
|
<signal name="open-location" handler="path_bar_open_location_cb" after="yes" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
|||||||
+611
-107
File diff suppressed because it is too large
Load Diff
@@ -109,6 +109,18 @@ gboolean gtk_grid_get_column_homogeneous (GtkGrid *grid);
|
|||||||
void gtk_grid_set_column_spacing (GtkGrid *grid,
|
void gtk_grid_set_column_spacing (GtkGrid *grid,
|
||||||
guint spacing);
|
guint spacing);
|
||||||
guint gtk_grid_get_column_spacing (GtkGrid *grid);
|
guint gtk_grid_get_column_spacing (GtkGrid *grid);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_grid_set_row_baseline_position (GtkGrid *grid,
|
||||||
|
gint row,
|
||||||
|
GtkBaselinePosition pos);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
GtkBaselinePosition gtk_grid_get_row_baseline_position (GtkGrid *grid,
|
||||||
|
gint row);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_grid_set_baseline_row (GtkGrid *grid,
|
||||||
|
gint row);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
gint gtk_grid_get_baseline_row (GtkGrid *grid);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
+68
-7
@@ -140,6 +140,8 @@ struct _GtkImagePrivate
|
|||||||
|
|
||||||
gchar *filename; /* Only used with GTK_IMAGE_ANIMATION, GTK_IMAGE_PIXBUF */
|
gchar *filename; /* Only used with GTK_IMAGE_ANIMATION, GTK_IMAGE_PIXBUF */
|
||||||
gchar *resource_path; /* Only used with GTK_IMAGE_PIXBUF */
|
gchar *resource_path; /* Only used with GTK_IMAGE_PIXBUF */
|
||||||
|
|
||||||
|
float baseline_align;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -154,6 +156,12 @@ static void gtk_image_get_preferred_width (GtkWidget *widget,
|
|||||||
static void gtk_image_get_preferred_height (GtkWidget *widget,
|
static void gtk_image_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_image_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
static void gtk_image_style_updated (GtkWidget *widget);
|
static void gtk_image_style_updated (GtkWidget *widget);
|
||||||
static void gtk_image_screen_changed (GtkWidget *widget,
|
static void gtk_image_screen_changed (GtkWidget *widget,
|
||||||
@@ -207,6 +215,7 @@ gtk_image_class_init (GtkImageClass *class)
|
|||||||
widget_class->draw = gtk_image_draw;
|
widget_class->draw = gtk_image_draw;
|
||||||
widget_class->get_preferred_width = gtk_image_get_preferred_width;
|
widget_class->get_preferred_width = gtk_image_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_image_get_preferred_height;
|
widget_class->get_preferred_height = gtk_image_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_image_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->unmap = gtk_image_unmap;
|
widget_class->unmap = gtk_image_unmap;
|
||||||
widget_class->unrealize = gtk_image_unrealize;
|
widget_class->unrealize = gtk_image_unrealize;
|
||||||
widget_class->style_updated = gtk_image_style_updated;
|
widget_class->style_updated = gtk_image_style_updated;
|
||||||
@@ -1393,6 +1402,26 @@ gtk_image_get_preferred_size (GtkImage *image,
|
|||||||
*height_out = height;
|
*height_out = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float
|
||||||
|
gtk_image_get_baseline_align (GtkImage *image)
|
||||||
|
{
|
||||||
|
PangoContext *pango_context;
|
||||||
|
PangoFontMetrics *metrics;
|
||||||
|
|
||||||
|
if (image->priv->baseline_align == 0.0)
|
||||||
|
{
|
||||||
|
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (image));
|
||||||
|
metrics = pango_context_get_metrics (pango_context,
|
||||||
|
pango_context_get_font_description (pango_context),
|
||||||
|
pango_context_get_language (pango_context));
|
||||||
|
image->priv->baseline_align =
|
||||||
|
(float)pango_font_metrics_get_ascent (metrics) /
|
||||||
|
(pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
|
||||||
|
}
|
||||||
|
|
||||||
|
return image->priv->baseline_align;
|
||||||
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gtk_image_draw (GtkWidget *widget,
|
gtk_image_draw (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
cairo_t *cr)
|
||||||
@@ -1401,7 +1430,7 @@ gtk_image_draw (GtkWidget *widget,
|
|||||||
GtkImagePrivate *priv;
|
GtkImagePrivate *priv;
|
||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
gint x, y, width, height;
|
gint x, y, width, height, baseline;
|
||||||
gfloat xalign, yalign;
|
gfloat xalign, yalign;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
@@ -1427,8 +1456,14 @@ gtk_image_draw (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||||
xalign = 1.0 - xalign;
|
xalign = 1.0 - xalign;
|
||||||
|
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
|
||||||
x = floor ((gtk_widget_get_allocated_width (widget) - width) * xalign) + border.left;
|
x = floor ((gtk_widget_get_allocated_width (widget) - width) * xalign) + border.left;
|
||||||
y = floor ((gtk_widget_get_allocated_height (widget) - height) * yalign) + border.top;
|
if (baseline == -1)
|
||||||
|
y = floor ((gtk_widget_get_allocated_height (widget) - height) * yalign) + border.top;
|
||||||
|
else
|
||||||
|
y = CLAMP (baseline - height * gtk_image_get_baseline_align (image),
|
||||||
|
border.top, gtk_widget_get_allocated_height (widget) - height);
|
||||||
|
|
||||||
if (gtk_image_get_storage_type (image) == GTK_IMAGE_ANIMATION)
|
if (gtk_image_get_storage_type (image) == GTK_IMAGE_ANIMATION)
|
||||||
{
|
{
|
||||||
@@ -1535,15 +1570,37 @@ gtk_image_get_preferred_width (GtkWidget *widget,
|
|||||||
*minimum = *natural = width;
|
*minimum = *natural = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_image_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
gint height;
|
||||||
|
float baseline_align;
|
||||||
|
|
||||||
|
gtk_image_get_preferred_size (GTK_IMAGE (widget), NULL, &height);
|
||||||
|
*minimum = *natural = height;
|
||||||
|
|
||||||
|
if (minimum_baseline || natural_baseline)
|
||||||
|
{
|
||||||
|
baseline_align = gtk_image_get_baseline_align (GTK_IMAGE (widget));
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = height * baseline_align;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = height * baseline_align;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_image_get_preferred_height (GtkWidget *widget,
|
gtk_image_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural)
|
gint *natural)
|
||||||
{
|
{
|
||||||
gint height;
|
gtk_image_get_preferred_height_and_baseline_for_width (widget, -1, minimum, natural,
|
||||||
|
NULL, NULL);
|
||||||
gtk_image_get_preferred_size (GTK_IMAGE (widget), NULL, &height);
|
|
||||||
*minimum = *natural = height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1558,9 +1615,13 @@ icon_theme_changed (GtkImage *image)
|
|||||||
static void
|
static void
|
||||||
gtk_image_style_updated (GtkWidget *widget)
|
gtk_image_style_updated (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
GtkImage *image = GTK_IMAGE (widget);
|
||||||
|
GtkImagePrivate *priv = image->priv;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget);
|
GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget);
|
||||||
|
|
||||||
icon_theme_changed (GTK_IMAGE (widget));
|
icon_theme_changed (image);
|
||||||
|
priv->baseline_align = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+91
-17
@@ -519,6 +519,12 @@ static void gtk_label_get_preferred_height_for_width (GtkWidget
|
|||||||
gint width,
|
gint width,
|
||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height);
|
gint *natural_height);
|
||||||
|
static void gtk_label_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
static GtkBuildableIface *buildable_parent_iface = NULL;
|
static GtkBuildableIface *buildable_parent_iface = NULL;
|
||||||
|
|
||||||
@@ -585,6 +591,7 @@ gtk_label_class_init (GtkLabelClass *class)
|
|||||||
widget_class->get_preferred_height = gtk_label_get_preferred_height;
|
widget_class->get_preferred_height = gtk_label_get_preferred_height;
|
||||||
widget_class->get_preferred_width_for_height = gtk_label_get_preferred_width_for_height;
|
widget_class->get_preferred_width_for_height = gtk_label_get_preferred_width_for_height;
|
||||||
widget_class->get_preferred_height_for_width = gtk_label_get_preferred_height_for_width;
|
widget_class->get_preferred_height_for_width = gtk_label_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_label_get_preferred_height_and_baseline_for_width;
|
||||||
|
|
||||||
class->move_cursor = gtk_label_move_cursor;
|
class->move_cursor = gtk_label_move_cursor;
|
||||||
class->copy_clipboard = gtk_label_copy_clipboard;
|
class->copy_clipboard = gtk_label_copy_clipboard;
|
||||||
@@ -3462,15 +3469,18 @@ gtk_label_get_request_mode (GtkWidget *widget)
|
|||||||
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_size_for_allocation (GtkLabel *label,
|
get_size_for_allocation (GtkLabel *label,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint allocation,
|
gint allocation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
gint text_height;
|
gint text_height, baseline;
|
||||||
|
|
||||||
layout = gtk_label_get_measuring_layout (label, NULL, allocation * PANGO_SCALE);
|
layout = gtk_label_get_measuring_layout (label, NULL, allocation * PANGO_SCALE);
|
||||||
|
|
||||||
@@ -3482,6 +3492,16 @@ get_size_for_allocation (GtkLabel *label,
|
|||||||
if (natural_size)
|
if (natural_size)
|
||||||
*natural_size = text_height;
|
*natural_size = text_height;
|
||||||
|
|
||||||
|
if (minimum_baseline || natural_baseline)
|
||||||
|
{
|
||||||
|
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = baseline;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = baseline;
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3578,7 +3598,9 @@ static void
|
|||||||
gtk_label_get_preferred_size (GtkWidget *widget,
|
gtk_label_get_preferred_size (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkLabel *label = GTK_LABEL (widget);
|
GtkLabel *label = GTK_LABEL (widget);
|
||||||
GtkLabelPrivate *priv = label->priv;
|
GtkLabelPrivate *priv = label->priv;
|
||||||
@@ -3586,6 +3608,12 @@ gtk_label_get_preferred_size (GtkWidget *widget,
|
|||||||
PangoRectangle smallest_rect;
|
PangoRectangle smallest_rect;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
|
|
||||||
gtk_label_get_preferred_layout_size (label, &smallest_rect, &widest_rect);
|
gtk_label_get_preferred_layout_size (label, &smallest_rect, &widest_rect);
|
||||||
|
|
||||||
/* Now that we have minimum and natural sizes in pango extents, apply a possible transform */
|
/* Now that we have minimum and natural sizes in pango extents, apply a possible transform */
|
||||||
@@ -3640,7 +3668,8 @@ gtk_label_get_preferred_size (GtkWidget *widget,
|
|||||||
get_size_for_allocation (label,
|
get_size_for_allocation (label,
|
||||||
GTK_ORIENTATION_VERTICAL,
|
GTK_ORIENTATION_VERTICAL,
|
||||||
smallest_rect.height,
|
smallest_rect.height,
|
||||||
minimum_size, natural_size);
|
minimum_size, natural_size,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3667,7 +3696,16 @@ gtk_label_get_preferred_size (GtkWidget *widget,
|
|||||||
get_size_for_allocation (label,
|
get_size_for_allocation (label,
|
||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
widest_rect.width,
|
widest_rect.width,
|
||||||
minimum_size, natural_size);
|
minimum_size, natural_size,
|
||||||
|
minimum_baseline, natural_baseline);
|
||||||
|
|
||||||
|
if (priv->angle == 180)
|
||||||
|
{
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = *minimum_size - *minimum_baseline;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = *natural_size - *natural_baseline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3680,6 +3718,12 @@ gtk_label_get_preferred_size (GtkWidget *widget,
|
|||||||
|
|
||||||
*minimum_size += border.top + border.bottom;
|
*minimum_size += border.top + border.bottom;
|
||||||
*natural_size += border.top + border.bottom;
|
*natural_size += border.top + border.bottom;
|
||||||
|
|
||||||
|
if (minimum_baseline && *minimum_baseline != -1)
|
||||||
|
*minimum_baseline += border.top;
|
||||||
|
|
||||||
|
if (natural_baseline && *natural_baseline != -1)
|
||||||
|
*natural_baseline += border.top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3688,7 +3732,7 @@ gtk_label_get_preferred_width (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_label_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
|
gtk_label_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3696,7 +3740,7 @@ gtk_label_get_preferred_height (GtkWidget *widget,
|
|||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size)
|
||||||
{
|
{
|
||||||
gtk_label_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
|
gtk_label_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3719,7 +3763,8 @@ gtk_label_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
|
|
||||||
get_size_for_allocation (label, GTK_ORIENTATION_VERTICAL,
|
get_size_for_allocation (label, GTK_ORIENTATION_VERTICAL,
|
||||||
MAX (1, height - border.top - border.bottom),
|
MAX (1, height - border.top - border.bottom),
|
||||||
minimum_width, natural_width);
|
minimum_width, natural_width,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
if (minimum_width)
|
if (minimum_width)
|
||||||
*minimum_width += border.right + border.left;
|
*minimum_width += border.right + border.left;
|
||||||
@@ -3732,15 +3777,17 @@ gtk_label_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_label_get_preferred_height_for_width (GtkWidget *widget,
|
gtk_label_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
gint width,
|
gint width,
|
||||||
gint *minimum_height,
|
gint *minimum_height,
|
||||||
gint *natural_height)
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkLabel *label = GTK_LABEL (widget);
|
GtkLabel *label = GTK_LABEL (widget);
|
||||||
GtkLabelPrivate *priv = label->priv;
|
GtkLabelPrivate *priv = label->priv;
|
||||||
|
|
||||||
if (priv->wrap && (priv->angle == 0 || priv->angle == 180 || priv->angle == 360))
|
if (width != -1 && priv->wrap && (priv->angle == 0 || priv->angle == 180 || priv->angle == 360))
|
||||||
{
|
{
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
@@ -3751,7 +3798,13 @@ gtk_label_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
|
|
||||||
get_size_for_allocation (label, GTK_ORIENTATION_HORIZONTAL,
|
get_size_for_allocation (label, GTK_ORIENTATION_HORIZONTAL,
|
||||||
MAX (1, width - border.left - border.right),
|
MAX (1, width - border.left - border.right),
|
||||||
minimum_height, natural_height);
|
minimum_height, natural_height,
|
||||||
|
minimum_baseline, natural_baseline);
|
||||||
|
|
||||||
|
if (minimum_baseline && *minimum_baseline != -1)
|
||||||
|
*minimum_baseline += border.top;
|
||||||
|
if (natural_baseline && *natural_baseline != -1)
|
||||||
|
*natural_baseline += border.top;
|
||||||
|
|
||||||
if (minimum_height)
|
if (minimum_height)
|
||||||
*minimum_height += border.top + border.bottom;
|
*minimum_height += border.top + border.bottom;
|
||||||
@@ -3760,7 +3813,18 @@ gtk_label_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
*natural_height += border.top + border.bottom;
|
*natural_height += border.top + border.bottom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, minimum_height, natural_height);
|
gtk_label_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum_height, natural_height, minimum_baseline, natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_label_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height)
|
||||||
|
{
|
||||||
|
return gtk_label_get_preferred_height_and_baseline_for_width (widget, width,
|
||||||
|
minimum_height, natural_height,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3855,6 +3919,7 @@ get_layout_location (GtkLabel *label,
|
|||||||
gint req_height;
|
gint req_height;
|
||||||
gfloat xalign, yalign;
|
gfloat xalign, yalign;
|
||||||
PangoRectangle logical;
|
PangoRectangle logical;
|
||||||
|
gint baseline, layout_baseline, baseline_offset;
|
||||||
|
|
||||||
misc = GTK_MISC (label);
|
misc = GTK_MISC (label);
|
||||||
widget = GTK_WIDGET (label);
|
widget = GTK_WIDGET (label);
|
||||||
@@ -3887,6 +3952,15 @@ get_layout_location (GtkLabel *label,
|
|||||||
|
|
||||||
x = floor (allocation.x + border.left + xalign * (allocation.width - req_width) - logical.x);
|
x = floor (allocation.x + border.left + xalign * (allocation.width - req_width) - logical.x);
|
||||||
|
|
||||||
|
baseline_offset = 0;
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
if (baseline != -1 && !priv->have_transform)
|
||||||
|
{
|
||||||
|
layout_baseline = pango_layout_get_baseline (priv->layout) / PANGO_SCALE;
|
||||||
|
baseline_offset = baseline - layout_baseline;
|
||||||
|
yalign = 0.0; /* Can't support yalign while baseline aligning */
|
||||||
|
}
|
||||||
|
|
||||||
/* bgo#315462 - For single-line labels, *do* align the requisition with
|
/* bgo#315462 - For single-line labels, *do* align the requisition with
|
||||||
* respect to the allocation, even if we are under-allocated. For multi-line
|
* respect to the allocation, even if we are under-allocated. For multi-line
|
||||||
* labels, always show the top of the text when they are under-allocated. The
|
* labels, always show the top of the text when they are under-allocated. The
|
||||||
@@ -3901,9 +3975,9 @@ get_layout_location (GtkLabel *label,
|
|||||||
* middle". You want to read the first line, at least, to get some context.
|
* middle". You want to read the first line, at least, to get some context.
|
||||||
*/
|
*/
|
||||||
if (pango_layout_get_line_count (priv->layout) == 1)
|
if (pango_layout_get_line_count (priv->layout) == 1)
|
||||||
y = floor (allocation.y + border.top + (allocation.height - req_height) * yalign) - logical.y;
|
y = floor (allocation.y + border.top + (allocation.height - req_height) * yalign) - logical.y + baseline_offset;
|
||||||
else
|
else
|
||||||
y = floor (allocation.y + border.top + MAX ((allocation.height - req_height) * yalign, 0)) - logical.y;
|
y = floor (allocation.y + border.top + MAX ((allocation.height - req_height) * yalign, 0)) - logical.y + baseline_offset;
|
||||||
|
|
||||||
if (xp)
|
if (xp)
|
||||||
*xp = x;
|
*xp = x;
|
||||||
|
|||||||
+2
-1
@@ -171,7 +171,8 @@ static const GDebugKey gtk_debug_keys[] = {
|
|||||||
{"printing", GTK_DEBUG_PRINTING},
|
{"printing", GTK_DEBUG_PRINTING},
|
||||||
{"builder", GTK_DEBUG_BUILDER},
|
{"builder", GTK_DEBUG_BUILDER},
|
||||||
{"size-request", GTK_DEBUG_SIZE_REQUEST},
|
{"size-request", GTK_DEBUG_SIZE_REQUEST},
|
||||||
{"no-css-cache", GTK_DEBUG_NO_CSS_CACHE}
|
{"no-css-cache", GTK_DEBUG_NO_CSS_CACHE},
|
||||||
|
{"baselines", GTK_DEBUG_BASELINES}
|
||||||
};
|
};
|
||||||
#endif /* G_ENABLE_DEBUG */
|
#endif /* G_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
|||||||
+2
-20
@@ -50,6 +50,7 @@
|
|||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
enum {
|
enum {
|
||||||
@@ -308,25 +309,6 @@ gtk_menu_bar_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
get_preferred_size_for_size (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
gint size,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_width (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
|
|
||||||
else
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_height (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_height_for_width (widget, size, minimum, natural);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_menu_bar_size_request (GtkWidget *widget,
|
gtk_menu_bar_size_request (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
@@ -374,7 +356,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
|
|||||||
|
|
||||||
if (gtk_widget_get_visible (child))
|
if (gtk_widget_get_visible (child))
|
||||||
{
|
{
|
||||||
get_preferred_size_for_size (child, orientation, size, &child_minimum, &child_natural);
|
_gtk_widget_get_preferred_size_for_size (child, orientation, size, &child_minimum, &child_natural);
|
||||||
|
|
||||||
if (use_toggle_size)
|
if (use_toggle_size)
|
||||||
{
|
{
|
||||||
|
|||||||
+49
-11
@@ -25,6 +25,8 @@
|
|||||||
#include "gtkactionhelper.h"
|
#include "gtkactionhelper.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gtkaccellabel.h"
|
#include "gtkaccellabel.h"
|
||||||
|
#include "gtkimage.h"
|
||||||
|
#include "gtkbox.h"
|
||||||
|
|
||||||
struct _GtkModelMenuItem
|
struct _GtkModelMenuItem
|
||||||
{
|
{
|
||||||
@@ -113,6 +115,51 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item,
|
|||||||
GMenuModel *submenu;
|
GMenuModel *submenu;
|
||||||
const gchar *key;
|
const gchar *key;
|
||||||
GVariant *value;
|
GVariant *value;
|
||||||
|
GtkWidget *label;
|
||||||
|
|
||||||
|
label = NULL;
|
||||||
|
|
||||||
|
/* In the case that we have an icon, make an HBox and put it beside
|
||||||
|
* the label. Otherwise, we just have a label directly.
|
||||||
|
*/
|
||||||
|
if ((value = g_menu_model_get_item_attribute_value (model, item_index, "icon", NULL)))
|
||||||
|
{
|
||||||
|
GIcon *icon;
|
||||||
|
|
||||||
|
icon = g_icon_deserialize (value);
|
||||||
|
|
||||||
|
if (icon != NULL)
|
||||||
|
{
|
||||||
|
GtkWidget *image;
|
||||||
|
GtkWidget *box;
|
||||||
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
|
||||||
|
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
|
||||||
|
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||||
|
g_object_unref (icon);
|
||||||
|
|
||||||
|
label = gtk_accel_label_new ("");
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), GTK_WIDGET (item));
|
||||||
|
gtk_box_pack_end (GTK_BOX (box), label, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (item), box);
|
||||||
|
|
||||||
|
gtk_widget_show_all (box);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_variant_unref (value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label == NULL)
|
||||||
|
{
|
||||||
|
/* Ensure that the GtkAccelLabel has been created... */
|
||||||
|
(void) gtk_menu_item_get_label (GTK_MENU_ITEM (item));
|
||||||
|
label = gtk_bin_get_child (GTK_BIN (item));
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert (label != NULL);
|
||||||
|
|
||||||
if ((submenu = g_menu_model_get_item_link (model, item_index, "submenu")))
|
if ((submenu = g_menu_model_get_item_link (model, item_index, "submenu")))
|
||||||
{
|
{
|
||||||
@@ -141,7 +188,7 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item,
|
|||||||
while (g_menu_attribute_iter_get_next (iter, &key, &value))
|
while (g_menu_attribute_iter_get_next (iter, &key, &value))
|
||||||
{
|
{
|
||||||
if (g_str_equal (key, "label") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
if (g_str_equal (key, "label") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
gtk_menu_item_set_label (GTK_MENU_ITEM (item), g_variant_get_string (value, NULL));
|
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), g_variant_get_string (value, NULL));
|
||||||
|
|
||||||
else if (g_str_equal (key, "accel") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
else if (g_str_equal (key, "accel") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
{
|
{
|
||||||
@@ -151,16 +198,7 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item,
|
|||||||
gtk_accelerator_parse (g_variant_get_string (value, NULL), &key, &modifiers);
|
gtk_accelerator_parse (g_variant_get_string (value, NULL), &key, &modifiers);
|
||||||
|
|
||||||
if (key)
|
if (key)
|
||||||
{
|
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (label), key, modifiers);
|
||||||
GtkAccelLabel *accel_label;
|
|
||||||
|
|
||||||
/* Ensure that the GtkAccelLabel has been created... */
|
|
||||||
(void) gtk_menu_item_get_label (GTK_MENU_ITEM (item));
|
|
||||||
accel_label = GTK_ACCEL_LABEL (gtk_bin_get_child (GTK_BIN (item)));
|
|
||||||
g_assert (accel_label);
|
|
||||||
|
|
||||||
gtk_accel_label_set_accel (accel_label, key, modifiers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (g_str_equal (key, "action") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
else if (g_str_equal (key, "action") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
|
|||||||
+5
-24
@@ -2214,25 +2214,6 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
get_preferred_size_for_size (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
gint size,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_width (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
|
|
||||||
else
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_height (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_height_for_width (widget, size, minimum, natural);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_padding_and_border (GtkNotebook *notebook,
|
get_padding_and_border (GtkNotebook *notebook,
|
||||||
GtkBorder *border)
|
GtkBorder *border)
|
||||||
@@ -2282,11 +2263,11 @@ gtk_notebook_size_request (GtkWidget *widget,
|
|||||||
if (gtk_widget_get_visible (page->child))
|
if (gtk_widget_get_visible (page->child))
|
||||||
{
|
{
|
||||||
vis_pages++;
|
vis_pages++;
|
||||||
get_preferred_size_for_size (page->child,
|
_gtk_widget_get_preferred_size_for_size (page->child,
|
||||||
orientation,
|
orientation,
|
||||||
size,
|
size,
|
||||||
&child_minimum,
|
&child_minimum,
|
||||||
&child_natural);
|
&child_natural);
|
||||||
|
|
||||||
*minimum = MAX (*minimum, child_minimum);
|
*minimum = MAX (*minimum, child_minimum);
|
||||||
*natural = MAX (*natural, child_natural);
|
*natural = MAX (*natural, child_natural);
|
||||||
|
|||||||
+3
-21
@@ -35,6 +35,7 @@
|
|||||||
#include "gtkorientableprivate.h"
|
#include "gtkorientableprivate.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
#include "a11y/gtkpanedaccessible.h"
|
#include "a11y/gtkpanedaccessible.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -869,25 +870,6 @@ gtk_paned_finalize (GObject *object)
|
|||||||
G_OBJECT_CLASS (gtk_paned_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gtk_paned_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
get_preferred_size_for_size (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
gint size,
|
|
||||||
gint *minimum,
|
|
||||||
gint *natural)
|
|
||||||
{
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_width (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
|
|
||||||
else
|
|
||||||
if (size < 0)
|
|
||||||
gtk_widget_get_preferred_height (widget, minimum, natural);
|
|
||||||
else
|
|
||||||
gtk_widget_get_preferred_height_for_width (widget, size, minimum, natural);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_paned_get_preferred_size (GtkWidget *widget,
|
gtk_paned_get_preferred_size (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
@@ -903,7 +885,7 @@ gtk_paned_get_preferred_size (GtkWidget *widget,
|
|||||||
|
|
||||||
if (priv->child1 && gtk_widget_get_visible (priv->child1))
|
if (priv->child1 && gtk_widget_get_visible (priv->child1))
|
||||||
{
|
{
|
||||||
get_preferred_size_for_size (priv->child1, orientation, size, &child_min, &child_nat);
|
_gtk_widget_get_preferred_size_for_size (priv->child1, orientation, size, &child_min, &child_nat);
|
||||||
if (priv->child1_shrink && priv->orientation == orientation)
|
if (priv->child1_shrink && priv->orientation == orientation)
|
||||||
*minimum = 0;
|
*minimum = 0;
|
||||||
else
|
else
|
||||||
@@ -913,7 +895,7 @@ gtk_paned_get_preferred_size (GtkWidget *widget,
|
|||||||
|
|
||||||
if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
if (priv->child2 && gtk_widget_get_visible (priv->child2))
|
||||||
{
|
{
|
||||||
get_preferred_size_for_size (priv->child2, orientation, size, &child_min, &child_nat);
|
_gtk_widget_get_preferred_size_for_size (priv->child2, orientation, size, &child_min, &child_nat);
|
||||||
|
|
||||||
if (priv->orientation == orientation)
|
if (priv->orientation == orientation)
|
||||||
{
|
{
|
||||||
|
|||||||
+721
-344
File diff suppressed because it is too large
Load Diff
+22
-9
@@ -18,8 +18,13 @@
|
|||||||
#ifndef __GTK_PATH_BAR_H__
|
#ifndef __GTK_PATH_BAR_H__
|
||||||
#define __GTK_PATH_BAR_H__
|
#define __GTK_PATH_BAR_H__
|
||||||
|
|
||||||
#include "gtkcontainer.h"
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
#include "gtkfilesystem.h"
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gtk/gtkcontainer.h>
|
||||||
|
#include <gtk/gtkfilesystem.h>
|
||||||
|
#include <gtk/gtkplacessidebar.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -46,18 +51,26 @@ struct _GtkPathBarClass
|
|||||||
{
|
{
|
||||||
GtkContainerClass parent_class;
|
GtkContainerClass parent_class;
|
||||||
|
|
||||||
void (* path_clicked) (GtkPathBar *path_bar,
|
void (* open_location) (GtkPathBar *path_bar,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GFile *child_file,
|
GFile *child_file,
|
||||||
gboolean child_is_hidden);
|
gboolean child_is_hidden);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gtk_path_bar_get_type (void) G_GNUC_CONST;
|
GType gtk_path_bar_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget *gtk_path_bar_new (void);
|
||||||
|
|
||||||
|
GtkPlacesOpenFlags gtk_path_bar_get_open_flags (GtkPathBar *path_bar);
|
||||||
|
void gtk_path_bar_set_open_flags (GtkPathBar *path_bar, GtkPlacesOpenFlags flags);
|
||||||
|
|
||||||
|
void gtk_path_bar_set_location (GtkPathBar *path_bar,
|
||||||
|
GFile *location,
|
||||||
|
gboolean keep_trail);
|
||||||
|
GFile *gtk_path_bar_get_location (GtkPathBar *path_bar);
|
||||||
|
|
||||||
void _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
|
void _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
|
||||||
GtkFileSystem *file_system);
|
GtkFileSystem *file_system);
|
||||||
void _gtk_path_bar_set_file (GtkPathBar *path_bar,
|
|
||||||
GFile *file,
|
|
||||||
gboolean keep_trail);
|
|
||||||
void _gtk_path_bar_up (GtkPathBar *path_bar);
|
void _gtk_path_bar_up (GtkPathBar *path_bar);
|
||||||
void _gtk_path_bar_down (GtkPathBar *path_bar);
|
void _gtk_path_bar_down (GtkPathBar *path_bar);
|
||||||
|
|
||||||
|
|||||||
+186
-52
@@ -170,6 +170,7 @@ struct _GtkPlacesSidebar {
|
|||||||
char *drop_target_uri;
|
char *drop_target_uri;
|
||||||
|
|
||||||
guint show_desktop : 1;
|
guint show_desktop : 1;
|
||||||
|
guint show_connect_to_server : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkPlacesSidebarClass {
|
struct _GtkPlacesSidebarClass {
|
||||||
@@ -180,10 +181,12 @@ struct _GtkPlacesSidebarClass {
|
|||||||
GtkPlacesOpenFlags open_flags);
|
GtkPlacesOpenFlags open_flags);
|
||||||
void (* populate_popup) (GtkPlacesSidebar *sidebar,
|
void (* populate_popup) (GtkPlacesSidebar *sidebar,
|
||||||
GtkMenu *menu,
|
GtkMenu *menu,
|
||||||
GFile *selected_item);
|
GFile *selected_item,
|
||||||
|
GVolume *selected_volume);
|
||||||
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
void (* show_error_message) (GtkPlacesSidebar *sidebar,
|
||||||
const char *primary,
|
const char *primary,
|
||||||
const char *secondary);
|
const char *secondary);
|
||||||
|
void (* show_connect_to_server) (GtkPlacesSidebar *sidebar);
|
||||||
GdkDragAction (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
GdkDragAction (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
GFile *dest_file,
|
GFile *dest_file,
|
||||||
@@ -221,6 +224,7 @@ typedef enum {
|
|||||||
PLACES_MOUNTED_VOLUME,
|
PLACES_MOUNTED_VOLUME,
|
||||||
PLACES_BOOKMARK,
|
PLACES_BOOKMARK,
|
||||||
PLACES_HEADING,
|
PLACES_HEADING,
|
||||||
|
PLACES_CONNECT_TO_SERVER,
|
||||||
PLACES_DROP_FEEDBACK
|
PLACES_DROP_FEEDBACK
|
||||||
} PlaceType;
|
} PlaceType;
|
||||||
|
|
||||||
@@ -235,6 +239,7 @@ enum {
|
|||||||
OPEN_LOCATION,
|
OPEN_LOCATION,
|
||||||
POPULATE_POPUP,
|
POPULATE_POPUP,
|
||||||
SHOW_ERROR_MESSAGE,
|
SHOW_ERROR_MESSAGE,
|
||||||
|
SHOW_CONNECT_TO_SERVER,
|
||||||
DRAG_ACTION_REQUESTED,
|
DRAG_ACTION_REQUESTED,
|
||||||
DRAG_ACTION_ASK,
|
DRAG_ACTION_ASK,
|
||||||
DRAG_PERFORM_DROP,
|
DRAG_PERFORM_DROP,
|
||||||
@@ -245,15 +250,17 @@ enum {
|
|||||||
PROP_LOCATION = 1,
|
PROP_LOCATION = 1,
|
||||||
PROP_OPEN_FLAGS,
|
PROP_OPEN_FLAGS,
|
||||||
PROP_SHOW_DESKTOP,
|
PROP_SHOW_DESKTOP,
|
||||||
|
PROP_SHOW_CONNECT_TO_SERVER,
|
||||||
NUM_PROPERTIES,
|
NUM_PROPERTIES,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Names for themed icons */
|
/* Names for themed icons */
|
||||||
#define ICON_NAME_HOME "user-home-symbolic"
|
#define ICON_NAME_HOME "user-home-symbolic"
|
||||||
#define ICON_NAME_DESKTOP "user-desktop"
|
#define ICON_NAME_DESKTOP "user-desktop"
|
||||||
#define ICON_NAME_FILESYSTEM "drive-harddisk-symbolic"
|
#define ICON_NAME_FILESYSTEM "drive-harddisk-symbolic"
|
||||||
#define ICON_NAME_EJECT "media-eject-symbolic"
|
#define ICON_NAME_EJECT "media-eject-symbolic"
|
||||||
#define ICON_NAME_NETWORK "network-workgroup-symbolic"
|
#define ICON_NAME_NETWORK "network-workgroup-symbolic"
|
||||||
|
#define ICON_NAME_NETWORK_SERVER "network-server-symbolic"
|
||||||
|
|
||||||
#define ICON_NAME_FOLDER_DESKTOP "user-desktop"
|
#define ICON_NAME_FOLDER_DESKTOP "user-desktop"
|
||||||
#define ICON_NAME_FOLDER_DOCUMENTS "folder-documents-symbolic"
|
#define ICON_NAME_FOLDER_DOCUMENTS "folder-documents-symbolic"
|
||||||
@@ -336,10 +343,10 @@ emit_open_location (GtkPlacesSidebar *sidebar, GFile *location, GtkPlacesOpenFla
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_populate_popup (GtkPlacesSidebar *sidebar, GtkMenu *menu, GFile *selected_item)
|
emit_populate_popup (GtkPlacesSidebar *sidebar, GtkMenu *menu, GFile *selected_item, GVolume *selected_volume)
|
||||||
{
|
{
|
||||||
g_signal_emit (sidebar, places_sidebar_signals[POPULATE_POPUP], 0,
|
g_signal_emit (sidebar, places_sidebar_signals[POPULATE_POPUP], 0,
|
||||||
menu, selected_item);
|
menu, selected_item, selected_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -349,6 +356,12 @@ emit_show_error_message (GtkPlacesSidebar *sidebar, const char *primary, const c
|
|||||||
primary, secondary);
|
primary, secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
emit_show_connect_to_server (GtkPlacesSidebar *sidebar)
|
||||||
|
{
|
||||||
|
g_signal_emit (sidebar, places_sidebar_signals[SHOW_CONNECT_TO_SERVER], 0);
|
||||||
|
}
|
||||||
|
|
||||||
static GdkDragAction
|
static GdkDragAction
|
||||||
emit_drag_action_requested (GtkPlacesSidebar *sidebar,
|
emit_drag_action_requested (GtkPlacesSidebar *sidebar,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
@@ -1062,6 +1075,16 @@ update_places (GtkPlacesSidebar *sidebar)
|
|||||||
_("Browse the contents of the network"));
|
_("Browse the contents of the network"));
|
||||||
g_object_unref (icon);
|
g_object_unref (icon);
|
||||||
|
|
||||||
|
if (sidebar->show_connect_to_server) {
|
||||||
|
icon = g_themed_icon_new (ICON_NAME_NETWORK_SERVER);
|
||||||
|
add_place (sidebar, PLACES_CONNECT_TO_SERVER,
|
||||||
|
SECTION_NETWORK,
|
||||||
|
_("Connect to Server"), icon, NULL,
|
||||||
|
NULL, NULL, NULL, 0,
|
||||||
|
_("Connect to a network server address"));
|
||||||
|
g_object_unref (icon);
|
||||||
|
}
|
||||||
|
|
||||||
network_volumes = g_list_reverse (network_volumes);
|
network_volumes = g_list_reverse (network_volumes);
|
||||||
for (l = network_volumes; l != NULL; l = l->next) {
|
for (l = network_volumes; l != NULL; l = l->next) {
|
||||||
volume = l->data;
|
volume = l->data;
|
||||||
@@ -2186,54 +2209,79 @@ mount_volume (GtkPlacesSidebar *sidebar, GVolume *volume)
|
|||||||
g_volume_mount (volume, 0, mount_op, NULL, volume_mount_cb, sidebar);
|
g_volume_mount (volume, 0, mount_op, NULL, volume_mount_cb, sidebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
open_selected_volume (GtkPlacesSidebar *sidebar,
|
||||||
|
GtkTreeModel *model,
|
||||||
|
GtkTreeIter *iter,
|
||||||
|
GtkPlacesOpenFlags open_flags)
|
||||||
|
{
|
||||||
|
GDrive *drive;
|
||||||
|
GVolume *volume;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, iter,
|
||||||
|
PLACES_SIDEBAR_COLUMN_DRIVE, &drive,
|
||||||
|
PLACES_SIDEBAR_COLUMN_VOLUME, &volume,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
if (volume != NULL && !sidebar->mounting) {
|
||||||
|
sidebar->mounting = TRUE;
|
||||||
|
|
||||||
|
sidebar->go_to_after_mount_open_flags = open_flags;
|
||||||
|
|
||||||
|
mount_volume (sidebar, volume);
|
||||||
|
} else if (volume == NULL && drive != NULL &&
|
||||||
|
(g_drive_can_start (drive) || g_drive_can_start_degraded (drive))) {
|
||||||
|
GMountOperation *mount_op;
|
||||||
|
|
||||||
|
mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
|
||||||
|
g_drive_start (drive, G_DRIVE_START_NONE, mount_op, NULL, drive_start_from_bookmark_cb, NULL);
|
||||||
|
g_object_unref (mount_op);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drive != NULL)
|
||||||
|
g_object_unref (drive);
|
||||||
|
|
||||||
|
if (volume != NULL)
|
||||||
|
g_object_unref (volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
open_selected_uri (GtkPlacesSidebar *sidebar,
|
||||||
|
const gchar *uri,
|
||||||
|
GtkPlacesOpenFlags open_flags)
|
||||||
|
{
|
||||||
|
GFile *location;
|
||||||
|
|
||||||
|
location = g_file_new_for_uri (uri);
|
||||||
|
emit_open_location (sidebar, location, open_flags);
|
||||||
|
g_object_unref (location);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
open_selected_bookmark (GtkPlacesSidebar *sidebar,
|
open_selected_bookmark (GtkPlacesSidebar *sidebar,
|
||||||
GtkTreeModel *model,
|
GtkTreeModel *model,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
GtkPlacesOpenFlags open_flags)
|
GtkPlacesOpenFlags open_flags)
|
||||||
{
|
{
|
||||||
GFile *location;
|
|
||||||
char *uri;
|
char *uri;
|
||||||
|
PlaceType place_type;
|
||||||
|
|
||||||
if (!iter) {
|
if (!iter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter, PLACES_SIDEBAR_COLUMN_URI, &uri, -1);
|
gtk_tree_model_get (model, iter,
|
||||||
|
PLACES_SIDEBAR_COLUMN_URI, &uri,
|
||||||
|
PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type,
|
||||||
|
-1);
|
||||||
|
|
||||||
if (uri != NULL) {
|
if (uri != NULL) {
|
||||||
location = g_file_new_for_uri (uri);
|
open_selected_uri (sidebar, uri, open_flags);
|
||||||
emit_open_location (sidebar, location, open_flags);
|
|
||||||
|
|
||||||
g_object_unref (location);
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
} else if (place_type == PLACES_CONNECT_TO_SERVER) {
|
||||||
|
emit_show_connect_to_server (sidebar);
|
||||||
} else {
|
} else {
|
||||||
GDrive *drive;
|
open_selected_volume (sidebar, model, iter, open_flags);
|
||||||
GVolume *volume;
|
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
|
||||||
PLACES_SIDEBAR_COLUMN_DRIVE, &drive,
|
|
||||||
PLACES_SIDEBAR_COLUMN_VOLUME, &volume,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
if (volume != NULL && !sidebar->mounting) {
|
|
||||||
sidebar->mounting = TRUE;
|
|
||||||
|
|
||||||
sidebar->go_to_after_mount_open_flags = open_flags;
|
|
||||||
|
|
||||||
mount_volume (sidebar, volume);
|
|
||||||
} else if (volume == NULL && drive != NULL &&
|
|
||||||
(g_drive_can_start (drive) || g_drive_can_start_degraded (drive))) {
|
|
||||||
GMountOperation *mount_op;
|
|
||||||
|
|
||||||
mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
|
|
||||||
g_drive_start (drive, G_DRIVE_START_NONE, mount_op, NULL, drive_start_from_bookmark_cb, sidebar);
|
|
||||||
g_object_unref (mount_op);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&drive);
|
|
||||||
g_clear_object (&volume);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3161,9 +3209,10 @@ bookmarks_build_popup_menu (GtkPlacesSidebar *sidebar)
|
|||||||
else
|
else
|
||||||
file = NULL;
|
file = NULL;
|
||||||
|
|
||||||
emit_populate_popup (sidebar, GTK_MENU (sidebar->popup_menu), file);
|
emit_populate_popup (sidebar, GTK_MENU (sidebar->popup_menu), file, sel_info.volume);
|
||||||
|
|
||||||
g_object_unref (file);
|
if (file)
|
||||||
|
g_object_unref (file);
|
||||||
|
|
||||||
free_selection_info (&sel_info);
|
free_selection_info (&sel_info);
|
||||||
}
|
}
|
||||||
@@ -3292,7 +3341,8 @@ bookmarks_button_release_event_cb (GtkWidget *widget,
|
|||||||
PLACES_SIDEBAR_COLUMN_ROW_TYPE, &row_type,
|
PLACES_SIDEBAR_COLUMN_ROW_TYPE, &row_type,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (row_type != PLACES_HEADING) {
|
if (row_type != PLACES_HEADING
|
||||||
|
&& row_type != PLACES_CONNECT_TO_SERVER) {
|
||||||
bookmarks_popup_menu (sidebar, event);
|
bookmarks_popup_menu (sidebar, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3477,7 +3527,9 @@ places_sidebar_sort_func (GtkTreeModel *model,
|
|||||||
|
|
||||||
g_free (name_a);
|
g_free (name_a);
|
||||||
g_free (name_b);
|
g_free (name_b);
|
||||||
}
|
} else if (place_type_a == PLACES_CONNECT_TO_SERVER) {
|
||||||
|
retval = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -3805,6 +3857,9 @@ gtk_places_sidebar_set_property (GObject *obj,
|
|||||||
case PROP_SHOW_DESKTOP:
|
case PROP_SHOW_DESKTOP:
|
||||||
gtk_places_sidebar_set_show_desktop (sidebar, g_value_get_boolean (value));
|
gtk_places_sidebar_set_show_desktop (sidebar, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SHOW_CONNECT_TO_SERVER:
|
||||||
|
gtk_places_sidebar_set_show_connect_to_server (sidebar, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -3829,6 +3884,9 @@ gtk_places_sidebar_get_property (GObject *obj,
|
|||||||
case PROP_SHOW_DESKTOP:
|
case PROP_SHOW_DESKTOP:
|
||||||
g_value_set_boolean (value, gtk_places_sidebar_get_show_desktop (sidebar));
|
g_value_set_boolean (value, gtk_places_sidebar_get_show_desktop (sidebar));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SHOW_CONNECT_TO_SERVER:
|
||||||
|
g_value_set_boolean (value, gtk_places_sidebar_get_show_connect_to_server (sidebar));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -3948,7 +4006,8 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* GtkPlacesSidebar::populate-popup:
|
* GtkPlacesSidebar::populate-popup:
|
||||||
* @sidebar: the object which received the signal.
|
* @sidebar: the object which received the signal.
|
||||||
* @menu: a #GtkMenu.
|
* @menu: a #GtkMenu.
|
||||||
* @selected_item: #GFile with the item to which the menu should refer.
|
* @selected_item: #GFile with the item to which the menu should refer, or #NULL in the case of a @selected_volume.
|
||||||
|
* @selected_volume: #GVolume if the selected item is a volume, or #NULL if it is a file.
|
||||||
*
|
*
|
||||||
* The places sidebar emits this signal when the user invokes a contextual
|
* The places sidebar emits this signal when the user invokes a contextual
|
||||||
* menu on one of its items. In the signal handler, the application may
|
* menu on one of its items. In the signal handler, the application may
|
||||||
@@ -3960,6 +4019,11 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
* gtk_places_sidebar_get_location() to get the file to which the item
|
* gtk_places_sidebar_get_location() to get the file to which the item
|
||||||
* refers.
|
* refers.
|
||||||
*
|
*
|
||||||
|
* The @selected_item argument may be #NULL in case the selection refers to
|
||||||
|
* a volume. In this case, @selected_volume will be non-NULL. In this case,
|
||||||
|
* the calling application will have to g_object_ref() the @selected_volume and
|
||||||
|
* keep it around for the purposes of its menu item's "activate" callback.
|
||||||
|
*
|
||||||
* The @menu and all its menu items are destroyed after the user
|
* The @menu and all its menu items are destroyed after the user
|
||||||
* dismisses the menu. The menu is re-created (and thus, this signal is
|
* dismisses the menu. The menu is re-created (and thus, this signal is
|
||||||
* emitted) every time the user activates the contextual menu.
|
* emitted) every time the user activates the contextual menu.
|
||||||
@@ -3972,8 +4036,9 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
G_SIGNAL_RUN_FIRST,
|
G_SIGNAL_RUN_FIRST,
|
||||||
G_STRUCT_OFFSET (GtkPlacesSidebarClass, populate_popup),
|
G_STRUCT_OFFSET (GtkPlacesSidebarClass, populate_popup),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
_gtk_marshal_VOID__OBJECT_OBJECT_OBJECT,
|
||||||
G_TYPE_NONE, 2,
|
G_TYPE_NONE, 3,
|
||||||
|
G_TYPE_OBJECT,
|
||||||
G_TYPE_OBJECT,
|
G_TYPE_OBJECT,
|
||||||
G_TYPE_OBJECT);
|
G_TYPE_OBJECT);
|
||||||
|
|
||||||
@@ -4001,6 +4066,27 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_STRING);
|
G_TYPE_STRING);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkPlacesSidebar::show-connect-to-server:
|
||||||
|
* @sidebar: the object which received the signal.
|
||||||
|
*
|
||||||
|
* The places sidebar emits this signal when it needs the calling
|
||||||
|
* application to present an way to connect directly to a network server.
|
||||||
|
* For example, the application may bring up a dialog box asking for
|
||||||
|
* a URL like "sftp://ftp.example.com". It is up to the application to create
|
||||||
|
* the corresponding mount by using, for example, g_file_mount_enclosing_volume().
|
||||||
|
*
|
||||||
|
* Since: 3.8
|
||||||
|
*/
|
||||||
|
places_sidebar_signals [SHOW_CONNECT_TO_SERVER] =
|
||||||
|
g_signal_new (I_("show-connect-to-server"),
|
||||||
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||||
|
G_SIGNAL_RUN_FIRST,
|
||||||
|
G_STRUCT_OFFSET (GtkPlacesSidebarClass, show_connect_to_server),
|
||||||
|
NULL, NULL,
|
||||||
|
_gtk_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkPlacesSidebar::drag-action-requested:
|
* GtkPlacesSidebar::drag-action-requested:
|
||||||
* @sidebar: the object which received the signal.
|
* @sidebar: the object which received the signal.
|
||||||
@@ -4088,21 +4174,27 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
|
|||||||
|
|
||||||
properties[PROP_LOCATION] =
|
properties[PROP_LOCATION] =
|
||||||
g_param_spec_object ("location",
|
g_param_spec_object ("location",
|
||||||
P_("Location to select"),
|
P_("Location to Select"),
|
||||||
P_("The location to highlight in the sidebar"),
|
P_("The location to highlight in the sidebar"),
|
||||||
G_TYPE_FILE,
|
G_TYPE_FILE,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
properties[PROP_OPEN_FLAGS] =
|
properties[PROP_OPEN_FLAGS] =
|
||||||
g_param_spec_flags ("open-flags",
|
g_param_spec_flags ("open-flags",
|
||||||
P_("The open modes supported for this widget"),
|
P_("Open Flags"),
|
||||||
P_("The set of open modes supported for this widget"),
|
P_("Modes in which the calling application can open locations selected in the sidebar"),
|
||||||
GTK_TYPE_PLACES_OPEN_FLAGS,
|
GTK_TYPE_PLACES_OPEN_FLAGS,
|
||||||
GTK_PLACES_OPEN_NORMAL,
|
GTK_PLACES_OPEN_NORMAL,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
properties[PROP_SHOW_DESKTOP] =
|
properties[PROP_SHOW_DESKTOP] =
|
||||||
g_param_spec_boolean ("show-desktop",
|
g_param_spec_boolean ("show-desktop",
|
||||||
P_("Whether to show desktop"),
|
P_("Show 'Desktop'"),
|
||||||
P_("Whether the sidebar includes a builtin shortcut to the desktop folder"),
|
P_("Whether the sidebar includes a builtin shortcut to the Desktop folder"),
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE);
|
||||||
|
properties[PROP_SHOW_CONNECT_TO_SERVER] =
|
||||||
|
g_param_spec_boolean ("show-connect-to-server",
|
||||||
|
P_("Show 'Connect to Server'"),
|
||||||
|
P_("Whether the sidebar includes a builtin shortcut to a 'Connect to server' dialog"),
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
@@ -4384,6 +4476,48 @@ gtk_places_sidebar_get_show_desktop (GtkPlacesSidebar *sidebar)
|
|||||||
return sidebar->show_desktop;
|
return sidebar->show_desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_places_sidebar_set_show_connect_to_server:
|
||||||
|
* @sidebar: a places sidebar
|
||||||
|
* @show_connect_to_server: whether to show an item for the Connect to Server command
|
||||||
|
*
|
||||||
|
* Sets whether the @sidebar should show an item for connecting to a network server; this is off by default.
|
||||||
|
* An application may want to turn this on if it implements a way for the user to connect
|
||||||
|
* to network servers directly.
|
||||||
|
*
|
||||||
|
* Since: 3.8
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_places_sidebar_set_show_connect_to_server (GtkPlacesSidebar *sidebar, gboolean show_connect_to_server)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar));
|
||||||
|
|
||||||
|
show_connect_to_server = !!show_connect_to_server;
|
||||||
|
if (sidebar->show_connect_to_server != show_connect_to_server) {
|
||||||
|
sidebar->show_connect_to_server = show_connect_to_server;
|
||||||
|
update_places (sidebar);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (sidebar), properties[PROP_SHOW_CONNECT_TO_SERVER]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_places_sidebar_get_show_connect_to_server:
|
||||||
|
* @sidebar: a places sidebar
|
||||||
|
*
|
||||||
|
* Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the sidebar will display a "Connect to Server" item.
|
||||||
|
*
|
||||||
|
* Since: 3.8
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_places_sidebar_get_show_connect_to_server (GtkPlacesSidebar *sidebar)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar), FALSE);
|
||||||
|
|
||||||
|
return sidebar->show_connect_to_server;
|
||||||
|
}
|
||||||
|
|
||||||
static GSList *
|
static GSList *
|
||||||
find_shortcut_link (GtkPlacesSidebar *sidebar, GFile *location)
|
find_shortcut_link (GtkPlacesSidebar *sidebar, GFile *location)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ void gtk_places_sidebar_set_location (GtkPlacesSidebar *sidebar, GFile *location
|
|||||||
gboolean gtk_places_sidebar_get_show_desktop (GtkPlacesSidebar *sidebar);
|
gboolean gtk_places_sidebar_get_show_desktop (GtkPlacesSidebar *sidebar);
|
||||||
void gtk_places_sidebar_set_show_desktop (GtkPlacesSidebar *sidebar, gboolean show_desktop);
|
void gtk_places_sidebar_set_show_desktop (GtkPlacesSidebar *sidebar, gboolean show_desktop);
|
||||||
|
|
||||||
|
gboolean gtk_places_sidebar_get_show_connect_to_server (GtkPlacesSidebar *sidebar);
|
||||||
|
void gtk_places_sidebar_set_show_connect_to_server (GtkPlacesSidebar *sidebar, gboolean show_connect_to_server);
|
||||||
|
|
||||||
void gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
void gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
||||||
void gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
void gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
||||||
GSList *gtk_places_sidebar_list_shortcuts (GtkPlacesSidebar *sidebar);
|
GSList *gtk_places_sidebar_list_shortcuts (GtkPlacesSidebar *sidebar);
|
||||||
|
|||||||
@@ -903,6 +903,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
gint indicator_size, indicator_spacing;
|
gint indicator_size, indicator_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
gint focus_pad;
|
||||||
|
gint baseline;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
gboolean interior_focus;
|
gboolean interior_focus;
|
||||||
|
|
||||||
@@ -923,9 +924,14 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
|
|||||||
_gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
|
_gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
|
||||||
x = indicator_spacing + border_width;
|
x = indicator_spacing + border_width;
|
||||||
y = (allocation.height - indicator_size) / 2;
|
if (baseline == -1)
|
||||||
|
y = (allocation.height - indicator_size) / 2;
|
||||||
|
else
|
||||||
|
y = CLAMP (baseline - indicator_size * button->priv->baseline_align,
|
||||||
|
0, allocation.height - indicator_size);
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (check_button));
|
child = gtk_bin_get_child (GTK_BIN (check_button));
|
||||||
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
|
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
|
||||||
|
|||||||
@@ -0,0 +1,896 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Author: Alexander Larsson <alexl@redhat.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "gtkrevealer.h"
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
#include "gtktypebuiltins.h"
|
||||||
|
#include "gtkprivate.h"
|
||||||
|
#include "gtkintl.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gtkrevealer
|
||||||
|
* @Short_description: Hide and show with animation
|
||||||
|
* @Title: GtkRevealer
|
||||||
|
* @See_also: #GtkExpander
|
||||||
|
*
|
||||||
|
* The GtkRevealer widget is a container which animates
|
||||||
|
* the transition of its child from invisible to visible.
|
||||||
|
*
|
||||||
|
* The style of transition can be controlled with
|
||||||
|
* gtk_revealer_set_transition_type().
|
||||||
|
*
|
||||||
|
* The GtkRevealer widget was added in GTK+ 3.10.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkRevealerTransitionType:
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_NONE: No transition
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_CROSSFADE: Fade in
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT: Slide in from the left
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT: Slide in from the right
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP: Slide in from the bottom
|
||||||
|
* @GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN: Slide in from the top
|
||||||
|
*
|
||||||
|
* These enumeration values describe the possible transitions
|
||||||
|
* when the child of a #GtkRevealer widget is shown or hidden.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_0,
|
||||||
|
PROP_TRANSITION_TYPE,
|
||||||
|
PROP_TRANSITION_DURATION,
|
||||||
|
PROP_REVEAL_CHILD,
|
||||||
|
PROP_CHILD_REVEALED
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkRevealerPrivate {
|
||||||
|
GtkRevealerTransitionType transition_type;
|
||||||
|
guint transition_duration;
|
||||||
|
|
||||||
|
GdkWindow* bin_window;
|
||||||
|
GdkWindow* view_window;
|
||||||
|
|
||||||
|
gdouble current_pos;
|
||||||
|
gdouble source_pos;
|
||||||
|
gdouble target_pos;
|
||||||
|
|
||||||
|
guint tick_id;
|
||||||
|
gint64 start_time;
|
||||||
|
gint64 end_time;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void gtk_revealer_real_realize (GtkWidget *widget);
|
||||||
|
static void gtk_revealer_real_unrealize (GtkWidget *widget);
|
||||||
|
static void gtk_revealer_real_add (GtkContainer *widget,
|
||||||
|
GtkWidget *child);
|
||||||
|
static void gtk_revealer_real_style_updated (GtkWidget *widget);
|
||||||
|
static void gtk_revealer_real_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation);
|
||||||
|
static void gtk_revealer_real_map (GtkWidget *widget);
|
||||||
|
static void gtk_revealer_real_unmap (GtkWidget *widget);
|
||||||
|
static gboolean gtk_revealer_real_draw (GtkWidget *widget,
|
||||||
|
cairo_t *cr);
|
||||||
|
static void gtk_revealer_real_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height);
|
||||||
|
static void gtk_revealer_real_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height);
|
||||||
|
static void gtk_revealer_real_get_preferred_width (GtkWidget *widget,
|
||||||
|
gint *minimum_width,
|
||||||
|
gint *natural_width);
|
||||||
|
static void gtk_revealer_real_get_preferred_width_for_height (GtkWidget *widget,
|
||||||
|
gint height,
|
||||||
|
gint *minimum_width,
|
||||||
|
gint *natural_width);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GtkRevealer, gtk_revealer, GTK_TYPE_BIN);
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_init (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv;
|
||||||
|
|
||||||
|
priv = G_TYPE_INSTANCE_GET_PRIVATE (revealer, GTK_TYPE_REVEALER, GtkRevealerPrivate);
|
||||||
|
revealer->priv = priv;
|
||||||
|
|
||||||
|
priv->transition_type = GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN;
|
||||||
|
priv->transition_duration = 250;
|
||||||
|
priv->current_pos = 0.0;
|
||||||
|
priv->target_pos = 0.0;
|
||||||
|
|
||||||
|
gtk_widget_set_has_window ((GtkWidget*) revealer, TRUE);
|
||||||
|
gtk_widget_set_redraw_on_allocate ((GtkWidget*) revealer, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_finalize (GObject *obj)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (obj);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
if (priv->tick_id != 0)
|
||||||
|
gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id);
|
||||||
|
priv->tick_id = 0;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gtk_revealer_parent_class)->finalize (obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_get_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_TRANSITION_TYPE:
|
||||||
|
g_value_set_enum (value, gtk_revealer_get_transition_type (revealer));
|
||||||
|
break;
|
||||||
|
case PROP_TRANSITION_DURATION:
|
||||||
|
g_value_set_uint (value, gtk_revealer_get_transition_duration (revealer));
|
||||||
|
break;
|
||||||
|
case PROP_REVEAL_CHILD:
|
||||||
|
g_value_set_boolean (value, gtk_revealer_get_reveal_child (revealer));
|
||||||
|
break;
|
||||||
|
case PROP_CHILD_REVEALED:
|
||||||
|
g_value_set_boolean (value, gtk_revealer_get_child_revealed (revealer));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_TRANSITION_TYPE:
|
||||||
|
gtk_revealer_set_transition_type (revealer, g_value_get_enum (value));
|
||||||
|
break;
|
||||||
|
case PROP_TRANSITION_DURATION:
|
||||||
|
gtk_revealer_set_transition_duration (revealer, g_value_get_uint (value));
|
||||||
|
break;
|
||||||
|
case PROP_REVEAL_CHILD:
|
||||||
|
gtk_revealer_set_reveal_child (revealer, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_class_init (GtkRevealerClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
|
||||||
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->get_property = gtk_revealer_get_property;
|
||||||
|
object_class->set_property = gtk_revealer_set_property;
|
||||||
|
object_class->finalize = gtk_revealer_finalize;
|
||||||
|
|
||||||
|
widget_class->realize = gtk_revealer_real_realize;
|
||||||
|
widget_class->unrealize = gtk_revealer_real_unrealize;
|
||||||
|
widget_class->style_updated = gtk_revealer_real_style_updated;
|
||||||
|
widget_class->size_allocate = gtk_revealer_real_size_allocate;
|
||||||
|
widget_class->map = gtk_revealer_real_map;
|
||||||
|
widget_class->unmap = gtk_revealer_real_unmap;
|
||||||
|
widget_class->draw = gtk_revealer_real_draw;
|
||||||
|
widget_class->get_preferred_height = gtk_revealer_real_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_for_width = gtk_revealer_real_get_preferred_height_for_width;
|
||||||
|
widget_class->get_preferred_width = gtk_revealer_real_get_preferred_width;
|
||||||
|
widget_class->get_preferred_width_for_height = gtk_revealer_real_get_preferred_width_for_height;
|
||||||
|
|
||||||
|
container_class->add = gtk_revealer_real_add;
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_TRANSITION_TYPE,
|
||||||
|
g_param_spec_enum ("transition-type",
|
||||||
|
P_("Transition type"),
|
||||||
|
P_("The type of animation used to transition"),
|
||||||
|
GTK_TYPE_REVEALER_TRANSITION_TYPE,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN,
|
||||||
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_TRANSITION_DURATION,
|
||||||
|
g_param_spec_uint ("transition-duration",
|
||||||
|
P_("Transition duration"),
|
||||||
|
P_("The animation duration, in milliseconds"),
|
||||||
|
0, G_MAXUINT,
|
||||||
|
250,
|
||||||
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_REVEAL_CHILD,
|
||||||
|
g_param_spec_boolean ("reveal-child",
|
||||||
|
P_("Reveal Child"),
|
||||||
|
P_("Whether the container should reveal the child"),
|
||||||
|
FALSE,
|
||||||
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_CHILD_REVEALED,
|
||||||
|
g_param_spec_boolean ("child-revealed",
|
||||||
|
P_("Child Revealed"),
|
||||||
|
P_("Whether the child is revealed and the animation target reached"),
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GtkRevealerPrivate));
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gtk_revealer_new (void)
|
||||||
|
{
|
||||||
|
return g_object_new (GTK_TYPE_REVEALER, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkRevealerTransitionType
|
||||||
|
effective_transition (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
if (gtk_widget_get_direction (GTK_WIDGET (revealer)) == GTK_TEXT_DIR_RTL)
|
||||||
|
{
|
||||||
|
if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT)
|
||||||
|
return GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT;
|
||||||
|
else if (priv->transition_type == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
return GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return priv->transition_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_get_child_allocation (GtkRevealer *revealer,
|
||||||
|
GtkAllocation *allocation,
|
||||||
|
GtkAllocation *child_allocation)
|
||||||
|
{
|
||||||
|
GtkWidget *child;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
g_return_if_fail (revealer != NULL);
|
||||||
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
|
child_allocation->x = 0;
|
||||||
|
child_allocation->y = 0;
|
||||||
|
child_allocation->width = allocation->width;
|
||||||
|
child_allocation->height = allocation->height;
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (revealer));
|
||||||
|
if (child != NULL && gtk_widget_get_visible (child))
|
||||||
|
{
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
|
||||||
|
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
gtk_widget_get_preferred_width_for_height (child, child_allocation->height, NULL,
|
||||||
|
&child_allocation->width);
|
||||||
|
else
|
||||||
|
gtk_widget_get_preferred_height_for_width (child, child_allocation->width, NULL,
|
||||||
|
&child_allocation->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_realize (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GdkWindowAttr attributes = { 0 };
|
||||||
|
GdkWindowAttributesType attributes_mask;
|
||||||
|
GtkAllocation child_allocation;
|
||||||
|
GtkWidget *child;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
attributes.x = allocation.x;
|
||||||
|
attributes.y = allocation.y;
|
||||||
|
attributes.width = allocation.width;
|
||||||
|
attributes.height = allocation.height;
|
||||||
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
|
attributes.event_mask =
|
||||||
|
gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
||||||
|
attributes_mask = (GDK_WA_X | GDK_WA_Y) | GDK_WA_VISUAL;
|
||||||
|
|
||||||
|
priv->view_window =
|
||||||
|
gdk_window_new (gtk_widget_get_parent_window ((GtkWidget*) revealer),
|
||||||
|
&attributes, attributes_mask);
|
||||||
|
gtk_widget_set_window (widget, priv->view_window);
|
||||||
|
gtk_widget_register_window (widget, priv->view_window);
|
||||||
|
|
||||||
|
gtk_revealer_get_child_allocation (revealer, &allocation, &child_allocation);
|
||||||
|
|
||||||
|
attributes.x = 0;
|
||||||
|
attributes.y = 0;
|
||||||
|
attributes.width = child_allocation.width;
|
||||||
|
attributes.height = child_allocation.height;
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
||||||
|
attributes.y = allocation.height - child_allocation.height;
|
||||||
|
else if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
attributes.x = allocation.width - child_allocation.width;
|
||||||
|
|
||||||
|
priv->bin_window =
|
||||||
|
gdk_window_new (priv->view_window, &attributes, attributes_mask);
|
||||||
|
gtk_widget_register_window (widget, priv->bin_window);
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (revealer));
|
||||||
|
if (child != NULL)
|
||||||
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_set_background (context, priv->view_window);
|
||||||
|
gtk_style_context_set_background (context, priv->bin_window);
|
||||||
|
gdk_window_show (priv->bin_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_unrealize (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
gtk_widget_unregister_window (widget, priv->bin_window);
|
||||||
|
gdk_window_destroy (priv->bin_window);
|
||||||
|
priv->view_window = NULL;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->unrealize (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_add (GtkContainer *container,
|
||||||
|
GtkWidget *child)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (container);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
g_return_if_fail (child != NULL);
|
||||||
|
|
||||||
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
||||||
|
gtk_widget_set_child_visible (child, priv->current_pos != 0.0);
|
||||||
|
|
||||||
|
GTK_CONTAINER_CLASS (gtk_revealer_parent_class)->add (container, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_style_updated (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
GtkStyleContext* context;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->style_updated (widget);
|
||||||
|
|
||||||
|
if (gtk_widget_get_realized (widget))
|
||||||
|
{
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_set_background (context, priv->bin_window);
|
||||||
|
gtk_style_context_set_background (context, priv->view_window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
GtkAllocation child_allocation;
|
||||||
|
GtkWidget *child;
|
||||||
|
gboolean window_visible;
|
||||||
|
int bin_x, bin_y;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
|
gtk_widget_set_allocation (widget, allocation);
|
||||||
|
gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (revealer));
|
||||||
|
if (child != NULL && gtk_widget_get_visible (child))
|
||||||
|
gtk_widget_size_allocate (child, &child_allocation);
|
||||||
|
|
||||||
|
if (gtk_widget_get_realized (widget))
|
||||||
|
{
|
||||||
|
if (gtk_widget_get_mapped (widget))
|
||||||
|
{
|
||||||
|
window_visible = allocation->width > 0 && allocation->height > 0;
|
||||||
|
|
||||||
|
if (!window_visible && gdk_window_is_visible (priv->view_window))
|
||||||
|
gdk_window_hide (priv->view_window);
|
||||||
|
|
||||||
|
if (window_visible && !gdk_window_is_visible (priv->view_window))
|
||||||
|
gdk_window_show (priv->view_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
gdk_window_move_resize (priv->view_window,
|
||||||
|
allocation->x, allocation->y,
|
||||||
|
allocation->width, allocation->height);
|
||||||
|
|
||||||
|
bin_x = 0;
|
||||||
|
bin_y = 0;
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
||||||
|
bin_y = allocation->height - child_allocation.height;
|
||||||
|
else if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
bin_x = allocation->width - child_allocation.width;
|
||||||
|
|
||||||
|
gdk_window_move_resize (priv->bin_window,
|
||||||
|
bin_x, bin_y,
|
||||||
|
child_allocation.width, child_allocation.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_set_position (GtkRevealer *revealer,
|
||||||
|
gdouble pos)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gboolean new_visible;
|
||||||
|
GtkWidget *child;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
priv->current_pos = pos;
|
||||||
|
|
||||||
|
/* We check target_pos here too, because we want to ensure we set
|
||||||
|
* child_visible immediately when starting a reveal operation
|
||||||
|
* otherwise the child widgets will not be properly realized
|
||||||
|
* after the reveal returns.
|
||||||
|
*/
|
||||||
|
new_visible = priv->current_pos != 0.0 || priv->target_pos != 0.0;
|
||||||
|
|
||||||
|
child = gtk_bin_get_child (GTK_BIN (revealer));
|
||||||
|
if (child != NULL &&
|
||||||
|
new_visible != gtk_widget_get_child_visible (child))
|
||||||
|
gtk_widget_set_child_visible (child, new_visible);
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
|
||||||
|
{
|
||||||
|
gtk_widget_set_opacity (GTK_WIDGET (revealer), priv->current_pos);
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (revealer));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (revealer));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->current_pos == priv->target_pos)
|
||||||
|
g_object_notify (G_OBJECT (revealer), "child-revealed");
|
||||||
|
}
|
||||||
|
|
||||||
|
static gdouble
|
||||||
|
ease_out_quad (gdouble t, gdouble d)
|
||||||
|
{
|
||||||
|
gdouble p = t / d;
|
||||||
|
return ((-1.0) * p) * (p - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_animate_step (GtkRevealer *revealer,
|
||||||
|
gint64 now)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gdouble t;
|
||||||
|
|
||||||
|
t = 1.0;
|
||||||
|
if (now < priv->end_time)
|
||||||
|
t = (now - priv->start_time) / (gdouble) (priv->end_time - priv->start_time);
|
||||||
|
t = ease_out_quad (t, 1.0);
|
||||||
|
|
||||||
|
gtk_revealer_set_position (revealer,
|
||||||
|
priv->source_pos + (t * (priv->target_pos - priv->source_pos)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_revealer_animate_cb (GtkRevealer *revealer,
|
||||||
|
GdkFrameClock *frame_clock,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gint64 now;
|
||||||
|
|
||||||
|
now = gdk_frame_clock_get_frame_time (frame_clock);
|
||||||
|
gtk_revealer_animate_step (revealer, now);
|
||||||
|
if (priv->current_pos == priv->target_pos)
|
||||||
|
{
|
||||||
|
priv->tick_id = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_start_animation (GtkRevealer *revealer,
|
||||||
|
gdouble target)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
GtkWidget *widget = GTK_WIDGET (revealer);
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
if (priv->target_pos == target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv->target_pos = target;
|
||||||
|
g_object_notify (G_OBJECT (revealer), "reveal-child");
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (gtk_widget_get_mapped (widget) &&
|
||||||
|
priv->transition_duration != 0 &&
|
||||||
|
transition != GTK_REVEALER_TRANSITION_TYPE_NONE)
|
||||||
|
{
|
||||||
|
priv->source_pos = priv->current_pos;
|
||||||
|
priv->start_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||||
|
priv->end_time = priv->start_time + (priv->transition_duration * 1000);
|
||||||
|
if (priv->tick_id == 0)
|
||||||
|
priv->tick_id =
|
||||||
|
gtk_widget_add_tick_callback (widget, (GtkTickCallback)gtk_revealer_animate_cb, revealer, NULL);
|
||||||
|
gtk_revealer_animate_step (revealer, priv->start_time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_revealer_set_position (revealer, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_stop_animation (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
priv->current_pos = priv->target_pos;
|
||||||
|
if (priv->tick_id != 0)
|
||||||
|
{
|
||||||
|
gtk_widget_remove_tick_callback (GTK_WIDGET (revealer), priv->tick_id);
|
||||||
|
priv->tick_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_map (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
|
||||||
|
if (!gtk_widget_get_mapped (widget))
|
||||||
|
{
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
if (allocation.width > 0 && allocation.height > 0)
|
||||||
|
gdk_window_show (priv->view_window);
|
||||||
|
|
||||||
|
gtk_revealer_start_animation (revealer, priv->target_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->map (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_unmap (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->unmap (widget);
|
||||||
|
|
||||||
|
gtk_revealer_stop_animation (revealer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_revealer_real_draw (GtkWidget *widget,
|
||||||
|
cairo_t *cr)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
|
||||||
|
if (gtk_cairo_should_draw_window (cr, priv->bin_window))
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->draw (widget, cr);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_set_reveal_child:
|
||||||
|
* @revealer: a #GtkRevealer
|
||||||
|
* @reveal_child: %TRUE to reveal the child
|
||||||
|
*
|
||||||
|
* Tells the #GtkRevealer to reveal or conceal its child.
|
||||||
|
*
|
||||||
|
* The transition will be animated with the current
|
||||||
|
* transition type of @revealer.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_revealer_set_reveal_child (GtkRevealer *revealer,
|
||||||
|
gboolean reveal_child)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_REVEALER (revealer));
|
||||||
|
|
||||||
|
if (reveal_child)
|
||||||
|
gtk_revealer_start_animation (revealer, 1.0);
|
||||||
|
else
|
||||||
|
gtk_revealer_start_animation (revealer, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_get_reveal_child:
|
||||||
|
* @revealer:
|
||||||
|
*
|
||||||
|
* Returns whether the child is currently
|
||||||
|
* revealed. See gtk_revealer_set_reveal_child().
|
||||||
|
*
|
||||||
|
* This function returns %TRUE as soon as the transition
|
||||||
|
* is to the revealed state is started. To learn whether
|
||||||
|
* the child is fully revealed (ie the transition is completed),
|
||||||
|
* use gtk_revealer_get_child_revealed().
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the child is revealed.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_revealer_get_reveal_child (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_REVEALER (revealer), FALSE);
|
||||||
|
|
||||||
|
return revealer->priv->target_pos != 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_get_child_revealed:
|
||||||
|
* @revealer: a #GtkRevealer
|
||||||
|
*
|
||||||
|
* Returns whether the child is fully revealed, ie wether
|
||||||
|
* the transition to the revealed state is completed.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the child is fully revealed
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_revealer_get_child_revealed (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
gboolean animation_finished = (revealer->priv->target_pos == revealer->priv->current_pos);
|
||||||
|
gboolean reveal_child = gtk_revealer_get_reveal_child (revealer);
|
||||||
|
|
||||||
|
if (animation_finished)
|
||||||
|
return reveal_child;
|
||||||
|
else
|
||||||
|
return !reveal_child;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These all report only the natural size, ignoring the minimal size,
|
||||||
|
* because its not really possible to allocate the right size during
|
||||||
|
* animation if the child size can change (without the child
|
||||||
|
* re-arranging itself during the animation).
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum_height_out,
|
||||||
|
gint *natural_height_out)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gint minimum_height;
|
||||||
|
gint natural_height;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_height (widget, &minimum_height, &natural_height);
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
|
||||||
|
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
||||||
|
natural_height = round (natural_height * priv->current_pos);
|
||||||
|
|
||||||
|
minimum_height = natural_height;
|
||||||
|
|
||||||
|
if (minimum_height_out)
|
||||||
|
*minimum_height_out = minimum_height;
|
||||||
|
if (natural_height_out)
|
||||||
|
*natural_height_out = natural_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_get_preferred_height_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height_out,
|
||||||
|
gint *natural_height_out)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gint minimum_height;
|
||||||
|
gint natural_height;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_height_for_width (widget, width, &minimum_height, &natural_height);
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
|
||||||
|
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
|
||||||
|
natural_height = round (natural_height * priv->current_pos);
|
||||||
|
|
||||||
|
minimum_height = natural_height;
|
||||||
|
|
||||||
|
if (minimum_height_out)
|
||||||
|
*minimum_height_out = minimum_height;
|
||||||
|
if (natural_height_out)
|
||||||
|
*natural_height_out = natural_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_get_preferred_width (GtkWidget *widget,
|
||||||
|
gint *minimum_width_out,
|
||||||
|
gint *natural_width_out)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gint minimum_width;
|
||||||
|
gint natural_width;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_width (widget, &minimum_width, &natural_width);
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
|
||||||
|
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
natural_width = round (natural_width * priv->current_pos);
|
||||||
|
|
||||||
|
minimum_width = natural_width;
|
||||||
|
|
||||||
|
if (minimum_width_out)
|
||||||
|
*minimum_width_out = minimum_width;
|
||||||
|
if (natural_width_out)
|
||||||
|
*natural_width_out = natural_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_revealer_real_get_preferred_width_for_height (GtkWidget *widget,
|
||||||
|
gint height,
|
||||||
|
gint *minimum_width_out,
|
||||||
|
gint *natural_width_out)
|
||||||
|
{
|
||||||
|
GtkRevealer *revealer = GTK_REVEALER (widget);
|
||||||
|
GtkRevealerPrivate *priv = revealer->priv;
|
||||||
|
gint minimum_width;
|
||||||
|
gint natural_width;
|
||||||
|
GtkRevealerTransitionType transition;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_revealer_parent_class)->get_preferred_width_for_height (widget, height, &minimum_width, &natural_width);
|
||||||
|
|
||||||
|
transition = effective_transition (revealer);
|
||||||
|
if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
|
||||||
|
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
|
||||||
|
natural_width = round (natural_width * priv->current_pos);
|
||||||
|
|
||||||
|
minimum_width = natural_width;
|
||||||
|
|
||||||
|
if (minimum_width_out)
|
||||||
|
*minimum_width_out = minimum_width;
|
||||||
|
if (natural_width_out)
|
||||||
|
*natural_width_out = natural_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_get_transition_duration:
|
||||||
|
* @revealer: a #GtkRevealer
|
||||||
|
*
|
||||||
|
* Returns the amount of time (in milliseconds) that
|
||||||
|
* transitions will take.
|
||||||
|
*
|
||||||
|
* Returns: the transition duration
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
gtk_revealer_get_transition_duration (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_REVEALER (revealer), 0);
|
||||||
|
|
||||||
|
return revealer->priv->transition_duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_set_transition_duration:
|
||||||
|
* @revealer: a #GtkRevealer
|
||||||
|
* @duration: the new duration, in milliseconds
|
||||||
|
*
|
||||||
|
* Sets the duration that transitions will take.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_revealer_set_transition_duration (GtkRevealer *revealer,
|
||||||
|
guint value)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_REVEALER (revealer));
|
||||||
|
|
||||||
|
revealer->priv->transition_duration = value;
|
||||||
|
g_object_notify (G_OBJECT (revealer), "transition-duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_revealer_get_transition_type:
|
||||||
|
* @revealer: a #GtkRevealer
|
||||||
|
*
|
||||||
|
* Gets the type of animation that will be used
|
||||||
|
* for transitions in @revealer.
|
||||||
|
*
|
||||||
|
* Return value: the current transition type of @revealer
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
GtkRevealerTransitionType
|
||||||
|
gtk_revealer_get_transition_type (GtkRevealer *revealer)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE);
|
||||||
|
|
||||||
|
return revealer->priv->transition_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_stack_set_transition_type:
|
||||||
|
* @stack: a #GtkStack
|
||||||
|
* @transition: the new transition type
|
||||||
|
*
|
||||||
|
* Sets the type of animation that will be used for
|
||||||
|
* transitions in @revealer. Available types include
|
||||||
|
* various kinds of fades and slides.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_revealer_set_transition_type (GtkRevealer *revealer,
|
||||||
|
GtkRevealerTransitionType transition)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_REVEALER (revealer));
|
||||||
|
|
||||||
|
revealer->priv->transition_type = transition;
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (revealer));
|
||||||
|
g_object_notify (G_OBJECT (revealer), "transition-type");
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Author: Alexander Larsson <alexl@redhat.com>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GTK_REVEALER_H__
|
||||||
|
#define __GTK_REVEALER_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkbin.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#define GTK_TYPE_REVEALER (gtk_revealer_get_type ())
|
||||||
|
#define GTK_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_REVEALER, GtkRevealer))
|
||||||
|
#define GTK_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_REVEALER, GtkRevealerClass))
|
||||||
|
#define GTK_IS_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_REVEALER))
|
||||||
|
#define GTK_IS_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_REVEALER))
|
||||||
|
#define GTK_REVEALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_REVEALER, GtkRevealerClass))
|
||||||
|
|
||||||
|
typedef struct _GtkRevealer GtkRevealer;
|
||||||
|
typedef struct _GtkRevealerClass GtkRevealerClass;
|
||||||
|
typedef struct _GtkRevealerPrivate GtkRevealerPrivate;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_NONE,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_CROSSFADE,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP,
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN
|
||||||
|
} GtkRevealerTransitionType;
|
||||||
|
|
||||||
|
struct _GtkRevealer {
|
||||||
|
GtkBin parent_instance;
|
||||||
|
GtkRevealerPrivate * priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkRevealerClass {
|
||||||
|
GtkBinClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gtk_revealer_get_type (void) G_GNUC_CONST;
|
||||||
|
GtkWidget* gtk_revealer_new (void);
|
||||||
|
gboolean gtk_revealer_get_reveal_child (GtkRevealer *revealer);
|
||||||
|
void gtk_revealer_set_reveal_child (GtkRevealer *revealer,
|
||||||
|
gboolean reveal_child);
|
||||||
|
gboolean gtk_revealer_get_child_revealed (GtkRevealer *revealer);
|
||||||
|
guint gtk_revealer_get_transition_duration (GtkRevealer *revealer);
|
||||||
|
void gtk_revealer_set_transition_duration (GtkRevealer *revealer,
|
||||||
|
guint duration);
|
||||||
|
void gtk_revealer_set_transition_type (GtkRevealer *revealer,
|
||||||
|
GtkRevealerTransitionType transition);
|
||||||
|
GtkRevealerTransitionType gtk_revealer_get_transition_type (GtkRevealer *revealer);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
+297
-79
@@ -93,16 +93,61 @@ get_vfunc_name (GtkOrientation orientation,
|
|||||||
return for_size < 0 ? "get_preferred_height" : "get_preferred_height_for_width";
|
return for_size < 0 ? "get_preferred_height" : "get_preferred_height_for_width";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
widget_class_has_baseline_support (GtkWidgetClass *widget_class)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *parent_class;
|
||||||
|
|
||||||
|
if (widget_class->get_preferred_height_and_baseline_for_width == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* This is kinda hacky, but for backwards compatibility reasons we have to handle the case
|
||||||
|
where a class previously did not support get_preferred_height_and_baseline_for_width,
|
||||||
|
but then gained support for it, and a subclass of it overrides the previous non-baseline
|
||||||
|
methods. If this happens we need to call the overridden (non-baseline supporting) versions
|
||||||
|
on the subclass, rather than the inherited but not overriddent new get_preferred_height_and_baseline_for_width.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Loop over all parent classes that inherit the same get_preferred_height_and_baseline_for_width */
|
||||||
|
parent_class = g_type_class_peek_parent (widget_class);
|
||||||
|
while (parent_class != NULL &&
|
||||||
|
parent_class->get_preferred_height_and_baseline_for_width == widget_class->get_preferred_height_and_baseline_for_width)
|
||||||
|
{
|
||||||
|
if (parent_class->get_preferred_height != widget_class->get_preferred_height ||
|
||||||
|
parent_class->get_preferred_height_for_width != widget_class->get_preferred_height_for_width)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
parent_class = g_type_class_peek_parent (parent_class);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
_gtk_widget_has_baseline_support (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
|
widget_class = GTK_WIDGET_GET_CLASS (widget);
|
||||||
|
|
||||||
|
return widget_class_has_baseline_support (widget_class);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size)
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
SizeRequestCache *cache;
|
SizeRequestCache *cache;
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
gint min_size = 0;
|
gint min_size = 0;
|
||||||
gint nat_size = 0;
|
gint nat_size = 0;
|
||||||
|
gint min_baseline = -1;
|
||||||
|
gint nat_baseline = -1;
|
||||||
gboolean found_in_cache;
|
gboolean found_in_cache;
|
||||||
|
|
||||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
|
||||||
@@ -113,7 +158,11 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
orientation,
|
orientation,
|
||||||
for_size,
|
for_size,
|
||||||
&min_size,
|
&min_size,
|
||||||
&nat_size);
|
&nat_size,
|
||||||
|
&min_baseline,
|
||||||
|
&nat_baseline);
|
||||||
|
|
||||||
|
widget_class = GTK_WIDGET_GET_CLASS (widget);
|
||||||
|
|
||||||
if (!found_in_cache)
|
if (!found_in_cache)
|
||||||
{
|
{
|
||||||
@@ -128,7 +177,7 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
if (for_size < 0)
|
if (for_size < 0)
|
||||||
{
|
{
|
||||||
push_recursion_check (widget, orientation, for_size);
|
push_recursion_check (widget, orientation, for_size);
|
||||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_size, &nat_size);
|
widget_class->get_preferred_width (widget, &min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
pop_recursion_check (widget, orientation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -142,17 +191,17 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
gtk_widget_get_preferred_height (widget, &minimum_height, &natural_height);
|
gtk_widget_get_preferred_height (widget, &minimum_height, &natural_height);
|
||||||
|
|
||||||
/* convert for_size to unadjusted height (for_size is a proposed allocation) */
|
/* convert for_size to unadjusted height (for_size is a proposed allocation) */
|
||||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
|
widget_class->adjust_size_allocation (widget,
|
||||||
GTK_ORIENTATION_VERTICAL,
|
GTK_ORIENTATION_VERTICAL,
|
||||||
&minimum_height,
|
&minimum_height,
|
||||||
&natural_height,
|
&natural_height,
|
||||||
&ignored_position,
|
&ignored_position,
|
||||||
&adjusted_for_size);
|
&adjusted_for_size);
|
||||||
|
|
||||||
push_recursion_check (widget, orientation, for_size);
|
push_recursion_check (widget, orientation, for_size);
|
||||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_width_for_height (widget,
|
widget_class->get_preferred_width_for_height (widget,
|
||||||
MAX (adjusted_for_size, minimum_height),
|
MAX (adjusted_for_size, minimum_height),
|
||||||
&min_size, &nat_size);
|
&min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
pop_recursion_check (widget, orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +210,12 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
if (for_size < 0)
|
if (for_size < 0)
|
||||||
{
|
{
|
||||||
push_recursion_check (widget, orientation, for_size);
|
push_recursion_check (widget, orientation, for_size);
|
||||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_height (widget, &min_size, &nat_size);
|
if (widget_class_has_baseline_support (widget_class))
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width (widget, -1,
|
||||||
|
&min_size, &nat_size,
|
||||||
|
&min_baseline, &nat_baseline);
|
||||||
|
else
|
||||||
|
widget_class->get_preferred_height (widget, &min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
pop_recursion_check (widget, orientation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -175,17 +229,21 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
gtk_widget_get_preferred_width (widget, &minimum_width, &natural_width);
|
gtk_widget_get_preferred_width (widget, &minimum_width, &natural_width);
|
||||||
|
|
||||||
/* convert for_size to unadjusted width (for_size is a proposed allocation) */
|
/* convert for_size to unadjusted width (for_size is a proposed allocation) */
|
||||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
|
widget_class->adjust_size_allocation (widget,
|
||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
&minimum_width,
|
&minimum_width,
|
||||||
&natural_width,
|
&natural_width,
|
||||||
&ignored_position,
|
&ignored_position,
|
||||||
&adjusted_for_size);
|
&adjusted_for_size);
|
||||||
|
|
||||||
push_recursion_check (widget, orientation, for_size);
|
push_recursion_check (widget, orientation, for_size);
|
||||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget,
|
if (widget_class_has_baseline_support (widget_class))
|
||||||
MAX (adjusted_for_size, minimum_width),
|
widget_class->get_preferred_height_and_baseline_for_width (widget, MAX (adjusted_for_size, minimum_width),
|
||||||
&min_size, &nat_size);
|
&min_size, &nat_size,
|
||||||
|
&min_baseline, &nat_baseline);
|
||||||
|
else
|
||||||
|
widget_class->get_preferred_height_for_width (widget, MAX (adjusted_for_size, minimum_width),
|
||||||
|
&min_size, &nat_size);
|
||||||
pop_recursion_check (widget, orientation);
|
pop_recursion_check (widget, orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,10 +256,10 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
|
|
||||||
adjusted_min = min_size;
|
adjusted_min = min_size;
|
||||||
adjusted_natural = nat_size;
|
adjusted_natural = nat_size;
|
||||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_request (widget,
|
widget_class->adjust_size_request (widget,
|
||||||
orientation,
|
orientation,
|
||||||
&adjusted_min,
|
&adjusted_min,
|
||||||
&adjusted_natural);
|
&adjusted_natural);
|
||||||
|
|
||||||
if (adjusted_min < min_size ||
|
if (adjusted_min < min_size ||
|
||||||
adjusted_natural < nat_size)
|
adjusted_natural < nat_size)
|
||||||
@@ -229,11 +287,42 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
nat_size = adjusted_natural;
|
nat_size = adjusted_natural;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (min_baseline != -1 || nat_baseline != -1)
|
||||||
|
{
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
g_warning ("%s %p reported a horizontal baseline",
|
||||||
|
G_OBJECT_TYPE_NAME (widget), widget);
|
||||||
|
min_baseline = -1;
|
||||||
|
nat_baseline = -1;
|
||||||
|
}
|
||||||
|
else if (min_baseline == -1 || nat_baseline == -1)
|
||||||
|
{
|
||||||
|
g_warning ("%s %p reported baseline for only one of min/natural (min: %d, natural: %d)",
|
||||||
|
G_OBJECT_TYPE_NAME (widget), widget,
|
||||||
|
min_baseline, nat_baseline);
|
||||||
|
min_baseline = -1;
|
||||||
|
nat_baseline = -1;
|
||||||
|
}
|
||||||
|
else if (gtk_widget_get_valign_with_baseline (widget) != GTK_ALIGN_BASELINE)
|
||||||
|
{
|
||||||
|
/* Ignore requested baseline for non-aligned widgets */
|
||||||
|
min_baseline = -1;
|
||||||
|
nat_baseline = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
widget_class->adjust_baseline_request (widget,
|
||||||
|
&min_baseline,
|
||||||
|
&nat_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
_gtk_size_request_cache_commit (cache,
|
_gtk_size_request_cache_commit (cache,
|
||||||
orientation,
|
orientation,
|
||||||
for_size,
|
for_size,
|
||||||
min_size,
|
min_size,
|
||||||
nat_size);
|
nat_size,
|
||||||
|
min_baseline,
|
||||||
|
nat_baseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minimum_size)
|
if (minimum_size)
|
||||||
@@ -242,15 +331,26 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
|
|||||||
if (natural_size)
|
if (natural_size)
|
||||||
*natural_size = nat_size;
|
*natural_size = nat_size;
|
||||||
|
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = min_baseline;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = nat_baseline;
|
||||||
|
|
||||||
g_assert (min_size <= nat_size);
|
g_assert (min_size <= nat_size);
|
||||||
|
|
||||||
GTK_NOTE (SIZE_REQUEST,
|
GTK_NOTE (SIZE_REQUEST,
|
||||||
g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d (hit cache: %s)\n",
|
g_print ("[%p] %s\t%s: %d is minimum %d and natural: %d",
|
||||||
widget, G_OBJECT_TYPE_NAME (widget),
|
widget, G_OBJECT_TYPE_NAME (widget),
|
||||||
orientation == GTK_ORIENTATION_HORIZONTAL ?
|
orientation == GTK_ORIENTATION_HORIZONTAL ?
|
||||||
"width for height" : "height for width" ,
|
"width for height" : "height for width" ,
|
||||||
for_size, min_size, nat_size,
|
for_size, min_size, nat_size);
|
||||||
found_in_cache ? "yes" : "no"));
|
if (min_baseline != -1 || nat_baseline != -1)
|
||||||
|
g_print (", baseline %d/%d",
|
||||||
|
min_baseline, nat_baseline);
|
||||||
|
g_print (" (hit cache: %s)\n",
|
||||||
|
found_in_cache ? "yes" : "no")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the main function that checks for a cached size and
|
/* This is the main function that checks for a cached size and
|
||||||
@@ -263,7 +363,9 @@ _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural)
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GHashTable *widgets;
|
GHashTable *widgets;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
@@ -276,12 +378,17 @@ _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
|||||||
*minimum = 0;
|
*minimum = 0;
|
||||||
if (natural)
|
if (natural)
|
||||||
*natural = 0;
|
*natural = 0;
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_LIKELY (!_gtk_widget_get_sizegroups (widget)))
|
if (G_LIKELY (!_gtk_widget_get_sizegroups (widget)))
|
||||||
{
|
{
|
||||||
gtk_widget_query_size_for_orientation (widget, orientation, for_size, minimum, natural);
|
gtk_widget_query_size_for_orientation (widget, orientation, for_size, minimum, natural,
|
||||||
|
minimum_baseline, natural_baseline);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +402,7 @@ _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
|||||||
GtkWidget *tmp_widget = key;
|
GtkWidget *tmp_widget = key;
|
||||||
gint min_dimension, nat_dimension;
|
gint min_dimension, nat_dimension;
|
||||||
|
|
||||||
gtk_widget_query_size_for_orientation (tmp_widget, orientation, for_size, &min_dimension, &nat_dimension);
|
gtk_widget_query_size_for_orientation (tmp_widget, orientation, for_size, &min_dimension, &nat_dimension, NULL, NULL);
|
||||||
|
|
||||||
min_result = MAX (min_result, min_dimension);
|
min_result = MAX (min_result, min_dimension);
|
||||||
nat_result = MAX (nat_result, nat_dimension);
|
nat_result = MAX (nat_result, nat_dimension);
|
||||||
@@ -305,6 +412,13 @@ _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
|||||||
|
|
||||||
g_hash_table_destroy (widgets);
|
g_hash_table_destroy (widgets);
|
||||||
|
|
||||||
|
/* Baselines make no sense with sizegroups really */
|
||||||
|
if (minimum_baseline)
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
|
||||||
|
if (natural_baseline)
|
||||||
|
*natural_baseline = -1;
|
||||||
|
|
||||||
if (minimum)
|
if (minimum)
|
||||||
*minimum = min_result;
|
*minimum = min_result;
|
||||||
|
|
||||||
@@ -377,7 +491,8 @@ gtk_widget_get_preferred_width (GtkWidget *widget,
|
|||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
-1,
|
-1,
|
||||||
minimum_width,
|
minimum_width,
|
||||||
natural_width);
|
natural_width,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -411,7 +526,8 @@ gtk_widget_get_preferred_height (GtkWidget *widget,
|
|||||||
GTK_ORIENTATION_VERTICAL,
|
GTK_ORIENTATION_VERTICAL,
|
||||||
-1,
|
-1,
|
||||||
minimum_height,
|
minimum_height,
|
||||||
natural_height);
|
natural_height,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -448,7 +564,8 @@ gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
GTK_ORIENTATION_HORIZONTAL,
|
GTK_ORIENTATION_HORIZONTAL,
|
||||||
height,
|
height,
|
||||||
minimum_width,
|
minimum_width,
|
||||||
natural_width);
|
natural_width,
|
||||||
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,7 +600,122 @@ gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
GTK_ORIENTATION_VERTICAL,
|
GTK_ORIENTATION_VERTICAL,
|
||||||
width,
|
width,
|
||||||
minimum_height,
|
minimum_height,
|
||||||
natural_height);
|
natural_height,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_widget_get_preferred_height_and_baseline_for_width:
|
||||||
|
* @widget: a #GtkWidget instance
|
||||||
|
* @width: the width which is available for allocation, or -1 if none
|
||||||
|
* @minimum_height: (out) (allow-none): location for storing the minimum height, or %NULL
|
||||||
|
* @natural_height: (out) (allow-none): location for storing the natural height, or %NULL
|
||||||
|
* @minimum_baseline: (out) (allow-none): location for storing the baseline for the minimum height, or %NULL
|
||||||
|
* @natural_baseline: (out) (allow-none): location for storing the baseline for the natural height, or %NULL
|
||||||
|
*
|
||||||
|
* Retrieves a widget's minimum and natural height and the corresponding baselines if it would be given
|
||||||
|
* the specified @width, or the default height if @width is -1. The baselines may be -1 which means
|
||||||
|
* that no baseline is requested for this widget.
|
||||||
|
*
|
||||||
|
* The returned request will be modified by the
|
||||||
|
* GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods
|
||||||
|
* and by any #GtkSizeGroup<!-- -->s that have been applied. That is, the returned request
|
||||||
|
* is the one that should be used for layout, not necessarily the one
|
||||||
|
* returned by the widget itself.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
g_return_if_fail (minimum_height != NULL || natural_height != NULL);
|
||||||
|
g_return_if_fail (width >= -1);
|
||||||
|
|
||||||
|
_gtk_widget_compute_size_for_orientation (widget,
|
||||||
|
GTK_ORIENTATION_VERTICAL,
|
||||||
|
width,
|
||||||
|
minimum_height,
|
||||||
|
natural_height,
|
||||||
|
minimum_baseline,
|
||||||
|
natural_baseline);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_widget_get_preferred_size_and_baseline:
|
||||||
|
* @widget: a #GtkWidget instance
|
||||||
|
* @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
|
||||||
|
* @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
|
||||||
|
*
|
||||||
|
* Retrieves the minimum and natural size and the corresponding baselines of a widget, taking
|
||||||
|
* into account the widget's preference for height-for-width management. The baselines may
|
||||||
|
* be -1 which means that no baseline is requested for this widget.
|
||||||
|
*
|
||||||
|
* This is used to retrieve a suitable size by container widgets which do
|
||||||
|
* not impose any restrictions on the child placement. It can be used
|
||||||
|
* to deduce toplevel window and menu sizes as well as child widgets in
|
||||||
|
* free-form containers such as GtkLayout.
|
||||||
|
*
|
||||||
|
* <note><para>Handle with care. Note that the natural height of a height-for-width
|
||||||
|
* widget will generally be a smaller size than the minimum height, since the required
|
||||||
|
* height for the natural width is generally smaller than the required height for
|
||||||
|
* the minimum width.</para></note>
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_widget_get_preferred_size_and_baseline (GtkWidget *widget,
|
||||||
|
GtkRequisition *minimum_size,
|
||||||
|
GtkRequisition *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
gint min_width, nat_width;
|
||||||
|
gint min_height, nat_height;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
|
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
||||||
|
{
|
||||||
|
gtk_widget_get_preferred_width (widget, &min_width, &nat_width);
|
||||||
|
|
||||||
|
if (minimum_size)
|
||||||
|
{
|
||||||
|
minimum_size->width = min_width;
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width (widget, min_width,
|
||||||
|
&minimum_size->height, NULL, minimum_baseline, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (natural_size)
|
||||||
|
{
|
||||||
|
natural_size->width = nat_width;
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width (widget, nat_width,
|
||||||
|
NULL, &natural_size->height, NULL, natural_baseline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT or CONSTANT_SIZE */
|
||||||
|
{
|
||||||
|
gtk_widget_get_preferred_height_and_baseline_for_width (widget, -1, &min_height, &nat_height, minimum_baseline, natural_baseline);
|
||||||
|
|
||||||
|
if (minimum_size)
|
||||||
|
{
|
||||||
|
minimum_size->height = min_height;
|
||||||
|
gtk_widget_get_preferred_width_for_height (widget, min_height,
|
||||||
|
&minimum_size->width, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (natural_size)
|
||||||
|
{
|
||||||
|
natural_size->height = nat_height;
|
||||||
|
gtk_widget_get_preferred_width_for_height (widget, nat_height,
|
||||||
|
NULL, &natural_size->width);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -505,6 +737,9 @@ gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
* height for the natural width is generally smaller than the required height for
|
* height for the natural width is generally smaller than the required height for
|
||||||
* the minimum width.</para></note>
|
* the minimum width.</para></note>
|
||||||
*
|
*
|
||||||
|
* Use gtk_widget_get_preferred_size_and_baseline() if you want to support
|
||||||
|
* baseline alignment.
|
||||||
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -512,50 +747,10 @@ gtk_widget_get_preferred_size (GtkWidget *widget,
|
|||||||
GtkRequisition *minimum_size,
|
GtkRequisition *minimum_size,
|
||||||
GtkRequisition *natural_size)
|
GtkRequisition *natural_size)
|
||||||
{
|
{
|
||||||
gint min_width, nat_width;
|
gtk_widget_get_preferred_size_and_baseline (widget, minimum_size, natural_size,
|
||||||
gint min_height, nat_height;
|
NULL, NULL);
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
|
||||||
|
|
||||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
|
||||||
{
|
|
||||||
gtk_widget_get_preferred_width (widget, &min_width, &nat_width);
|
|
||||||
|
|
||||||
if (minimum_size)
|
|
||||||
{
|
|
||||||
minimum_size->width = min_width;
|
|
||||||
gtk_widget_get_preferred_height_for_width (widget, min_width,
|
|
||||||
&minimum_size->height, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (natural_size)
|
|
||||||
{
|
|
||||||
natural_size->width = nat_width;
|
|
||||||
gtk_widget_get_preferred_height_for_width (widget, nat_width,
|
|
||||||
NULL, &natural_size->height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT or CONSTANT_SIZE */
|
|
||||||
{
|
|
||||||
gtk_widget_get_preferred_height (widget, &min_height, &nat_height);
|
|
||||||
|
|
||||||
if (minimum_size)
|
|
||||||
{
|
|
||||||
minimum_size->height = min_height;
|
|
||||||
gtk_widget_get_preferred_width_for_height (widget, min_height,
|
|
||||||
&minimum_size->width, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (natural_size)
|
|
||||||
{
|
|
||||||
natural_size->height = nat_height;
|
|
||||||
gtk_widget_get_preferred_width_for_height (widget, nat_height,
|
|
||||||
NULL, &natural_size->width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_gap (gconstpointer p1,
|
compare_gap (gconstpointer p1,
|
||||||
gconstpointer p2,
|
gconstpointer p2,
|
||||||
@@ -657,3 +852,26 @@ gtk_distribute_natural_allocation (gint extra_space,
|
|||||||
|
|
||||||
return extra_space;
|
return extra_space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gtk_widget_get_preferred_size_for_size (GtkWidget *widget,
|
||||||
|
GtkOrientation orientation,
|
||||||
|
gint size,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
g_return_if_fail (size >= -1);
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
if (size < 0)
|
||||||
|
gtk_widget_get_preferred_width (widget, minimum, natural);
|
||||||
|
else
|
||||||
|
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
|
||||||
|
else
|
||||||
|
if (size < 0)
|
||||||
|
gtk_widget_get_preferred_height (widget, minimum, natural);
|
||||||
|
else
|
||||||
|
gtk_widget_get_preferred_height_for_width (widget, size, minimum, natural);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+198
-75
@@ -32,31 +32,38 @@ _gtk_size_request_cache_init (SizeRequestCache *cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_sizes (SizeRequest **sizes)
|
free_sizes_x (SizeRequestX **sizes)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++)
|
for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++)
|
||||||
g_slice_free (SizeRequest, sizes[i]);
|
g_slice_free (SizeRequestX, sizes[i]);
|
||||||
|
|
||||||
g_slice_free1 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes);
|
g_slice_free1 (sizeof (SizeRequestY *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_sizes_y (SizeRequestY **sizes)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; i < GTK_SIZE_REQUEST_CACHED_SIZES && sizes[i] != NULL; i++)
|
||||||
|
g_slice_free (SizeRequestY, sizes[i]);
|
||||||
|
|
||||||
|
g_slice_free1 (sizeof (SizeRequestY *) * GTK_SIZE_REQUEST_CACHED_SIZES, sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_size_request_cache_free (SizeRequestCache *cache)
|
_gtk_size_request_cache_free (SizeRequestCache *cache)
|
||||||
{
|
{
|
||||||
guint i;
|
if (cache->requests_x)
|
||||||
|
free_sizes_x (cache->requests_x);
|
||||||
for (i = 0; i < 2; i++)
|
if (cache->requests_x)
|
||||||
{
|
free_sizes_y (cache->requests_y);
|
||||||
if (cache->requests[i])
|
|
||||||
free_sizes (cache->requests[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_size_request_cache_clear (SizeRequestCache *cache)
|
_gtk_size_request_cache_clear (SizeRequestCache *cache)
|
||||||
|
|
||||||
{
|
{
|
||||||
_gtk_size_request_cache_free (cache);
|
_gtk_size_request_cache_free (cache);
|
||||||
_gtk_size_request_cache_init (cache);
|
_gtk_size_request_cache_init (cache);
|
||||||
@@ -67,17 +74,34 @@ _gtk_size_request_cache_commit (SizeRequestCache *cache,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint minimum_size,
|
gint minimum_size,
|
||||||
gint natural_size)
|
gint natural_size,
|
||||||
|
gint minimum_baseline,
|
||||||
|
gint natural_baseline)
|
||||||
{
|
{
|
||||||
SizeRequest **cached_sizes;
|
|
||||||
SizeRequest *cached_size;
|
|
||||||
guint i, n_sizes;
|
guint i, n_sizes;
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
{
|
||||||
|
g_assert (minimum_baseline == -1);
|
||||||
|
g_assert (natural_baseline == -1);
|
||||||
|
}
|
||||||
|
|
||||||
/* First handle caching of the base requests */
|
/* First handle caching of the base requests */
|
||||||
if (for_size < 0)
|
if (for_size < 0)
|
||||||
{
|
{
|
||||||
cache->cached_size[orientation].minimum_size = minimum_size;
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
cache->cached_size[orientation].natural_size = natural_size;
|
{
|
||||||
|
cache->cached_size_x.minimum_size = minimum_size;
|
||||||
|
cache->cached_size_x.natural_size = natural_size;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cache->cached_size_y.minimum_size = minimum_size;
|
||||||
|
cache->cached_size_y.natural_size = natural_size;
|
||||||
|
cache->cached_size_y.minimum_baseline = minimum_baseline;
|
||||||
|
cache->cached_size_y.natural_baseline = natural_baseline;
|
||||||
|
}
|
||||||
|
|
||||||
cache->flags[orientation].cached_size_valid = TRUE;
|
cache->flags[orientation].cached_size_valid = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,45 +110,99 @@ _gtk_size_request_cache_commit (SizeRequestCache *cache,
|
|||||||
* in the cache and if this result can be used to extend
|
* in the cache and if this result can be used to extend
|
||||||
* that cache entry
|
* that cache entry
|
||||||
*/
|
*/
|
||||||
cached_sizes = cache->requests[orientation];
|
|
||||||
n_sizes = cache->flags[orientation].n_cached_requests;
|
n_sizes = cache->flags[orientation].n_cached_requests;
|
||||||
|
|
||||||
for (i = 0; i < n_sizes; i++)
|
|
||||||
{
|
|
||||||
if (cached_sizes[i]->cached_size.minimum_size == minimum_size &&
|
|
||||||
cached_sizes[i]->cached_size.natural_size == natural_size)
|
|
||||||
{
|
|
||||||
cached_sizes[i]->lower_for_size = MIN (cached_sizes[i]->lower_for_size, for_size);
|
|
||||||
cached_sizes[i]->upper_for_size = MAX (cached_sizes[i]->upper_for_size, for_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If not found, pull a new size from the cache, the returned size cache
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
* will immediately be used to cache the new computed size so we go ahead
|
|
||||||
* and increment the last_cached_request right away */
|
|
||||||
if (n_sizes < GTK_SIZE_REQUEST_CACHED_SIZES)
|
|
||||||
{
|
{
|
||||||
cache->flags[orientation].n_cached_requests++;
|
SizeRequestX **cached_sizes;
|
||||||
cache->flags[orientation].last_cached_request = cache->flags[orientation].n_cached_requests - 1;
|
SizeRequestX *cached_size;
|
||||||
|
cached_sizes = cache->requests_x;
|
||||||
|
|
||||||
|
for (i = 0; i < n_sizes; i++)
|
||||||
|
{
|
||||||
|
if (cached_sizes[i]->cached_size.minimum_size == minimum_size &&
|
||||||
|
cached_sizes[i]->cached_size.natural_size == natural_size)
|
||||||
|
{
|
||||||
|
cached_sizes[i]->lower_for_size = MIN (cached_sizes[i]->lower_for_size, for_size);
|
||||||
|
cached_sizes[i]->upper_for_size = MAX (cached_sizes[i]->upper_for_size, for_size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If not found, pull a new size from the cache, the returned size cache
|
||||||
|
* will immediately be used to cache the new computed size so we go ahead
|
||||||
|
* and increment the last_cached_request right away */
|
||||||
|
if (n_sizes < GTK_SIZE_REQUEST_CACHED_SIZES)
|
||||||
|
{
|
||||||
|
cache->flags[orientation].n_cached_requests++;
|
||||||
|
cache->flags[orientation].last_cached_request = cache->flags[orientation].n_cached_requests - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (++cache->flags[orientation].last_cached_request == GTK_SIZE_REQUEST_CACHED_SIZES)
|
||||||
|
cache->flags[orientation].last_cached_request = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache->requests_x == NULL)
|
||||||
|
cache->requests_x = g_slice_alloc0 (sizeof (SizeRequestX *) * GTK_SIZE_REQUEST_CACHED_SIZES);
|
||||||
|
|
||||||
|
if (cache->requests_x[cache->flags[orientation].last_cached_request] == NULL)
|
||||||
|
cache->requests_x[cache->flags[orientation].last_cached_request] = g_slice_new (SizeRequestX);
|
||||||
|
|
||||||
|
cached_size = cache->requests_x[cache->flags[orientation].last_cached_request];
|
||||||
|
cached_size->lower_for_size = for_size;
|
||||||
|
cached_size->upper_for_size = for_size;
|
||||||
|
cached_size->cached_size.minimum_size = minimum_size;
|
||||||
|
cached_size->cached_size.natural_size = natural_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (++cache->flags[orientation].last_cached_request == GTK_SIZE_REQUEST_CACHED_SIZES)
|
SizeRequestY **cached_sizes;
|
||||||
cache->flags[orientation].last_cached_request = 0;
|
SizeRequestY *cached_size;
|
||||||
|
cached_sizes = cache->requests_y;
|
||||||
|
|
||||||
|
for (i = 0; i < n_sizes; i++)
|
||||||
|
{
|
||||||
|
if (cached_sizes[i]->cached_size.minimum_size == minimum_size &&
|
||||||
|
cached_sizes[i]->cached_size.natural_size == natural_size &&
|
||||||
|
cached_sizes[i]->cached_size.minimum_baseline == minimum_baseline &&
|
||||||
|
cached_sizes[i]->cached_size.natural_baseline == natural_baseline)
|
||||||
|
{
|
||||||
|
cached_sizes[i]->lower_for_size = MIN (cached_sizes[i]->lower_for_size, for_size);
|
||||||
|
cached_sizes[i]->upper_for_size = MAX (cached_sizes[i]->upper_for_size, for_size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If not found, pull a new size from the cache, the returned size cache
|
||||||
|
* will immediately be used to cache the new computed size so we go ahead
|
||||||
|
* and increment the last_cached_request right away */
|
||||||
|
if (n_sizes < GTK_SIZE_REQUEST_CACHED_SIZES)
|
||||||
|
{
|
||||||
|
cache->flags[orientation].n_cached_requests++;
|
||||||
|
cache->flags[orientation].last_cached_request = cache->flags[orientation].n_cached_requests - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (++cache->flags[orientation].last_cached_request == GTK_SIZE_REQUEST_CACHED_SIZES)
|
||||||
|
cache->flags[orientation].last_cached_request = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache->requests_y == NULL)
|
||||||
|
cache->requests_y = g_slice_alloc0 (sizeof (SizeRequestY *) * GTK_SIZE_REQUEST_CACHED_SIZES);
|
||||||
|
|
||||||
|
if (cache->requests_y[cache->flags[orientation].last_cached_request] == NULL)
|
||||||
|
cache->requests_y[cache->flags[orientation].last_cached_request] = g_slice_new (SizeRequestY);
|
||||||
|
|
||||||
|
cached_size = cache->requests_y[cache->flags[orientation].last_cached_request];
|
||||||
|
cached_size->lower_for_size = for_size;
|
||||||
|
cached_size->upper_for_size = for_size;
|
||||||
|
cached_size->cached_size.minimum_size = minimum_size;
|
||||||
|
cached_size->cached_size.natural_size = natural_size;
|
||||||
|
cached_size->cached_size.minimum_baseline = minimum_baseline;
|
||||||
|
cached_size->cached_size.natural_baseline = natural_baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache->requests[orientation] == NULL)
|
|
||||||
cache->requests[orientation] = g_slice_alloc0 (sizeof (SizeRequest *) * GTK_SIZE_REQUEST_CACHED_SIZES);
|
|
||||||
|
|
||||||
if (cache->requests[orientation][cache->flags[orientation].last_cached_request] == NULL)
|
|
||||||
cache->requests[orientation][cache->flags[orientation].last_cached_request] = g_slice_new (SizeRequest);
|
|
||||||
|
|
||||||
cached_size = cache->requests[orientation][cache->flags[orientation].last_cached_request];
|
|
||||||
cached_size->lower_for_size = for_size;
|
|
||||||
cached_size->upper_for_size = for_size;
|
|
||||||
cached_size->cached_size.minimum_size = minimum_size;
|
|
||||||
cached_size->cached_size.natural_size = natural_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* looks for a cached size request for this for_size.
|
/* looks for a cached size request for this for_size.
|
||||||
@@ -137,40 +215,85 @@ _gtk_size_request_cache_lookup (SizeRequestCache *cache,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural)
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
CachedSize *result = NULL;
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
|
|
||||||
if (for_size < 0)
|
|
||||||
{
|
{
|
||||||
if (cache->flags[orientation].cached_size_valid)
|
CachedSizeX *result = NULL;
|
||||||
result = &cache->cached_size[orientation];
|
|
||||||
|
if (for_size < 0)
|
||||||
|
{
|
||||||
|
if (cache->flags[orientation].cached_size_valid)
|
||||||
|
result = &cache->cached_size_x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
/* Search for an already cached size */
|
||||||
|
for (i = 0; i < cache->flags[orientation].n_cached_requests; i++)
|
||||||
|
{
|
||||||
|
SizeRequestX *cur = cache->requests_x[i];
|
||||||
|
|
||||||
|
if (cur->lower_for_size <= for_size &&
|
||||||
|
cur->upper_for_size >= for_size)
|
||||||
|
{
|
||||||
|
result = &cur->cached_size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
*minimum = result->minimum_size;
|
||||||
|
*natural = result->natural_size;
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
*natural_baseline = -1;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
guint i;
|
CachedSizeY *result = NULL;
|
||||||
|
|
||||||
/* Search for an already cached size */
|
if (for_size < 0)
|
||||||
for (i = 0; i < cache->flags[orientation].n_cached_requests; i++)
|
{
|
||||||
{
|
if (cache->flags[orientation].cached_size_valid)
|
||||||
SizeRequest *cur = cache->requests[orientation][i];
|
result = &cache->cached_size_y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
if (cur->lower_for_size <= for_size &&
|
/* Search for an already cached size */
|
||||||
cur->upper_for_size >= for_size)
|
for (i = 0; i < cache->flags[orientation].n_cached_requests; i++)
|
||||||
{
|
{
|
||||||
result = &cur->cached_size;
|
SizeRequestY *cur = cache->requests_y[i];
|
||||||
break;
|
|
||||||
}
|
if (cur->lower_for_size <= for_size &&
|
||||||
}
|
cur->upper_for_size >= for_size)
|
||||||
|
{
|
||||||
|
result = &cur->cached_size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
*minimum = result->minimum_size;
|
||||||
|
*natural = result->natural_size;
|
||||||
|
*minimum_baseline = result->minimum_baseline;
|
||||||
|
*natural_baseline = result->natural_baseline;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
*minimum = result->minimum_size;
|
|
||||||
*natural = result->natural_size;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,19 +41,35 @@ G_BEGIN_DECLS
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
gint minimum_size;
|
gint minimum_size;
|
||||||
gint natural_size;
|
gint natural_size;
|
||||||
} CachedSize;
|
} CachedSizeX;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gint minimum_size;
|
||||||
|
gint natural_size;
|
||||||
|
gint minimum_baseline;
|
||||||
|
gint natural_baseline;
|
||||||
|
} CachedSizeY;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gint lower_for_size; /* The minimum for_size with the same result */
|
gint lower_for_size; /* The minimum for_size with the same result */
|
||||||
gint upper_for_size; /* The maximum for_size with the same result */
|
gint upper_for_size; /* The maximum for_size with the same result */
|
||||||
CachedSize cached_size;
|
CachedSizeX cached_size;
|
||||||
} SizeRequest;
|
} SizeRequestX;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
gint lower_for_size; /* The minimum for_size with the same result */
|
||||||
|
gint upper_for_size; /* The maximum for_size with the same result */
|
||||||
|
CachedSizeY cached_size;
|
||||||
|
} SizeRequestY;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SizeRequest **requests[2];
|
SizeRequestX **requests_x;
|
||||||
|
SizeRequestY **requests_y;
|
||||||
|
|
||||||
CachedSize cached_size[2];
|
CachedSizeX cached_size_x;
|
||||||
|
CachedSizeY cached_size_y;
|
||||||
|
|
||||||
GtkSizeRequestMode request_mode : 3;
|
GtkSizeRequestMode request_mode : 3;
|
||||||
guint request_mode_valid : 1;
|
guint request_mode_valid : 1;
|
||||||
@@ -72,12 +88,16 @@ void _gtk_size_request_cache_commit (SizeRequestCach
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint minimum_size,
|
gint minimum_size,
|
||||||
gint natural_size);
|
gint natural_size,
|
||||||
|
gint minimum_baseline,
|
||||||
|
gint natural_baseline);
|
||||||
gboolean _gtk_size_request_cache_lookup (SizeRequestCache *cache,
|
gboolean _gtk_size_request_cache_lookup (SizeRequestCache *cache,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
+30
-4
@@ -222,6 +222,12 @@ static void gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
|||||||
static void gtk_spin_button_get_preferred_height (GtkWidget *widget,
|
static void gtk_spin_button_get_preferred_height (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint *minimum,
|
||||||
gint *natural);
|
gint *natural);
|
||||||
|
static void gtk_spin_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_spin_button_size_allocate (GtkWidget *widget,
|
static void gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
static gint gtk_spin_button_draw (GtkWidget *widget,
|
static gint gtk_spin_button_draw (GtkWidget *widget,
|
||||||
@@ -309,6 +315,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
|
|||||||
widget_class->unrealize = gtk_spin_button_unrealize;
|
widget_class->unrealize = gtk_spin_button_unrealize;
|
||||||
widget_class->get_preferred_width = gtk_spin_button_get_preferred_width;
|
widget_class->get_preferred_width = gtk_spin_button_get_preferred_width;
|
||||||
widget_class->get_preferred_height = gtk_spin_button_get_preferred_height;
|
widget_class->get_preferred_height = gtk_spin_button_get_preferred_height;
|
||||||
|
widget_class->get_preferred_height_and_baseline_for_width = gtk_spin_button_get_preferred_height_and_baseline_for_width;
|
||||||
widget_class->size_allocate = gtk_spin_button_size_allocate;
|
widget_class->size_allocate = gtk_spin_button_size_allocate;
|
||||||
widget_class->draw = gtk_spin_button_draw;
|
widget_class->draw = gtk_spin_button_draw;
|
||||||
widget_class->scroll_event = gtk_spin_button_scroll;
|
widget_class->scroll_event = gtk_spin_button_scroll;
|
||||||
@@ -1197,14 +1204,20 @@ gtk_spin_button_get_preferred_width (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_get_preferred_height (GtkWidget *widget,
|
gtk_spin_button_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
gint *minimum,
|
gint width,
|
||||||
gint *natural)
|
gint *minimum,
|
||||||
|
gint *natural,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
{
|
{
|
||||||
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
|
||||||
GtkSpinButtonPrivate *priv = spin_button->priv;
|
GtkSpinButtonPrivate *priv = spin_button->priv;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->get_preferred_height (widget, minimum, natural);
|
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->get_preferred_height_and_baseline_for_width (widget, width,
|
||||||
|
minimum, natural,
|
||||||
|
minimum_baseline,
|
||||||
|
natural_baseline);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
@@ -1216,9 +1229,22 @@ gtk_spin_button_get_preferred_height (GtkWidget *widget,
|
|||||||
|
|
||||||
*minimum += up_panel_height + down_panel_height;
|
*minimum += up_panel_height + down_panel_height;
|
||||||
*natural += up_panel_height + down_panel_height;
|
*natural += up_panel_height + down_panel_height;
|
||||||
|
|
||||||
|
if (minimum_baseline && *minimum_baseline != -1)
|
||||||
|
*minimum_baseline += up_panel_height;
|
||||||
|
if (natural_baseline && *natural_baseline != -1)
|
||||||
|
*natural_baseline += up_panel_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_spin_button_get_preferred_height (GtkWidget *widget,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural)
|
||||||
|
{
|
||||||
|
gtk_spin_button_get_preferred_height_and_baseline_for_width (widget, -1, minimum, natural, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spin_button_size_allocate (GtkWidget *widget,
|
gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
|
|||||||
+17
-19
@@ -374,12 +374,12 @@ gtk_stack_class_init (GtkStackClass *klass)
|
|||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_TRANSITION_DURATION,
|
PROP_TRANSITION_DURATION,
|
||||||
g_param_spec_int ("transition-duration",
|
g_param_spec_uint ("transition-duration",
|
||||||
P_("Transition duration"),
|
P_("Transition duration"),
|
||||||
P_("The animation duration, in milliseconds"),
|
P_("The animation duration, in milliseconds"),
|
||||||
G_MININT, G_MAXINT,
|
0, G_MAXUINT,
|
||||||
200,
|
200,
|
||||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_TRANSITION_TYPE,
|
PROP_TRANSITION_TYPE,
|
||||||
g_param_spec_enum ("transition-type",
|
g_param_spec_enum ("transition-type",
|
||||||
@@ -1094,7 +1094,7 @@ gtk_stack_get_homogeneous (GtkStack *stack)
|
|||||||
* gtk_stack_get_transition_duration:
|
* gtk_stack_get_transition_duration:
|
||||||
* @stack: a #GtkStack
|
* @stack: a #GtkStack
|
||||||
*
|
*
|
||||||
* Returns the amount of time (in milliseconds that
|
* Returns the amount of time (in milliseconds) that
|
||||||
* transitions between pages in @stack will take.
|
* transitions between pages in @stack will take.
|
||||||
*
|
*
|
||||||
* Returns: the transition duration
|
* Returns: the transition duration
|
||||||
@@ -1112,22 +1112,20 @@ gtk_stack_get_transition_duration (GtkStack *stack)
|
|||||||
/**
|
/**
|
||||||
* gtk_stack_set_transition_duration:
|
* gtk_stack_set_transition_duration:
|
||||||
* @stack: a #GtkStack
|
* @stack: a #GtkStack
|
||||||
* @transition_duration: the new duration, in milliseconds
|
* @duration: the new duration, in milliseconds
|
||||||
*
|
*
|
||||||
* Sets the duration that transitions between pages in @stack
|
* Sets the duration that transitions between pages in @stack
|
||||||
* will take.
|
* will take.
|
||||||
*
|
*
|
||||||
* Returns: the transition duration
|
|
||||||
*
|
|
||||||
* Since: 3.10
|
* Since: 3.10
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_stack_set_transition_duration (GtkStack *stack,
|
gtk_stack_set_transition_duration (GtkStack *stack,
|
||||||
guint transition_duration)
|
guint duration)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_STACK (stack));
|
g_return_if_fail (GTK_IS_STACK (stack));
|
||||||
|
|
||||||
stack->priv->transition_duration = transition_duration;
|
stack->priv->transition_duration = duration;
|
||||||
g_object_notify (G_OBJECT (stack), "transition-duration");
|
g_object_notify (G_OBJECT (stack), "transition-duration");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1153,7 +1151,7 @@ gtk_stack_get_transition_type (GtkStack *stack)
|
|||||||
/**
|
/**
|
||||||
* gtk_stack_set_transition_type:
|
* gtk_stack_set_transition_type:
|
||||||
* @stack: a #GtkStack
|
* @stack: a #GtkStack
|
||||||
* @transition_type: the new transition type
|
* @transition: the new transition type
|
||||||
*
|
*
|
||||||
* Sets the type of animation that will be used for
|
* Sets the type of animation that will be used for
|
||||||
* transitions between pages in @stack. Available
|
* transitions between pages in @stack. Available
|
||||||
@@ -1167,11 +1165,11 @@ gtk_stack_get_transition_type (GtkStack *stack)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_stack_set_transition_type (GtkStack *stack,
|
gtk_stack_set_transition_type (GtkStack *stack,
|
||||||
GtkStackTransitionType transition_type)
|
GtkStackTransitionType transition)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_STACK (stack));
|
g_return_if_fail (GTK_IS_STACK (stack));
|
||||||
|
|
||||||
stack->priv->transition_type = transition_type;
|
stack->priv->transition_type = transition;
|
||||||
g_object_notify (G_OBJECT (stack), "transition-type");
|
g_object_notify (G_OBJECT (stack), "transition-type");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1271,10 +1269,10 @@ gtk_stack_set_visible_child_name (GtkStack *stack,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_stack_set_visible_child_name:
|
* gtk_stack_set_visible_child_full:
|
||||||
* @stack: a #GtkStack
|
* @stack: a #GtkStack
|
||||||
* @name: the name of the child to make visible
|
* @name: the name of the child to make visible
|
||||||
* @transition_type: the transition type to use
|
* @transition: the transition type to use
|
||||||
*
|
*
|
||||||
* Makes the child with the given name visible.
|
* Makes the child with the given name visible.
|
||||||
*
|
*
|
||||||
@@ -1283,7 +1281,7 @@ gtk_stack_set_visible_child_name (GtkStack *stack,
|
|||||||
void
|
void
|
||||||
gtk_stack_set_visible_child_full (GtkStack *stack,
|
gtk_stack_set_visible_child_full (GtkStack *stack,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkStackTransitionType transition_type)
|
GtkStackTransitionType transition)
|
||||||
{
|
{
|
||||||
GtkStackPrivate *priv;
|
GtkStackPrivate *priv;
|
||||||
GtkStackChildInfo *child_info, *info;
|
GtkStackChildInfo *child_info, *info;
|
||||||
@@ -1307,7 +1305,7 @@ gtk_stack_set_visible_child_full (GtkStack *stack,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (child_info != NULL && gtk_widget_get_visible (child_info->widget))
|
if (child_info != NULL && gtk_widget_get_visible (child_info->widget))
|
||||||
set_visible_child (stack, child_info, transition_type, priv->transition_duration);
|
set_visible_child (stack, child_info, transition, priv->transition_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+3
-3
@@ -74,15 +74,15 @@ void gtk_stack_set_visible_child_name (GtkStack
|
|||||||
const gchar * gtk_stack_get_visible_child_name (GtkStack *stack);
|
const gchar * gtk_stack_get_visible_child_name (GtkStack *stack);
|
||||||
void gtk_stack_set_visible_child_full (GtkStack *stack,
|
void gtk_stack_set_visible_child_full (GtkStack *stack,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
GtkStackTransitionType transition_type);
|
GtkStackTransitionType transition);
|
||||||
void gtk_stack_set_homogeneous (GtkStack *stack,
|
void gtk_stack_set_homogeneous (GtkStack *stack,
|
||||||
gboolean homogeneous);
|
gboolean homogeneous);
|
||||||
gboolean gtk_stack_get_homogeneous (GtkStack *stack);
|
gboolean gtk_stack_get_homogeneous (GtkStack *stack);
|
||||||
void gtk_stack_set_transition_duration (GtkStack *stack,
|
void gtk_stack_set_transition_duration (GtkStack *stack,
|
||||||
guint transition_duration);
|
guint duration);
|
||||||
guint gtk_stack_get_transition_duration (GtkStack *stack);
|
guint gtk_stack_get_transition_duration (GtkStack *stack);
|
||||||
void gtk_stack_set_transition_type (GtkStack *stack,
|
void gtk_stack_set_transition_type (GtkStack *stack,
|
||||||
GtkStackTransitionType transition_type);
|
GtkStackTransitionType transition);
|
||||||
GtkStackTransitionType gtk_stack_get_transition_type (GtkStack *stack);
|
GtkStackTransitionType gtk_stack_get_transition_type (GtkStack *stack);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gtkstackswitcher
|
* SECTION:gtkstackswitcher
|
||||||
* @Short_decription: A controller for GtkStack
|
* @Short_description: A controller for GtkStack
|
||||||
* @Title: GtkStackSwitcher
|
* @Title: GtkStackSwitcher
|
||||||
* @See_also: #GtkStack
|
* @See_also: #GtkStack
|
||||||
*
|
*
|
||||||
|
|||||||
+202
-17
@@ -95,6 +95,7 @@
|
|||||||
* <listitem>#GtkWidgetClass.get_preferred_height()</listitem>
|
* <listitem>#GtkWidgetClass.get_preferred_height()</listitem>
|
||||||
* <listitem>#GtkWidgetClass.get_preferred_height_for_width()</listitem>
|
* <listitem>#GtkWidgetClass.get_preferred_height_for_width()</listitem>
|
||||||
* <listitem>#GtkWidgetClass.get_preferred_width_for_height()</listitem>
|
* <listitem>#GtkWidgetClass.get_preferred_width_for_height()</listitem>
|
||||||
|
* <listitem>#GtkWidgetClass.get_preferred_height_and_baseline_for_width()</listitem>
|
||||||
* </itemizedlist>
|
* </itemizedlist>
|
||||||
*
|
*
|
||||||
* There are some important things to keep in mind when implementing
|
* There are some important things to keep in mind when implementing
|
||||||
@@ -222,6 +223,26 @@
|
|||||||
* container, you <emphasis>must</emphasis> use the wrapper APIs.
|
* container, you <emphasis>must</emphasis> use the wrapper APIs.
|
||||||
* Otherwise, you would not properly consider widget margins,
|
* Otherwise, you would not properly consider widget margins,
|
||||||
* #GtkSizeGroup, and so forth.
|
* #GtkSizeGroup, and so forth.
|
||||||
|
*
|
||||||
|
* Since 3.10 Gtk+ also supports baseline vertical alignment of widgets. This
|
||||||
|
* means that widgets are positioned such that the typographical baseline of
|
||||||
|
* widgets in the same row are aligned. This happens if a widget supports baselines,
|
||||||
|
* has a vertical alignment of %GTK_ALIGN_BASELINE, and is inside a container
|
||||||
|
* that supports baselines and has a natural "row" that it aligns to the baseline,
|
||||||
|
* or a baseline assigned to it by the grandparent.
|
||||||
|
*
|
||||||
|
* Baseline alignment support for a widget is done by the #GtkWidgetClass.get_preferred_height_and_baseline_for_width()
|
||||||
|
* virtual function. It allows you to report a baseline in combination with the
|
||||||
|
* minimum and natural height. If there is no baseline you can return -1 to indicate
|
||||||
|
* this. The default implementation of this virtual function calls into the
|
||||||
|
* #GtkWidgetClass.get_preferred_height() and #GtkWidgetClass.get_preferred_height_for_width(),
|
||||||
|
* so if baselines are not supported it doesn't need to be implemented.
|
||||||
|
*
|
||||||
|
* If a widget ends up baseline aligned it will be allocated all the space in the parent
|
||||||
|
* as if it was %GTK_ALIGN_FILL, but the selected baseline can be found via gtk_widget_get_allocated_baseline().
|
||||||
|
* If this has a value other than -1 you need to align the widget such that the baseline
|
||||||
|
* appears at the position.
|
||||||
|
*
|
||||||
* </para>
|
* </para>
|
||||||
* </refsect2>
|
* </refsect2>
|
||||||
* <refsect2 id="style-properties">
|
* <refsect2 id="style-properties">
|
||||||
@@ -478,6 +499,7 @@ struct _GtkWidgetPrivate
|
|||||||
|
|
||||||
/* The widget's allocated size */
|
/* The widget's allocated size */
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
gint allocated_baseline;
|
||||||
|
|
||||||
/* The widget's requested sizes */
|
/* The widget's requested sizes */
|
||||||
SizeRequestCache requests;
|
SizeRequestCache requests;
|
||||||
@@ -785,12 +807,17 @@ static void gtk_widget_real_adjust_size_request (GtkWidget
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size);
|
||||||
|
static void gtk_widget_real_adjust_baseline_request (GtkWidget *widget,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
static void gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
|
static void gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size,
|
gint *natural_size,
|
||||||
gint *allocated_pos,
|
gint *allocated_pos,
|
||||||
gint *allocated_size);
|
gint *allocated_size);
|
||||||
|
static void gtk_widget_real_adjust_baseline_allocation (GtkWidget *widget,
|
||||||
|
gint *baseline);
|
||||||
|
|
||||||
/* --- functions dealing with template data structures --- */
|
/* --- functions dealing with template data structures --- */
|
||||||
static AutomaticChildClass *automatic_child_class_new (const gchar *name,
|
static AutomaticChildClass *automatic_child_class_new (const gchar *name,
|
||||||
@@ -1091,6 +1118,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
klass->get_preferred_height = gtk_widget_real_get_height;
|
klass->get_preferred_height = gtk_widget_real_get_height;
|
||||||
klass->get_preferred_width_for_height = gtk_widget_real_get_width_for_height;
|
klass->get_preferred_width_for_height = gtk_widget_real_get_width_for_height;
|
||||||
klass->get_preferred_height_for_width = gtk_widget_real_get_height_for_width;
|
klass->get_preferred_height_for_width = gtk_widget_real_get_height_for_width;
|
||||||
|
klass->get_preferred_height_and_baseline_for_width = NULL;
|
||||||
klass->state_changed = NULL;
|
klass->state_changed = NULL;
|
||||||
klass->state_flags_changed = gtk_widget_real_state_flags_changed;
|
klass->state_flags_changed = gtk_widget_real_state_flags_changed;
|
||||||
klass->parent_set = NULL;
|
klass->parent_set = NULL;
|
||||||
@@ -1150,7 +1178,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
klass->get_accessible = gtk_widget_real_get_accessible;
|
klass->get_accessible = gtk_widget_real_get_accessible;
|
||||||
|
|
||||||
klass->adjust_size_request = gtk_widget_real_adjust_size_request;
|
klass->adjust_size_request = gtk_widget_real_adjust_size_request;
|
||||||
|
klass->adjust_baseline_request = gtk_widget_real_adjust_baseline_request;
|
||||||
klass->adjust_size_allocation = gtk_widget_real_adjust_size_allocation;
|
klass->adjust_size_allocation = gtk_widget_real_adjust_size_allocation;
|
||||||
|
klass->adjust_baseline_allocation = gtk_widget_real_adjust_baseline_allocation;
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
@@ -5306,22 +5336,31 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_widget_size_allocate:
|
* gtk_widget_size_allocate_with_baseline:
|
||||||
* @widget: a #GtkWidget
|
* @widget: a #GtkWidget
|
||||||
* @allocation: position and size to be allocated to @widget
|
* @allocation: position and size to be allocated to @widget
|
||||||
|
* @baseline: The baseline of the child, or -1
|
||||||
*
|
*
|
||||||
* This function is only used by #GtkContainer subclasses, to assign a size
|
* This function is only used by #GtkContainer subclasses, to assign a size,
|
||||||
* and position to their child widgets.
|
* position and (optionally) baseline to their child widgets.
|
||||||
*
|
*
|
||||||
* In this function, the allocation may be adjusted. It will be forced
|
* In this function, the allocation and baseline may be adjusted. It
|
||||||
* to a 1x1 minimum size, and the adjust_size_allocation virtual
|
* will be forced to a 1x1 minimum size, and the
|
||||||
* method on the child will be used to adjust the allocation. Standard
|
* adjust_size_allocation virtual and adjust_baseline_allocation
|
||||||
* adjustments include removing the widget's margins, and applying the
|
* methods on the child will be used to adjust the allocation and
|
||||||
* widget's #GtkWidget:halign and #GtkWidget:valign properties.
|
* baseline. Standard adjustments include removing the widget's
|
||||||
|
* margins, and applying the widget's #GtkWidget:halign and
|
||||||
|
* #GtkWidget:valign properties.
|
||||||
|
*
|
||||||
|
* If the child widget does not have a valign of %GTK_ALIGN_BASELINE the
|
||||||
|
* baseline argument is ignored and -1 is used instead.
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_widget_size_allocate (GtkWidget *widget,
|
gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation,
|
||||||
|
gint baseline)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv;
|
GtkWidgetPrivate *priv;
|
||||||
GdkRectangle real_allocation;
|
GdkRectangle real_allocation;
|
||||||
@@ -5329,9 +5368,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
GdkRectangle adjusted_allocation;
|
GdkRectangle adjusted_allocation;
|
||||||
gboolean alloc_needed;
|
gboolean alloc_needed;
|
||||||
gboolean size_changed;
|
gboolean size_changed;
|
||||||
|
gboolean baseline_changed;
|
||||||
gboolean position_changed;
|
gboolean position_changed;
|
||||||
gint natural_width, natural_height, dummy;
|
gint natural_width, natural_height, dummy;
|
||||||
gint min_width, min_height;
|
gint min_width, min_height;
|
||||||
|
gint old_baseline;
|
||||||
|
|
||||||
priv = widget->priv;
|
priv = widget->priv;
|
||||||
|
|
||||||
@@ -5358,17 +5399,28 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
|
name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
|
||||||
g_print ("gtk_widget_size_allocate: %*s%s %d %d\n",
|
g_print ("gtk_widget_size_allocate: %*s%s %d %d",
|
||||||
2 * depth, " ", name,
|
2 * depth, " ", name,
|
||||||
allocation->width, allocation->height);
|
allocation->width, allocation->height);
|
||||||
|
if (baseline != -1)
|
||||||
|
g_print (" baseline: %d", baseline);
|
||||||
|
g_print ("\n");
|
||||||
}
|
}
|
||||||
#endif /* G_ENABLE_DEBUG */
|
#endif /* G_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
/* Never pass a baseline to a child unless it requested it.
|
||||||
|
This means containers don't have to manually check for this. */
|
||||||
|
if (baseline != -1 &&
|
||||||
|
(gtk_widget_get_valign_with_baseline (widget) != GTK_ALIGN_BASELINE ||
|
||||||
|
!_gtk_widget_has_baseline_support (widget)))
|
||||||
|
baseline = -1;
|
||||||
|
|
||||||
alloc_needed = priv->alloc_needed;
|
alloc_needed = priv->alloc_needed;
|
||||||
/* Preserve request/allocate ordering */
|
/* Preserve request/allocate ordering */
|
||||||
priv->alloc_needed = FALSE;
|
priv->alloc_needed = FALSE;
|
||||||
|
|
||||||
old_allocation = priv->allocation;
|
old_allocation = priv->allocation;
|
||||||
|
old_baseline = priv->allocated_baseline;
|
||||||
real_allocation = *allocation;
|
real_allocation = *allocation;
|
||||||
|
|
||||||
adjusted_allocation = real_allocation;
|
adjusted_allocation = real_allocation;
|
||||||
@@ -5418,6 +5470,9 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
&natural_height,
|
&natural_height,
|
||||||
&adjusted_allocation.y,
|
&adjusted_allocation.y,
|
||||||
&adjusted_allocation.height);
|
&adjusted_allocation.height);
|
||||||
|
if (baseline >= 0)
|
||||||
|
GTK_WIDGET_GET_CLASS (widget)->adjust_baseline_allocation (widget,
|
||||||
|
&baseline);
|
||||||
|
|
||||||
if (adjusted_allocation.x < real_allocation.x ||
|
if (adjusted_allocation.x < real_allocation.x ||
|
||||||
adjusted_allocation.y < real_allocation.y ||
|
adjusted_allocation.y < real_allocation.y ||
|
||||||
@@ -5447,14 +5502,16 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
real_allocation.width = MAX (real_allocation.width, 1);
|
real_allocation.width = MAX (real_allocation.width, 1);
|
||||||
real_allocation.height = MAX (real_allocation.height, 1);
|
real_allocation.height = MAX (real_allocation.height, 1);
|
||||||
|
|
||||||
|
baseline_changed = old_baseline != baseline;
|
||||||
size_changed = (old_allocation.width != real_allocation.width ||
|
size_changed = (old_allocation.width != real_allocation.width ||
|
||||||
old_allocation.height != real_allocation.height);
|
old_allocation.height != real_allocation.height);
|
||||||
position_changed = (old_allocation.x != real_allocation.x ||
|
position_changed = (old_allocation.x != real_allocation.x ||
|
||||||
old_allocation.y != real_allocation.y);
|
old_allocation.y != real_allocation.y);
|
||||||
|
|
||||||
if (!alloc_needed && !size_changed && !position_changed)
|
if (!alloc_needed && !size_changed && !position_changed && !baseline_changed)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
priv->allocated_baseline = baseline;
|
||||||
g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
|
g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
|
||||||
|
|
||||||
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
|
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
|
||||||
@@ -5473,7 +5530,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
cairo_region_destroy (invalidate);
|
cairo_region_destroy (invalidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size_changed)
|
if (size_changed || baseline_changed)
|
||||||
{
|
{
|
||||||
if (priv->redraw_on_alloc)
|
if (priv->redraw_on_alloc)
|
||||||
{
|
{
|
||||||
@@ -5488,7 +5545,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_changed || position_changed) && priv->parent &&
|
if ((size_changed || position_changed || baseline_changed) && priv->parent &&
|
||||||
gtk_widget_get_realized (priv->parent) && _gtk_container_get_reallocate_redraws (GTK_CONTAINER (priv->parent)))
|
gtk_widget_get_realized (priv->parent) && _gtk_container_get_reallocate_redraws (GTK_CONTAINER (priv->parent)))
|
||||||
{
|
{
|
||||||
cairo_region_t *invalidate = cairo_region_create_rectangle (&priv->parent->priv->allocation);
|
cairo_region_t *invalidate = cairo_region_create_rectangle (&priv->parent->priv->allocation);
|
||||||
@@ -5500,6 +5557,31 @@ out:
|
|||||||
gtk_widget_pop_verify_invariants (widget);
|
gtk_widget_pop_verify_invariants (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_widget_size_allocate:
|
||||||
|
* @widget: a #GtkWidget
|
||||||
|
* @allocation: position and size to be allocated to @widget
|
||||||
|
*
|
||||||
|
* This function is only used by #GtkContainer subclasses, to assign a size
|
||||||
|
* and position to their child widgets.
|
||||||
|
*
|
||||||
|
* In this function, the allocation may be adjusted. It will be forced
|
||||||
|
* to a 1x1 minimum size, and the adjust_size_allocation virtual
|
||||||
|
* method on the child will be used to adjust the allocation. Standard
|
||||||
|
* adjustments include removing the widget's margins, and applying the
|
||||||
|
* widget's #GtkWidget:halign and #GtkWidget:valign properties.
|
||||||
|
*
|
||||||
|
* For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline()
|
||||||
|
* instead.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gtk_widget_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation)
|
||||||
|
{
|
||||||
|
gtk_widget_size_allocate_with_baseline (widget, allocation, -1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_widget_common_ancestor:
|
* gtk_widget_common_ancestor:
|
||||||
* @widget_a: a #GtkWidget
|
* @widget_a: a #GtkWidget
|
||||||
@@ -5721,6 +5803,7 @@ adjust_for_align (GtkAlign align,
|
|||||||
{
|
{
|
||||||
switch (align)
|
switch (align)
|
||||||
{
|
{
|
||||||
|
case GTK_ALIGN_BASELINE:
|
||||||
case GTK_ALIGN_FILL:
|
case GTK_ALIGN_FILL:
|
||||||
/* change nothing */
|
/* change nothing */
|
||||||
break;
|
break;
|
||||||
@@ -5791,6 +5874,18 @@ gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_widget_real_adjust_baseline_allocation (GtkWidget *widget,
|
||||||
|
gint *baseline)
|
||||||
|
{
|
||||||
|
const GtkWidgetAuxInfo *aux_info;
|
||||||
|
|
||||||
|
aux_info = _gtk_widget_get_aux_info_or_defaults (widget);
|
||||||
|
|
||||||
|
if (baseline >= 0)
|
||||||
|
*baseline -= aux_info->margin.top;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_widget_real_can_activate_accel (GtkWidget *widget,
|
gtk_widget_real_can_activate_accel (GtkWidget *widget,
|
||||||
guint signal_id)
|
guint signal_id)
|
||||||
@@ -6283,6 +6378,26 @@ _gtk_widget_draw_internal (GtkWidget *widget,
|
|||||||
0, cr,
|
0, cr,
|
||||||
&result);
|
&result);
|
||||||
|
|
||||||
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
if (G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_BASELINES))
|
||||||
|
{
|
||||||
|
gint baseline = gtk_widget_get_allocated_baseline (widget);
|
||||||
|
gint width = gtk_widget_get_allocated_width (widget);
|
||||||
|
|
||||||
|
if (baseline != -1)
|
||||||
|
{
|
||||||
|
cairo_save (cr);
|
||||||
|
cairo_new_path (cr);
|
||||||
|
cairo_move_to (cr, 0, baseline+0.5);
|
||||||
|
cairo_line_to (cr, width, baseline+0.5);
|
||||||
|
cairo_set_line_width (cr, 1.0);
|
||||||
|
cairo_set_source_rgba (cr, 1.0, 0, 0, 0.25);
|
||||||
|
cairo_stroke (cr);
|
||||||
|
cairo_restore (cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cairo_status (cr) &&
|
if (cairo_status (cr) &&
|
||||||
_gtk_cairo_get_event (cr))
|
_gtk_cairo_get_event (cr))
|
||||||
{
|
{
|
||||||
@@ -11293,6 +11408,28 @@ gtk_widget_real_adjust_size_request (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_widget_real_adjust_baseline_request (GtkWidget *widget,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline)
|
||||||
|
{
|
||||||
|
const GtkWidgetAuxInfo *aux_info;
|
||||||
|
|
||||||
|
aux_info =_gtk_widget_get_aux_info_or_defaults (widget);
|
||||||
|
|
||||||
|
if (aux_info->height >= 0)
|
||||||
|
{
|
||||||
|
/* No baseline support for explicitly set height */
|
||||||
|
*minimum_baseline = -1;
|
||||||
|
*natural_baseline = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*minimum_baseline += aux_info->margin.top;
|
||||||
|
*natural_baseline += aux_info->margin.top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _gtk_widget_peek_request_cache:
|
* _gtk_widget_peek_request_cache:
|
||||||
*
|
*
|
||||||
@@ -13518,19 +13655,46 @@ gtk_widget_set_halign (GtkWidget *widget,
|
|||||||
g_object_notify (G_OBJECT (widget), "halign");
|
g_object_notify (G_OBJECT (widget), "halign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_widget_get_valign_with_baseline:
|
||||||
|
* @widget: a #GtkWidget
|
||||||
|
*
|
||||||
|
* Gets the value of the #GtkWidget:valign property, including
|
||||||
|
* %GTK_ALIGN_BASELINE.
|
||||||
|
*
|
||||||
|
* Returns: the vertical alignment of @widget
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
*/
|
||||||
|
GtkAlign
|
||||||
|
gtk_widget_get_valign_with_baseline (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_ALIGN_FILL);
|
||||||
|
return _gtk_widget_get_aux_info_or_defaults (widget)->valign;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_widget_get_valign:
|
* gtk_widget_get_valign:
|
||||||
* @widget: a #GtkWidget
|
* @widget: a #GtkWidget
|
||||||
*
|
*
|
||||||
* Gets the value of the #GtkWidget:valign property.
|
* Gets the value of the #GtkWidget:valign property.
|
||||||
*
|
*
|
||||||
* Returns: the vertical alignment of @widget
|
* For backwards compatibility reasons this method will never return
|
||||||
|
* %GTK_ALIGN_BASELINE, but instead it will convert it to
|
||||||
|
* %GTK_ALIGN_FILL. If your widget want to support baseline aligned
|
||||||
|
* children it must use gtk_widget_get_valign_with_baseline().
|
||||||
|
*
|
||||||
|
* Returns: the vertical alignment of @widget, ignoring baseline alignment
|
||||||
*/
|
*/
|
||||||
GtkAlign
|
GtkAlign
|
||||||
gtk_widget_get_valign (GtkWidget *widget)
|
gtk_widget_get_valign (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_ALIGN_FILL);
|
GtkAlign align;
|
||||||
return _gtk_widget_get_aux_info_or_defaults (widget)->valign;
|
|
||||||
|
align = gtk_widget_get_valign_with_baseline (widget);
|
||||||
|
if (align == GTK_ALIGN_BASELINE)
|
||||||
|
return GTK_ALIGN_FILL;
|
||||||
|
return align;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14307,6 +14471,27 @@ gtk_widget_get_allocated_height (GtkWidget *widget)
|
|||||||
return widget->priv->allocation.height;
|
return widget->priv->allocation.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_widget_get_allocated_baseline:
|
||||||
|
* @widget: the widget to query
|
||||||
|
*
|
||||||
|
* Returns the baseline that has currently been allocated to @widget.
|
||||||
|
* This function is intended to be used when implementing handlers
|
||||||
|
* for the #GtkWidget::draw function, and when allocating child
|
||||||
|
* widgets in #GtkWidget::size_allocate.
|
||||||
|
*
|
||||||
|
* Returns: the baseline of the @widget, or -1 if none
|
||||||
|
*
|
||||||
|
* Since: 3.10
|
||||||
|
**/
|
||||||
|
int
|
||||||
|
gtk_widget_get_allocated_baseline (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
|
||||||
|
|
||||||
|
return widget->priv->allocated_baseline;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_widget_get_requisition:
|
* gtk_widget_get_requisition:
|
||||||
* @widget: a #GtkWidget
|
* @widget: a #GtkWidget
|
||||||
|
|||||||
+33
-3
@@ -433,14 +433,23 @@ struct _GtkWidgetClass
|
|||||||
gboolean (* touch_event) (GtkWidget *widget,
|
gboolean (* touch_event) (GtkWidget *widget,
|
||||||
GdkEventTouch *event);
|
GdkEventTouch *event);
|
||||||
|
|
||||||
|
void (* get_preferred_height_and_baseline_for_width) (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
void (* adjust_baseline_request)(GtkWidget *widget,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
void (* adjust_baseline_allocation) (GtkWidget *widget,
|
||||||
|
gint *baseline);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
GtkWidgetClassPrivate *priv;
|
GtkWidgetClassPrivate *priv;
|
||||||
|
|
||||||
/* Padding for future expansion */
|
/* Padding for future expansion */
|
||||||
void (*_gtk_reserved2) (void);
|
|
||||||
void (*_gtk_reserved3) (void);
|
|
||||||
void (*_gtk_reserved4) (void);
|
|
||||||
void (*_gtk_reserved5) (void);
|
void (*_gtk_reserved5) (void);
|
||||||
void (*_gtk_reserved6) (void);
|
void (*_gtk_reserved6) (void);
|
||||||
void (*_gtk_reserved7) (void);
|
void (*_gtk_reserved7) (void);
|
||||||
@@ -498,6 +507,10 @@ void gtk_widget_size_request (GtkWidget *widget,
|
|||||||
GtkRequisition *requisition);
|
GtkRequisition *requisition);
|
||||||
void gtk_widget_size_allocate (GtkWidget *widget,
|
void gtk_widget_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation,
|
||||||
|
gint baseline);
|
||||||
|
|
||||||
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
|
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
|
||||||
void gtk_widget_get_preferred_width (GtkWidget *widget,
|
void gtk_widget_get_preferred_width (GtkWidget *widget,
|
||||||
@@ -514,9 +527,22 @@ void gtk_widget_get_preferred_width_for_height (GtkWidget *w
|
|||||||
gint height,
|
gint height,
|
||||||
gint *minimum_width,
|
gint *minimum_width,
|
||||||
gint *natural_width);
|
gint *natural_width);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_widget_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||||
|
gint width,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
void gtk_widget_get_preferred_size (GtkWidget *widget,
|
void gtk_widget_get_preferred_size (GtkWidget *widget,
|
||||||
GtkRequisition *minimum_size,
|
GtkRequisition *minimum_size,
|
||||||
GtkRequisition *natural_size);
|
GtkRequisition *natural_size);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
void gtk_widget_get_preferred_size_and_baseline (GtkWidget *widget,
|
||||||
|
GtkRequisition *minimum_size,
|
||||||
|
GtkRequisition *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
|
||||||
GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
|
GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
|
||||||
void gtk_widget_get_child_requisition (GtkWidget *widget,
|
void gtk_widget_get_child_requisition (GtkWidget *widget,
|
||||||
@@ -662,6 +688,8 @@ void gtk_widget_unregister_window (GtkWidget *widget,
|
|||||||
|
|
||||||
int gtk_widget_get_allocated_width (GtkWidget *widget);
|
int gtk_widget_get_allocated_width (GtkWidget *widget);
|
||||||
int gtk_widget_get_allocated_height (GtkWidget *widget);
|
int gtk_widget_get_allocated_height (GtkWidget *widget);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
int gtk_widget_get_allocated_baseline (GtkWidget *widget);
|
||||||
|
|
||||||
void gtk_widget_get_allocation (GtkWidget *widget,
|
void gtk_widget_get_allocation (GtkWidget *widget,
|
||||||
GtkAllocation *allocation);
|
GtkAllocation *allocation);
|
||||||
@@ -760,6 +788,8 @@ GtkAlign gtk_widget_get_halign (GtkWidget *widget);
|
|||||||
void gtk_widget_set_halign (GtkWidget *widget,
|
void gtk_widget_set_halign (GtkWidget *widget,
|
||||||
GtkAlign align);
|
GtkAlign align);
|
||||||
GtkAlign gtk_widget_get_valign (GtkWidget *widget);
|
GtkAlign gtk_widget_get_valign (GtkWidget *widget);
|
||||||
|
GDK_AVAILABLE_IN_3_10
|
||||||
|
GtkAlign gtk_widget_get_valign_with_baseline (GtkWidget *widget);
|
||||||
void gtk_widget_set_valign (GtkWidget *widget,
|
void gtk_widget_set_valign (GtkWidget *widget,
|
||||||
GtkAlign align);
|
GtkAlign align);
|
||||||
gint gtk_widget_get_margin_left (GtkWidget *widget);
|
gint gtk_widget_get_margin_left (GtkWidget *widget);
|
||||||
|
|||||||
@@ -69,7 +69,15 @@ void _gtk_widget_compute_size_for_orientation (GtkWidget *widget,
|
|||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
gint for_size,
|
gint for_size,
|
||||||
gint *minimum_size,
|
gint *minimum_size,
|
||||||
gint *natural_size);
|
gint *natural_size,
|
||||||
|
gint *minimum_baseline,
|
||||||
|
gint *natural_baseline);
|
||||||
|
void _gtk_widget_get_preferred_size_for_size (GtkWidget *widget,
|
||||||
|
GtkOrientation orientation,
|
||||||
|
gint size,
|
||||||
|
gint *minimum,
|
||||||
|
gint *natural);
|
||||||
|
gboolean _gtk_widget_has_baseline_support (GtkWidget *widget);
|
||||||
|
|
||||||
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
gboolean _gtk_widget_get_translation_to_window (GtkWidget *widget,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
|
|||||||
+181
-245
@@ -35,6 +35,7 @@
|
|||||||
#include "gtkwindowprivate.h"
|
#include "gtkwindowprivate.h"
|
||||||
#include "gtkaccelgroupprivate.h"
|
#include "gtkaccelgroupprivate.h"
|
||||||
#include "gtkbindings.h"
|
#include "gtkbindings.h"
|
||||||
|
#include "gtkcssshadowsvalueprivate.h"
|
||||||
#include "gtkkeyhash.h"
|
#include "gtkkeyhash.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkmnemonichash.h"
|
#include "gtkmnemonichash.h"
|
||||||
@@ -1188,6 +1189,18 @@ gtk_window_class_init (GtkWindowClass *klass)
|
|||||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_WINDOW_ACCESSIBLE);
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_WINDOW_ACCESSIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_window_get_maximized (GtkWindow *window)
|
||||||
|
{
|
||||||
|
GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
|
||||||
|
gboolean maximized = FALSE;
|
||||||
|
|
||||||
|
if (gdk_window)
|
||||||
|
maximized = (gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_MAXIMIZED);
|
||||||
|
|
||||||
|
return maximized;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_window_title_min_clicked (GtkWidget *widget, gpointer data)
|
gtk_window_title_min_clicked (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
@@ -1200,9 +1213,8 @@ static void
|
|||||||
gtk_window_title_max_clicked (GtkWidget *widget, gpointer data)
|
gtk_window_title_max_clicked (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
GtkWindow *window = (GtkWindow *)data;
|
GtkWindow *window = (GtkWindow *)data;
|
||||||
GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (widget));
|
|
||||||
|
|
||||||
if (state & GDK_WINDOW_STATE_MAXIMIZED)
|
if (gtk_window_get_maximized (window))
|
||||||
gtk_window_unmaximize (window);
|
gtk_window_unmaximize (window);
|
||||||
else
|
else
|
||||||
gtk_window_maximize (window);
|
gtk_window_maximize (window);
|
||||||
@@ -4978,15 +4990,13 @@ static void
|
|||||||
update_window_buttons (GtkWindow *window)
|
update_window_buttons (GtkWindow *window)
|
||||||
{
|
{
|
||||||
GtkWindowPrivate *priv = window->priv;
|
GtkWindowPrivate *priv = window->priv;
|
||||||
GdkWindow *win;
|
gboolean maximized;
|
||||||
gboolean maximized = FALSE;
|
|
||||||
|
|
||||||
if (priv->custom_title)
|
if (priv->custom_title)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
win = gtk_widget_get_window (GTK_WIDGET (window));
|
maximized = gtk_window_get_maximized (window);
|
||||||
if (win != NULL)
|
|
||||||
maximized = gdk_window_get_state (win) & GDK_WINDOW_STATE_MAXIMIZED;
|
|
||||||
if (priv->decorated &&
|
if (priv->decorated &&
|
||||||
priv->client_decorated &&
|
priv->client_decorated &&
|
||||||
!priv->fullscreen &&
|
!priv->fullscreen &&
|
||||||
@@ -5062,7 +5072,6 @@ update_window_buttons (GtkWindow *window)
|
|||||||
image = gtk_image_new_from_icon_name ("window-minimize-symbolic", GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_icon_name ("window-minimize-symbolic", GTK_ICON_SIZE_MENU);
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "window-minimize-button");
|
|
||||||
gtk_widget_set_can_focus (button, FALSE);
|
gtk_widget_set_can_focus (button, FALSE);
|
||||||
gtk_widget_show_all (button);
|
gtk_widget_show_all (button);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
@@ -5073,21 +5082,13 @@ update_window_buttons (GtkWindow *window)
|
|||||||
priv->resizable &&
|
priv->resizable &&
|
||||||
priv->gdk_type_hint == GDK_WINDOW_TYPE_HINT_NORMAL)
|
priv->gdk_type_hint == GDK_WINDOW_TYPE_HINT_NORMAL)
|
||||||
{
|
{
|
||||||
GdkWindow *win;
|
|
||||||
gboolean maximized;
|
|
||||||
const gchar *icon_name;
|
const gchar *icon_name;
|
||||||
|
|
||||||
win = gtk_widget_get_window (GTK_WIDGET (window));
|
|
||||||
if (win != NULL)
|
|
||||||
maximized = gdk_window_get_state (win) & GDK_WINDOW_STATE_MAXIMIZED;
|
|
||||||
else
|
|
||||||
maximized = FALSE;
|
|
||||||
icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
|
icon_name = maximized ? "window-restore-symbolic" : "window-maximize-symbolic";
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "window-maximize-button");
|
|
||||||
gtk_widget_set_can_focus (button, FALSE);
|
gtk_widget_set_can_focus (button, FALSE);
|
||||||
gtk_widget_show_all (button);
|
gtk_widget_show_all (button);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
@@ -5102,7 +5103,6 @@ update_window_buttons (GtkWindow *window)
|
|||||||
image = gtk_image_new_from_icon_name ("window-delete-symbolic", GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_icon_name ("window-delete-symbolic", GTK_ICON_SIZE_MENU);
|
||||||
g_object_set (image, "use-fallback", TRUE, NULL);
|
g_object_set (image, "use-fallback", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (button), image);
|
gtk_container_add (GTK_CONTAINER (button), image);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "window-close-button");
|
|
||||||
gtk_widget_set_can_focus (button, FALSE);
|
gtk_widget_set_can_focus (button, FALSE);
|
||||||
gtk_widget_show_all (button);
|
gtk_widget_show_all (button);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
@@ -5133,22 +5133,6 @@ update_window_buttons (GtkWindow *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
set_client_decorated (GtkWidget *widget,
|
|
||||||
gboolean value)
|
|
||||||
{
|
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
|
||||||
priv->client_decorated = value;
|
|
||||||
|
|
||||||
if (value)
|
|
||||||
gtk_style_context_add_class (context, "client-decorated");
|
|
||||||
else
|
|
||||||
gtk_style_context_remove_class (context, "client-decorated");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_decoration (GtkWidget *widget)
|
create_decoration (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
@@ -5169,7 +5153,7 @@ create_decoration (GtkWidget *widget)
|
|||||||
|
|
||||||
#ifdef GDK_WINDOWING_WAYLAND
|
#ifdef GDK_WINDOWING_WAYLAND
|
||||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||||
set_client_decorated (widget, TRUE);
|
priv->client_decorated = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!priv->client_decorated &&
|
if (!priv->client_decorated &&
|
||||||
@@ -5182,7 +5166,7 @@ create_decoration (GtkWidget *widget)
|
|||||||
if (visual)
|
if (visual)
|
||||||
{
|
{
|
||||||
gtk_widget_set_visual (widget, visual);
|
gtk_widget_set_visual (widget, visual);
|
||||||
set_client_decorated (widget, TRUE);
|
priv->client_decorated = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6065,92 +6049,88 @@ set_grip_position (GtkWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_decoration_borders (GtkWidget *widget,
|
sum_borders (GtkBorder *one,
|
||||||
GtkBorder *title_border,
|
GtkBorder *two)
|
||||||
GtkBorder *window_border,
|
|
||||||
GtkBorder *outer_border)
|
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
one->top += two->top;
|
||||||
GtkStateFlags state;
|
one->right += two->right;
|
||||||
GdkWindow *window;
|
one->bottom += two->bottom;
|
||||||
gboolean maximized = FALSE;
|
one->left += two->left;
|
||||||
const GtkBorder empty = { 0 };
|
|
||||||
GtkBorder outer;
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
|
||||||
state = gtk_style_context_get_state (context);
|
|
||||||
window = gtk_widget_get_window (widget);
|
|
||||||
if (window != NULL)
|
|
||||||
maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
|
|
||||||
|
|
||||||
if (title_border != NULL)
|
|
||||||
{
|
|
||||||
gtk_style_context_save (context);
|
|
||||||
gtk_style_context_add_class (context, "titlebar");
|
|
||||||
gtk_style_context_get_border (context, state, title_border);
|
|
||||||
gtk_style_context_restore (context);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window_border != NULL)
|
|
||||||
{
|
|
||||||
if (maximized)
|
|
||||||
{
|
|
||||||
*window_border = empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_style_context_save (context);
|
|
||||||
gtk_style_context_add_class (context, "window-border");
|
|
||||||
gtk_style_context_get_border (context, state, window_border);
|
|
||||||
gtk_style_context_restore (context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window_border != NULL || outer_border != NULL)
|
|
||||||
{
|
|
||||||
if (maximized)
|
|
||||||
{
|
|
||||||
outer = empty;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_style_context_save (context);
|
|
||||||
gtk_style_context_add_class (context, "window-outer-border");
|
|
||||||
gtk_style_context_get_border (context, state, &outer);
|
|
||||||
gtk_style_context_restore (context);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outer_border != NULL)
|
|
||||||
{
|
|
||||||
*outer_border = outer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window_border->left += outer.left;
|
|
||||||
window_border->right += outer.right;
|
|
||||||
window_border->top += outer.top;
|
|
||||||
window_border->bottom += outer.bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_border_windows (GtkWindow *window, GtkBorder *border)
|
get_decoration_size (GtkWidget *widget,
|
||||||
|
GtkBorder *decorations)
|
||||||
|
{
|
||||||
|
GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
|
||||||
|
GtkBorder border = { 0 };
|
||||||
|
GtkBorder margin;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkStateFlags state;
|
||||||
|
GtkCssValue *shadows;
|
||||||
|
|
||||||
|
*decorations = border;
|
||||||
|
|
||||||
|
if (!priv->client_decorated)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gtk_window_get_maximized (GTK_WINDOW (widget)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
state = gtk_widget_get_state_flags (widget);
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BACKGROUND);
|
||||||
|
gtk_style_context_add_class (context, "window-frame");
|
||||||
|
|
||||||
|
/* Always sum border + padding */
|
||||||
|
gtk_style_context_get_border (context, state, decorations);
|
||||||
|
gtk_style_context_get_padding (context, state, &border);
|
||||||
|
sum_borders (decorations, &border);
|
||||||
|
|
||||||
|
/* Calculate the size of the drop shadows ... */
|
||||||
|
shadows = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW);
|
||||||
|
_gtk_css_shadows_value_get_extents (shadows, &border);
|
||||||
|
|
||||||
|
/* ... and compare it to the margin size, which we use for resize grips */
|
||||||
|
gtk_style_context_get_margin (context, state, &margin);
|
||||||
|
|
||||||
|
border.top = MAX (border.top, margin.top);
|
||||||
|
border.right = MAX (border.right, margin.right);
|
||||||
|
border.bottom = MAX (border.bottom, margin.bottom);
|
||||||
|
border.left = MAX (border.left, margin.left);
|
||||||
|
|
||||||
|
sum_borders (decorations, &border);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_border_windows (GtkWindow *window)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = (GtkWidget *)window;
|
GtkWidget *widget = (GtkWidget *)window;
|
||||||
GtkWindowPrivate *priv = window->priv;
|
GtkWindowPrivate *priv = window->priv;
|
||||||
GdkWindowState state;
|
|
||||||
gboolean resize_h, resize_v;
|
gboolean resize_h, resize_v;
|
||||||
gint handle;
|
gint handle;
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
cairo_rectangle_int_t rect;
|
cairo_rectangle_int_t rect;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
GtkBorder border;
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
if (priv->border_window[0] == NULL)
|
if (priv->border_window[0] == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
state = gdk_window_get_state (gtk_widget_get_window (widget));
|
context = gtk_widget_get_style_context (widget);
|
||||||
if (!priv->resizable || (state & GDK_WINDOW_STATE_MAXIMIZED))
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_add_class (context, "window-frame");
|
||||||
|
gtk_style_context_get_margin (context,
|
||||||
|
gtk_widget_get_state_flags (widget),
|
||||||
|
&border);
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
|
if (!priv->resizable || gtk_window_get_maximized (window))
|
||||||
{
|
{
|
||||||
resize_h = resize_v = FALSE;
|
resize_h = resize_v = FALSE;
|
||||||
}
|
}
|
||||||
@@ -6174,31 +6154,31 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
"decoration-resize-handle", &handle,
|
"decoration-resize-handle", &handle,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
width = gtk_widget_get_allocated_width (widget) - (border->left + border->right);
|
width = gtk_widget_get_allocated_width (widget) - (border.left + border.right);
|
||||||
height = gtk_widget_get_allocated_height (widget) - (border->top + border->bottom);
|
height = gtk_widget_get_allocated_height (widget) - (border.top + border.bottom);
|
||||||
|
|
||||||
if (resize_h && resize_v)
|
if (resize_h && resize_v)
|
||||||
{
|
{
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH_WEST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH_WEST],
|
||||||
0, 0,
|
0, 0,
|
||||||
border->left + handle, border->top + handle);
|
border.left + handle, border.top + handle);
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH_EAST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH_EAST],
|
||||||
border->left + width - handle, 0,
|
border.left + width - handle, 0,
|
||||||
border->right + handle, border->top + handle);
|
border.right + handle, border.top + handle);
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH_WEST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH_WEST],
|
||||||
0, border->top + height - handle,
|
0, border.top + height - handle,
|
||||||
border->left + handle, border->bottom + handle);
|
border.left + handle, border.bottom + handle);
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH_EAST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH_EAST],
|
||||||
border->left + width - handle, border->top + height - handle,
|
border.left + width - handle, border.top + height - handle,
|
||||||
border->right + handle, border->bottom + handle);
|
border.right + handle, border.bottom + handle);
|
||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = border->left + handle;
|
rect.width = border.left + handle;
|
||||||
rect.height = border->top + handle;
|
rect.height = border.top + handle;
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = cairo_region_create_rectangle (&rect);
|
||||||
rect.x = border->left;
|
rect.x = border.left;
|
||||||
rect.y = border->top;
|
rect.y = border.top;
|
||||||
rect.width = handle;
|
rect.width = handle;
|
||||||
rect.height = handle;
|
rect.height = handle;
|
||||||
cairo_region_subtract_rectangle (region, &rect);
|
cairo_region_subtract_rectangle (region, &rect);
|
||||||
@@ -6208,11 +6188,11 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = border->right + handle;
|
rect.width = border.right + handle;
|
||||||
rect.height = border->top + handle;
|
rect.height = border.top + handle;
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = cairo_region_create_rectangle (&rect);
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = border->top;
|
rect.y = border.top;
|
||||||
rect.width = handle;
|
rect.width = handle;
|
||||||
rect.height = handle;
|
rect.height = handle;
|
||||||
cairo_region_subtract_rectangle (region, &rect);
|
cairo_region_subtract_rectangle (region, &rect);
|
||||||
@@ -6222,10 +6202,10 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = border->left + handle;
|
rect.width = border.left + handle;
|
||||||
rect.height = border->bottom + handle;
|
rect.height = border.bottom + handle;
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = cairo_region_create_rectangle (&rect);
|
||||||
rect.x = border->left;
|
rect.x = border.left;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = handle;
|
rect.width = handle;
|
||||||
rect.height = handle;
|
rect.height = handle;
|
||||||
@@ -6236,8 +6216,8 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = border->right + handle;
|
rect.width = border.right + handle;
|
||||||
rect.height = border->bottom + handle;
|
rect.height = border.bottom + handle;
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = cairo_region_create_rectangle (&rect);
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
@@ -6267,21 +6247,21 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
|
|
||||||
if (resize_h)
|
if (resize_h)
|
||||||
{
|
{
|
||||||
x = border->left + handle;
|
x = border.left + handle;
|
||||||
w = width - 2 * handle;
|
w = width - 2 * handle;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
w = width + border->left + border->right;
|
w = width + border.left + border.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_NORTH],
|
||||||
x, 0,
|
x, 0,
|
||||||
w, border->top);
|
w, border.top);
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_SOUTH],
|
||||||
x, border->top + height,
|
x, border.top + height,
|
||||||
w, border->bottom);
|
w, border.bottom);
|
||||||
|
|
||||||
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_NORTH]);
|
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_NORTH]);
|
||||||
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_SOUTH]);
|
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_SOUTH]);
|
||||||
@@ -6298,22 +6278,22 @@ update_border_windows (GtkWindow *window, GtkBorder *border)
|
|||||||
|
|
||||||
if (resize_v)
|
if (resize_v)
|
||||||
{
|
{
|
||||||
y = border->top + handle;
|
y = border.top + handle;
|
||||||
h = height - 2 * handle;
|
h = height - 2 * handle;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y = 0;
|
y = 0;
|
||||||
h = height + border->top + border->bottom;
|
h = height + border.top + border.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_WEST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_WEST],
|
||||||
0, y,
|
0, y,
|
||||||
border->left, h);
|
border.left, h);
|
||||||
|
|
||||||
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_EAST],
|
gdk_window_move_resize (priv->border_window[GDK_WINDOW_EDGE_EAST],
|
||||||
border->left + width, y,
|
border.left + width, y,
|
||||||
border->right, h);
|
border.right, h);
|
||||||
|
|
||||||
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_WEST]);
|
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_WEST]);
|
||||||
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_EAST]);
|
gdk_window_show (priv->border_window[GDK_WINDOW_EDGE_EAST]);
|
||||||
@@ -6353,7 +6333,6 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
GtkWindowPrivate *priv = window->priv;
|
GtkWindowPrivate *priv = window->priv;
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
GtkBorder title_border = { 0 };
|
|
||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
gint title_height = 0;
|
gint title_height = 0;
|
||||||
|
|
||||||
@@ -6362,13 +6341,7 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
|
|
||||||
gtk_widget_set_allocation (widget, allocation);
|
gtk_widget_set_allocation (widget, allocation);
|
||||||
|
|
||||||
if (priv->title_box != NULL && priv->client_decorated)
|
get_decoration_size (widget, &window_border);
|
||||||
get_decoration_borders (widget, &title_border, &window_border, NULL);
|
|
||||||
else if (priv->client_decorated)
|
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
else if (priv->title_box != NULL)
|
|
||||||
get_decoration_borders (widget, &title_border, NULL, NULL);
|
|
||||||
|
|
||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
|
||||||
|
|
||||||
child_allocation.x = 0;
|
child_allocation.x = 0;
|
||||||
@@ -6382,11 +6355,10 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
GtkAllocation title_allocation;
|
GtkAllocation title_allocation;
|
||||||
|
|
||||||
title_allocation.x = title_border.left + window_border.left;
|
title_allocation.x = window_border.left;
|
||||||
title_allocation.y = title_border.top + window_border.top;
|
title_allocation.y = window_border.top;
|
||||||
title_allocation.width =
|
title_allocation.width =
|
||||||
MAX (1, (gint) allocation->width -
|
MAX (1, (gint) allocation->width -
|
||||||
title_border.left - title_border.right -
|
|
||||||
window_border.left - window_border.right);
|
window_border.left - window_border.right);
|
||||||
|
|
||||||
gtk_widget_get_preferred_height_for_width (priv->title_box,
|
gtk_widget_get_preferred_height_for_width (priv->title_box,
|
||||||
@@ -6403,13 +6375,9 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
!priv->fullscreen)
|
!priv->fullscreen)
|
||||||
{
|
{
|
||||||
child_allocation.x += window_border.left;
|
child_allocation.x += window_border.left;
|
||||||
child_allocation.y += window_border.top +
|
child_allocation.y += window_border.top + title_height;
|
||||||
title_height +
|
|
||||||
title_border.top +
|
|
||||||
title_border.bottom;
|
|
||||||
child_allocation.width -= window_border.left + window_border.right;
|
child_allocation.width -= window_border.left + window_border.right;
|
||||||
child_allocation.height -= window_border.top + window_border.bottom +
|
child_allocation.height -= window_border.top + window_border.bottom +
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
title_height;
|
title_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6428,7 +6396,7 @@ _gtk_window_set_allocation (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
update_grip_visibility (window);
|
update_grip_visibility (window);
|
||||||
set_grip_position (window);
|
set_grip_position (window);
|
||||||
update_border_windows (window, &window_border);
|
update_border_windows (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6575,6 +6543,7 @@ gtk_window_style_updated (GtkWidget *widget)
|
|||||||
{
|
{
|
||||||
GtkWindow *window = GTK_WINDOW (widget);
|
GtkWindow *window = GTK_WINDOW (widget);
|
||||||
GtkWindowPrivate *priv = window->priv;
|
GtkWindowPrivate *priv = window->priv;
|
||||||
|
GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 };
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_window_parent_class)->style_updated (widget);
|
GTK_WIDGET_CLASS (gtk_window_parent_class)->style_updated (widget);
|
||||||
@@ -6587,6 +6556,13 @@ gtk_window_style_updated (GtkWidget *widget)
|
|||||||
|
|
||||||
set_grip_shape (window);
|
set_grip_shape (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gtk_widget_get_realized (widget))
|
||||||
|
{
|
||||||
|
gdk_window_set_background_rgba (gtk_widget_get_window (widget),
|
||||||
|
&transparent);
|
||||||
|
gtk_widget_queue_resize (widget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -6804,12 +6780,10 @@ gtk_window_get_resize_grip_area (GtkWindow *window,
|
|||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
|
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
|
||||||
|
|
||||||
if (!window->priv->has_resize_grip)
|
if (!priv->has_resize_grip)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (priv->client_decorated)
|
get_decoration_size (widget, &window_border);
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
@@ -7029,7 +7003,7 @@ gtk_window_button_press_event (GtkWidget *widget,
|
|||||||
GtkWindowRegion region;
|
GtkWindowRegion region;
|
||||||
gboolean maximized;
|
gboolean maximized;
|
||||||
|
|
||||||
maximized = gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_MAXIMIZED;
|
maximized = gtk_window_get_maximized (window);
|
||||||
|
|
||||||
gdk_window_get_user_data (event->window, (gpointer *)&src);
|
gdk_window_get_user_data (event->window, (gpointer *)&src);
|
||||||
if (src && src != widget)
|
if (src && src != widget)
|
||||||
@@ -7459,7 +7433,6 @@ gtk_window_get_preferred_width (GtkWidget *widget,
|
|||||||
guint border_width;
|
guint border_width;
|
||||||
gint title_min = 0, title_nat = 0;
|
gint title_min = 0, title_nat = 0;
|
||||||
gint child_min = 0, child_nat = 0;
|
gint child_min = 0, child_nat = 0;
|
||||||
GtkBorder title_border = { 0, };
|
|
||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
|
|
||||||
window = GTK_WINDOW (widget);
|
window = GTK_WINDOW (widget);
|
||||||
@@ -7471,22 +7444,15 @@ gtk_window_get_preferred_width (GtkWidget *widget,
|
|||||||
if (priv->decorated &&
|
if (priv->decorated &&
|
||||||
!priv->fullscreen)
|
!priv->fullscreen)
|
||||||
{
|
{
|
||||||
|
get_decoration_size (widget, &window_border);
|
||||||
|
|
||||||
if (priv->title_box != NULL)
|
if (priv->title_box != NULL)
|
||||||
{
|
gtk_widget_get_preferred_width (priv->title_box,
|
||||||
gtk_widget_get_preferred_width (priv->title_box,
|
&title_min, &title_nat);
|
||||||
&title_min, &title_nat);
|
|
||||||
get_decoration_borders (widget, &title_border, &window_border, NULL);
|
|
||||||
}
|
|
||||||
else if (priv->client_decorated)
|
|
||||||
{
|
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
title_min += border_width * 2 +
|
title_min += border_width * 2 +
|
||||||
title_border.left + title_border.right +
|
|
||||||
window_border.left + window_border.right;
|
window_border.left + window_border.right;
|
||||||
title_nat += border_width * 2 +
|
title_nat += border_width * 2 +
|
||||||
title_border.left + title_border.right +
|
|
||||||
window_border.left + window_border.right;
|
window_border.left + window_border.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7516,7 +7482,6 @@ gtk_window_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
guint border_width;
|
guint border_width;
|
||||||
gint title_min = 0, title_nat = 0;
|
gint title_min = 0, title_nat = 0;
|
||||||
gint child_min = 0, child_nat = 0;
|
gint child_min = 0, child_nat = 0;
|
||||||
GtkBorder title_border = { 0, };
|
|
||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
|
|
||||||
window = GTK_WINDOW (widget);
|
window = GTK_WINDOW (widget);
|
||||||
@@ -7528,23 +7493,16 @@ gtk_window_get_preferred_width_for_height (GtkWidget *widget,
|
|||||||
if (priv->decorated &&
|
if (priv->decorated &&
|
||||||
!priv->fullscreen)
|
!priv->fullscreen)
|
||||||
{
|
{
|
||||||
|
get_decoration_size (widget, &window_border);
|
||||||
|
|
||||||
if (priv->title_box != NULL)
|
if (priv->title_box != NULL)
|
||||||
{
|
gtk_widget_get_preferred_width_for_height (priv->title_box,
|
||||||
gtk_widget_get_preferred_width_for_height (priv->title_box,
|
height,
|
||||||
height,
|
&title_min, &title_nat);
|
||||||
&title_min, &title_nat);
|
|
||||||
get_decoration_borders (widget, &title_border, &window_border, NULL);
|
|
||||||
}
|
|
||||||
else if (priv->client_decorated)
|
|
||||||
{
|
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
title_min += border_width * 2 +
|
title_min += border_width * 2 +
|
||||||
title_border.left + title_border.right +
|
|
||||||
window_border.left + window_border.right;
|
window_border.left + window_border.right;
|
||||||
title_nat += border_width * 2 +
|
title_nat += border_width * 2 +
|
||||||
title_border.left + title_border.right +
|
|
||||||
window_border.left + window_border.right;
|
window_border.left + window_border.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7574,7 +7532,6 @@ gtk_window_get_preferred_height (GtkWidget *widget,
|
|||||||
guint border_width;
|
guint border_width;
|
||||||
int title_min = 0;
|
int title_min = 0;
|
||||||
int title_height = 0;
|
int title_height = 0;
|
||||||
GtkBorder title_border = { 0, };
|
|
||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
|
|
||||||
window = GTK_WINDOW (widget);
|
window = GTK_WINDOW (widget);
|
||||||
@@ -7589,24 +7546,17 @@ gtk_window_get_preferred_height (GtkWidget *widget,
|
|||||||
if (priv->decorated &&
|
if (priv->decorated &&
|
||||||
!priv->fullscreen)
|
!priv->fullscreen)
|
||||||
{
|
{
|
||||||
|
get_decoration_size (widget, &window_border);
|
||||||
|
|
||||||
if (priv->title_box != NULL)
|
if (priv->title_box != NULL)
|
||||||
{
|
gtk_widget_get_preferred_height (priv->title_box,
|
||||||
gtk_widget_get_preferred_height (priv->title_box,
|
&title_min,
|
||||||
&title_min,
|
&title_height);
|
||||||
&title_height);
|
|
||||||
get_decoration_borders (widget, &title_border, &window_border, NULL);
|
|
||||||
}
|
|
||||||
else if (priv->client_decorated)
|
|
||||||
{
|
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
*minimum_size = title_min +
|
*minimum_size = title_min +
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
window_border.top + window_border.bottom;
|
window_border.top + window_border.bottom;
|
||||||
|
|
||||||
*natural_size = title_height +
|
*natural_size = title_height +
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
window_border.top + window_border.bottom;
|
window_border.top + window_border.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7633,7 +7583,6 @@ gtk_window_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
guint border_width;
|
guint border_width;
|
||||||
int title_min = 0;
|
int title_min = 0;
|
||||||
int title_height = 0;
|
int title_height = 0;
|
||||||
GtkBorder title_border = { 0, };
|
|
||||||
GtkBorder window_border = { 0 };
|
GtkBorder window_border = { 0 };
|
||||||
|
|
||||||
window = GTK_WINDOW (widget);
|
window = GTK_WINDOW (widget);
|
||||||
@@ -7648,25 +7597,18 @@ gtk_window_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
if (priv->decorated &&
|
if (priv->decorated &&
|
||||||
!priv->fullscreen)
|
!priv->fullscreen)
|
||||||
{
|
{
|
||||||
|
get_decoration_size (widget, &window_border);
|
||||||
|
|
||||||
if (priv->title_box != NULL)
|
if (priv->title_box != NULL)
|
||||||
{
|
gtk_widget_get_preferred_height_for_width (priv->title_box,
|
||||||
gtk_widget_get_preferred_height_for_width (priv->title_box,
|
width,
|
||||||
width,
|
&title_min,
|
||||||
&title_min,
|
&title_height);
|
||||||
&title_height);
|
|
||||||
get_decoration_borders (widget, &title_border, &window_border, NULL);
|
|
||||||
}
|
|
||||||
else if (priv->client_decorated)
|
|
||||||
{
|
|
||||||
get_decoration_borders (widget, NULL, &window_border, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
*minimum_size = title_min +
|
*minimum_size = title_min +
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
window_border.top + window_border.bottom;
|
window_border.top + window_border.bottom;
|
||||||
|
|
||||||
*natural_size = title_height +
|
*natural_size = title_height +
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
window_border.top + window_border.bottom;
|
window_border.top + window_border.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7773,7 +7715,6 @@ gtk_window_do_popup (GtkWindow *window,
|
|||||||
GdkEventButton *event)
|
GdkEventButton *event)
|
||||||
{
|
{
|
||||||
GtkWindowPrivate *priv = window->priv;
|
GtkWindowPrivate *priv = window->priv;
|
||||||
GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
|
|
||||||
GtkWidget *menuitem;
|
GtkWidget *menuitem;
|
||||||
|
|
||||||
if (priv->popup_menu)
|
if (priv->popup_menu)
|
||||||
@@ -7793,7 +7734,7 @@ gtk_window_do_popup (GtkWindow *window,
|
|||||||
G_CALLBACK (minimize_window_clicked), window);
|
G_CALLBACK (minimize_window_clicked), window);
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), menuitem);
|
gtk_menu_shell_append (GTK_MENU_SHELL (priv->popup_menu), menuitem);
|
||||||
|
|
||||||
menuitem = gtk_menu_item_new_with_label (state & GDK_WINDOW_STATE_MAXIMIZED ? _("Unmaximize") : _("Maximize"));
|
menuitem = gtk_menu_item_new_with_label (gtk_window_get_maximized (window) ? _("Unmaximize") : _("Maximize"));
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
if (!priv->resizable ||
|
if (!priv->resizable ||
|
||||||
priv->gdk_type_hint != GDK_WINDOW_TYPE_HINT_NORMAL)
|
priv->gdk_type_hint != GDK_WINDOW_TYPE_HINT_NORMAL)
|
||||||
@@ -8881,46 +8822,40 @@ gtk_window_draw (GtkWidget *widget,
|
|||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkBorder title_border = { 0 };
|
GtkBorder window_border;
|
||||||
GtkBorder inner_border = { 0 };
|
|
||||||
GtkBorder outer_border = { 0 };
|
|
||||||
gint title_height;
|
gint title_height;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
|
get_decoration_size (widget, &window_border);
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
get_decoration_borders (widget, &title_border, &inner_border, &outer_border);
|
|
||||||
|
|
||||||
if (!gtk_widget_get_app_paintable (widget) &&
|
if (!gtk_widget_get_app_paintable (widget) &&
|
||||||
gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
||||||
{
|
{
|
||||||
if (priv->client_decorated &&
|
if (priv->client_decorated &&
|
||||||
priv->decorated &&
|
priv->decorated &&
|
||||||
!priv->fullscreen &&
|
!priv->fullscreen &&
|
||||||
!(gdk_window_get_state (gtk_widget_get_window (widget)) & GDK_WINDOW_STATE_MAXIMIZED))
|
!gtk_window_get_maximized (GTK_WINDOW (widget)))
|
||||||
{
|
{
|
||||||
gtk_style_context_save (context);
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "window-border");
|
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BACKGROUND);
|
||||||
|
gtk_style_context_add_class (context, "window-frame");
|
||||||
|
|
||||||
gtk_render_background (context, cr,
|
gtk_render_background (context, cr,
|
||||||
inner_border.left + outer_border.left,
|
window_border.left, window_border.top,
|
||||||
inner_border.top + outer_border.top,
|
|
||||||
allocation.width -
|
allocation.width -
|
||||||
(inner_border.left + inner_border.right +
|
(window_border.left + window_border.right),
|
||||||
outer_border.left + outer_border.right),
|
|
||||||
allocation.height -
|
allocation.height -
|
||||||
(inner_border.top + inner_border.bottom +
|
(window_border.top + window_border.bottom));
|
||||||
outer_border.top + outer_border.bottom));
|
|
||||||
gtk_render_frame (context, cr,
|
gtk_render_frame (context, cr,
|
||||||
outer_border.left,
|
window_border.left, window_border.top,
|
||||||
outer_border.top,
|
allocation.width -
|
||||||
allocation.width - (outer_border.left + outer_border.right),
|
(window_border.left + window_border.right),
|
||||||
allocation.height - (outer_border.top + outer_border.bottom));
|
allocation.height -
|
||||||
gtk_style_context_remove_class (context, "window-border");
|
(window_border.top + window_border.bottom));
|
||||||
gtk_style_context_add_class (context, "window-outer-border");
|
|
||||||
gtk_render_frame (context, cr,
|
|
||||||
0, 0, allocation.width, allocation.height);
|
|
||||||
gtk_style_context_restore (context);
|
gtk_style_context_restore (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8928,22 +8863,23 @@ gtk_window_draw (GtkWidget *widget,
|
|||||||
title_height = gtk_widget_get_allocated_height (priv->title_box);
|
title_height = gtk_widget_get_allocated_height (priv->title_box);
|
||||||
else
|
else
|
||||||
title_height = 0;
|
title_height = 0;
|
||||||
gtk_style_context_save (context);
|
|
||||||
gtk_style_context_add_class (context, "window-content");
|
|
||||||
gtk_render_background (context, cr,
|
gtk_render_background (context, cr,
|
||||||
inner_border.left + outer_border.left,
|
window_border.left,
|
||||||
inner_border.top + outer_border.top +
|
window_border.top + title_height,
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
title_height,
|
|
||||||
allocation.width -
|
allocation.width -
|
||||||
(inner_border.left + inner_border.right +
|
(window_border.left + window_border.right),
|
||||||
outer_border.left + outer_border.right),
|
|
||||||
allocation.height -
|
allocation.height -
|
||||||
(inner_border.top + inner_border.bottom +
|
(window_border.top + window_border.bottom +
|
||||||
outer_border.top + outer_border.bottom +
|
|
||||||
title_border.top + title_border.bottom +
|
|
||||||
title_height));
|
title_height));
|
||||||
gtk_style_context_restore (context);
|
gtk_render_frame (context, cr,
|
||||||
|
window_border.left,
|
||||||
|
window_border.top + title_height,
|
||||||
|
allocation.width -
|
||||||
|
(window_border.left + window_border.right),
|
||||||
|
allocation.height -
|
||||||
|
(window_border.top + window_border.bottom +
|
||||||
|
title_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_WIDGET_CLASS (gtk_window_parent_class)->draw)
|
if (GTK_WIDGET_CLASS (gtk_window_parent_class)->draw)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
CC = @CC_FOR_BUILD@
|
CC = @CC_FOR_BUILD@
|
||||||
CFLAGS = @CFLAGS_FOR_BUILD@
|
AM_CFLAGS = @CFLAGS_FOR_BUILD@
|
||||||
CPP = @CPP_FOR_BUILD@
|
CPP = @CPP_FOR_BUILD@
|
||||||
CPPFLAGS = @CPPFLAGS_FOR_BUILD@
|
AM_CPPFLAGS = @CPPFLAGS_FOR_BUILD@
|
||||||
LDFLAGS = @LDFLAGS_FOR_BUILD@
|
AM_LDFLAGS = @LDFLAGS_FOR_BUILD@
|
||||||
|
|
||||||
if CROSS_COMPILING
|
if CROSS_COMPILING
|
||||||
if !USE_EXTERNAL_ICON_CACHE
|
if !USE_EXTERNAL_ICON_CACHE
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ gtk/gtkrecentchooser.c
|
|||||||
gtk/gtkrecentchooserdefault.c
|
gtk/gtkrecentchooserdefault.c
|
||||||
gtk/gtkrecentchoosermenu.c
|
gtk/gtkrecentchoosermenu.c
|
||||||
gtk/gtkrecentmanager.c
|
gtk/gtkrecentmanager.c
|
||||||
|
gtk/gtkrevealer.c
|
||||||
gtk/gtkscalebutton.c
|
gtk/gtkscalebutton.c
|
||||||
gtk/gtkscale.c
|
gtk/gtkscale.c
|
||||||
gtk/gtkscrollable.c
|
gtk/gtkscrollable.c
|
||||||
@@ -206,6 +207,8 @@ gtk/gtksizegroup.c
|
|||||||
gtk/gtksocket.c
|
gtk/gtksocket.c
|
||||||
gtk/gtkspinbutton.c
|
gtk/gtkspinbutton.c
|
||||||
gtk/gtkspinner.c
|
gtk/gtkspinner.c
|
||||||
|
gtk/gtkstack.c
|
||||||
|
gtk/gtkstackswitcher.c
|
||||||
gtk/gtkstatusbar.c
|
gtk/gtkstatusbar.c
|
||||||
gtk/gtkstatusicon.c
|
gtk/gtkstatusicon.c
|
||||||
gtk/gtkstock.c
|
gtk/gtkstock.c
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
demos/gtk-demo/demo.ui
|
demos/gtk-demo/demo.ui
|
||||||
demos/gtk-demo/menus.ui
|
demos/gtk-demo/menus.ui
|
||||||
|
demos/gtk-demo/stack.ui
|
||||||
demos/gtk-demo/theming.ui
|
demos/gtk-demo/theming.ui
|
||||||
demos/widget-factory/widget-factory.ui
|
demos/widget-factory/widget-factory.ui
|
||||||
examples/bloatpad.c
|
examples/bloatpad.c
|
||||||
|
|||||||
+755
-670
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -195,6 +195,7 @@ gtk/gtkrecentchooser.c
|
|||||||
gtk/gtkrecentchooserdefault.c
|
gtk/gtkrecentchooserdefault.c
|
||||||
gtk/gtkrecentchoosermenu.c
|
gtk/gtkrecentchoosermenu.c
|
||||||
gtk/gtkrecentmanager.c
|
gtk/gtkrecentmanager.c
|
||||||
|
gtk/gtkrevealer.c
|
||||||
gtk/gtkscalebutton.c
|
gtk/gtkscalebutton.c
|
||||||
gtk/gtkscale.c
|
gtk/gtkscale.c
|
||||||
gtk/gtkscrollable.c
|
gtk/gtkscrollable.c
|
||||||
@@ -209,6 +210,8 @@ gtk/gtksizerequest.c
|
|||||||
gtk/gtksocket.c
|
gtk/gtksocket.c
|
||||||
gtk/gtkspinbutton.c
|
gtk/gtkspinbutton.c
|
||||||
gtk/gtkspinner.c
|
gtk/gtkspinner.c
|
||||||
|
gtk/gtkstack.c
|
||||||
|
gtk/gtkstackswitcher.c
|
||||||
gtk/gtkstatusbar.c
|
gtk/gtkstatusbar.c
|
||||||
gtk/gtkstatusicon.c
|
gtk/gtkstatusicon.c
|
||||||
gtk/gtkstock.c
|
gtk/gtkstock.c
|
||||||
@@ -300,4 +303,3 @@ gtk/gtkrecentchooserdefault.ui.h
|
|||||||
gtk/gtkscalebutton.ui.h
|
gtk/gtkscalebutton.ui.h
|
||||||
gtk/gtkstatusbar.ui.h
|
gtk/gtkstatusbar.ui.h
|
||||||
gtk/gtkvolumebutton.ui.h
|
gtk/gtkvolumebutton.ui.h
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
demos/gtk-demo/demo.ui
|
demos/gtk-demo/demo.ui
|
||||||
demos/gtk-demo/menus.ui
|
demos/gtk-demo/menus.ui
|
||||||
|
demos/gtk-demo/stack.ui
|
||||||
demos/gtk-demo/theming.ui
|
demos/gtk-demo/theming.ui
|
||||||
demos/widget-factory/widget-factory.ui
|
demos/widget-factory/widget-factory.ui
|
||||||
examples/bloatpad.c
|
examples/bloatpad.c
|
||||||
|
|||||||
+422
-263
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ msgstr ""
|
|||||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
|
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk"
|
||||||
"%2b&keywords=I18N+L10N&component=general\n"
|
"%2b&keywords=I18N+L10N&component=general\n"
|
||||||
"POT-Creation-Date: 2013-03-25 18:34+0000\n"
|
"POT-Creation-Date: 2013-03-25 18:34+0000\n"
|
||||||
"PO-Revision-Date: 2013-04-20 14:27+0500\n"
|
"PO-Revision-Date: 2013-04-22 13:11+0500\n"
|
||||||
"Last-Translator: Victor Ibragimov <victor.ibragimov@gmail.com>\n"
|
"Last-Translator: Victor Ibragimov <victor.ibragimov@gmail.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: Tajik\n"
|
"Language: Tajik\n"
|
||||||
@@ -412,10 +412,9 @@ msgid "WebCam"
|
|||||||
msgstr "Веб-камера"
|
msgstr "Веб-камера"
|
||||||
|
|
||||||
#: ../gdk/keyname-table.h:4013
|
#: ../gdk/keyname-table.h:4013
|
||||||
#, fuzzy
|
|
||||||
msgctxt "keyboard label"
|
msgctxt "keyboard label"
|
||||||
msgid "Display"
|
msgid "Display"
|
||||||
msgstr "Дисплей"
|
msgstr "Display"
|
||||||
|
|
||||||
#: ../gdk/keyname-table.h:4014
|
#: ../gdk/keyname-table.h:4014
|
||||||
msgctxt "keyboard label"
|
msgctxt "keyboard label"
|
||||||
@@ -474,11 +473,10 @@ msgid "Opening %s"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../gdk/x11/gdkapplaunchcontext-x11.c:310
|
#: ../gdk/x11/gdkapplaunchcontext-x11.c:310
|
||||||
#, fuzzy, c-format
|
#, c-format
|
||||||
msgid "Opening %d Item"
|
msgid "Opening %d Item"
|
||||||
msgid_plural "Opening %d Items"
|
msgid_plural "Opening %d Items"
|
||||||
msgstr[0] "Илова кардани объект"
|
msgstr[0] ""
|
||||||
msgstr[1] ""
|
|
||||||
|
|
||||||
#: ../gtk/a11y/gtkbooleancellaccessible.c:43
|
#: ../gtk/a11y/gtkbooleancellaccessible.c:43
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
@@ -1171,9 +1169,8 @@ msgstr "Беэътимод"
|
|||||||
#. * acelerator.
|
#. * acelerator.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkcellrendereraccel.c:416 ../gtk/gtkcellrendereraccel.c:747
|
#: ../gtk/gtkcellrendereraccel.c:416 ../gtk/gtkcellrendereraccel.c:747
|
||||||
#, fuzzy
|
|
||||||
msgid "New accelerator…"
|
msgid "New accelerator…"
|
||||||
msgstr "<i>_Намоиши нав...</i>"
|
msgstr "Суръатафзои нав…"
|
||||||
|
|
||||||
#: ../gtk/gtkcellrendererprogress.c:372 ../gtk/gtkcellrendererprogress.c:462
|
#: ../gtk/gtkcellrendererprogress.c:372 ../gtk/gtkcellrendererprogress.c:462
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -1186,7 +1183,6 @@ msgid "Pick a Color"
|
|||||||
msgstr "Интихоби ранг"
|
msgstr "Интихоби ранг"
|
||||||
|
|
||||||
#: ../gtk/gtkcolorchooserdialog.c:162
|
#: ../gtk/gtkcolorchooserdialog.c:162
|
||||||
#, fuzzy
|
|
||||||
msgid "Select a Color"
|
msgid "Select a Color"
|
||||||
msgstr "Интихоби ранг"
|
msgstr "Интихоби ранг"
|
||||||
|
|
||||||
@@ -1475,9 +1471,8 @@ msgstr "_Фармоишдиҳӣ"
|
|||||||
#. * it isn't default:mm or default:inch it will not work
|
#. * it isn't default:mm or default:inch it will not work
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkcustompaperunixdialog.c:115
|
#: ../gtk/gtkcustompaperunixdialog.c:115
|
||||||
#, fuzzy
|
|
||||||
msgid "default:mm"
|
msgid "default:mm"
|
||||||
msgstr "Андозаи пешфарз:"
|
msgstr "пешфарз:мм"
|
||||||
|
|
||||||
#. And show the custom paper dialog
|
#. And show the custom paper dialog
|
||||||
#: ../gtk/gtkcustompaperunixdialog.c:397 ../gtk/gtkprintunixdialog.c:3275
|
#: ../gtk/gtkcustompaperunixdialog.c:397 ../gtk/gtkprintunixdialog.c:3275
|
||||||
@@ -1490,7 +1485,7 @@ msgstr "дюйм"
|
|||||||
|
|
||||||
#: ../gtk/gtkcustompaperunixdialog.c:560 ../gtk/gtkpagesetupunixdialog.c:776
|
#: ../gtk/gtkcustompaperunixdialog.c:560 ../gtk/gtkpagesetupunixdialog.c:776
|
||||||
msgid "mm"
|
msgid "mm"
|
||||||
msgstr ""
|
msgstr "мм"
|
||||||
|
|
||||||
#: ../gtk/gtkcustompaperunixdialog.c:605
|
#: ../gtk/gtkcustompaperunixdialog.c:605
|
||||||
msgid "Margins from Printer…"
|
msgid "Margins from Printer…"
|
||||||
@@ -1601,7 +1596,7 @@ msgstr "(Ҳеҷ)"
|
|||||||
|
|
||||||
#: ../gtk/gtkfilechooserbutton.c:2198
|
#: ../gtk/gtkfilechooserbutton.c:2198
|
||||||
msgid "Other…"
|
msgid "Other…"
|
||||||
msgstr ""
|
msgstr "Дигар..."
|
||||||
|
|
||||||
#: ../gtk/gtkfilechooserdefault.c:152
|
#: ../gtk/gtkfilechooserdefault.c:152
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
@@ -2049,9 +2044,8 @@ msgstr ""
|
|||||||
|
|
||||||
#. Placeholder in --gtk-module=MODULES in --help output
|
#. Placeholder in --gtk-module=MODULES in --help output
|
||||||
#: ../gtk/gtkmain.c:447
|
#: ../gtk/gtkmain.c:447
|
||||||
#, fuzzy
|
|
||||||
msgid "MODULES"
|
msgid "MODULES"
|
||||||
msgstr "Модулҳои боршаванда"
|
msgstr "МОДУЛҲО"
|
||||||
|
|
||||||
#. Description of --g-fatal-warnings in --help output
|
#. Description of --g-fatal-warnings in --help output
|
||||||
#: ../gtk/gtkmain.c:449
|
#: ../gtk/gtkmain.c:449
|
||||||
@@ -2074,9 +2068,8 @@ msgstr ""
|
|||||||
#. * it isn't default:LTR or default:RTL it will not work
|
#. * it isn't default:LTR or default:RTL it will not work
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkmain.c:703
|
#: ../gtk/gtkmain.c:703
|
||||||
#, fuzzy
|
|
||||||
msgid "default:LTR"
|
msgid "default:LTR"
|
||||||
msgstr "Андозаи пешфарз:"
|
msgstr "пешфарз:LTR"
|
||||||
|
|
||||||
#: ../gtk/gtkmain.c:768
|
#: ../gtk/gtkmain.c:768
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
@@ -2263,9 +2256,8 @@ msgid "Authentication"
|
|||||||
msgstr "_Санҷиши ҳаққоният"
|
msgstr "_Санҷиши ҳаққоният"
|
||||||
|
|
||||||
#: ../gtk/gtkprinteroptionwidget.c:546
|
#: ../gtk/gtkprinteroptionwidget.c:546
|
||||||
#, fuzzy
|
|
||||||
msgid "Select a filename"
|
msgid "Select a filename"
|
||||||
msgstr "Номи файли пойгоҳи иттилоотӣ"
|
msgstr "Интихоби номи файл"
|
||||||
|
|
||||||
#: ../gtk/gtkprinteroptionwidget.c:770
|
#: ../gtk/gtkprinteroptionwidget.c:770
|
||||||
msgid "Not available"
|
msgid "Not available"
|
||||||
@@ -2380,9 +2372,8 @@ msgid "Custom size"
|
|||||||
msgstr "Андозаи равзана"
|
msgstr "Андозаи равзана"
|
||||||
|
|
||||||
#: ../gtk/gtkprintoperation-win32.c:1537
|
#: ../gtk/gtkprintoperation-win32.c:1537
|
||||||
#, fuzzy
|
|
||||||
msgid "No printer found"
|
msgid "No printer found"
|
||||||
msgstr "Тамосҳо дарёфт нашудаанд"
|
msgstr "Ягон принтер ёфт нашуд"
|
||||||
|
|
||||||
#: ../gtk/gtkprintoperation-win32.c:1564
|
#: ../gtk/gtkprintoperation-win32.c:1564
|
||||||
msgid "Invalid argument to CreateDC"
|
msgid "Invalid argument to CreateDC"
|
||||||
@@ -2677,7 +2668,7 @@ msgstr "_Ҳозир"
|
|||||||
|
|
||||||
#: ../gtk/gtkprintunixdialog.c:3603
|
#: ../gtk/gtkprintunixdialog.c:3603
|
||||||
msgid "A_t:"
|
msgid "A_t:"
|
||||||
msgstr ""
|
msgstr "_Дар:"
|
||||||
|
|
||||||
#. Translators: Ability to parse the am/pm format depends on actual locale.
|
#. Translators: Ability to parse the am/pm format depends on actual locale.
|
||||||
#. * You can remove the am/pm values below for your locale if they are not
|
#. * You can remove the am/pm values below for your locale if they are not
|
||||||
@@ -2810,9 +2801,8 @@ msgstr ""
|
|||||||
#. * recent chooser menu widget.
|
#. * recent chooser menu widget.
|
||||||
#.
|
#.
|
||||||
#: ../gtk/gtkrecentchoosermenu.c:360
|
#: ../gtk/gtkrecentchoosermenu.c:360
|
||||||
#, fuzzy
|
|
||||||
msgid "No items found"
|
msgid "No items found"
|
||||||
msgstr "Тамосҳо дарёфт нашудаанд"
|
msgstr "Ягон объект ёфт нашуд"
|
||||||
|
|
||||||
#: ../gtk/gtkrecentchoosermenu.c:526 ../gtk/gtkrecentchoosermenu.c:582
|
#: ../gtk/gtkrecentchoosermenu.c:526 ../gtk/gtkrecentchoosermenu.c:582
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -2953,10 +2943,9 @@ msgid "_Delete"
|
|||||||
msgstr "_Нест кардан"
|
msgstr "_Нест кардан"
|
||||||
|
|
||||||
#: ../gtk/gtkstock.c:345
|
#: ../gtk/gtkstock.c:345
|
||||||
#, fuzzy
|
|
||||||
msgctxt "Stock label"
|
msgctxt "Stock label"
|
||||||
msgid "_Discard"
|
msgid "_Discard"
|
||||||
msgstr "&Рад кардан"
|
msgstr "_Рад кардан"
|
||||||
|
|
||||||
#: ../gtk/gtkstock.c:346
|
#: ../gtk/gtkstock.c:346
|
||||||
msgctxt "Stock label"
|
msgctxt "Stock label"
|
||||||
@@ -3619,7 +3608,7 @@ msgstr "%d %%"
|
|||||||
#: ../gtk/paper_names_offsets.c:4
|
#: ../gtk/paper_names_offsets.c:4
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "asme_f"
|
msgid "asme_f"
|
||||||
msgstr ""
|
msgstr "asme_f"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:5
|
#: ../gtk/paper_names_offsets.c:5
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
@@ -3798,37 +3787,37 @@ msgstr "A9"
|
|||||||
#: ../gtk/paper_names_offsets.c:39
|
#: ../gtk/paper_names_offsets.c:39
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B0"
|
msgid "B0"
|
||||||
msgstr ""
|
msgstr "B0"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:40
|
#: ../gtk/paper_names_offsets.c:40
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B1"
|
msgid "B1"
|
||||||
msgstr ""
|
msgstr "B1"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:41
|
#: ../gtk/paper_names_offsets.c:41
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B10"
|
msgid "B10"
|
||||||
msgstr ""
|
msgstr "B10"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:42
|
#: ../gtk/paper_names_offsets.c:42
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B2"
|
msgid "B2"
|
||||||
msgstr ""
|
msgstr "B2"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:43
|
#: ../gtk/paper_names_offsets.c:43
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B3"
|
msgid "B3"
|
||||||
msgstr ""
|
msgstr "B3"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:44
|
#: ../gtk/paper_names_offsets.c:44
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B4"
|
msgid "B4"
|
||||||
msgstr ""
|
msgstr "B4"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:45
|
#: ../gtk/paper_names_offsets.c:45
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B5"
|
msgid "B5"
|
||||||
msgstr ""
|
msgstr "B5"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:46
|
#: ../gtk/paper_names_offsets.c:46
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
@@ -3839,27 +3828,27 @@ msgstr "Зичи изофӣ"
|
|||||||
#: ../gtk/paper_names_offsets.c:47
|
#: ../gtk/paper_names_offsets.c:47
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B6"
|
msgid "B6"
|
||||||
msgstr ""
|
msgstr "B6"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:48
|
#: ../gtk/paper_names_offsets.c:48
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B6/C4"
|
msgid "B6/C4"
|
||||||
msgstr ""
|
msgstr "B6/C4"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:49
|
#: ../gtk/paper_names_offsets.c:49
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B7"
|
msgid "B7"
|
||||||
msgstr ""
|
msgstr "B7"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:50
|
#: ../gtk/paper_names_offsets.c:50
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B8"
|
msgid "B8"
|
||||||
msgstr ""
|
msgstr "B8"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:51
|
#: ../gtk/paper_names_offsets.c:51
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "B9"
|
msgid "B9"
|
||||||
msgstr ""
|
msgstr "B9"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:52
|
#: ../gtk/paper_names_offsets.c:52
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
@@ -4130,32 +4119,32 @@ msgstr "Лифофаи a2"
|
|||||||
#: ../gtk/paper_names_offsets.c:105
|
#: ../gtk/paper_names_offsets.c:105
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "Arch A"
|
msgid "Arch A"
|
||||||
msgstr ""
|
msgstr "Arch A"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:106
|
#: ../gtk/paper_names_offsets.c:106
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "Arch B"
|
msgid "Arch B"
|
||||||
msgstr ""
|
msgstr "Arch B"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:107
|
#: ../gtk/paper_names_offsets.c:107
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "Arch C"
|
msgid "Arch C"
|
||||||
msgstr ""
|
msgstr "Arch C"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:108
|
#: ../gtk/paper_names_offsets.c:108
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "Arch D"
|
msgid "Arch D"
|
||||||
msgstr ""
|
msgstr "Arch D"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:109
|
#: ../gtk/paper_names_offsets.c:109
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "Arch E"
|
msgid "Arch E"
|
||||||
msgstr ""
|
msgstr "Arch E"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:110
|
#: ../gtk/paper_names_offsets.c:110
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "b-plus"
|
msgid "b-plus"
|
||||||
msgstr ""
|
msgstr "b-plus"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:111
|
#: ../gtk/paper_names_offsets.c:111
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
@@ -4406,7 +4395,7 @@ msgstr "Лифофаи prc10"
|
|||||||
#: ../gtk/paper_names_offsets.c:157
|
#: ../gtk/paper_names_offsets.c:157
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "prc 16k"
|
msgid "prc 16k"
|
||||||
msgstr ""
|
msgstr "prc 16k"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:158
|
#: ../gtk/paper_names_offsets.c:158
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
@@ -4421,7 +4410,7 @@ msgstr "Лифофаи prc3"
|
|||||||
#: ../gtk/paper_names_offsets.c:160
|
#: ../gtk/paper_names_offsets.c:160
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
msgid "prc 32k"
|
msgid "prc 32k"
|
||||||
msgstr ""
|
msgstr "prc 32k"
|
||||||
|
|
||||||
#: ../gtk/paper_names_offsets.c:161
|
#: ../gtk/paper_names_offsets.c:161
|
||||||
msgctxt "paper size"
|
msgctxt "paper size"
|
||||||
|
|||||||
+10
-1
@@ -36,6 +36,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
|||||||
testappchooser \
|
testappchooser \
|
||||||
testappchooserbutton \
|
testappchooserbutton \
|
||||||
testassistant \
|
testassistant \
|
||||||
|
testbaseline \
|
||||||
testbbox \
|
testbbox \
|
||||||
testboxcss \
|
testboxcss \
|
||||||
testbuttons \
|
testbuttons \
|
||||||
@@ -131,7 +132,8 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
|||||||
testpixbuf-scale \
|
testpixbuf-scale \
|
||||||
testgmenu \
|
testgmenu \
|
||||||
testlogout \
|
testlogout \
|
||||||
teststack
|
teststack \
|
||||||
|
testrevealer
|
||||||
|
|
||||||
if USE_X11
|
if USE_X11
|
||||||
noinst_PROGRAMS += testerrors
|
noinst_PROGRAMS += testerrors
|
||||||
@@ -165,6 +167,7 @@ testiconview_DEPENDENCIES = $(TEST_DEPS)
|
|||||||
testaccel_DEPENDENCIES = $(TEST_DEPS)
|
testaccel_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testadjustsize_DEPENDENCIES = $(TEST_DEPS)
|
testadjustsize_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testassistant_DEPENDENCIES = $(TEST_DEPS)
|
testassistant_DEPENDENCIES = $(TEST_DEPS)
|
||||||
|
testbaseline_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testbbox_DEPENDENCIES = $(TEST_DEPS)
|
testbbox_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testbuttons_DEPENDENCIES = $(TEST_DEPS)
|
testbuttons_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testcairo_DEPENDENCIES = $(TEST_DEPS)
|
testcairo_DEPENDENCIES = $(TEST_DEPS)
|
||||||
@@ -256,6 +259,7 @@ testpixbuf_scale_DEPENDENCIES = $(TEST_DEPS)
|
|||||||
testgmenu_DEPENDENCIES = $(TEST_DEPS)
|
testgmenu_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testlogout_DEPENDENCIES = $(TEST_DEPS)
|
testlogout_DEPENDENCIES = $(TEST_DEPS)
|
||||||
teststack_DEPENDENCIES = $(TEST_DEPS)
|
teststack_DEPENDENCIES = $(TEST_DEPS)
|
||||||
|
testrevealer_DEPENDENCIES = $(TEST_DEPS)
|
||||||
|
|
||||||
animated_resizing_SOURCES = \
|
animated_resizing_SOURCES = \
|
||||||
animated-resizing.c \
|
animated-resizing.c \
|
||||||
@@ -356,6 +360,9 @@ testmerge_SOURCES = \
|
|||||||
testactions_SOURCES = \
|
testactions_SOURCES = \
|
||||||
testactions.c
|
testactions.c
|
||||||
|
|
||||||
|
testbaseline_SOURCES = \
|
||||||
|
testbaseline.c
|
||||||
|
|
||||||
testbbox_SOURCES = \
|
testbbox_SOURCES = \
|
||||||
testbbox.c
|
testbbox.c
|
||||||
|
|
||||||
@@ -456,6 +463,8 @@ testkineticscrolling_SOURCES = testkineticscrolling.c
|
|||||||
|
|
||||||
teststack_SOURCES = teststack.c
|
teststack_SOURCES = teststack.c
|
||||||
|
|
||||||
|
testrevealer_SOURCES = testrevealer.c
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
gradient1.png \
|
gradient1.png \
|
||||||
prop-editor.h \
|
prop-editor.h \
|
||||||
|
|||||||
@@ -0,0 +1,382 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Nokia Corporation.
|
||||||
|
* Author: Xan Lopez <xan.lopez@nokia.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static char *baseline_pos_str[] = {
|
||||||
|
"BASELINE_POSITION_TOP",
|
||||||
|
"BASELINE_POSITION_CENTER",
|
||||||
|
"BASELINE_POSITION_BOTTOM"
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
baseline_row_value_changed (GtkSpinButton *spin_button,
|
||||||
|
GtkGrid *grid)
|
||||||
|
{
|
||||||
|
gint row = gtk_spin_button_get_value_as_int (spin_button);
|
||||||
|
|
||||||
|
gtk_grid_set_baseline_row (grid, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
homogeneous_changed (GtkToggleButton *toggle_button,
|
||||||
|
GtkGrid *grid)
|
||||||
|
{
|
||||||
|
gtk_grid_set_row_homogeneous (grid, gtk_toggle_button_get_active (toggle_button));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
baseline_position_changed (GtkComboBox *combo,
|
||||||
|
GtkBox *hbox)
|
||||||
|
{
|
||||||
|
int i = gtk_combo_box_get_active (combo);
|
||||||
|
|
||||||
|
gtk_box_set_baseline_position (hbox, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
image_size_value_changed (GtkSpinButton *spin_button,
|
||||||
|
GtkImage *image)
|
||||||
|
{
|
||||||
|
gint size = gtk_spin_button_get_value_as_int (spin_button);
|
||||||
|
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc,
|
||||||
|
char **argv)
|
||||||
|
{
|
||||||
|
GtkWidget *window, *label, *entry, *button, *grid, *notebook;
|
||||||
|
GtkWidget *vbox, *hbox, *grid_hbox, *spin, *spin2, *toggle, *combo, *image, *ebox;
|
||||||
|
PangoFontDescription *font;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
|
||||||
|
notebook = gtk_notebook_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), notebook);
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
|
vbox, gtk_label_new ("hboxes"));
|
||||||
|
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
|
||||||
|
|
||||||
|
char *aligns_names[] = { "FILL", "BASELINE" };
|
||||||
|
GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE};
|
||||||
|
|
||||||
|
label = gtk_label_new (aligns_names[j]);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
label = gtk_label_new ("│XYyj,Ö...");
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (label, font);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (label, aligns[j]);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "│XYyj,Ö...");
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (entry, font);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (entry, aligns[j]);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
spin = gtk_spin_button_new (NULL, 0, 1);
|
||||||
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), GTK_ORIENTATION_VERTICAL);
|
||||||
|
gtk_widget_set_valign (spin, aligns[j]);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), spin);
|
||||||
|
}
|
||||||
|
|
||||||
|
grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
|
||||||
|
|
||||||
|
combo = gtk_combo_box_text_new ();
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]);
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[1]);
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[2]);
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), combo);
|
||||||
|
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (combo), "changed",
|
||||||
|
G_CALLBACK (baseline_position_changed), hbox);
|
||||||
|
|
||||||
|
if (j == 0)
|
||||||
|
label = gtk_label_new ("Baseline:");
|
||||||
|
else
|
||||||
|
label = gtk_label_new ("Normal:");
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label ("│Xyj,Ö");
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (button, font);
|
||||||
|
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label ("│Xyj,Ö");
|
||||||
|
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON));
|
||||||
|
gtk_button_set_always_show_image (GTK_BUTTON (button), TRUE);
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (button, font);
|
||||||
|
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
ebox = gtk_event_box_new ();
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (ebox, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), ebox);
|
||||||
|
|
||||||
|
image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON);
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 34);
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (image, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (ebox), image);
|
||||||
|
|
||||||
|
button = gtk_toggle_button_new_with_label ("│Xyj,Ö");
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
|
||||||
|
button = gtk_toggle_button_new_with_label ("│Xyj,Ö");
|
||||||
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
|
||||||
|
button = gtk_check_button_new_with_label ("│Xyj,Ö");
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
|
||||||
|
button = gtk_radio_button_new_with_label (NULL, "│Xyj,Ö");
|
||||||
|
if (j == 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
|
vbox, gtk_label_new ("grid"));
|
||||||
|
|
||||||
|
grid_hbox = hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
|
||||||
|
|
||||||
|
label = gtk_label_new ("Align me:");
|
||||||
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||||
|
|
||||||
|
grid = gtk_grid_new ();
|
||||||
|
gtk_widget_set_valign (grid, GTK_ALIGN_BASELINE);
|
||||||
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 8);
|
||||||
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 8);
|
||||||
|
|
||||||
|
for (j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
char *labels[] = { "Normal:", "Baseline (top):", "Baseline (center):", "Baseline (bottom):"};
|
||||||
|
label = gtk_label_new (labels[j]);
|
||||||
|
|
||||||
|
gtk_grid_attach (GTK_GRID (grid),
|
||||||
|
label,
|
||||||
|
0, j,
|
||||||
|
1, 1);
|
||||||
|
gtk_widget_set_vexpand (label, TRUE);
|
||||||
|
|
||||||
|
if (j != 0)
|
||||||
|
gtk_grid_set_row_baseline_position (GTK_GRID (grid),
|
||||||
|
j, (GtkBaselinePosition)(j-1));
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
label = gtk_label_new ("Xyjg,Ö.");
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (label, font);
|
||||||
|
|
||||||
|
if (j != 0)
|
||||||
|
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_grid_attach (GTK_GRID (grid),
|
||||||
|
label,
|
||||||
|
i+1, j,
|
||||||
|
1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label ("│Xyj,Ö");
|
||||||
|
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button),
|
||||||
|
gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON));
|
||||||
|
gtk_button_set_always_show_image (GTK_BUTTON (button), TRUE);
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (button, font);
|
||||||
|
|
||||||
|
if (j != 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_grid_attach (GTK_GRID (grid),
|
||||||
|
button,
|
||||||
|
i+4, j,
|
||||||
|
1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), grid);
|
||||||
|
|
||||||
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
|
||||||
|
|
||||||
|
adjustment = gtk_adjustment_new (0.0, -1.0, 5.0, 1.0, 1.0, 0.0);
|
||||||
|
spin = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||||
|
g_signal_connect (spin, "value-changed", (GCallback)baseline_row_value_changed, grid);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), spin);
|
||||||
|
|
||||||
|
toggle = gtk_toggle_button_new_with_label ("Homogeneous");
|
||||||
|
g_signal_connect (toggle, "toggled", (GCallback)homogeneous_changed, grid);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), toggle);
|
||||||
|
|
||||||
|
combo = gtk_combo_box_text_new ();
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[0]);
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[1]);
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), baseline_pos_str[2]);
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1);
|
||||||
|
g_signal_connect (G_OBJECT (combo), "changed",
|
||||||
|
G_CALLBACK (baseline_position_changed), grid_hbox);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), combo);
|
||||||
|
|
||||||
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
|
vbox, gtk_label_new ("button box"));
|
||||||
|
|
||||||
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
|
||||||
|
|
||||||
|
adjustment = gtk_adjustment_new (34.0, 1.0, 64.0, 1.0, 1.0, 0.0);
|
||||||
|
spin = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), spin);
|
||||||
|
|
||||||
|
adjustment = gtk_adjustment_new (16.0, 1.0, 64.0, 1.0, 1.0, 0.0);
|
||||||
|
spin2 = gtk_spin_button_new (adjustment, 1.0, 0);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), spin2);
|
||||||
|
|
||||||
|
for (j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
|
||||||
|
|
||||||
|
gtk_box_set_baseline_position (GTK_BOX (hbox), j);
|
||||||
|
|
||||||
|
label = gtk_label_new (baseline_pos_str[j]);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), label);
|
||||||
|
gtk_widget_set_vexpand (label, TRUE);
|
||||||
|
|
||||||
|
image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON);
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 34);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), image);
|
||||||
|
|
||||||
|
g_signal_connect (spin, "value-changed", (GCallback)image_size_value_changed, image);
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label ("│Xyj,Ö");
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (button, font);
|
||||||
|
|
||||||
|
if (i != 0)
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
button = gtk_button_new_with_label ("│Xyj,Ö");
|
||||||
|
|
||||||
|
image = gtk_image_new_from_icon_name ("face-sad", GTK_ICON_SIZE_BUTTON);
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
|
||||||
|
gtk_button_set_image (GTK_BUTTON (button), image);
|
||||||
|
if (i == 0)
|
||||||
|
g_signal_connect (spin2, "value-changed", (GCallback)image_size_value_changed, image);
|
||||||
|
gtk_button_set_always_show_image (GTK_BUTTON (button), TRUE);
|
||||||
|
|
||||||
|
font = pango_font_description_new ();
|
||||||
|
pango_font_description_set_size (font, 5*(i+1)* 1024);
|
||||||
|
gtk_widget_override_font (button, font);
|
||||||
|
|
||||||
|
gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_show_all (window);
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc,
|
||||||
|
gchar ** argv)
|
||||||
|
{
|
||||||
|
GtkWidget *window, *revealer, *box, *widget, *entry;
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_widget_set_size_request (window, 300, 300);
|
||||||
|
|
||||||
|
box = gtk_grid_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), box);
|
||||||
|
|
||||||
|
widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
|
||||||
|
gtk_widget_set_margin_top (widget, 10);
|
||||||
|
gtk_widget_set_margin_bottom (widget, 10);
|
||||||
|
gtk_widget_set_margin_left (widget, 10);
|
||||||
|
gtk_widget_set_margin_right (widget, 10);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
|
||||||
|
gtk_widget_set_margin_top (widget, 10);
|
||||||
|
gtk_widget_set_margin_bottom (widget, 10);
|
||||||
|
gtk_widget_set_margin_left (widget, 10);
|
||||||
|
gtk_widget_set_margin_right (widget, 10);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 3, 3, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("None");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 0, 0, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_halign (revealer, GTK_ALIGN_START);
|
||||||
|
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "00000");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_NONE);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 1, 0, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("Fade");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 4, 4, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_halign (revealer, GTK_ALIGN_END);
|
||||||
|
gtk_widget_set_valign (revealer, GTK_ALIGN_END);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "00000");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 3, 4, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("Right");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 0, 2, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_hexpand (revealer, TRUE);
|
||||||
|
gtk_widget_set_halign (revealer, GTK_ALIGN_START);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "12345");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 1, 2, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("Down");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 2, 0, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_vexpand (revealer, TRUE);
|
||||||
|
gtk_widget_set_valign (revealer, GTK_ALIGN_START);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "23456");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 2, 1, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("Left");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 4, 2, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_hexpand (revealer, TRUE);
|
||||||
|
gtk_widget_set_halign (revealer, GTK_ALIGN_END);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "34567");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 3, 2, 1, 1);
|
||||||
|
|
||||||
|
widget = gtk_toggle_button_new_with_label ("Up");
|
||||||
|
gtk_grid_attach (GTK_GRID (box), widget, 2, 4, 1, 1);
|
||||||
|
revealer = gtk_revealer_new ();
|
||||||
|
gtk_widget_set_vexpand (revealer, TRUE);
|
||||||
|
gtk_widget_set_valign (revealer, GTK_ALIGN_END);
|
||||||
|
entry = gtk_entry_new ();
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (entry), "45678");
|
||||||
|
gtk_container_add (GTK_CONTAINER (revealer), entry);
|
||||||
|
g_object_bind_property (widget, "active", revealer, "reveal-child", 0);
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
|
||||||
|
gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 2000);
|
||||||
|
gtk_grid_attach (GTK_GRID (box), revealer, 2, 3, 1, 1);
|
||||||
|
|
||||||
|
gtk_widget_show_all (window);
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
gtk_widget_destroy (window);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user