Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
MouseXML Class Reference

#include <MouseXML.h>

Inheritance diagram for MouseXML:
Inheritance graph
[legend]
Collaboration diagram for MouseXML:
Collaboration graph
[legend]

Public Types

enum  ElemClass {
  MOUSE , MOUSE_LISTENER , MONITOR , MONITOR_MOVE ,
  MONITOR_DOWN , MONITOR_UP , MONITOR_DRAG
}
 
enum  EventClass {
  ENTER , LEAVE , MOVE , DOWN ,
  UP , CLICK
}
 
enum  CoordinateProcessing { UNDEFINED = 0 , IMAGE_COORDS = 1 , RELATIVE_COORDS = 3 , GEOGRAPHIC_COORDS = 7 }
 
typedef drain::EnumFlagger< drain::MultiFlagger< CoordinateProcessing > > CoordFlagger
 

Static Public Member Functions

static void addVisibilitySwitch (XML &dstElem, XML &listenerElem, const std::string &scope="document", const std::string &mouseEventOn="onmouseenter", const std::string &mouseEventOff="onmouseleave")
 Show an element only if the mouse is on another specified element (listenerElem).
 

Protected Member Functions

template<class N >
void adjustListenerGeoRef (DRAIN_XML_TREE(N) &handlerScopeJS, CoordFlagger::ivalue_t coords) const
 

Static Protected Member Functions

static std::string getEventFunctionName (MouseXML::EventClass eventKey)
 Modifies short mouse event name like "click" to "onmouseclick", or prefixed form "handleClick".
 
static std::string getHandlerFunctionName (MouseXML::EventClass eventKey)
 
static std::string getInitialiserFunctionName (MouseXML::EventClass eventKey)
 
template<class N >
static DRAIN_XML_TREE (N) &getListenerScope(DRAIN_XML_TREE(N) &root
 Return internal ("top-level") routine for mouse event. The routine calls subroutine (that has a sub scope).
 
template<class N >
static DRAIN_XML_TREE (N) &getListenerInitScope(DRAIN_XML_TREE(N) &root
 Return ("top-level") initialisation script scope for a mouse event. The routine calls subroutine (that has a sub scope).
 
template<class N >
static DRAIN_XML_TREE (N) &ensureListenerUNUSED(DRAIN_XML_TREE(N) &root
 Create internal ("top-level") routine for mouse event, if it does not exist.
 
static void attachListener (XML &elem, const std::string &eventName, const std::string &handlerName)
 
template<class N >
static DRAIN_XML_TREE (N) &ensureListenerHandler(DRAIN_XML_TREE(N) &root
 
template<class N >
static DRAIN_XML_TREE (N) &ensureListenerInit(DRAIN_XML_TREE(N) &root
 Create internal ("top-level") initialisation script scope for mouse event, if it does not exist.
 

Protected Attributes

static const std::string & handlerName
 
static const std::string & initFnctName
 
static XML & elem
 
static XML const EventClass & eventCls
 

Static Protected Attributes

static const std::string COORD_INIT_SCOPE
 

Detailed Description

In running JavaScript on the rendered (SVG or HTML) document, the processing is divided in two sections:

The idea in initialisation is to minimize processing time/load of the actual listener routine. For example, the final routine should not repeatedly call query functions whose return value is constant. Examples of such functions are getElementById() and queryElem().

Also, coordinate handling is optimised such that georeferenced coordinates are not computed unless they are explicitly requested by a routine.

Member Enumeration Documentation

◆ ElemClass

enum ElemClass
See also
rack::RackSVG::ElemClass

Note: Event based entries will be deprecated as they are listed by EventClass

Member Function Documentation

◆ getEventFunctionName()

std::string getEventFunctionName ( MouseXML::EventClass  eventKey)
staticprotected

Modifies short mouse event name like "click" to "onmouseclick", or prefixed form "handleClick".

Examples:

  • "CLICK" -> "onmouseclick"
  • "CLICK","handle" -> "handleClick"

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