OpenTTD
Data Structures | Functions | Variables
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 "widgets/date_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  SetDateWindow
 Window to select a date graphically by using dropdowns. 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. More...
 

Variables

static const NWidgetPart _nested_set_date_widgets []
 Widgets for the date setting window. More...
 
static WindowDesc _set_date_desc (WDP_CENTER, NULL, 0, 0, WC_SET_DATE, WC_NONE, 0, _nested_set_date_widgets, lengthof(_nested_set_date_widgets))
 Description of the date setting window. More...
 

Detailed Description

Graphical selection of a date.

Definition in file date_gui.cpp.

Function Documentation

◆ ShowSetDateWindow()

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_numbernumber for the window
parentthe parent window, i.e. if this closes we should close too
initial_datethe initial date to show
min_yearthe minimum year to show in the year dropdown
max_yearthe maximum year (inclusive) to show in the year dropdown
callbackthe callback to call once a date has been selected

Definition at line 215 of file date_gui.cpp.

References DeleteWindowByClass(), SetDateWindow::SetDateWindow(), and WC_SET_DATE.

Variable Documentation

◆ _nested_set_date_widgets

const NWidgetPart _nested_set_date_widgets[]
static
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_DATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP),
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP),
NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_SD_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP),
}
Actually set the date.
Definition: date_widget.h:20
Horizontal container.
Definition: widget_type.h:75
Close box (at top-left of a window)
Definition: widget_type.h:69
Invisible widget that takes some space.
Definition: widget_type.h:79
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
Simple depressed panel.
Definition: widget_type.h:50
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1114
Dropdown for the year.
Definition: date_widget.h:19
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
Vertical container.
Definition: widget_type.h:77
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Drop down list.
Definition: widget_type.h:70
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
Dropdown for the month.
Definition: date_widget.h:18
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:429
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1076
Dropdown for the day.
Definition: date_widget.h:17

Widgets for the date setting window.

Definition at line 177 of file date_gui.cpp.

◆ _set_date_desc

Description of the date setting window.