# NWidgetContainer Class Reference
[Hierarchical widgets]

Baseclass for container widgets. More...

`#include <widget_type.h>`

Inheritance diagram for NWidgetContainer:

## Public Member Functions
| NWidgetContainer (WidgetType tp)
| Constructor container baseclass.
void | Add (NWidgetBase *wid)
| Append widget wid to container.
void | FillNestedArray (NWidgetBase **array, uint length)
bool | IsEmpty ()
| Return whether the container is empty.
NWidgetBase * | GetWidgetOfType (WidgetType tp)
| Retrieve a widget by its type.
## Protected Attributes
NWidgetBase * | head
| Pointer to first widget in container.
NWidgetBase * | tail
| Pointer to last widget in container.

## Detailed Description

Baseclass for container widgets.

Definition at line 299 of file widget_type.h.

## Constructor & Destructor Documentation

NWidgetContainer::NWidgetContainer | ( | WidgetType | tp | ) |

Constructor container baseclass.

Parameters:

  | tp | Type of the container.

Definition at line 877 of file widget.cpp.

References head, and tail.

## Member Function Documentation

void NWidgetContainer::Add | ( | NWidgetBase * | wid | ) |

Append widget wid to container.

Parameters:

  | wid | Widget to append.

Definition at line 907 of file widget.cpp.

References head, NWidgetBase::next, NWidgetBase::prev, and tail.

Referenced by NWidgetBackground::Add(), AddKey(), CargoWidgets(), MakeButtonsColumn(), MakeCargoButtons(), MakeCompanyButtonRows(), MakeDescriptionColumn(), MakeMainToolbar(), MakeNWidgetCompanyLines(), MakePerformanceDetailPanels(), MakeWidgetTree(), and MakeWindowNWidgetTree().

bool NWidgetContainer::IsEmpty | ( |  | ) | `[inline]`

Return whether the container is empty.

Definition at line 308 of file widget_type.h.

Referenced by AddKey().

NWidgetBase * NWidgetContainer::GetWidgetOfType | ( | WidgetType | tp | ) | `[virtual]`

Retrieve a widget by its type.

Parameters:

  | tp | Widget type to search for.

Returns:
  Returns the first widget of the specified type, or `NULL` if no widget can be found.

Reimplemented from NWidgetBase.

Definition at line 893 of file widget.cpp.

References NWidgetBase::GetWidgetOfType(), head, NWidgetBase::next, and NWidgetBase::type.

Referenced by NWidgetBackground::GetWidgetOfType(), and MakeWindowNWidgetTree().

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

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