OpenTTD Source  1.11.2
story_gui.cpp File Reference
#include "stdafx.h"
#include "window_gui.h"
#include "strings_func.h"
#include "date_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 "widgets/story_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
#include <numeric>
#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 page_id)
 Raise or create the story book window for company, at page page_id. More...
 

Variables

static const NWidgetPart _nested_story_book_widgets []
 
static WindowDesc _story_book_desc (WDP_CENTER, "view_story", 400, 300, WC_STORY_BOOK, WC_NONE, 0, _nested_story_book_widgets, lengthof(_nested_story_book_widgets))
 

Detailed Description

GUI for stories.

Definition in file story_gui.cpp.

Function Documentation

◆ ShowStoryBook()

void ShowStoryBook ( CompanyID  company,
uint16  page_id 
)

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.

Definition at line 1062 of file story_gui.cpp.

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

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

Variable Documentation

◆ _nested_story_book_widgets

const NWidgetPart _nested_story_book_widgets[]
static
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SB_CAPTION), SetDataTip(STR_JUST_STRING, 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_BLACK_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),
}

Definition at line 963 of file story_gui.cpp.

SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1104
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
WID_SB_NEXT_PAGE
@ WID_SB_NEXT_PAGE
Next button.
Definition: story_widget.h:21
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:63
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:939
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1023
WID_SB_PAGE_PANEL
@ WID_SB_PAGE_PANEL
Page body.
Definition: story_widget.h:18
WID_SB_CAPTION
@ WID_SB_CAPTION
Caption of the window.
Definition: story_widget.h:16
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:66
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1008
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1123
WID_SB_PREV_PAGE
@ WID_SB_PREV_PAGE
Prev button.
Definition: story_widget.h:20
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:956
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:992
WID_SB_SEL_PAGE
@ WID_SB_SEL_PAGE
Page selector.
Definition: story_widget.h:17
WID_SB_SCROLLBAR
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
Definition: story_widget.h:19
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
NWID_BUTTON_DROPDOWN
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition: widget_type.h:80
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:62