OpenTTD Source 20251005-master-ga617d009cc
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, StoryPageID page_id, bool centered)
 Raise or create the story book window for company, at page page_id.
 

Variables

static constexpr NWidgetPart _nested_story_book_widgets []
 
static WindowDesc _story_book_desc (WDP_AUTO, "view_story", 400, 300, WC_STORY_BOOK, WC_NONE, {}, _nested_story_book_widgets)
 
static WindowDesc _story_book_gs_desc (WDP_CENTER, "view_story_gs", 400, 300, WC_STORY_BOOK, WC_NONE, {}, _nested_story_book_widgets)
 

Detailed Description

GUI for stories.

Definition in file story_gui.cpp.

Typedef Documentation

◆ GUIStoryPageElementList

Definition at line 39 of file story_gui.cpp.

◆ GUIStoryPageList

Definition at line 38 of file story_gui.cpp.

Function Documentation

◆ ShowStoryBook()

void ShowStoryBook ( CompanyID  company,
StoryPageID  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 CompanyID::Invalid().
page_idPage to open, may be StoryPageID::Invalid().
centeredWhether to open the window centered.

Definition at line 1043 of file story_gui.cpp.

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

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

◆ TranslateStoryPageButtonCursor()

static CursorID TranslateStoryPageButtonCursor ( StoryPageButtonCursor  cursor)
static

Definition at line 975 of file story_gui.cpp.

Variable Documentation

◆ _nested_story_book_widgets

constexpr NWidgetPart _nested_story_book_widgets[]
staticconstexpr
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
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), SetStringTip(STR_STORY_BOOK_PREV_PAGE, STR_STORY_BOOK_PREV_PAGE_TOOLTIP),
SetToolTip(STR_STORY_BOOK_SEL_PAGE_TOOLTIP), SetResize(1, 0),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SB_NEXT_PAGE), SetMinimalSize(100, 0), SetFill(0, 0), SetStringTip(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.
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
@ WID_SB_PAGE_PANEL
Page body.
@ WID_SB_SEL_PAGE
Page selector.
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
@ WID_SB_CAPTION
Caption of the window.
@ WID_SB_PREV_PAGE
Prev button.
@ WID_SB_NEXT_PAGE
Next button.
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition widget_type.h:75
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:67
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:45
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:40
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:58
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:56
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:53
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:77
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:61
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:60
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:57

Definition at line 940 of file story_gui.cpp.