# group_gui.cpp File Reference

GUI for the group window. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "textbuf_gui.h"`
`#include "command_func.h"`
`#include "vehicle_gui.h"`
`#include "vehicle_base.h"`
`#include "group.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "autoreplace_gui.h"`
`#include "company_func.h"`
`#include "widgets/dropdown_type.h"`
`#include "widgets/dropdown_func.h"`
`#include "tilehighlight_func.h"`
`#include "vehicle_gui_base.h"`
`#include "core/geometry_func.hpp"`
`#include "company_base.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
class | VehicleGroupWindow
## Typedefs
typedef GUIList< const Group * > | GUIGroupList
## Enumerations
enum | GroupListWidgets { GRP_WIDGET_CAPTION, GRP_WIDGET_SORT_BY_ORDER, GRP_WIDGET_SORT_BY_DROPDOWN, GRP_WIDGET_LIST_VEHICLE, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR, GRP_WIDGET_AVAILABLE_VEHICLES, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, GRP_WIDGET_STOP_ALL, GRP_WIDGET_START_ALL, GRP_WIDGET_ALL_VEHICLES, GRP_WIDGET_DEFAULT_VEHICLES, GRP_WIDGET_LIST_GROUP, GRP_WIDGET_LIST_GROUP_SCROLLBAR, GRP_WIDGET_CREATE_GROUP, GRP_WIDGET_DELETE_GROUP, GRP_WIDGET_RENAME_GROUP, GRP_WIDGET_REPLACE_PROTECTION }
enum | GroupActionListFunction { GALF_REPLACE, GALF_SERVICE, GALF_DEPOT, GALF_ADD_SHARED, GALF_REMOVE_ALL }
## Functions
static void | ShowGroupActionDropdown (Window *w, GroupID gid)
| Update/redraw the group action dropdown.
void | ShowCompanyGroup (CompanyID company, VehicleType vehicle_type)
static VehicleGroupWindow * | FindVehicleGroupWindow (VehicleType vt, Owner owner)
| Finds a group list window determined by vehicle type and owner.
void | CcCreateGroup (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
| Opens a 'Rename group' window for newly created group.
void | DeleteGroupHighlightOfVehicle (const Vehicle *v)
| Removes the highlight of a vehicle in a group window.
## Variables
static const NWidgetPart | _nested_group_widgets []
static WindowDesc | _other_group_desc (WDP_AUTO, 460, 246, WC_INVALID, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_group_widgets, lengthof(_nested_group_widgets))
static const WindowDesc | _train_group_desc (WDP_AUTO, 525, 246, WC_TRAINS_LIST, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_group_widgets, lengthof(_nested_group_widgets))

## Detailed Description

GUI for the group window.

Definition in file group_gui.cpp.

## Function Documentation

void CcCreateGroup | ( | const CommandCost & | result,
|  | TileIndex | tile,
|  | uint32 | p1,
|  | uint32 | p2 |
| ) |  |  |

Opens a 'Rename group' window for newly created group.

Parameters:

  | success | did command succeed?
  | tile | unused
  | p1 | vehicle type
  | p2 | unused

See also:
  CmdCreateGroup

Definition at line 745 of file group_gui.cpp.

References CommandCost::Failed(), FindVehicleGroupWindow(), and VEH_AIRCRAFT.

Referenced by VehicleGroupWindow::OnClick().

void DeleteGroupHighlightOfVehicle | ( | const Vehicle * | v | ) |

Removes the highlight of a vehicle in a group window.

Parameters:

  | *v | Vehicle to remove all highlights from

Definition at line 758 of file group_gui.cpp.

References FindVehicleGroupWindow(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, BaseVehicle::type, and VehicleGroupWindow::UnselectVehicle().

Referenced by Vehicle::PreDestructor().

static VehicleGroupWindow* FindVehicleGroupWindow | ( | VehicleType | vt,
|  | Owner | owner |
| ) |  |  | `[inline, static]`

Finds a group list window determined by vehicle type and owner.

Parameters:

  | vt | vehicle type
  | owner | owner of groups

Returns:
  pointer to VehicleGroupWindow, NULL if not found

Definition at line 732 of file group_gui.cpp.

References FindWindowById(), and GetWindowClassForVehicleType().

Referenced by CcCreateGroup(), and DeleteGroupHighlightOfVehicle().

static void ShowGroupActionDropdown | ( | Window * | w,
|  | GroupID | gid |
| ) |  |  | `[static]`

Update/redraw the group action dropdown.

Parameters:

  | w | the window the dropdown belongs to
  | gid | the currently selected group in the window

Definition at line 70 of file group_gui.cpp.

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

Referenced by VehicleGroupWindow::OnClick().