clan::SpanLayout Class Reference - ClanLib SDK
Description: clan::SpanLayout Class Reference

Classes | Public Member Functions | List of all members
clan::SpanLayout Class Reference
clanDisplay 2D

Span layout class. More...

`#include <span_layout.h>`

## Classes
struct | HitTestResult

## Public Member Functions
| SpanLayout ()
| ~SpanLayout ()
template<typename T>
void | add_component (T *component, int baseline_offset=0, int id=-1)
| Add component.
void | add_image (const Image &image, int baseline_offset=0, int id=-1)
| Add image.
void | add_text (const std::string &text, const Font &font, const Colorf &color=StandardColorf::white(), int id=-1)
| Add text.
void | clear ()
| Clear.
void | draw_layout (Canvas &canvas)
| Draw layout.
void | draw_layout_ellipsis (Canvas &canvas, const Rect &content_rect)
| Draw layout generating ellipsis for clipped text.
Size | find_preferred_size (Canvas &canvas)
| Find preferred size.
std::string | get_combined_text () const
| Get Combined text.
int | get_first_baseline_offset ()
| Returns the baseline offset for the first baseline.
int | get_last_baseline_offset ()
| Returns the baseline offset for the last baseline.
Rect | get_rect () const
| Get Rect.
std::vector< Rect > | get_rect_by_id (int id) const
| Get Rect By Id.
Size | get_size () const
| Get Size.
void | hide_cursor ()
| Hides the cursor caret.
HitTestResult | hit_test (Canvas &canvas, const Point &pos)
| Hit test.
void | layout (Canvas &canvas, int max_width)
| Layout.
void | set_align (SpanAlign align)
| Sets the text alignment.
void | set_component_geometry ()
| Set component geometry.
void | set_cursor_color (const Colorf &color)
| Sets the cursor color.
void | set_cursor_overwrite_mode (bool enable)
| Toggles whether the cursor caret is shown as a solid box or a line.
void | set_cursor_pos (std::string::size_type pos)
| Sets the cursor position.
void | set_position (const Point &pos)
| Set position.
void | set_selection_colors (const Colorf &foreground, const Colorf &background)
| Set selection colors.
void | set_selection_range (std::string::size_type start, std::string::size_type end)
| Set selection range.
void | show_cursor ()
| Shows the cursor caret.

## Detailed Description

Span layout class.

## Constructor & Destructor Documentation

## ◆ SpanLayout()

clan::SpanLayout::SpanLayout | ( |  | ) |

## ◆ ~SpanLayout()

clan::SpanLayout::~SpanLayout | ( |  | ) |

## Member Function Documentation

## ◆ add_component()

template<typename T>

void clan::SpanLayout::add_component | ( | T * | component,
|  | int | baseline_offset = 0,
|  | int | id = -1 )

Add component.

Parameters

  component | = T
  baseline_offset | = value
  id | = value

## ◆ add_image()

void clan::SpanLayout::add_image | ( | const Image & | image,
|  | int | baseline_offset = 0,
|  | int | id = -1 )

Add image.

Parameters

  image | = Image
  baseline_offset | = value
  id | = value

References clan::image.

## ◆ add_text()

void clan::SpanLayout::add_text | ( | const std::string & | text,
|  | const Font & | font,
|  | const Colorf & | color = StandardColorf::white(),
|  | int | id = -1 )

Add text.

Parameters

  text | = String
  font | = Font
  color | = Colorf
  id | = value

References clan::color, and clan::StandardColorf::white().

## ◆ clear()

void clan::SpanLayout::clear | ( |  | ) |

Clear.

## ◆ draw_layout()

void clan::SpanLayout::draw_layout | ( | Canvas & | canvas | ) |

Draw layout.

Parameters

  canvas | = Canvas

## ◆ draw_layout_ellipsis()

void clan::SpanLayout::draw_layout_ellipsis | ( | Canvas & | canvas,
|  | const Rect & | content_rect )

Draw layout generating ellipsis for clipped text.

Parameters

  canvas | = Canvas
  content_rect | = Clipping rectangle

## ◆ find_preferred_size()

Size clan::SpanLayout::find_preferred_size | ( | Canvas & | canvas | ) |

Find preferred size.

Parameters

  canvas | = Canvas

Returns
  Size

## ◆ get_combined_text()

std::string clan::SpanLayout::get_combined_text | ( |  | ) | const

Get Combined text.

Returns
  combined_text

## ◆ get_first_baseline_offset()

int clan::SpanLayout::get_first_baseline_offset | ( |  | ) |

Returns the baseline offset for the first baseline.

## ◆ get_last_baseline_offset()

int clan::SpanLayout::get_last_baseline_offset | ( |  | ) |

Returns the baseline offset for the last baseline.

## ◆ get_rect()

Rect clan::SpanLayout::get_rect | ( |  | ) | const

Get Rect.

Returns
  rect

## ◆ get_rect_by_id()

std::vector< Rect > clan::SpanLayout::get_rect_by_id | ( | int | id | ) | const

Get Rect By Id.

Returns
  rect

## ◆ get_size()

Size clan::SpanLayout::get_size | ( |  | ) | const

Get Size.

Returns
  size

## ◆ hide_cursor()

void clan::SpanLayout::hide_cursor | ( |  | ) |

Hides the cursor caret.

## ◆ hit_test()

HitTestResult clan::SpanLayout::hit_test | ( | Canvas & | canvas,
|  | const Point & | pos )

Hit test.

Parameters

  canvas | = Canvas
  pos | = Point

Returns
  Hit Test Result

## ◆ layout()

void clan::SpanLayout::layout | ( | Canvas & | canvas,
|  | int | max_width )

Layout.

Parameters

  canvas | = Canvas
  max_width | = value

## ◆ set_align()

void clan::SpanLayout::set_align | ( | SpanAlign | align | ) |

Sets the text alignment.

Alignment is applied when layout() is called

Parameters

  align | = The alignment

## ◆ set_component_geometry()

void clan::SpanLayout::set_component_geometry | ( |  | ) |

Set component geometry.

## ◆ set_cursor_color()

void clan::SpanLayout::set_cursor_color | ( | const Colorf & | color | ) |

Sets the cursor color.

Parameters

  color | = Color of cursor

References clan::color.

## ◆ set_cursor_overwrite_mode()

void clan::SpanLayout::set_cursor_overwrite_mode | ( | bool | enable | ) |

Toggles whether the cursor caret is shown as a solid box or a line.

Parameters

  enable | = Shows the cursor as a solid box if set to true

## ◆ set_cursor_pos()

void clan::SpanLayout::set_cursor_pos | ( | std::string::size_type | pos | ) |

Sets the cursor position.

Parameters

  pos | = Index of cursor

## ◆ set_position()

void clan::SpanLayout::set_position | ( | const Point & | pos | ) |

Set position.

Parameters

  pos | = Point

## ◆ set_selection_colors()

void clan::SpanLayout::set_selection_colors | ( | const Colorf & | foreground,
|  | const Colorf & | background )

Set selection colors.

Parameters

  foreground | = Colorf
  background | = Colorf

## ◆ set_selection_range()

void clan::SpanLayout::set_selection_range | ( | std::string::size_type | start,
|  | std::string::size_type | end )

Set selection range.

Parameters

  size_type | = String
  size_type | = String

References clan::end.

## ◆ show_cursor()

void clan::SpanLayout::show_cursor | ( |  | ) |

Shows the cursor caret.

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

- span_layout.h