Remove inclusion of sys/socket.h from nntp-thread.c
[claws.git] / src / plugins / litehtml_viewer / litehtml / css_properties.h
blob739e35fc2ce371359ac0db7e775ab0309087655c
1 #ifndef LITEHTML_CSS_PROPERTIES_H
2 #define LITEHTML_CSS_PROPERTIES_H
4 #include "os_types.h"
5 #include "types.h"
6 #include "css_margins.h"
7 #include "borders.h"
8 #include "css_offsets.h"
9 #include "background.h"
11 namespace litehtml
13 class element;
14 class document;
16 class css_properties
18 private:
19 element_position m_el_position;
20 text_align m_text_align;
21 overflow m_overflow;
22 white_space m_white_space;
23 style_display m_display;
24 visibility m_visibility;
25 box_sizing m_box_sizing;
26 css_length m_z_index;
27 vertical_align m_vertical_align;
28 element_float m_float;
29 element_clear m_clear;
30 css_margins m_css_margins;
31 css_margins m_css_padding;
32 css_borders m_css_borders;
33 css_length m_css_width;
34 css_length m_css_height;
35 css_length m_css_min_width;
36 css_length m_css_min_height;
37 css_length m_css_max_width;
38 css_length m_css_max_height;
39 css_offsets m_css_offsets;
40 css_length m_css_text_indent;
41 css_length m_css_line_height;
42 int m_line_height;
43 list_style_type m_list_style_type;
44 list_style_position m_list_style_position;
45 string m_list_style_image;
46 string m_list_style_image_baseurl;
47 background m_bg;
48 uint_ptr m_font;
49 css_length m_font_size;
50 string m_font_family;
51 font_weight m_font_weight;
52 font_style m_font_style;
53 string m_text_decoration;
54 font_metrics m_font_metrics;
55 text_transform m_text_transform;
56 web_color m_color;
57 string m_cursor;
58 string m_content;
59 border_collapse m_border_collapse;
60 css_length m_css_border_spacing_x;
61 css_length m_css_border_spacing_y;
63 float m_flex_grow;
64 float m_flex_shrink;
65 css_length m_flex_basis;
66 flex_direction m_flex_direction;
67 flex_wrap m_flex_wrap;
68 flex_justify_content m_flex_justify_content;
69 flex_align_items m_flex_align_items;
70 flex_align_self m_flex_align_self;
71 flex_align_content m_flex_align_content;
73 caption_side m_caption_side;
75 private:
76 void compute_font(const element* el, const std::shared_ptr<document>& doc);
77 void compute_background(const element* el, const std::shared_ptr<document>& doc);
78 void compute_flex(const element* el, const std::shared_ptr<document>& doc);
80 public:
81 css_properties() :
82 m_el_position(element_position_static),
83 m_text_align(text_align_left),
84 m_overflow(overflow_visible),
85 m_white_space(white_space_normal),
86 m_display(display_inline),
87 m_visibility(visibility_visible),
88 m_box_sizing(box_sizing_content_box),
89 m_z_index(0),
90 m_vertical_align(va_baseline),
91 m_float(float_none),
92 m_clear(clear_none),
93 m_css_margins(),
94 m_css_padding(),
95 m_css_borders(),
96 m_css_width(),
97 m_css_height(),
98 m_css_min_width(),
99 m_css_min_height(),
100 m_css_max_width(),
101 m_css_max_height(),
102 m_css_offsets(),
103 m_css_text_indent(),
104 m_css_line_height(0),
105 m_line_height(0),
106 m_list_style_type(list_style_type_none),
107 m_list_style_position(list_style_position_outside),
108 m_bg(),
109 m_font_size(0),
110 m_font(0),
111 m_font_metrics(),
112 m_text_transform(text_transform_none),
113 m_border_collapse(border_collapse_separate),
114 m_css_border_spacing_x(),
115 m_css_border_spacing_y(),
116 m_flex_grow(0),
117 m_flex_shrink(1),
118 m_flex_direction(flex_direction_row),
119 m_flex_wrap(flex_wrap_nowrap),
120 m_flex_justify_content(flex_justify_content_flex_start),
121 m_flex_align_items(flex_align_items_stretch),
122 m_flex_align_self(flex_align_self_auto),
123 m_flex_align_content(flex_align_content_stretch)
126 void compute(const element* el, const std::shared_ptr<document>& doc);
127 std::vector<std::tuple<string, string>> dump_get_attrs();
129 element_position get_position() const;
130 void set_position(element_position mElPosition);
132 text_align get_text_align() const;
133 void set_text_align(text_align mTextAlign);
135 overflow get_overflow() const;
136 void set_overflow(overflow mOverflow);
138 white_space get_white_space() const;
139 void set_white_space(white_space mWhiteSpace);
141 style_display get_display() const;
142 void set_display(style_display mDisplay);
144 visibility get_visibility() const;
145 void set_visibility(visibility mVisibility);
147 box_sizing get_box_sizing() const;
148 void set_box_sizing(box_sizing mBoxSizing);
150 int get_z_index() const;
151 void set_z_index(int mZIndex);
153 vertical_align get_vertical_align() const;
154 void set_vertical_align(vertical_align mVerticalAlign);
156 element_float get_float() const;
157 void set_float(element_float mFloat);
159 element_clear get_clear() const;
160 void set_clear(element_clear mClear);
162 const css_margins &get_margins() const;
163 void set_margins(const css_margins &mCssMargins);
165 const css_margins &get_padding() const;
166 void set_padding(const css_margins &mCssPadding);
168 const css_borders &get_borders() const;
169 void set_borders(const css_borders &mCssBorders);
171 const css_length &get_width() const;
172 void set_width(const css_length &mCssWidth);
174 const css_length &get_height() const;
175 void set_height(const css_length &mCssHeight);
177 const css_length &get_min_width() const;
178 void set_min_width(const css_length &mCssMinWidth);
180 const css_length &get_min_height() const;
181 void set_min_height(const css_length &mCssMinHeight);
183 const css_length &get_max_width() const;
184 void set_max_width(const css_length &mCssMaxWidth);
186 const css_length &get_max_height() const;
187 void set_max_height(const css_length &mCssMaxHeight);
189 const css_offsets &get_offsets() const;
190 void set_offsets(const css_offsets &mCssOffsets);
192 const css_length &get_text_indent() const;
193 void set_text_indent(const css_length &mCssTextIndent);
195 int get_line_height() const;
196 void set_line_height(int mLineHeight);
198 list_style_type get_list_style_type() const;
199 void set_list_style_type(list_style_type mListStyleType);
201 list_style_position get_list_style_position() const;
202 void set_list_style_position(list_style_position mListStylePosition);
204 string get_list_style_image() const;
205 void set_list_style_image(const string& url);
207 string get_list_style_image_baseurl() const;
208 void set_list_style_image_baseurl(const string& url);
210 const background &get_bg() const;
211 void set_bg(const background &mBg);
213 int get_font_size() const;
214 void set_font_size(int mFontSize);
216 uint_ptr get_font() const;
217 void set_font(uint_ptr mFont);
219 const font_metrics& get_font_metrics() const;
220 void set_font_metrics(const font_metrics& mFontMetrics);
222 text_transform get_text_transform() const;
223 void set_text_transform(text_transform mTextTransform);
225 web_color get_color() const;
226 void set_color(web_color color);
228 string get_cursor() const;
229 void set_cursor(const string& cursor);
231 string get_content() const;
232 void set_content(const string& content);
234 border_collapse get_border_collapse() const;
235 void set_border_collapse(border_collapse mBorderCollapse);
237 const css_length& get_border_spacing_x() const ;
238 void set_border_spacing_x(const css_length& mBorderSpacingX);
240 const css_length& get_border_spacing_y() const;
241 void set_border_spacing_y(const css_length& mBorderSpacingY);
243 caption_side get_caption_side() const;
244 void set_caption_side(caption_side side);
246 float get_flex_grow() const;
247 float get_flex_shrink() const;
248 const css_length& get_flex_basis() const;
249 flex_direction get_flex_direction() const;
250 flex_wrap get_flex_wrap() const;
251 flex_justify_content get_flex_justify_content() const;
252 flex_align_items get_flex_align_items() const;
253 flex_align_self get_flex_align_self() const;
254 flex_align_content get_flex_align_content() const;
257 inline element_position css_properties::get_position() const
259 return m_el_position;
262 inline void css_properties::set_position(element_position mElPosition)
264 m_el_position = mElPosition;
267 inline text_align css_properties::get_text_align() const
269 return m_text_align;
272 inline void css_properties::set_text_align(text_align mTextAlign)
274 m_text_align = mTextAlign;
277 inline overflow css_properties::get_overflow() const
279 return m_overflow;
282 inline void css_properties::set_overflow(overflow mOverflow)
284 m_overflow = mOverflow;
287 inline white_space css_properties::get_white_space() const
289 return m_white_space;
292 inline void css_properties::set_white_space(white_space mWhiteSpace)
294 m_white_space = mWhiteSpace;
297 inline style_display css_properties::get_display() const
299 return m_display;
302 inline void css_properties::set_display(style_display mDisplay)
304 m_display = mDisplay;
307 inline visibility css_properties::get_visibility() const
309 return m_visibility;
312 inline void css_properties::set_visibility(visibility mVisibility)
314 m_visibility = mVisibility;
317 inline box_sizing css_properties::get_box_sizing() const
319 return m_box_sizing;
322 inline void css_properties::set_box_sizing(box_sizing mBoxSizing)
324 m_box_sizing = mBoxSizing;
327 inline int css_properties::get_z_index() const
329 return (int)m_z_index.val();
332 inline void css_properties::set_z_index(int mZIndex)
334 m_z_index.set_value((float)mZIndex, css_units_none);
337 inline vertical_align css_properties::get_vertical_align() const
339 return m_vertical_align;
342 inline void css_properties::set_vertical_align(vertical_align mVerticalAlign)
344 m_vertical_align = mVerticalAlign;
347 inline element_float css_properties::get_float() const
349 return m_float;
352 inline void css_properties::set_float(element_float mFloat)
354 m_float = mFloat;
357 inline element_clear css_properties::get_clear() const
359 return m_clear;
362 inline void css_properties::set_clear(element_clear mClear)
364 m_clear = mClear;
367 inline const css_margins &css_properties::get_margins() const
369 return m_css_margins;
372 inline void css_properties::set_margins(const css_margins &mCssMargins)
374 m_css_margins = mCssMargins;
377 inline const css_margins &css_properties::get_padding() const
379 return m_css_padding;
382 inline void css_properties::set_padding(const css_margins &mCssPadding)
384 m_css_padding = mCssPadding;
387 inline const css_borders &css_properties::get_borders() const
389 return m_css_borders;
392 inline void css_properties::set_borders(const css_borders &mCssBorders)
394 m_css_borders = mCssBorders;
397 inline const css_length &css_properties::get_width() const
399 return m_css_width;
402 inline void css_properties::set_width(const css_length &mCssWidth)
404 m_css_width = mCssWidth;
407 inline const css_length &css_properties::get_height() const
409 return m_css_height;
412 inline void css_properties::set_height(const css_length &mCssHeight)
414 m_css_height = mCssHeight;
417 inline const css_length &css_properties::get_min_width() const
419 return m_css_min_width;
422 inline void css_properties::set_min_width(const css_length &mCssMinWidth)
424 m_css_min_width = mCssMinWidth;
427 inline const css_length &css_properties::get_min_height() const
429 return m_css_min_height;
432 inline void css_properties::set_min_height(const css_length &mCssMinHeight)
434 m_css_min_height = mCssMinHeight;
437 inline const css_length &css_properties::get_max_width() const
439 return m_css_max_width;
442 inline void css_properties::set_max_width(const css_length &mCssMaxWidth)
444 m_css_max_width = mCssMaxWidth;
447 inline const css_length &css_properties::get_max_height() const
449 return m_css_max_height;
452 inline void css_properties::set_max_height(const css_length &mCssMaxHeight)
454 m_css_max_height = mCssMaxHeight;
457 inline const css_offsets &css_properties::get_offsets() const
459 return m_css_offsets;
462 inline void css_properties::set_offsets(const css_offsets &mCssOffsets)
464 m_css_offsets = mCssOffsets;
467 inline const css_length &css_properties::get_text_indent() const
469 return m_css_text_indent;
472 inline void css_properties::set_text_indent(const css_length &mCssTextIndent)
474 m_css_text_indent = mCssTextIndent;
477 inline int css_properties::get_line_height() const
479 return m_line_height;
482 inline void css_properties::set_line_height(int mLineHeight)
484 m_line_height = mLineHeight;
487 inline list_style_type css_properties::get_list_style_type() const
489 return m_list_style_type;
492 inline void css_properties::set_list_style_type(list_style_type mListStyleType)
494 m_list_style_type = mListStyleType;
497 inline list_style_position css_properties::get_list_style_position() const
499 return m_list_style_position;
502 inline void css_properties::set_list_style_position(list_style_position mListStylePosition)
504 m_list_style_position = mListStylePosition;
507 inline string css_properties::get_list_style_image() const { return m_list_style_image; }
508 inline void css_properties::set_list_style_image(const string& url) { m_list_style_image = url; }
510 inline string css_properties::get_list_style_image_baseurl() const { return m_list_style_image_baseurl; }
511 inline void css_properties::set_list_style_image_baseurl(const string& url) { m_list_style_image_baseurl = url; }
513 inline const background &css_properties::get_bg() const
515 return m_bg;
518 inline void css_properties::set_bg(const background &mBg)
520 m_bg = mBg;
523 inline int css_properties::get_font_size() const
525 return (int)m_font_size.val();
528 inline void css_properties::set_font_size(int mFontSize)
530 m_font_size = (float)mFontSize;
533 inline uint_ptr css_properties::get_font() const
535 return m_font;
538 inline void css_properties::set_font(uint_ptr mFont)
540 m_font = mFont;
543 inline const font_metrics& css_properties::get_font_metrics() const
545 return m_font_metrics;
548 inline void css_properties::set_font_metrics(const font_metrics& mFontMetrics)
550 m_font_metrics = mFontMetrics;
553 inline text_transform css_properties::get_text_transform() const
555 return m_text_transform;
558 inline void css_properties::set_text_transform(text_transform mTextTransform)
560 m_text_transform = mTextTransform;
563 inline web_color css_properties::get_color() const { return m_color; }
564 inline void css_properties::set_color(web_color color) { m_color = color; }
566 inline string css_properties::get_cursor() const { return m_cursor; }
567 inline void css_properties::set_cursor(const string& cursor) { m_cursor = cursor; }
569 inline string css_properties::get_content() const { return m_content; }
570 inline void css_properties::set_content(const string& content) { m_content = content; }
572 inline border_collapse css_properties::get_border_collapse() const
574 return m_border_collapse;
577 inline void css_properties::set_border_collapse(border_collapse mBorderCollapse)
579 m_border_collapse = mBorderCollapse;
582 inline const css_length& css_properties::get_border_spacing_x() const
584 return m_css_border_spacing_x;
587 inline void css_properties::set_border_spacing_x(const css_length& mBorderSpacingX)
589 m_css_border_spacing_x = mBorderSpacingX;
592 inline const css_length& css_properties::get_border_spacing_y() const
594 return m_css_border_spacing_y;
597 inline void css_properties::set_border_spacing_y(const css_length& mBorderSpacingY)
599 m_css_border_spacing_y = mBorderSpacingY;
602 inline float css_properties::get_flex_grow() const
604 return m_flex_grow;
607 inline float css_properties::get_flex_shrink() const
609 return m_flex_shrink;
612 inline const css_length& css_properties::get_flex_basis() const
614 return m_flex_basis;
617 inline flex_direction css_properties::get_flex_direction() const
619 return m_flex_direction;
622 inline flex_wrap css_properties::get_flex_wrap() const
624 return m_flex_wrap;
627 inline flex_justify_content css_properties::get_flex_justify_content() const
629 return m_flex_justify_content;
632 inline flex_align_items css_properties::get_flex_align_items() const
634 return m_flex_align_items;
637 inline flex_align_self css_properties::get_flex_align_self() const
639 return m_flex_align_self;
642 inline flex_align_content css_properties::get_flex_align_content() const
644 return m_flex_align_content;
647 inline caption_side css_properties::get_caption_side() const
649 return m_caption_side;
651 inline void css_properties::set_caption_side(caption_side side)
653 m_caption_side = side;
658 #endif //LITEHTML_CSS_PROPERTIES_H