Skip to main content

Application Development Kit (Version 4.7)


gui.h

Last updated: 17-Sep-2025
Go to the documentation of this file.
    1 // -*- Mode: C++; -*-    2 #ifndef GUI_H_2013_03_14    3 #define GUI_H_2013_03_14    4     10 #include <stdarg.h>   11 #include <pthread.h>   12 #include "jsobject.h"   13 #include "timestamp.h"   14 #include "gui_error.h"   15 #include "types.h"   16     17 #if defined _WIN32 && defined VFI_GUIPRT_SHARED_EXPORT   18 #    define DllSpec __declspec(dllexport)   19 #elif defined __GNUC__ && defined VFI_GUIPRT_SHARED_EXPORT   20 #  define DllSpec  __attribute__((visibility ("default")))   21 #else   22 #  define DllSpec   23 #endif   24     26 #ifndef DOXYGEN   27 namespace vfigui {   28 #endif   29 #if 0   30 } // just to satisfy automatic indentation of the editor   31 #endif   32     33 using namespace vfihtml; // import common interfaces   34     51 typedef bool (*uiCallback)(void *data);   52     54 enum UICBType { UI_CB_RESULT,        55                 UI_CB_UPDATE,        56                 UI_CB_LOAD,          57                 UI_CB_ERROR_LIST,    58                 UI_CB_STATISTICS,    59                 UI_CB_EVENT          60 };   61     62 struct UIErrorEntry;   63 struct UIStatistics;   64     66 class UICBData {   67  public:   68     70    virtual ~UICBData() {}   71     73    virtual int &result()=0;   74     76    virtual int txn_id()=0;   77     79    virtual stringmap &value()=0;   80     82    virtual std::string &url()=0;   83     85    virtual std::vector<UIErrorEntry> &error()=0;   86     88    virtual std::string &script_error()=0;   89     91    virtual UIStatistics &statistics()=0;   92     93 };   94     95    105 typedef void (*uiAsyncCallback)(void *data, UICBType type, UICBData &uidata);  106    109 struct UIRegion {  110    int id;   111    int left;     112    int top;      113    int right;    114    int bottom;   115    int flags;    116 };  117    118 enum { UI_REGION_DEFAULT=0        119 };  120    121 enum {  122    UI_REGION_FLAG_HIDDEN=1           124 };  125    126    131 DllSpec void uiSetConnectAttempts(int num);  132    136 DllSpec int uiGetConnectAttempts();  137    143 typedef void (*uiDisconnectCallback)(int display);  144    150 DllSpec void uiSetDisconnectCallback(uiDisconnectCallback cb);  151    155 DllSpec uiDisconnectCallback uiGetDisconnectCallback();  156    163 DllSpec void uiSetKeepalive(int count, int interval);  164    169 DllSpec void uiGetKeepalive(int &count, int &interval);  170    175 DllSpec void uiDisconnect(int display);  176    184 DllSpec int uiReadRuntimeID(int display, std::string &id, int timeout_msec=5000);  185    194 DllSpec std::string uiPrint(const char *format, ...);  195    198 DllSpec std::string uiPrintV(const char *format, va_list va);  199    200    204 DllSpec int uiDisplayCount();  205    206    214 DllSpec int uiDisplay(int display, int region_id, const std::string &text);  215    216 DllSpec int uiDisplay(int region_id, const std::string &text);  217    218 inline int uiDisplay(const std::string &text) { return uiDisplay(0,UI_REGION_DEFAULT,text); }  219    220    232 DllSpec int uiInvoke(int display, int region_id, stringmap &value, const std::string &text, uiCallback cb=0, void *cbdata=0);  233    234 DllSpec int uiInvoke(int region_id, stringmap &value, const std::string &text, uiCallback cb=0, void *cbdata=0);  235    236 inline int uiInvoke(stringmap &value, const std::string &text, uiCallback cb=0, void *cbdata=0)  237 { return uiInvoke(0,UI_REGION_DEFAULT,value,text,cb,cbdata); }  238    239 inline int uiInvoke(int display, int region_id, const std::string &text, uiCallback cb=0, void *cbdata=0)  240 { stringmap value; return uiInvoke(display, region_id,value,text,cb,cbdata); }  241    242 inline int uiInvoke(int region_id, const std::string &text, uiCallback cb=0, void *cbdata=0)  243 { stringmap value; return uiInvoke(0,region_id,value,text,cb,cbdata); }  244    245 inline int uiInvoke(const std::string &text, uiCallback cb=0, void *cbdata=0)  246 { stringmap value; return uiInvoke(0,UI_REGION_DEFAULT,value,text,cb,cbdata); }  247    260 DllSpec int uiInvokeTemplate(int display, int region_id, stringmap &value, const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0);  261    262 DllSpec int uiInvokeTemplate(int region_id, stringmap &value, const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0);  263    264 inline int uiInvokeTemplate(stringmap &value, const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0)  265 { return uiInvokeTemplate(0,UI_REGION_DEFAULT,value,template_name,text,cb,cbdata); }  266    267 inline int uiInvokeTemplate(int display, int region_id, const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0)  268 { stringmap value; return uiInvokeTemplate(display,region_id,value,template_name,text,cb,cbdata); }  269    270 inline int uiInvokeTemplate(int region_id, const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0)  271 { stringmap value; return uiInvokeTemplate(0,region_id,value,template_name,text,cb,cbdata); }  272    273 inline int uiInvokeTemplate(const std::string &template_name, const std::string &text, uiCallback cb=0, void *cbdata=0)  274 { stringmap value; return uiInvokeTemplate(0,UI_REGION_DEFAULT,value,template_name,text,cb,cbdata); }  275    276    289 DllSpec int uiInvokeURL(int display, int region_id, stringmap &value, const char *url, uiCallback cb=0, void *cbdata=0);  290    292 DllSpec int uiInvokeURL(int region_id, stringmap &value, const char *url, uiCallback cb=0, void *cbdata=0);  293    295 inline int uiInvokeURL(stringmap &value, const char *url, uiCallback cb=0, void *cbdata=0)  296 { return uiInvokeURL(0,UI_REGION_DEFAULT,value,url,cb,cbdata); }  297    299 inline int uiInvokeURL(int display, int region_id, const char *url, uiCallback cb=0, void *cbdata=0)  300 { stringmap value; return uiInvokeURL(display, region_id,value,url,cb,cbdata); }  301    303 inline int uiInvokeURL(int region_id, const char *url, uiCallback cb=0, void *cbdata=0)  304 { stringmap value; return uiInvokeURL(0,region_id,value,url,cb,cbdata); }  305    307 inline int uiInvokeURL(const char *url, uiCallback cb=0, void *cbdata=0)  308 { stringmap value; return uiInvokeURL(0,UI_REGION_DEFAULT,value,url,cb,cbdata); }  309    310    323 DllSpec int uiInvokeURL(int display, int region_id, stringmap &value, const std::string &url, uiCallback cb=0, void *cbdata=0);  324    326 inline int uiInvokeURL(int region_id, stringmap &value, const std::string &url, uiCallback cb=0, void *cbdata=0)  327 { return uiInvokeURL(0,region_id,value,url,cb,cbdata); }  328    330 inline int uiInvokeURL(stringmap &value, const std::string &url, uiCallback cb=0, void *cbdata=0)  331 { return uiInvokeURL(0,UI_REGION_DEFAULT,value,url,cb,cbdata); }  332    334 inline int uiInvokeURL(int display, int region_id, const std::string &url, uiCallback cb=0, void *cbdata=0)  335 { stringmap value; return uiInvokeURL(display,region_id,value,url,cb,cbdata); }  336    338 inline int uiInvokeURL(int region_id, const std::string &url, uiCallback cb=0, void *cbdata=0)  339 { stringmap value; return uiInvokeURL(0,region_id,value,url,cb,cbdata); }  340    342 inline int uiInvokeURL(const std::string &url, uiCallback cb=0, void *cbdata=0)  343 { stringmap value; return uiInvokeURL(0,UI_REGION_DEFAULT, value,url,cb,cbdata); }  344    345    358 DllSpec int uiInvokeAsync(int display, int region_id, const stringmap &value, const std::string &text, uiAsyncCallback cb=0, void *data=0);  359    361 DllSpec int uiInvokeAsync(int region_id, const stringmap &value, const std::string &text, uiAsyncCallback cb=0, void *data=0);  362    364 inline int uiInvokeAsync(const stringmap &value, const std::string &text, uiAsyncCallback cb=0, void *data=0)  365 { return uiInvokeAsync(0,UI_REGION_DEFAULT, value, text,cb,data); }  366    368 inline int uiInvokeAsync(int display, int region_id, const std::string &text, uiAsyncCallback cb=0, void *data=0)  369 { stringmap value; return uiInvokeAsync(display, region_id,value,text,cb,data); }  370    372 inline int uiInvokeAsync(int region_id, const std::string &text, uiAsyncCallback cb=0, void *data=0)  373 { stringmap value; return uiInvokeAsync(0,region_id,value,text,cb,data); }  374    376 inline int uiInvokeAsync(const std::string &text, uiAsyncCallback cb=0, void *data=0)  377 { stringmap value; return uiInvokeAsync(0,UI_REGION_DEFAULT, value, text,cb,data); }  378    392 DllSpec int uiInvokeTemplateAsync(int display, int region_id, const stringmap &value, const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0);  393    395 DllSpec int uiInvokeTemplateAsync(int region_id, const stringmap &value, const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0);  396    398 inline int uiInvokeTemplateAsync(const stringmap &value, const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0)  399 { return uiInvokeTemplateAsync(0, UI_REGION_DEFAULT, value, template_name, text, cb,data); }  400    402 inline int uiInvokeTemplateAsync(int display, int region_id, const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0)  403 { stringmap value; return uiInvokeTemplateAsync(display,region_id,value,template_name,text, cb,data); }  404    406 inline int uiInvokeTemplateAsync(int region_id, const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0)  407 { stringmap value; return uiInvokeTemplateAsync(0,region_id,value,template_name,text, cb,data); }  408    410 inline int uiInvokeTemplateAsync(const std::string &template_name, const std::string &text, uiAsyncCallback cb=0, void *data=0)  411 { stringmap value; return uiInvokeTemplateAsync(0,UI_REGION_DEFAULT, value, template_name, text, cb,data); }  412    413    427 DllSpec int uiInvokeURLAsync(int display, int region_id, const stringmap &value, const char *url, uiAsyncCallback cb=0, void *data=0);  428    430 DllSpec int uiInvokeURLAsync(int region_id, const stringmap &value, const char *url, uiAsyncCallback cb=0, void *data=0);  431    433 inline int uiInvokeURLAsync(const stringmap &value, const char *url, uiAsyncCallback cb=0, void *data=0)  434 { return uiInvokeURLAsync(0, UI_REGION_DEFAULT, value, url,cb,data); }  435    437 inline int uiInvokeURLAsync(int display, int region_id,const char *url, uiAsyncCallback cb=0, void *data=0)  438 { stringmap value; return uiInvokeURLAsync(display, region_id,value,url,cb,data); }  439    441 inline int uiInvokeURLAsync(int region_id,const char *url, uiAsyncCallback cb=0, void *data=0)  442 { stringmap value; return uiInvokeURLAsync(0,region_id,value,url,cb,data); }  443    445 inline int uiInvokeURLAsync(const char *url, uiAsyncCallback cb=0, void *data=0)  446 { stringmap value; return uiInvokeURLAsync(0, UI_REGION_DEFAULT, value, url,cb,data); }  447    448    462 DllSpec int uiInvokeURLAsync(int display, int region_id, const stringmap &value, const std::string &url, uiAsyncCallback cb=0, void *data=0);  463    465 inline int uiInvokeURLAsync(int region_id, const stringmap &value, const std::string &url, uiAsyncCallback cb=0, void *data=0)  466 { return uiInvokeURLAsync(0, region_id, value, url,cb,data); }  467    469 inline int uiInvokeURLAsync(const stringmap &value, const std::string &url, uiAsyncCallback cb=0, void *data=0)  470 { return uiInvokeURLAsync(0, UI_REGION_DEFAULT, value, url,cb,data); }  471    473 inline int uiInvokeURLAsync(int display, int region_id,const std::string &url, uiAsyncCallback cb=0, void *data=0)  474 { stringmap value; return uiInvokeURLAsync(display, region_id,value,url,cb,data); }  475    477 inline int uiInvokeURLAsync(int region_id,const std::string &url, uiAsyncCallback cb=0, void *data=0)  478 { stringmap value; return uiInvokeURLAsync(0,region_id,value,url,cb,data); }  479    481 inline int uiInvokeURLAsync(const std::string &url, uiAsyncCallback cb=0, void *data=0)  482 { stringmap value; return uiInvokeURLAsync(0, UI_REGION_DEFAULT, value, url,cb,data); }  483    484    496 DllSpec int uiInvokeWait(int txn_id, std::map<std::string,std::string> &value, int timeout_msec=-1);  497    498    500 inline int uiInvokeWait(int txn_id, int timeout_msec=-1)  501 {  502    std::map<std::string,std::string> value;  503    return uiInvokeWait(txn_id,value,timeout_msec);  504 }  505    515 DllSpec int uiInvokeCancel(int txn_id, std::map<std::string,std::string> &value);  516    518 inline int uiInvokeCancel(int txn_id)  519 {  520    std::map<std::string,std::string> value;  521    return uiInvokeCancel(txn_id,value);  522 }  523    527 DllSpec int uiInvokeCancelAsync(int txn_id);  528    539 DllSpec int uiInvokeURLDetached(int display, int region_id, const char *url);  540    542 DllSpec int uiInvokeURLDetached(int region_id, const char *url);  543    545 inline int uiInvokeURLDetached(const char *url)  546 { return uiInvokeURLDetached(0, UI_REGION_DEFAULT,url); }  547    548    555 DllSpec int uiClear(int display, int region_id);  556    558 inline int uiClear(int region_id) { return uiClear(0,region_id); }  559    561 enum UIPropertyInt {  562    UI_PROP_TIMEOUT=0,                  563    UI_PROP_PASSWORD_CHAR,              564    UI_PROP_DEFAULT_FONT_SIZE,          565    UI_PROP_PIN_AUTO_ENTER,             566    UI_PROP_PIN_CLEAR_ALL,              567    UI_PROP_PIN_BYPASS_KEY,             572    UI_PROP_PIN_ALGORITHM,              574    UI_PROP_PIN_INTERCHAR_TIMEOUT,      575    UI_PROP_PASSWORD_SHOW_CHAR,         576    UI_PROP_KEEP_DISPLAY,               579    UI_PROP_UPDATE_EVENTS,              581    UI_PROP_CIRCULAR_MENU,              583    UI_PROP_TOUCH_ACTION_BEEP,          585    UI_PROP_STATISTICS,                 586    UI_PROP_RESTRICTED,                 587    UI_PROP_CP_APP_MODE,                588    UI_PROP_SCROLL_COLOR,               589    UI_PROP_INPUT_ERROR_BEEP,           592    UI_PROP_ZOOM_MAX,                   593    UI_PROP_SCROLL_DISPLAY,             595    UI_PROP_JS_QUOTA_SIZE,                 597    // Readonly properties  598    UI_DEVICE_WIDTH=1000,               599    UI_DEVICE_HEIGHT,                   600    UI_DEVICE_COLOR_DEPTH,              601    UI_DEVICE_SUPPORTS_TOUCH,           602    UI_DEVICE_SUPPORTS_BEEPER,        // not supported, do not use. Left here for compatibility reasons.  603    UI_DEVICE_SUPPORTS_AUDIO,           604    UI_DEVICE_SUPPORTS_VIDEO,           605    UI_DEVICE_SUPPORTS_SIGCAP,          606    UI_DEVICE_SUPPORTS_COLOR_DISPLAY,   607    UI_DEVICE_HAS_CAP_TOUCH_KEYPAD,     608    UI_DEVICE_SUPPORTS_NAVIGATOR_MODE,  609    UI_DEVICE_KEY_COUNT                 610 };  611    613 enum UIPropertyString {  614    UI_PROP_DECIMAL_SEPARATOR=2000,   615    UI_PROP_THOUSANDS_SEPARATOR,      616    UI_PROP_DEFAULT_FONT,             617    UI_PROP_RESOURCE_PATH,            618    UI_PROP_FILE_PREFIX,              620    UI_PROP_KEYMAP,                   621    UI_PROP_CSS,                      622    UI_PROP_RESOURCE_DEFAULT_PATH,    623    UI_PROP_GUI_EXTENSIONS,           624    UI_PROP_HTTP_HEADER_FIELDS,       626    UI_PROP_CP_APP_DIR,               628    UI_PROP_LANGUAGE,                 636    UI_PROP_JS_ROOT,                  639    UI_PROP_PRINT_ROOT,               641    UI_PROP_PRINT_CSS,                643    UI_PROP_JS_QUOTA_ROOT,            645    // Readonly properties  646    UI_DEVICE_MODEL=3000              647 };  648    656 DllSpec int uiSetPropertyInt(int display, enum UIPropertyInt property, int value);  657    659 DllSpec int uiSetPropertyInt(enum UIPropertyInt property, int value);  660    668 DllSpec int uiGetPropertyInt(int display, enum UIPropertyInt property, int *value);  669    671 DllSpec int uiGetPropertyInt(enum UIPropertyInt property, int *value);  672    680 DllSpec int uiSetPropertyString(int display, enum UIPropertyString property, const char *value);  681    683 DllSpec int uiSetPropertyString(enum UIPropertyString property, const char *value);  684    692 inline int uiSetPropertyString(int display, enum UIPropertyString property, const std::string &value)  693 { return uiSetPropertyString(display,property,value.c_str()); }  694    696 inline int uiSetPropertyString(enum UIPropertyString property, const std::string &value)  697 { return uiSetPropertyString(0,property,value.c_str()); }  698    707 DllSpec int uiGetPropertyString(int display, enum UIPropertyString property, char* value, int len);  708    710 DllSpec int uiGetPropertyString(enum UIPropertyString property, char* value, int len);  711    719 DllSpec int uiGetPropertyString(int display, enum UIPropertyString property, std::string &value);  720    722 DllSpec int uiGetPropertyString(enum UIPropertyString property, std::string &value);  723    724    726 enum UIServerProperty {  727    UI_SERVER_TOUCH_ACTION_BEEP,   730    UI_SERVER_INPUT_ERROR_BEEP,   733    UI_SERVER_KEYMAP,             735 };  736    743 DllSpec int uiSetServerProperty(int display, enum UIServerProperty property, const std::string &value);  744    751 DllSpec int uiGetServerProperty(int display, enum UIServerProperty property, std::string &value);  752    760 DllSpec std::string uiGetTerminalResourceDir(int display, const std::string &www_path);  761    763 DllSpec std::string uiGetTerminalResourceDir(const std::string &www_path);  764    767 DllSpec std::string uiGetKeypadType(int display);  768    774 DllSpec void uiSetLocalProperties(bool local);  775    777 DllSpec bool uiGetLocalProperties();  778    792 DllSpec int uiLayout(int display, const UIRegion *region, int regcnt, const UIRegion *oldreg, int oldregcnt);  793    795 DllSpec int uiLayout(const UIRegion *region, int regcnt, const UIRegion *oldreg, int oldregcnt);  796    798 DllSpec int uiLayout(int display, const UIRegion *region, int regcnt);  799    801 DllSpec int uiLayout(const UIRegion *region, int regcnt);  802    810 inline int uiLayout(int display, const std::vector<UIRegion> &reg) {  811    UIRegion dummy;  812    return uiLayout(display, reg.size() ? &reg[0] : &dummy,reg.size());  813 }  814    816 inline int uiLayout(const std::vector<UIRegion> &reg) {  817    UIRegion dummy;  818    return uiLayout(0, reg.size() ? &reg[0] : &dummy,reg.size());  819 }  820    831 inline int uiLayout(int display, const std::vector<UIRegion> &reg, const std::vector<UIRegion> &oldreg)  832 {  833    UIRegion dummy;  834    return uiLayout(display, reg.size() ? &reg[0] : &dummy,reg.size(), oldreg.size() ? &oldreg[0] : &dummy, oldreg.size());  835 }  836    838 inline int uiLayout(const std::vector<UIRegion> &reg, const std::vector<UIRegion> &oldreg)  839 {  840    UIRegion dummy;  841    return uiLayout(0,reg.size() ? &reg[0] : &dummy,reg.size(), oldreg.size() ? &oldreg[0] : &dummy, oldreg.size());  842 }  843    851 DllSpec int uiLayout(int display, const char *name);  852    854 DllSpec int uiLayout(const char *name);  855    862 DllSpec int uiGetLayout(int display, std::vector<UIRegion> &region);  863    865 DllSpec int uiGetLayout(std::vector<UIRegion> &region);  866    874 DllSpec int uiGetRegionSize(int display, int region_id, int &width, int &height);  875    877 inline int uiGetRegionSize(int region_id, int &width, int &height)  878 {  879    return uiGetRegionSize(0,region_id,width,height);  880 }  881    890 DllSpec int uiEnterRegion(int display, int region_id);  891    893 DllSpec int uiEnterRegion(int region_id);  894    899 DllSpec int uiLeaveRegion(int display);  900    902 DllSpec int uiLeaveRegion();  903    912 DllSpec std::string uiCurrentRegionPath(int display);  913    915 DllSpec std::string uiCurrentRegionPath();  916    923 DllSpec int uiSetCurrentRegionPath(int display, const std::string &path);  924    926 DllSpec int uiSetCurrentRegionPath(const std::string &path);  927    928    934 DllSpec int uiRegionIsVisible(int display, int region_id);  935    940 inline int uiRegionIsVisible(int region_id)  941 {return uiRegionIsVisible(0,region_id); }  942    943    952 DllSpec void uiReadConfig(int display);  953    955 DllSpec void uiReadConfig();  956    957    966 DllSpec int uiSetCatalog(int display, const std::string &filename);  967    969 DllSpec int uiSetCatalog(const std::string &filename);  970    976 DllSpec std::string uiGetCatalog(int display);  977    979 DllSpec std::string uiGetCatalog();  980    988 DllSpec void uiCatalogSetDelayedRelease(unsigned num);  989    995 DllSpec unsigned uiCatalogGetDelayedRelease();  996    997   1006 DllSpec std::string uiGetText(int display, const std::string &name, const std::string &deflt=""); 1007   1009 DllSpec std::string uiGetText(const std::string &name, const std::string &deflt=""); 1010   1027 DllSpec std::string uiGetText(int display, const std::string &filename, const std::string &name, const std::string &deflt); 1028   1030 DllSpec std::string uiGetText(const std::string &filename, const std::string &name, const std::string &deflt); 1031   1041 DllSpec int uiGetHtml(int display, const std::map<std::string,std::string> &value, const std::string &text, std::string &html); 1042   1044 DllSpec int uiGetHtml(const std::map<std::string,std::string> &value, const std::string &text, std::string &html); 1045   1056 DllSpec int uiGetHtmlURL(int display, const std::map<std::string,std::string> &value, const std::string &url, std::string &html); 1057   1059 DllSpec int uiGetHtmlURL(const std::map<std::string,std::string> &value, const std::string &url, std::string &html); 1060   1061   1069 DllSpec std::string uiGetURLPath(int display, const std::string &url); 1070   1072 DllSpec std::string uiGetURLPath(const std::string &url); 1073   1074   1082 DllSpec int uiScreenshotPNG(int display, const char *filename); 1083   1085 DllSpec int uiScreenshotPNG(const char *filename); 1086   1099 DllSpec int uiScreenshotPNG(int display, const char *filename, int x, int y, int w, int h); 1100   1102 inline int uiScreenshotPNG(const char *filename, int x, int y, int w, int h) 1103 { 1104    return uiScreenshotPNG(0,filename,x,y,w,h); 1105 } 1106   1107   1115 DllSpec int uiScreenshotPNGData(int display, std::vector<unsigned char> &data); 1116   1118 DllSpec int uiScreenshotPNGData(std::vector<unsigned char> &data); 1119   1132 DllSpec int uiScreenshotPNGData(int display, std::vector<unsigned char> &data, int x, int y, int w, int h); 1133   1135 inline int uiScreenshotPNGData(std::vector<unsigned char> &data, int x, int y, int w, int h) 1136 { 1137    return uiScreenshotPNGData(0,data,x,y,w,h); 1138 } 1139   1140   1151 DllSpec int uiURL2PNG(const char *filename, int width, int height, const std::map<std::string,std::string> &value, const std::string &url); 1152   1163 DllSpec int uiURL2PNGData(std::vector<unsigned char> &data, int width, int height, const std::map<std::string,std::string> &value, const std::string &url); 1164   1174 DllSpec int uiHTML2PNG(const char *filename, int width, int height, const std::map<std::string,std::string> &value, const std::string &text); 1175   1185 DllSpec int uiHTML2PNGData(std::vector<unsigned char> &data, int width, int height, const std::map<std::string,std::string> &value, const std::string &text); 1186   1190 DllSpec const char *uiLibVersion(); 1191   1195 DllSpec const char *gui_GetVersion(); 1196   1197   1202 DllSpec const char *gui_GetSvcVersion(int display); 1203 DllSpec const char *gui_GetSvcVersion(); 1204   1206 enum { 1207    // lowest 4 bits: direction flags 1208    UI_TRANS_UP     =0x1,   1209    UI_TRANS_RIGHT  =0x2,   1210    UI_TRANS_DOWN   =0x4,   1211    UI_TRANS_LEFT   =0x8,   1213    UI_TRANS_DIRECTION_MASK=0xf,  1215    // 2 bits affecting speed: 1216    UI_TRANS_EASE_IN    =0x10,  1217    UI_TRANS_EASE_OUT   =0x20,  1218    UI_TRANS_EASE_INOUT =0x30,  1220    UI_TRANS_EASE_MASK=0x30,  1222    // Transition type 1223    UI_TRANS_NONE     =0x000,  1224    UI_TRANS_SLIDE    =0x100,  1225    UI_TRANS_SLIDEON  =0x200,  1226    UI_TRANS_SWAP     =0x300,  1228    UI_TRANS_CROSSFADE=0x400,  1230    UI_TRANS_TYPE_MASK=0xfff00  1231 }; 1232   1242 DllSpec int uiSetTransition(int display, int region_id, unsigned transtype, int duration_ms); 1243   1245 DllSpec int uiSetTransition(int region_id, unsigned transtype, int duration_ms); 1246   1248 inline int uiSetTransition(unsigned transtype, int duration_ms) 1249 { return uiSetTransition(0,UI_REGION_DEFAULT,transtype,duration_ms); } 1250   1251   1253 struct UIErrorEntry { 1255    enum ErrorType { NOT_FOUND,    1256                     UNSUPPORTED,  1257                     CORRUPT       1258    } type;  1259    std::string name;  1261    UIErrorEntry(ErrorType t, const std::string &n) :type(t),name(n) {} 1262 }; 1263   1270 DllSpec const std::vector<UIErrorEntry> &uiErrorList(); 1271   1273 struct UIStatistics { 1274    vfigui::TimeStamp start;   1275    vfigui::TimeStamp css;     1276    vfigui::TimeStamp html;    1277    vfigui::TimeStamp draw;    1278 }; 1279   1280   1286 DllSpec const UIStatistics &uiStatistics(); 1287   1288   1292 DllSpec std::string uiScriptError(); 1293   1294   1298 DllSpec int uiGetIdleTime(int display=0); 1299   1303 DllSpec void uiSetLogMask(unsigned mask); 1304   1308 DllSpec unsigned uiGetLogMask(void); 1309   1311 enum UILEDShape { 1312    UI_SHAPE_RECTANGLE,   1313    UI_SHAPE_ELLIPSE      1314 }; 1315   1329 DllSpec int uiConfigLEDs(int display, 1330                          UILEDShape shape, int width, int height, 1331                          unsigned off_rgba, 1332                          unsigned on0_rgba, unsigned on1_rgba, unsigned on2_rgba, unsigned on3_rgba); 1333   1335 DllSpec int uiConfigLEDs(UILEDShape shape, int width, int height, 1336                          unsigned off_rgba, 1337                          unsigned on0_rgba, unsigned on1_rgba, unsigned on2_rgba, unsigned on3_rgba); 1338   1339   1349 DllSpec int uiConfigLEDs(int display, const char *filename); 1350   1352 DllSpec int uiConfigLEDs(const char *filename); 1353   1355 enum UIEdge { 1356    UI_EDGE_TOP,   1357    UI_EDGE_RIGHT,   1358    UI_EDGE_BOTTOM,  1359    UI_EDGE_LEFT     1360 }; 1361   1378 DllSpec int uiShowLEDArea(int display, UIEdge edge, int width, int height, unsigned bg_rgba); 1379   1381 DllSpec int uiShowLEDArea(UIEdge edge, int width, int height, unsigned bg_rgba); 1382   1387 DllSpec int uiHideLEDArea(int display); 1388   1390 DllSpec int uiHideLEDArea(); 1391   1398 DllSpec int uiSetLED(int display, unsigned led, bool state); 1399   1401 DllSpec int uiSetLED(unsigned led, bool state); 1402   1403   1405 struct UIBacklight { 1406    unsigned brightness;  1407    unsigned timeout;     1409 }; 1410   1424 DllSpec int uiSetBacklightConfig(int display, const std::vector<UIBacklight> &levels); 1425   1431 DllSpec int uiGetBacklightConfig(int display, std::vector<UIBacklight> &levels); 1432   1440 DllSpec int uiSetBacklightLevel(int display, int level); 1441   1447 DllSpec int uiGetBacklightLevel(int display, int &level); 1448   1449   1457 DllSpec int uiSetInput(int display, int region_id, const std::string &name, const std::string &value); 1458   1460 inline int uiSetInput(int region_id, const std::string &name, const std::string &value) 1461 { 1462    return uiSetInput(0,region_id,name,value); 1463 } 1464   1471 DllSpec int uiRunAction(int display, int region_id, const std::string &name); 1472   1474 inline int uiRunAction(int region_id, const std::string &name) 1475 { 1476    return uiRunAction(0,region_id,name); 1477 } 1478   1479   1486 DllSpec int uiRunAction2(int display, int region_id, const std::string &name); 1487   1489 inline int uiRunAction2(int region_id, const std::string &name) 1490 { 1491    return uiRunAction2(0,region_id,name); 1492 } 1493   1507 DllSpec int uiAddOption(int display, int region_id, const std::string &name, const std::string &value, const std::string &text, const std::string &style="", const std::string &action="", int position=-1); 1508   1510 inline int uiAddOption(int region_id, const std::string &name, const std::string &value, const std::string &text, const std::string &style="", const std::string &action="", int position=-1) 1511 { 1512    return uiAddOption(0,region_id,name,value,text,style,action,position); 1513 } 1514   1516 enum UIScrollPosition { UI_SCROLL_TOP,    1517                         UI_SCROLL_BOTTOM  1518 }; 1519   1520   1530 DllSpec int uiScrollOption(int display, int region_id, const std::string &name, const std::string &value, UIScrollPosition pos); 1531   1533 inline int uiScrollOption(int region_id, const std::string &name, const std::string &value, UIScrollPosition pos) 1534 { 1535    return uiScrollOption(0,region_id,name,value,pos); 1536 } 1537   1545 DllSpec int uiRemoveOption(int display, int region_id, const std::string &name, const std::string &value); 1546   1548 inline int uiRemoveOption(int region_id, const std::string &name, const std::string &value) 1549 { 1550    return uiRemoveOption(0,region_id,name,value); 1551 } 1552   1560 DllSpec int uiDisablePINOK(int display=0); 1561   1568 DllSpec int uiEnablePINOK(int display=0); 1569   1570   1582 DllSpec int uiUpdate(int display, int region_id, const std::string &name, const std::string &html); 1583   1585 inline int uiUpdate(int region_id, const std::string &name, const std::string &html) 1586 { 1587    return uiUpdate(0,region_id,name,html); 1588 } 1589   1591 enum UIBeep { 1592    UI_BEEP_NORMAL,  1593    UI_BEEP_ERROR    1594 }; 1595   1601 DllSpec int uiBeep(int display, UIBeep beep); 1602   1604 inline int uiBeep(UIBeep beep) { 1605    return uiBeep(0,beep); 1606 } 1607   1608   1610 enum UINagScreenType { 1611    UI_NAG_TEST_DEVICE  1612 }; 1613   1624 DllSpec int uiNagScreen(int display, enum UINagScreenType type, int hide, int show); 1625   1626 /*****************************************************************************/ 1627 /*****************************************************************************/ 1628 /**************************** Canvas interface *******************************/ 1629 /*****************************************************************************/ 1630 /*****************************************************************************/ 1631   1633 enum UICanvasEvent { 1634    UI_PUSH,    1635    UI_DRAG,    1636    UI_RELEASE, 1637    UI_KEYDOWN, 1638    UI_KEYUP,   1639    UI_TERMINATE  1640 }; 1641   1653 typedef void (*uiEventCallback)(void *data, UICanvasEvent event, int x, int y, int key, unsigned flags); 1654   1656 class DllSpec UIDrawing { 1657   1658  public: 1659    vfihtml::JSObject drawlist; 1660   1662    enum { 1663       FNT_NORMAL=0x0,  1664       FNT_ITALIC=0x1,  1665       FNT_BOLD=0x700   1666    }; 1667   1669    enum ImageType { 1670       IMG_BMP,   1671       IMG_GIF,   1672       IMG_JPEG,  1673       IMG_PAM,   1674       IMG_PBM,   1675       IMG_PNG,   1676       IMG_RAW    1677    }; 1678   1680    UIDrawing(); 1681   1683    ~UIDrawing(); 1684   1686    void reset(); 1687   1690    void clear(unsigned rgb); 1691   1694    void color(unsigned rgb); 1695   1698    void linewidth(int w); 1699   1705    void line(int x, int y, int x2, int y2); 1706   1710    void pixel(int x, int y); 1711   1717    void rect(int x, int y, int w, int h); 1718   1724    void rectf(int x, int y, int w, int h); 1725   1733    void trif(int x, int y, int x2, int y2, int x3, int y3); 1734   1739    void font(const char *name, int size, unsigned style=FNT_NORMAL); 1740   1745    void font(const std::string &name, int size, unsigned style=FNT_NORMAL); 1746   1754    void text(const char *text, int x, int y); 1755   1757    void text(const std::string &text, int x, int y); 1758   1759   1775    void image(ImageType type, const void *data, unsigned size, int x, int y, int w=0, int h=0); 1776   1782    void image(const char *filename, int x, int y); 1783   1785    void image(const std::string &filename, int x, int y); 1786   1787 }; 1788   1789   1797 DllSpec int uiCanvas(int display, int region_id, uiEventCallback cb, void *data=0); 1798   1800 inline int uiCanvas(int region_id, uiEventCallback cb, void *data=0) 1801 { 1802    return uiCanvas(0,region_id,cb,data); 1803 } 1804   1811 DllSpec int uiDraw(int display, int region_id, const UIDrawing &drawing); 1812   1814 inline int uiDraw(int region_id, const UIDrawing &drawing) 1815 { 1816    return uiDraw(0,region_id,drawing); 1817 } 1818   1825 DllSpec int uiDrawAsync(int display, int region_id, const UIDrawing &drawing, uiAsyncCallback cb=0, void *data=0); 1826   1828 inline int uiDrawAsync(int region_id, const UIDrawing &drawing, uiAsyncCallback cb=0, void *data=0) 1829 { 1830    return uiDrawAsync(0,region_id,drawing,cb,data); 1831 } 1832   1834 struct UITextWidth { 1835    std::string text;  1836    int width;         1839    UITextWidth(const std::string &s="") { text=s; width=0; } 1840 }; 1841   1842   1854 DllSpec int uiTextMetrics(int display, int region_id, const std::string &font, int size, unsigned style, std::vector<UITextWidth> &width, int &height, int &descent); 1855   1857 inline int uiTextMetrics(int region_id, const std::string &font, int size, unsigned style, std::vector<UITextWidth> &width, int &height, int &descent) 1858 { 1859    return uiTextMetrics(0,region_id,font,size,style,width,height,descent); 1860 } 1861   1862   1867 DllSpec const char *uiDataURLType(const std::string &in); 1868   1873 DllSpec bool uiDataURLToString(std::string &out,const std::string &in); 1874   1879 DllSpec bool uiDataURLToFile(const char *filename,const std::string &in); 1880   1881   1882 #ifndef DOXYGEN 1883 } // namespace vfigui 1884 #endif 1885   1886   1889 #undef DllSpec 1890   1891   1892 #include "gui_template.h" // add "old" template functions 1893   1894 #endif

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo