Add popup to header.

@param Popup  $popup
@param string $id
@param string $icon

@throws Exception

@return mixed
330495
public function addPopup($popup = null, $icon = 'caret square down')
    {
        if (!$this->app) {
            throw new Exception('Columns\'s popup need to have a layout.');
        }

        $popup = $this->app->add($popup ? $popup : 'Popup')->setHoverable();

        $this->setHeaderPopup($popup, $icon);

        return $popup;
    }
206933
def _popup_menu(self, icon, button, time, extended=True):
        """"""
        m = self.create_context_menu(extended)
        m.show_all()
        m.popup(parent_menu_shell=None,
                parent_menu_item=None,
                func=icon.position_menu,
                data=icon,
                button=button,
                activate_time=time)
        # need to store reference or menu will be destroyed before showing:
        self._m = m
690312
protected static function createMenu($title, $uri, $icon = 'fa-bars', $parentId = 0)
    {
        $menuModel = config('admin.database.menu_model');

        $lastOrder = $menuModel::max('order');

        $menuModel::create([
            'parent_id' => $parentId,
            'order'     => $lastOrder + 1,
            'title'     => $title,
            'icon'      => $icon,
            'uri'       => $uri,
        ]);
    }
1013410
function (offset) {

            if (this.callbackID) {
                ariaCoreTimer.cancelCallback(this.callbackID);
                this.callbackID = null;
            }

            if (this._popup == null && this.ellipsesNeeded === true) {

                this.callbackID = ariaCoreTimer.addCallback({
                    fn : this._showPopup,
                    scope : this,
                    delay : 500,
                    args : offset
                });
            }
        }
358586
private void registerPopup(boolean allowCsvExport) {
        this.setComponentPopupMenu(popup);
        JMenuItem itemCopy = new JMenuItem("Copy Image to Clipboard");
        itemCopy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/copy.png")));
        JMenuItem itemSave = new JMenuItem("Save Image as...");
        itemSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/save.png")));
        JMenuItem itemExport = new JMenuItem("Export to CSV...");
        itemExport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kg/apc/jmeter/img/export.png")));
        itemCopy.addActionListener(new CopyAction());
        itemSave.addActionListener(new SaveAction());
        itemExport.addActionListener(new CsvExportAction());
        popup.add(itemCopy);
        popup.add(itemSave);
        if (allowCsvExport) {
            popup.addSeparator();
            popup.add(itemExport);
        }
    }
838220
function showTooltipBind() {
            if(hasEnableExp && !scope.$eval(attrs[prefix+'Enable'])) {
              return;
            }
            if ( scope.tt_popupDelay ) {
              popupTimeout = $timeout( show, scope.tt_popupDelay );
            } else {
              scope.$apply( show );
            }
          }
978402
protected void openPopup(final A_CmsContextMenuItem item) {

        m_popup.add(item.getSubMenu());
        m_popup.addAutoHidePartner(item.getElement());
        m_popup.setModal(false);
        m_popup.show();

        setSubMenuPosition(item);

        if (m_isFixed) {
            m_popup.setPositionFixed();
        }
    }
629646
public function populate($id)
    {
        if (empty($id)) {
            throw new Exception('No identifier supplied for totp', Totp\Exception::NO_IDENTIFIER_SUPPLIED);
        }

        $this->sendApiCall(self::ACTION_RETRIEVE, $this->getCreateUrl() . '/' . urlencode($id));
    }
1196911
public function generatePopup()
    {
        $GLOBALS['TL_JAVASCRIPT']['cca.dc-general.vanillaGeneral'] = 'bundles/ccadcgeneral/js/vanillaGeneral.js';

        $environment = $this->getEnvironment();
        $translator  = $environment->getTranslator();
        $template    = new ContaoBackendViewTemplate('widget_treepicker_popup');

        $icon = new GenerateHtmlEvent($this->titleIcon);
        $environment->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_GET_HTML, $icon);

        $template
            ->setTranslator($translator)
            ->set('id', 'tl_listing')
            ->set('name', $this->strName)
            ->set('class', ($this->strClass ? ' ' . $this->strClass : ''))
            ->set('icon', $icon->getHtml())
            ->set('title', $translator->translate($this->title ?: 'MSC.treePicker', '', [$this->sourceName]))
            ->set('fieldType', $this->fieldType)
            ->set('resetSelected', $translator->translate('MSC.resetSelected'))
            ->set('selectAll', $translator->translate('MSC.selectAll'))
            ->set('values', StringUtil::deserialize($this->varValue, true));

        // Create Tree Render with custom root points.
        $tree = '';
        foreach ($this->getRootIds() as $pid) {
            $tree .= $this->generateTreeView($this->loadCollection($pid), 'tree');
        }

        $template->set('tree', $tree);

        // Load the fonts for the drag hint.
        $GLOBALS['TL_CONFIG']['loadGoogleFonts'] = true;

        return $template->parse();
    }
934283
function (popup) {
                var curZIndex = popup.getZIndex();
                var newBaseZIndex = this.currentZIndex;
                if (curZIndex === newBaseZIndex) {
                    // already top most, nothing to do in any case!
                    return;
                }
                // gets all popups supposed to be in front of this one, including this one
                var openedPopups = this.openedPopups;
                var popupsToKeepInFront = [];
                var i, l;
                for (i = openedPopups.length - 1; i >= 0; i--) {
                    var curPopup = openedPopups[i];
                    if (curPopup === popup || curPopup.conf.zIndexKeepOpenOrder) {
                        popupsToKeepInFront.unshift(curPopup);
                        if (curPopup.getZIndex() === newBaseZIndex) {
                            newBaseZIndex -= 10;
                        }
                        if (curPopup === popup) {
                            break;
                        }
                    }
                }
                if (i < 0 || newBaseZIndex + 10 === curZIndex) {
                    // either the popup is not in openedPopups (i < 0)
                    // or it is already correctly positioned (newBaseZIndex + 10 === curZIndex)
                    return;
                }
                var eventObject = {
                    name : "beforeBringingPopupsToFront",
                    popups : popupsToKeepInFront,
                    cancel : false
                };
                this.$raiseEvent(eventObject);
                if (eventObject.cancel) {
                    return;
                }
                this.currentZIndex = newBaseZIndex;
                for (i = 0, l = popupsToKeepInFront.length; i < l; i++) {
                    var curPopup = popupsToKeepInFront[i];
                    curPopup.setZIndex(this.getZIndexForPopup(curPopup));
                }
            }
779804
public function set($fx = null, $arg2 = null)
    {
        if (!is_object($fx) && !($fx instanceof Closure)) {
            throw new Exception('Error: Need to pass a function to Popup::set()');
        }

        if ($arg2) {
            throw new Exception('Only one argument is needed by Popup::set()');
        }

        $this->cb = $this->add('Callback');

        if (!$this->minWidth) {
            $this->minWidth = '120px';
        }

        if (!$this->minHeight) {
            $this->minHeight = '60px';
        }

        if ($this->cb->triggered()) {
            //create content view to pass to callback.
            $content = $this->add($this->dynamicContent);
            $this->cb->set($fx, [$content]);
            //only render our content view.
            //PopupService will replace content with this one.
            $this->app->terminate($content->renderJSON());
        }
    }
1095038
function popinLoad(name, url, options) {

            var id          = 'gina-popin-' + instance.id +'-'+ name;

            // popin element
            var $el         = document.getElementById(id) || null;

            if ( $el == null ) {

                var className   = self.options.class +' '+ id;
                $el             = document.createElement('div');
                $el.setAttribute('id', id);
                $el.setAttribute('class', className);
                instance.target.firstChild.appendChild($el);
            }

            if ( typeof(options) != 'undefined' ) {
                var options = merge(options, xhrOptions);
            } else {
                var options = xhrOptions;
            }

            options.url     = url;


            if ( options.withCredentials ) {
                if ('withCredentials' in xhr) {
                    // XHR for Chrome/Firefox/Opera/Safari.
                    if (options.isSynchrone) {
                        xhr.open(options.method, options.url, options.isSynchrone)
                    } else {
                        xhr.open(options.method, options.url)
                    }
                } else if ( typeof XDomainRequest != 'undefined' ) {
                    // XDomainRequest for IE.
                    xhr = new XDomainRequest();
                    xhr.open(options.method, options.url);
                } else {
                    // CORS not supported.
                    xhr = null;
                    var result = 'CORS not supported: the server is missing the header `"Access-Control-Allow-Credentials": true` ';
                    triggerEvent(gina, $el, 'error.' + id, result)
                }
            } else {
                if (options.isSynchrone) {
                    xhr.open(options.method, options.url, options.isSynchrone)
                } else {
                    xhr.open(options.method, options.url)
                }
            }

            // setting up headers
            for (var hearder in options.headers) {
                xhr.setRequestHeader(hearder, options.headers[hearder]);
            }

            if (xhr) {
                // catching ready state cb
                xhr.onreadystatechange = function (event) {
                    if (xhr.readyState == 4) {
                        // 200, 201, 201' etc ...
                        if( /^2/.test(xhr.status) ) {

                            try {
                                var result = xhr.responseText;
                                if ( /json$/.test( xhr.getResponseHeader("Content-Type") ) ) {
                                    result = JSON.parse(xhr.responseText)
                                }


                                instance.eventData.success = result;

                                triggerEvent(gina, $el, 'loaded.' + id, result);

                            } catch (err) {
                                var result = {
                                    'status':  422,
                                    'error' : err.description
                                };

                                instance.eventData.error = result;

                                triggerEvent(gina, $el, 'error.' + id, result)
                            }

                        } else {
                            //console.log('error event triggered ', event.target, $form);
                            var result = {
                                'status':  xhr.status,
                                'error' : xhr.responseText
                            };

                            instance.eventData.error = result;

                            // update toolbar
                            var XHRData = result;
                            if ( gina && typeof(window.ginaToolbar) == "object" && XHRData ) {
                                try {
                                    if ( XHRData.error && /^(\{|\[).test(XHRData.error) /)
                                        XHRData.error = JSON.parse(XHRData.error);

                                    // bad .. should not happen
                                    if ( typeof(XHRData.error.error) != 'undefined' )
                                        XHRData.error = XHRData.error.error;

                                    ginaToolbar.update("data-xhr", XHRData )
                                } catch (err) {
                                    throw err
                                }
                            }


                            triggerEvent(gina, $el, 'error.' + id, result)
                        }
                    }
                };

                // catching request progress
                // xhr.onprogress = function(event) {
                //     //console.log(
                //     //    'progress position '+ event.position,
                //     //    '\nprogress total size '+ event.totalSize
                //     //);
                //
                //     var percentComplete = (event.position / event.totalSize)*100;
                //     var result = {
                //         'status': 100,
                //         'progress': percentComplete
                //     };
                //
                //     instance.eventData.onprogress = result;
                //
                //     triggerEvent(gina, $el, 'progress.' + id, result)
                // };

                // catching timeout
                // xhr.ontimeout = function (event) {
                //     var result = {
                //         'status': 408,
                //         'error': 'Request Timeout'
                //     };
                //
                //     instance.eventData.ontimeout = result;
                //
                //     triggerEvent(gina, $el, 'error.' + id, result)
                // };


                // sending
                xhr.send();

                return {
                    'open': function () {
                        var fired = false;
                        addListener(gina, $el, 'loaded.' + id, function(e) {
                        //$popin.on('loaded', function (e) {
                            e.preventDefault();

                            if (!fired) {
                                fired = true;

                                e.target.innerHTML = e.detail;


                                // bind with formValidator if forms are found
                                if ( /<form/i.test(e.target.innerHTML) && typeof($validator) != 'undefined' ) {
                                    var _id = null;
                                    var $forms = e.target.getElementsByTagName('form');
                                    for (var i = 0, len = $forms.length; i < len; ++i) {

                                        if ( !$forms[i]['id'] || typeof($forms[i]) != 'string' ) {
                                            _id = $forms[i].getAttribute('id') || 'form.' + uuid.v1();
                                            $forms[i].setAttribute('id', _id);// just in case
                                            $forms[i]['id'] = _id
                                        } else {
                                            _id = $forms[i]['id']
                                        }

                                        //console.log('pushing ', _id, $forms[i]['id'], typeof($forms[i]['id']), $forms[i].getAttribute('id'));
                                        if ($popin['$forms'].indexOf(_id) < 0)
                                            $popin['$forms'].push(_id);

                                        $forms[i].close = popinClose;
                                        $validator.validateFormById($forms[i].getAttribute('id')) //$forms[i]['id']

                                        removeListener(gina, $popin.target, e.type);
                                    }
                                }

                                popinOpen($popin.name);
                            }
                        });
                    }
                }
            }

        }
1234810
public function addTab(string $id, array $tab): void
	{
		$this->optionTabs[] = array_merge($tab, ['DIV' => $id]);
	}
318695
public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){
		return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon));
	}
825074
function showPopup(editor, popup, button) {

    var offset, left, top, $popup = $(popup);

    // Determine the popup location
    if (button) {
      var $button = $(button);
      offset = $button.offset();
      left = --offset.left;
      top = offset.top + $button.height();
    }
    else {
      var $toolbar = editor.$toolbar;
      offset = $toolbar.offset();
      left = Math.floor(($toolbar.width() - $popup.width()) / 2) + offset.left;
      top = offset.top + $toolbar.height() - 2;
    }

    // Position and show the popup
    hidePopups();
    $popup.css({left: left, top: top})
      .show();

    // Assign the popup button and click event handler
    if (button) {
      $.data(popup, BUTTON, button);
      $popup.bind(CLICK, {popup: popup}, $.proxy(popupClick, editor));
    }

    // Focus the first input element if any
    setTimeout(function() {
      $popup.find(":text,textarea").eq(0).focus().select();
    }, 100);

  }
441824
function popinDestroy(name) {
            var id = null, $el = null;
            if ( typeof(name) == 'string' && name != '' ) {
                id = 'gina-popin-' + instance.id +'-'+ name;
                if (id !== $popin.id)
                    throw new Error('Popin `'+name+'` not found !')
            } else if ( typeof(name) == 'undefined' ) {
                id = $popin.id
            }
        }
1011937
public function addPopupHtml($html="", $variation=NULL, $params=array()) {
		$this->_popup=new InternalPopup($this);
		$this->_popup->setHtml($html);
		$this->_popup->setAttributes($variation, $params);
		return $this;
	}