OpenTTD Source: src/goal_gui.cpp File Reference

OpenTTD Source 15.0-RC2

Data Structures | Enumerations | Functions | Variables
goal_gui.cpp File Reference

GUI for goals. More...

`#include "stdafx.h"`
`#include "industry.h"`
`#include "town.h"`
`#include "window_gui.h"`
`#include "strings_func.h"`
`#include "viewport_func.h"`
`#include "gui.h"`
`#include "goal_base.h"`
`#include "core/geometry_func.hpp"`
`#include "company_func.h"`
`#include "company_base.h"`
`#include "company_gui.h"`
`#include "story_base.h"`
`#include "command_func.h"`
`#include "string_func.h"`
`#include "goal_cmd.h"`
`#include "widgets/goal_widget.h"`
`#include "table/strings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | GoalListWindow
| Window for displaying goals. More...
struct | GoalQuestionWindow
| Ask a question about a goal. More...
struct | NestedGoalWidgets< bg_colour, btn_colour, caption >
| Widgets of the goal question window. More...

## Enumerations
enum | GoalColumn : uint8_t { GC_GOAL = 0 , GC_PROGRESS }
| Goal list columns. More...

## Functions
void | ShowGoalsList (CompanyID company)
| Open a goal list window.
void | ShowGoalQuestion (uint16_t id, uint8_t type, uint32_t button_mask, const EncodedString &question)
| Display a goal question.

## Variables
static constexpr std::initializer_list< NWidgetPart > | _nested_goals_list_widgets
| Widgets of the GoalListWindow.
static WindowDesc | _goals_list_desc (WDP_AUTO, "list_goals", 500, 127, WC_GOALS_LIST, WC_NONE, {}, _nested_goals_list_widgets)
static constexpr auto | _nested_goal_question_widgets_question = NestedGoalWidgets<COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, STR_GOAL_QUESTION_CAPTION_QUESTION>::widgetparts
static constexpr auto | _nested_goal_question_widgets_info = NestedGoalWidgets<COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, STR_GOAL_QUESTION_CAPTION_INFORMATION>::widgetparts
static constexpr auto | _nested_goal_question_widgets_warning = NestedGoalWidgets<COLOUR_YELLOW, COLOUR_YELLOW, STR_GOAL_QUESTION_CAPTION_WARNING>::widgetparts
static constexpr auto | _nested_goal_question_widgets_error = NestedGoalWidgets<COLOUR_RED, COLOUR_YELLOW, STR_GOAL_QUESTION_CAPTION_ERROR>::widgetparts
static WindowDesc | _goal_question_list_desc []

## Detailed Description

GUI for goals.

Definition in file goal_gui.cpp.

## Enumeration Type Documentation

## ◆ GoalColumn

enum GoalColumn : uint8_t

Goal list columns.

Enumerator
GC_GOAL | Goal text column.
GC_PROGRESS | Goal progress column.

Definition at line 34 of file goal_gui.cpp.

## Function Documentation

## ◆ ShowGoalQuestion()

void ShowGoalQuestion | ( | uint16_t | id,
|  | uint8_t | type,
|  | uint32_t | button_mask,
|  | const EncodedString & | question
| ) |  |

Display a goal question.

Parameters

  id | Window number to use.
  type | Type of question.
  button_mask | Buttons to display.
  question | Question to ask.

Definition at line 475 of file goal_gui.cpp.

Referenced by CmdGoalQuestion().

## ◆ ShowGoalsList()

void ShowGoalsList | ( | CompanyID | company | ) |

Open a goal list window.

Parameters

  company | Company to display the goals for, use CompanyID::Invalid() to display global goals.

Definition at line 311 of file goal_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID().

Referenced by MenuClickGoal(), GoalListWindow::OnClick(), MainToolbarWindow::OnHotkey(), and StoryBookWindow::OnPageElementClick().

## Variable Documentation

## ◆ _goal_question_list_desc

WindowDesc _goal_question_list_desc[]
| static

Initial value:
= {
{
WDP_CENTER, {}, 0, 0,
WC_GOAL_QUESTION, WC_NONE,
WindowDefaultFlag::Construction,
_nested_goal_question_widgets_question,
},
{
WDP_CENTER, {}, 0, 0,
WC_GOAL_QUESTION, WC_NONE,
WindowDefaultFlag::Construction,
_nested_goal_question_widgets_info,
},
{
WDP_CENTER, {}, 0, 0,
WC_GOAL_QUESTION, WC_NONE,
WindowDefaultFlag::Construction,
_nested_goal_question_widgets_warning,
},
{
WDP_CENTER, {}, 0, 0,
WC_GOAL_QUESTION, WC_NONE,
WindowDefaultFlag::Construction,
_nested_goal_question_widgets_error,
},
}
WindowDefaultFlag::Construction
@ Construction
This window is used for construction; close it whenever changing company.
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition window_gui.h:145
WC_GOAL_QUESTION
@ WC_GOAL_QUESTION
Popup with a set of buttons, designed to ask the user a question from a GameScript.
Definition window_type.h:142
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50

Definition at line 441 of file goal_gui.cpp.

## ◆ _nested_goal_question_widgets_error

constexpr auto _nested_goal_question_widgets_error = NestedGoalWidgets<COLOUR_RED, COLOUR_YELLOW, STR_GOAL_QUESTION_CAPTION_ERROR>::widgetparts
| staticconstexpr

Definition at line 439 of file goal_gui.cpp.

## ◆ _nested_goal_question_widgets_info

constexpr auto _nested_goal_question_widgets_info = NestedGoalWidgets<COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, STR_GOAL_QUESTION_CAPTION_INFORMATION>::widgetparts
| staticconstexpr

Definition at line 437 of file goal_gui.cpp.

## ◆ _nested_goal_question_widgets_question

constexpr auto _nested_goal_question_widgets_question = NestedGoalWidgets<COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, STR_GOAL_QUESTION_CAPTION_QUESTION>::widgetparts
| staticconstexpr

Definition at line 436 of file goal_gui.cpp.

## ◆ _nested_goal_question_widgets_warning

constexpr auto _nested_goal_question_widgets_warning = NestedGoalWidgets<COLOUR_YELLOW, COLOUR_YELLOW, STR_GOAL_QUESTION_CAPTION_WARNING>::widgetparts
| staticconstexpr

Definition at line 438 of file goal_gui.cpp.

## ◆ _nested_goals_list_widgets

constexpr std::initializer_list<NWidgetPart> _nested_goals_list_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_GOAL_CAPTION),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GOAL_SELECT_BUTTONS),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_GOAL_GLOBAL_BUTTON), SetMinimalSize(50, 0), SetStringTip(STR_GOALS_GLOBAL_BUTTON, STR_GOALS_GLOBAL_BUTTON_HELPTEXT),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_GOAL_COMPANY_BUTTON), SetMinimalSize(50, 0), SetStringTip(STR_GOALS_COMPANY_BUTTON, STR_GOALS_COMPANY_BUTTON_HELPTEXT),
EndContainer(),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_GOAL_LIST), SetToolTip(STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetScrollbar(WID_GOAL_SCROLLBAR), SetResize(1, 1), SetMinimalTextLines(2, 0),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_GOAL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
EndContainer(),
}
WID_GOAL_COMPANY_BUTTON
@ WID_GOAL_COMPANY_BUTTON
Button to show company goals.
Definition goal_widget.h:19
WID_GOAL_CAPTION
@ WID_GOAL_CAPTION
Caption of the window.
Definition goal_widget.h:16
WID_GOAL_SCROLLBAR
@ WID_GOAL_SCROLLBAR
Scrollbar of the goal list.
Definition goal_widget.h:21
WID_GOAL_SELECT_BUTTONS
@ WID_GOAL_SELECT_BUTTONS
Selection widget for the title bar button.
Definition goal_widget.h:17
WID_GOAL_GLOBAL_BUTTON
@ WID_GOAL_GLOBAL_BUTTON
Button to show global goals.
Definition goal_widget.h:18
WID_GOAL_LIST
@ WID_GOAL_LIST
Goal list.
Definition goal_widget.h:20
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition widget_type.h:1399
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1240
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1156
SetToolTip
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
Definition widget_type.h:1318
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1229
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1424
SetMinimalTextLines
constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition widget_type.h:1187
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1145
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:104
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:57
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:55
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:76
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:59
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:56
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition widget_type.h:71

Widgets of the GoalListWindow.

Definition at line 278 of file goal_gui.cpp.