Commit 98e22a43 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

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.
parent 12f78259
...@@ -92,7 +92,7 @@ gtk_alignment_class_init (GtkAlignmentClass *class) ...@@ -92,7 +92,7 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
static void static void
gtk_alignment_init (GtkAlignment *alignment) gtk_alignment_init (GtkAlignment *alignment)
{ {
GTK_WIDGET_SET_FLAGS (alignment, GTK_NO_WINDOW | GTK_BASIC); GTK_WIDGET_SET_FLAGS (alignment, GTK_NO_WINDOW);
alignment->xalign = 0.5; alignment->xalign = 0.5;
alignment->yalign = 0.5; alignment->yalign = 0.5;
......
...@@ -39,7 +39,7 @@ struct _GtkArgQueryData ...@@ -39,7 +39,7 @@ struct _GtkArgQueryData
/* --- functions --- */ /* --- functions --- */
void GtkArgInfo*
gtk_arg_type_new_static (GtkType base_class_type, gtk_arg_type_new_static (GtkType base_class_type,
const gchar *arg_name, const gchar *arg_name,
guint class_n_args_offset, guint class_n_args_offset,
...@@ -56,14 +56,14 @@ gtk_arg_type_new_static (GtkType base_class_type, ...@@ -56,14 +56,14 @@ gtk_arg_type_new_static (GtkType base_class_type,
guint *n_args_p; guint *n_args_p;
gchar *p; gchar *p;
g_return_if_fail (arg_name != NULL); g_return_val_if_fail (arg_name != NULL, NULL);
g_return_if_fail (GTK_FUNDAMENTAL_TYPE (base_class_type) == GTK_TYPE_OBJECT); g_return_val_if_fail (GTK_FUNDAMENTAL_TYPE (base_class_type) == GTK_TYPE_OBJECT, NULL);
g_return_if_fail (class_n_args_offset != 0); g_return_val_if_fail (class_n_args_offset != 0, NULL);
g_return_if_fail (arg_info_hash_table != NULL); g_return_val_if_fail (arg_info_hash_table != NULL, NULL);
g_return_if_fail (arg_type > GTK_TYPE_NONE); g_return_val_if_fail (arg_type > GTK_TYPE_NONE, NULL);
g_return_if_fail (arg_id > 0); g_return_val_if_fail (arg_id > 0, NULL);
g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0); g_return_val_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0, NULL);
/* g_return_if_fail ((arg_flags & GTK_ARG_CHILD_ARG) == 0); */ /* g_return_val_if_fail ((arg_flags & GTK_ARG_CHILD_ARG) == 0, NULL); */
arg_flags &= GTK_ARG_MASK; arg_flags &= GTK_ARG_MASK;
...@@ -71,7 +71,7 @@ gtk_arg_type_new_static (GtkType base_class_type, ...@@ -71,7 +71,7 @@ gtk_arg_type_new_static (GtkType base_class_type,
if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':')) if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
{ {
g_warning ("gtk_arg_type_new(): invalid arg name: \"%s\"\n", arg_name); g_warning ("gtk_arg_type_new(): invalid arg name: \"%s\"\n", arg_name);
return; return NULL;
} }
class_offset = (guint) (arg_part - arg_name); class_offset = (guint) (arg_part - arg_name);
...@@ -84,7 +84,7 @@ gtk_arg_type_new_static (GtkType base_class_type, ...@@ -84,7 +84,7 @@ gtk_arg_type_new_static (GtkType base_class_type,
g_warning ("gtk_arg_type_new(): argument class in \"%s\" is not in the `%s' ancestry", g_warning ("gtk_arg_type_new(): argument class in \"%s\" is not in the `%s' ancestry",
arg_name, arg_name,
gtk_type_name (base_class_type)); gtk_type_name (base_class_type));
return; return NULL;
} }
p = gtk_type_class (class_type); p = gtk_type_class (class_type);
...@@ -102,6 +102,8 @@ gtk_arg_type_new_static (GtkType base_class_type, ...@@ -102,6 +102,8 @@ gtk_arg_type_new_static (GtkType base_class_type,
info->seq_id = *n_args_p; info->seq_id = *n_args_p;
g_hash_table_insert (arg_info_hash_table, info, info); g_hash_table_insert (arg_info_hash_table, info, info);
return info;
} }
gchar* gchar*
......
...@@ -50,38 +50,38 @@ struct _GtkArgInfo ...@@ -50,38 +50,38 @@ struct _GtkArgInfo
/* Non-public methods */ /* Non-public methods */
GtkArg* gtk_arg_new (GtkType arg_type); GtkArg* gtk_arg_new (GtkType arg_type);
GtkArg* gtk_arg_copy (GtkArg *src_arg, GtkArg* gtk_arg_copy (GtkArg *src_arg,
GtkArg *dest_arg); GtkArg *dest_arg);
void gtk_arg_free (GtkArg *arg, void gtk_arg_free (GtkArg *arg,
gboolean free_contents); gboolean free_contents);
gchar* gtk_args_collect (GtkType object_type, gchar* gtk_args_collect (GtkType object_type,
GHashTable *arg_info_hash_table, GHashTable *arg_info_hash_table,
GSList **arg_list_p, GSList **arg_list_p,
GSList **info_list_p, GSList **info_list_p,
const gchar *first_arg_name, const gchar *first_arg_name,
va_list var_args); va_list var_args);
void gtk_args_collect_cleanup (GSList *arg_list, void gtk_args_collect_cleanup (GSList *arg_list,
GSList *info_list); GSList *info_list);
gchar* gtk_arg_get_info (GtkType object_type, gchar* gtk_arg_get_info (GtkType object_type,
GHashTable *arg_info_hash_table, GHashTable *arg_info_hash_table,
const gchar *arg_name, const gchar *arg_name,
GtkArgInfo **info_p); GtkArgInfo **info_p);
void gtk_arg_type_new_static (GtkType base_class_type, GtkArgInfo* gtk_arg_type_new_static (GtkType base_class_type,
const gchar *arg_name, const gchar *arg_name,
guint class_n_args_offset, guint class_n_args_offset,
GHashTable *arg_info_hash_table, GHashTable *arg_info_hash_table,
GtkType arg_type, GtkType arg_type,
guint arg_flags, guint arg_flags,
guint arg_id); guint arg_id);
GtkArg* gtk_args_query (GtkType class_type, GtkArg* gtk_args_query (GtkType class_type,
GHashTable *arg_info_hash_table, GHashTable *arg_info_hash_table,
guint32 **arg_flags, guint32 **arg_flags,
guint *n_args_p); guint *n_args_p);
gchar* gtk_arg_name_strip_type (const gchar *arg_name); gchar* gtk_arg_name_strip_type (const gchar *arg_name);
gint gtk_arg_info_equal (gconstpointer arg_info_1, gint gtk_arg_info_equal (gconstpointer arg_info_1,
gconstpointer arg_info_2); gconstpointer arg_info_2);
guint gtk_arg_info_hash (gconstpointer arg_info); guint gtk_arg_info_hash (gconstpointer arg_info);
......
...@@ -134,7 +134,7 @@ gtk_box_class_init (GtkBoxClass *class) ...@@ -134,7 +134,7 @@ gtk_box_class_init (GtkBoxClass *class)
static void static void
gtk_box_init (GtkBox *box) gtk_box_init (GtkBox *box)
{ {
GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW | GTK_BASIC); GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
box->children = NULL; box->children = NULL;
box->spacing = 0; box->spacing = 0;
......
...@@ -29,11 +29,11 @@ extern "C" { ...@@ -29,11 +29,11 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_TYPE_BOX (gtk_box_get_type ()) #define GTK_TYPE_BOX (gtk_box_get_type ())
#define GTK_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BOX, GtkBox)) #define GTK_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BOX, GtkBox))
#define GTK_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX, GtkBoxClass)) #define GTK_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BOX, GtkBoxClass))
#define GTK_IS_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BOX)) #define GTK_IS_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BOX))
#define GTK_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX)) #define GTK_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOX))
typedef struct _GtkBox GtkBox; typedef struct _GtkBox GtkBox;
......
...@@ -142,8 +142,10 @@ enum ...@@ -142,8 +142,10 @@ enum
enum { enum {
ARG_0, ARG_0,
ARG_HADJUSTMENT, ARG_N_COLUMNS,
ARG_VADJUSTMENT ARG_SHADOW_TYPE,
ARG_SELECTION_MODE,
ARG_ROW_HEIGHT
}; };
static void sync_selection (GtkCList * clist, static void sync_selection (GtkCList * clist,
...@@ -159,6 +161,9 @@ static void gtk_clist_destroy (GtkObject *object); ...@@ -159,6 +161,9 @@ static void gtk_clist_destroy (GtkObject *object);
static void gtk_clist_finalize (GtkObject *object); static void gtk_clist_finalize (GtkObject *object);
/* GtkWidget Methods */ /* GtkWidget Methods */
static void gtk_clist_scroll_adjustments (GtkCList *clist,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
static void gtk_clist_realize (GtkWidget *widget); static void gtk_clist_realize (GtkWidget *widget);
static void gtk_clist_unrealize (GtkWidget *widget); static void gtk_clist_unrealize (GtkWidget *widget);
static void gtk_clist_map (GtkWidget *widget); static void gtk_clist_map (GtkWidget *widget);
...@@ -414,14 +419,36 @@ gtk_clist_class_init (GtkCListClass *klass) ...@@ -414,14 +419,36 @@ gtk_clist_class_init (GtkCListClass *klass)
parent_class = gtk_type_class (GTK_TYPE_CONTAINER); parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gtk_object_add_arg_type ("GtkCList::hadjustment", gtk_object_add_arg_type ("GtkCList::n_columns",
GTK_TYPE_ADJUSTMENT, GTK_TYPE_UINT,
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT_ONLY,
ARG_N_COLUMNS);
gtk_object_add_arg_type ("GtkCList::shadow_type",
GTK_TYPE_SHADOW_TYPE,
GTK_ARG_READWRITE, GTK_ARG_READWRITE,
ARG_HADJUSTMENT); ARG_SHADOW_TYPE);
gtk_object_add_arg_type ("GtkCList::vadjustment", gtk_object_add_arg_type ("GtkCList::selection_mode",
GTK_TYPE_ADJUSTMENT, GTK_TYPE_SELECTION_MODE,
GTK_ARG_READWRITE, GTK_ARG_READWRITE,
ARG_VADJUSTMENT); ARG_SELECTION_MODE);
gtk_object_add_arg_type ("GtkCList::row_height",
GTK_TYPE_UINT,
GTK_ARG_READWRITE,
ARG_ROW_HEIGHT);
object_class->set_arg = gtk_clist_set_arg;
object_class->get_arg = gtk_clist_get_arg;
object_class->destroy = gtk_clist_destroy;
object_class->finalize = gtk_clist_finalize;
widget_class->scroll_adjustments_signal =
gtk_signal_new ("scroll_adjustments",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkCListClass, scroll_adjustments),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
clist_signals[SELECT_ROW] = clist_signals[SELECT_ROW] =
gtk_signal_new ("select_row", gtk_signal_new ("select_row",
...@@ -533,15 +560,8 @@ gtk_clist_class_init (GtkCListClass *klass) ...@@ -533,15 +560,8 @@ gtk_clist_class_init (GtkCListClass *klass)
GTK_SIGNAL_OFFSET (GtkCListClass, abort_column_resize), GTK_SIGNAL_OFFSET (GtkCListClass, abort_column_resize),
gtk_marshal_NONE__NONE, gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0); GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, clist_signals, LAST_SIGNAL); gtk_object_class_add_signals (object_class, clist_signals, LAST_SIGNAL);
object_class->set_arg = gtk_clist_set_arg;
object_class->get_arg = gtk_clist_get_arg;
object_class->destroy = gtk_clist_destroy;
object_class->finalize = gtk_clist_finalize;
widget_class->realize = gtk_clist_realize; widget_class->realize = gtk_clist_realize;
widget_class->unrealize = gtk_clist_unrealize; widget_class->unrealize = gtk_clist_unrealize;
widget_class->map = gtk_clist_map; widget_class->map = gtk_clist_map;
...@@ -566,6 +586,7 @@ gtk_clist_class_init (GtkCListClass *klass) ...@@ -566,6 +586,7 @@ gtk_clist_class_init (GtkCListClass *klass)
container_class->focus = gtk_clist_focus; container_class->focus = gtk_clist_focus;
container_class->set_focus_child = gtk_clist_set_focus_child; container_class->set_focus_child = gtk_clist_set_focus_child;
klass->scroll_adjustments = gtk_clist_scroll_adjustments;
klass->select_row = real_select_row; klass->select_row = real_select_row;
klass->unselect_row = real_unselect_row; klass->unselect_row = real_unselect_row;
klass->undo_selection = real_undo_selection; klass->undo_selection = real_undo_selection;
...@@ -797,19 +818,22 @@ gtk_clist_set_arg (GtkObject *object, ...@@ -797,19 +818,22 @@ gtk_clist_set_arg (GtkObject *object,
guint arg_id) guint arg_id)
{ {
GtkCList *clist; GtkCList *clist;
GtkAdjustment *adjustment;
clist = GTK_CLIST (object); clist = GTK_CLIST (object);
switch (arg_id) switch (arg_id)
{ {
case ARG_HADJUSTMENT: case ARG_N_COLUMNS: /* construct-only arg, only set when !GTK_CONSTRUCTED */
adjustment = GTK_VALUE_POINTER (*arg); gtk_clist_construct (clist, MAX (1, GTK_VALUE_UINT (*arg)), NULL);
gtk_clist_set_hadjustment (clist, adjustment); break;
case ARG_SHADOW_TYPE:
gtk_clist_set_shadow_type (clist, GTK_VALUE_ENUM (*arg));
break; break;
case ARG_VADJUSTMENT: case ARG_SELECTION_MODE:
adjustment = GTK_VALUE_POINTER (*arg); gtk_clist_set_selection_mode (clist, GTK_VALUE_ENUM (*arg));
gtk_clist_set_vadjustment (clist, adjustment); break;
case ARG_ROW_HEIGHT:
gtk_clist_set_row_height (clist, GTK_VALUE_UINT (*arg));
break; break;
default: default:
break; break;
...@@ -827,11 +851,17 @@ gtk_clist_get_arg (GtkObject *object, ...@@ -827,11 +851,17 @@ gtk_clist_get_arg (GtkObject *object,
switch (arg_id) switch (arg_id)
{ {
case ARG_HADJUSTMENT: case ARG_N_COLUMNS:
GTK_VALUE_POINTER (*arg) = clist->hadjustment; GTK_VALUE_UINT (*arg) = clist->columns;
break;
case ARG_SHADOW_TYPE:
GTK_VALUE_ENUM (*arg) = clist->shadow_type;
break;
case ARG_SELECTION_MODE:
GTK_VALUE_ENUM (*arg) = clist->selection_mode;
break; break;
case ARG_VADJUSTMENT: case ARG_ROW_HEIGHT:
GTK_VALUE_POINTER (*arg) = clist->vadjustment; GTK_VALUE_UINT (*arg) = GTK_CLIST_ROW_HEIGHT_SET (clist) ? clist->row_height : 0;
break; break;
default: default:
arg->type = GTK_TYPE_INVALID; arg->type = GTK_TYPE_INVALID;
...@@ -909,13 +939,13 @@ gtk_clist_construct (GtkCList *clist, ...@@ -909,13 +939,13 @@ gtk_clist_construct (GtkCList *clist,
gint columns, gint columns,
gchar *titles[]) gchar *titles[])
{ {
int i;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CLIST (clist));
g_return_if_fail (GTK_CLIST_CONSTRUCTED (clist) == FALSE); g_return_if_fail (columns > 0);
g_return_if_fail (GTK_OBJECT_CONSTRUCTED (clist) == FALSE);
GTK_CLIST_SET_FLAG (clist, CLIST_CONSTRUCTED); /* mark the object as constructed */
gtk_object_constructed (GTK_OBJECT (clist));
/* initalize memory chunks, if this has not been done by any /* initalize memory chunks, if this has not been done by any
* possibly derived widget * possibly derived widget
...@@ -945,6 +975,8 @@ gtk_clist_construct (GtkCList *clist, ...@@ -945,6 +975,8 @@ gtk_clist_construct (GtkCList *clist,
if (titles) if (titles)
{ {
guint i;
GTK_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES); GTK_CLIST_SET_FLAG (clist, CLIST_SHOW_TITLES);
for (i = 0; i < columns; i++) for (i = 0; i < columns; i++)
gtk_clist_set_column_title (clist, i, titles[i]); gtk_clist_set_column_title (clist, i, titles[i]);
...@@ -965,17 +997,16 @@ gtk_clist_construct (GtkCList *clist, ...@@ -965,17 +997,16 @@ gtk_clist_construct (GtkCList *clist,
* gtk_clist_set_shadow_type * gtk_clist_set_shadow_type
* gtk_clist_set_border *** deprecated function *** * gtk_clist_set_border *** deprecated function ***
* gtk_clist_set_selection_mode * gtk_clist_set_selection_mode
* gtk_clist_set_policy
* gtk_clist_freeze * gtk_clist_freeze
* gtk_clist_thaw * gtk_clist_thaw
*/ */
GtkWidget * GtkWidget*
gtk_clist_new (gint columns) gtk_clist_new (gint columns)
{ {
return gtk_clist_new_with_titles (columns, NULL); return gtk_clist_new_with_titles (columns, NULL);
} }
GtkWidget * GtkWidget*
gtk_clist_new_with_titles (gint columns, gtk_clist_new_with_titles (gint columns,
gchar *titles[]) gchar *titles[])
{ {
...@@ -983,6 +1014,7 @@ gtk_clist_new_with_titles (gint columns, ...@@ -983,6 +1014,7 @@ gtk_clist_new_with_titles (gint columns,
widget = gtk_type_new (GTK_TYPE_CLIST); widget = gtk_type_new (GTK_TYPE_CLIST);
gtk_clist_construct (GTK_CLIST (widget), columns, titles); gtk_clist_construct (GTK_CLIST (widget), columns, titles);
return widget; return widget;
} }
...@@ -1086,6 +1118,17 @@ gtk_clist_get_vadjustment (GtkCList *clist) ...@@ -1086,6 +1118,17 @@ gtk_clist_get_vadjustment (GtkCList *clist)
return clist->vadjustment; return clist->vadjustment;
} }
static void
gtk_clist_scroll_adjustments (GtkCList *clist,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment)
{
if (clist->hadjustment != hadjustment)
gtk_clist_set_hadjustment (clist, hadjustment);
if (clist->vadjustment != vadjustment)
gtk_clist_set_vadjustment (clist, vadjustment);
}
void void
gtk_clist_set_shadow_type (GtkCList *clist, gtk_clist_set_shadow_type (GtkCList *clist,
GtkShadowType type) GtkShadowType type)
...@@ -1104,6 +1147,8 @@ void ...@@ -1104,6 +1147,8 @@ void
gtk_clist_set_border (GtkCList *clist, gtk_clist_set_border (GtkCList *clist,
GtkShadowType border) GtkShadowType border)
{ {
g_message ("gtk_clist_set_border() is deprecated");
gtk_clist_set_shadow_type (clist, border); gtk_clist_set_shadow_type (clist, border);
} }
...@@ -1140,15 +1185,6 @@ gtk_clist_set_selection_mode (GtkCList *clist, ...@@ -1140,15 +1185,6 @@ gtk_clist_set_selection_mode (GtkCList *clist,
} }
} }
void
gtk_clist_set_policy (GtkCList *clist,
GtkPolicyType vscrollbar_policy,
GtkPolicyType hscrollbar_policy)
{
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
}
void void
gtk_clist_freeze (GtkCList *clist) gtk_clist_freeze (GtkCList *clist)
{ {
...@@ -1335,7 +1371,9 @@ gtk_clist_set_column_title (GtkCList *clist, ...@@ -1335,7 +1371,9 @@ gtk_clist_set_column_title (GtkCList *clist,
break; break;
} }
gtk_widget_push_composite_child ();
label = gtk_label_new (clist->column[column].title); label = gtk_label_new (clist->column[column].title);
gtk_widget_pop_composite_child ();
gtk_container_add (GTK_CONTAINER (alignment), label); gtk_container_add (GTK_CONTAINER (alignment), label);
gtk_container_add (GTK_CONTAINER (clist->column[column].button), alignment); gtk_container_add (GTK_CONTAINER (clist->column[column].button), alignment);
gtk_widget_show (label); gtk_widget_show (label);
...@@ -1959,7 +1997,9 @@ column_button_create (GtkCList *clist, ...@@ -1959,7 +1997,9 @@ column_button_create (GtkCList *clist,
{ {
GtkWidget *button; GtkWidget *button;
gtk_widget_push_composite_child ();
button = clist->column[column].button = gtk_button_new (); button = clist->column[column].button = gtk_button_new ();
gtk_widget_pop_composite_child ();
if (GTK_WIDGET_REALIZED (clist) && clist->title_window) if (GTK_WIDGET_REALIZED (clist) && clist->title_window)
gtk_widget_set_parent_window (clist->column[column].button, gtk_widget_set_parent_window (clist->column[column].button,
...@@ -1995,25 +2035,38 @@ column_button_clicked (GtkWidget *widget, ...@@ -1995,25 +2035,38 @@ column_button_clicked (GtkWidget *widget,
void void
gtk_clist_set_row_height (GtkCList *clist, gtk_clist_set_row_height (GtkCList *clist,
gint height) guint height)
{ {
GtkWidget *widget;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CLIST (clist));
widget = GTK_WIDGET (clist);
if (height > 0) if (height > 0)
clist->row_height = height; {
clist->row_height = height;
GTK_CLIST_SET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
}
else else
return; {
GTK_CLIST_UNSET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
clist->row_height = 0;
}
GTK_CLIST_SET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
if (GTK_WIDGET_REALIZED (clist)) if (GTK_WIDGET_REALIZED (clist))
{ {
GdkFont *font; if (!GTK_CLIST_ROW_HEIGHT_SET (clist))
{
font = GTK_WIDGET (clist)->style->font; clist->row_height = (widget->style->font->ascent +
clist->row_center_offset = (((height + font->ascent - font->descent - 1) widget->style->font->descent + 1);
/ 2) + 1.5); clist->row_center_offset = widget->style->font->ascent + 1.5;
}
else
clist->row_center_offset = 1.5 + (clist->row_height +
widget->style->font->ascent -
widget->style->font->descent - 1) / 2;
} }
if (!GTK_CLIST_FROZEN (clist)) if (!GTK_CLIST_FROZEN (clist))
...@@ -4077,11 +4130,13 @@ gtk_clist_destroy (GtkObject *object) ...@@ -4077,11 +4130,13 @@ gtk_clist_destroy (GtkObject *object)
/* unref adjustments */ /* unref adjustments */
if (clist->hadjustment) if (clist->hadjustment)
{ {
gtk_signal_disconnect_by_data (GTK_OBJECT (clist->hadjustment), clist);
gtk_object_unref (GTK_OBJECT (clist->hadjustment)); gtk_object_unref (GTK_OBJECT (clist->hadjustment));
clist->hadjustment = NULL; clist->hadjustment = NULL;
} }
if (clist->vadjustment) if (clist->vadjustment)
{ {
gtk_signal_disconnect_by_data (GTK_OBJECT (clist->vadjustment), clist);
gtk_object_unref (GTK_OBJECT (clist->vadjustment)); gtk_object_unref (GTK_OBJECT (clist->vadjustment));
clist->vadjustment = NULL; clist->vadjustment = NULL;
} }
......
...@@ -41,11 +41,10 @@ enum ...@@ -41,11 +41,10 @@ enum
GTK_CLIST_DRAG_SELECTION = 1 << 2, GTK_CLIST_DRAG_SELECTION = 1 << 2,
GTK_CLIST_ROW_HEIGHT_SET = 1 << 3, GTK_CLIST_ROW_HEIGHT_SET = 1 << 3,
GTK_CLIST_SHOW_TITLES = 1 << 4, GTK_CLIST_SHOW_TITLES = 1 << 4,
GTK_CLIST_CONSTRUCTED = 1 << 5, GTK_CLIST_CHILD_HAS_FOCUS = 1 << 5,
GTK_CLIST_CHILD_HAS_FOCUS = 1 << 6, GTK_CLIST_ADD_MODE = 1 << 6,
GTK_CLIST_ADD_MODE = 1 << 7, GTK_CLIST_AUTO_SORT = 1 << 7,
GTK_CLIST_AUTO_SORT = 1 << 8, GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 8
GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 9
}; };
/* cell types */ /* cell types */
...@@ -72,7 +71,6 @@ typedef enum ...@@ -72,7 +71,6 @@ typedef enum
#define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG) #define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG)
#define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET) #define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET)
#define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES) #define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES)
#define GTK_CLIST_CONSTRUCTED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_CONSTRUCTED)
#define GTK_CLIST_CHILD_HAS_FOCUS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_CHILD_HAS_FOCUS) #define GTK_CLIST_CHILD_HAS_FOCUS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_CHILD_HAS_FOCUS)
#define GTK_CLIST_DRAG_SELECTION(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAG_SELECTION) #define GTK_CLIST_DRAG_SELECTION(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_DRAG_SELECTION)
#define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE) #define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE)
...@@ -191,6 +189,9 @@ struct _GtkCListClass ...@@ -191,6 +189,9 @@ struct _GtkCListClass
{ {
GtkContainerClass parent_class; GtkContainerClass parent_class;
void (*scroll_adjustments) (GtkCList *clist,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
void (*select_row) (GtkCList *clist, void (*select_row) (GtkCList *clist,
gint row, gint row,
gint column, gint column,
...@@ -374,7 +375,7 @@ struct _GtkCell ...@@ -374,7 +375,7 @@ struct _GtkCell
GtkType gtk_clist_get_type (void); GtkType gtk_clist_get_type (void);
/* constructers useful for gtk-- wrappers */ /* constructors useful for gtk-- wrappers */
void gtk_clist_construct (GtkCList *clist, void gtk_clist_construct (GtkCList *clist,
gint columns, gint columns,
gchar *titles[]); gchar *titles[]);
...@@ -482,11 +483,11 @@ void gtk_clist_set_column_max_width (GtkCList *clist, ...@@ -482,11 +483,11 @@ void gtk_clist_set_column_max_width (GtkCList *clist,
gint column, gint column,
gint max_width); gint max_width);
/* change the height of the rows, the default is the hight /* change the height of the rows, the default (height=0) is
* of the current font * the hight of the current font.
*/ */
void gtk_clist_set_row_height (GtkCList *clist, void gtk_clist_set_row_height (GtkCList *clist,
gint height); guint height);
/* scroll the viewing area of the list to the given column and row; /* scroll the viewing area of the list to the given column and row;
* row_align and col_align are between 0-1 representing the location the * row_align and col_align are between 0-1 representing the location the
...@@ -705,10 +706,6 @@ void gtk_clist_set_auto_sort (GtkCList *clist, ...@@ -705,10 +706,6 @@ void gtk_clist_set_auto_sort (GtkCList *clist,
void gtk_clist_set_border (GtkCList *clist, void gtk_clist_set_border (GtkCList *clist,
GtkShadowType border); GtkShadowType border);
/* Completely non-functional */
void gtk_clist_set_policy (GtkCList *clist,
GtkPolicyType vscrollbar_policy,
GtkPolicyType hscrollbar_policy);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
......
...@@ -302,14 +302,14 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w ...@@ -302,14 +302,14 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
2 * popwin->child->style->klass->xthickness - 2 * popwin->child->style->klass->xthickness -
2 * GTK_CONTAINER (popwin->child)->border_width -