ubit
Public Member Functions | Protected Attributes | Friends | List of all members
ubit::UMouseEvent Class Reference

mouse events More...

#include <uevent.hpp>

Inheritance diagram for ubit::UMouseEvent:
ubit::UInputEvent ubit::UEvent ubit::UModifier ubit::UWheelEvent

Public Member Functions

 UMouseEvent (const UCond &, UView *source, UEventFlow *, unsigned long time, int state, const UPoint &pos, const UPoint &abs_pos, int btn)
 
virtual UMouseEventtoMouseEvent ()
 
float getX () const
 returns the X coordinate of the mouse in getView().
 
float getY () const
 returns the Y coordinate of the mouse in getView().
 
const UPointgetPos () const
 returns the coordinates of the mouse in getView().
 
const UPointgetScreenPos () const
 returns the screen coordinates of the mouse.
 
UPoint getPosIn (const UView &view) const
 returns the coordinates of this event in this 'view'.
 
UPoint getPosIn (const UBox &parent_box) const
 returns the coordinates of this event in parent_box. More...
 
UPoint getPosAndViewIn (const UBox &parent, UView *&parent_view) const
 returns the coordinates of this event in 'parent' and the corresponding 'parent's view. More...
 
int getClickCount () const
 returns the number of mouse clicks.
 
int getButton () const
 returns the button that was just pressed or released. More...
 
int getButtons () const
 returns an ORed mask of mouse buttons after the event occured. More...
 
void translatePos (float x, float y)
 translates the mouse position.
 
void propagate ()
 propagates events in children: More...
 
void setFirstDrag (bool s)
 
bool isFirstDrag () const
 
bool isBrowsing () const
 
UStrgetStr ()
 returns the UStr object that is under the mouse ( More...
 
UStrgetStr (UDataContext &)
 returns the UStr object that is under the mouse and related properties ( More...
 
UDatagetData ()
 returns the UData object that is under the mouse ( More...
 
UDatagetData (UDataContext &)
 returns the UData object that is under the mouse and related properties. More...
 
- Public Member Functions inherited from ubit::UInputEvent
 UInputEvent (const UCond &, UView *source_view, UEventFlow *, unsigned long when, int state)
 
virtual UInputEventtoInputEvent ()
 dynamic cast: returns 'this' converted to the requested class or null.
 
virtual UElemgetSource () const
 returns the object that received this event.
 
UViewgetView () const
 returns the object's view that received this event. More...
 
UViewgetViewOf (const UBox &box) const
 returns the view of 'box' that (indirectly) received this event. More...
 
unsigned long getWhen () const
 returns the time when this event was produced.
 
virtual int getModifiers () const
 returns an ORed mask of mouse buttons and modifiers that are pressed. More...
 
bool isShiftDown () const
 
bool isControlDown () const
 
bool isMetaDown () const
 
bool isAltDown () const
 
bool isAltGraphDown () const
 
UWingetWin () const
 returns the hard window that received this event.
 
UViewgetWinView () const
 returns the view of the hard window that received this event.
 
UEventFlowgetFlow () const
 returns the Event Flow that received this event (for two-handed interaction or groupware). More...
 
UDispgetDisp () const
 returns the display that received this event. More...
 
bool dontCloseMenu () const
 impl.
 
- Public Member Functions inherited from ubit::UEvent
 UEvent (const UCond &c, UObject *source, UObject *aux=null)
 
const UCondgetCond () const
 returns the event condition that detected this event. More...
 
virtual UObjectgetAux () const
 returns auxilliary data.
 
virtual UKeyEventtoKeyEvent ()
 
virtual UWheelEventtoWheelEvent ()
 
virtual UViewEventtoViewEvent ()
 
virtual UPaintEventtoPaintEvent ()
 
virtual UResizeEventtoResizeEvent ()
 
virtual UTimerEventtoTimerEvent ()
 
virtual UWinEventtoWinEvent ()
 
virtual UMessageEventtoMessageEvent ()
 
virtual USysWMEventtoSysWMEvent ()
 
virtual UUserEventtoUserEvent ()
 
void setCond (const UCond &)
 

Protected Attributes

int button
 
int click_count
 
UPoint pos
 
UPoint abs_pos
 
- Protected Attributes inherited from ubit::UInputEvent
struct ubit::UInputEvent::Modes modes
 
int state
 
unsigned long when
 
UViewsource_view
 
UEventFloweflow
 
UElemevent_observer
 
- Protected Attributes inherited from ubit::UEvent
const UCondcond
 
UObjectsource
 
UObjectaux
 

Friends

class UEventFlow
 
class UElem
 
class UView
 
class UFlowView
 

Additional Inherited Members

- Static Public Member Functions inherited from ubit::UModifier
static void mapKeys (UDisp *)
 impl: init keys mapping.
 
- Static Public Attributes inherited from ubit::UModifier
static const int LeftButton
 
static const int RightButton
 
static const int MidButton
 
static const int ShiftDown
 
static const int ControlDown
 
static const int & MetaDown
 
static const int & AltDown
 
static const int AltGraphDown
 

Detailed Description

mouse events

See also
UOn::mpress, UOn::mrelease, UOn::mdrag, UOn::mmove for explanations.

Member Function Documentation

§ getButton()

int ubit::UMouseEvent::getButton ( ) const
inline

returns the button that was just pressed or released.

returns one of: UEvent::LeftButton, MidButton, RightButton for UOn::mpress and UOn::mrelease events. Returns 0 for UOn::mmove or UOn::mdrag events. Example:

      class MyClass {
      public:
         Myclass();  // contructor
      private:
         void pressCB(UMouseEvent&);
      };
      MyClass::MyClass() {
         ....
         ubutton("Press Me" + ucall(this, &MyClass::pressCB))
         ....
      }
      void MyClass::pressCB(UMouseEvent& e) {
         if (e.getButton() == e.RightButton && e.isControlDown()) 
              // done when the left mouse button AND the control key are pressed
      }
      

§ getButtons()

int UMouseEvent::getButtons ( ) const

returns an ORed mask of mouse buttons after the event occured.

button mask are UEvent::LeftButton, MidButton, RightButton. They are defined in class UModifier and inherited by UEvent. see UInputEvent::getModifiers() for examples.

§ getData() [1/2]

UData * UMouseEvent::getData ( )

returns the UData object that is under the mouse (

See also
getData(UDataContext&)).

§ getData() [2/2]

UData* ubit::UMouseEvent::getData ( UDataContext )

returns the UData object that is under the mouse and related properties.

  • returns null if no UData object was under the mouse when this event was generated
  • the UDataContext argument is filled with useful info on the retreived object.
  • use getStr() if you are only interested in UData objects that are strings.
    See also
    also: UDataContext

§ getPosAndViewIn()

UPoint UMouseEvent::getPosAndViewIn ( const UBox parent,
UView *&  parent_view 
) const

returns the coordinates of this event in 'parent' and the corresponding 'parent's view.

returns point (0,0) and 'parent_view' == null if the mouse is not located inside 'parent'.

§ getPosIn()

UPoint ubit::UMouseEvent::getPosIn ( const UBox parent_box) const

returns the coordinates of this event in parent_box.

returns point (0,0) if the mouse is not located inside 'parent_box'.

§ getStr() [1/2]

UStr * UMouseEvent::getStr ( )

returns the UStr object that is under the mouse (

See also
getData(UDataContext&)).

§ getStr() [2/2]

UStr* ubit::UMouseEvent::getStr ( UDataContext )

returns the UStr object that is under the mouse and related properties (

See also
getData(UDataContext&)).

§ propagate()

void ubit::UMouseEvent::propagate ( )
inline

propagates events in children:

See also
UElem::catchEvents().

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