Menu window to select cargoes and companies to show in a link graph overlay. More...
#include <linkgraph_gui.h>
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 |
Menu window to select cargoes and companies to show in a link graph overlay.
Definition at line 98 of file linkgraph_gui.h.
void LinkGraphLegendWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 422 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.
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 478 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.
data | ignored | |
gui_scope | ignored |
Reimplemented from Window.
Definition at line 513 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 406 of file linkgraph_gui.cpp.
References LinkGraphOverlay::GetCargoMask(), LinkGraphOverlay::GetCompanyMask(), HasBit(), Window::IsWidgetDisabled(), and Window::SetWidgetLoweredState().