forked from AuroraMiddleware/gtk
Merge branch 'content-fit-followup' into 'main'
GtkContentFit followups See merge request GNOME/gtk!4877
This commit is contained in:
commit
9cc7dbe9c9
@ -1266,7 +1266,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkPicture">
|
||||
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
|
||||
<property name="content-fit">cover</property>
|
||||
<property name="overflow">hidden</property>
|
||||
<child>
|
||||
<object class="GtkDragSource">
|
||||
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
|
||||
|
@ -121,10 +121,9 @@ typedef enum
|
||||
* content will appear as letterboxed if its aspect ratio is different
|
||||
* from the allocation aspect ratio.
|
||||
* @GTK_CONTENT_FIT_COVER: Cover the entire allocation, while taking
|
||||
* the content aspect ratio in consideration. This can result in an overflow
|
||||
* if the content aspect ratio is different from the allocation aspect ratio.
|
||||
* For this reason, you may also want to set [property@Gtk.Widget:overflow]
|
||||
* to %GTK_OVERFLOW_HIDDEN.
|
||||
* the content aspect ratio in consideration. The resulting content
|
||||
* will appear as clipped if its aspect ratio is different from the
|
||||
* allocation aspect ratio.
|
||||
* @GTK_CONTENT_FIT_SCALE_DOWN: The content is scaled down to fit the
|
||||
* allocation, if needed, otherwise its original size is used.
|
||||
*
|
||||
|
@ -474,6 +474,8 @@ gtk_picture_init (GtkPicture *self)
|
||||
{
|
||||
self->can_shrink = TRUE;
|
||||
self->content_fit = GTK_CONTENT_FIT_CONTAIN;
|
||||
|
||||
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -972,23 +974,20 @@ gtk_picture_get_can_shrink (GtkPicture *self)
|
||||
* Sets how the content should be resized to fit the `GtkPicture`.
|
||||
*
|
||||
* See [enum@Gtk.ContentFit] for details.
|
||||
*
|
||||
* If you use `GTK_CONTENT_FIT_COVER`, you may also want to set the
|
||||
* [property@Gtk.Widget:overflow] to `GTK_OVERFLOW_HIDDEN`, otherwise the
|
||||
* paintable will overflow the widget allocation if the aspect ratio of the
|
||||
* paintable is different from the one of the `GtkPicture` allocation.
|
||||
*/
|
||||
void
|
||||
gtk_picture_set_content_fit (GtkPicture *self,
|
||||
GtkContentFit content_fit)
|
||||
{
|
||||
gboolean notify_keep_aspect_ratio;
|
||||
|
||||
g_return_if_fail (GTK_IS_PICTURE (self));
|
||||
|
||||
if (self->content_fit == content_fit)
|
||||
return;
|
||||
|
||||
gboolean notify_keep_aspect_ratio = (content_fit == GTK_CONTENT_FIT_FILL ||
|
||||
self->content_fit == GTK_CONTENT_FIT_FILL);
|
||||
notify_keep_aspect_ratio = (content_fit == GTK_CONTENT_FIT_FILL ||
|
||||
self->content_fit == GTK_CONTENT_FIT_FILL);
|
||||
|
||||
self->content_fit = content_fit;
|
||||
|
||||
|
@ -69,10 +69,10 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_picture_set_pixbuf (GtkPicture *self,
|
||||
GdkPixbuf *pixbuf);
|
||||
|
||||
GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_set_fit_mode)
|
||||
GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_set_content_fit)
|
||||
void gtk_picture_set_keep_aspect_ratio (GtkPicture *self,
|
||||
gboolean keep_aspect_ratio);
|
||||
GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_get_fit_mode)
|
||||
GDK_DEPRECATED_IN_4_8_FOR(gtk_picture_get_content_fit)
|
||||
gboolean gtk_picture_get_keep_aspect_ratio (GtkPicture *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_picture_set_can_shrink (GtkPicture *self,
|
||||
|
Loading…
Reference in New Issue
Block a user