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,
dump: String,
) -> 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, dump: String, ) -> 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
.
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 more