add TextView margins

This commit is contained in:
yggverse 2024-10-13 10:10:05 +03:00
parent ef615e2e03
commit bf58e69817

View File

@ -3,6 +3,8 @@ use gtk::{
}; };
use std::sync::Arc; use std::sync::Arc;
const MARGIN: i32 = 16;
pub struct Widget { pub struct Widget {
gobject: TextView, gobject: TextView,
} }
@ -16,11 +18,15 @@ impl Widget {
motion_controller: EventControllerMotion, motion_controller: EventControllerMotion,
) -> Arc<Self> { ) -> Arc<Self> {
let gobject = TextView::builder() let gobject = TextView::builder()
.editable(false) .bottom_margin(MARGIN)
.cursor_visible(false)
.wrap_mode(WrapMode::Word)
.vexpand(true)
.buffer(buffer) .buffer(buffer)
.cursor_visible(false)
.editable(false)
.left_margin(MARGIN)
.right_margin(MARGIN)
.top_margin(MARGIN)
.vexpand(true)
.wrap_mode(WrapMode::Word)
.build(); .build();
gobject.add_controller(primary_button_controller); gobject.add_controller(primary_button_controller);