Struct lazybar_core::common::PanelCommon
source · pub struct PanelCommon {
pub dependence: Dependence,
pub actions: Actions,
pub images: Vec<Image>,
pub visible: bool,
}
Expand description
The common part of most PanelConfigs
. Stores format
strings, Attrs
, and Dependence
Fields§
§dependence: Dependence
Whether the panel depends on its neighbors
actions: Actions
The events that should be run on mouse events
images: Vec<Image>
The images that will be displayed on the bar
visible: bool
Whether the panel should be visible on startup
Implementations§
source§impl PanelCommon
impl PanelCommon
sourcepub fn draw(
&self,
cr: &Rc<Context>,
text: &str,
attrs: &Attrs,
dependence: Dependence,
highlight: Option<Highlight>,
images: Vec<Image>,
height: i32,
show_hide: ShowHide,
) -> Result<PanelDrawInfo>
pub fn draw( &self, cr: &Rc<Context>, text: &str, attrs: &Attrs, dependence: Dependence, highlight: Option<Highlight>, images: Vec<Image>, height: i32, show_hide: ShowHide, ) -> Result<PanelDrawInfo>
The end of a typical draw function.
Takes a cairo context, a string to display, and attributes to use, and returns a closure that will do the drawing and a tuple representing the final width and height.
The text will be interpreted as markup. If this is not your intended
behavior, use markup_escape_text
to
display what you want or implement this functionality manually.
sourcepub fn parse_format<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
suffix: &'static str,
default: &'static str,
) -> String
pub fn parse_format<S: BuildHasher>( table: &mut HashMap<String, Value, S>, suffix: &'static str, default: &'static str, ) -> String
Parses a single format from a subset of the global config.
sourcepub fn parse_formats<S: BuildHasher, const N: usize>(
table: &mut HashMap<String, Value, S>,
suffixes: &[&'static str; N],
defaults: &[&'static str; N],
) -> [String; N]
pub fn parse_formats<S: BuildHasher, const N: usize>( table: &mut HashMap<String, Value, S>, suffixes: &[&'static str; N], defaults: &[&'static str; N], ) -> [String; N]
Parses a fixed-size group of formats from a subset of the global config.
sourcepub fn parse_formats_variadic<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
default: &[&'static str],
) -> Vec<String>
pub fn parse_formats_variadic<S: BuildHasher>( table: &mut HashMap<String, Value, S>, default: &[&'static str], ) -> Vec<String>
Parses a variable-size group of formats from a subset of the global config.
The formats should be specified with formats = ["format1", "format2", ...]
sourcepub fn parse_attr<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
suffix: &'static str,
) -> Attrs
pub fn parse_attr<S: BuildHasher>( table: &mut HashMap<String, Value, S>, suffix: &'static str, ) -> Attrs
Parses a single Attrs
from a subset of the global config.
sourcepub fn parse_attrs<S: BuildHasher, const N: usize>(
table: &mut HashMap<String, Value, S>,
suffixes: &[&'static str; N],
) -> [Attrs; N]
pub fn parse_attrs<S: BuildHasher, const N: usize>( table: &mut HashMap<String, Value, S>, suffixes: &[&'static str; N], ) -> [Attrs; N]
Parses a fixed-size group of Attrs
from a subset of the global
config.
sourcepub fn parse_ramp<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
suffix: &'static str,
) -> Ramp
pub fn parse_ramp<S: BuildHasher>( table: &mut HashMap<String, Value, S>, suffix: &'static str, ) -> Ramp
Parses a single Ramp
from a subset of the global config.
sourcepub fn parse_ramps<S: BuildHasher, const N: usize>(
table: &mut HashMap<String, Value, S>,
suffixes: &[&'static str; N],
) -> [Ramp; N]
pub fn parse_ramps<S: BuildHasher, const N: usize>( table: &mut HashMap<String, Value, S>, suffixes: &[&'static str; N], ) -> [Ramp; N]
Parses a fixed-size group of Ramp
s from a subset of the global
config.
sourcepub fn parse_highlight<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
suffix: &'static str,
) -> Highlight
pub fn parse_highlight<S: BuildHasher>( table: &mut HashMap<String, Value, S>, suffix: &'static str, ) -> Highlight
Parses a single Highlight
from a subset of the global config.
sourcepub fn parse_highlights<S: BuildHasher, const N: usize>(
table: &mut HashMap<String, Value, S>,
suffixes: &[&'static str; N],
) -> [Highlight; N]
pub fn parse_highlights<S: BuildHasher, const N: usize>( table: &mut HashMap<String, Value, S>, suffixes: &[&'static str; N], ) -> [Highlight; N]
Parses a fixed-size group of Highlight
s from the global config.
sourcepub fn parse_common<S: BuildHasher>(
table: &mut HashMap<String, Value, S>,
) -> Result<Self>
pub fn parse_common<S: BuildHasher>( table: &mut HashMap<String, Value, S>, ) -> Result<Self>
Attempts to parse common panel configuration options from a subset of
the global Config
. The format suffixes and defaults
and attrs prefixes are documented by each panel.
Format strings should be specified as format{suffix} = "value"
. Where
not noted, panels accept one format string with no suffix.
Dependence should be specified as dependence = "value"
, where value is
a valid variant of Dependence
.
See Actions::parse
and Image::parse
for more parsing details.
Trait Implementations§
source§impl Clone for PanelCommon
impl Clone for PanelCommon
source§fn clone(&self) -> PanelCommon
fn clone(&self) -> PanelCommon
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for PanelCommon
impl RefUnwindSafe for PanelCommon
impl !Send for PanelCommon
impl !Sync for PanelCommon
impl Unpin for PanelCommon
impl UnwindSafe for PanelCommon
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)