# NWidgetVertical Class Reference
[Hierarchical widgets]

Vertical container. More...

`#include <widget_type.h>`

Inheritance diagram for NWidgetVertical:

## Public Member Functions

| NWidgetVertical (NWidContainerFlags flags=NC_NONE)
| Vertical 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

Vertical container.

Definition at line 399 of file widget_type.h.

## Constructor & Destructor Documentation

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

Vertical container widget.

Definition at line 1259 of file widget.cpp.

## Member Function Documentation

void NWidgetVertical::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 1263 of file widget.cpp.

References NWidgetBase::fill_x, NWidgetBase::fill_y, NWidgetPIPContainer::flags, NWidgetContainer::head, LeastCommonMultiple(), max(), NC_EQUALSIZE, NWidgetBase::next, NWidgetBase::padding_top, 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 NWidgetVertical::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.

Definition at line 1330 of file widget.cpp.

References ComputeMaxSize(), NWidgetContainer::head, max(), NWidgetBase::next, NWidgetBase::smallest_x, NWidgetBase::smallest_y, ST_SMALLEST, and NWidgetBase::StoreSizePosition().

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

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