OpenTTD Source: src/story_gui.cpp File Reference

OpenTTD Source 14.0-RC3

Data Structures | Typedefs | Functions | Variables
story_gui.cpp File Reference
`#include "stdafx.h"`
`#include "window_gui.h"`
`#include "strings_func.h"`
`#include "gui.h"`
`#include "story_base.h"`
`#include "core/geometry_func.hpp"`
`#include "company_func.h"`
`#include "command_func.h"`
`#include "widgets/dropdown_type.h"`
`#include "widgets/dropdown_func.h"`
`#include "sortlist_type.h"`
`#include "goal_base.h"`
`#include "viewport_func.h"`
`#include "window_func.h"`
`#include "company_base.h"`
`#include "tilehighlight_func.h"`
`#include "vehicle_base.h"`
`#include "story_cmd.h"`
`#include "widgets/story_widget.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | StoryBookWindow
struct | StoryBookWindow::LayoutCacheElement

## Typedefs
typedef GUIList< const StoryPage * > | GUIStoryPageList
typedef GUIList< const StoryPageElement * > | GUIStoryPageElementList

## Functions
static CursorID | TranslateStoryPageButtonCursor (StoryPageButtonCursor cursor)
void | ShowStoryBook (CompanyID company, uint16_t page_id, bool centered)
| Raise or create the story book window for company, at page page_id. More...

## Variables
static constexpr NWidgetPart | _nested_story_book_widgets []
static WindowDesc | _story_book_desc (__FILE__, __LINE__, WDP_AUTO, "view_story", 400, 300, WC_STORY_BOOK, WC_NONE, 0, std::begin(_nested_story_book_widgets), std::end(_nested_story_book_widgets))
static WindowDesc | _story_book_gs_desc (__FILE__, __LINE__, WDP_CENTER, "view_story_gs", 400, 300, WC_STORY_BOOK, WC_NONE, 0, std::begin(_nested_story_book_widgets), std::end(_nested_story_book_widgets))

## Detailed Description

GUI for stories.

Definition in file story_gui.cpp.

## Function Documentation

## ◆ ShowStoryBook()

void ShowStoryBook | ( | CompanyID | company,
|  | uint16_t | page_id,
|  | bool | centered
| ) |  |

Raise or create the story book window for company, at page page_id.

Parameters

  company | 'Owner' of the story book, may be INVALID_COMPANY.
  page_id | Page to open, may be #INVALID_STORY_PAGE.
  centered | Whether to open the window centered.

Definition at line 1053 of file story_gui.cpp.

Referenced by CmdShowStoryPage(), GoalListWindow::HandleClick(), and MenuClickStory().

## Variable Documentation

## ◆ _nested_story_book_widgets

constexpr NWidgetPart _nested_story_book_widgets[]
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SB_CAPTION), SetDataTip(STR_JUST_STRING1, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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_SB_PAGE_PANEL), SetResize(1, 1), SetScrollbar(WID_SB_SCROLLBAR), EndContainer(),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_SB_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SB_PREV_PAGE), SetMinimalSize(100, 0), SetFill(0, 0), SetDataTip(STR_STORY_BOOK_PREV_PAGE, STR_STORY_BOOK_PREV_PAGE_TOOLTIP),
NWidget(NWID_BUTTON_DROPDOWN, COLOUR_BROWN, WID_SB_SEL_PAGE), SetMinimalSize(93, 12), SetFill(1, 0),
SetDataTip(STR_JUST_RAW_STRING, STR_STORY_BOOK_SEL_PAGE_TOOLTIP), SetResize(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SB_NEXT_PAGE), SetMinimalSize(100, 0), SetFill(0, 0), SetDataTip(STR_STORY_BOOK_NEXT_PAGE, STR_STORY_BOOK_NEXT_PAGE_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
}

Definition at line 950 of file story_gui.cpp.

SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1143
WID_SB_PAGE_PANEL
@ WID_SB_PAGE_PANEL
Page body.
Definition: story_widget.h:18
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:68
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:63
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:67
WID_SB_PREV_PAGE
@ WID_SB_PREV_PAGE
Prev button.
Definition: story_widget.h:20
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:77
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1153
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition: widget_type.h:1088
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1246
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1260
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:71
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:70
WID_SB_SEL_PAGE
@ WID_SB_SEL_PAGE
Page selector.
Definition: story_widget.h:17
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:86
WID_SB_CAPTION
@ WID_SB_CAPTION
Caption of the window.
Definition: story_widget.h:16
WID_SB_SCROLLBAR
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
Definition: story_widget.h:19
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:52
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1099
WID_SB_NEXT_PAGE
@ WID_SB_NEXT_PAGE
Next button.
Definition: story_widget.h:21
SetDataTip
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1164
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:57
NWID_BUTTON_DROPDOWN
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition: widget_type.h:84
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:66