mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
use ContentFit::ScaleDown for picture browser
This commit is contained in:
parent
9c01581258
commit
0a50681945
1 changed files with 4 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture};
|
use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, ContentFit, Picture};
|
||||||
|
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
gobject: Picture,
|
gobject: Picture,
|
||||||
|
|
@ -7,13 +7,15 @@ pub struct Image {
|
||||||
impl Image {
|
impl Image {
|
||||||
// Defaults
|
// Defaults
|
||||||
|
|
||||||
const DEFAULT_MARGIN: i32 = 6;
|
pub const DEFAULT_MARGIN: i32 = 6;
|
||||||
|
pub const DEFAULT_CONTENT_FIT: ContentFit = ContentFit::ScaleDown;
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self {
|
pub fn new_from_pixbuf(buffer: &Pixbuf) -> Self {
|
||||||
let gobject = Picture::for_pixbuf(buffer);
|
let gobject = Picture::for_pixbuf(buffer);
|
||||||
|
|
||||||
|
gobject.set_content_fit(Self::DEFAULT_CONTENT_FIT);
|
||||||
gobject.set_margin_end(Self::DEFAULT_MARGIN);
|
gobject.set_margin_end(Self::DEFAULT_MARGIN);
|
||||||
gobject.set_margin_start(Self::DEFAULT_MARGIN);
|
gobject.set_margin_start(Self::DEFAULT_MARGIN);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue