use std::fmt;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Category {
ApplicationStatus,
Communications,
SystemServices,
Hardware,
}
impl fmt::Display for Category {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
let r = match *self {
Category::ApplicationStatus => "ApplicationStatus",
Category::Communications => "Communications",
Category::SystemServices => "SystemServices",
Category::Hardware => "Hardware",
};
f.write_str(r)
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Status {
Passive,
Active,
NeedsAttention,
}
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
let r = match *self {
Status::Passive => "Passive",
Status::Active => "Active",
Status::NeedsAttention => "NeedsAttention",
};
f.write_str(r)
}
}
#[derive(Clone, Debug, Default, Hash)]
pub struct ToolTip {
pub icon_name: String,
pub icon_pixmap: Vec<Icon>,
pub title: String,
pub description: String,
}
impl From<ToolTip> for (String, Vec<(i32, i32, Vec<u8>)>, String, String) {
fn from(tooltip: ToolTip) -> Self {
(
tooltip.icon_name,
tooltip.icon_pixmap.into_iter().map(Into::into).collect(),
tooltip.title,
tooltip.description,
)
}
}
#[derive(Clone, Debug, Hash)]
pub struct Icon {
pub width: i32,
pub height: i32,
pub data: Vec<u8>,
}
impl From<Icon> for (i32, i32, Vec<u8>) {
fn from(icon: Icon) -> Self {
(icon.width, icon.height, icon.data)
}
}