titemfactory.h - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
titemfactory.h (4457B)
---
     1 /************************************************************************
     2  * itemfactory.h  GtkItemFactory and friends for Unix/Win32             *
     3  * Copyright (C)  1998-2021  Ben Webb                                   *
     4  *                Email: benwebb@users.sf.net                           *
     5  *                WWW: https://dopewars.sourceforge.io/                 *
     6  *                                                                      *
     7  * When using GTK+3, which has removed GtkItemFactory, or Win32,        *
     8  * provide our own implementation; on GTK+2, use the implementation in  *
     9  * GTK+ itself.                                                         *
    10  *                                                                      *
    11  * This program is free software; you can redistribute it and/or        *
    12  * modify it under the terms of the GNU General Public License          *
    13  * as published by the Free Software Foundation; either version 2       *
    14  * of the License, or (at your option) any later version.               *
    15  *                                                                      *
    16  * This program is distributed in the hope that it will be useful,      *
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
    19  * GNU General Public License for more details.                         *
    20  *                                                                      *
    21  * You should have received a copy of the GNU General Public License    *
    22  * along with this program; if not, write to the Free Software          *
    23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,               *
    24  *                   MA  02111-1307, USA.                               *
    25  ************************************************************************/
    26 
    27 #ifndef __ITEM_FACTORY_H__
    28 #define __ITEM_FACTORY_H__
    29 
    30 #ifdef HAVE_CONFIG_H
    31 #include 
    32 #endif
    33 
    34 #include 
    35 
    36 #ifdef CYGWIN
    37 #include 
    38 #include 
    39 #include "gtktypes.h"
    40 #else
    41 #include 
    42 #endif
    43 
    44 /* Use GTK+2's own implementation of these functions */
    45 #if GTK_MAJOR_VERSION == 2
    46 #define DPGtkTranslateFunc GtkTranslateFunc
    47 #define DPGtkItemFactoryCallback GtkItemFactoryCallback
    48 #define DPGtkItemFactoryEntry GtkItemFactoryEntry
    49 #define DPGtkItemFactory GtkItemFactory
    50 
    51 GtkItemFactory *dp_gtk_item_factory_new(const gchar *path,
    52                                         GtkAccelGroup *accel_group);
    53 
    54 #define dp_gtk_item_factory_create_items gtk_item_factory_create_items
    55 #define dp_gtk_item_factory_create_item gtk_item_factory_create_item
    56 #define dp_gtk_item_factory_get_widget gtk_item_factory_get_widget
    57 #define dp_gtk_item_factory_set_translate_func gtk_item_factory_set_translate_func
    58 #else
    59 
    60 typedef gchar *(*DPGtkTranslateFunc) (const gchar *path, gpointer func_data);
    61 
    62 typedef void (*DPGtkItemFactoryCallback) ();
    63 
    64 typedef struct _DPGtkItemFactoryEntry DPGtkItemFactoryEntry;
    65 typedef struct _DPGtkItemFactory DPGtkItemFactory;
    66 
    67 struct _DPGtkItemFactoryEntry {
    68   gchar *path;
    69   gchar *accelerator;
    70   DPGtkItemFactoryCallback callback;
    71   guint callback_action;
    72   gchar *item_type;
    73 };
    74 
    75 struct _DPGtkItemFactory {
    76   GSList *children;
    77   gchar *path;
    78   GtkAccelGroup *accel_group;
    79   GtkWidget *top_widget;
    80   DPGtkTranslateFunc translate_func;
    81   gpointer translate_data;
    82 };
    83 
    84 DPGtkItemFactory *dp_gtk_item_factory_new(const gchar *path,
    85                                           GtkAccelGroup *accel_group);
    86 void dp_gtk_item_factory_create_item(DPGtkItemFactory *ifactory,
    87                                      DPGtkItemFactoryEntry *entry,
    88                                      gpointer callback_data,
    89                                      guint callback_type);
    90 void dp_gtk_item_factory_create_items(DPGtkItemFactory *ifactory,
    91                                       guint n_entries,
    92                                       DPGtkItemFactoryEntry *entries,
    93                                       gpointer callback_data);
    94 GtkWidget *dp_gtk_item_factory_get_widget(DPGtkItemFactory *ifactory,
    95                                           const gchar *path);
    96 void dp_gtk_item_factory_set_translate_func(DPGtkItemFactory *ifactory,
    97                                             DPGtkTranslateFunc func,
    98                                             gpointer data,
    99                                             GDestroyNotify notify);
   100 #endif /* GTK+2 */
   101 
   102 #endif /* __ITEM_FACTORY_H__ */