mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 14:51:04 +02:00
feat: Add orientation support for custom label and button
This commit is contained in:
parent
702b0a63bf
commit
70b2c592b2
11 changed files with 145 additions and 39 deletions
|
@ -3,6 +3,7 @@ use gtk::Label;
|
|||
use serde::Deserialize;
|
||||
|
||||
use crate::build;
|
||||
use crate::config::ModuleOrientation;
|
||||
use crate::dynamic_value::dynamic_string;
|
||||
|
||||
use super::{CustomWidget, CustomWidgetContext};
|
||||
|
@ -12,6 +13,8 @@ pub struct LabelWidget {
|
|||
name: Option<String>,
|
||||
class: Option<String>,
|
||||
label: String,
|
||||
#[serde(default)]
|
||||
orientation: ModuleOrientation,
|
||||
}
|
||||
|
||||
impl CustomWidget for LabelWidget {
|
||||
|
@ -20,6 +23,10 @@ impl CustomWidget for LabelWidget {
|
|||
fn into_widget(self, _context: CustomWidgetContext) -> Self::Widget {
|
||||
let label = build!(self, Self::Widget);
|
||||
|
||||
label.set_angle(
|
||||
self.orientation.to_angle(),
|
||||
);
|
||||
|
||||
label.set_use_markup(true);
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue