# NWidgetHorizontal Class Reference
[Hierarchical widgets]

Horizontal container. More...

`#include <widget_type.h>`

Inheritance diagram for NWidgetHorizontal:

## Public Member Functions
| NWidgetHorizontal (NWidContainerFlags flags=NC_NONE)
| Horizontal container widget.
void | SetupSmallestSize (Window *w, bool init_array)
| Compute smallest size needed by the widget.
void | AssignSizePosition (SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
| Assign size and position to the widget.

## Detailed Description

Horizontal container.

Definition at line 382 of file widget_type.h.

## Constructor & Destructor Documentation

NWidgetHorizontal::NWidgetHorizontal | ( | NWidContainerFlags | flags = `NC_NONE` | ) |

Horizontal container widget.

Definition at line 1107 of file widget.cpp.

## Member Function Documentation

void NWidgetHorizontal::SetupSmallestSize | ( | Window * | w,
|  | bool | init_array |
| ) |  |  | `[virtual]`

Compute smallest size needed by the widget.

The smallest size of a widget is the smallest size that a widget needs to display itself properly. In addition, filling and resizing of the widget are computed. The function calls Window::UpdateWidgetSize for each leaf widget and background widget without child with a non-negative index.

Parameters:

  | w | Window owning the widget.
  | init_array | Initialize the `w->nested_array`.

Note:
  After the computation, the results can be queried by accessing the smallest_x and smallest_y data members of the widget.

Implements NWidgetBase.

Definition at line 1111 of file widget.cpp.

References NWidgetBase::fill_x, NWidgetBase::fill_y, NWidgetPIPContainer::flags, NWidgetContainer::head, LeastCommonMultiple(), max(), NC_EQUALSIZE, NWidgetBase::next, NWidgetBase::padding_left, NWidgetPIPContainer::pip_inter, NWidgetPIPContainer::pip_post, NWidgetPIPContainer::pip_pre, NWidgetBase::resize_x, NWidgetBase::resize_y, NWidgetBase::smallest_x, NWidgetBase::smallest_y, and ST_SMALLEST.

void NWidgetHorizontal::AssignSizePosition | ( | SizingType | sizing,
|  | uint | x,
|  | uint | y,
|  | uint | given_width,
|  | uint | given_height,
|  | bool | rtl |
| ) |  |  | `[virtual]`

Assign size and position to the widget.

Parameters:

  | sizing | Type of resizing to perform.
  | x | Horizontal offset of the widget relative to the left edge of the window.
  | y | Vertical offset of the widget relative to the top edge of the window.
  | given_width | Width allocated to the widget.
  | given_height | Height allocated to the widget.
  | rtl | Adapt for right-to-left languages (position contents of horizontal containers backwards).

Afterwards, pos_x and pos_y contain the top-left position of the widget, smallest_x and smallest_y contain the smallest size such that all widgets of the window are consistent, and current_x and current_y contain the current size.

Implements NWidgetBase.

Reimplemented in NWidgetHorizontalLTR.

Definition at line 1178 of file widget.cpp.

References NWidgetBase::AssignSizePosition(), ComputeMaxSize(), NWidgetBase::current_x, NWidgetBase::current_y, NWidgetContainer::head, max(), NWidgetBase::next, NWidgetBase::padding_left, NWidgetBase::padding_right, NWidgetBase::padding_top, NWidgetBase::prev, NWidgetBase::smallest_x, NWidgetBase::smallest_y, ST_SMALLEST, NWidgetBase::StoreSizePosition(), and NWidgetContainer::tail.

Referenced by NWidgetHorizontalLTR::AssignSizePosition().

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

- src/widget_type.h
- src/widget.cpp