added shadow_type setting and gtk_menu_bar_set_shadow_type function to

* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars

* gtk/gtkviewport.h: use GtkShadowType enum instead of generic guint

-Yosh
This commit is contained in:
Manish Singh 1998-11-16 09:05:26 +00:00
parent 3ae1549289
commit d8ab8e0e7d
10 changed files with 155 additions and 11 deletions

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -1,3 +1,12 @@
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
gtk_menu_bar_set_shadow_type function to allow shadow
configurability for menubars
* gtk/gtkviewport.h: use GtkShadowType enum instead of generic
guint
Mon Nov 16 00:17:53 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): relookup type node after

View File

@ -22,6 +22,11 @@
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
enum {
ARG_0,
ARG_SHADOW
};
#define BORDER_SPACING 2
#define CHILD_SPACING 3
@ -29,6 +34,12 @@
static void gtk_menu_bar_class_init (GtkMenuBarClass *klass);
static void gtk_menu_bar_init (GtkMenuBar *menu_bar);
static void gtk_menu_bar_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_menu_bar_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_menu_bar_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
@ -69,14 +80,21 @@ gtk_menu_bar_get_type (void)
static void
gtk_menu_bar_class_init (GtkMenuBarClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkMenuShellClass *menu_shell_class;
GtkBindingSet *binding_set;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
gtk_object_add_arg_type ("GtkMenuBar::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW);
object_class->set_arg = gtk_menu_bar_set_arg;
object_class->get_arg = gtk_menu_bar_get_arg;
widget_class->draw = gtk_menu_bar_draw;
widget_class->size_request = gtk_menu_bar_size_request;
widget_class->size_allocate = gtk_menu_bar_size_allocate;
@ -110,6 +128,46 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
static void
gtk_menu_bar_init (GtkMenuBar *menu_bar)
{
menu_bar->shadow_type = GTK_SHADOW_OUT;
}
static void
gtk_menu_bar_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GtkMenuBar *menu_bar;
menu_bar = GTK_MENU_BAR (object);
switch (arg_id)
{
case ARG_SHADOW:
gtk_menu_bar_set_shadow_type (menu_bar, GTK_VALUE_ENUM (*arg));
break;
default:
break;
}
}
static void
gtk_menu_bar_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
GtkMenuBar *menu_bar;
menu_bar = GTK_MENU_BAR (object);
switch (arg_id)
{
case ARG_SHADOW:
GTK_VALUE_ENUM (*arg) = menu_bar->shadow_type;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
GtkWidget*
@ -262,6 +320,25 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
}
}
void
gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar,
GtkShadowType type)
{
g_return_if_fail (menu_bar != NULL);
g_return_if_fail (GTK_IS_MENU_BAR (menu_bar));
if ((GtkShadowType) menu_bar->shadow_type != type)
{
menu_bar->shadow_type = type;
if (GTK_WIDGET_DRAWABLE (menu_bar))
{
gtk_widget_queue_clear (GTK_WIDGET (menu_bar));
}
gtk_widget_queue_resize (GTK_WIDGET (menu_bar));
}
}
static void
gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area)
{
@ -273,7 +350,7 @@ gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area)
gtk_paint_box (widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
GTK_MENU_BAR (widget)->shadow_type,
area, widget, "menubar",
0, 0,
-1,-1);

View File

@ -41,6 +41,8 @@ typedef struct _GtkMenuBarClass GtkMenuBarClass;
struct _GtkMenuBar
{
GtkMenuShell menu_shell;
GtkShadowType shadow_type;
};
struct _GtkMenuBarClass
@ -49,15 +51,17 @@ struct _GtkMenuBarClass
};
GtkType gtk_menu_bar_get_type (void);
GtkWidget* gtk_menu_bar_new (void);
void gtk_menu_bar_append (GtkMenuBar *menu_bar,
GtkWidget *child);
void gtk_menu_bar_prepend (GtkMenuBar *menu_bar,
GtkWidget *child);
void gtk_menu_bar_insert (GtkMenuBar *menu_bar,
GtkWidget *child,
gint position);
GtkType gtk_menu_bar_get_type (void);
GtkWidget* gtk_menu_bar_new (void);
void gtk_menu_bar_append (GtkMenuBar *menu_bar,
GtkWidget *child);
void gtk_menu_bar_prepend (GtkMenuBar *menu_bar,
GtkWidget *child);
void gtk_menu_bar_insert (GtkMenuBar *menu_bar,
GtkWidget *child,
gint position);
void gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar,
GtkShadowType type);
#ifdef __cplusplus

View File

@ -44,7 +44,7 @@ struct _GtkViewport
{
GtkBin bin;
guint shadow_type;
GtkShadowType shadow_type;
GdkWindow *view_window;
GdkWindow *bin_window;
GtkAdjustment *hadjustment;