OpenTTD Source 20241224-master-gee860a5c8e
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.
 

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.

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,
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.

References INVALID_COMPANY, INVALID_STORY_PAGE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::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 983 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_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.
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
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:83
@ 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:85
@ 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.