# window_func.h File Reference

Window functions not directly related to making/drawing windows. More...

`#include "window_type.h"`
`#include "player_type.h"`

Go to the source code of this file.

## Functions

void | SetWindowDirty (const Window *w)
| Marks the window as dirty for repaint.
void | SendWindowMessage (WindowClass wnd_class, WindowNumber wnd_num, int msg, int wparam, int lparam)
| Send a message from one window to another.
void | SendWindowMessageClass (WindowClass wnd_class, int msg, int wparam, int lparam)
| Send a message from one window to another.
Window * | FindWindowById (WindowClass cls, WindowNumber number)
void | DeleteWindow (Window *w)
void | ChangeWindowOwner (PlayerID old_player, PlayerID new_player)
| Change the owner of all the windows one player can take over from another player in the case of a company merger.
void | ResizeWindow (Window *w, int x, int y)
| Update all the widgets of a window based on their resize flags Both the areas of the old window and the new sized window are set dirty ensuring proper redrawal.
int | PositionMainToolbar (Window *w)
void | InitWindowSystem ()
void | UnInitWindowSystem ()
void | ResetWindowSystem ()
void | SetupColorsAndInitialWindow ()
void | InputLoop ()
void | InvalidateThisWindowData (Window *w)
void | InvalidateWindowData (WindowClass cls, WindowNumber number)
void | RelocateAllWindows (int neww, int newh)
void | DeleteNonVitalWindows ()
void | DeleteAllNonVitalWindows ()
| It is possible that a stickied window gets to a position where the 'close' button is outside the gaming area.
void | HideVitalWindows ()
| Delete all always on-top windows to get an empty screen.
void | ShowVitalWindows ()
Window ** | FindWindowZPosition (const Window *w)
| Find the z-value of a window.
void | InvalidateWindow (WindowClass cls, WindowNumber number)
void | InvalidateWindowWidget (WindowClass cls, WindowNumber number, byte widget_index)
void | InvalidateWindowClasses (WindowClass cls)
void | InvalidateWindowClassesData (WindowClass cls)
void | DeleteWindowById (WindowClass cls, WindowNumber number)
void | DeleteWindowByClass (WindowClass cls)

## Detailed Description

Window functions not directly related to making/drawing windows.

Definition in file window_func.h.

## Function Documentation

void ChangeWindowOwner | ( | PlayerID | old_player,
|  | PlayerID | new_player |
| ) |  |  |

Change the owner of all the windows one player can take over from another player in the case of a company merger.

Do not change ownership of windows that need to be deleted once takeover is complete

Parameters:

  | old_player | PlayerID of original owner of the window
  | new_player | PlayerID of the new owner of the window

Definition at line 447 of file window.cpp.

void DeleteAllNonVitalWindows | ( |  | ) |

It is possible that a stickied window gets to a position where the 'close' button is outside the gaming area.

You cannot close it then; except with this function. It closes all windows calling the standard function, then, does a little hacked loop of closing all stickied windows. Note that standard windows (status bar, etc.) are not stickied, so these aren't affected

Definition at line 2069 of file window.cpp.

Window** FindWindowZPosition | ( | const Window * | w | ) |

Find the z-value of a window.

A window must already be open or the behaviour is undefined but function should never fail

Parameters:

  | w | window to query Z Position

Returns:
  the window that matches it

Definition at line 338 of file window.cpp.

void ResizeWindow | ( | Window * | w,
|  | int | x,
|  | int | y |
| ) |  |  |

Update all the widgets of a window based on their resize flags Both the areas of the old window and the new sized window are set dirty ensuring proper redrawal.

Parameters:

  | w | Window to resize
  | x | delta x-size of changed window (positive if larger, etc.)
  | y | delta y-size of changed window

Definition at line 1167 of file window.cpp.

void SendWindowMessage | ( | WindowClass | wnd_class,
|  | WindowNumber | wnd_num,
|  | int | msg,
|  | int | wparam,
|  | int | lparam |
| ) |  |  |

Send a message from one window to another.

The receiving window is found by

Parameters:

  | wnd_class | see WindowClass class AND
  | wnd_num | see WindowNumber number, mostly 0
  | msg | Specifies the message to be sent
  | wparam | Specifies additional message-specific information
  | lparam | Specifies additional message-specific information

Definition at line 1612 of file window.cpp.

void SendWindowMessageClass | ( | WindowClass | wnd_class,
|  | int | msg,
|  | int | wparam,
|  | int | lparam |
| ) |  |  |

Send a message from one window to another.

The message will be sent to ALL windows of the windowclass specified in the first parameter

Parameters:

  | wnd_class | see WindowClass class
  | msg | Specifies the message to be sent
  | wparam | Specifies additional message-specific information
  | lparam | Specifies additional message-specific information

Definition at line 1625 of file window.cpp.