Public Types | Public Member Functions | Data Fields

# CompanyWindow Struct Reference

Window with general information about a company. More...

Inheritance diagram for CompanyWindow:

## Public Types
enum | CompanyWindowPlanes { CWP_MP_C_PWD = 0, CWP_MP_C_JOIN, CWP_VB_VIEW = 0, CWP_VB_BUILD, CWP_RELOCATE_SHOW = 0, CWP_RELOCATE_HIDE, CWP_BUTTONS_LOCAL = 0, CWP_BUTTONS_OTHER }
| Display planes in the company window. More...
## Public Member Functions
| CompanyWindow (WindowDesc *desc, WindowNumber window_number)
virtual void | OnPaint ()
| The window must be repainted.
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 | SetStringParameters (int widget) const
| Initialize string parameters for a 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 | OnHundredthTick ()
| Called once every 100 (game) ticks.
virtual void | OnPlaceObject (Point pt, TileIndex tile)
| The user clicked some place on the map when a tile highlight mode has been set.
virtual void | OnPlaceObjectAbort ()
| The user cancelled a tile highlight mode that has been set.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
## Data Fields
CompanyWidgets | query_widget

## Detailed Description

Window with general information about a company.

Definition at line 1973 of file company_gui.cpp.

## Member Enumeration Documentation

enum CompanyWindow::CompanyWindowPlanes

Display planes in the company window.

Enumerator:

  CWP_MP_C_PWD | Display the company password button.
  CWP_MP_C_JOIN | Display the join company button.
  CWP_VB_VIEW | Display the view button.
  CWP_VB_BUILD | Display the build button.
  CWP_RELOCATE_SHOW | Show the relocate HQ button.
  CWP_RELOCATE_HIDE | Hide the relocate HQ button.
  CWP_BUTTONS_LOCAL | Buttons of the local company.
  CWP_BUTTONS_OTHER | Buttons of the other companies.

Definition at line 1978 of file company_gui.cpp.

## Member Function Documentation

virtual void CompanyWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, 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 2126 of file company_gui.cpp.

References _networking, CompanyInfrastructure::airport, CompanyProperties::colour, DrawCompanyManagerFace(), DrawSprite(), DrawString(), DrawStringMultiLine(), CompanyProperties::face, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetSpriteSize(), Company::group_all, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, lengthof, NetworkCompanyIsPassworded(), GroupStatistics::num_vehicle, CompanyInfrastructure::rail, CompanyInfrastructure::road, SA_HOR_CENTER, SetDParam(), CompanyInfrastructure::signal, CompanyInfrastructure::station, CompanyInfrastructure::water, WID_C_DESC_COLOUR_SCHEME_EXAMPLE, WID_C_DESC_INFRASTRUCTURE_COUNTS, WID_C_DESC_OWNERS, WID_C_DESC_VEHICLE_COUNTS, WID_C_FACE, WID_C_FACE_TITLE, WID_C_HAS_PASSWORD, and Window::window_number.

virtual void CompanyWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, 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 2257 of file company_gui.cpp.

References _ctrl_pressed, _local_company, _network_server, BringWindowToFrontById(), CLIENT_ID_SERVER, CMD_BUY_SHARE_IN_COMPANY, CMD_MSG, CMD_SELL_SHARE_IN_COMPANY, CS_ALPHANUMERAL, DoCommandP(), DoSelectCompanyManagerFace(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HT_RECT, Window::IsWidgetLowered(), Window::LowerWidget(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_CHARS, MAX_LENGTH_PRESIDENT_NAME_CHARS, NETWORK_PASSWORD_LENGTH, NetworkClientRequestMove(), NetworkCompanyIsPassworded(), NetworkServerDoMove(), QSF_ENABLE_DEFAULT, QSF_LEN_IN_CHARS, Window::RaiseButtons(), ScrollMainWindowToTile(), SetDParam(), SetTileSelectSize(), Window::SetWidgetDirty(), ShowCompanyInfrastructure(), ShowExtraViewPortWindow(), ShowQueryString(), WC_COMPANY_COLOUR, WID_C_BUILD_HQ, WID_C_BUY_SHARE, WID_C_COLOUR_SCHEME, WID_C_COMPANY_JOIN, WID_C_COMPANY_NAME, WID_C_COMPANY_PASSWORD, WID_C_NEW_FACE, WID_C_PRESIDENT_NAME, WID_C_RELOCATE_HQ, WID_C_SELL_SHARE, WID_C_VIEW_HQ, WID_C_VIEW_INFRASTRUCTURE, and Window::window_number.

virtual void CompanyWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[inline, 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 2398 of file company_gui.cpp.

References _local_company, _settings_game, EconomySettings::allow_shares, COMPANY_SPECTATOR, Window::DisableWidget(), GameSettings::economy, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), INVALID_OWNER, CompanyProperties::is_ai, Window::SetWidgetDisabledState(), WID_C_BUY_SHARE, WID_C_SELL_SHARE, and Window::window_number.

virtual void CompanyWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

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

Reimplemented from Window.

Definition at line 2003 of file company_gui.cpp.

References _local_company, _networking, CWP_BUTTONS_LOCAL, CWP_MP_C_JOIN, CWP_MP_C_PWD, CWP_RELOCATE_HIDE, CWP_RELOCATE_SHOW, CWP_VB_BUILD, CWP_VB_VIEW, Window::DrawWidgets(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), INVALID_COMPANY, INVALID_TILE, Window::InvalidateData(), CompanyProperties::is_ai, Window::IsShaded(), lengthof, CompanyProperties::location_of_HQ, Window::ReInit(), Window::SetDirty(), NWidgetStacked::SetDisplayedPlane(), Window::SetWidgetDisabledState(), CompanyProperties::share_owners, NWidgetStacked::shown_plane, SZSP_NONE, WID_C_COMPANY_JOIN, WID_C_VIEW_HQ, and Window::window_number.

virtual void CompanyWindow::OnPlaceObject | ( | Point | pt,
|  | TileIndex | tile |
| ) |  |  | `[inline, virtual]`

The user clicked some place on the map when a tile highlight mode has been set.

Parameters:

  | pt | the exact point on the map that has been clicked.
  | tile | the tile on the map that has been clicked.

Reimplemented from Window.

Definition at line 2356 of file company_gui.cpp.

References CMD_BUILD_OBJECT, CMD_MSG, DoCommandP(), OBJECT_HQ, and Window::RaiseButtons().

virtual void CompanyWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 2369 of file company_gui.cpp.

References CMD_MSG, CMD_RENAME_COMPANY, CMD_RENAME_PRESIDENT, DoCommandP(), NetworkClientRequestMove(), WID_C_COMPANY_JOIN, WID_C_COMPANY_NAME, WID_C_PRESIDENT_NAME, and Window::window_number.

virtual void CompanyWindow::SetStringParameters | ( | int | widget | ) | const`[inline, 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 2239 of file company_gui.cpp.

References CalculateCompanyValue(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), SetDParam(), WID_C_CAPTION, WID_C_DESC_COMPANY_VALUE, WID_C_DESC_INAUGURATION, and Window::window_number.

virtual void CompanyWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, 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.

Parameters:

  | 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 2072 of file company_gui.cpp.

References GetSpriteSize(), GetStringBoundingBox(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, lengthof, max(), maxdim(), SetDParam(), SetDParamMaxValue(), WID_C_DESC_COLOUR_SCHEME_EXAMPLE, WID_C_DESC_COMPANY_VALUE, WID_C_DESC_INFRASTRUCTURE_COUNTS, WID_C_DESC_OWNERS, WID_C_DESC_VEHICLE_COUNTS, WID_C_HAS_PASSWORD, and Window::width.

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

- src/company_gui.cpp