Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using HTML widget

To create an HTML widget, do the following:

  1. Call ISHELL_CreateInstance() with the ClassID AEECLSID_CHTMLWidget.
    if(AEE_SUCCESS == nErr) {
       nErr = ISHELL_CreateInstance(me->pIShell, AEECLSID_CHTMLWIDGET, 
                                           (void**)&(me->piwHtml));
    }
  2. Set properties for the HTML widget:
    if(AEE_SUCCESS == nErr) {
       ERR_TRY(IWidget_SetBGColor(me->piwHtml, MAKE_RGBA(255,255,255,255)));
       we.width = (me->rcRoot).dx-nScrollHndlWidth-nScrollPad-4;
       we.height = (me->rcRoot).dy;
       IWidget_SetExtent(me->piwHtml,&we);
       ERR_TRY(IWidget_SetIWeb(me->piwHtml, me->piWeb));
       IDecorator_SetWidget(me->piwScrollBar, me->piwHtml);
    }
    
  3. Add Listeners for the HTML widget:
    if(AEE_SUCCESS == nErr) {
       LISTENER_SetListenerInfo(&me->mlHtmlDoc, 
                     samplehtmlwidgettouchapp_htmldoclistener, me);
       LISTENER_SetListenerInfo(&me->mlHtmlView, 
                    samplehtmlwidgettouchapp_htmlviewlistener, me);
       ERR_TRY(IDocModel_AddListener(me->piDocModel, &me->mlHtmlDoc));
       ERR_TRY(IHTMLViewModel_AddListener(me->piViewModel, 
                                                  &me->mlHtmlView));
    }
  4. Set the position of the widget and insert the widget into the container:
    dwpos.x = 0;
    dwpos.y = 0;
    dwpos.bVisible = TRUE;
    
    // insert widget into root container
    if(AEE_SUCCESS == nErr) {
       nErr = IRootContainer_Insert(me->picRoot, CAST(IWidget *, 
                       me->piwScrollBar), WIDGET_ZNORMAL, &dwpos);
    }
    nErr =(IWidget_MoveFocus(me->piwRoot, CAST(IWidget*,
                                            me->piwScrollBar)));

HTML Widget has touch screen support for links. On EVT_POINTER_DOWN event, the HTML widget touch controller sets PROP_HTMLW_FOCUSPOS on the widget for the hit link element. This will cause the focus to move to the touched link if it did not have focus prior to touching. On EVT_POINTER_UP, if the pointer was still on the same link, the HTML widget touch controller sets PROP_HTMLW_SELECTPOS on HTML widget. This causes the view model to send out EVT_HVM_JUMP.

PROPEX_HTMLW_WIDATPOS gets the widget at given position and forwards the event to it.