Commit e0423105 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Add support for stock and normal imagemenuitems.

2001-03-21  Alexander Larsson  <alexl@redhat.com>

	* gtk/gtkitemfactory.[ch]:
	Add support for stock and normal imagemenuitems.

	* gtk/testgtk.c:
	Add some tests for mnemonics, stock toolbars, stock
	and image menuitems in itemfactory and gdk_window_scroll.
parent de5eafed
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkitemfactory.[ch]:
Add support for stock and normal imagemenuitems.
* gtk/testgtk.c:
Add some tests for mnemonics, stock toolbars, stock
and image menuitems in itemfactory and gdk_window_scroll.
2001-03-21 Alexander Larsson <alexl@redhat.com>
* gtk/gtkbutton.[ch]:
......
......@@ -37,9 +37,13 @@
#include "gtk/gtkmenuitem.h"
#include "gtk/gtkradiomenuitem.h"
#include "gtk/gtkcheckmenuitem.h"
#include "gtk/gtkimagemenuitem.h"
#include "gtk/gtktearoffmenuitem.h"
#include "gtk/gtkaccellabel.h"
#include "gdk/gdkkeysyms.h"
#include "gtk/gtkimage.h"
#include "gtk/gtkstock.h"
#include "gtk/gtkiconfactory.h"
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -105,6 +109,8 @@ static GQuark quark_type_title = 0;
static GQuark quark_type_radio_item = 0;
static GQuark quark_type_check_item = 0;
static GQuark quark_type_toggle_item = 0;
static GQuark quark_type_image_item = 0;
static GQuark quark_type_stock_item = 0;
static GQuark quark_type_tearoff_item = 0;
static GQuark quark_type_separator_item = 0;
static GQuark quark_type_branch = 0;
......@@ -220,6 +226,8 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
quark_type_radio_item = g_quark_from_static_string ("<RadioItem>");
quark_type_check_item = g_quark_from_static_string ("<CheckItem>");
quark_type_toggle_item = g_quark_from_static_string ("<ToggleItem>");
quark_type_image_item = g_quark_from_static_string ("<ImageItem>");
quark_type_stock_item = g_quark_from_static_string ("<StockItem>");
quark_type_tearoff_item = g_quark_from_static_string ("<Tearoff>");
quark_type_separator_item = g_quark_from_static_string ("<Separator>");
quark_type_branch = g_quark_from_static_string ("<Branch>");
......@@ -1095,15 +1103,17 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
GtkOptionMenu *option_menu = NULL;
GtkWidget *parent;
GtkWidget *widget;
GtkWidget *image;
GSList *radio_group;
gchar *name;
gchar *parent_path;
gchar *path;
guint accel_key;
gchar *accelerator;
guint type_id;
GtkType type;
gchar *item_type_path;
GtkStockItem stock_item;
g_return_if_fail (ifactory != NULL);
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
g_return_if_fail (entry != NULL);
......@@ -1132,6 +1142,10 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
type = GTK_TYPE_RADIO_MENU_ITEM;
else if (type_id == quark_type_check_item)
type = GTK_TYPE_CHECK_MENU_ITEM;
else if (type_id == quark_type_image_item)
type = GTK_TYPE_IMAGE_MENU_ITEM;
else if (type_id == quark_type_stock_item)
type = GTK_TYPE_IMAGE_MENU_ITEM;
else if (type_id == quark_type_tearoff_item)
type = GTK_TYPE_TEAROFF_MENU_ITEM;
else if (type_id == quark_type_toggle_item)
......@@ -1199,6 +1213,8 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
g_return_if_fail (GTK_IS_CONTAINER (parent));
accelerator = entry->accelerator;
widget = gtk_widget_new (type,
"GtkWidget::visible", TRUE,
"GtkWidget::sensitive", (type_id != quark_type_separator_item &&
......@@ -1212,6 +1228,39 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gtk_radio_menu_item_set_group (GTK_RADIO_MENU_ITEM (widget), radio_group);
if (GTK_IS_CHECK_MENU_ITEM (widget))
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE);
if (GTK_IS_IMAGE_MENU_ITEM (widget))
{
GdkPixbuf *pixbuf = NULL;
image = NULL;
pixbuf = gdk_pixbuf_new_from_inline (entry->extra_data,
FALSE,
entry->extra_data2,
NULL);
if (pixbuf)
image = gtk_image_new_from_pixbuf (pixbuf);
if (image)
gtk_image_menu_item_add_image (GTK_IMAGE_MENU_ITEM (widget), image);
if (pixbuf)
g_object_unref (G_OBJECT (pixbuf));
}
if (type_id == quark_type_stock_item)
{
image = gtk_image_new_from_stock (entry->extra_data, GTK_ICON_SIZE_MENU);
if (image)
gtk_image_menu_item_add_image (GTK_IMAGE_MENU_ITEM (widget), image);
if (gtk_stock_lookup (entry->extra_data, &stock_item))
{
if (!accelerator)
accelerator = gtk_accelerator_name (stock_item.keyval, stock_item.modifier);
}
}
/* install underline accelerators for this item
*/
......@@ -1251,7 +1300,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
}
gtk_item_factory_add_item (ifactory,
path, entry->accelerator,
path, accelerator,
(type_id == quark_type_branch ||
type_id == quark_type_last_branch) ?
(GtkItemFactoryCallback) NULL : entry->callback,
......@@ -1260,6 +1309,9 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
item_type_path,
widget);
if (accelerator != entry->accelerator)
g_free (accelerator);
g_free (path);
}
......
......@@ -110,6 +110,13 @@ struct _GtkItemFactoryEntry
* "<LastBranch>" -> create a right justified item to hold sub items
*/
gchar *item_type;
/* Extra data for some item types:
* ImageItem -> pointer to inline pixbuf + inline pixbuf length
* StockItem -> name of stock item
*/
gpointer extra_data;
guint extra_data2;
};
struct _GtkItemFactoryItem
......
......@@ -190,7 +190,7 @@ create_buttons (void)
button[0] = gtk_button_new_with_label ("button1");
button[1] = gtk_button_new_with_mnemonic ("_button2");
button[2] = gtk_button_new_with_label ("button3");
button[2] = gtk_button_new_with_mnemonic ("_button3");
button[3] = gtk_button_new_from_stock (GTK_STOCK_BUTTON_OK);
button[4] = gtk_button_new_with_label ("button5");
button[5] = gtk_button_new_with_label ("button6");
......@@ -373,7 +373,7 @@ create_check_buttons (void)
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
button = gtk_check_button_new_with_label ("button1");
button = gtk_check_button_new_with_mnemonic ("_button1");
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_check_button_new_with_label ("button2");
......@@ -630,6 +630,21 @@ new_pixmap (char *filename,
return wpixmap;
}
static void
set_toolbar_small_stock (GtkWidget *widget,
gpointer data)
{
gtk_toolbar_set_icon_size (GTK_TOOLBAR (data), GTK_ICON_SIZE_SMALL_TOOLBAR);
}
static void
set_toolbar_large_stock (GtkWidget *widget,
gpointer data)
{
gtk_toolbar_set_icon_size (GTK_TOOLBAR (data), GTK_ICON_SIZE_LARGE_TOOLBAR);
}
static void
set_toolbar_horizontal (GtkWidget *widget,
gpointer data)
......@@ -751,6 +766,16 @@ create_toolbar (void)
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
"Stock icon: New", "Toolbar/New",
(GtkSignalFunc) set_toolbar_small_stock, toolbar, -1);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"Stock icon: Open", "Toolbar/Open",
(GtkSignalFunc) set_toolbar_large_stock, toolbar, -1);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
"Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal",
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
......@@ -2892,6 +2917,10 @@ create_menus (void)
menu = create_menu (1, 5, FALSE);
gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accel_group);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("Accelerate Me");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
......@@ -2966,6 +2995,119 @@ gtk_ifactory_cb (gpointer callback_data,
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
}
/* This file was automatically generated by the make-inline-pixbuf program.
* It contains inline RGB image data.
*/
static const guchar apple[] =
{
/* File magic (1197763408) */
0x47, 0x64, 0x6b, 0x50,
/* Format of following stuff (0) */
0x00, 0x00, 0x00, 0x00,
/* Rowstride (64) */
0x00, 0x00, 0x00, 0x40,
/* Width (16) */
0x00, 0x00, 0x00, 0x10,
/* Height (16) */
0x00, 0x00, 0x00, 0x10,
/* Has an alpha channel (TRUE) */
0x01,
/* Colorspace (0 == RGB, no other options implemented) (0) */
0x00, 0x00, 0x00, 0x00,
/* Number of channels (4) */
0x00, 0x00, 0x00, 0x04,
/* Bits per sample (8) */
0x00, 0x00, 0x00, 0x08,
/* Image data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x14, 0x0f, 0x04,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x5b, 0x2b, 0x6e, 0x7c, 0x61, 0xd9,
0x71, 0x80, 0x63, 0xd7, 0x5f, 0x6b, 0x5b, 0x35, 0x00, 0x00, 0x00, 0x00,
0x3a, 0x35, 0x28, 0x8f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x6c, 0x5c, 0x07, 0x6d, 0x7b, 0x61, 0xd8,
0x75, 0x84, 0x65, 0xf6, 0x76, 0x86, 0x66, 0xf7, 0x6a, 0x77, 0x60, 0xec,
0x5e, 0x6a, 0x58, 0x47, 0x1c, 0x1a, 0x13, 0xa2, 0x4b, 0x47, 0x30, 0x07,
0x55, 0x4e, 0x33, 0x21, 0x48, 0x3e, 0x2a, 0x08, 0xd0, 0xb8, 0x84, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x76, 0x5f, 0x74,
0x75, 0x84, 0x65, 0xf3, 0x67, 0x75, 0x5e, 0xc4, 0x69, 0x62, 0x55, 0x75,
0x94, 0x50, 0x50, 0x69, 0x75, 0x5c, 0x52, 0xb2, 0x69, 0x38, 0x34, 0xa2,
0xa7, 0x5b, 0x53, 0xea, 0xa3, 0x52, 0x4f, 0xff, 0x90, 0x47, 0x42, 0xfa,
0x76, 0x44, 0x36, 0xb9, 0x59, 0x38, 0x29, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x6b, 0x5a, 0x09,
0x69, 0x76, 0x5e, 0xb0, 0x5f, 0x6b, 0x59, 0x57, 0x9a, 0x4b, 0x4d, 0x5b,
0xb8, 0x5f, 0x63, 0xfa, 0xcc, 0x7d, 0x7e, 0xff, 0xc5, 0x69, 0x68, 0xff,
0xc7, 0x6b, 0x67, 0xff, 0xc5, 0x6f, 0x67, 0xff, 0xba, 0x5e, 0x5a, 0xff,
0xb1, 0x4d, 0x4d, 0xff, 0x92, 0x4b, 0x42, 0xff, 0x6a, 0x3e, 0x30, 0xfc,
0x5c, 0x3b, 0x27, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5d, 0x69, 0x57, 0x09, 0x5d, 0x69, 0x57, 0x09, 0x92, 0x47, 0x46, 0x1e,
0xba, 0x65, 0x64, 0xf4, 0xe7, 0xbf, 0xc0, 0xff, 0xdf, 0xa5, 0xa3, 0xff,
0xd4, 0x84, 0x81, 0xff, 0xd1, 0x7c, 0x76, 0xff, 0xc9, 0x78, 0x6d, 0xff,
0xbb, 0x6a, 0x5d, 0xff, 0xb3, 0x5a, 0x52, 0xff, 0x9f, 0x4b, 0x47, 0xff,
0x78, 0x45, 0x35, 0xff, 0x5f, 0x3c, 0x28, 0xfa, 0x53, 0x5a, 0x38, 0x24,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0x54, 0x4d, 0x8c, 0xcf, 0x8e, 0x89, 0xff, 0xe3, 0xb1, 0xae, 0xff,
0xd8, 0x94, 0x8e, 0xff, 0xd3, 0x8a, 0x82, 0xff, 0xcf, 0x80, 0x76, 0xff,
0xc4, 0x75, 0x67, 0xff, 0xb7, 0x6c, 0x5c, 0xff, 0xab, 0x5e, 0x51, 0xff,
0x9c, 0x4c, 0x46, 0xff, 0x7e, 0x4a, 0x3a, 0xff, 0x5c, 0x3c, 0x26, 0xff,
0x58, 0x3d, 0x28, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa2, 0x59, 0x4f, 0xc3, 0xcd, 0x8e, 0x88, 0xff,
0xd3, 0x93, 0x8c, 0xff, 0xd0, 0x8c, 0x83, 0xff, 0xcc, 0x84, 0x79, 0xff,
0xc7, 0x7c, 0x6e, 0xff, 0xbc, 0x73, 0x61, 0xff, 0xb1, 0x6b, 0x59, 0xff,
0xa3, 0x5f, 0x4f, 0xff, 0x93, 0x50, 0x44, 0xff, 0x78, 0x48, 0x35, 0xff,
0x59, 0x3b, 0x25, 0xff, 0x4f, 0x3d, 0x28, 0x4f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x5b, 0x4d, 0xbc,
0xbd, 0x7e, 0x72, 0xff, 0xc6, 0x86, 0x7a, 0xff, 0xc5, 0x7f, 0x72, 0xff,
0xc2, 0x7b, 0x6c, 0xff, 0xbf, 0x77, 0x63, 0xff, 0xb7, 0x72, 0x5b, 0xff,
0xa9, 0x6b, 0x53, 0xff, 0x9a, 0x60, 0x4b, 0xff, 0x8b, 0x56, 0x41, 0xff,
0x6a, 0x44, 0x2e, 0xff, 0x53, 0x38, 0x21, 0xfd, 0x42, 0x4b, 0x2e, 0x1a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8e, 0x57, 0x48, 0x6e, 0xa6, 0x6b, 0x5a, 0xff, 0xb3, 0x74, 0x62, 0xff,
0xb8, 0x75, 0x61, 0xff, 0xba, 0x76, 0x61, 0xff, 0xb7, 0x74, 0x5c, 0xff,
0xae, 0x6e, 0x54, 0xff, 0x9f, 0x67, 0x4c, 0xff, 0x90, 0x5d, 0x43, 0xff,
0x79, 0x4d, 0x38, 0xff, 0x5c, 0x3d, 0x25, 0xff, 0x50, 0x39, 0x23, 0xb8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x78, 0x52, 0x43, 0x07, 0x92, 0x5c, 0x47, 0xdc,
0x9e, 0x64, 0x4e, 0xff, 0xa8, 0x6b, 0x52, 0xff, 0xaa, 0x6d, 0x53, 0xff,
0xa7, 0x6d, 0x50, 0xff, 0x9c, 0x67, 0x4a, 0xff, 0x8e, 0x5d, 0x41, 0xff,
0x7d, 0x54, 0x3a, 0xff, 0x6a, 0x4b, 0x32, 0xff, 0x51, 0x39, 0x23, 0xff,
0x28, 0x20, 0x12, 0x77, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6f, 0x4a, 0x37, 0x2a, 0x81, 0x54, 0x3d, 0xec, 0x8b, 0x5a, 0x41, 0xff,
0x8b, 0x5a, 0x3f, 0xff, 0x85, 0x56, 0x3c, 0xff, 0x7d, 0x52, 0x38, 0xff,
0x77, 0x51, 0x33, 0xff, 0x6f, 0x4e, 0x34, 0xff, 0x5f, 0x45, 0x2c, 0xff,
0x2e, 0x21, 0x14, 0xff, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x92,
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x11, 0x0b, 0x08, 0xb4,
0x50, 0x37, 0x25, 0xfe, 0x6d, 0x49, 0x2f, 0xff, 0x52, 0x37, 0x22, 0xff,
0x50, 0x37, 0x21, 0xff, 0x66, 0x45, 0x2b, 0xff, 0x60, 0x46, 0x2c, 0xff,
0x2d, 0x22, 0x16, 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xd2,
0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x64, 0x09, 0x0a, 0x07, 0xa4,
0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xc4,
0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x6c,
0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d,
0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
static void
dump_accels (gpointer callback_data,
guint callback_action,
......@@ -2976,17 +3118,17 @@ dump_accels (gpointer callback_data,
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/_Dump \"_Accels\"", NULL, dump_accels, 0 },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", NULL, gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_NEW },
{ "/File/_Open", NULL, gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_OPEN },
{ "/File/_Save", NULL, gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
{ "/File/Save _As...", "<control>A", gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
{ "/File/_Dump \"_Accels\"", NULL, dump_accels, 0 },
{ "/File/\\/Test__Escaping/And\\/\n\tWei\\\\rdly",
NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", NULL, gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_QUIT },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
......@@ -2999,6 +3141,7 @@ static GtkItemFactoryEntry menu_items[] =
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
{ "/_Preferences/Shape/_Image", NULL, gtk_ifactory_cb, 0, "<ImageItem>", apple, sizeof(apple) },
/* For testing deletion of menus */
{ "/_Preferences/Should_NotAppear", NULL, 0, 0, "<Branch>" },
......@@ -3006,6 +3149,7 @@ static GtkItemFactoryEntry menu_items[] =
{ "/Preferences/ShouldNotAppear/SubItem2", NULL, gtk_ifactory_cb, 0 },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_Help", NULL, gtk_ifactory_cb, 0, "<StockItem>", GTK_STOCK_HELP},
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
};
......@@ -6783,10 +6927,12 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
GtkWidget *pixwid;
gint i;
char buffer[32];
char accel_buffer[32];
for (i = start; i <= end; i++)
{
sprintf (buffer, "Page %d", i);
sprintf (accel_buffer, "Page _%d", i);
child = gtk_frame_new (buffer);
gtk_container_set_border_width (GTK_CONTAINER (child), 10);
......@@ -6828,10 +6974,10 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
label = gtk_label_new (buffer);
label = gtk_label_new_with_mnemonic (accel_buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box);
menu_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
......@@ -8772,70 +8918,16 @@ scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget)
gint dest_max = widget->allocation.height;
GdkRectangle rect;
GdkEvent *event;
gint dy;
dy = scroll_test_pos - (int)adj->value;
scroll_test_pos = adj->value;
if (!GTK_WIDGET_DRAWABLE (widget))
return;
if (source_min < 0)
{
rect.x = 0;
rect.y = 0;
rect.width = widget->allocation.width;
rect.height = -source_min;
if (rect.height > widget->allocation.height)
rect.height = widget->allocation.height;
source_min = 0;
dest_min = rect.height;
}
else
{
rect.x = 0;
rect.y = 2*widget->allocation.height - source_max;
if (rect.y < 0)
rect.y = 0;
rect.width = widget->allocation.width;
rect.height = widget->allocation.height - rect.y;
source_max = widget->allocation.height;
dest_max = rect.y;
}
if (source_min != source_max)
{
if (scroll_test_gc == NULL)
{
scroll_test_gc = gdk_gc_new (widget->window);
gdk_gc_set_exposures (scroll_test_gc, TRUE);
}
gdk_draw_pixmap (widget->window,
scroll_test_gc,
widget->window,
0, source_min,
0, dest_min,
widget->allocation.width,
source_max - source_min);
/* Make sure graphics expose events are processed before scrolling
* again */
while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
{
gtk_widget_event (widget, event);
if (event->expose.count == 0)
{
gdk_event_free (event);
break;
}
gdk_event_free (event);
}
}
if (rect.height != 0)
gtk_widget_draw (widget, &rect);
gdk_window_scroll (widget->window, 0, dy);
gdk_window_process_updates (widget->window, FALSE);
}
......
......@@ -190,7 +190,7 @@ create_buttons (void)
button[0] = gtk_button_new_with_label ("button1");
button[1] = gtk_button_new_with_mnemonic ("_button2");
button[2] = gtk_button_new_with_label ("button3");
button[2] = gtk_button_new_with_mnemonic ("_button3");
button[3] = gtk_button_new_from_stock (GTK_STOCK_BUTTON_OK);
button[4] = gtk_button_new_with_label ("button5");
button[5] = gtk_button_new_with_label ("button6");
......@@ -373,7 +373,7 @@ create_check_buttons (void)
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
button = gtk_check_button_new_with_label ("button1");
button = gtk_check_button_new_with_mnemonic ("_button1");
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_check_button_new_with_label ("button2");
......@@ -630,6 +630,21 @@ new_pixmap (char *filename,
return wpixmap;
}
static void
set_toolbar_small_stock (GtkWidget *widget,
gpointer data)
{
gtk_toolbar_set_icon_size (GTK_TOOLBAR (data), GTK_ICON_SIZE_SMALL_TOOLBAR);
}
static void
set_toolbar_large_stock (GtkWidget *widget,
gpointer data)
{
gtk_toolbar_set_icon_size (GTK_TOOLBAR (data), GTK_ICON_SIZE_LARGE_TOOLBAR);
}
static void
set_toolbar_horizontal (GtkWidget *widget,
gpointer data)
......@@ -751,6 +766,16 @@ create_toolbar (void)
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
"Stock icon: New", "Toolbar/New",
(GtkSignalFunc) set_toolbar_small_stock, toolbar, -1);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"Stock icon: Open", "Toolbar/Open",
(GtkSignalFunc) set_toolbar_large_stock, toolbar, -1);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
"Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal",
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
......@@ -2892,6 +2917,10 @@ create_menus (void)
menu = create_menu (1, 5, FALSE);
gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, accel_group);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("Accelerate Me");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
......@@ -2966,6 +2995,119 @@ gtk_ifactory_cb (gpointer callback_data,
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
}
/* This file was automatically generated by the make-inline-pixbuf program.
* It contains inline RGB image data.
*/
static const guchar apple[] =
{
/* File magic (1197763408) */
0x47, 0x64, 0x6b, 0x50,
/* Format of following stuff (0) */
0x00, 0x00, 0x00, 0x00,
/* Rowstride (64) */
0x00, 0x00, 0x00, 0x40,
/* Width (16) */
0x00, 0x00, 0x00, 0x10,
/* Height (16) */
0x00, 0x00, 0x00, 0x10,
/* Has an alpha channel (TRUE) */
0x01,
/* Colorspace (0 == RGB, no other options implemented) (0) */
0x00, 0x00, 0x00, 0x00,
/* Number of channels (4) */
0x00, 0x00, 0x00, 0x04,
/* Bits per sample (8) */
0x00, 0x00, 0x00, 0x08,
/* Image data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x14, 0x0f, 0x04,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x5b, 0x2b, 0x6e, 0x7c, 0x61, 0xd9,
0x71, 0x80, 0x63, 0xd7, 0x5f, 0x6b, 0x5b, 0x35, 0x00, 0x00, 0x00, 0x00,
0x3a, 0x35, 0x28, 0x8f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x6c, 0x5c, 0x07, 0x6d, 0x7b, 0x61, 0xd8,
0x75, 0x84, 0x65, 0xf6, 0x76, 0x86, 0x66, 0xf7, 0x6a, 0x77, 0x60, 0xec,
0x5e, 0x6a, 0x58, 0x47, 0x1c, 0x1a, 0x13, 0xa2, 0x4b, 0x47, 0x30, 0x07,
0x55, 0x4e, 0x33, 0x21, 0x48, 0x3e, 0x2a, 0x08, 0xd0, 0xb8, 0x84, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x76, 0x5f, 0x74,
0x75, 0x84, 0x65, 0xf3, 0x67, 0x75, 0x5e, 0xc4, 0x69, 0x62, 0x55, 0x75,
0x94, 0x50, 0x50, 0x69, 0x75, 0x5c, 0x52, 0xb2, 0x69, 0x38, 0x34, 0xa2,
0xa7, 0x5b, 0x53, 0xea, 0xa3, 0x52, 0x4f, 0xff, 0x90, 0x47, 0x42, 0xfa,
0x76, 0x44, 0x36, 0xb9, 0x59, 0x38, 0x29, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x6b, 0x5a, 0x09,
0x69, 0x76, 0x5e, 0xb0, 0x5f, 0x6b, 0x59, 0x57, 0x9a, 0x4b, 0x4d, 0x5b,
0xb8, 0x5f, 0x63, 0xfa, 0xcc, 0x7d, 0x7e, 0xff, 0xc5, 0x69, 0x68, 0xff,
0xc7, 0x6b, 0x67, 0xff, 0xc5, 0x6f, 0x67, 0xff, 0xba, 0x5e, 0x5a, 0xff,
0xb1, 0x4d, 0x4d, 0xff, 0x92, 0x4b, 0x42, 0xff, 0x6a, 0x3e, 0x30, 0xfc,
0x5c, 0x3b, 0x27, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5d, 0x69, 0x57, 0x09, 0x5d, 0x69, 0x57, 0x09, 0x92, 0x47, 0x46, 0x1e,
0xba, 0x65, 0x64, 0xf4, 0xe7, 0xbf, 0xc0, 0xff, 0xdf, 0xa5, 0xa3, 0xff,
0xd4, 0x84, 0x81, 0xff, 0xd1, 0x7c, 0x76, 0xff, 0xc9, 0x78, 0x6d, 0xff,
0xbb, 0x6a, 0x5d, 0xff, 0xb3, 0x5a, 0x52, 0xff, 0x9f, 0x4b, 0x47, 0xff,
0x78, 0x45, 0x35, 0xff, 0x5f, 0x3c, 0x28, 0xfa, 0x53, 0x5a, 0x38, 0x24,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0x54, 0x4d, 0x8c,