Public Member Functions | Data Fields

# SetDateWindow Struct Reference

Window to select a date graphically by using dropdowns. More...

Inheritance diagram for SetDateWindow:

## Public Member Functions
| SetDateWindow (const WindowDesc *desc, WindowNumber window_number, Window *parent, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback)
| Create the new 'set date' window.
virtual Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
| Compute the initial position of the window.
void | ShowDateDropDown (int widget)
| Helper function to construct the dropdown.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
| Update size and resize step of a widget in the window.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
## Data Fields
SetDateCallback * | callback
| Callback to call when a date has been selected.
YearMonthDay | date
| The currently selected date.
Year | min_year
| The minimum year in the year dropdown.
Year | max_year
| The maximum year (inclusive) in the year dropdown.

## Detailed Description

Window to select a date graphically by using dropdowns.

Definition at line 25 of file date_gui.cpp.

## Constructor & Destructor Documentation

SetDateWindow::SetDateWindow | ( | const WindowDesc * | desc,
|  | WindowNumber | window_number,
|  | Window * | parent,
|  | Date | initial_date,
|  | Year | min_year,
|  | Year | max_year,
|  | SetDateCallback * | callback |
| ) |  |  | `[inline]`

Create the new 'set date' window.

Parameters:

  | desc | the window description
  | window_number | number of 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 34 of file date_gui.cpp.

## Member Function Documentation

virtual void SetDateWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 132 of file date_gui.cpp.

References date, YearMonthDay::day, YearMonthDay::month, SetDParam(), WID_SD_DAY, WID_SD_MONTH, WID_SD_YEAR, and YearMonthDay::year.

virtual void SetDateWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 148 of file date_gui.cpp.

virtual Point SetDateWindow::OnInitialPosition | ( | const WindowDesc * | desc,
|  | int16 | sm_width,
|  | int16 | sm_height,
|  | int | window_number |
| ) |  |  | `[inline, virtual]`

Compute the initial position of the window.

Parameters:

  | *desc | The pointer to the WindowDesc of the window to create.
  | sm_width | Smallest width of the window.
  | sm_height | Smallest height of the window.
  | window_number | The window number of the new window.

Returns:
  Initial position of the top-left corner of the window.

Reimplemented from Window.

Definition at line 49 of file date_gui.cpp.

virtual void SetDateWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 123 of file date_gui.cpp.

void SetDateWindow::ShowDateDropDown | ( | int | widget | ) | `[inline]`

Helper function to construct the dropdown.

Parameters:

  | widget | the dropdown widget to create the dropdown for

Definition at line 59 of file date_gui.cpp.

virtual void SetDateWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, virtual]`

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:

  | widget | Widget number.
  | size | Size of the widget.
  | padding | Recommended amount of space between the widget content and the widget edge.
  | fill | Fill step of the widget.
  | resize | Resize step of the widget.

Reimplemented from Window.

Definition at line 94 of file date_gui.cpp.

The documentation for this struct was generated from the following file:

- src/date_gui.cpp