The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
gui::widget Class Reference

#include <widget.hpp>

Inheritance diagram for gui::widget:
Inheritance graph

Public Member Functions

SDL_Rect const & location () const
 
virtual void set_location (SDL_Rect const &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 set_volatile (bool val=true)
 
void set_dirty (bool dirty=true)
 
bool dirty () const
 
const std::stringid () const
 
void set_id (const std::string &id)
 
void set_help_string (const std::string &str)
 
void set_tooltip_string (const std::string &str)
 
virtual void process_help_string (int mousex, int mousey)
 
virtual void process_tooltip_string (int mousex, int mousey)
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_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 ()
 

Protected Member Functions

 widget (widget const &o)
 
 widget (CVideo &video, const bool auto_join=true)
 
virtual ~widget ()
 
void bg_register (SDL_Rect const &rect)
 
void bg_restore () const
 
void bg_restore (SDL_Rect const &rect) const
 
void bg_update ()
 
void bg_cancel ()
 
CVideovideo () const
 
virtual void draw ()
 
virtual void draw_contents ()
 
virtual void update_location (SDL_Rect const &rect)
 
const SDL_Rect * clip_rect () const
 
virtual sdl_handler_vector member_handlers ()
 
virtual void handle_event (SDL_Event const &)
 
virtual void handle_window_event (SDL_Event const &event)
 
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)
 
virtual ~sdl_handler ()
 
virtual std::vector
< sdl_handler * > 
handler_members ()
 

Protected Attributes

bool focus_
 

Private Types

enum  { UNINIT, HIDDEN, DIRTY, DRAWN }
 

Private Member Functions

void volatile_draw ()
 
void volatile_undraw ()
 
void hide_override (bool value=true)
 

Private Attributes

CVideovideo_
 
std::vector< surface_restorerrestorer_
 
SDL_Rect rect_
 
bool needs_restore_
 
enum gui::widget:: { ... }  state_
 
bool hidden_override_
 
bool enabled_
 
bool clip_
 
SDL_Rect clip_rect_
 
bool volatile_
 
std::string help_text_
 
std::string tooltip_text_
 
int help_string_
 
std::string id_
 
bool mouse_lock_local_
 

Static Private Attributes

static bool mouse_lock_ = false
 

Friends

class scrollpane
 
class dialog
 

Detailed Description

Definition at line 25 of file widget.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
UNINIT 
HIDDEN 
DIRTY 
DRAWN 

Definition at line 111 of file widget.hpp.

Constructor & Destructor Documentation

gui::widget::widget ( widget const &  o)
protected

Definition at line 35 of file widget.cpp.

gui::widget::widget ( CVideo video,
const bool  auto_join = true 
)
protected

Definition at line 43 of file widget.cpp.

gui::widget::~widget ( )
protectedvirtual

Definition at line 50 of file widget.cpp.

References bg_cancel(), and free_mouse_lock().

Member Function Documentation

void gui::widget::aquire_mouse_lock ( )
protected

Definition at line 56 of file widget.cpp.

References mouse_lock_, and mouse_lock_local_.

Referenced by gui::combo_drag::handle_move().

void gui::widget::bg_cancel ( )
protected

Definition at line 77 of file widget.cpp.

References i, and restorer_.

Referenced by set_location(), gui::scrollarea::test_scrollbar(), and ~widget().

void gui::widget::bg_register ( SDL_Rect const &  rect)
protected
void gui::widget::bg_restore ( ) const
protected
void gui::widget::bg_restore ( SDL_Rect const &  rect) const
protected

Definition at line 267 of file widget.cpp.

References clip_, clip_rect_, i, restorer_, and video().

void gui::widget::bg_update ( )
protected

Definition at line 244 of file widget.cpp.

References i, and restorer_.

Referenced by hide(), hide_override(), and volatile_draw().

const SDL_Rect * gui::widget::clip_rect ( ) const
protected
bool gui::widget::dirty ( ) const

Definition at line 227 of file widget.cpp.

References DIRTY, and state_.

Referenced by draw(), mp::gamebrowser::draw(), and gui::menu::draw().

void gui::widget::draw ( )
protectedvirtual
virtual void gui::widget::draw_contents ( )
inlineprotectedvirtual
void gui::widget::enable ( bool  new_val = true)
virtual
bool gui::widget::enabled ( ) const
bool gui::widget::focus ( const SDL_Event *  event)
void gui::widget::free_mouse_lock ( )
protected

Definition at line 63 of file widget.cpp.

References mouse_lock_, and mouse_lock_local_.

Referenced by gui::combo_drag::mouse_up(), and ~widget().

void gui::widget::handle_event ( SDL_Event const &  event)
protectedvirtual
void gui::widget::handle_window_event ( SDL_Event const &  event)
protectedvirtual

Implements events::sdl_handler.

Definition at line 352 of file widget.cpp.

References set_dirty().

int gui::widget::height ( ) const
bool gui::widget::hidden ( ) const
void gui::widget::hide ( bool  value = true)
virtual
void gui::widget::hide_override ( bool  value = true)
private

Definition at line 177 of file widget.cpp.

References bg_restore(), bg_update(), DIRTY, DRAWN, hidden_override_, set_dirty(), and state_.

const std::string & gui::widget::id ( ) const
const SDL_Rect & gui::widget::location ( ) const

Definition at line 144 of file widget.cpp.

References rect_.

Referenced by editor::location_palette::add_item(), help::help_browser::adjust_layout(), gui::button::calculate_size(), gui::scrollpane::client_area(), statistics_dialog::do_scene_selection(), mp::gamebrowser::draw(), gui::menu::draw(), gui::progress_bar::draw_contents(), gui::label::draw_contents(), location_palette_item::draw_contents(), editor::location_palette::draw_contents(), gui::slider::draw_contents(), mp::wait::leader_preview_pane::draw_contents(), gui::button::draw_contents(), editor::palette_manager::draw_contents(), gui::tristate_button::draw_contents(), gui::dialog_image::draw_contents(), dialogs::unit_preview_pane::draw_contents(), gui::textbox::draw_cursor(), battle_prediction_pane::draw_unit(), gui::scrollbar::groove_area(), gui::combo_drag::handle_move(), gui::scrollarea::has_scrollbar(), gui::tristate_button::hit(), gui::button::hit(), location_palette_item::hit(), gui::menu::hit_column(), gui::scrollarea::inner_location(), gui::dialog::layout(), mp::create::layout_children(), mp::configure::layout_children(), mp::connect::layout_children(), mp::lobby::layout_children(), gui::button::load_images(), gui::combo::make_drop_down_menu(), gui::slider::mouse_wheel(), gui::combo_drag::process(), gui::dialog::process(), help::help_browser::process_event(), help::help_text_area::ref_at(), gui::slider::set_slider_position(), gui::slider::slider_area(), gui::scrollarea::test_scrollbar(), gui::textbox::update_text_cache(), and gui::preview_pane::~preview_pane().

virtual sdl_handler_vector gui::widget::member_handlers ( )
inlineprotectedvirtual

Definition at line 90 of file widget.hpp.

bool gui::widget::mouse_locked ( ) const
protected
void gui::widget::process_help_string ( int  mousex,
int  mousey 
)
virtual
void gui::widget::process_tooltip_string ( int  mousex,
int  mousey 
)
virtual

Reimplemented from events::sdl_handler.

Definition at line 337 of file widget.cpp.

References tooltips::add_tooltip(), hidden(), sdl::point_in_rect(), rect_, and tooltip_text_.

void gui::widget::set_clip_rect ( const SDL_Rect &  rect)

Definition at line 191 of file widget.cpp.

References clip_, clip_rect_, and set_dirty().

Referenced by gui::scrollpane::add_widget().

void gui::widget::set_dirty ( bool  dirty = true)

Definition at line 217 of file widget.cpp.

References DIRTY, DRAWN, hidden_override_, needs_restore_, state_, and volatile_.

Referenced by help::help_browser::adjust_layout(), editor::palette_manager::adjust_size(), editor::location_palette::adjust_size(), gui::textbox::append_text(), gui::menu::change_item(), gui::textbox::clear(), gui::menu::do_sort(), draw(), mp::gamebrowser::draw(), gui::menu::draw(), editor::location_palette::draw_contents(), editor::palette_manager::draw_contents(), editor::editor_palette< Item >::draw_contents(), dialogs::unit_preview_pane::draw_contents(), enable(), gui::menu::erase_item(), gui::slider::handle_event(), gui::button::handle_event(), gui::tristate_button::handle_event(), location_palette_item::handle_event(), gui::scrollbar::handle_event(), handle_event(), gui::textbox::handle_event(), mp::gamebrowser::handle_event(), handle_window_event(), hide(), hide_override(), mp::wait::leader_preview_pane::process_event(), editor::palette_manager::resrote_palete_bg(), help::help_text_area::scroll(), gui::textbox::scroll(), mp::gamebrowser::scroll(), gui::menu::scroll(), editor::palette_manager::scroll_down(), editor::location_palette::scroll_down(), editor::palette_manager::scroll_up(), editor::unit_palette::select_bg_item(), mp::gamebrowser::select_game(), editor::location_palette::select_item(), gui::button::set_active(), gui::button::set_check(), set_clip_rect(), gui::label::set_color(), gui::textbox::set_cursor_pos(), set_focus(), gui::scrollbar::set_full_size(), mp::gamebrowser::set_game_items(), gui::menu::set_heading(), gui::button::set_image(), gui::menu::set_items(), gui::button::set_label(), set_location(), gui::slider::set_max(), gui::slider::set_min(), gui::button::set_overlay(), gui::scrollbar::set_position(), gui::tristate_button::set_pressed(), gui::progress_bar::set_progress_percent(), gui::textbox::set_selection(), mp::wait::leader_preview_pane::set_selection(), dialogs::unit_preview_pane::set_selection(), gui::scrollbar::set_shown_size(), gui::progress_bar::set_text(), gui::label::set_text(), gui::textbox::set_text(), gui::slider::set_value(), gui::textbox::set_wrap(), help::show_help(), help::help_text_area::show_topic(), gui::menu::sort_by(), gui::scrollpane::update_content_size(), gui::textbox::update_location(), gui::scrollpane::update_widget_positions(), and default_map_generator::user_config().

void gui::widget::set_focus ( bool  focus)
void gui::widget::set_height ( int  h)
void gui::widget::set_help_string ( const std::string str)
void gui::widget::set_id ( const std::string id)

Definition at line 237 of file widget.cpp.

References id(), and id_.

void gui::widget::set_location ( SDL_Rect const &  rect)
virtual
void gui::widget::set_location ( int  x,
int  y 
)

Definition at line 114 of file widget.cpp.

References sdl::create_rect(), rect_, and set_location().

void gui::widget::set_measurements ( int  w,
int  h 
)
void gui::widget::set_tooltip_string ( const std::string str)
void gui::widget::set_volatile ( bool  val = true)

Definition at line 276 of file widget.cpp.

References DIRTY, DRAWN, state_, and volatile_.

void gui::widget::set_width ( int  w)
void gui::widget::update_location ( SDL_Rect const &  rect)
protectedvirtual

Reimplemented in gui::scrollbar, gui::textbox, help::help_browser, and gui::scrollarea.

Definition at line 99 of file widget.cpp.

References bg_register().

Referenced by set_location(), and gui::scrollbar::update_location().

CVideo& gui::widget::video ( ) const
inlineprotected
void gui::widget::volatile_draw ( )
privatevirtual

Reimplemented from events::sdl_handler.

Definition at line 298 of file widget.cpp.

References bg_update(), DIRTY, draw(), DRAWN, hidden_override_, state_, and volatile_.

void gui::widget::volatile_undraw ( )
privatevirtual

Reimplemented from events::sdl_handler.

Definition at line 307 of file widget.cpp.

References bg_restore(), and volatile_.

int gui::widget::width ( ) const

Friends And Related Function Documentation

friend class dialog
friend

Definition at line 128 of file widget.hpp.

friend class scrollpane
friend

Definition at line 127 of file widget.hpp.

Member Data Documentation

bool gui::widget::clip_
private

Definition at line 114 of file widget.hpp.

Referenced by bg_restore(), clip_rect(), draw(), hidden(), and set_clip_rect().

SDL_Rect gui::widget::clip_rect_
private

Definition at line 115 of file widget.hpp.

Referenced by bg_restore(), clip_rect(), draw(), hidden(), and set_clip_rect().

bool gui::widget::enabled_
private

Definition at line 113 of file widget.hpp.

Referenced by enable(), and enabled().

bool gui::widget::focus_
protected
int gui::widget::help_string_
private

Definition at line 121 of file widget.hpp.

Referenced by process_help_string().

std::string gui::widget::help_text_
private

Definition at line 119 of file widget.hpp.

Referenced by process_help_string(), and set_help_string().

bool gui::widget::hidden_override_
private

Definition at line 112 of file widget.hpp.

Referenced by hidden(), hide(), hide_override(), set_dirty(), and volatile_draw().

std::string gui::widget::id_
private

Definition at line 122 of file widget.hpp.

Referenced by id(), and set_id().

bool gui::widget::mouse_lock_ = false
staticprivate

Definition at line 125 of file widget.hpp.

Referenced by aquire_mouse_lock(), free_mouse_lock(), and mouse_locked().

bool gui::widget::mouse_lock_local_
private

Definition at line 124 of file widget.hpp.

Referenced by aquire_mouse_lock(), free_mouse_lock(), and mouse_locked().

bool gui::widget::needs_restore_
mutableprivate

Definition at line 109 of file widget.hpp.

Referenced by bg_restore(), and set_dirty().

SDL_Rect gui::widget::rect_
private
std::vector< surface_restorer > gui::widget::restorer_
private

Definition at line 107 of file widget.hpp.

Referenced by bg_cancel(), bg_register(), bg_restore(), and bg_update().

enum { ... } gui::widget::state_
std::string gui::widget::tooltip_text_
private

Definition at line 120 of file widget.hpp.

Referenced by process_tooltip_string(), and set_tooltip_string().

CVideo* gui::widget::video_
private

Definition at line 106 of file widget.hpp.

Referenced by video().

bool gui::widget::volatile_
private

Definition at line 117 of file widget.hpp.

Referenced by set_dirty(), set_volatile(), volatile_draw(), and volatile_undraw().


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