# company_gui.h File Reference

GUI Functions related to companies. More...

`#include "company_type.h"`
`#include "gfx_type.h"`

Go to the source code of this file.

## Functions
TextColour | GetDrawStringCompanyColour (CompanyID company)
| Get the colour for DrawString-subroutines which matches the colour of the company.
void | DrawCompanyIcon (CompanyID c, int x, int y)
| Draw the icon of a company.
void | ShowCompanyStations (CompanyID company)
| Opens window with list of company's stations.
void | ShowCompanyFinances (CompanyID company)
| Open the finances window of a company.
void | ShowCompany (CompanyID company)
void | InvalidateCompanyWindows (const Company *c)
| Refresh all windows owned by a company.
void | DeleteCompanyWindows (CompanyID company)
| Delete all windows of a company.

## Detailed Description

GUI Functions related to companies.

Definition in file company_gui.h.

## Function Documentation

void DeleteCompanyWindows | ( | CompanyID | id | ) |

Delete all windows of a company.

We identify windows of a company by looking at the caption colour. If it is equal to the company ID then we say the window belongs to the company and should be deleted

Parameters:

  | id | company identifier

Definition at line 765 of file window.cpp.

References DeleteWindowById(), and Window::owner.

Referenced by CmdCompanyCtrl(), and Company::~Company().

void DrawCompanyIcon | ( | CompanyID | c,
|  | int | x,
|  | int | y |
| ) |  |  |

Draw the icon of a company.

Parameters:

  | c | Company that needs its icon drawn.
  | x | Horizontal coordinate of the icon.
  | y | Vertical coordinate of the icon.

Definition at line 135 of file company_cmd.cpp.

TextColour GetDrawStringCompanyColour | ( | CompanyID | company | ) |

Get the colour for DrawString-subroutines which matches the colour of the company.

Parameters:

  | company | Company to get the colour of.

Returns:
  Colour of company.

Definition at line 123 of file company_cmd.cpp.

References _colour_gradient, _company_colours, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and TC_IS_PALETTE_COLOUR.

void InvalidateCompanyWindows | ( | const Company * | company | ) |

Refresh all windows owned by a company.

Parameters:

  | company | Company that changed, and needs its windows refreshed.

Definition at line 175 of file company_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, and SetWindowDirty().

Referenced by CmdDecreaseLoan(), CmdIncreaseLoan(), and SubtractMoneyFromAnyCompany().

void ShowCompanyFinances | ( | CompanyID | company | ) |

Open the finances window of a company.

Parameters:

  | company | Company to show finances of.

Precondition:
  is company a valid company.

Definition at line 489 of file company_gui.cpp.

References BringWindowToFrontById(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

Referenced by CompaniesYearlyLoop(), StatusBarWindow::OnClick(), and MainToolbarWindow::OnKeyPress().

void ShowCompanyStations | ( | CompanyID | company | ) |

Opens window with list of company's stations.

Parameters:

  | company | whose stations' list show

Definition at line 808 of file station_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

Referenced by MainToolbarWindow::OnKeyPress().