Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends

gui::drop_target Class Reference

Handles droping for drag able ui items. More...

#include <drop_target.hpp>

Inheritance diagram for gui::drop_target:
Inheritance graph
[legend]
Collaboration diagram for gui::drop_target:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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.

References group_, and groups_.

gui::drop_target::~drop_target (  ) 

Definition at line 51 of file drop_target.cpp.

References find_this(), and groups_.

Here is the call graph for this function:


Member Function Documentation

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
: id which widget was hit when droping

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

References id_, and loc_.

Referenced by handle_drop().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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_.


Friends And Related Function Documentation

friend class drop_group_manager [friend]

Definition at line 87 of file drop_target.hpp.


Member Data Documentation

Definition at line 52 of file drop_target.hpp.

Referenced by drop_target(), find_this(), and handle_drop().

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().

Definition at line 44 of file drop_target.hpp.

Referenced by create_group().

Definition at line 43 of file drop_target.hpp.

Referenced by delete_group(), empty(), and next_free_id().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:16 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs