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. More... | |
~drop_target () | |
int | get_id () const |
bool | is_this_id (const int id) const |
Checks if id matches id for this object. More... | |
Protected Member Functions | |
int | handle_drop () |
Called by widget object when droping happens. More... | |
Static Protected Member Functions | |
static bool | empty () |
Used to check if static storages are empty. More... | |
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 38 of file drop_target.hpp.
|
private |
Definition at line 39 of file drop_target.hpp.
|
private |
Definition at line 40 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 33 of file drop_target.cpp.
gui::drop_target::~drop_target | ( | ) |
Definition at line 50 of file drop_target.cpp.
References find_this(), and groups_.
|
staticprivate |
Definition at line 82 of file drop_target.cpp.
References next_group_.
|
staticprivate |
Definition at line 76 of file drop_target.cpp.
References groups_, and next_id_.
Referenced by gui::drop_group_manager::~drop_group_manager().
|
inlinestaticprotected |
Used to check if static storages are empty.
Only for testing.
Definition at line 61 of file drop_target.hpp.
Referenced by test_drop_target::empty().
|
private |
Definition at line 43 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 55 of file drop_target.cpp.
References id_.
|
protected |
Called by widget object when droping happens.
Droping over multiple widget objects in same group is undefined.
Definition at line 60 of file drop_target.cpp.
References group_, groups_, hit_rect(), id_, itor, and loc_.
Referenced by test_drop_target::handle_drop(), and gui::combo_drag::handle_drop().
|
private |
Definition at line 87 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 38 of file drop_target.cpp.
References id_.
Referenced by find_this().
|
private |
Definition at line 27 of file drop_target.cpp.
References next_id_.
|
friend |
Definition at line 86 of file drop_target.hpp.
|
private |
Definition at line 51 of file drop_target.hpp.
Referenced by drop_target(), find_this(), and handle_drop().
|
staticprivate |
Definition at line 41 of file drop_target.hpp.
Referenced by delete_group(), drop_target(), find_this(), handle_drop(), and ~drop_target().
|
private |
Definition at line 50 of file drop_target.hpp.
Referenced by find_this(), get_id(), handle_drop(), hit_rect(), and is_this_id().
|
private |
Definition at line 49 of file drop_target.hpp.
Referenced by handle_drop(), and hit_rect().
|
staticprivate |
Definition at line 43 of file drop_target.hpp.
Referenced by create_group().
|
staticprivate |
Definition at line 42 of file drop_target.hpp.
Referenced by delete_group(), and next_free_id().