OpenTTD Source  20241108-master-g80f628063a
story_gui.cpp File Reference

GUI for stories. More...

#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 "dropdown_type.h"
#include "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 (WDP_AUTO, "view_story", 400, 300, WC_STORY_BOOK, WC_NONE, 0, _nested_story_book_widgets)
 
static WindowDesc _story_book_gs_desc (WDP_CENTER, "view_story_gs", 400, 300, WC_STORY_BOOK, WC_NONE, 0, _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_idPage to open, may be #INVALID_STORY_PAGE.
centeredWhether to open the window centered.

Definition at line 1051 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(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),
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),
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),
}
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1181
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1284
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1202
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1137
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1309
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1191
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition: widget_type.h:1126
@ WID_SB_PAGE_PANEL
Page body.
Definition: story_widget.h:18
@ WID_SB_SEL_PAGE
Page selector.
Definition: story_widget.h:17
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
Definition: story_widget.h:19
@ WID_SB_CAPTION
Caption of the window.
Definition: story_widget.h:16
@ WID_SB_PREV_PAGE
Prev button.
Definition: story_widget.h:20
@ WID_SB_NEXT_PAGE
Next button.
Definition: story_widget.h:21
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition: widget_type.h:82
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:75
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:55
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:50
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:64
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:84
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:69
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:68
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:65

Definition at line 948 of file story_gui.cpp.