Menu window to select cargoes and companies to show in a link graph overlay. More...
#include <linkgraph_gui.h>
Public Member Functions | |
LinkGraphLegendWindow (WindowDesc *desc, int window_number) | |
void | SetOverlay (LinkGraphOverlay *overlay) |
Set the overlay belonging to this menu and import its company/cargo settings. | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
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 99 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 472 of file linkgraph_gui.cpp.
References CargoSpec::abbrev, LinkGraph::cargo, DrawCompanyIcon(), DrawString(), FONT_HEIGHT_SMALL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Get(), GetSpriteSize(), GfxFillRect(), IsInsideMM(), Window::IsWidgetDisabled(), LinkGraphOverlay::LINK_COLOURS, 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 528 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 563 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 427 of file linkgraph_gui.cpp.
References LinkGraphOverlay::GetCargoMask(), LinkGraphOverlay::GetCompanyMask(), HasBit(), Window::IsWidgetDisabled(), and Window::SetWidgetLoweredState().
void LinkGraphLegendWindow::UpdateWidgetSize | ( | int | widget, | |
Dimension * | size, | |||
const Dimension & | padding, | |||
Dimension * | fill, | |||
Dimension * | resize | |||
) | [virtual] |
Update size and resize step of a widget in the window.
After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.
widget | Widget number. | |
size | Size of the widget. | |
padding | Recommended amount of space between the widget content and the widget edge. | |
fill | Fill step of the widget. | |
resize | Resize step of the widget. |
Reimplemented from Window.
Definition at line 443 of file linkgraph_gui.cpp.
References CargoSpec::abbrev, LinkGraph::cargo, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Get(), GetStringBoundingBox(), IsInsideMM(), CargoSpec::IsValid(), maxdim(), WD_FRAMERECT_LEFT, and WD_FRAMERECT_TOP.