NWidgetPIPContainer Class Reference

Container with pre/inter/post child space. More...

#include <widget_type.h>

Inheritance diagram for NWidgetPIPContainer:
NWidgetContainer NWidgetBase ZeroedMemoryAllocator NWidgetHorizontal NWidgetMatrix NWidgetVertical NWidgetHorizontalLTR

Public Member Functions

 NWidgetPIPContainer (WidgetType tp, NWidContainerFlags flags=NC_NONE)
void SetPIP (uint8 pip_pre, uint8 pip_inter, uint8 pip_post)
 Set additional pre/inter/post space for the container.
void Draw (const Window *w)
 Draw the widgets of the tree.
NWidgetCoreGetWidgetFromPos (int x, int y)
 Retrieve a widget by its position.

Protected Attributes

NWidContainerFlags flags
 Flags of the container.
uint8 pip_pre
 Amount of space before first widget.
uint8 pip_inter
 Amount of space between widgets.
uint8 pip_post
 Amount of space after last widget.

Detailed Description

Container with pre/inter/post child space.

Definition at line 398 of file widget_type.h.


Member Function Documentation

void NWidgetPIPContainer::Draw ( const Window w  )  [virtual]

Draw the widgets of the tree.

The function calls Window::DrawWidget for each widget with a non-negative index, after the widget itself is painted.

Parameters:
w Window that owns the tree.

Implements NWidgetBase.

Reimplemented in NWidgetMatrix.

Definition at line 1020 of file widget.cpp.

References NWidgetContainer::head, and NWidgetBase::next.

Referenced by NWidgetBackground::Draw().

NWidgetCore * NWidgetPIPContainer::GetWidgetFromPos ( int  x,
int  y 
) [virtual]

Retrieve a widget by its position.

Parameters:
x Horizontal position relative to the left edge of the window.
y Vertical position relative to the top edge of the window.
Returns:
Returns the deepest nested widget that covers the given position, or NULL if no widget can be found.

Implements NWidgetBase.

Reimplemented in NWidgetMatrix.

Definition at line 1027 of file widget.cpp.

References NWidgetBase::current_x, NWidgetBase::current_y, NWidgetCore::GetWidgetFromPos(), NWidgetContainer::head, IsInsideBS(), NWidgetBase::next, NWidgetBase::pos_x, and NWidgetBase::pos_y.

Referenced by NWidgetBackground::GetWidgetFromPos().

void NWidgetPIPContainer::SetPIP ( uint8  pip_pre,
uint8  pip_inter,
uint8  pip_post 
)

Set additional pre/inter/post space for the container.

Parameters:
pip_pre Additional space in front of the first child widget (above for the vertical container, at the left for the horizontal container).
pip_inter Additional space between two child widgets.
pip_post Additional space after the last child widget (below for the vertical container, at the right for the horizontal container).

Definition at line 1013 of file widget.cpp.

Referenced by MakeNWidget(), and NWidgetBackground::SetPIP().


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

Generated on Thu Apr 14 00:49:16 2011 for OpenTTD by  doxygen 1.6.1