/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Authors: Michel Zucchi * * Copyright 2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ #ifndef __E_POPUP_H__ #define __E_POPUP_H__ #include #include "e-util/e-msgport.h" #ifdef __cplusplus extern "C" { #pragma } #endif /* __cplusplus */ /* This is an abstract popup menu management/merging class. To implement your own popup menu system, just create your own target types and implement the target free method. */ typedef struct _EPopup EPopup; typedef struct _EPopupClass EPopupClass; typedef struct _EPopupItem EPopupItem; typedef struct _EPopupFactory EPopupFactory; /* anonymous type */ typedef struct _EPopupTarget EPopupTarget; typedef void (*EPopupActivateFunc)(EPopup *ep, EPopupItem *item, void *data); typedef void (*EPopupFactoryFunc)(EPopup *emp, void *data); typedef void (*EPopupItemsFunc)(EPopup *ep, GSList *items, void *data); /** * enum _e_popup_t - Popup item type enumeration. * @E_POPUP_ITEM: A simple menu item. * @E_POPUP_TOGGLE: A toggle menu item. * @E_POPUP_RADIO: A radio menu item. Note that the radio group is * global for the entire (sub) menu. i.e. submenu's must be used to * separate radio button menu items. * @E_POPUP_IMAGE: A &GtkImage menu item. In this case the @image * field of &struct _EPopupItem points to the &GtkImage directly. * @E_POPUP_SUBMENU: A sub-menu header. It is up to the application * to define the @path properly so that the submenu comes before the * submenu items. * @E_POPUP_BAR: A menu separator bar. * @E_POPUP_TYPE_MASK: Mask used to separate item type from option bits. * @E_POPUP_ACTIVE: An option bit to signify that the radio button or * toggle button is active. */ enum _e_popup_t { E_POPUP_ITEM = 0, E_POPUP_TOGGLE, E_POPUP_RADIO, E_POPUP_IMAGE, E_POPUP_SUBMENU, E_POPUP_BAR, E_POPUP_TYPE_MASK = 0xffff, E_POPUP_ACTIVE = 0x10000, }; /* FIXME: activate passes back no context data apart from that provided. FIXME: It should pass the target at the least. The menu widget is useless */ /** * struct _EPopupItem - A popup menu item definition. * @type: The type of the popup. See the &enum _epopup_t definition * for possible values. * @path: An absolute path, which when sorted using a simple ASCII * sort, will put the menu item in the right place in the menu * heirarchy. '/' is used to separate menus from submenu items. * @label: The text of the menyu item. * @activate: A function conforming to &EPopupActivateFunc which will * be called when the menu item is activated. * @user_data: Extra per-item user-data available to the * application. This is not passed to the @data field of @activate. * @image: For most types, the name of the icon in the icon theme to * display next to the menu item, if required. For the %E_POPUP_IMAGE * type, it is a pointer to the &GtkWidget instead. * @visible: Visibility mask. Used together with the &EPopupTarget mask * to determine if the item should be part of the menu or not. * @enable: Sensitivity mask. Similar to the visibility mask, but * currently unimplemented. * @popup: Used by e-popup to reference the parent object from * callbacks. * * The EPopupItem defines a single popup menu item, or submenu item, * or menu separator based on the @type. Any number of these are * merged at popup display type to form the popup menu. * * The application may extend this structure using simple C structure * containers to add any additional fields it may require. */ struct _EPopupItem { enum _e_popup_t type; char *path; /* absolute path! must sort ascii-lexographically into the right spot */ char *label; EPopupActivateFunc activate; void *user_data; /* user data, not passed directly to @activate */ void *image; /* char* for item type, GtkWidget * for image type */ guint32 visible; /* visibility mask */ guint32 enable; /* sensitivity mask */ }; /** * struct EPopupTarget - A popup menu target definition. * * @popup: The parent popup object, used for virtual methods on the target. * @widget: The parent widget, where available. In some cases the * type of this object is part of the published api for the target. * @type: The target type. This will be defined by the * implementation. * @mask: Target mask. This is used to sensitise and show items * based on their definition in EPopupItem. * * An EPopupTarget defines the context for a specific popup menu * instance. The root target object is abstract, and it is up to * sub-classes of &EPopup to define the additional fields required to * make it usable. */ struct _EPopupTarget { struct _EPopup *popup; /* used for virtual methods */ struct _GtkWidget *widget; /* used if you need a parent toplevel, if available */ guint32 type; /* targe type, for implementors */ guint32 mask; /* depends on type, visibility mask */ /* implementation fields follow */ }; /** * struct _EPopup - A Popup menu manager. * * @object: Superclass, GObject. * @priv: Private data. * @menuid: The id of this menu instance. * @target: The current target during the display of the popup menu. * * The EPopup manager object. Each popup menu is built using this * one-off object which is created each time the popup is invoked. */ struct _EPopup { GObject object; struct _EPopupPrivate *priv; char *menuid; EPopupTarget *target; }; /** * struct _EPopupClass - * * @object_class: Superclass type. * @factories: A list of factories for this particular class of popup * menu. * @target_free: Virtual method to free the popup target. The base * class frees the allocation and unrefs the popup pointer * structure. * * The EPopup class definition. This should be sub-classed for each * component that wants to provide hookable popup menus. The * sub-class only needs to know how to allocate and free the various target * types it supports. */ struct _EPopupClass { GObjectClass object_class; EDList factories; void (*target_free)(EPopup *ep, EPopupTarget *t); }; GType e_popup_get_type(void); EPopup *e_popup_new(const char *menuid); /* Static class methods */ EPopupFactory *e_popup_class_add_factory(EPopupClass *klass, const char *menuid, EPopupFactoryFunc func, void *data); void e_popup_class_remove_factory(EPopupClass *klass, EPopupFactory *f); EPopup *e_popup_construct(EPopup *, const char *menuid); void e_popup_add_items(EPopup *, GSList *items, EPopupItemsFunc freefunc, void *data); void e_popup_add_static_items(EPopup *emp, EPopupTarget *target); /* do not call e_popup_create_menu, it can leak structures if not used right */ struct _GtkMenu *e_popup_create_menu(EPopup *, EPopupTarget *, guint32 mask); struct _GtkMenu *e_popup_create_menu_once(EPopup *emp, EPopupTarget *, guint32 mask); void *e_popup_target_new(EPopup *, int type, size_t size); void e_popup_target_free(EPopup *, void *); /* ********************************************************************** */ /* popup plugin target, they are closely integrated */ /* To implement a basic popup menu plugin, you just need to subclass this and initialise the class target type tables */ #include "e-util/e-plugin.h" typedef struct _EPopupHookMenu EPopupHookMenu; typedef struct _EPopupHook EPopupHook; typedef struct _EPopupHookClass EPopupHookClass; typedef struct _EPluginHookTargetMap EPopupHookTargetMap; typedef struct _EPluginHookTargetKey EPopupHookTargetMask; typedef void (*EPopupHookFunc)(struct _EPlugin *plugin, EPopupTarget *target); /** * struct _EPopupHookMenu - * * @hook: Parent pointer. * @id: The identifier of the menu to which these items belong. * @target_type: The target number of the type of target these menu * items expect. It will generally also be defined by the menu id. * @items: A list of EPopupItems. * * The structure used to keep track of all of the items that a plugin * wishes to add to a given menu. This is used internally by a factory * method set on EPlugin to add the right menu items to a given menu. */ struct _EPopupHookMenu { struct _EPopupHook *hook; /* parent pointer */ char *id; /* target menu id for these menu items */ int target_type; /* target type of this menu */ GSList *items; /* items to add to menu */ }; /** * struct _EPopupHook - A popup menu hook. * * @hook: Superclass. * @menus: A list of EPopupHookMenus, for all menus registered on * this hook type. * * The EPopupHook class loads and manages the meta-data required to * map plugin definitions to physical menus. */ struct _EPopupHook { EPluginHook hook; GSList *menus; }; /** * struct _EPopupHookClass - * * @hook_class: Superclass. * @target_map: Table of EPluginHookTargetMaps which enumerate the * target types and enable bits of the implementing class. * @popup_class: The EPopupClass of the corresponding popup manager * for the implementing class. * * The EPopupHookClass is a concrete class, however it is empty on its * own. It needs to be sub-classed and initialised appropriately. * * The EPluginHookClass.id must be set to the name and version of the * hook handler itself. The @target_map must be initialised with the * data required to enumerate the target types and enable flags * supported by the implementing class. */ struct _EPopupHookClass { EPluginHookClass hook_class; /* EPopupHookTargetMap by .type */ GHashTable *target_map; /* the popup class these popups belong to */ EPopupClass *popup_class; }; GType e_popup_hook_get_type(void); /* for implementors */ void e_popup_hook_class_add_target_map(EPopupHookClass *klass, const EPopupHookTargetMap *); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __E_POPUP_H__ */ mit/textproc?h=dependabot/npm_and_yarn/devel/electron4/files/lodash-4.17.19&id=fc0cc574fc2a4c1259954cae4bac1e0d22e58d50'>textproc/zsh-syntax-highlighting: Update to 0.6.0.231,1jrm2019-01-172-5/+5 * Update to 1.22sunpoet2019-01-172-5/+8 * Fix Qt5 symbol version scripts to put the catch-all clause first. Whentijl2019-01-1619-8/+19 * New port: textproc/rubygem-compass-blueprinttz2019-01-164-0/+28 * Update to 1.54sunpoet2019-01-162-5/+6 * Add py-cmarkgfm 0.4.2sunpoet2019-01-164-0/+29 * Update KDE Frameworks to 5.54.0tcberner2019-01-163-9/+9 * textproc/chkascii: update to version 1.3swills2019-01-152-4/+4 * textproc/py-asciinema: update to 2.0.2swills2019-01-152-4/+4 * Update to 2019.01.13sunpoet2019-01-142-4/+4 * Update to 2.2.0sunpoet2019-01-142-4/+4 * textproc/py-elasticsearch-dsl: update to 6.3.1swills2019-01-142-4/+4 * - Add LICENSEamdmi32019-01-141-0/+4 * - Update to 6.7wen2019-01-142-4/+4 * Update WWWsunpoet2019-01-141-1/+1 * Update WWWsunpoet2019-01-141-1/+1 * Update to 0.24sunpoet2019-01-142-4/+4 * Update to 1.05sunpoet2019-01-142-5/+17 * Update to 9.4.5sunpoet2019-01-142-4/+4 * Fix check-plist errorsunpoet2019-01-121-0/+1 * Update gemspec for rubygem-ffi 1.10.0 updatesunpoet2019-01-122-0/+12 * Update to 0.094sunpoet2019-01-122-4/+4 * - Pet portlintamdmi32019-01-111-1/+5 * - Update to 0.417wen2019-01-112-4/+5 * Update KDE Applications to 18.12.1tcberner2019-01-112-6/+6 * Update to 1.99sunpoet2019-01-092-5/+6 * Update to 1.1.0sunpoet2019-01-092-5/+7 * Update to 0.2sunpoet2019-01-093-9/+10 * Take maintainershipsunpoet2019-01-081-1/+1 * Change MASTER_SITES to CHEESESHOPsunpoet2019-01-081-3/+2 * Do not set GNU_CONFIGURE twicetobik2019-01-081-1/+0 * Pass py-sphinx maintainership to python@antoine2019-01-081-1/+4 * Reset the maintainership back to ports@ because I'm not using thesearaujo2019-01-083-3/+3 * The Python package custom_inherit provides convenient, light-weight tools forskreuzer2019-01-084-0/+38 * Update to 2019.01.06sunpoet2019-01-082-4/+4 * textproc/emacs-wiki: Properly register xml-parse.el as a run dependency tootobik2019-01-081-3/+3 * textproc/2bsd-diff: fix breakage on currentfernape2019-01-078-28/+662 * Update dns/libidn2 to 2.1.0sunpoet2019-01-071-0/+1 * x11-wm/sway: add new portjbeich2019-01-064-0/+37 * lang/ghc: Update to 8.6.3 and bump PORTREVISION's of all Haskell ports.arrowd2019-01-06105-248/+270 * textproc/bibutils: Update to 6.6tobik2019-01-063-14/+25 * textproc/libxml2: fix build with GCC-based architecturesswills2019-01-061-0/+3 * Update to 9.4.4sunpoet2019-01-062-4/+4 * textproc/scancode-toolkit: create portswills2019-01-067-0/+234 * textproc/py-license-expression: Update to 0.99swills2019-01-062-5/+5 * textproc/p5-Text-Distill: create portswills2019-01-065-0/+45 * textproc/Spreadsheet-ParseXLSX: create portswills2019-01-065-0/+46 * textproc/p5-docx2txt: create portswills2019-01-065-0/+51 * textproc/p5-PDF-Reuse: create portswills2019-01-065-0/+107 * Remove stale IGNORE_WITH_PHP=56 values.rene2019-01-052-2/+0 * Remove expired IGNORE_WITH_PHP= 56joneum2019-01-051-2/+0 * Remove expired IGNORE_WITH_PHP= 56joneum2019-01-051-2/+0 * Upgrade to 2.0.1matthew2019-01-052-4/+4 * - update to 0.8.6dinoex2019-01-052-12/+13 * Update to 1.62bapt2019-01-042-4/+6 * - Add LICENSEamdmi32019-01-041-0/+3 * Upgrade to 2.4.1.thierry2019-01-042-4/+4 * Update to 1.27sunpoet2019-01-042-4/+4 * Fix LICENSE_PERMSantoine2019-01-041-1/+1 * textproc/rubygem-nokogiri: PORTREVISION bump for libxml2 updateswills2019-01-041-2/+5 * This port now requires USES=compiler:c11 to build on GCC-based architectures.linimon2019-01-031-1/+2 * Update to 0.10.3bapt2019-01-033-6/+5 * Update to 1.26sunpoet2019-01-033-5/+6 * textproc/libxml2: update to 2.9.8swills2019-01-0213-73/+59 * Take maintainershipsunpoet2019-01-021-3/+4 * Update to 2018.12.30sunpoet2019-01-022-4/+4 * Update to 1.2.8sunpoet2019-01-022-7/+6 * Update to 9.4.3sunpoet2019-01-022-4/+4 * Add p5-Text-Template-Simple 0.91sunpoet2019-01-025-0/+68 * Update to 2.3.6joneum2019-01-022-4/+4 * textproc/tinyxml2: fix build on GCC architectures after r488341tcberner2019-01-011-1/+1 * Remove expired php56- ports:rene2019-01-0116-238/+0 * Remove expired ports:rene2019-01-014-34/+0 * Bump PORTREVISION on *-sbcl ports after lang/sbcl upgrade.krion2019-01-012-2/+2 * textproc/p5-Spreadsheet-Read: update to 0.80swills2019-01-012-4/+4 * Remove some more KDE4 ports and hopefully fix INDEX againrene2019-01-014-49/+0 * Remove KDE4, part 5rene2019-01-019-99/+0 * textproc/groonga: Update version 8.0.9=>8.1.0bofh2019-01-013-5/+7 * - Add LICENSEamdmi32018-12-311-0/+4 * Remove expired ports:rene2018-12-3129-373/+0 * More GCC-related fixes in kde@ portstcberner2018-12-311-1/+1 * Drop maintainership, it is in most cases easier to just use pip.gstreamer0.10-removalrene2018-12-291-1/+1 * textproc/trang: update to 20181222fernape2018-12-292-17/+13 * textproc/jo: update to 1.2swills2018-12-282-5/+5 * json-yaml is a small command line utility to convert JSON to YAML.madpilot2018-12-284-0/+32 * textproc/py-sphinx_rtd_theme: update 0.4.0 -> 0.4.2robak2018-12-272-4/+4 * Groff now requires texinfo to be installed to buildbapt2018-12-271-1/+1 * Update to 1.22.4bapt2018-12-276-38/+27 * Update to 2.0.0matthew2018-12-272-4/+4 * textproc/jing: update to 20181222swills2018-12-272-14/+10 * This port requires USES=compiler:c++11-lang to build on GCC-basedlinimon2018-12-271-1/+1 * Update to 0.4.2bapt2018-12-262-4/+4 * - Fix LICENSEamdmi32018-12-262-2/+4 * Change cmake default behaviour to outsource.tcberner2018-12-2626-26/+26 * - Update to 1.26wen2018-12-242-3/+4 * Cater for systems built WITH_SVN knobsevan2018-12-241-3/+3 * Upgrade to 1.5.8 which is required for gitlab-ce 11.6.mfechner2018-12-232-6/+7 * Upgrade to 2.4.0.thierry2018-12-222-4/+4 * Remove expired ports:rene2018-12-215-87/+0 * - After changing to "mysqli", this port builds successfully with PHP 7.xjoneum2018-12-211-4/+6 * - After changing to "mysqli", this port builds successfully with PHP 7.xjoneum2018-12-211-4/+6 * textproc/lowdown: Unbreak by adding missing files to plistyuri2018-12-203-2/+4 * This port requires a C11-aware compiler to build on GCC-basedlinimon2018-12-201-0/+1 * textproc/ansifilter: Update version 2.10=>2.13bofh2018-12-182-17/+14 * textproc/ffe: update 0.3.8 to 0.3.9egypcio2018-12-172-6/+6 * textproc/retext: Fix broken translations; Fix autoplistyuri2018-12-173-66/+33 * textproc/retext: Unbreak by deleting the empty directory that was breaking th...yuri2018-12-171-0/+3 * textproc/groonga: Update version 8.0.4=>8.0.9bofh2018-12-17