Webdar 1.0.0
Web user interface to libdar
Classes | Public Types | Public Member Functions | List of all members
css_class Class Reference

class css_class gather css attributed under a given label More...

#include <css_class.hpp>

Public Types

enum  selector_type {
  active , checked , disabled , enabled ,
  focus , hover , link , in_range ,
  invalid , out_of_range , read_only , read_write ,
  root , target , valid , visited
}
 selector_type is ordered for :hover being defined after :link and :visited
 
enum  pseudo_element_type {
  first_line , first_letter , before , after ,
  marker , selection
}
 

Public Member Functions

 css_class (const std::string &name="")
 
 css_class (const std::string &name, const css &ref)
 
 css_class (const css_class &ref)=default
 
 css_class (css_class &&ref) noexcept=default
 
css_classoperator= (const css_class &ref)=default
 
css_classoperator= (css_class &&ref) noexcept=default
 
void change_name (const std::string &newname)
 change css_class name
 
const std::string & get_name () const
 get the css_class name
 
void set_value (const css &ref)
 defines or overwirte the css_class value from a css object
 
const cssget_value () const
 obtain the current value
 
void clear_value ()
 clear css_class value and all selector values
 
void set_selector (selector_type sel, const css &ref, const std::string &descendant="")
 defines the value for a given css_selector on that class (or pseudo-class in CSS parlance) More...
 
void clear_selector (selector_type sel, const std::string &descendant="")
 remove definition for the given selector type
 
void set_pseudo_element (pseudo_element_type pe, const css &val, const std::string &descendant="")
 defines the value of a given pseudo-element More...
 
void clear_pseudo_element (pseudo_element_type pe, const std::string &descendant="")
 remove definition for the given pseudo-element
 
void clear ()
 clear all css definition, including those provided with selector, only the css name is kept
 
std::string get_definition () const
 returns the css class definition
 

Detailed Description

class css_class gather css attributed under a given label

associate a name to a css object in other words contains what HTML standard defines as a css class: a name associated to a list of CSS properties. this class also include selectors like :hover and so on

Examples
/home/denis/Webdar/webdar/src/html_form_input_file.hpp.

Member Function Documentation

◆ set_pseudo_element()

void css_class::set_pseudo_element ( pseudo_element_type  pe,
const css val,
const std::string &  descendant = "" 
)

defines the value of a given pseudo-element

Note
same behavior of set_selector() above, but for pseudo-elements instead of pseudo-classes

◆ set_selector()

void css_class::set_selector ( selector_type  sel,
const css ref,
const std::string &  descendant = "" 
)

defines the value for a given css_selector on that class (or pseudo-class in CSS parlance)

Parameters
[in]selthe selector to be defined
[in]refthe css definition to give to that selector (= pseudo-class)
[in]descendantnot an empty string, the definition applies to the specified descendant components (html type, like "p" for paragraph, "div" or other) or subcomponent with the provided class name.
Note
a descendant component is any component specified inside the current component, for example in the following html string "<div> demo <p> something </p> something else</div>" "<p>" is a descendant of "<div>". If one wants a specific css definition for "<p>" inside "<div>", the descendant string here should be "p" and the current css_class object be used (or rather referred by its name) by an html_div component. if the descendant is to be a class name rather than an HTML component name, it should be preceeded by a dot like ".myclassname". combining HTML component name with class is possible: "p.myclassname" and restricts the css definition to only "<p>" descendant having the "class=myclassname" attributes.

The documentation for this class was generated from the following files: