Public Member Functions | Protected Member Functions | Protected Attributes

# WatchCompany Class Reference

Inheritance diagram for WatchCompany:

## Public Member Functions
| WatchCompany (const WindowDesc *desc, int window_number, CompanyID company_to_watch)
| Watch Company Class Constructor.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
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 | OnResize ()
| Called after the window got resized.
virtual void | OnScroll (Point delta)
| Handle the request for (viewport) scrolling.
virtual void | OnMouseWheel (int wheel)
| The mouse wheel has been turned.
virtual void | OnInvalidateData (int data, bool gui_scope)
| Some data on this window has become invalid.
virtual void | OnTick ()
| Used to decrement the activity counter.
void | OnDoCommand (CompanyByte company, TileIndex tile)
| OnDoCommand function - Called by the DoCommand.
## Protected Member Functions
void | SetWatchWindowTitle ()
void | ScrollToTile (TileIndex tile)
## Protected Attributes
CompanyID | watched_company
int | company_activity [MAX_COMPANIES]
int | company_count_client [MAX_COMPANIES]
char | company_name [MAX_LENGTH_COMPANY_NAME_CHARS]

## Detailed Description

Definition at line 30 of file watch_gui.h.

## Constructor & Destructor Documentation

WatchCompany::WatchCompany | ( | const WindowDesc * | desc,
|  | int | window_number,
|  | CompanyID | company_to_watch = `INVALID_COMPANY` |
| ) |  |  |

Watch Company Class Constructor.

Parameters:

  | desc | Window Descriptor The Window Descriptor
  | window_number | The window number for the class
  | company_to_watch | Company ID for watching a particular company

Definition at line 154 of file watch_gui.cpp.

References COMPANY_FIRST, ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, FindWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), NWidgetViewport::InitializeViewport(), Window::InitNested(), INVALID_COMPANY, Window::InvalidateData(), CompanyProperties::last_build_coordinate, lastof, Window::owner, ViewportData::scrollpos_x, ViewportData::scrollpos_y, Window::viewport, ViewPort::virtual_height, ViewPort::virtual_width, and ZOOM_LVL_NORMAL.

## Member Function Documentation

void WatchCompany::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 209 of file watch_gui.cpp.

References _networking, DrawCompanyIcon(), DrawSprite(), GetSpriteSize(), IsInsideMM(), Company::IsValidAiID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and Window::IsWidgetDisabled().

void WatchCompany::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 275 of file watch_gui.cpp.

References ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, DoZoomInOutWindow(), FindWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, IsInsideMM(), Window::IsWidgetDisabled(), CompanyProperties::last_build_coordinate, lastof, Window::LowerWidget(), Window::owner, Window::RaiseWidget(), ViewportData::scrollpos_x, ViewportData::scrollpos_y, Window::SetDirty(), SetDParam(), Window::ToggleWidgetLoweredState(), Window::viewport, ViewPort::virtual_height, ViewPort::virtual_width, ZOOM_IN, and ZOOM_OUT.

void WatchCompany::OnDoCommand | ( | CompanyByte | company,
|  | TileIndex | tile |
| ) |  |  |

OnDoCommand function - Called by the DoCommand.

Parameters:

  | company | The company ID who's client is building
  | tile | The tile number where action took place

Definition at line 384 of file watch_gui.cpp.

References Window::SetDirty().

Referenced by DoCommandPInternal().

void WatchCompany::OnInvalidateData | ( | int | data,
|  | bool | gui_scope |
| ) |  |  | `[virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.
  | gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Reimplemented from Window.

Definition at line 328 of file watch_gui.cpp.

References _networking, NetworkClientInfo::client_playas, COMPANY_FIRST, FOR_ALL_CLIENT_INFOS, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HandleZoomMessage(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), lastof, Window::LowerWidget(), Window::RaiseWidget(), SetDParam(), Window::SetWidgetDisabledState(), and Window::viewport.

void WatchCompany::OnMouseWheel | ( | int | wheel | ) | `[virtual]`

The mouse wheel has been turned.

Parameters:

  | wheel | the amount of movement of the mouse wheel.

Reimplemented from Window.

Definition at line 270 of file watch_gui.cpp.

void WatchCompany::OnResize | ( |  | ) | `[virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 251 of file watch_gui.cpp.

References NWidgetViewport::UpdateViewportCoordinates(), and Window::viewport.

void WatchCompany::OnScroll | ( | Point | delta | ) | `[virtual]`

Handle the request for (viewport) scrolling.

Parameters:

  | delta | the amount the viewport must be scrolled.

Reimplemented from Window.

Definition at line 259 of file watch_gui.cpp.

References ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, IsPtInWindowViewport(), ScaleByZoom(), ViewportData::scrollpos_x, ViewportData::scrollpos_y, Window::viewport, and ViewPort::zoom.

void WatchCompany::OnTick | ( |  | ) | `[virtual]`

Used to decrement the activity counter.

Reimplemented from Window.

Definition at line 405 of file watch_gui.cpp.

References COMPANY_FIRST, and Window::SetDirty().

void WatchCompany::SetStringParameters | ( | int | widget | ) | const`[virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 193 of file watch_gui.cpp.

References SetDParamStr().

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

- src/watch_gui.h
- src/watch_gui.cpp