1998-01-18 23:01:09 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
* GtkStatusbar Copyright (C) 1998 Shawn T. Amundson
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-01-18 23:01:09 +00:00
|
|
|
* 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
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1998-01-18 23:01:09 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser 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.
|
1998-01-18 23:01:09 +00:00
|
|
|
*/
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* 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/.
|
|
|
|
*/
|
|
|
|
|
1998-01-18 23:01:09 +00:00
|
|
|
#include "gtkframe.h"
|
|
|
|
#include "gtklabel.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
#include "gtkmarshalers.h"
|
1998-01-18 23:01:09 +00:00
|
|
|
#include "gtkstatusbar.h"
|
2001-03-29 21:17:45 +00:00
|
|
|
#include "gtkwindow.h"
|
2001-06-04 23:15:51 +00:00
|
|
|
#include "gtkintl.h"
|
1998-01-18 23:01:09 +00:00
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
typedef struct _GtkStatusbarMsg GtkStatusbarMsg;
|
|
|
|
|
|
|
|
struct _GtkStatusbarMsg
|
|
|
|
{
|
|
|
|
gchar *text;
|
|
|
|
guint context_id;
|
|
|
|
guint message_id;
|
|
|
|
};
|
1998-02-23 15:13:03 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SIGNAL_TEXT_PUSHED,
|
|
|
|
SIGNAL_TEXT_POPPED,
|
|
|
|
SIGNAL_LAST
|
|
|
|
};
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
static void gtk_statusbar_class_init (GtkStatusbarClass *class);
|
|
|
|
static void gtk_statusbar_init (GtkStatusbar *statusbar);
|
|
|
|
static void gtk_statusbar_destroy (GtkObject *object);
|
|
|
|
static void gtk_statusbar_update (GtkStatusbar *statusbar,
|
|
|
|
guint context_id,
|
|
|
|
const gchar *text);
|
|
|
|
static void gtk_statusbar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static void gtk_statusbar_realize (GtkWidget *widget);
|
|
|
|
static void gtk_statusbar_unrealize (GtkWidget *widget);
|
|
|
|
static void gtk_statusbar_map (GtkWidget *widget);
|
|
|
|
static void gtk_statusbar_unmap (GtkWidget *widget);
|
|
|
|
static gboolean gtk_statusbar_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gboolean gtk_statusbar_expose_event (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
2001-06-04 23:15:51 +00:00
|
|
|
static void gtk_statusbar_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gtk_statusbar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
2001-03-29 21:17:45 +00:00
|
|
|
static void gtk_statusbar_create_window (GtkStatusbar *statusbar);
|
|
|
|
static void gtk_statusbar_destroy_window (GtkStatusbar *statusbar);
|
|
|
|
|
1998-01-18 23:01:09 +00:00
|
|
|
static GtkContainerClass *parent_class;
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint statusbar_signals[SIGNAL_LAST] = { 0 };
|
1998-01-18 23:01:09 +00:00
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
GType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_statusbar_get_type (void)
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
2002-10-09 00:38:22 +00:00
|
|
|
static GType statusbar_type = 0;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
|
|
|
if (!statusbar_type)
|
|
|
|
{
|
2002-10-09 00:38:22 +00:00
|
|
|
static const GTypeInfo statusbar_info =
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
|
|
|
sizeof (GtkStatusbarClass),
|
2002-10-09 00:38:22 +00:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gtk_statusbar_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkStatusbar),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gtk_statusbar_init,
|
1998-01-18 23:01:09 +00:00
|
|
|
};
|
|
|
|
|
2002-10-22 18:04:44 +00:00
|
|
|
statusbar_type = g_type_register_static (GTK_TYPE_HBOX, "GtkStatusbar",
|
2002-10-09 00:38:22 +00:00
|
|
|
&statusbar_info, 0);
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return statusbar_type;
|
1998-03-02 23:16:39 +00:00
|
|
|
}
|
1998-01-18 23:01:09 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_class_init (GtkStatusbarClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass *) class;
|
|
|
|
widget_class = (GtkWidgetClass *) class;
|
|
|
|
container_class = (GtkContainerClass *) class;
|
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
parent_class = g_type_class_peek_parent (class);
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
|
|
|
object_class->destroy = gtk_statusbar_destroy;
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
widget_class->realize = gtk_statusbar_realize;
|
|
|
|
widget_class->unrealize = gtk_statusbar_unrealize;
|
|
|
|
widget_class->map = gtk_statusbar_map;
|
|
|
|
widget_class->unmap = gtk_statusbar_unmap;
|
|
|
|
|
|
|
|
widget_class->button_press_event = gtk_statusbar_button_press;
|
|
|
|
widget_class->expose_event = gtk_statusbar_expose_event;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
widget_class->size_request = gtk_statusbar_size_request;
|
|
|
|
widget_class->size_allocate = gtk_statusbar_size_allocate;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
2002-10-22 18:04:44 +00:00
|
|
|
class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusbar messages mem chunk",
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
sizeof (GtkStatusbarMsg),
|
|
|
|
sizeof (GtkStatusbarMsg) * 64,
|
|
|
|
G_ALLOC_AND_FREE);
|
|
|
|
|
|
|
|
class->text_pushed = gtk_statusbar_update;
|
|
|
|
class->text_popped = gtk_statusbar_update;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
statusbar_signals[SIGNAL_TEXT_PUSHED] =
|
2002-10-09 00:38:22 +00:00
|
|
|
g_signal_new ("text_pushed",
|
|
|
|
G_OBJECT_CLASS_TYPE (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkStatusbarClass, text_pushed),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__UINT_STRING,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_UINT,
|
|
|
|
G_TYPE_STRING);
|
1998-02-23 15:13:03 +00:00
|
|
|
statusbar_signals[SIGNAL_TEXT_POPPED] =
|
2002-10-09 00:38:22 +00:00
|
|
|
g_signal_new ("text_popped",
|
|
|
|
G_OBJECT_CLASS_TYPE (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkStatusbarClass, text_popped),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__UINT_STRING,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_UINT,
|
|
|
|
G_TYPE_STRING);
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
g_param_spec_enum ("shadow_type",
|
|
|
|
_("Shadow type"),
|
|
|
|
_("Style of bevel around the statusbar text"),
|
|
|
|
GTK_TYPE_SHADOW_TYPE,
|
|
|
|
GTK_SHADOW_IN,
|
|
|
|
G_PARAM_READABLE));
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_init (GtkStatusbar *statusbar)
|
|
|
|
{
|
1998-02-23 15:13:03 +00:00
|
|
|
GtkBox *box;
|
2001-06-04 23:15:51 +00:00
|
|
|
GtkShadowType shadow_type;
|
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
box = GTK_BOX (statusbar);
|
|
|
|
|
|
|
|
box->spacing = 2;
|
|
|
|
box->homogeneous = FALSE;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
statusbar->has_resize_grip = TRUE;
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
1998-01-27 06:39:56 +00:00
|
|
|
statusbar->frame = gtk_frame_new (NULL);
|
2001-06-04 23:15:51 +00:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
|
1998-02-23 15:13:03 +00:00
|
|
|
gtk_box_pack_start (box, statusbar->frame, TRUE, TRUE, 0);
|
1998-01-27 06:39:56 +00:00
|
|
|
gtk_widget_show (statusbar->frame);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
statusbar->label = gtk_label_new ("");
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (statusbar->label), 0.0, 0.0);
|
2001-06-04 23:15:51 +00:00
|
|
|
/* don't expand the size request for the label; if we
|
|
|
|
* do that then toplevels weirdly resize
|
|
|
|
*/
|
2002-10-09 00:38:22 +00:00
|
|
|
gtk_widget_set_size_request (statusbar->label, 1, -1);
|
1998-02-23 15:13:03 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (statusbar->frame), statusbar->label);
|
1998-01-27 06:39:56 +00:00
|
|
|
gtk_widget_show (statusbar->label);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
statusbar->seq_context_id = 1;
|
|
|
|
statusbar->seq_message_id = 1;
|
1998-02-23 15:13:03 +00:00
|
|
|
statusbar->messages = NULL;
|
1998-03-01 23:29:40 +00:00
|
|
|
statusbar->keys = NULL;
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget*
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_statusbar_new (void)
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
2002-10-09 00:38:22 +00:00
|
|
|
return g_object_new (GTK_TYPE_STATUSBAR, NULL);
|
1998-02-23 15:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_update (GtkStatusbar *statusbar,
|
1998-03-01 23:29:40 +00:00
|
|
|
guint context_id,
|
1998-02-23 15:13:03 +00:00
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
if (!text)
|
|
|
|
text = "";
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-12-15 20:31:26 +00:00
|
|
|
gtk_label_set_text (GTK_LABEL (statusbar->label), text);
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
guint
|
|
|
|
gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
|
|
|
|
const gchar *context_description)
|
|
|
|
{
|
|
|
|
gchar *string;
|
|
|
|
guint *id;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
|
|
|
|
g_return_val_if_fail (context_description != NULL, 0);
|
|
|
|
|
|
|
|
/* we need to preserve namespaces on object datas */
|
|
|
|
string = g_strconcat ("gtk-status-bar-context:", context_description, NULL);
|
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
id = g_object_get_data (G_OBJECT (statusbar), string);
|
1998-03-01 23:29:40 +00:00
|
|
|
if (!id)
|
|
|
|
{
|
|
|
|
id = g_new (guint, 1);
|
|
|
|
*id = statusbar->seq_context_id++;
|
2002-10-09 00:38:22 +00:00
|
|
|
g_object_set_data_full (G_OBJECT (statusbar), string, id, g_free);
|
1998-03-01 23:29:40 +00:00
|
|
|
statusbar->keys = g_slist_prepend (statusbar->keys, string);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_free (string);
|
|
|
|
|
|
|
|
return *id;
|
|
|
|
}
|
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
guint
|
|
|
|
gtk_statusbar_push (GtkStatusbar *statusbar,
|
1998-03-01 23:29:40 +00:00
|
|
|
guint context_id,
|
1998-02-23 15:13:03 +00:00
|
|
|
const gchar *text)
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
|
|
|
GtkStatusbarMsg *msg;
|
1998-02-23 15:13:03 +00:00
|
|
|
GtkStatusbarClass *class;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
|
|
|
|
g_return_val_if_fail (text != NULL, 0);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
class = GTK_STATUSBAR_GET_CLASS (statusbar);
|
1998-02-23 15:13:03 +00:00
|
|
|
msg = g_chunk_new (GtkStatusbarMsg, class->messages_mem_chunk);
|
|
|
|
msg->text = g_strdup (text);
|
1998-03-01 23:29:40 +00:00
|
|
|
msg->context_id = context_id;
|
|
|
|
msg->message_id = statusbar->seq_message_id++;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
statusbar->messages = g_slist_prepend (statusbar->messages, msg);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
g_signal_emit (statusbar,
|
|
|
|
statusbar_signals[SIGNAL_TEXT_PUSHED],
|
|
|
|
0,
|
|
|
|
msg->context_id,
|
|
|
|
msg->text);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
return msg->message_id;
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
void
|
1998-03-01 23:29:40 +00:00
|
|
|
gtk_statusbar_pop (GtkStatusbar *statusbar,
|
|
|
|
guint context_id)
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
1998-02-23 15:13:03 +00:00
|
|
|
GtkStatusbarMsg *msg;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
if (statusbar->messages)
|
|
|
|
{
|
1998-03-01 23:29:40 +00:00
|
|
|
GSList *list;
|
1998-04-10 00:44:35 +00:00
|
|
|
|
|
|
|
for (list = statusbar->messages; list; list = list->next)
|
|
|
|
{
|
|
|
|
msg = list->data;
|
|
|
|
|
|
|
|
if (msg->context_id == context_id)
|
|
|
|
{
|
|
|
|
GtkStatusbarClass *class;
|
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
class = GTK_STATUSBAR_GET_CLASS (statusbar);
|
1998-04-10 00:44:35 +00:00
|
|
|
|
|
|
|
statusbar->messages = g_slist_remove_link (statusbar->messages,
|
|
|
|
list);
|
|
|
|
g_free (msg->text);
|
|
|
|
g_mem_chunk_free (class->messages_mem_chunk, msg);
|
|
|
|
g_slist_free_1 (list);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-02-23 15:13:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
msg = statusbar->messages ? statusbar->messages->data : NULL;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
2002-10-09 00:38:22 +00:00
|
|
|
g_signal_emit (statusbar,
|
|
|
|
statusbar_signals[SIGNAL_TEXT_POPPED],
|
|
|
|
0,
|
|
|
|
(guint) (msg ? msg->context_id : 0),
|
|
|
|
msg ? msg->text : NULL);
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-03-01 23:29:40 +00:00
|
|
|
gtk_statusbar_remove (GtkStatusbar *statusbar,
|
|
|
|
guint context_id,
|
|
|
|
guint message_id)
|
1998-01-18 23:01:09 +00:00
|
|
|
{
|
1998-02-23 15:13:03 +00:00
|
|
|
GtkStatusbarMsg *msg;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
|
1998-03-01 23:29:40 +00:00
|
|
|
g_return_if_fail (message_id > 0);
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-02-23 15:13:03 +00:00
|
|
|
msg = statusbar->messages ? statusbar->messages->data : NULL;
|
|
|
|
if (msg)
|
|
|
|
{
|
1998-03-01 23:29:40 +00:00
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
/* care about signal emission if the topmost item is removed */
|
|
|
|
if (msg->context_id == context_id &&
|
|
|
|
msg->message_id == message_id)
|
1998-02-23 15:13:03 +00:00
|
|
|
{
|
1998-03-01 23:29:40 +00:00
|
|
|
gtk_statusbar_pop (statusbar, context_id);
|
1998-02-23 15:13:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (list = statusbar->messages; list; list = list->next)
|
|
|
|
{
|
|
|
|
msg = list->data;
|
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
if (msg->context_id == context_id &&
|
|
|
|
msg->message_id == message_id)
|
1998-02-23 15:13:03 +00:00
|
|
|
{
|
|
|
|
GtkStatusbarClass *class;
|
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
class = GTK_STATUSBAR_GET_CLASS (statusbar);
|
1998-03-01 23:29:40 +00:00
|
|
|
statusbar->messages = g_slist_remove_link (statusbar->messages, list);
|
1998-02-23 15:13:03 +00:00
|
|
|
g_free (msg->text);
|
|
|
|
g_mem_chunk_free (class->messages_mem_chunk, msg);
|
1998-03-01 23:29:40 +00:00
|
|
|
g_slist_free_1 (list);
|
1998-02-23 15:13:03 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-01-18 23:01:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
void
|
|
|
|
gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
|
|
|
|
|
|
|
|
setting = setting != FALSE;
|
|
|
|
|
|
|
|
if (setting != statusbar->has_resize_grip)
|
|
|
|
{
|
|
|
|
statusbar->has_resize_grip = setting;
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (statusbar));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (statusbar))
|
|
|
|
{
|
|
|
|
if (statusbar->has_resize_grip && statusbar->grip_window == NULL)
|
|
|
|
gtk_statusbar_create_window (statusbar);
|
|
|
|
else if (!statusbar->has_resize_grip && statusbar->grip_window != NULL)
|
|
|
|
gtk_statusbar_destroy_window (statusbar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gtk_statusbar_get_has_resize_grip (GtkStatusbar *statusbar)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), FALSE);
|
|
|
|
|
|
|
|
return statusbar->has_resize_grip;
|
|
|
|
}
|
|
|
|
|
1998-01-18 23:01:09 +00:00
|
|
|
static void
|
|
|
|
gtk_statusbar_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
1998-02-23 15:13:03 +00:00
|
|
|
GtkStatusbarClass *class;
|
1998-03-01 23:29:40 +00:00
|
|
|
GSList *list;
|
1998-02-23 15:13:03 +00:00
|
|
|
|
1998-01-18 23:01:09 +00:00
|
|
|
g_return_if_fail (GTK_IS_STATUSBAR (object));
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (object);
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
class = GTK_STATUSBAR_GET_CLASS (statusbar);
|
1998-02-23 15:13:03 +00:00
|
|
|
|
|
|
|
for (list = statusbar->messages; list; list = list->next)
|
|
|
|
{
|
|
|
|
GtkStatusbarMsg *msg;
|
|
|
|
|
|
|
|
msg = list->data;
|
|
|
|
g_free (msg->text);
|
|
|
|
g_mem_chunk_free (class->messages_mem_chunk, msg);
|
|
|
|
}
|
1998-03-01 23:29:40 +00:00
|
|
|
g_slist_free (statusbar->messages);
|
1998-02-23 15:13:03 +00:00
|
|
|
statusbar->messages = NULL;
|
1998-01-18 23:01:09 +00:00
|
|
|
|
1998-03-12 07:28:41 +00:00
|
|
|
for (list = statusbar->keys; list; list = list->next)
|
|
|
|
g_free (list->data);
|
|
|
|
g_slist_free (statusbar->keys);
|
|
|
|
statusbar->keys = NULL;
|
|
|
|
|
1998-03-01 23:29:40 +00:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
get_grip_rect (GtkStatusbar *statusbar,
|
|
|
|
GdkRectangle *rect)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
gint w, h;
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (statusbar);
|
|
|
|
|
|
|
|
/* These are in effect the max/default size of the grip. */
|
|
|
|
w = 18;
|
|
|
|
h = 18;
|
|
|
|
|
|
|
|
if (w > (widget->allocation.width))
|
|
|
|
w = widget->allocation.width;
|
|
|
|
|
|
|
|
if (h > (widget->allocation.height - widget->style->ythickness))
|
|
|
|
h = widget->allocation.height - widget->style->ythickness;
|
|
|
|
|
|
|
|
rect->x = widget->allocation.x + widget->allocation.width - w;
|
|
|
|
rect->y = widget->allocation.y + widget->allocation.height - h;
|
|
|
|
rect->width = w;
|
|
|
|
rect->height = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_create_window (GtkStatusbar *statusbar)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_WIDGET_REALIZED (statusbar));
|
|
|
|
g_return_if_fail (statusbar->has_resize_grip);
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (statusbar);
|
|
|
|
|
|
|
|
get_grip_rect (statusbar, &rect);
|
|
|
|
|
|
|
|
attributes.x = rect.x;
|
|
|
|
attributes.y = rect.y;
|
|
|
|
attributes.width = rect.width;
|
|
|
|
attributes.height = rect.height;
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget) |
|
|
|
|
GDK_BUTTON_PRESS_MASK;
|
|
|
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
|
|
|
|
|
|
|
statusbar->grip_window = gdk_window_new (widget->window,
|
|
|
|
&attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (statusbar->grip_window, widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_destroy_window (GtkStatusbar *statusbar)
|
|
|
|
{
|
|
|
|
gdk_window_set_user_data (statusbar->grip_window, NULL);
|
|
|
|
gdk_window_destroy (statusbar->grip_window);
|
|
|
|
statusbar->grip_window = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
|
|
|
|
|
|
|
|
if (statusbar->has_resize_grip)
|
|
|
|
gtk_statusbar_create_window (statusbar);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_unrealize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
if (statusbar->grip_window)
|
|
|
|
gtk_statusbar_destroy_window (statusbar);
|
|
|
|
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->map) (widget);
|
|
|
|
|
|
|
|
if (statusbar->grip_window)
|
|
|
|
gdk_window_show (statusbar->grip_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_unmap (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
if (statusbar->grip_window)
|
|
|
|
gdk_window_hide (statusbar->grip_window);
|
|
|
|
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_statusbar_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
GtkWidget *ancestor;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
if (!statusbar->has_resize_grip)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
ancestor = gtk_widget_get_toplevel (widget);
|
|
|
|
|
|
|
|
if (!GTK_IS_WINDOW (ancestor))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (event->button == 1)
|
|
|
|
gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
|
|
|
|
GDK_WINDOW_EDGE_SOUTH_EAST,
|
|
|
|
event->button,
|
|
|
|
event->x_root, event->y_root,
|
|
|
|
event->time);
|
|
|
|
else if (event->button == 2)
|
|
|
|
gtk_window_begin_move_drag (GTK_WINDOW (ancestor),
|
|
|
|
event->button,
|
|
|
|
event->x_root, event->y_root,
|
|
|
|
event->time);
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_statusbar_expose_event (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
|
|
|
|
|
|
|
|
if (statusbar->has_resize_grip)
|
|
|
|
{
|
|
|
|
get_grip_rect (statusbar, &rect);
|
2001-06-04 23:15:51 +00:00
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
gtk_paint_resize_grip (widget->style,
|
|
|
|
widget->window,
|
|
|
|
GTK_WIDGET_STATE (widget),
|
|
|
|
NULL,
|
|
|
|
widget,
|
|
|
|
"statusbar",
|
|
|
|
GDK_WINDOW_EDGE_SOUTH_EAST,
|
|
|
|
rect.x, rect.y,
|
|
|
|
/* don't draw grip over the frame, though you
|
|
|
|
* can click on the frame.
|
|
|
|
*/
|
|
|
|
rect.width - widget->style->xthickness,
|
|
|
|
rect.height - widget->style->ythickness);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-06-04 23:15:51 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
GtkShadowType shadow_type;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow_type", &shadow_type, NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), shadow_type);
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
|
|
|
|
|
|
|
|
if (statusbar->has_resize_grip)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
/* x, y in the grip rect depend on size allocation, but
|
|
|
|
* w, h do not so this is OK
|
|
|
|
*/
|
|
|
|
get_grip_rect (statusbar, &rect);
|
|
|
|
|
|
|
|
requisition->width += rect.width;
|
|
|
|
requisition->height = MAX (requisition->height, rect.height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_statusbar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
GtkStatusbar *statusbar;
|
|
|
|
|
|
|
|
statusbar = GTK_STATUSBAR (widget);
|
|
|
|
|
|
|
|
if (statusbar->has_resize_grip)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
GtkRequisition saved_req;
|
|
|
|
|
|
|
|
widget->allocation = *allocation; /* get_grip_rect needs this info */
|
|
|
|
get_grip_rect (statusbar, &rect);
|
|
|
|
|
|
|
|
if (statusbar->grip_window)
|
|
|
|
gdk_window_move_resize (statusbar->grip_window,
|
|
|
|
rect.x, rect.y,
|
|
|
|
rect.width, rect.height);
|
|
|
|
|
|
|
|
/* enter the bad hack zone */
|
|
|
|
saved_req = widget->requisition;
|
|
|
|
widget->requisition.width -= rect.width; /* HBox::size_allocate needs this */
|
|
|
|
if (widget->requisition.width < 0)
|
|
|
|
widget->requisition.width = 0;
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
|
|
|
widget->requisition = saved_req;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* chain up normally */
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
|
|
|
}
|
|
|
|
}
|