Handles droping for drag able ui items. More...
#include <drop_target.hpp>


Public Member Functions | |
| drop_target (const drop_group_manager_ptr group, const SDL_Rect &loc) | |
| Registers drop target and saves reference to location. | |
| ~drop_target () | |
| int | get_id () const |
| bool | is_this_id (const int id) const |
| Checks if id matches id for this object. | |
Protected Member Functions | |
| int | handle_drop () |
| Called by widget object when droping happens. | |
Static Protected Member Functions | |
| static bool | empty () |
| Used to check if static storages are empty. | |
Private Types | |
| typedef std::multimap < drop_target_group, drop_target * > | drop_groups |
| typedef std::map < drop_target_group, int > | target_id |
Private Member Functions | |
| int | next_free_id (const drop_target_group &group) const |
| bool | hit_rect (const SDL_Rect &hit_loc, const int not_id) const |
| drop_groups::iterator | find_this () const |
Static Private Member Functions | |
| static drop_target_group | create_group () |
| static void | delete_group (const drop_target_group id) |
Private Attributes | |
| const SDL_Rect & | loc_ |
| const int | id_ |
| drop_group_manager_ptr | group_ |
Static Private Attributes | |
| static drop_groups | groups_ |
| static target_id | next_id_ |
| static drop_target_group | next_group_ = 0 |
Friends | |
| class | drop_group_manager |
Handles droping for drag able ui items.
Widget class just has to inherit from drop_target, call constructor and handle_drop.
Definition at line 39 of file drop_target.hpp.
typedef std::multimap<drop_target_group, drop_target*> gui::drop_target::drop_groups [private] |
Definition at line 40 of file drop_target.hpp.
typedef std::map<drop_target_group, int> gui::drop_target::target_id [private] |
Definition at line 41 of file drop_target.hpp.
| gui::drop_target::drop_target | ( | const drop_group_manager_ptr | group, | |
| const SDL_Rect & | loc | |||
| ) |
Registers drop target and saves reference to location.
Definition at line 34 of file drop_target.cpp.
| gui::drop_target::~drop_target | ( | ) |
Definition at line 51 of file drop_target.cpp.
References find_this(), and groups_.

| drop_target_group gui::drop_target::create_group | ( | ) | [static, private] |
Definition at line 83 of file drop_target.cpp.
References next_group_.
| void gui::drop_target::delete_group | ( | const drop_target_group | id | ) | [static, private] |
Definition at line 77 of file drop_target.cpp.
References groups_, and next_id_.
Referenced by gui::drop_group_manager::~drop_group_manager().

| static bool gui::drop_target::empty | ( | ) | [inline, static, protected] |
Used to check if static storages are empty.
Only for testing.
Reimplemented in test_drop_target.
Definition at line 62 of file drop_target.hpp.
References groups_, and next_id_.
Referenced by test_drop_target::empty().

| drop_target::drop_groups::iterator gui::drop_target::find_this | ( | ) | const [private] |
Definition at line 44 of file drop_target.cpp.
References group_, groups_, id_, and is_this_id().
Referenced by ~drop_target().


| int gui::drop_target::get_id | ( | ) | const |
Definition at line 56 of file drop_target.cpp.
References id_.
| int gui::drop_target::handle_drop | ( | ) | [protected] |
Called by widget object when droping happens.
Droping over multiple widget objects in same group is undefined.
Reimplemented in test_drop_target.
Definition at line 61 of file drop_target.cpp.
References group_, groups_, hit_rect(), id_, and loc_.
Referenced by test_drop_target::handle_drop().


| bool gui::drop_target::hit_rect | ( | const SDL_Rect & | hit_loc, | |
| const int | not_id | |||
| ) | const [private] |
Definition at line 88 of file drop_target.cpp.
Referenced by handle_drop().

| bool gui::drop_target::is_this_id | ( | const int | id | ) | const |
Checks if id matches id for this object.
Used by for_each/boost:bind
Definition at line 39 of file drop_target.cpp.
References id_.
Referenced by find_this().

| int gui::drop_target::next_free_id | ( | const drop_target_group & | group | ) | const [private] |
Definition at line 28 of file drop_target.cpp.
References next_id_.
friend class drop_group_manager [friend] |
Definition at line 87 of file drop_target.hpp.
Definition at line 52 of file drop_target.hpp.
Referenced by drop_target(), find_this(), and handle_drop().
drop_target::drop_groups gui::drop_target::groups_ [static, private] |
Definition at line 42 of file drop_target.hpp.
Referenced by delete_group(), drop_target(), empty(), find_this(), handle_drop(), and ~drop_target().
const int gui::drop_target::id_ [private] |
Definition at line 51 of file drop_target.hpp.
Referenced by find_this(), get_id(), handle_drop(), hit_rect(), and is_this_id().
const SDL_Rect& gui::drop_target::loc_ [private] |
Definition at line 50 of file drop_target.hpp.
Referenced by handle_drop(), and hit_rect().
drop_target_group gui::drop_target::next_group_ = 0 [static, private] |
Definition at line 44 of file drop_target.hpp.
Referenced by create_group().
drop_target::target_id gui::drop_target::next_id_ [static, private] |
Definition at line 43 of file drop_target.hpp.
Referenced by delete_group(), empty(), and next_free_id().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:16 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |