A help browser widget. More...
#include <help_browser.hpp>
Public Member Functions | |
help_browser (const section &toplevel) | |
void | adjust_layout () |
void | show_topic (const std::string &topic_id) |
Display the topic with the specified identifier. More... | |
Public Member Functions inherited from gui::widget | |
const rect & | location () const |
virtual void | set_location (const SDL_Rect &rect) |
void | set_location (int x, int y) |
void | set_width (int w) |
void | set_height (int h) |
void | set_measurements (int w, int h) |
int | width () const |
int | height () const |
bool | focus (const SDL_Event *event) |
void | set_focus (bool focus) |
virtual void | hide (bool value=true) |
bool | hidden () const |
virtual void | enable (bool new_val=true) |
bool | enabled () const |
void | set_clip_rect (const SDL_Rect &rect) |
void | queue_redraw () |
Indicate that the widget should be redrawn. More... | |
void | queue_redraw (const rect &) |
Indicate that a specific region of the screen should be redrawn. More... | |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_tooltip_string (int mousex, int mousey) override |
virtual void | layout () override |
Called by draw_manager to validate layout. More... | |
virtual bool | expose (const rect ®ion) override |
Called by draw_manager when it believes a redraw is necessary. More... | |
virtual rect | screen_location () override |
The current draw location of the display, on the screen. More... | |
Public Member Functions inherited from events::sdl_handler | |
virtual void | handle_window_event (const SDL_Event &) |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
virtual bool | has_joined () |
virtual bool | has_joined_global () |
sdl_handler & | operator= (sdl_handler &&)=delete |
Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More... | |
sdl_handler (sdl_handler &&)=delete | |
Public Member Functions inherited from gui2::top_level_drawable | |
virtual void | update () |
Update state and any parameters that may effect layout, or any of the later stages. More... | |
virtual void | render () |
Perform any internal rendering necessary to prepare the drawable. More... | |
Protected Member Functions | |
virtual void | update_location (const SDL_Rect &rect) |
virtual void | process_event () |
virtual void | handle_event (const SDL_Event &event) |
Protected Member Functions inherited from gui::widget | |
widget (const bool auto_join=true) | |
virtual | ~widget () |
virtual void | draw_contents () |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
sdl_handler (const sdl_handler &) | |
sdl_handler & | operator= (const sdl_handler &) |
virtual | ~sdl_handler () |
virtual std::vector< sdl_handler * > | handler_members () |
Protected Member Functions inherited from gui2::top_level_drawable | |
top_level_drawable () | |
virtual | ~top_level_drawable () |
top_level_drawable (const top_level_drawable &) | |
top_level_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
Private Member Functions | |
void | update_cursor () |
Update the current cursor, set it to the reference cursor if mousex, mousey is over a cross-reference, otherwise, set it to the normal cursor. More... | |
void | show_topic (const topic &t, bool save_in_history=true) |
void | move_in_history (std::deque< const topic * > &from, std::deque< const topic * > &to) |
Move in the topic history. More... | |
Private Attributes | |
help_menu | menu_ |
help_text_area | text_area_ |
const section & | toplevel_ |
bool | ref_cursor_ |
std::deque< const topic * > | back_topics_ |
std::deque< const topic * > | forward_topics_ |
gui::button | back_button_ |
gui::button | forward_button_ |
topic const * | shown_topic_ |
Additional Inherited Members | |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
A help browser widget.
Definition at line 30 of file help_browser.hpp.
help::help_browser::help_browser | ( | const section & | toplevel | ) |
Definition at line 29 of file help_browser.cpp.
References back_button_, forward_button_, gui::widget::hide(), font::relative_size(), and gui::widget::set_measurements().
void help::help_browser::adjust_layout | ( | ) |
Definition at line 49 of file help_browser.cpp.
References back_button_, forward_button_, gui::widget::height(), gui::widget::location(), menu_, gui::widget::queue_redraw(), font::relative_size(), gui::widget::set_height(), gui::widget::set_location(), gui::menu::set_max_height(), gui::menu::set_max_width(), gui::widget::set_width(), text_area_, and gui::widget::width().
Referenced by update_location().
|
protectedvirtual |
Reimplemented from gui::widget.
Definition at line 132 of file help_browser.cpp.
References _(), back_button_, back_topics_, help::find_topic(), forward_button_, forward_topics_, gui::widget::handle_event(), gui::widget::hidden(), gui::widget::hide(), move_in_history(), wfl::msg(), help::help_text_area::ref_at(), show_topic(), gui2::show_transient_message(), t, text_area_, toplevel_, and update_cursor().
|
private |
Move in the topic history.
Pop an element from from and insert it in to. Pop at the fronts if the maximum number of elements is exceeded.
Definition at line 115 of file help_browser.cpp.
References help::max_history, show_topic(), and shown_topic_.
Referenced by handle_event(), and process_event().
|
protectedvirtual |
Reimplemented from events::sdl_handler.
Definition at line 90 of file help_browser.cpp.
References back_button_, back_topics_, help::help_menu::chosen_topic(), rect::contains(), forward_button_, forward_topics_, sdl::get_mouse_state(), gui::widget::hide(), gui::widget::location(), menu_, move_in_history(), gui::button::pressed(), help::help_menu::process(), show_topic(), and shown_topic_.
void help::help_browser::show_topic | ( | const std::string & | topic_id | ) |
Display the topic with the specified identifier.
Open the menu on the right location and display the topic in the text area.
Definition at line 202 of file help_browser.cpp.
References help::find_topic(), help::hidden_symbol(), PLAIN_LOG, t, toplevel_, help::unit_prefix, and help::unknown_unit_topic.
Referenced by handle_event(), move_in_history(), process_event(), and help::show_with_toplevel().
|
private |
Definition at line 216 of file help_browser.cpp.
References back_topics_, forward_topics_, log_scope, help::max_history, menu_, help::help_menu::select_topic(), help::help_text_area::show_topic(), shown_topic_, t, text_area_, and update_cursor().
|
private |
Update the current cursor, set it to the reference cursor if mousex, mousey is over a cross-reference, otherwise, set it to the normal cursor.
Definition at line 187 of file help_browser.cpp.
References sdl::get_mouse_state(), cursor::HYPERLINK, cursor::NORMAL, help::help_text_area::ref_at(), ref_cursor_, cursor::set(), and text_area_.
Referenced by handle_event(), and show_topic().
|
protectedvirtual |
Reimplemented from gui::widget.
Definition at line 85 of file help_browser.cpp.
References adjust_layout().
|
private |
Definition at line 67 of file help_browser.hpp.
Referenced by adjust_layout(), handle_event(), help_browser(), and process_event().
|
private |
Definition at line 66 of file help_browser.hpp.
Referenced by handle_event(), process_event(), and show_topic().
|
private |
Definition at line 67 of file help_browser.hpp.
Referenced by adjust_layout(), handle_event(), help_browser(), and process_event().
|
private |
Definition at line 66 of file help_browser.hpp.
Referenced by handle_event(), process_event(), and show_topic().
|
private |
Definition at line 62 of file help_browser.hpp.
Referenced by adjust_layout(), process_event(), and show_topic().
|
private |
Definition at line 65 of file help_browser.hpp.
Referenced by update_cursor().
|
private |
Definition at line 68 of file help_browser.hpp.
Referenced by move_in_history(), process_event(), and show_topic().
|
private |
Definition at line 63 of file help_browser.hpp.
Referenced by adjust_layout(), handle_event(), show_topic(), and update_cursor().
|
private |
Definition at line 64 of file help_browser.hpp.
Referenced by handle_event(), and show_topic().