The Battle for Wesnoth  1.15.12+dev
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::story_viewer Class Reference

Dialog to view the storyscreen. More...

#include <story_viewer.hpp>

Inheritance diagram for gui2::dialogs::story_viewer:

Public Member Functions

 story_viewer (const std::string &scenario_name, const config &cfg_parsed)
 
 ~story_viewer ()
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 Returns the cached window exit code. More...
 
void set_retval (int retval)
 Convenience wrapper to set the window's exit code. More...
 
void set_always_save_fields (const bool always_save_fields)
 
void set_restore (const bool restore)
 
void set_allow_plugin_skip (const bool allow_plugin_skip)
 
void set_show_even_without_video (const bool show_even_without_video)
 

Static Public Member Functions

static void display (const std::string &scenario_name, const config &story)
 

Private Types

enum  NAV_DIRECTION { DIR_FORWARD, DIR_BACKWARDS }
 
enum  FADE_STATE { FADING_IN, FADING_OUT, NOT_FADING }
 
using floating_image_list = std::vector< storyscreen::floating_image >
 

Private Member Functions

virtual const std::string & window_id () const override
 The id of the window to build. More...
 
virtual void pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
void clear_image_timer ()
 
void update_current_part_ptr ()
 
void display_part ()
 
void draw_floating_image (floating_image_list::const_iterator image_iter, int this_part_index)
 
void nav_button_callback (NAV_DIRECTION direction)
 
void key_press_callback (const SDL_Keycode key)
 
void set_next_draw ()
 
void begin_fade_draw (bool fade_in)
 
void halt_fade_draw ()
 
void draw_callback ()
 
void flag_stack_as_dirty ()
 

Private Attributes

storyscreen::controller controller_
 
int part_index_
 
storyscreen::controller::part_pointer_type current_part_
 
std::size_t timer_id_
 
std::size_t next_draw_
 
int fade_step_
 
FADE_STATE fade_state_
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_boolregister_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
 Creates a new integer field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
 Creates a new text field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
 Registers a new styled_widget as a label. More...
 
field_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Dialog to view the storyscreen.

Definition at line 27 of file story_viewer.hpp.

Member Typedef Documentation

◆ floating_image_list

Definition at line 55 of file story_viewer.hpp.

Member Enumeration Documentation

◆ FADE_STATE

Enumerator
FADING_IN 
FADING_OUT 
NOT_FADING 

Definition at line 86 of file story_viewer.hpp.

◆ NAV_DIRECTION

Enumerator
DIR_FORWARD 
DIR_BACKWARDS 

Definition at line 58 of file story_viewer.hpp.

Constructor & Destructor Documentation

◆ story_viewer()

gui2::dialogs::story_viewer::story_viewer ( const std::string &  scenario_name,
const config cfg_parsed 
)

Definition at line 55 of file story_viewer.cpp.

◆ ~story_viewer()

gui2::dialogs::story_viewer::~story_viewer ( )

Definition at line 75 of file story_viewer.cpp.

References clear_image_timer().

Member Function Documentation

◆ begin_fade_draw()

void gui2::dialogs::story_viewer::begin_fade_draw ( bool  fade_in)
private

Definition at line 438 of file story_viewer.cpp.

References fade_state_, fade_step_, FADING_IN, FADING_OUT, and set_next_draw().

Referenced by display_part(), and nav_button_callback().

◆ clear_image_timer()

void gui2::dialogs::story_viewer::clear_image_timer ( )
private

Definition at line 67 of file story_viewer.cpp.

References gui2::remove_timer(), and timer_id_.

Referenced by display(), display_part(), and ~story_viewer().

◆ display()

static void gui2::dialogs::story_viewer::display ( const std::string &  scenario_name,
const config story 
)
inlinestatic

◆ display_part()

void gui2::dialogs::story_viewer::display_part ( )
private

◆ draw_callback()

void gui2::dialogs::story_viewer::draw_callback ( )
private

◆ draw_floating_image()

void gui2::dialogs::story_viewer::draw_floating_image ( floating_image_list::const_iterator  image_iter,
int  this_part_index 
)
private

◆ flag_stack_as_dirty()

void gui2::dialogs::story_viewer::flag_stack_as_dirty ( )
private

Definition at line 492 of file story_viewer.cpp.

References gui2::dialogs::modal_dialog::get_window().

Referenced by draw_callback(), and nav_button_callback().

◆ halt_fade_draw()

void gui2::dialogs::story_viewer::halt_fade_draw ( )
private

Definition at line 446 of file story_viewer.cpp.

References fade_state_, fade_step_, next_draw_, and NOT_FADING.

Referenced by draw_callback(), and nav_button_callback().

◆ key_press_callback()

void gui2::dialogs::story_viewer::key_press_callback ( const SDL_Keycode  key)
private

Definition at line 414 of file story_viewer.cpp.

References DIR_BACKWARDS, DIR_FORWARD, and nav_button_callback().

Referenced by pre_show().

◆ nav_button_callback()

void gui2::dialogs::story_viewer::nav_button_callback ( NAV_DIRECTION  direction)
private

◆ pre_show()

void gui2::dialogs::story_viewer::pre_show ( window window)
overrideprivatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 80 of file story_viewer.cpp.

References gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_on_draw(), gui2::event::connect_signal_pre_key_press(), DIR_BACKWARDS, DIR_FORWARD, display_part(), draw_callback(), key_press_callback(), nav_button_callback(), and gui2::window::set_enter_disabled().

Referenced by display().

◆ set_next_draw()

void gui2::dialogs::story_viewer::set_next_draw ( )
private

Definition at line 433 of file story_viewer.cpp.

References next_draw_.

Referenced by begin_fade_draw(), and draw_callback().

◆ update_current_part_ptr()

void gui2::dialogs::story_viewer::update_current_part_ptr ( )
private

◆ window_id()

virtual const std::string& gui2::dialogs::story_viewer::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Referenced by display().

Member Data Documentation

◆ controller_

storyscreen::controller gui2::dialogs::story_viewer::controller_
private

Definition at line 75 of file story_viewer.hpp.

Referenced by display(), nav_button_callback(), and update_current_part_ptr().

◆ current_part_

storyscreen::controller::part_pointer_type gui2::dialogs::story_viewer::current_part_
private

Definition at line 79 of file story_viewer.hpp.

Referenced by display_part(), draw_floating_image(), and update_current_part_ptr().

◆ fade_state_

FADE_STATE gui2::dialogs::story_viewer::fade_state_
private

◆ fade_step_

int gui2::dialogs::story_viewer::fade_step_
private

Definition at line 84 of file story_viewer.hpp.

Referenced by begin_fade_draw(), draw_callback(), and halt_fade_draw().

◆ next_draw_

std::size_t gui2::dialogs::story_viewer::next_draw_
private

Definition at line 82 of file story_viewer.hpp.

Referenced by draw_callback(), halt_fade_draw(), and set_next_draw().

◆ part_index_

int gui2::dialogs::story_viewer::part_index_
private

◆ timer_id_

std::size_t gui2::dialogs::story_viewer::timer_id_
private

Definition at line 81 of file story_viewer.hpp.

Referenced by clear_image_timer(), and draw_floating_image().


The documentation for this class was generated from the following files: