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 | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
gui::combo_drag Class Reference

#include <combo_drag.hpp>

Inheritance diagram for gui::combo_drag:
Inheritance graph

Public Member Functions

 combo_drag (CVideo &v, const std::vector< std::string > &items, const drop_group_manager_ptr group)
 
int get_drop_target ()
 used to query if this object was dropped to a target More...
 
virtual void process (events::pump_info &)
 Implements return after drop. More...
 
- Public Member Functions inherited from gui::combo
 combo (CVideo &v, const std::vector< std::string > &items)
 
void set_selected (int val)
 
void set_items (const std::vector< std::string > &items)
 
int selected () const
 
bool changed ()
 
- Public Member Functions inherited from gui::button
 button (CVideo &video, const std::string &label, TYPE type=TYPE_PRESS, std::string button_image="", SPACE_CONSUMPTION spacing=DEFAULT_SPACE, const bool auto_join=true, std::string overlay_image="")
 
virtual ~button ()
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
void set_check (bool check)
 
void set_active (bool active)
 
bool checked () const
 
void set_label (const std::string &val)
 
void set_image (const std::string &image_file_base)
 
void set_overlay (const std::string &image_file_base)
 
void set_image_path_suffix (const std::string &suffix)
 
bool pressed ()
 
bool hit (int x, int y) const
 
virtual void enable (bool new_val=true)
 
void release ()
 
- Public Member Functions inherited from gui::widget
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
 
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 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 ()
 
- Public Member Functions inherited from gui::drop_target
 drop_target (const drop_group_manager_ptr group, const SDL_Rect &loc)
 Registers drop target and saves reference to location. More...
 
 ~drop_target ()
 
int get_id () const
 
bool is_this_id (const int id) const
 Checks if id matches id for this object. More...
 
- Public Member Functions inherited from events::pump_monitor
 pump_monitor ()
 
virtual ~pump_monitor ()
 

Protected Member Functions

virtual void process_event ()
 
virtual void mouse_motion (const SDL_MouseMotionEvent &event)
 
virtual void mouse_down (const SDL_MouseButtonEvent &event)
 
virtual void mouse_up (const SDL_MouseButtonEvent &event)
 
- Protected Member Functions inherited from gui::combo
void make_drop_down_menu ()
 
- Protected Member Functions inherited from gui::button
virtual void handle_event (const SDL_Event &event)
 
virtual void draw_contents ()
 
- Protected Member Functions inherited from gui::widget
 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 update_location (SDL_Rect const &rect)
 
const SDL_Rect * clip_rect () const
 
virtual sdl_handler_vector member_handlers ()
 
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 Member Functions inherited from gui::drop_target
int handle_drop ()
 Called by widget object when droping happens. More...
 

Private Types

enum  drag_state {
  NONE, PRESSED, PRESSED_MOVE, MOVED,
  RETURN, DROP_DOWN
}
 

Private Member Functions

void handle_move (const SDL_MouseMotionEvent &event)
 
void handle_drop ()
 

Private Attributes

int drag_target_
 
int old_drag_target_
 
SDL_Rect old_location_
 
int mouse_x_
 
int mouse_y_
 
drag_state drag_
 

Static Private Attributes

static const float MIN_DRAG_DISTANCE = 10.0
 
static const float RETURN_SPEED = 25.0
 

Additional Inherited Members

- Public Types inherited from gui::button
enum  TYPE {
  TYPE_PRESS, TYPE_CHECK, TYPE_TURBO, TYPE_IMAGE,
  TYPE_RADIO
}
 
enum  SPACE_CONSUMPTION { DEFAULT_SPACE, MINIMUM_SPACE }
 
- Static Protected Member Functions inherited from gui::drop_target
static bool empty ()
 Used to check if static storages are empty. More...
 
- Protected Attributes inherited from gui::button
TYPE type_
 
- Protected Attributes inherited from gui::widget
bool focus_
 

Detailed Description

Definition at line 27 of file combo_drag.hpp.

Member Enumeration Documentation

Enumerator
NONE 
PRESSED 
PRESSED_MOVE 
MOVED 
RETURN 
DROP_DOWN 

Definition at line 53 of file combo_drag.hpp.

Constructor & Destructor Documentation

gui::combo_drag::combo_drag ( CVideo v,
const std::vector< std::string > &  items,
const drop_group_manager_ptr  group 
)

Definition at line 28 of file combo_drag.cpp.

Member Function Documentation

int gui::combo_drag::get_drop_target ( )

used to query if this object was dropped to a target

Returns
: -1 if not dropped and other the id of target object

Definition at line 42 of file combo_drag.cpp.

References drag_target_, and old_drag_target_.

void gui::combo_drag::handle_drop ( )
private

Definition at line 111 of file combo_drag.cpp.

References drag_target_, and gui::drop_target::handle_drop().

Referenced by mouse_up().

void gui::combo_drag::handle_move ( const SDL_MouseMotionEvent &  event)
private
void gui::combo_drag::mouse_down ( const SDL_MouseButtonEvent &  event)
protectedvirtual

Reimplemented from gui::button.

Definition at line 150 of file combo_drag.cpp.

References drag_, gui::button::hit(), gui::button::mouse_down(), mouse_x_, mouse_y_, and PRESSED.

void gui::combo_drag::mouse_motion ( const SDL_MouseMotionEvent &  event)
protectedvirtual

Reimplemented from gui::button.

Definition at line 116 of file combo_drag.cpp.

References drag_, handle_move(), gui::button::mouse_motion(), MOVED, PRESSED, and PRESSED_MOVE.

void gui::combo_drag::mouse_up ( const SDL_MouseButtonEvent &  event)
protectedvirtual
void gui::combo_drag::process ( events::pump_info )
virtual

Implements return after drop.

Implements events::pump_monitor.

Definition at line 88 of file combo_drag.cpp.

References drag_, gui::widget::location(), NONE, old_location_, RETURN, RETURN_SPEED, and gui::widget::set_location().

void gui::combo_drag::process_event ( )
protectedvirtual

Reimplemented from gui::combo.

Definition at line 161 of file combo_drag.cpp.

References drag_, DROP_DOWN, gui::combo::make_drop_down_menu(), and NONE.

Member Data Documentation

drag_state gui::combo_drag::drag_
private

Definition at line 61 of file combo_drag.hpp.

Referenced by handle_move(), mouse_down(), mouse_motion(), mouse_up(), process(), and process_event().

int gui::combo_drag::drag_target_
private

Definition at line 50 of file combo_drag.hpp.

Referenced by get_drop_target(), and handle_drop().

const float gui::combo_drag::MIN_DRAG_DISTANCE = 10.0
staticprivate

Definition at line 62 of file combo_drag.hpp.

Referenced by handle_move().

int gui::combo_drag::mouse_x_
private

Definition at line 52 of file combo_drag.hpp.

Referenced by handle_move(), and mouse_down().

int gui::combo_drag::mouse_y_
private

Definition at line 52 of file combo_drag.hpp.

Referenced by handle_move(), and mouse_down().

int gui::combo_drag::old_drag_target_
private

Definition at line 50 of file combo_drag.hpp.

Referenced by get_drop_target().

SDL_Rect gui::combo_drag::old_location_
private

Definition at line 51 of file combo_drag.hpp.

Referenced by handle_move(), and process().

const float gui::combo_drag::RETURN_SPEED = 25.0
staticprivate

Definition at line 63 of file combo_drag.hpp.

Referenced by process().


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