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
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "gtktypeutils.h"
|
|
|
|
|
|
|
|
|
1998-11-29 06:29:40 +00:00
|
|
|
#define TYPE_NODES_BLOCK_SIZE (35) /* needs to be > GTK_TYPE_FUNDAMENTAL_MAX */
|
1998-05-06 01:43:56 +00:00
|
|
|
|
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) { \
|
1998-11-29 06:29:40 +00:00
|
|
|
GtkTypeNode *__node = NULL; \
|
|
|
|
GtkType sqn = GTK_TYPE_SEQNO (type); \
|
|
|
|
if (sqn > 0) \
|
|
|
|
{ \
|
|
|
|
sqn--; \
|
|
|
|
if (sqn < GTK_TYPE_FUNDAMENTAL_MAX) \
|
|
|
|
{ \
|
|
|
|
if (sqn < n_ftype_nodes) \
|
|
|
|
__node = type_nodes + sqn; \
|
|
|
|
} \
|
|
|
|
else if (sqn < n_type_nodes) \
|
|
|
|
__node = type_nodes + sqn; \
|
|
|
|
} \
|
|
|
|
node_var = __node; \
|
1998-05-06 01:43:56 +00:00
|
|
|
}
|
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;
|
1998-11-29 06:29:40 +00:00
|
|
|
static guint n_ftype_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*
|
1998-11-29 06:29:40 +00:00
|
|
|
gtk_type_node_next_and_invalidate (GtkType parent_type)
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
1998-11-29 06:29:40 +00:00
|
|
|
static guint n_free_type_nodes = 0;
|
|
|
|
GtkTypeNode *node;
|
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)
|
|
|
|
{
|
1998-11-29 06:29:40 +00:00
|
|
|
guint i;
|
|
|
|
guint size;
|
1998-05-06 01:43:56 +00:00
|
|
|
|
|
|
|
/* 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-11-29 06:29:40 +00:00
|
|
|
if (!n_type_nodes)
|
|
|
|
{
|
|
|
|
n_type_nodes = GTK_TYPE_FUNDAMENTAL_MAX;
|
|
|
|
n_free_type_nodes -= GTK_TYPE_FUNDAMENTAL_MAX;
|
|
|
|
}
|
1998-05-06 01:43:56 +00:00
|
|
|
}
|
1998-11-18 00:57:16 +00:00
|
|
|
|
1998-11-29 06:29:40 +00:00
|
|
|
if (!parent_type)
|
|
|
|
{
|
|
|
|
g_assert (n_ftype_nodes < GTK_TYPE_FUNDAMENTAL_MAX); /* paranoid */
|
1998-11-18 00:57:16 +00:00
|
|
|
|
1998-11-29 06:29:40 +00:00
|
|
|
node = type_nodes + n_ftype_nodes;
|
|
|
|
n_ftype_nodes++;
|
|
|
|
node->type = n_ftype_nodes;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
node = type_nodes + n_type_nodes;
|
|
|
|
n_type_nodes++;
|
|
|
|
n_free_type_nodes--;
|
|
|
|
node->type = GTK_TYPE_MAKE (parent_type, n_type_nodes);
|
|
|
|
}
|
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
|
|
|
{
|
|
|
|
g_assert (sizeof (GtkType) >= 4);
|
1998-11-29 06:29:40 +00:00
|
|
|
g_assert (TYPE_NODES_BLOCK_SIZE > GTK_TYPE_FUNDAMENTAL_MAX);
|
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,
|
1998-11-30 19:07:15 +00:00
|
|
|
const GtkTypeInfo *type_info)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
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
|
|
|
*/
|
1998-11-29 06:29:40 +00:00
|
|
|
new_node = gtk_type_node_next_and_invalidate (parent_type);
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
if (parent_type)
|
|
|
|
{
|
1998-11-29 06:29:40 +00:00
|
|
|
g_assert (GTK_TYPE_SEQNO (new_node->type) > GTK_TYPE_FUNDAMENTAL_MAX);
|
1998-05-06 01:43:56 +00:00
|
|
|
LOOKUP_TYPE_NODE (parent, parent_type);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
1998-11-29 06:29:40 +00:00
|
|
|
g_assert (new_node->type <= GTK_TYPE_FUNDAMENTAL_MAX);
|
1998-05-06 01:43:56 +00:00
|
|
|
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,
|
1998-11-30 19:07:15 +00:00
|
|
|
const GtkTypeInfo *type_info)
|
1998-06-09 07:11:55 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
1998-11-29 06:29:40 +00:00
|
|
|
if (!parent_type && n_ftype_nodes >= GTK_TYPE_FUNDAMENTAL_MAX)
|
|
|
|
{
|
|
|
|
g_warning ("gtk_type_unique(): maximum amount of fundamental types reached, "
|
|
|
|
"try increasing GTK_TYPE_FUNDAMENTAL_MAX");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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);
|
1999-01-11 07:09:07 +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-09-05 06:54:20 +00:00
|
|
|
GtkTypeObject *tobject;
|
1998-05-06 01:43:56 +00:00
|
|
|
gpointer klass;
|
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-11-16 06:05:37 +00:00
|
|
|
klass = node->klass;
|
|
|
|
if (!klass)
|
|
|
|
{
|
|
|
|
klass = gtk_type_class (type);
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
}
|
1998-05-14 21:13:18 +00:00
|
|
|
node->chunk_alloc_locked = TRUE;
|
1998-09-05 06:54:20 +00:00
|
|
|
|
1998-05-14 21:13:18 +00:00
|
|
|
if (node->mem_chunk)
|
1998-11-16 06:05:37 +00:00
|
|
|
tobject = g_mem_chunk_alloc0 (node->mem_chunk);
|
1998-05-14 21:13:18 +00:00
|
|
|
else
|
1998-09-05 06:54:20 +00:00
|
|
|
tobject = 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
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
* could get called with partly-initialized objects. the real object
|
|
|
|
* class is passed as second argment to the initializers.
|
1998-07-12 04:13:02 +00:00
|
|
|
*/
|
1998-11-16 06:05:37 +00:00
|
|
|
if (node->n_supers)
|
1998-05-06 01:43:56 +00:00
|
|
|
{
|
1998-11-16 06:05:37 +00:00
|
|
|
guint i;
|
|
|
|
GtkType *supers;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
GtkTypeNode *pnode;
|
1998-11-16 06:05:37 +00:00
|
|
|
|
|
|
|
supers = node->supers;
|
|
|
|
for (i = node->n_supers; i > 0; i--)
|
1998-07-12 04:13:02 +00:00
|
|
|
{
|
1998-11-16 06:05:37 +00:00
|
|
|
LOOKUP_TYPE_NODE (pnode, supers[i]);
|
|
|
|
if (pnode->type_info.object_init_func)
|
|
|
|
{
|
|
|
|
tobject->klass = pnode->klass;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
pnode->type_info.object_init_func (tobject, klass);
|
1998-11-16 06:05:37 +00:00
|
|
|
}
|
1998-07-12 04:13:02 +00:00
|
|
|
}
|
1998-11-16 06:05:37 +00:00
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
1998-05-06 01:43:56 +00:00
|
|
|
}
|
1998-09-05 06:54:20 +00:00
|
|
|
tobject->klass = klass;
|
1998-05-06 01:43:56 +00:00
|
|
|
if (node->type_info.object_init_func)
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
{
|
|
|
|
node->type_info.object_init_func (tobject, klass);
|
|
|
|
tobject->klass = klass;
|
|
|
|
}
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-09-05 06:54:20 +00:00
|
|
|
return tobject;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-08 05:58:41 +00:00
|
|
|
gboolean
|
1997-11-24 22:37:52 +00:00
|
|
|
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-11-29 06:29:40 +00:00
|
|
|
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-11-29 06:29:40 +00:00
|
|
|
GtkTypeNode *a_node;
|
1998-05-08 23:20:48 +00:00
|
|
|
|
|
|
|
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-09-05 06:54:20 +00:00
|
|
|
GtkTypeClass *type_class;
|
1998-06-28 07:46:10 +00:00
|
|
|
GtkTypeNode *base_node;
|
|
|
|
GSList *slist;
|
1998-07-14 07:40:15 +00:00
|
|
|
|
1998-09-05 06:54:20 +00:00
|
|
|
if (node->type_info.class_size < sizeof (GtkTypeClass))
|
|
|
|
g_warning ("The `%s' class is too small to inherit from GtkTypeClass",
|
|
|
|
node->type_info.type_name);
|
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);
|
1998-09-05 06:54:20 +00:00
|
|
|
|
|
|
|
if (node->type_info.class_size < parent->type_info.class_size)
|
|
|
|
g_warning ("The `%s' class is smaller than its parent class `%s'",
|
|
|
|
node->type_info.type_name,
|
1998-10-08 19:43:47 +00:00
|
|
|
parent->type_info.type_name);
|
1998-09-05 06:54:20 +00:00
|
|
|
|
1998-05-06 01:43:56 +00:00
|
|
|
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-09-05 06:54:20 +00:00
|
|
|
type_class = node->klass;
|
|
|
|
type_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)
|
|
|
|
{
|
1998-11-29 06:29:40 +00:00
|
|
|
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-09-05 06:54:20 +00:00
|
|
|
static inline gchar*
|
|
|
|
gtk_type_descriptive_name (GtkType type)
|
|
|
|
{
|
|
|
|
gchar *name;
|
|
|
|
|
|
|
|
name = gtk_type_name (type);
|
|
|
|
if (!name)
|
|
|
|
name = "(unknown)";
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkTypeObject*
|
|
|
|
gtk_type_check_object_cast (GtkTypeObject *type_object,
|
|
|
|
GtkType cast_type)
|
|
|
|
{
|
|
|
|
if (!type_object)
|
|
|
|
{
|
|
|
|
g_warning ("invalid cast from (NULL) pointer to `%s'",
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return type_object;
|
|
|
|
}
|
|
|
|
if (!type_object->klass)
|
|
|
|
{
|
|
|
|
g_warning ("invalid unclassed pointer in cast to `%s'",
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return type_object;
|
|
|
|
}
|
|
|
|
/* currently, GTK_TYPE_OBJECT is the lowest fundamental type
|
|
|
|
* dominator for types that introduce classes.
|
|
|
|
*/
|
|
|
|
if (type_object->klass->type < GTK_TYPE_OBJECT)
|
|
|
|
{
|
|
|
|
g_warning ("invalid class type `%s' in cast to `%s'",
|
|
|
|
gtk_type_descriptive_name (type_object->klass->type),
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return type_object;
|
|
|
|
}
|
|
|
|
if (!gtk_type_is_a (type_object->klass->type, cast_type))
|
|
|
|
{
|
|
|
|
g_warning ("invalid cast from `%s' to `%s'",
|
|
|
|
gtk_type_descriptive_name (type_object->klass->type),
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return type_object;
|
|
|
|
}
|
|
|
|
|
|
|
|
return type_object;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkTypeClass*
|
|
|
|
gtk_type_check_class_cast (GtkTypeClass *klass,
|
|
|
|
GtkType cast_type)
|
|
|
|
{
|
|
|
|
if (!klass)
|
|
|
|
{
|
|
|
|
g_warning ("invalid class cast from (NULL) pointer to `%s'",
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
/* currently, GTK_TYPE_OBJECT is the lowest fundamental type
|
|
|
|
* dominator for types that introduce classes.
|
|
|
|
*/
|
|
|
|
if (klass->type < GTK_TYPE_OBJECT)
|
|
|
|
{
|
|
|
|
g_warning ("invalid class type `%s' in class cast to `%s'",
|
|
|
|
gtk_type_descriptive_name (klass->type),
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
if (!gtk_type_is_a (klass->type, cast_type))
|
|
|
|
{
|
|
|
|
g_warning ("invalid class cast from `%s' to `%s'",
|
|
|
|
gtk_type_descriptive_name (klass->type),
|
|
|
|
gtk_type_descriptive_name (cast_type));
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
|
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);
|
1998-10-02 21:14:26 +00:00
|
|
|
if (vals)
|
|
|
|
while (vals->value_name)
|
|
|
|
{
|
|
|
|
if (strcmp (vals->value_name, value_name) == 0 ||
|
|
|
|
strcmp (vals->value_nick, value_name) == 0)
|
|
|
|
return vals;
|
|
|
|
vals++;
|
|
|
|
}
|
1998-07-27 01:50:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
g_warning ("gtk_type_enum_find_value(): type `%s' is not derived from `GtkEnum' or `GtkFlags'",
|
|
|
|
gtk_type_name (enum_type));
|
1998-10-02 21:14:26 +00:00
|
|
|
|
1998-07-27 01:50:16 +00:00
|
|
|
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-10-03 17:04:41 +00:00
|
|
|
typedef struct _GtkTypeVarargType GtkTypeVarargType;
|
|
|
|
struct _GtkTypeVarargType
|
|
|
|
{
|
|
|
|
GtkType foreign_type;
|
|
|
|
GtkType varargs_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
static GtkTypeVarargType *vararg_types = NULL;
|
|
|
|
static guint n_vararg_types = 0;
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_type_set_varargs_type (GtkType foreign_type,
|
|
|
|
GtkType varargs_type)
|
|
|
|
{
|
|
|
|
g_return_if_fail (foreign_type == GTK_FUNDAMENTAL_TYPE (foreign_type));
|
|
|
|
g_return_if_fail (foreign_type > GTK_TYPE_FUNDAMENTAL_LAST);
|
|
|
|
|
|
|
|
if (!((varargs_type >= GTK_TYPE_STRUCTURED_FIRST &&
|
|
|
|
varargs_type <= GTK_TYPE_STRUCTURED_LAST) ||
|
|
|
|
(varargs_type >= GTK_TYPE_FLAT_FIRST &&
|
|
|
|
varargs_type <= GTK_TYPE_FLAT_LAST) ||
|
|
|
|
varargs_type == GTK_TYPE_NONE))
|
|
|
|
{
|
|
|
|
g_warning ("invalid varargs type `%s' for fundamental type `%s'",
|
|
|
|
gtk_type_name (varargs_type),
|
|
|
|
gtk_type_name (foreign_type));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (gtk_type_get_varargs_type (foreign_type))
|
|
|
|
{
|
|
|
|
g_warning ("varargs type is already registered for fundamental type `%s'",
|
|
|
|
gtk_type_name (foreign_type));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
n_vararg_types++;
|
|
|
|
vararg_types = g_realloc (vararg_types, sizeof (GtkTypeVarargType) * n_vararg_types);
|
|
|
|
|
|
|
|
vararg_types[n_vararg_types - 1].foreign_type = foreign_type;
|
|
|
|
vararg_types[n_vararg_types - 1].varargs_type = varargs_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkType
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_type_get_varargs_type (GtkType foreign_type)
|
1998-10-03 17:04:41 +00:00
|
|
|
{
|
|
|
|
GtkType type;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
type = GTK_FUNDAMENTAL_TYPE (foreign_type);
|
|
|
|
if (type <= GTK_TYPE_FUNDAMENTAL_LAST)
|
|
|
|
return type;
|
|
|
|
|
|
|
|
for (i = 0; i < n_vararg_types; i++)
|
|
|
|
if (vararg_types[i].foreign_type == type)
|
|
|
|
return vararg_types[i].varargs_type;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
static inline GtkType
|
1998-12-08 23:57:25 +00:00
|
|
|
gtk_type_register_intern (gchar *name,
|
|
|
|
GtkType parent,
|
|
|
|
const 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-12-08 23:57:25 +00:00
|
|
|
info.reserved_1 = (gpointer) values;
|
1998-06-28 07:46:10 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1998-12-08 23:57:25 +00:00
|
|
|
GtkTypeQuery*
|
|
|
|
gtk_type_query (GtkType type)
|
|
|
|
{
|
|
|
|
GtkTypeNode *node;
|
|
|
|
|
|
|
|
LOOKUP_TYPE_NODE (node, type);
|
|
|
|
if (node)
|
|
|
|
{
|
|
|
|
GtkTypeQuery *query;
|
|
|
|
|
|
|
|
query = g_new0 (GtkTypeQuery, 1);
|
|
|
|
query->type = type;
|
|
|
|
query->type_name = node->type_info.type_name;
|
|
|
|
query->object_size = node->type_info.object_size;
|
|
|
|
query->class_size = node->type_info.class_size;
|
1998-12-20 01:24:40 +00:00
|
|
|
|
|
|
|
return query;
|
1998-12-08 23:57:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-06-10 04:55:22 +00:00
|
|
|
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
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const struct {
|
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
|
|
|
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
|
|
|
};
|
1998-11-30 19:07:15 +00:00
|
|
|
static 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;
|
1998-12-08 23:57:25 +00:00
|
|
|
const 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.
|
|
|
|
*/
|
1998-11-29 06:29:40 +00:00
|
|
|
type_id = gtk_type_register_intern (fundamental_info[i].name, 0, 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-11-29 06:29:40 +00:00
|
|
|
g_assert (GTK_TYPE_SEQNO (type_id) > GTK_TYPE_FUNDAMENTAL_MAX);
|
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;
|
|
|
|
}
|