# CompanyWindow Struct Reference

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

Inheritance diagram for CompanyWindow:

## Public Types
enum | CompanyWindowPlanes { CWP_MP_EMPTY = 0, CWP_MP_C_PWD, 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 (const 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.
## Data Fields
CompanyWindowWidgets | query_widget

## Detailed Description

Window with general information about a company.

Definition at line 1697 of file company_gui.cpp.

## Member Enumeration Documentation

enum CompanyWindow::CompanyWindowPlanes

Display planes in the company window.

Enumerator:

  CWP_MP_EMPTY | Do not display any multiplayer button.
  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 1702 of file company_gui.cpp.

## Member Function Documentation

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

References _settings_game, EconomySettings::allow_shares, COMPANY_SPECTATOR, CW_WIDGET_SELECT_BUTTONS, CW_WIDGET_SELECT_MULTIPLAYER, CW_WIDGET_SELECT_RELOCATE, CWP_BUTTONS_LOCAL, CWP_BUTTONS_OTHER, CWP_MP_C_JOIN, CWP_MP_C_PWD, CWP_MP_EMPTY, CWP_RELOCATE_HIDE, CWP_RELOCATE_SHOW, CWP_VB_BUILD, CWP_VB_VIEW, Window::DisableWidget(), Window::DrawWidgets(), GameSettings::economy, INVALID_OWNER, INVALID_TILE, Window::IsShaded(), Window::SetDirty(), NWidgetStacked::SetDisplayedPlane(), Window::SetWidgetDisabledState(), NWidgetStacked::shown_plane, 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 1795 of file company_gui.cpp.

References CW_WIDGET_HAS_PASSWORD, GetSpriteSize(), GetStringBoundingBox(), lengthof, max(), maxdim(), SetDParam(), and Dimension::width.

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

References assert_compile(), Rect::bottom, CW_WIDGET_HAS_PASSWORD, DrawCompanyManagerFace(), DrawSprite(), DrawString(), DrawStringMultiLine(), FONT_HEIGHT_NORMAL, Rect::left, lengthof, Rect::right, SA_CENTER, SetDParam(), Rect::top, 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 1901 of file company_gui.cpp.

References CalculateCompanyValue(), SetDParam(), 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 1919 of file company_gui.cpp.

References _ctrl_pressed, BringWindowToFrontById(), CMD_BUY_SHARE_IN_COMPANY, CMD_MSG, CMD_SELL_SHARE_IN_COMPANY, CS_ALPHANUMERAL, DoCommandP(), DoSelectCompanyManagerFace(), HT_RECT, Window::LowerWidget(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_BYTES, MAX_LENGTH_COMPANY_NAME_PIXELS, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, QSF_ENABLE_DEFAULT, SetDParam(), SetTileSelectSize(), Window::SetWidgetDirty(), ShowQueryString(), 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 2004 of file company_gui.cpp.

References CMD_BUILD_COMPANY_HQ, CMD_MSG, DoCommandP(), 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 2017 of file company_gui.cpp.

References CMD_MSG, CMD_RENAME_COMPANY, CMD_RENAME_PRESIDENT, DoCommandP(), and Window::window_number.

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

- src/company_gui.cpp