ProcessViewBrowser-ServerProgramming
Functions
TextEvents

Functions

int textEventType (const char *text)
 
const char * svgObjectName (const char *text)
 
int getSvgBoundsOnElement (const char *text, float *x, float *y, float *width, float *height)
 
int getSvgMatrixForElement (const char *text, float *m11, float *m12, float *m21, float *m22, float *det, float *dx, float *dy)
 
int getGeometry (const char *text, int *x, int *y, int *width, int *height)
 
int getParentWidgetId (const char *text, int *parent)
 

Detailed Description

These are parsing functions for TEXT_EVENT

Example for useing TEXT_EVENTS:

static int slotTextEvent(PARAM *p, int id, DATA *d, const char *text)
{
  if(p == NULL || id == 0 || d == NULL || text == NULL) return -1;
  float x,y,w,h;
  float m11,m12,m21,m22,det,dx,dy;
  switch(textEventType(text))
  {
    case PLAIN_TEXT_EVENT:
      printf("plain\n");
      break;
    case WIDGET_GEOMETRY:
      int X,Y,W,H;
      getGeometry(text,&X,&Y,&W,&H);
      printf("geometry(%d)=%d,%d,%d,%d\n",id,X,Y,W,H);
      break;
    case PARENT_WIDGET_ID:
      int PID;
      getParentWidgetId(text,&PID);
      printf("parent(%d)=%d\n",id,PID);
      break;
    case SVG_LEFT_BUTTON_PRESSED:
      printf("left pressed\n");
      printf("objectname=%s\n",svgObjectName(text));
      break;
    case SVG_MIDDLE_BUTTON_PRESSED:
      printf("middle pressed\n");
      printf("objectname=%s\n",svgObjectName(text));
      break;
    case SVG_RIGHT_BUTTON_PRESSED:
      printf("right pressed\n");
      printf("objectname=%s\n",svgObjectName(text));
      break;
    case SVG_LEFT_BUTTON_RELEASED:
      printf("left released\n");
      printf("objectname=%s\n",svgObjectName(text));
      break;
    case SVG_MIDDLE_BUTTON_RELEASED:
      printf("middle released\n");
      printf("objectname=%s\n",svgObjectName(text));
      break;
    case SVG_RIGHT_BUTTON_RELEASED:
      printf("right released\n");
      break;
    case SVG_BOUNDS_ON_ELEMENT:
      getSvgBoundsOnElement(text, &x, &y, &w, &h);
      printf("bounds object=%s xywh=%f,%f,%f,%f\n",svgObjectName(text),x,y,w,h);
      break;
    case SVG_MATRIX_FOR_ELEMENT:
      getSvgMatrixForElement(text, &m11, &m12, &m21, &m22, &det, &dx, &dy);
      printf("matrix object=%s m=%f,%f,%f,%f det=%f dx=%f dy=%f\n",svgObjectName(text),
                               m11,m12,m21,m22,det,dx,dy);
      break;
    default:
      printf("default\n");
      break;
  }
  return 0;
}

Function Documentation

◆ getGeometry()

int getGeometry ( const char *  text,
int *  x,
int *  y,
int *  width,
int *  height 
)
Returns the geometry for a widget from a TEXT_EVENT
Allowed widgets: all widgets

◆ getParentWidgetId()

int getParentWidgetId ( const char *  text,
int *  parent 
)
Returns the parent id for a widget from a TEXT_EVENT
Allowed widgets: all widgets

◆ getSvgBoundsOnElement()

int getSvgBoundsOnElement ( const char *  text,
float *  x,
float *  y,
float *  width,
float *  height 
)
Returns the bounds on object within a SVG graphic from a TEXT_EVENT
Allowed widgets: QDrawWidget

◆ getSvgMatrixForElement()

int getSvgMatrixForElement ( const char *  text,
float *  m11,
float *  m12,
float *  m21,
float *  m22,
float *  det,
float *  dx,
float *  dy 
)
Returns the matrix for object within a SVG graphic from a TEXT_EVENT
Allowed widgets: QDrawWidget

◆ svgObjectName()

const char* svgObjectName ( const char *  text)
Returns the object name within a SVG graphic from a TEXT_EVENT
or "" if not found
Allowed widgets: QDrawWidget

◆ textEventType()

int textEventType ( const char *  text)
Return the enum TextEvents
Allowed widgets: QDrawWidget