# date_gui.cpp File Reference

Graphical selection of a date. More...

`#include "stdafx.h"`
`#include "strings_func.h"`
`#include "date_func.h"`
`#include "window_func.h"`
`#include "window_gui.h"`
`#include "date_gui.h"`
`#include "core/geometry_func.hpp"`
`#include "widgets/dropdown_type.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | SetDateWindow
| Window to select a date graphically by using dropdowns. More...
## Enumerations
enum | SetDateWidgets { SDW_DAY, SDW_MONTH, SDW_YEAR, SDW_SET_DATE }
| Widgets used by the date window. More...
## Functions
void | ShowSetDateWindow (Window *parent, int window_number, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback)
| Create the new 'set date' window.
## Variables
static const NWidgetPart | _nested_set_date_widgets []
static const WindowDesc | _set_date_desc (WDP_CENTER, 0, 0, WC_SET_DATE, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_set_date_widgets, lengthof(_nested_set_date_widgets))

## Detailed Description

Graphical selection of a date.

Definition in file date_gui.cpp.

## Enumeration Type Documentation

enum SetDateWidgets

Widgets used by the date window.

Enumerator:

  SDW_DAY | Dropdown for the day.
  SDW_MONTH | Dropdown for the month.
  SDW_YEAR | Dropdown for the year.
  SDW_SET_DATE | Actually set the date.

Definition at line 25 of file date_gui.cpp.

## Function Documentation

void ShowSetDateWindow | ( | Window * | parent,
|  | int | window_number,
|  | Date | initial_date,
|  | Year | min_year,
|  | Year | max_year,
|  | SetDateCallback * | callback |
| ) |  |  |

Create the new 'set date' window.

Parameters:

  | window_number | number for the window
  | parent | the parent window, i.e. if this closes we should close too
  | initial_date | the initial date to show
  | min_year | the minimum year to show in the year dropdown
  | max_year | the maximum year (inclusive) to show in the year dropdown
  | callback | the callback to call once a date has been selected

Definition at line 226 of file date_gui.cpp.

References DeleteWindowByClass().

Referenced by TimetableWindow::OnClick().

## Variable Documentation

const NWidgetPart _nested_set_date_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
        NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_DATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_BROWN),
        NWidget(NWID_VERTICAL), SetPIP(6, 6, 6),
          NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(6, 6, 6),
            NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP),
            NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP),
            NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP),
          EndContainer(),
          NWidget(NWID_HORIZONTAL),
            NWidget(NWID_SPACER), SetFill(1, 0),
            NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SDW_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP),
            NWidget(NWID_SPACER), SetFill(1, 0),
          EndContainer(),
        EndContainer(),
      EndContainer()
    }

Definition at line 189 of file date_gui.cpp.