mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
move defaults to implementation
This commit is contained in:
parent
2b2cb50f28
commit
939b44030d
1 changed files with 9 additions and 5 deletions
|
|
@ -1,23 +1,27 @@
|
||||||
use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture};
|
use gtk::{gdk_pixbuf::Pixbuf, prelude::WidgetExt, Picture};
|
||||||
|
|
||||||
const MARGIN: i32 = 6;
|
|
||||||
|
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
gobject: Picture,
|
gobject: Picture,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Image {
|
impl Image {
|
||||||
// Construct
|
// Defaults
|
||||||
|
|
||||||
|
const DEFAULT_MARGIN: i32 = 6;
|
||||||
|
|
||||||
|
// 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_margin_end(MARGIN);
|
gobject.set_margin_end(Self::DEFAULT_MARGIN);
|
||||||
gobject.set_margin_start(MARGIN);
|
gobject.set_margin_start(Self::DEFAULT_MARGIN);
|
||||||
|
|
||||||
Self { gobject }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
pub fn gobject(&self) -> &Picture {
|
pub fn gobject(&self) -> &Picture {
|
||||||
&self.gobject
|
&self.gobject
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue