mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 20:30:15 +00:00
Added "orientation_changed" and "style_changed" signals to GtkToolbar.
Fixed some nits. - Federico
This commit is contained in:
parent
7bac5c59eb
commit
104f72cf95
203
gtk/gtktoolbar.c
203
gtk/gtktoolbar.c
@ -26,6 +26,13 @@
|
|||||||
#define DEFAULT_SPACE_SIZE 5
|
#define DEFAULT_SPACE_SIZE 5
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ORIENTATION_CHANGED,
|
||||||
|
STYLE_CHANGED,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
@ -33,25 +40,42 @@ typedef struct {
|
|||||||
} Child;
|
} Child;
|
||||||
|
|
||||||
|
|
||||||
static void gtk_toolbar_class_init (GtkToolbarClass *class);
|
typedef void (*GtkToolbarSignal1) (GtkObject *object,
|
||||||
static void gtk_toolbar_init (GtkToolbar *toolbar);
|
gint arg1,
|
||||||
static void gtk_toolbar_destroy (GtkObject *object);
|
gpointer data);
|
||||||
static void gtk_toolbar_map (GtkWidget *widget);
|
|
||||||
static void gtk_toolbar_unmap (GtkWidget *widget);
|
static void gtk_toolbar_marshal_signal_1 (GtkObject *object,
|
||||||
static void gtk_toolbar_draw (GtkWidget *widget,
|
GtkSignalFunc func,
|
||||||
GdkRectangle *area);
|
gpointer func_data,
|
||||||
static void gtk_toolbar_size_request (GtkWidget *widget,
|
GtkArg *args);
|
||||||
GtkRequisition *requisition);
|
|
||||||
static void gtk_toolbar_size_allocate (GtkWidget *widget,
|
|
||||||
GtkAllocation *allocation);
|
static void gtk_toolbar_class_init (GtkToolbarClass *class);
|
||||||
static void gtk_toolbar_add (GtkContainer *container,
|
static void gtk_toolbar_init (GtkToolbar *toolbar);
|
||||||
GtkWidget *widget);
|
static void gtk_toolbar_destroy (GtkObject *object);
|
||||||
static void gtk_toolbar_foreach (GtkContainer *container,
|
static void gtk_toolbar_map (GtkWidget *widget);
|
||||||
GtkCallback callback,
|
static void gtk_toolbar_unmap (GtkWidget *widget);
|
||||||
gpointer callback_data);
|
static void gtk_toolbar_draw (GtkWidget *widget,
|
||||||
|
GdkRectangle *area);
|
||||||
|
static void gtk_toolbar_size_request (GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition);
|
||||||
|
static void gtk_toolbar_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation);
|
||||||
|
static void gtk_toolbar_add (GtkContainer *container,
|
||||||
|
GtkWidget *widget);
|
||||||
|
static void gtk_toolbar_foreach (GtkContainer *container,
|
||||||
|
GtkCallback callback,
|
||||||
|
gpointer callback_data);
|
||||||
|
static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
|
||||||
|
GtkOrientation orientation);
|
||||||
|
static void gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
|
||||||
|
GtkToolbarStyle style);
|
||||||
|
|
||||||
|
|
||||||
static GtkContainerClass *parent_class;
|
static GtkContainerClass *parent_class;
|
||||||
|
|
||||||
|
static gint toolbar_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
guint
|
guint
|
||||||
gtk_toolbar_get_type(void)
|
gtk_toolbar_get_type(void)
|
||||||
@ -87,6 +111,25 @@ gtk_toolbar_class_init(GtkToolbarClass *class)
|
|||||||
|
|
||||||
parent_class = gtk_type_class(gtk_container_get_type());
|
parent_class = gtk_type_class(gtk_container_get_type());
|
||||||
|
|
||||||
|
toolbar_signals[ORIENTATION_CHANGED] =
|
||||||
|
gtk_signal_new("orientation_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET(GtkToolbarClass, orientation_changed),
|
||||||
|
gtk_toolbar_marshal_signal_1,
|
||||||
|
GTK_TYPE_NONE, 1,
|
||||||
|
GTK_TYPE_INT);
|
||||||
|
toolbar_signals[STYLE_CHANGED] =
|
||||||
|
gtk_signal_new("style_changed",
|
||||||
|
GTK_RUN_FIRST,
|
||||||
|
object_class->type,
|
||||||
|
GTK_SIGNAL_OFFSET(GtkToolbarClass, style_changed),
|
||||||
|
gtk_toolbar_marshal_signal_1,
|
||||||
|
GTK_TYPE_NONE, 1,
|
||||||
|
GTK_TYPE_INT);
|
||||||
|
|
||||||
|
gtk_object_class_add_signals(object_class, toolbar_signals, LAST_SIGNAL);
|
||||||
|
|
||||||
object_class->destroy = gtk_toolbar_destroy;
|
object_class->destroy = gtk_toolbar_destroy;
|
||||||
|
|
||||||
widget_class->map = gtk_toolbar_map;
|
widget_class->map = gtk_toolbar_map;
|
||||||
@ -97,6 +140,9 @@ gtk_toolbar_class_init(GtkToolbarClass *class)
|
|||||||
|
|
||||||
container_class->add = gtk_toolbar_add;
|
container_class->add = gtk_toolbar_add;
|
||||||
container_class->foreach = gtk_toolbar_foreach;
|
container_class->foreach = gtk_toolbar_foreach;
|
||||||
|
|
||||||
|
class->orientation_changed = gtk_real_toolbar_orientation_changed;
|
||||||
|
class->style_changed = gtk_real_toolbar_style_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -139,7 +185,7 @@ gtk_toolbar_destroy(GtkObject *object)
|
|||||||
|
|
||||||
toolbar = GTK_TOOLBAR(object);
|
toolbar = GTK_TOOLBAR(object);
|
||||||
|
|
||||||
gtk_tooltips_unref(toolbar->tooltips); /* XXX: do I have to unref the tooltips? */
|
gtk_tooltips_unref(toolbar->tooltips); /* XXX: do I have to unref the tooltips to destroy them? */
|
||||||
|
|
||||||
for (children = toolbar->children; children; children = children->next) {
|
for (children = toolbar->children; children; children = children->next) {
|
||||||
child = children->data;
|
child = children->data;
|
||||||
@ -390,6 +436,9 @@ gtk_toolbar_insert_item(GtkToolbar *toolbar,
|
|||||||
gtk_signal_connect(GTK_OBJECT(child->button), "clicked",
|
gtk_signal_connect(GTK_OBJECT(child->button), "clicked",
|
||||||
callback, user_data);
|
callback, user_data);
|
||||||
|
|
||||||
|
if (tooltip_text)
|
||||||
|
gtk_tooltips_set_tips(toolbar->tooltips, child->button, tooltip_text);
|
||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
child->label = gtk_label_new(text);
|
child->label = gtk_label_new(text);
|
||||||
else
|
else
|
||||||
@ -479,3 +528,123 @@ gtk_toolbar_insert_space(GtkToolbar *toolbar,
|
|||||||
if (GTK_WIDGET_VISIBLE(toolbar))
|
if (GTK_WIDGET_VISIBLE(toolbar))
|
||||||
gtk_widget_queue_resize(GTK_WIDGET(toolbar));
|
gtk_widget_queue_resize(GTK_WIDGET(toolbar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_toolbar_set_orientation(GtkToolbar *toolbar,
|
||||||
|
GtkOrientation orientation)
|
||||||
|
{
|
||||||
|
gtk_signal_emit(GTK_OBJECT(toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_toolbar_set_style(GtkToolbar *toolbar,
|
||||||
|
GtkToolbarStyle style)
|
||||||
|
{
|
||||||
|
gtk_signal_emit(GTK_OBJECT(toolbar), toolbar_signals[STYLE_CHANGED], style);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_toolbar_set_space_size(GtkToolbar *toolbar,
|
||||||
|
gint space_size)
|
||||||
|
{
|
||||||
|
g_return_if_fail(toolbar != NULL);
|
||||||
|
g_return_if_fail(GTK_IS_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
if (toolbar->space_size != space_size) {
|
||||||
|
toolbar->space_size = space_size;
|
||||||
|
gtk_widget_queue_resize(GTK_WIDGET(toolbar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_toolbar_set_tooltips(GtkToolbar *toolbar,
|
||||||
|
gint enable)
|
||||||
|
{
|
||||||
|
g_return_if_fail(toolbar != NULL);
|
||||||
|
g_return_if_fail(GTK_IS_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
gtk_tooltips_enable(toolbar->tooltips);
|
||||||
|
else
|
||||||
|
gtk_tooltips_disable(toolbar->tooltips);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_toolbar_marshal_signal_1(GtkObject *object,
|
||||||
|
GtkSignalFunc func,
|
||||||
|
gpointer func_data,
|
||||||
|
GtkArg *args)
|
||||||
|
{
|
||||||
|
GtkToolbarSignal1 rfunc;
|
||||||
|
|
||||||
|
rfunc = (GtkToolbarSignal1) func;
|
||||||
|
|
||||||
|
(*rfunc) (object, GTK_VALUE_ENUM(args[0]), func_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_real_toolbar_orientation_changed(GtkToolbar *toolbar,
|
||||||
|
GtkOrientation orientation)
|
||||||
|
{
|
||||||
|
g_return_if_fail(toolbar != NULL);
|
||||||
|
g_return_if_fail(GTK_IS_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
if (toolbar->orientation != orientation) {
|
||||||
|
toolbar->orientation = orientation;
|
||||||
|
gtk_widget_queue_resize(GTK_WIDGET(toolbar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_real_toolbar_style_changed(GtkToolbar *toolbar,
|
||||||
|
GtkToolbarStyle style)
|
||||||
|
{
|
||||||
|
GList *children;
|
||||||
|
Child *child;
|
||||||
|
|
||||||
|
g_return_if_fail(toolbar != NULL);
|
||||||
|
g_return_if_fail(GTK_IS_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
if (toolbar->style != style) {
|
||||||
|
toolbar->style = style;
|
||||||
|
|
||||||
|
for (children = toolbar->children; children; children = children->next) {
|
||||||
|
child = children->data;
|
||||||
|
|
||||||
|
if (child)
|
||||||
|
switch (style) {
|
||||||
|
case GTK_TOOLBAR_ICONS:
|
||||||
|
if (!GTK_WIDGET_VISIBLE(child->icon))
|
||||||
|
gtk_widget_show(child->icon);
|
||||||
|
|
||||||
|
if (GTK_WIDGET_VISIBLE(child->label))
|
||||||
|
gtk_widget_hide(child->label);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_TOOLBAR_TEXT:
|
||||||
|
if (GTK_WIDGET_VISIBLE(child->icon))
|
||||||
|
gtk_widget_hide(child->icon);
|
||||||
|
|
||||||
|
if (!GTK_WIDGET_VISIBLE(child->label))
|
||||||
|
gtk_widget_show(child->label);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_TOOLBAR_BOTH:
|
||||||
|
if (!GTK_WIDGET_VISIBLE(child->icon))
|
||||||
|
gtk_widget_show(child->icon);
|
||||||
|
|
||||||
|
if (!GTK_WIDGET_VISIBLE(child->label))
|
||||||
|
gtk_widget_show(child->label);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_resize(GTK_WIDGET(toolbar));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -61,36 +61,50 @@ struct _GtkToolbar
|
|||||||
struct _GtkToolbarClass
|
struct _GtkToolbarClass
|
||||||
{
|
{
|
||||||
GtkContainerClass parent_class;
|
GtkContainerClass parent_class;
|
||||||
|
|
||||||
|
void (* orientation_changed) (GtkToolbar *toolbar,
|
||||||
|
GtkOrientation orientation);
|
||||||
|
void (* style_changed) (GtkToolbar *toolbar,
|
||||||
|
GtkToolbarStyle style);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
guint gtk_toolbar_get_type (void);
|
guint gtk_toolbar_get_type (void);
|
||||||
GtkWidget *gtk_toolbar_new (GtkOrientation orientation,
|
GtkWidget *gtk_toolbar_new (GtkOrientation orientation,
|
||||||
GtkToolbarStyle style);
|
GtkToolbarStyle style);
|
||||||
|
|
||||||
void gtk_toolbar_append_item (GtkToolbar *toolbar,
|
void gtk_toolbar_append_item (GtkToolbar *toolbar,
|
||||||
const char *text,
|
const char *text,
|
||||||
const char *tooltip_text,
|
const char *tooltip_text,
|
||||||
GtkPixmap *icon,
|
GtkPixmap *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void gtk_toolbar_prepend_item (GtkToolbar *toolbar,
|
void gtk_toolbar_prepend_item (GtkToolbar *toolbar,
|
||||||
const char *text,
|
const char *text,
|
||||||
const char *tooltip_text,
|
const char *tooltip_text,
|
||||||
GtkPixmap *icon,
|
GtkPixmap *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void gtk_toolbar_insert_item (GtkToolbar *toolbar,
|
void gtk_toolbar_insert_item (GtkToolbar *toolbar,
|
||||||
const char *text,
|
const char *text,
|
||||||
const char *tooltip_text,
|
const char *tooltip_text,
|
||||||
GtkPixmap *icon,
|
GtkPixmap *icon,
|
||||||
GtkSignalFunc callback,
|
GtkSignalFunc callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
gint position);
|
gint position);
|
||||||
void gtk_toolbar_append_space (GtkToolbar *toolbar);
|
void gtk_toolbar_append_space (GtkToolbar *toolbar);
|
||||||
void gtk_toolbar_prepend_space (GtkToolbar *toolbar);
|
void gtk_toolbar_prepend_space (GtkToolbar *toolbar);
|
||||||
void gtk_toolbar_insert_space (GtkToolbar *toolbar,
|
void gtk_toolbar_insert_space (GtkToolbar *toolbar,
|
||||||
gint position);
|
gint position);
|
||||||
|
|
||||||
|
void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
|
||||||
|
GtkOrientation orientation);
|
||||||
|
void gtk_toolbar_set_style (GtkToolbar *toolbar,
|
||||||
|
GtkToolbarStyle style);
|
||||||
|
void gtk_toolbar_set_space_size (GtkToolbar *toolbar,
|
||||||
|
gint space_size);
|
||||||
|
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
|
||||||
|
gint enable);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
193
gtk/testgtk.c
193
gtk/testgtk.c
@ -549,7 +549,9 @@ create_button_box ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
new_pixmap (char *filename, GdkWindow *window, GdkColor *background)
|
new_pixmap (char *filename,
|
||||||
|
GdkWindow *window,
|
||||||
|
GdkColor *background)
|
||||||
{
|
{
|
||||||
GtkWidget *wpixmap;
|
GtkWidget *wpixmap;
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
@ -563,6 +565,69 @@ new_pixmap (char *filename, GdkWindow *window, GdkColor *background)
|
|||||||
return wpixmap;
|
return wpixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_horizontal (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_vertical (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_icons (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_ICONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_text (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_TEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_both (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_BOTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_small_space (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_big_space (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_enable (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_disable (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
create_toolbar (void)
|
create_toolbar (void)
|
||||||
{
|
{
|
||||||
@ -573,6 +638,7 @@ create_toolbar (void)
|
|||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
|
gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
|
||||||
|
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||||
GTK_SIGNAL_FUNC (destroy_window),
|
GTK_SIGNAL_FUNC (destroy_window),
|
||||||
@ -587,31 +653,59 @@ create_toolbar (void)
|
|||||||
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"New", "New document",
|
"Horizontal", "Horizontal toolbar layout",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_horizontal, toolbar);
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Open", "Open existing",
|
"Vertical", "Vertical toolbar layout",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_vertical, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Close", "Close current document",
|
"Icons", "Only show toolbar icons",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_icons, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Text", "Only show toolbar text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_text, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Both", "Show toolbar icons and text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_both, toolbar);
|
||||||
|
|
||||||
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Undo", "Undo screw-up",
|
"Small", "Use small spaces",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_small_space, toolbar);
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Redo", "Redo not-screwup-after-all",
|
"Big", "Use big spaces",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_big_space, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Enable", "Enable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_enable, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Disable", "Disable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_disable, toolbar);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (window), toolbar);
|
gtk_container_add (GTK_CONTAINER (window), toolbar);
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
@ -623,6 +717,74 @@ create_toolbar (void)
|
|||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
make_toolbar (GtkWidget *window)
|
||||||
|
{
|
||||||
|
GtkWidget *toolbar;
|
||||||
|
|
||||||
|
if (!GTK_WIDGET_REALIZED (window))
|
||||||
|
gtk_widget_realize (window);
|
||||||
|
|
||||||
|
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Horizontal", "Horizontal toolbar layout",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_horizontal, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Vertical", "Vertical toolbar layout",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_vertical, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Icons", "Only show toolbar icons",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_icons, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Text", "Only show toolbar text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_text, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Both", "Show toolbar icons and text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_both, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Small", "Use small spaces",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_small_space, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Big", "Use big spaces",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_big_space, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Enable", "Enable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_enable, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Disable", "Disable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_disable, toolbar);
|
||||||
|
|
||||||
|
return toolbar;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
create_handle_box ()
|
create_handle_box ()
|
||||||
{
|
{
|
||||||
@ -650,7 +812,7 @@ create_handle_box ()
|
|||||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||||
gtk_widget_set_usize(hbox, 300, 40);
|
gtk_widget_set_usize(hbox, 300, 40);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
#if 0
|
||||||
#if 0
|
#if 0
|
||||||
button = gtk_toggle_button_new_with_label ("Let's try this");
|
button = gtk_toggle_button_new_with_label ("Let's try this");
|
||||||
#else
|
#else
|
||||||
@ -659,6 +821,13 @@ create_handle_box ()
|
|||||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
gtk_widget_set_usize(button, 250, 40);
|
gtk_widget_set_usize(button, 250, 40);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
GtkWidget *toolbar = make_toolbar (window);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), toolbar);
|
||||||
|
gtk_widget_show (toolbar);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (window))
|
if (!GTK_WIDGET_VISIBLE (window))
|
||||||
|
193
tests/testgtk.c
193
tests/testgtk.c
@ -549,7 +549,9 @@ create_button_box ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
new_pixmap (char *filename, GdkWindow *window, GdkColor *background)
|
new_pixmap (char *filename,
|
||||||
|
GdkWindow *window,
|
||||||
|
GdkColor *background)
|
||||||
{
|
{
|
||||||
GtkWidget *wpixmap;
|
GtkWidget *wpixmap;
|
||||||
GdkPixmap *pixmap;
|
GdkPixmap *pixmap;
|
||||||
@ -563,6 +565,69 @@ new_pixmap (char *filename, GdkWindow *window, GdkColor *background)
|
|||||||
return wpixmap;
|
return wpixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_horizontal (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_vertical (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_icons (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_ICONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_text (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_TEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_both (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_BOTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_small_space (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_big_space (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_enable (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_toolbar_disable (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
create_toolbar (void)
|
create_toolbar (void)
|
||||||
{
|
{
|
||||||
@ -573,6 +638,7 @@ create_toolbar (void)
|
|||||||
{
|
{
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
|
gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
|
||||||
|
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||||
GTK_SIGNAL_FUNC (destroy_window),
|
GTK_SIGNAL_FUNC (destroy_window),
|
||||||
@ -587,31 +653,59 @@ create_toolbar (void)
|
|||||||
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"New", "New document",
|
"Horizontal", "Horizontal toolbar layout",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_horizontal, toolbar);
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Open", "Open existing",
|
"Vertical", "Vertical toolbar layout",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_vertical, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Close", "Close current document",
|
"Icons", "Only show toolbar icons",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_icons, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Text", "Only show toolbar text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_text, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Both", "Show toolbar icons and text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_both, toolbar);
|
||||||
|
|
||||||
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Undo", "Undo screw-up",
|
"Small", "Use small spaces",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_small_space, toolbar);
|
||||||
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
"Redo", "Redo not-screwup-after-all",
|
"Big", "Use big spaces",
|
||||||
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
&window->style->bg[GTK_STATE_NORMAL])),
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
NULL, NULL);
|
(GtkSignalFunc) set_toolbar_big_space, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Enable", "Enable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_enable, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Disable", "Disable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_disable, toolbar);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (window), toolbar);
|
gtk_container_add (GTK_CONTAINER (window), toolbar);
|
||||||
gtk_widget_show (toolbar);
|
gtk_widget_show (toolbar);
|
||||||
@ -623,6 +717,74 @@ create_toolbar (void)
|
|||||||
gtk_widget_destroy (window);
|
gtk_widget_destroy (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
make_toolbar (GtkWidget *window)
|
||||||
|
{
|
||||||
|
GtkWidget *toolbar;
|
||||||
|
|
||||||
|
if (!GTK_WIDGET_REALIZED (window))
|
||||||
|
gtk_widget_realize (window);
|
||||||
|
|
||||||
|
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Horizontal", "Horizontal toolbar layout",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_horizontal, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Vertical", "Vertical toolbar layout",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_vertical, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Icons", "Only show toolbar icons",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_icons, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Text", "Only show toolbar text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_text, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Both", "Show toolbar icons and text",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_both, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Small", "Use small spaces",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_small_space, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Big", "Use big spaces",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_big_space, toolbar);
|
||||||
|
|
||||||
|
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||||
|
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Enable", "Enable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_enable, toolbar);
|
||||||
|
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
|
||||||
|
"Disable", "Disable tooltips",
|
||||||
|
GTK_PIXMAP (new_pixmap ("test.xpm", window->window,
|
||||||
|
&window->style->bg[GTK_STATE_NORMAL])),
|
||||||
|
(GtkSignalFunc) set_toolbar_disable, toolbar);
|
||||||
|
|
||||||
|
return toolbar;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
create_handle_box ()
|
create_handle_box ()
|
||||||
{
|
{
|
||||||
@ -650,7 +812,7 @@ create_handle_box ()
|
|||||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||||
gtk_widget_set_usize(hbox, 300, 40);
|
gtk_widget_set_usize(hbox, 300, 40);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
#if 0
|
||||||
#if 0
|
#if 0
|
||||||
button = gtk_toggle_button_new_with_label ("Let's try this");
|
button = gtk_toggle_button_new_with_label ("Let's try this");
|
||||||
#else
|
#else
|
||||||
@ -659,6 +821,13 @@ create_handle_box ()
|
|||||||
gtk_container_add (GTK_CONTAINER (hbox), button);
|
gtk_container_add (GTK_CONTAINER (hbox), button);
|
||||||
gtk_widget_set_usize(button, 250, 40);
|
gtk_widget_set_usize(button, 250, 40);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
GtkWidget *toolbar = make_toolbar (window);
|
||||||
|
gtk_container_add (GTK_CONTAINER (hbox), toolbar);
|
||||||
|
gtk_widget_show (toolbar);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GTK_WIDGET_VISIBLE (window))
|
if (!GTK_WIDGET_VISIBLE (window))
|
||||||
|
Loading…
Reference in New Issue
Block a user