# group_gui.cpp File Reference

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "gui.h"`
`#include "window_gui.h"`
`#include "textbuf_gui.h"`
`#include "command_func.h"`
`#include "engine.h"`
`#include "vehicle_gui.h"`
`#include "depot.h"`
`#include "train.h"`
`#include "group.h"`
`#include "debug.h"`
`#include "strings_func.h"`
`#include "core/alloc_func.hpp"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "autoreplace_gui.h"`
`#include "string_func.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "player_func.h"`
`#include "widgets/dropdown_type.h"`
`#include "widgets/dropdown_func.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | Sorting
## Enumerations
enum | GroupListWidgets { GRP_WIDGET_CLOSEBOX = 0, GRP_WIDGET_CAPTION, GRP_WIDGET_STICKY, GRP_WIDGET_EMPTY_TOP_LEFT, GRP_WIDGET_ALL_VEHICLES, GRP_WIDGET_DEFAULT_VEHICLES, GRP_WIDGET_LIST_GROUP, GRP_WIDGET_LIST_GROUP_SCROLLBAR, GRP_WIDGET_SORT_BY_ORDER, GRP_WIDGET_SORT_BY_DROPDOWN, GRP_WIDGET_EMPTY_TOP_RIGHT, GRP_WIDGET_LIST_VEHICLE, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR, GRP_WIDGET_CREATE_GROUP, GRP_WIDGET_DELETE_GROUP, GRP_WIDGET_RENAME_GROUP, GRP_WIDGET_EMPTY1, GRP_WIDGET_REPLACE_PROTECTION, GRP_WIDGET_EMPTY2, GRP_WIDGET_AVAILABLE_VEHICLES, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, GRP_WIDGET_STOP_ALL, GRP_WIDGET_START_ALL, GRP_WIDGET_EMPTY_BOTTOM_RIGHT, GRP_WIDGET_RESIZE }
enum | GroupActionListFunction { GALF_REPLACE, GALF_SERVICE, GALF_DEPOT, GALF_ADD_SHARED, GALF_REMOVE_ALL }
## Functions
static void | BuildGroupList (grouplist_d *gl, PlayerID owner, VehicleType vehicle_type)
static int CDECL | GroupNameSorter (const void *a, const void *b)
static void | SortGroupList (grouplist_d *gl)
static void | CreateVehicleGroupWindow (Window *w)
static void | ShowGroupActionDropdown (Window *w, GroupID gid)
| Update/redraw the group action dropdown.
static void | GroupWndProc (Window *w, WindowEvent *e)
| bitmask for w->window_number 0-7 PlayerID (owner) 11-15 vehicle type
void | ShowPlayerGroup (PlayerID player, VehicleType vehicle_type)
## Variables
static Sorting | _sorting
static const Widget | _group_widgets []
static const WindowDesc | _group_desc

## Detailed Description

Definition in file group_gui.cpp.

## Function Documentation

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 271 of file group_gui.cpp.

Referenced by GroupWndProc().

## Variable Documentation

const WindowDesc _group_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 460, 194, 526, 246,
      WC_TRAINS_LIST, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _group_widgets,
      GroupWndProc
    }

Definition at line 775 of file group_gui.cpp.

const Widget _group_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,             STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   447,     0,    13, 0x0,                  STR_018C_WINDOW_TITLE_DRAG_THIS},
    {  WWT_STICKYBOX,     RESIZE_LR,    14,   448,   459,     0,    13, 0x0,                  STR_STICKY_BUTTON},
    {      WWT_PANEL,   RESIZE_NONE,    14,     0,   200,    14,    25, 0x0,                  STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,    14,     0,   200,    26,    38, 0x0,                  STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,    14,     0,   200,    39,    51, 0x0,                  STR_NULL},
    {     WWT_MATRIX, RESIZE_BOTTOM,    14,     0,   188,    52,   168, 0x701,                STR_GROUPS_CLICK_ON_GROUP_FOR_TIP},
    {  WWT_SCROLLBAR, RESIZE_BOTTOM,    14,   189,   200,    52,   168, 0x0,                  STR_0190_SCROLL_BAR_SCROLLS_LIST},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   201,   281,    14,    25, STR_SORT_BY,          STR_SORT_ORDER_TIP},
    {   WWT_DROPDOWN,   RESIZE_NONE,    14,   282,   447,    14,    25, 0x0,                  STR_SORT_CRITERIA_TIP},
    {      WWT_PANEL,  RESIZE_RIGHT,    14,   448,   459,    14,    25, 0x0,                  STR_NULL},
    {     WWT_MATRIX,     RESIZE_RB,    14,   201,   447,    26,   181, 0x701,                STR_NULL},
    { WWT_SCROLL2BAR,    RESIZE_LRB,    14,   448,   459,    26,   181, 0x0,                  STR_0190_SCROLL_BAR_SCROLLS_LIST},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,     0,    23,   169,   193, 0x0,                  STR_GROUP_CREATE_TIP},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,    24,    47,   169,   193, 0x0,                  STR_GROUP_DELETE_TIP},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,    48,    71,   169,   193, 0x0,                  STR_GROUP_RENAME_TIP},
    {      WWT_PANEL,     RESIZE_TB,    14,    72,   164,   169,   193, 0x0,                  STR_NULL},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,   165,   188,   169,   193, 0x0,                  STR_GROUP_REPLACE_PROTECTION_TIP},
    {      WWT_PANEL,     RESIZE_TB,    14,   189,   200,   169,   193, 0x0,                  STR_NULL},
    { WWT_PUSHTXTBTN,     RESIZE_TB,    14,   201,   306,   182,   193, 0x0,                  STR_AVAILABLE_ENGINES_TIP},
    {   WWT_DROPDOWN,     RESIZE_TB,    14,   307,   423,   182,   193, STR_MANAGE_LIST,      STR_MANAGE_LIST_TIP},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,   424,   435,   182,   193, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP},
    { WWT_PUSHIMGBTN,     RESIZE_TB,    14,   436,   447,   182,   193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
    {      WWT_PANEL,    RESIZE_RTB,    14,   448,   447,   182,   193, 0x0,                  STR_NULL},
    {  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   448,   459,   182,   193, 0x0,                  STR_RESIZE_BUTTON},
    {   WIDGETS_END},
    }

Definition at line 137 of file group_gui.cpp.