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

class managing Cascading Style Sheets attributes More...

#include <css.hpp>

Public Types

enum  positionning { pos_absolute , pos_relative , pos_fixed , pos_sticky }
 
enum  overflowing {
  ov_visible , ov_hidden , ov_scroll , ov_auto ,
  ov_inherit
}
 
enum  floating { fl_left , fl_right , fl_none }
 
enum  floatclear { fc_left , fc_right , fc_both , fc_none }
 
enum  bx_sizing { bx_content , bx_border }
 
enum  h_align { al_right , al_left , al_center , al_justify }
 
enum  v_align {
  al_top , al_middle , al_bottom , al_baseline ,
  al_sub , al_super , al_text_top , al_text_bottom
}
 
enum  decoration { dc_underline , dc_overline , dc_line_through , dc_none }
 
enum  border {
  bd_top , bd_right , bd_bottom , bd_left ,
  bd_all , bd_clear
}
 
enum  bd_width { bd_thin , bd_medium , bd_thick }
 
enum  bd_style {
  bd_dotted , bd_dashed , bd_solid , bd_double ,
  bd_groove , bd_ridge , bd_inset , bd_outset ,
  bd_none
}
 
enum  transition_function {
  ease , linear , ease_in , ease_out ,
  ease_in_out
}
 css transition, this concerns all properties that changed within CSS style (hover, focus, and so on)
 

Public Member Functions

 css (const css &ref)=default
 
 css (css &&ref) noexcept=default
 
cssoperator= (const css &ref)=default
 
cssoperator= (css &&ref) noexcept=default
 
void update_from (const css &ref)
 update current object with argument ignoring all fields which are unset
 
void clear ()
 set css attributes to their default
 
void css_color (const std::string &col)
 
void css_background_color (const std::string &col)
 
void css_background_color ()
 
void css_background_image (const std::string &url, bool repeat_x, bool repeat_y, bool fixed)
 
void css_background_image ()
 
void css_background_position (const std::string &x, const std::string &y)
 
void css_background_position ()
 
void css_box_shadow ()
 
void css_box_shadow (const std::string &x_shift, const std::string &y_shift, const std::string &blur_size, const std::string &color="#444444")
 
void css_text_shadow ()
 
void css_text_shadow (const std::string &x_shift, const std::string &y_shift, const std::string &blur_size, const std::string &color="#444444")
 
void css_margin (const std::string &all)
 
void css_margin ()
 
void css_margin_top (const std::string &top)
 
void css_margin_top ()
 
void css_margin_right (const std::string &right)
 
void css_margin_right ()
 
void css_margin_bottom (const std::string &bottom)
 
void css_margin_bottom ()
 
void css_margin_left (const std::string &left)
 
void css_margin_left ()
 
void css_height (const std::string &val, bool center)
 
void css_height ()
 
void css_min_height (const std::string &val)
 
void css_min_height ()
 
void css_max_height (const std::string &val)
 
void css_max_height ()
 
void css_width (const std::string &val, bool center)
 
void css_width ()
 
void css_min_width (const std::string &val)
 
void css_min_width ()
 
void css_max_width (const std::string &val)
 
void css_max_width ()
 
void css_z_index (unsigned int index)
 
void css_z_index ()
 
void css_position_type (positionning val)
 
void css_position_type ()
 
void css_position_top (const std::string &top)
 
void css_position_top ()
 
void css_position_left (const std::string &left)
 
void css_position_left ()
 
void css_position_bottom (const std::string &bottom)
 
void css_position_bottom ()
 
void css_position_right (const std::string &right)
 
void css_position_right ()
 
void css_overflow (overflowing val)
 set both x and y overflow More...
 
void css_overflow_x (overflowing val)
 set only x overflow
 
void css_overflow_y (overflowing val)
 set only y overflow
 
void css_overflow ()
 clear both x and y overflow (default value)
 
void css_float (floating val)
 
void css_float ()
 
void css_float_clear (floatclear val)
 
void css_float_clear ()
 
void css_opacity (const std::string &opacity)
 
void css_box_sizing (bx_sizing val)
 
void css_display (const std::string &val)
 
void css_padding (const std::string &val)
 
void css_padding ()
 
void css_padding_top (const std::string &top)
 
void css_padding_top ()
 
void css_padding_right (const std::string &right)
 
void css_padding_right ()
 
void css_padding_bottom (const std::string &bottom)
 
void css_padding_bottom ()
 
void css_padding_left (const std::string &left)
 
void css_padding_left ()
 
void css_font_size (const std::string &val)
 
void css_font_style_italic ()
 
void css_font_style_normal ()
 
void css_font_style ()
 
void css_font_weight_bold ()
 
void css_font_weight_normal ()
 
void css_font_weight ()
 
void css_text_h_align (h_align val)
 
void css_text_h_align ()
 
void css_text_v_align (v_align val)
 
void css_text_v_align ()
 
void css_text_decoration (decoration val)
 
void css_text_decoration ()
 
void css_border_width (border which, bd_width val)
 
void css_border_width (border which, const std::string &val)
 
void css_border_width ()
 
void css_border_color (border which, const std::string &col)
 
void css_border_color ()
 
void css_border_style (border which, bd_style val)
 
void css_border_style ()
 
void css_corner_radius (const std::string &all)
 
void css_corner_radius (const std::string &topleft, const std::string &topright, const std::string &botright, const std::string &botleft)
 
void css_corner_radius ()
 
void css_visibility (bool val)
 css_visibility does not prevent sending HTML code to the browser More...
 
void css_content (const std::string &name)
 css content property for "::after" and "::before" pseudo-elements
 
void css_transition (const std::string &duration, const std::string &delay="0s", transition_function funct=ease)
 
void css_transition ()
 clear transition property
 
std::string css_get_raw_string () const
 returns the css raw string
 

Protected Member Functions

virtual void css_updated ()
 this method is called when a property has been modified
 
void declare_custom_css (const std::string &label)
 custom css properties, method available for inherited classes More...
 
void set_custom_css (const std::string &label, const std::string &val)
 set value to a previously declared custom css
 
void clear_custom_css (const std::string &label)
 unset value of a previously declared custom css
 

Detailed Description

class managing Cascading Style Sheets attributes

contains a set of well-known css attributes and their values provide methods to reset each of them to a well-known default value

Member Enumeration Documentation

◆ bx_sizing

Enumerator
bx_content 

width and height define the content (add padding and border size for the real size)

bx_border 

width and height define the box size (reduce content space to fit within the border+padding)

◆ positionning

Enumerator
pos_absolute 

absolute in the document

pos_relative 

shifted relative to its expected position

pos_fixed 

fixed in the viewport

pos_sticky 

either relative or fixed depending on scrolling of parent object

Member Function Documentation

◆ css_overflow()

void css::css_overflow ( overflowing  val)

set both x and y overflow

Note
css_overflow, css_overflow_x and css_overflow_y are mutual exclusive

◆ css_transition()

void css::css_transition ( const std::string &  duration,
const std::string &  delay = "0s",
transition_function  funct = ease 
)
Note
CSS is more precise and is able to define specific transition timing for different properties

◆ css_visibility()

void css::css_visibility ( bool  val)

css_visibility does not prevent sending HTML code to the browser

Note
body_builder class has a set_visible() method that avoids a component to produce html code though it keeps it place in the adoption tree but no html code is sent to the browser. Here CSS visibility sends html code to the browser and may lead an object to change its visibility without webdar - browser communication (Responsive CSS)

◆ declare_custom_css()

void css::declare_custom_css ( const std::string &  label)
protected

custom css properties, method available for inherited classes

Note
storing css properties by this css methods lead them to be integrated in the css_get_string/css_get_raw_string methods they also can be abstracted to html class by body builder derived class note, that this provided label must not have already been declared previously on that css

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