DUtilsCV::GUI::MouseHandler Class Reference

#include <GUI.h>

List of all members.

Classes

struct  tEvent
 Mouse event. More...

Public Member Functions

 MouseHandler ()
virtual ~MouseHandler ()
void attach (const tWinHandler &hwnd, const std::vector< int > &events=std::vector< int >())
void attachToClicks (const tWinHandler &hwnd)
void attachToMotions (const tWinHandler &hwnd)
bool attached () const
void listen (int event)
void listenToAll ()
void ignore (int event)
bool get (tEvent &event)
bool empty () const

Static Protected Member Functions

static void callbackHandlerFunction (int event, int x, int y, int flags, void *pMouseHandler)

Protected Attributes

bool m_attached
std::queue< tEventm_events
 Valid event queue.
std::vector< int > m_valid_events
 List of events to listen to.

Detailed Description

Synchronous mouse event handler

Note:
Important! this class is still non thread aware, so race conditions can occur. Apart from that, it is fully functional

Constructor & Destructor Documentation

GUI::MouseHandler::MouseHandler (  ) 

Creates the handler without attaching it to any window

GUI::MouseHandler::~MouseHandler (  )  [virtual]

Destroyer


Member Function Documentation

void GUI::MouseHandler::attach ( const tWinHandler hwnd,
const std::vector< int > &  events = std::vector<int>() 
)

Attaches the handler to a window. It can only be attached once

Parameters:
hwnd window
events (optional) events to listen to. If not given, the existing list of valid events is not modified, except if it was empty. In that case, all the events are added, even mouse move.
bool DUtilsCV::GUI::MouseHandler::attached (  )  const [inline]

Says if the mouse handler is already attached to some window

Returns:
true iif attached
void GUI::MouseHandler::attachToClicks ( const tWinHandler hwnd  ) 

Attaches the handler to a window and makes it listen to left single clicks only

Parameters:
hwnd window
void GUI::MouseHandler::attachToMotions ( const tWinHandler hwnd  ) 

Attaches the handler to a window and makes it listen to mouse movements only

Parameters:
hwnd window
void GUI::MouseHandler::callbackHandlerFunction ( int  event,
int  x,
int  y,
int  flags,
void *  pMouseHandler 
) [static, protected]

Callback function invoked when there is a new mouse event

Parameters:
event 
x 
y 
falgs 
pMouseHandler pointer to the MouseHandler parent
bool DUtilsCV::GUI::MouseHandler::empty (  )  const [inline]

Says whether there is some event to get

Returns:
true iif no event available
bool GUI::MouseHandler::get ( tEvent event  ) 

Gets the next event from the queue

Parameters:
event (out) event fetched
Returns:
false iif queue was empty and no event could be retrieved
void GUI::MouseHandler::ignore ( int  event  ) 

Stops listening to some event

Parameters:
event 
void GUI::MouseHandler::listen ( int  event  ) 

Adds an event to listen to

Parameters:
event 
void GUI::MouseHandler::listenToAll (  ) 

Adds all the events to the list of valid events


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations
Generated on Thu Feb 7 19:22:00 2013 by  doxygen 1.6.3