Public Member Functions | Private Member Functions | Private Attributes

# LinkGraphLegendWindow Struct Reference

Menu window to select cargoes and companies to show in a link graph overlay. More...

`#include <linkgraph_gui.h>`

Inheritance diagram for LinkGraphLegendWindow:

## Public Member Functions
| LinkGraphLegendWindow (const WindowDesc *desc, int window_number)
void | SetOverlay (LinkGraphOverlay *overlay)
| Set the overlay belonging to this menu and import its company/cargo settings.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Invalidate the data of this window if the cargoes or companies have changed.
## Private Member Functions
void | UpdateOverlayCompanies ()
| Update the overlay with the new company selection.
void | UpdateOverlayCargoes ()
| Update the overlay with the new cargo selection.
## Private Attributes
LinkGraphOverlay * | overlay

## Detailed Description

Menu window to select cargoes and companies to show in a link graph overlay.

Definition at line 100 of file linkgraph_gui.h.

## Member Function Documentation

void LinkGraphLegendWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 417 of file linkgraph_gui.cpp.

References CargoSpec::abbrev, NWidgetBase::current_x, DrawCompanyIcon(), DrawString(), CargoSpec::Get(), GetSpriteSize(), GfxFillRect(), IsInsideMM(), Window::IsWidgetDisabled(), LinkGraphOverlay::LINK_COLOURS, NWidgetBase::pos_x, NWidgetBase::pos_y, and SA_HOR_CENTER.

void LinkGraphLegendWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 473 of file linkgraph_gui.cpp.

References IsInsideMM(), Window::IsWidgetDisabled(), Window::SetDirty(), Window::SetWidgetLoweredState(), Window::ToggleWidgetLoweredState(), UpdateOverlayCargoes(), and UpdateOverlayCompanies().

void LinkGraphLegendWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[virtual]`

Invalidate the data of this window if the cargoes or companies have changed.

Parameters:

  | data | ignored
  | gui_scope | ignored

Reimplemented from Window.

Definition at line 511 of file linkgraph_gui.cpp.

References COMPANY_FIRST, CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and Window::SetWidgetDisabledState().

void LinkGraphLegendWindow::SetOverlay | ( | LinkGraphOverlay * | overlay | ) |

Set the overlay belonging to this menu and import its company/cargo settings.

overlay New overlay for this menu.

Definition at line 401 of file linkgraph_gui.cpp.

References LinkGraphOverlay::GetCargoMask(), LinkGraphOverlay::GetCompanyMask(), HasBit(), Window::IsWidgetDisabled(), and Window::SetWidgetLoweredState().

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

- src/linkgraph_gui.h
- src/linkgraph_gui.cpp