1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1998-07-14 07:40:15 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
1997-11-24 22:37:52 +00:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#include "gtkobject.h"
|
|
|
|
#include "gtktypeutils.h"
|
1998-06-14 14:37:39 +00:00
|
|
|
#include "gtkcontainer.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
#define TYPE_NODES_BLOCK_SIZE (200)
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
typedef struct _GtkTypeNode GtkTypeNode;
|
|
|
|
|
|
|
|
struct _GtkTypeNode
|
|
|
|
{
|
|
|
|
GtkType type;
|
|
|
|
GtkTypeInfo type_info;
|
1998-05-14 21:13:18 +00:00
|
|
|
guint n_supers : 24;
|
|
|
|
guint chunk_alloc_locked : 1;
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkType *supers;
|
|
|
|
GtkType parent_type;
|
|
|
|
gpointer klass;
|
|
|
|
GList *children_types;
|
1998-05-14 21:13:18 +00:00
|
|
|
GMemChunk *mem_chunk;
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
#define LOOKUP_TYPE_NODE(node_var, type) { \
|
|
|
|
if (type > 0) \
|
|
|
|
{ \
|
|
|
|
register GtkType sqn = GTK_TYPE_SEQNO (type); \
|
|
|
|
if (sqn < n_type_nodes) \
|
|
|
|
node_var = type_nodes + sqn; \
|
|
|
|
else \
|
|
|
|
node_var = NULL; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
node_var = NULL; \
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-08-11 19:29:36 +00:00
|
|
|
static void gtk_type_class_init (GtkType node_type);
|
1998-05-06 01:43:56 +00:00
|
|
|
static guint gtk_type_name_hash (const char *key);
|
|
|
|
static gint gtk_type_name_compare (const char *a,
|
|
|
|
const char *b);
|
|
|
|
static void gtk_type_init_builtin_types (void);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
static GtkTypeNode *type_nodes = NULL;
|
1998-07-14 07:40:15 +00:00
|
|
|
static guint n_type_nodes = 0;
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
static GHashTable *type_name_2_type_ht = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
static GtkTypeNode*
|
|
|
|
gtk_type_node_next_and_invalidate (void)
|
|
|
|
{
|
1998-07-14 07:40:15 +00:00
|
|
|
static guint n_free_type_nodes = 0;
|
|
|
|
register GtkTypeNode *node;
|
1998-05-06 01:43:56 +00:00
|
|
|
register GtkType new_type;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
/* don't keep *any* GtkTypeNode pointers across invokation of this function!!!
|
|
|
|
*/
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (n_free_type_nodes == 0)
|
|
|
|
{
|
|
|
|
register guint i;
|
|
|
|
register guint size;
|
|
|
|
|
|
|
|
/* nearest pow
|
|
|
|
*/
|
|
|
|
size = n_type_nodes + TYPE_NODES_BLOCK_SIZE;
|
|
|
|
size *= sizeof (GtkTypeNode);
|
|
|
|
i = 1;
|
|
|
|
while (i < size)
|
|
|
|
i <<= 1;
|
|
|
|
size = i;
|
|
|
|
|
|
|
|
type_nodes = g_realloc (type_nodes, size);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
n_free_type_nodes = size / sizeof (GtkTypeNode) - n_type_nodes;
|
|
|
|
|
|
|
|
memset (type_nodes + n_type_nodes, 0, n_free_type_nodes * sizeof (GtkTypeNode));
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
new_type = n_type_nodes++;
|
|
|
|
n_free_type_nodes--;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, new_type);
|
|
|
|
if (node)
|
|
|
|
node->type = new_type;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_type_init (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
if (n_type_nodes == 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkTypeNode *zero;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_assert (sizeof (GtkType) >= 4);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
zero = gtk_type_node_next_and_invalidate ();
|
|
|
|
g_assert (zero == NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
type_name_2_type_ht = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
|
|
|
|
(GCompareFunc) gtk_type_name_compare);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_type_init_builtin_types ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
void
|
|
|
|
gtk_type_set_chunk_alloc (GtkType type,
|
1998-07-14 07:40:15 +00:00
|
|
|
guint n_chunks)
|
1998-05-14 21:13:18 +00:00
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
g_return_if_fail (node->chunk_alloc_locked == FALSE);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
if (node->mem_chunk)
|
|
|
|
{
|
|
|
|
g_mem_chunk_destroy (node->mem_chunk);
|
|
|
|
node->mem_chunk = NULL;
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
if (n_chunks)
|
|
|
|
node->mem_chunk = g_mem_chunk_new (node->type_info.type_name,
|
|
|
|
node->type_info.object_size,
|
|
|
|
node->type_info.object_size * n_chunks,
|
|
|
|
G_ALLOC_AND_FREE);
|
|
|
|
}
|
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
static GtkType
|
|
|
|
gtk_type_create (GtkType parent_type,
|
|
|
|
gchar *type_name,
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkTypeInfo *type_info)
|
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkTypeNode *new_node;
|
|
|
|
GtkTypeNode *parent;
|
|
|
|
guint i;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
if (g_hash_table_lookup (type_name_2_type_ht, type_name))
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
1998-06-09 07:11:55 +00:00
|
|
|
g_warning ("gtk_type_create(): type `%s' already exists.", type_name);
|
1998-05-06 01:43:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1998-06-09 07:11:55 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (parent_type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *tmp_node;
|
1998-06-09 07:11:55 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (tmp_node, parent_type);
|
|
|
|
if (!tmp_node)
|
|
|
|
{
|
1998-06-09 07:11:55 +00:00
|
|
|
g_warning ("gtk_type_create(): unknown parent type `%u'.", parent_type);
|
1998-05-06 01:43:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
/* relookup pointers afterwards.
|
1998-05-06 01:43:56 +00:00
|
|
|
*/
|
|
|
|
new_node = gtk_type_node_next_and_invalidate ();
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (parent_type)
|
|
|
|
{
|
|
|
|
new_node->type = GTK_TYPE_MAKE (parent_type, new_node->type);
|
|
|
|
LOOKUP_TYPE_NODE (parent, parent_type);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
|
|
|
g_assert (new_node->type <= 0xff);
|
|
|
|
parent = NULL;
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
new_node->type_info = *type_info;
|
1998-06-09 07:11:55 +00:00
|
|
|
new_node->type_info.type_name = type_name;
|
1998-06-28 07:46:10 +00:00
|
|
|
/* new_node->type_info.reserved_1 = NULL; */
|
|
|
|
new_node->type_info.reserved_2 = NULL;
|
1998-05-06 01:43:56 +00:00
|
|
|
new_node->n_supers = parent ? parent->n_supers + 1 : 0;
|
1998-05-14 21:13:18 +00:00
|
|
|
new_node->chunk_alloc_locked = FALSE;
|
1998-05-06 01:43:56 +00:00
|
|
|
new_node->supers = g_new0 (GtkType, new_node->n_supers + 1);
|
|
|
|
new_node->parent_type = parent_type;
|
|
|
|
new_node->klass = NULL;
|
|
|
|
new_node->children_types = NULL;
|
1998-05-14 21:13:18 +00:00
|
|
|
new_node->mem_chunk = NULL;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (parent)
|
1998-05-13 04:59:38 +00:00
|
|
|
parent->children_types = g_list_append (parent->children_types, GUINT_TO_POINTER (new_node->type));
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
parent = new_node;
|
|
|
|
for (i = 0; i < new_node->n_supers + 1; i++)
|
|
|
|
{
|
|
|
|
new_node->supers[i] = parent->type;
|
|
|
|
LOOKUP_TYPE_NODE (parent, parent->parent_type);
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-13 04:59:38 +00:00
|
|
|
g_hash_table_insert (type_name_2_type_ht, new_node->type_info.type_name, GUINT_TO_POINTER (new_node->type));
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return new_node->type;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
GtkType
|
|
|
|
gtk_type_unique (GtkType parent_type,
|
|
|
|
GtkTypeInfo *type_info)
|
|
|
|
{
|
|
|
|
GtkType new_type;
|
|
|
|
gchar *type_name;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
g_return_val_if_fail (type_info != NULL, 0);
|
|
|
|
g_return_val_if_fail (type_info->type_name != NULL, 0);
|
|
|
|
|
|
|
|
if (n_type_nodes == 0)
|
|
|
|
gtk_type_init ();
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
type_name = g_strdup (type_info->type_name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
new_type = gtk_type_create (parent_type, type_name, type_info);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
if (!new_type)
|
|
|
|
g_free (type_name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
return new_type;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar*
|
|
|
|
gtk_type_name (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (node)
|
|
|
|
return node->type_info.type_name;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_type_from_name (const gchar *name)
|
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
if (type_name_2_type_ht)
|
|
|
|
{
|
|
|
|
GtkType type;
|
|
|
|
|
1998-05-13 04:59:38 +00:00
|
|
|
type = GPOINTER_TO_UINT (g_hash_table_lookup (type_name_2_type_ht, (gpointer) name));
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return type;
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkType
|
|
|
|
gtk_type_parent (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1997-11-24 22:37:52 +00:00
|
|
|
if (node)
|
1998-05-06 01:43:56 +00:00
|
|
|
return node->parent_type;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
gpointer
|
|
|
|
gtk_type_parent_class (GtkType type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
g_return_val_if_fail (node != NULL, NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (node)
|
|
|
|
{
|
|
|
|
LOOKUP_TYPE_NODE (node, node->parent_type);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (node)
|
|
|
|
{
|
|
|
|
if (!node->klass)
|
1998-08-11 19:29:36 +00:00
|
|
|
{
|
|
|
|
type = node->type;
|
|
|
|
gtk_type_class_init (type);
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return node->klass;
|
|
|
|
}
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
return NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gpointer
|
|
|
|
gtk_type_class (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (node != NULL, NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (!node->klass)
|
1998-08-11 19:29:36 +00:00
|
|
|
{
|
|
|
|
type = node->type;
|
|
|
|
gtk_type_class_init (type);
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return node->klass;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpointer
|
|
|
|
gtk_type_new (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkObject *object;
|
|
|
|
gpointer klass;
|
|
|
|
guint i;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (node != NULL, NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
klass = gtk_type_class (type);
|
1998-05-14 21:13:18 +00:00
|
|
|
node->chunk_alloc_locked = TRUE;
|
|
|
|
if (node->mem_chunk)
|
|
|
|
{
|
|
|
|
object = g_mem_chunk_alloc (node->mem_chunk);
|
|
|
|
memset (object, 0, node->type_info.object_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
object = g_malloc0 (node->type_info.object_size);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-07-12 04:13:02 +00:00
|
|
|
/* we need to call the base classes' object_init_func for derived
|
|
|
|
* objects with the object's ->klass field still pointing to the
|
|
|
|
* corresponding base class, otherwise overridden class functions
|
|
|
|
* could get called with partly-initialized objects.
|
|
|
|
*/
|
1998-05-06 01:43:56 +00:00
|
|
|
for (i = node->n_supers; i > 0; i--)
|
|
|
|
{
|
|
|
|
GtkTypeNode *pnode;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (pnode, node->supers[i]);
|
|
|
|
if (pnode->type_info.object_init_func)
|
1998-07-12 04:13:02 +00:00
|
|
|
{
|
|
|
|
object->klass = pnode->klass;
|
|
|
|
pnode->type_info.object_init_func (object);
|
|
|
|
}
|
1998-05-06 01:43:56 +00:00
|
|
|
}
|
1998-07-12 04:13:02 +00:00
|
|
|
object->klass = klass;
|
1998-05-06 01:43:56 +00:00
|
|
|
if (node->type_info.object_init_func)
|
1998-07-12 04:13:02 +00:00
|
|
|
node->type_info.object_init_func (object);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
void
|
1998-07-14 07:40:15 +00:00
|
|
|
gtk_type_free (GtkType type,
|
|
|
|
gpointer mem)
|
1998-05-14 21:13:18 +00:00
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
g_return_if_fail (mem != NULL);
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
g_return_if_fail (node != NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
if (node->mem_chunk)
|
|
|
|
g_mem_chunk_free (node->mem_chunk, mem);
|
|
|
|
else
|
|
|
|
g_free (mem);
|
|
|
|
}
|
|
|
|
|
1998-06-10 07:32:52 +00:00
|
|
|
GList*
|
|
|
|
gtk_type_children_types (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 07:32:52 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
if (node)
|
|
|
|
return node->children_types;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 07:32:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_type_describe_heritage (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-08-18 16:58:09 +00:00
|
|
|
gchar *is_a = "";
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (node)
|
|
|
|
{
|
|
|
|
if (node->type_info.type_name)
|
1998-08-18 16:58:09 +00:00
|
|
|
g_message ("%s%s",
|
|
|
|
is_a,
|
|
|
|
node->type_info.type_name);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-08-18 16:58:09 +00:00
|
|
|
g_message ("%s<unnamed type>",
|
|
|
|
is_a);
|
|
|
|
is_a = "is a ";
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, node->parent_type);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-07-14 07:40:15 +00:00
|
|
|
gtk_type_describe_tree (GtkType type,
|
1998-06-10 07:32:52 +00:00
|
|
|
gboolean show_size)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
|
|
|
|
if (node)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
static gint indent = 0;
|
|
|
|
GList *list;
|
|
|
|
guint old_indent;
|
|
|
|
guint i;
|
1998-08-18 16:58:09 +00:00
|
|
|
GString *gstring;
|
|
|
|
|
|
|
|
gstring = g_string_new ("");
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
for (i = 0; i < indent; i++)
|
1998-08-18 16:58:09 +00:00
|
|
|
g_string_append_c (gstring, ' ');
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
if (node->type_info.type_name)
|
1998-08-18 16:58:09 +00:00
|
|
|
g_string_append (gstring, node->type_info.type_name);
|
1998-05-06 01:43:56 +00:00
|
|
|
else
|
1998-08-18 16:58:09 +00:00
|
|
|
g_string_append (gstring, "<unnamed type>");
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
if (show_size)
|
1998-08-18 16:58:09 +00:00
|
|
|
g_string_sprintfa (gstring, " (%d bytes)", node->type_info.object_size);
|
|
|
|
|
|
|
|
g_message ("%s", gstring->str);
|
|
|
|
g_string_free (gstring, TRUE);
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
old_indent = indent;
|
|
|
|
indent += 4;
|
|
|
|
|
|
|
|
for (list = node->children_types; list; list = list->next)
|
1998-05-13 04:59:38 +00:00
|
|
|
gtk_type_describe_tree (GPOINTER_TO_UINT (list->data), show_size);
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
indent = old_indent;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
gtk_type_is_a (GtkType type,
|
|
|
|
GtkType is_a_type)
|
|
|
|
{
|
1998-05-08 23:20:48 +00:00
|
|
|
if (type == is_a_type)
|
|
|
|
return TRUE;
|
|
|
|
else
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-08 23:20:48 +00:00
|
|
|
register GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-08 23:20:48 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
if (node)
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
1998-05-08 23:20:48 +00:00
|
|
|
register GtkTypeNode *a_node;
|
|
|
|
|
|
|
|
LOOKUP_TYPE_NODE (a_node, is_a_type);
|
|
|
|
if (a_node)
|
|
|
|
{
|
|
|
|
if (a_node->n_supers <= node->n_supers)
|
|
|
|
return node->supers[node->n_supers - a_node->n_supers] == is_a_type;
|
|
|
|
}
|
1998-05-06 01:43:56 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-05-08 23:20:48 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-08-11 19:29:36 +00:00
|
|
|
gtk_type_class_init (GtkType type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-08-11 19:29:36 +00:00
|
|
|
GtkTypeNode *node;
|
|
|
|
|
|
|
|
/* we need to relookup nodes everytime we called an external function */
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (!node->klass && node->type_info.class_size)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-28 07:46:10 +00:00
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkTypeNode *base_node;
|
|
|
|
GSList *slist;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
g_assert (node->type_info.class_size >= sizeof (GtkObjectClass));
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
node->klass = g_malloc0 (node->type_info.class_size);
|
1998-06-14 14:37:39 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (node->parent_type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-05-06 01:43:56 +00:00
|
|
|
GtkTypeNode *parent;
|
1998-06-14 14:37:39 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (parent, node->parent_type);
|
|
|
|
if (!parent->klass)
|
1998-08-11 19:29:36 +00:00
|
|
|
{
|
|
|
|
gtk_type_class_init (parent->type);
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
LOOKUP_TYPE_NODE (parent, node->parent_type);
|
|
|
|
}
|
1998-06-14 14:37:39 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (parent->klass)
|
|
|
|
memcpy (node->klass, parent->klass, parent->type_info.class_size);
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
object_class = node->klass;
|
|
|
|
object_class->type = node->type;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
/* stack all base class initialization functions, so we
|
|
|
|
* call them in ascending order.
|
|
|
|
*/
|
|
|
|
base_node = node;
|
|
|
|
slist = NULL;
|
|
|
|
while (base_node)
|
|
|
|
{
|
|
|
|
if (base_node->type_info.base_class_init_func)
|
|
|
|
slist = g_slist_prepend (slist, base_node->type_info.base_class_init_func);
|
|
|
|
LOOKUP_TYPE_NODE (base_node, base_node->parent_type);
|
|
|
|
}
|
|
|
|
if (slist)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
for (walk = slist; walk; walk = walk->next)
|
|
|
|
{
|
|
|
|
register GtkClassInitFunc base_class_init;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-28 07:46:10 +00:00
|
|
|
base_class_init = walk->data;
|
|
|
|
base_class_init (node->klass);
|
1998-08-11 19:29:36 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1998-06-28 07:46:10 +00:00
|
|
|
}
|
|
|
|
g_slist_free (slist);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (node->type_info.class_init_func)
|
1998-06-28 07:46:10 +00:00
|
|
|
node->type_info.class_init_func (node->klass);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
GtkEnumValue*
|
|
|
|
gtk_type_enum_get_values (GtkType enum_type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-10 04:55:22 +00:00
|
|
|
if (GTK_FUNDAMENTAL_TYPE (enum_type) == GTK_TYPE_ENUM ||
|
|
|
|
GTK_FUNDAMENTAL_TYPE (enum_type) == GTK_TYPE_FLAGS)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, enum_type);
|
|
|
|
if (node)
|
1998-06-28 07:46:10 +00:00
|
|
|
return (GtkEnumValue*) node->type_info.reserved_1;
|
1998-06-10 04:55:22 +00:00
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-07-27 01:50:16 +00:00
|
|
|
g_warning ("gtk_type_enum_get_values(): type `%s' is not derived from `GtkEnum' or `GtkFlags'",
|
1998-06-10 04:55:22 +00:00
|
|
|
gtk_type_name (enum_type));
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
return NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
GtkFlagValue*
|
1998-07-14 07:40:15 +00:00
|
|
|
gtk_type_flags_get_values (GtkType flags_type)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-10 04:55:22 +00:00
|
|
|
return gtk_type_enum_get_values (flags_type);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-07-27 01:50:16 +00:00
|
|
|
GtkEnumValue*
|
|
|
|
gtk_type_enum_find_value (GtkType enum_type,
|
|
|
|
const gchar *value_name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (value_name != NULL, NULL);
|
|
|
|
|
|
|
|
if (GTK_FUNDAMENTAL_TYPE (enum_type) == GTK_TYPE_ENUM ||
|
|
|
|
GTK_FUNDAMENTAL_TYPE (enum_type) == GTK_TYPE_FLAGS)
|
|
|
|
{
|
|
|
|
GtkEnumValue *vals;
|
|
|
|
|
|
|
|
vals = gtk_type_enum_get_values (enum_type);
|
|
|
|
while (vals)
|
|
|
|
{
|
|
|
|
if (strcmp (vals->value_name, value_name) == 0 ||
|
|
|
|
strcmp (vals->value_nick, value_name) == 0)
|
|
|
|
return vals;
|
|
|
|
vals++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_warning ("gtk_type_enum_find_value(): type `%s' is not derived from `GtkEnum' or `GtkFlags'",
|
|
|
|
gtk_type_name (enum_type));
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkFlagValue*
|
|
|
|
gtk_type_flags_find_value (GtkType flag_type,
|
|
|
|
const gchar *value_name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (value_name != NULL, NULL);
|
|
|
|
|
|
|
|
return gtk_type_enum_find_value (flag_type, value_name);
|
|
|
|
}
|
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
static inline GtkType
|
1998-07-14 07:40:15 +00:00
|
|
|
gtk_type_register_intern (gchar *name,
|
|
|
|
GtkType parent,
|
1998-06-10 04:55:22 +00:00
|
|
|
GtkEnumValue *values)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-10 04:55:22 +00:00
|
|
|
GtkType type_id;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkTypeInfo info;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
info.type_name = name;
|
1998-06-10 04:55:22 +00:00
|
|
|
info.object_size = 0;
|
|
|
|
info.class_size = 0;
|
1998-06-28 07:46:10 +00:00
|
|
|
info.class_init_func = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
info.object_init_func = NULL;
|
1998-06-28 07:46:10 +00:00
|
|
|
info.reserved_1 = values;
|
|
|
|
info.reserved_2 = NULL;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
type_id = gtk_type_create (parent, name, &info);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
if (type_id && values)
|
|
|
|
{
|
|
|
|
guint i;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* check for proper type consistency and NULL termination
|
|
|
|
* of value array
|
|
|
|
*/
|
|
|
|
g_assert (GTK_FUNDAMENTAL_TYPE (type_id) == GTK_TYPE_ENUM ||
|
|
|
|
GTK_FUNDAMENTAL_TYPE (type_id) == GTK_TYPE_FLAGS);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
i = 0;
|
|
|
|
while (values[i].value_name)
|
|
|
|
i++;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
g_assert (values[i].value_name == NULL && values[i].value_nick == NULL);
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
return type_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_type_register_enum (const gchar *type_name,
|
|
|
|
GtkEnumValue *values)
|
|
|
|
{
|
|
|
|
GtkType type_id;
|
|
|
|
gchar *name;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
g_return_val_if_fail (type_name != NULL, 0);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
name = g_strdup (type_name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
type_id = gtk_type_register_intern (name, GTK_TYPE_ENUM, values);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
if (!type_id)
|
|
|
|
g_free (name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
return type_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkType
|
1998-07-14 07:40:15 +00:00
|
|
|
gtk_type_register_flags (const gchar *type_name,
|
|
|
|
GtkFlagValue *values)
|
1998-06-10 04:55:22 +00:00
|
|
|
{
|
|
|
|
GtkType type_id;
|
|
|
|
gchar *name;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
g_return_val_if_fail (type_name != NULL, 0);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
name = g_strdup (type_name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
type_id = gtk_type_register_intern (name, GTK_TYPE_FLAGS, values);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
if (!type_id)
|
|
|
|
g_free (name);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
return type_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gtk_type_name_hash (const char *key)
|
|
|
|
{
|
|
|
|
guint result;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
result = 0;
|
|
|
|
while (*key)
|
|
|
|
result += (result << 3) + *key++;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_type_name_compare (const char *a,
|
|
|
|
const char *b)
|
|
|
|
{
|
|
|
|
return (strcmp (a, b) == 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-01-03 05:46:58 +00:00
|
|
|
extern void gtk_object_init_type (void);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
#include "makeenums.h" /* include for various places
|
|
|
|
* with enum definitions
|
|
|
|
*/
|
|
|
|
#include "gtktypebuiltins_vars.c" /* type variable declarations
|
|
|
|
*/
|
|
|
|
#include "gtktypebuiltins_evals.c" /* enum value definition arrays
|
|
|
|
*/
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_type_init_builtin_types (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
/* GTK_TYPE_INVALID has typeid 0. The first type id returned by
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
* gtk_type_unique is 1, which is GTK_TYPE_NONE. And so on.
|
|
|
|
*/
|
1998-07-14 07:40:15 +00:00
|
|
|
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
struct {
|
|
|
|
GtkType type_id;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar *name;
|
|
|
|
} fundamental_info[] = {
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
{ GTK_TYPE_NONE, "void" },
|
deleted most of the argument handling code, since that is now implemented
Fri Jul 10 00:02:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: deleted most of the argument handling code, since
that is now implemented in gtkarg.c. similar to gtk_object_args_collect,
we now export a new function gtk_container_child_args_collect().
for consistency with the object arguments, a few functions got renamed:
gtk_container_child_arg_get -> gtk_container_child_get,
gtk_container_child_arg_set -> gtk_container_child_set,
gtk_container_child_arg_getv -> gtk_container_child_getv,
gtk_container_child_arg_setv -> gtk_container_child_setv,
gtk_container_add_with_argv -> gtk_container_addv.
note, gtk_container_add_with_args() remained, because its equivalent
would be gtk_container_add(,, ...) which would break all existing code.
(gtk_container_add_child_arg_type): similar to gtk_object_add_arg_type,
we expect the `arg_name' argument to be a const static string now.
(gtk_container_get_child_arg_type): function removed.
Thu Jul 9 07:03:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c: new file which holds gtk_arg_collect_value().
this is a static inline function that collects command line arguments
from a va_list. this file can just be included in all places that
need this functionality.
* gtk/gtkarg.h:
* gtk/gtkarg.c: new files which implement most of the argument
handling stuff from gtkobject.c. also collected a few more
gtk_arg_* utility functions from else places.
* gtk/gtkobject.h:
* gtk/gtkobject.c: moved most of the argument handling code into
gtkarg.c. we now export gtk_object_args_collect() as a non-public
method with a blind va_list pointer.
(gtk_object_add_arg_type): the `arg_name' argument is required to be a
const static string now.
(gtk_object_get_arg_type): function got removed.
* gtk/gtkwidget.c:
(gtk_widget_set):
(gtk_widget_new): adaptions for gtk_object_args_collect().
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): changed the internal
fundamental type name so as to have a valid prefix, e.g. "bool"->
"gboolean", "string"->"GtkString" and somesuch, left "void" as is,
though that should probably be something like GtkNone since the
type itself is called GTK_TYPE_NONE.
even the internal type names need to avoid name clashes and must live
in their own namespace, several code portions rely on that.
we should relly have typedefs such as typedef gchar* GtkString; so the
fundamental type names can be used for code dumpers just like with all
the Gtk/Gdk types.
1998-07-09 23:00:34 +00:00
|
|
|
{ GTK_TYPE_CHAR, "gchar" },
|
1998-07-14 07:40:15 +00:00
|
|
|
{ GTK_TYPE_UCHAR, "guchar" },
|
deleted most of the argument handling code, since that is now implemented
Fri Jul 10 00:02:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: deleted most of the argument handling code, since
that is now implemented in gtkarg.c. similar to gtk_object_args_collect,
we now export a new function gtk_container_child_args_collect().
for consistency with the object arguments, a few functions got renamed:
gtk_container_child_arg_get -> gtk_container_child_get,
gtk_container_child_arg_set -> gtk_container_child_set,
gtk_container_child_arg_getv -> gtk_container_child_getv,
gtk_container_child_arg_setv -> gtk_container_child_setv,
gtk_container_add_with_argv -> gtk_container_addv.
note, gtk_container_add_with_args() remained, because its equivalent
would be gtk_container_add(,, ...) which would break all existing code.
(gtk_container_add_child_arg_type): similar to gtk_object_add_arg_type,
we expect the `arg_name' argument to be a const static string now.
(gtk_container_get_child_arg_type): function removed.
Thu Jul 9 07:03:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c: new file which holds gtk_arg_collect_value().
this is a static inline function that collects command line arguments
from a va_list. this file can just be included in all places that
need this functionality.
* gtk/gtkarg.h:
* gtk/gtkarg.c: new files which implement most of the argument
handling stuff from gtkobject.c. also collected a few more
gtk_arg_* utility functions from else places.
* gtk/gtkobject.h:
* gtk/gtkobject.c: moved most of the argument handling code into
gtkarg.c. we now export gtk_object_args_collect() as a non-public
method with a blind va_list pointer.
(gtk_object_add_arg_type): the `arg_name' argument is required to be a
const static string now.
(gtk_object_get_arg_type): function got removed.
* gtk/gtkwidget.c:
(gtk_widget_set):
(gtk_widget_new): adaptions for gtk_object_args_collect().
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): changed the internal
fundamental type name so as to have a valid prefix, e.g. "bool"->
"gboolean", "string"->"GtkString" and somesuch, left "void" as is,
though that should probably be something like GtkNone since the
type itself is called GTK_TYPE_NONE.
even the internal type names need to avoid name clashes and must live
in their own namespace, several code portions rely on that.
we should relly have typedefs such as typedef gchar* GtkString; so the
fundamental type names can be used for code dumpers just like with all
the Gtk/Gdk types.
1998-07-09 23:00:34 +00:00
|
|
|
{ GTK_TYPE_BOOL, "gboolean" },
|
|
|
|
{ GTK_TYPE_INT, "gint" },
|
|
|
|
{ GTK_TYPE_UINT, "guint" },
|
|
|
|
{ GTK_TYPE_LONG, "glong" },
|
|
|
|
{ GTK_TYPE_ULONG, "gulong" },
|
|
|
|
{ GTK_TYPE_FLOAT, "gfloat" },
|
|
|
|
{ GTK_TYPE_DOUBLE, "gdouble" },
|
|
|
|
{ GTK_TYPE_STRING, "GtkString" },
|
|
|
|
{ GTK_TYPE_ENUM, "GtkEnum" },
|
|
|
|
{ GTK_TYPE_FLAGS, "GtkFlags" },
|
|
|
|
{ GTK_TYPE_BOXED, "GtkBoxed" },
|
|
|
|
{ GTK_TYPE_POINTER, "gpointer" },
|
1998-07-14 07:40:15 +00:00
|
|
|
|
deleted most of the argument handling code, since that is now implemented
Fri Jul 10 00:02:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: deleted most of the argument handling code, since
that is now implemented in gtkarg.c. similar to gtk_object_args_collect,
we now export a new function gtk_container_child_args_collect().
for consistency with the object arguments, a few functions got renamed:
gtk_container_child_arg_get -> gtk_container_child_get,
gtk_container_child_arg_set -> gtk_container_child_set,
gtk_container_child_arg_getv -> gtk_container_child_getv,
gtk_container_child_arg_setv -> gtk_container_child_setv,
gtk_container_add_with_argv -> gtk_container_addv.
note, gtk_container_add_with_args() remained, because its equivalent
would be gtk_container_add(,, ...) which would break all existing code.
(gtk_container_add_child_arg_type): similar to gtk_object_add_arg_type,
we expect the `arg_name' argument to be a const static string now.
(gtk_container_get_child_arg_type): function removed.
Thu Jul 9 07:03:04 1998 Tim Janik <timj@gtk.org>
* gtk/gtkargcollector.c: new file which holds gtk_arg_collect_value().
this is a static inline function that collects command line arguments
from a va_list. this file can just be included in all places that
need this functionality.
* gtk/gtkarg.h:
* gtk/gtkarg.c: new files which implement most of the argument
handling stuff from gtkobject.c. also collected a few more
gtk_arg_* utility functions from else places.
* gtk/gtkobject.h:
* gtk/gtkobject.c: moved most of the argument handling code into
gtkarg.c. we now export gtk_object_args_collect() as a non-public
method with a blind va_list pointer.
(gtk_object_add_arg_type): the `arg_name' argument is required to be a
const static string now.
(gtk_object_get_arg_type): function got removed.
* gtk/gtkwidget.c:
(gtk_widget_set):
(gtk_widget_new): adaptions for gtk_object_args_collect().
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): changed the internal
fundamental type name so as to have a valid prefix, e.g. "bool"->
"gboolean", "string"->"GtkString" and somesuch, left "void" as is,
though that should probably be something like GtkNone since the
type itself is called GTK_TYPE_NONE.
even the internal type names need to avoid name clashes and must live
in their own namespace, several code portions rely on that.
we should relly have typedefs such as typedef gchar* GtkString; so the
fundamental type names can be used for code dumpers just like with all
the Gtk/Gdk types.
1998-07-09 23:00:34 +00:00
|
|
|
{ GTK_TYPE_SIGNAL, "GtkSignal" },
|
1998-07-14 07:40:15 +00:00
|
|
|
{ GTK_TYPE_ARGS, "GtkArgs" },
|
|
|
|
{ GTK_TYPE_CALLBACK, "GtkCallback" },
|
|
|
|
{ GTK_TYPE_C_CALLBACK, "GtkCCallback" },
|
|
|
|
{ GTK_TYPE_FOREIGN, "GtkForeign" },
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
struct {
|
1998-06-09 07:11:55 +00:00
|
|
|
gchar *type_name;
|
|
|
|
GtkType *type_id;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkType parent;
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
GtkEnumValue *values;
|
1998-06-09 07:11:55 +00:00
|
|
|
} builtin_info[GTK_TYPE_NUM_BUILTINS + 1] = {
|
|
|
|
#include "gtktypebuiltins_ids.c" /* type entries */
|
1997-11-24 22:37:52 +00:00
|
|
|
{ NULL }
|
|
|
|
};
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
guint i;
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof (fundamental_info) / sizeof (fundamental_info[0]); i++)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-09 07:11:55 +00:00
|
|
|
GtkType type_id;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
type_id = gtk_type_register_intern (fundamental_info[i].name, GTK_TYPE_INVALID, NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
g_assert (type_id == fundamental_info[i].type_id);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-05-06 01:43:56 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_init_type ();
|
1998-05-06 01:43:56 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
for (i = 0; i < GTK_TYPE_NUM_BUILTINS; i++)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-09 07:11:55 +00:00
|
|
|
GtkType type_id;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
g_assert (builtin_info[i].type_name != NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
/* relookup pointers afterwards.
|
|
|
|
*/
|
|
|
|
type_id = gtk_type_register_intern (builtin_info[i].type_name,
|
|
|
|
builtin_info[i].parent,
|
|
|
|
builtin_info[i].values);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
g_assert (type_id != GTK_TYPE_INVALID);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
(*builtin_info[i].type_id) = type_id;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-07-10 02:33:06 +00:00
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_identifier_get_type (void)
|
|
|
|
{
|
|
|
|
static GtkType identifier_type = 0;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-07-10 02:33:06 +00:00
|
|
|
if (!identifier_type)
|
|
|
|
identifier_type = gtk_type_register_intern ("GtkIdentifier", GTK_TYPE_STRING, NULL);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-07-10 02:33:06 +00:00
|
|
|
return identifier_type;
|
|
|
|
}
|