Wt::SDLInput::EventInfo Class Reference

converted event to wt semantics More...

Collaboration diagram for Wt::SDLInput::EventInfo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EventInfo ()
 EventInfo (const SDL_Event *event)
bool operator== (const EventInfo &other) const

Public Attributes

int button
int state
int wheel_delta
int button_event_type
Point point
Widgetwidget
Time time

Static Public Attributes

static const int delta_proximity = 10
static const int delta_delay = 300

Detailed Description

converted event to wt semantics

Definition at line 63 of file sdlinput.h.


Constructor & Destructor Documentation

Wt::SDLInput::EventInfo::EventInfo (  ) 

Definition at line 61 of file sdlinput.cpp.

00061                              :
00062         button(NoButton),
00063         state(0),
00064         wheel_delta(0),
00065         button_event_type(0),
00066         point(-1, -1),
00067 widget(0) {}

Wt::SDLInput::EventInfo::EventInfo ( const SDL_Event *  event  ) 

Definition at line 69 of file sdlinput.cpp.

References button, button_event_type, Wt::SDLInput::buttonMap, Wt::Widget::childAt(), Wt::Singleton< DERIVED >::instance(), Wt::RootWindow::instance(), Wt::Object::isDescendant(), Wt::SDLInput::keyMap, Wt::Event::MouseButtonPress, Wt::Event::MouseButtonRelease, Wt::NoButton, Wt::Event::Nope, point, Wt::Time::start(), Wt::FlagMap::state(), state, time, wheel_delta, Wt::SDLInput::wheelMap, and widget.

00069                                                    {
00070 
00071     int modifiers_state = SDL_GetModState();
00072 
00073     switch(event->type) {
00074     case SDL_MOUSEMOTION: {
00075             const SDL_MouseMotionEvent *mme = reinterpret_cast<
00076                                               const SDL_MouseMotionEvent *>(event);
00077             button = NoButton;
00078             state = keyMap.state(modifiers_state) | buttonMap.state(mme->state);
00079             wheel_delta = 0;
00080             button_event_type = Event::Nope;
00081             point = Point(mme->x, mme->y);
00082         }
00083         break;
00084     case SDL_MOUSEBUTTONDOWN:
00085     case SDL_MOUSEBUTTONUP: {
00086             const SDL_MouseButtonEvent *mbe = reinterpret_cast<
00087                                               const SDL_MouseButtonEvent *>(event);
00088             button = buttonMap[mbe->button];
00089             state = keyMap.state(modifiers_state);
00090             wheel_delta = wheelMap[mbe->button];
00091             button_event_type = (event->type == SDL_MOUSEBUTTONDOWN) ?
00092                                 Event::MouseButtonPress : Event::MouseButtonRelease;
00093             point = Point(mbe->x, mbe->y);
00094             if (button_event_type == Event::MouseButtonPress) {
00095                 time.start();
00096             }
00097         }
00098         break;
00099     default:
00100         assert(0);
00101         break;
00102     }
00103 
00104     Widget *w = RootWindow::instance()->childAt(point, true);
00105     Widget *mg = SDLInput::instance()->mouseGrabber();
00106     widget = (!mg || w->isDescendant(mg)) ? w : mg;
00107 }

Here is the call graph for this function:


Member Function Documentation

bool Wt::SDLInput::EventInfo::operator== ( const EventInfo other  )  const

Definition at line 109 of file sdlinput.cpp.

References button, button_event_type, delta_delay, delta_proximity, Wt::Time::msecsTo(), point, state, time, wheel_delta, widget, Wt::Point::x(), and Wt::Point::y().

00109                                                                {
00110     if (button != other.button)
00111         return false;
00112     if (state != other.state)
00113         return false;
00114     if (wheel_delta != other.wheel_delta)
00115         return false;
00116     if (button_event_type != other.button_event_type)
00117         return false;
00118     if (std::max(abs(point.x() - other.point.x()),
00119             abs(point.y() - other.point.y())) > delta_proximity)
00120         return false;
00121     if (widget != other.widget)
00122         return false;
00123     if (abs(time.msecsTo(other.time)) > delta_delay) {
00124         return false;
00125     }
00126     return true;
00127 }

Here is the call graph for this function:


Member Data Documentation

int Wt::SDLInput::EventInfo::button

Definition at line 69 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleMouseEvent(), and operator==().

int Wt::SDLInput::EventInfo::button_event_type

Definition at line 72 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleMouseEvent(), and operator==().

const int Wt::SDLInput::EventInfo::delta_delay = 300 [static]

Definition at line 78 of file sdlinput.h.

Referenced by operator==().

const int Wt::SDLInput::EventInfo::delta_proximity = 10 [static]

Definition at line 77 of file sdlinput.h.

Referenced by operator==().

Point Wt::SDLInput::EventInfo::point

Definition at line 73 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleMouseEvent(), and operator==().

int Wt::SDLInput::EventInfo::state

Definition at line 70 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleMouseEvent(), and operator==().

Time Wt::SDLInput::EventInfo::time

Definition at line 75 of file sdlinput.h.

Referenced by EventInfo(), and operator==().

int Wt::SDLInput::EventInfo::wheel_delta

Definition at line 71 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleMouseEvent(), and operator==().

Widget* Wt::SDLInput::EventInfo::widget

Definition at line 74 of file sdlinput.h.

Referenced by EventInfo(), Wt::SDLInput::handleActiveEvent(), Wt::SDLInput::handleMouseEvent(), and operator==().


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

Generated Fri Jul 28 19:32:34 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.