2009-03-01 05:19:42 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-11-09 02:22:19 +00:00
|
|
|
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
|
|
|
2008-05-29 09:34:53 +00:00
|
|
|
#include <gtk/gtkunixprint.h>
|
2004-09-15 05:03:24 +00:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2004-11-16 05:10:18 +00:00
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include <gdkx.h>
|
2004-08-23 21:22:55 +00:00
|
|
|
#include "widgets.h"
|
2014-10-22 04:55:39 +00:00
|
|
|
#include "gtkgears.h"
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2004-11-16 05:10:18 +00:00
|
|
|
#define SMALL_WIDTH 240
|
|
|
|
#define SMALL_HEIGHT 75
|
|
|
|
#define MEDIUM_WIDTH 240
|
|
|
|
#define MEDIUM_HEIGHT 165
|
|
|
|
#define LARGE_WIDTH 240
|
|
|
|
#define LARGE_HEIGHT 240
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
new_widget_info (const char *name,
|
2004-09-16 04:34:21 +00:00
|
|
|
GtkWidget *widget,
|
|
|
|
WidgetSize size)
|
2004-08-23 21:22:55 +00:00
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
info = g_new0 (WidgetInfo, 1);
|
|
|
|
info->name = g_strdup (name);
|
2004-11-16 05:10:18 +00:00
|
|
|
info->size = size;
|
2004-10-10 20:35:16 +00:00
|
|
|
if (GTK_IS_WINDOW (widget))
|
|
|
|
{
|
|
|
|
info->window = widget;
|
2004-11-16 05:10:18 +00:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (info->window), FALSE);
|
2004-10-10 20:35:16 +00:00
|
|
|
info->include_decorations = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
info->include_decorations = FALSE;
|
|
|
|
gtk_widget_show_all (widget);
|
|
|
|
gtk_container_add (GTK_CONTAINER (info->window), widget);
|
|
|
|
}
|
2004-08-23 21:22:55 +00:00
|
|
|
info->no_focus = TRUE;
|
|
|
|
|
|
|
|
g_signal_connect (info->window, "focus", G_CALLBACK (gtk_true), NULL);
|
2004-09-16 04:34:21 +00:00
|
|
|
|
|
|
|
switch (size)
|
|
|
|
{
|
|
|
|
case SMALL:
|
|
|
|
gtk_widget_set_size_request (info->window,
|
|
|
|
240, 75);
|
|
|
|
break;
|
|
|
|
case MEDIUM:
|
|
|
|
gtk_widget_set_size_request (info->window,
|
|
|
|
240, 165);
|
|
|
|
break;
|
|
|
|
case LARGE:
|
|
|
|
gtk_widget_set_size_request (info->window,
|
|
|
|
240, 240);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
widget = gtk_button_new_with_mnemonic ("_Button");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("button", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2010-11-29 16:23:07 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_switch (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *sw;
|
|
|
|
|
|
|
|
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
|
|
|
sw = gtk_switch_new ();
|
|
|
|
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE);
|
2010-11-29 16:23:07 +00:00
|
|
|
sw = gtk_switch_new ();
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE);
|
2010-11-29 16:23:07 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2010-11-29 16:23:07 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("switch", widget, SMALL);
|
2010-11-29 16:23:07 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_toggle_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_toggle_button_new_with_mnemonic ("_Toggle Button");
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("toggle-button", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_check_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
widget = gtk_check_button_new_with_mnemonic ("_Check Button");
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("check-button", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2006-01-30 15:39:23 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_link_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_link_button_new_with_label ("http://www.gtk.org", "Link Button");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2006-01-30 15:39:23 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("link-button", widget, SMALL);
|
2006-01-30 15:39:23 +00:00
|
|
|
}
|
|
|
|
|
2012-07-14 02:31:34 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_menu_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *image;
|
|
|
|
GtkWidget *menu;
|
2012-08-04 23:11:43 +00:00
|
|
|
GtkWidget *vbox;
|
2012-07-14 02:31:34 +00:00
|
|
|
|
|
|
|
widget = gtk_menu_button_new ();
|
|
|
|
image = gtk_image_new ();
|
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic", GTK_ICON_SIZE_MENU);
|
2016-10-14 14:00:26 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (widget), image);
|
2012-07-14 02:31:34 +00:00
|
|
|
menu = gtk_menu_new ();
|
2012-08-20 21:03:15 +00:00
|
|
|
gtk_menu_button_set_popup (GTK_MENU_BUTTON (widget), menu);
|
2012-07-14 02:31:34 +00:00
|
|
|
|
2012-08-04 23:11:43 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2012-08-04 23:11:43 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Menu Button"), TRUE, TRUE);
|
2012-08-04 23:11:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("menu-button", vbox, SMALL);
|
2012-07-14 02:31:34 +00:00
|
|
|
}
|
|
|
|
|
2011-04-30 03:40:47 +00:00
|
|
|
#define G_TYPE_TEST_PERMISSION (g_test_permission_get_type ())
|
|
|
|
#define G_TEST_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
|
|
|
G_TYPE_TEST_PERMISSION, \
|
|
|
|
GTestPermission))
|
|
|
|
#define G_IS_TEST_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
|
|
|
|
G_TYPE_TEST_PERMISSION))
|
|
|
|
|
|
|
|
typedef struct _GTestPermission GTestPermission;
|
|
|
|
typedef struct _GTestPermissionClass GTestPermissionClass;
|
|
|
|
|
|
|
|
struct _GTestPermission
|
|
|
|
{
|
|
|
|
GPermission parent;
|
|
|
|
|
|
|
|
gboolean success;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GTestPermissionClass
|
|
|
|
{
|
|
|
|
GPermissionClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GTestPermission, g_test_permission, G_TYPE_PERMISSION)
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_test_permission_init (GTestPermission *test)
|
|
|
|
{
|
|
|
|
g_permission_impl_update (G_PERMISSION (test), FALSE, TRUE, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_test_permission_class_init (GTestPermissionClass *class)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_lockbutton (void)
|
|
|
|
{
|
2012-08-04 23:11:43 +00:00
|
|
|
GtkWidget *vbox;
|
2011-04-30 03:40:47 +00:00
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_lock_button_new (g_object_new (G_TYPE_TEST_PERMISSION, NULL));
|
|
|
|
|
2012-08-04 23:11:43 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2012-08-04 23:11:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Lock Button"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2012-08-04 23:11:43 +00:00
|
|
|
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
|
|
|
|
|
|
|
return new_widget_info ("lock-button", vbox, SMALL);
|
2011-04-30 03:40:47 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_entry (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
widget = gtk_entry_new ();
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_entry_set_text (GTK_ENTRY (widget), "Entry");
|
|
|
|
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("entry", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2012-07-14 02:31:34 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_search_entry (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_search_entry_new ();
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2012-07-14 02:31:34 +00:00
|
|
|
gtk_entry_set_placeholder_text (GTK_ENTRY (widget), "Search...");
|
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("search-entry", widget, SMALL);
|
2012-07-14 02:31:34 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_radio (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *radio;
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2004-09-16 04:34:21 +00:00
|
|
|
radio = gtk_radio_button_new_with_mnemonic (NULL, "Radio Button _One");
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
|
2004-09-16 04:34:21 +00:00
|
|
|
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button _Two");
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
|
2004-09-16 04:34:21 +00:00
|
|
|
radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button T_hree");
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("radio-group", widget, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_label (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_label_new ("Label");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("label", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2004-09-15 05:03:24 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_accel_label (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget, *button, *box;
|
|
|
|
GtkAccelGroup *accel_group;
|
|
|
|
|
|
|
|
widget = gtk_accel_label_new ("Accel Label");
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label ("Quit");
|
|
|
|
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (widget), button);
|
|
|
|
gtk_widget_set_no_show_all (button, TRUE);
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (box), widget);
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), button);
|
|
|
|
|
|
|
|
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (widget), button);
|
|
|
|
accel_group = gtk_accel_group_new();
|
|
|
|
|
2004-09-16 04:34:21 +00:00
|
|
|
info = new_widget_info ("accel-label", box, SMALL);
|
2004-09-15 05:03:24 +00:00
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
gtk_widget_add_accelerator (button, "activate", accel_group, GDK_KEY_Q, GDK_CONTROL_MASK,
|
2004-09-15 05:03:24 +00:00
|
|
|
GTK_ACCEL_VISIBLE | GTK_ACCEL_LOCKED);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_combo_box_entry (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
2010-10-14 01:52:27 +00:00
|
|
|
GtkTreeModel *model;
|
|
|
|
|
|
|
|
model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
|
|
|
|
widget = g_object_new (GTK_TYPE_COMBO_BOX,
|
|
|
|
"has-entry", TRUE,
|
|
|
|
"model", model,
|
|
|
|
"entry-text-column", 0,
|
|
|
|
NULL);
|
|
|
|
g_object_unref (model);
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("combo-box-entry", widget, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2004-11-28 05:09:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_combo_box (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2013-04-25 01:56:08 +00:00
|
|
|
GtkCellRenderer *cell;
|
|
|
|
GtkListStore *store;
|
|
|
|
|
|
|
|
widget = gtk_combo_box_new ();
|
|
|
|
gtk_cell_layout_clear (GTK_CELL_LAYOUT (widget));
|
|
|
|
cell = gtk_cell_renderer_text_new ();
|
|
|
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), cell, FALSE);
|
2013-07-17 23:34:22 +00:00
|
|
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), cell, "text", 0, NULL);
|
2013-04-25 01:56:08 +00:00
|
|
|
|
2013-07-17 23:34:22 +00:00
|
|
|
store = gtk_list_store_new (1, G_TYPE_STRING);
|
|
|
|
gtk_list_store_insert_with_values (store, NULL, -1, 0, "Combo Box", -1);
|
2013-04-25 01:56:08 +00:00
|
|
|
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
|
2004-11-28 05:09:55 +00:00
|
|
|
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-11-28 05:09:55 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("combo-box", widget, SMALL);
|
2004-11-28 05:09:55 +00:00
|
|
|
}
|
|
|
|
|
2013-04-25 01:56:08 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_combo_box_text (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_combo_box_text_new ();
|
|
|
|
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Combo Box Text");
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2013-04-25 01:56:08 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
return new_widget_info ("combo-box-text", widget, SMALL);
|
2013-04-25 01:56:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_info_bar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2014-02-13 19:16:17 +00:00
|
|
|
WidgetInfo *info;
|
2013-04-25 01:56:08 +00:00
|
|
|
|
2014-02-13 19:16:17 +00:00
|
|
|
widget = gtk_info_bar_new ();
|
|
|
|
gtk_info_bar_set_show_close_button (GTK_INFO_BAR (widget), TRUE);
|
2013-04-25 01:56:08 +00:00
|
|
|
gtk_info_bar_set_message_type (GTK_INFO_BAR (widget), GTK_MESSAGE_INFO);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (widget))),
|
|
|
|
gtk_label_new ("Info Bar"));
|
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2013-04-25 01:56:08 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
info = new_widget_info ("info-bar", widget, SMALL);
|
2014-02-13 19:16:17 +00:00
|
|
|
|
|
|
|
return info;
|
2013-04-25 01:56:08 +00:00
|
|
|
}
|
2014-06-10 01:09:40 +00:00
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_search_bar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *entry;
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkWidget *box;
|
|
|
|
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
widget = gtk_search_bar_new ();
|
|
|
|
|
|
|
|
entry = gtk_search_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (entry), "Search Bar");
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), entry);
|
|
|
|
gtk_widget_show (entry);
|
|
|
|
|
|
|
|
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (widget), TRUE);
|
|
|
|
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (widget), TRUE);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), widget);
|
|
|
|
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE);
|
2014-06-10 01:09:40 +00:00
|
|
|
|
|
|
|
info = new_widget_info ("search-bar", box, SMALL);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_action_bar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *button;
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkWidget *box;
|
|
|
|
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE);
|
2014-06-10 01:09:40 +00:00
|
|
|
|
|
|
|
widget = gtk_action_bar_new ();
|
|
|
|
|
|
|
|
button = gtk_button_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), button);
|
|
|
|
button = gtk_button_new_from_icon_name ("call-start-symbolic", GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), button);
|
|
|
|
g_object_set (gtk_widget_get_parent (button), "margin", 6, "spacing", 6, NULL);
|
|
|
|
|
|
|
|
gtk_widget_show (widget);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), widget);
|
|
|
|
|
|
|
|
info = new_widget_info ("action-bar", box, SMALL);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2006-03-30 18:52:52 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_recent_chooser_dialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_recent_chooser_dialog_new ("Recent Chooser Dialog",
|
|
|
|
NULL,
|
2013-06-27 01:35:40 +00:00
|
|
|
"Cancel", GTK_RESPONSE_CANCEL,
|
|
|
|
"Open", GTK_RESPONSE_ACCEPT,
|
2006-03-30 18:52:52 +00:00
|
|
|
NULL);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305);
|
|
|
|
|
|
|
|
info = new_widget_info ("recentchooserdialog", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_text_view (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *text_view;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
|
|
|
text_view = gtk_text_view_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), text_view);
|
|
|
|
/* Bad hack to add some size to the widget */
|
|
|
|
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)),
|
2004-09-16 04:34:21 +00:00
|
|
|
"Multiline\nText\n\n", -1);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
2004-09-16 04:34:21 +00:00
|
|
|
|
|
|
|
return new_widget_info ("multiline-text", widget, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_tree_view (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *tree_view;
|
2014-09-07 01:59:23 +00:00
|
|
|
GtkTreeStore *store;
|
2004-08-23 21:22:55 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
2014-09-07 01:59:23 +00:00
|
|
|
store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
|
|
|
|
gtk_tree_store_append (store, &iter, NULL);
|
|
|
|
gtk_tree_store_set (store, &iter, 0, "Line One", 1, FALSE, 2, "A", -1);
|
|
|
|
gtk_tree_store_append (store, &iter, NULL);
|
|
|
|
gtk_tree_store_set (store, &iter, 0, "Line Two", 1, TRUE, 2, "B", -1);
|
|
|
|
gtk_tree_store_append (store, &iter, &iter);
|
|
|
|
gtk_tree_store_set (store, &iter, 0, "Line Three", 1, FALSE, 2, "C", -1);
|
|
|
|
|
|
|
|
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
|
|
|
|
gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (tree_view), TRUE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
|
2014-09-07 01:59:23 +00:00
|
|
|
0, "List",
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_cell_renderer_text_new (),
|
|
|
|
"text", 0, NULL);
|
2014-09-07 01:59:23 +00:00
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
|
|
|
|
1, "and",
|
|
|
|
gtk_cell_renderer_toggle_new (),
|
|
|
|
"active", 1, NULL);
|
|
|
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
|
|
|
|
2, "Tree",
|
|
|
|
g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, "xalign", 0.5, NULL),
|
|
|
|
"text", 2, NULL);
|
|
|
|
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (widget), tree_view);
|
2004-09-16 04:34:21 +00:00
|
|
|
|
|
|
|
info = new_widget_info ("list-and-tree", widget, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
info->no_focus = FALSE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-09-15 05:03:24 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_icon_view (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *icon_view;
|
|
|
|
GtkListStore *list_store;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
|
|
|
list_store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
|
|
|
|
gtk_list_store_append (list_store, &iter);
|
2008-07-03 17:29:39 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_file ("folder.png", NULL);
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_list_store_set (list_store, &iter, 0, "One", 1, pixbuf, -1);
|
|
|
|
gtk_list_store_append (list_store, &iter);
|
2008-07-03 17:29:39 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_file ("gnome.png", NULL);
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_list_store_set (list_store, &iter, 0, "Two", 1, pixbuf, -1);
|
|
|
|
|
|
|
|
icon_view = gtk_icon_view_new();
|
|
|
|
|
|
|
|
gtk_icon_view_set_model (GTK_ICON_VIEW (icon_view), GTK_TREE_MODEL (list_store));
|
|
|
|
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), 0);
|
|
|
|
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), 1);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), icon_view);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE);
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Icon View"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-09-15 05:03:24 +00:00
|
|
|
|
2004-09-16 04:34:21 +00:00
|
|
|
info = new_widget_info ("icon-view", vbox, MEDIUM);
|
2004-09-15 05:03:24 +00:00
|
|
|
info->no_focus = FALSE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_color_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *picker;
|
2016-10-11 11:29:05 +00:00
|
|
|
GdkRGBA color;
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2004-08-23 21:22:55 +00:00
|
|
|
color.red = 0x1e<<8; /* Go Gagne! */
|
|
|
|
color.green = 0x90<<8;
|
|
|
|
color.blue = 0xff<<8;
|
2016-10-11 11:29:05 +00:00
|
|
|
picker = gtk_color_button_new_with_rgba (&color);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Color Button"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2004-09-16 04:34:21 +00:00
|
|
|
return new_widget_info ("color-button", vbox, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_font_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *picker;
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2004-08-23 21:22:55 +00:00
|
|
|
picker = gtk_font_button_new_with_font ("Sans Serif 10");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Font Button"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-08-23 21:22:55 +00:00
|
|
|
|
2004-09-16 04:34:21 +00:00
|
|
|
return new_widget_info ("font-button", vbox, SMALL);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
2004-09-15 05:03:24 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_file_button (void)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
2004-10-24 07:05:00 +00:00
|
|
|
GtkWidget *vbox2;
|
2004-09-15 05:03:24 +00:00
|
|
|
GtkWidget *picker;
|
2013-06-27 01:35:40 +00:00
|
|
|
char *path;
|
2004-09-15 05:03:24 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
|
|
|
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2004-12-15 14:58:39 +00:00
|
|
|
picker = gtk_file_chooser_button_new ("File Chooser Button",
|
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN);
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_widget_set_size_request (picker, 150, -1);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), picker, FALSE, FALSE);
|
2004-10-24 07:05:00 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2),
|
2004-12-15 14:58:39 +00:00
|
|
|
gtk_label_new ("File Button (Files)"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-24 07:05:00 +00:00
|
|
|
|
2004-09-15 05:03:24 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2016-10-02 15:37:22 +00:00
|
|
|
vbox2, TRUE, TRUE);
|
2004-10-24 07:05:00 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2010-10-29 23:32:34 +00:00
|
|
|
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-09-15 05:03:24 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2004-12-15 14:58:39 +00:00
|
|
|
picker = gtk_file_chooser_button_new ("File Chooser Button",
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
2004-10-24 07:05:00 +00:00
|
|
|
gtk_widget_set_size_request (picker, 150, -1);
|
2013-06-27 01:35:40 +00:00
|
|
|
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
|
|
|
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (picker), path);
|
|
|
|
g_free (path);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), picker, FALSE, FALSE);
|
2004-10-24 07:05:00 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2),
|
2004-12-15 14:58:39 +00:00
|
|
|
gtk_label_new ("File Button (Select Folder)"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-24 07:05:00 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2016-10-02 15:37:22 +00:00
|
|
|
vbox2, TRUE, TRUE);
|
2004-10-24 07:05:00 +00:00
|
|
|
|
|
|
|
return new_widget_info ("file-button", vbox, MEDIUM);
|
2004-09-15 05:03:24 +00:00
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_separator (void)
|
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
2010-10-29 23:32:34 +00:00
|
|
|
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL),
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
2010-10-29 23:32:34 +00:00
|
|
|
gtk_separator_new (GTK_ORIENTATION_VERTICAL),
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2004-09-16 04:34:21 +00:00
|
|
|
g_object_new (GTK_TYPE_LABEL,
|
|
|
|
"label", "Horizontal and Vertical\nSeparators",
|
|
|
|
"justify", GTK_JUSTIFY_CENTER,
|
|
|
|
NULL),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-09 05:52:44 +00:00
|
|
|
return new_widget_info ("separator", vbox, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_panes (void)
|
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *pane;
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
2010-10-29 23:47:13 +00:00
|
|
|
pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_paned_pack1 (GTK_PANED (pane),
|
|
|
|
g_object_new (GTK_TYPE_FRAME,
|
2013-04-25 01:56:08 +00:00
|
|
|
"shadow-type", GTK_SHADOW_IN,
|
2004-08-23 21:22:55 +00:00
|
|
|
NULL),
|
|
|
|
FALSE, FALSE);
|
|
|
|
gtk_paned_pack2 (GTK_PANED (pane),
|
|
|
|
g_object_new (GTK_TYPE_FRAME,
|
2013-04-25 01:56:08 +00:00
|
|
|
"shadow-type", GTK_SHADOW_IN,
|
2004-08-23 21:22:55 +00:00
|
|
|
NULL),
|
|
|
|
FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
|
|
|
pane,
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
2010-10-29 23:47:13 +00:00
|
|
|
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_paned_pack1 (GTK_PANED (pane),
|
|
|
|
g_object_new (GTK_TYPE_FRAME,
|
2013-04-25 01:56:08 +00:00
|
|
|
"shadow-type", GTK_SHADOW_IN,
|
2004-08-23 21:22:55 +00:00
|
|
|
NULL),
|
|
|
|
FALSE, FALSE);
|
|
|
|
gtk_paned_pack2 (GTK_PANED (pane),
|
|
|
|
g_object_new (GTK_TYPE_FRAME,
|
2013-04-25 01:56:08 +00:00
|
|
|
"shadow-type", GTK_SHADOW_IN,
|
2004-08-23 21:22:55 +00:00
|
|
|
NULL),
|
|
|
|
FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
|
|
|
pane,
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
|
2004-08-23 21:22:55 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2004-09-16 04:34:21 +00:00
|
|
|
g_object_new (GTK_TYPE_LABEL,
|
|
|
|
"label", "Horizontal and Vertical\nPanes",
|
|
|
|
"justify", GTK_JUSTIFY_CENTER,
|
|
|
|
NULL),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-09 05:52:44 +00:00
|
|
|
return new_widget_info ("panes", vbox, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_frame (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_frame_new ("Frame");
|
|
|
|
|
2004-09-16 04:34:21 +00:00
|
|
|
return new_widget_info ("frame", widget, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_window (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
2004-11-16 05:10:18 +00:00
|
|
|
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
2004-09-16 04:34:21 +00:00
|
|
|
info = new_widget_info ("window", widget, MEDIUM);
|
2004-08-23 21:22:55 +00:00
|
|
|
info->include_decorations = TRUE;
|
|
|
|
gtk_window_set_title (GTK_WINDOW (info->window), "Window");
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-12-07 06:22:19 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_filesel (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_file_chooser_dialog_new ("File Chooser Dialog",
|
|
|
|
NULL,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
2013-06-27 01:35:40 +00:00
|
|
|
"Cancel", GTK_RESPONSE_CANCEL,
|
|
|
|
"Open", GTK_RESPONSE_ACCEPT,
|
2004-12-07 06:22:19 +00:00
|
|
|
NULL);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305);
|
|
|
|
|
|
|
|
info = new_widget_info ("filechooser", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_print_dialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_print_unix_dialog_new ("Print Dialog", NULL);
|
|
|
|
gtk_widget_set_size_request (widget, 505, 350);
|
|
|
|
info = new_widget_info ("printdialog", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_page_setup_dialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkPageSetup *page_setup;
|
|
|
|
GtkPrintSettings *settings;
|
|
|
|
|
|
|
|
page_setup = gtk_page_setup_new ();
|
|
|
|
settings = gtk_print_settings_new ();
|
|
|
|
widget = gtk_page_setup_unix_dialog_new ("Page Setup Dialog", NULL);
|
|
|
|
gtk_page_setup_unix_dialog_set_page_setup (GTK_PAGE_SETUP_UNIX_DIALOG (widget),
|
|
|
|
page_setup);
|
|
|
|
gtk_page_setup_unix_dialog_set_print_settings (GTK_PAGE_SETUP_UNIX_DIALOG (widget),
|
|
|
|
settings);
|
|
|
|
|
|
|
|
info = new_widget_info ("pagesetupdialog", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-10-10 20:35:16 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_toolbar (void)
|
|
|
|
{
|
2013-07-17 19:04:20 +00:00
|
|
|
GtkWidget *widget;
|
2004-10-10 20:35:16 +00:00
|
|
|
GtkToolItem *item;
|
|
|
|
|
|
|
|
widget = gtk_toolbar_new ();
|
|
|
|
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-new");
|
2004-10-10 20:35:16 +00:00
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (widget), item, -1);
|
|
|
|
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
|
2004-10-10 20:35:16 +00:00
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (widget), item, -1);
|
|
|
|
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "view-refresh");
|
2004-10-10 20:35:16 +00:00
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (widget), item, -1);
|
|
|
|
|
|
|
|
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (widget), FALSE);
|
|
|
|
|
|
|
|
return new_widget_info ("toolbar", widget, SMALL);
|
|
|
|
}
|
|
|
|
|
2009-11-27 04:52:20 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_toolpalette (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget, *group;
|
|
|
|
GtkToolItem *item;
|
|
|
|
|
|
|
|
widget = gtk_tool_palette_new ();
|
|
|
|
group = gtk_tool_item_group_new ("Tools");
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), group);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "help-about");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-new");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "folder");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
|
|
|
|
group = gtk_tool_item_group_new ("More tools");
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), group);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "edit-cut");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "edit-find");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
2013-06-27 01:35:40 +00:00
|
|
|
item = gtk_tool_button_new (NULL, NULL);
|
|
|
|
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-properties");
|
2009-11-27 04:52:20 +00:00
|
|
|
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
|
|
|
|
|
|
|
|
return new_widget_info ("toolpalette", widget, MEDIUM);
|
|
|
|
}
|
|
|
|
|
2004-10-10 20:35:16 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_menubar (void)
|
|
|
|
{
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *widget, *vbox, *item;
|
2004-10-10 20:35:16 +00:00
|
|
|
|
|
|
|
widget = gtk_menu_bar_new ();
|
|
|
|
|
|
|
|
item = gtk_menu_item_new_with_mnemonic ("_File");
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
|
|
|
|
|
|
|
item = gtk_menu_item_new_with_mnemonic ("_Edit");
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
|
|
|
|
|
|
|
item = gtk_menu_item_new_with_mnemonic ("_Help");
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2004-10-10 20:35:16 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Menu Bar"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-10 20:35:16 +00:00
|
|
|
|
|
|
|
return new_widget_info ("menubar", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_message_dialog (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_message_dialog_new (NULL,
|
|
|
|
0,
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_OK,
|
|
|
|
NULL);
|
2010-08-21 01:08:15 +00:00
|
|
|
gtk_window_set_icon_name (GTK_WINDOW (widget), "edit-copy");
|
2014-02-13 19:51:31 +00:00
|
|
|
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (widget), "Message Dialog");
|
|
|
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget), "%s", "With secondary text");
|
2009-03-01 05:19:42 +00:00
|
|
|
return new_widget_info ("messagedialog", widget, ASIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_about_dialog (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
const gchar *authors[] = {
|
|
|
|
"Peter Mattis",
|
|
|
|
"Spencer Kimball",
|
|
|
|
"Josh MacDonald",
|
|
|
|
"and many more...",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
widget = gtk_about_dialog_new ();
|
|
|
|
g_object_set (widget,
|
|
|
|
"program-name", "GTK+ Code Demos",
|
|
|
|
"version", PACKAGE_VERSION,
|
2013-07-17 19:06:15 +00:00
|
|
|
"copyright", "© 1997-2013 The GTK+ Team",
|
2009-03-01 05:19:42 +00:00
|
|
|
"website", "http://www.gtk.org",
|
|
|
|
"comments", "Program to demonstrate GTK+ functions.",
|
2010-08-21 01:08:15 +00:00
|
|
|
"logo-icon-name", "help-about",
|
2009-03-01 05:19:42 +00:00
|
|
|
"title", "About GTK+ Code Demos",
|
|
|
|
"authors", authors,
|
|
|
|
NULL);
|
2010-08-21 01:08:15 +00:00
|
|
|
gtk_window_set_icon_name (GTK_WINDOW (widget), "help-about");
|
2009-03-01 05:19:42 +00:00
|
|
|
return new_widget_info ("aboutdialog", widget, ASIS);
|
2004-10-10 20:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_notebook (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_notebook_new ();
|
|
|
|
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (widget),
|
|
|
|
gtk_label_new ("Notebook"),
|
|
|
|
NULL);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (widget), gtk_event_box_new (), NULL);
|
|
|
|
gtk_notebook_append_page (GTK_NOTEBOOK (widget), gtk_event_box_new (), NULL);
|
|
|
|
|
|
|
|
return new_widget_info ("notebook", widget, MEDIUM);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_progressbar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_progress_bar_new ();
|
|
|
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), 0.5);
|
2004-10-11 15:14:27 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2004-10-10 20:35:16 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Progress Bar"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-10 20:35:16 +00:00
|
|
|
|
|
|
|
return new_widget_info ("progressbar", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
2012-08-04 23:11:43 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_level_bar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_level_bar_new ();
|
|
|
|
gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), 0.333);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, FALSE);
|
2012-08-04 23:11:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Level Bar"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2012-08-04 23:11:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("levelbar", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
2004-10-11 15:14:27 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_scrolledwindow (void)
|
|
|
|
{
|
|
|
|
GtkWidget *scrolledwin, *label;
|
|
|
|
|
|
|
|
scrolledwin = gtk_scrolled_window_new (NULL, NULL);
|
2013-04-25 01:56:08 +00:00
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin),
|
2013-07-17 19:03:49 +00:00
|
|
|
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
2004-10-11 15:14:27 +00:00
|
|
|
label = gtk_label_new ("Scrolled Window");
|
|
|
|
|
2013-02-01 16:22:13 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (scrolledwin), label);
|
2004-10-11 15:14:27 +00:00
|
|
|
|
|
|
|
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
|
|
|
|
}
|
|
|
|
|
2013-04-25 01:56:08 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_scrollbar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2013-04-25 01:56:08 +00:00
|
|
|
|
|
|
|
widget = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
|
|
|
gtk_widget_set_size_request (widget, 100, -1);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2013-04-25 01:56:08 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Scrollbar"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2013-04-25 01:56:08 +00:00
|
|
|
|
|
|
|
return new_widget_info ("scrollbar", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
2004-10-11 15:14:27 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_spinbutton (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2004-10-11 15:14:27 +00:00
|
|
|
|
|
|
|
widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2004-10-11 15:14:27 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Spin Button"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-11 15:14:27 +00:00
|
|
|
|
|
|
|
return new_widget_info ("spinbutton", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_statusbar (void)
|
|
|
|
{
|
2004-11-16 05:10:18 +00:00
|
|
|
WidgetInfo *info;
|
2004-10-11 15:14:27 +00:00
|
|
|
GtkWidget *widget;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2004-10-11 15:14:27 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2004-11-16 05:10:18 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_label_new ("Status Bar"),
|
|
|
|
FALSE, FALSE);
|
2004-10-11 15:14:27 +00:00
|
|
|
widget = gtk_statusbar_new ();
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
2004-10-11 15:14:27 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "Hold on...");
|
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2004-11-16 05:10:18 +00:00
|
|
|
|
|
|
|
info = new_widget_info ("statusbar", vbox, SMALL);
|
2004-10-11 15:14:27 +00:00
|
|
|
|
2004-11-16 05:10:18 +00:00
|
|
|
return info;
|
2004-10-11 15:14:27 +00:00
|
|
|
}
|
|
|
|
|
2004-10-11 16:07:34 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_scales (void)
|
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
2004-10-11 16:07:34 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
2010-10-30 00:01:27 +00:00
|
|
|
gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
0.0, 100.0, 1.0),
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
2004-10-11 16:07:34 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox),
|
2010-10-30 00:01:27 +00:00
|
|
|
gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL,
|
|
|
|
0.0, 100.0, 1.0),
|
2016-10-02 15:37:22 +00:00
|
|
|
TRUE, TRUE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE);
|
2004-10-11 16:07:34 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
g_object_new (GTK_TYPE_LABEL,
|
|
|
|
"label", "Horizontal and Vertical\nScales",
|
|
|
|
"justify", GTK_JUSTIFY_CENTER,
|
|
|
|
NULL),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-11 16:07:34 +00:00
|
|
|
return new_widget_info ("scales", vbox, MEDIUM);}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_image (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2004-10-11 16:07:34 +00:00
|
|
|
|
2013-07-17 21:53:03 +00:00
|
|
|
widget = gtk_image_new_from_icon_name ("applications-graphics",
|
|
|
|
GTK_ICON_SIZE_DIALOG);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
2004-10-11 16:07:34 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2004-10-11 16:07:34 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Image"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2004-10-11 16:07:34 +00:00
|
|
|
|
|
|
|
return new_widget_info ("image", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
2009-10-14 17:52:52 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_spinner (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2009-10-14 17:52:52 +00:00
|
|
|
|
|
|
|
widget = gtk_spinner_new ();
|
|
|
|
gtk_widget_set_size_request (widget, 24, 24);
|
2013-07-17 23:11:16 +00:00
|
|
|
gtk_spinner_start (GTK_SPINNER (widget));
|
2009-10-14 17:52:52 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2009-10-14 17:52:52 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Spinner"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2009-10-14 17:52:52 +00:00
|
|
|
|
|
|
|
return new_widget_info ("spinner", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
2007-06-03 05:34:56 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_volume_button (void)
|
|
|
|
{
|
2014-02-13 09:01:41 +00:00
|
|
|
GtkWidget *button, *box;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *popup;
|
|
|
|
|
|
|
|
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_widget_set_size_request (widget, 100, 250);
|
|
|
|
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), box);
|
2007-06-03 05:34:56 +00:00
|
|
|
|
|
|
|
button = gtk_volume_button_new ();
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE);
|
2014-02-13 09:01:41 +00:00
|
|
|
|
2007-06-03 05:34:56 +00:00
|
|
|
gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 33);
|
2014-02-13 09:01:41 +00:00
|
|
|
popup = gtk_scale_button_get_popup (GTK_SCALE_BUTTON (button));
|
|
|
|
gtk_widget_realize (widget);
|
|
|
|
gtk_widget_show (box);
|
|
|
|
gtk_widget_show (popup);
|
|
|
|
|
2007-06-03 05:34:56 +00:00
|
|
|
return new_widget_info ("volumebutton", widget, ASIS);
|
|
|
|
}
|
|
|
|
|
2006-01-30 04:53:53 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_assistant (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *page1, *page2;
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
widget = gtk_assistant_new ();
|
|
|
|
gtk_window_set_title (GTK_WINDOW (widget), "Assistant");
|
|
|
|
|
|
|
|
page1 = gtk_label_new ("Assistant");
|
|
|
|
gtk_widget_show (page1);
|
|
|
|
gtk_widget_set_size_request (page1, 300, 140);
|
|
|
|
gtk_assistant_prepend_page (GTK_ASSISTANT (widget), page1);
|
|
|
|
gtk_assistant_set_page_title (GTK_ASSISTANT (widget), page1, "Assistant page");
|
|
|
|
gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page1, TRUE);
|
|
|
|
|
|
|
|
page2 = gtk_label_new (NULL);
|
|
|
|
gtk_widget_show (page2);
|
|
|
|
gtk_assistant_append_page (GTK_ASSISTANT (widget), page2);
|
|
|
|
gtk_assistant_set_page_type (GTK_ASSISTANT (widget), page2, GTK_ASSISTANT_PAGE_CONFIRM);
|
|
|
|
|
|
|
|
info = new_widget_info ("assistant", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2011-01-06 07:07:35 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_appchooserbutton (void)
|
|
|
|
{
|
|
|
|
GtkWidget *picker;
|
2016-10-15 15:43:56 +00:00
|
|
|
GtkWidget *vbox;
|
2011-01-06 07:07:35 +00:00
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
|
|
|
picker = gtk_app_chooser_button_new ("text/plain");
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), picker, FALSE, FALSE);
|
2011-01-06 07:07:35 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Application Button"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2011-01-06 07:07:35 +00:00
|
|
|
|
|
|
|
return new_widget_info ("appchooserbutton", vbox, SMALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_appchooserdialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "image/png");
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (widget), 200, 300);
|
|
|
|
|
|
|
|
info = new_widget_info ("appchooserdialog", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2012-02-15 04:48:36 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_fontchooserdialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_font_chooser_dialog_new ("Font Chooser Dialog", NULL);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (widget), 200, 300);
|
|
|
|
info = new_widget_info ("fontchooser", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_colorchooserdialog (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
widget = gtk_color_chooser_dialog_new ("Color Chooser Dialog", NULL);
|
|
|
|
info = new_widget_info ("colorchooser", widget, ASIS);
|
|
|
|
info->include_decorations = TRUE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2013-05-27 20:40:43 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_headerbar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *bar;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_widget_set_size_request (window, 220, 150);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), view);
|
|
|
|
bar = gtk_header_bar_new ();
|
|
|
|
gtk_header_bar_set_title (GTK_HEADER_BAR (bar), "Header Bar");
|
|
|
|
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (bar), "(subtitle)");
|
|
|
|
gtk_window_set_titlebar (GTK_WINDOW (window), bar);
|
|
|
|
button = gtk_button_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic", GTK_ICON_SIZE_BUTTON));
|
|
|
|
gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button);
|
2014-02-25 22:44:06 +00:00
|
|
|
gtk_widget_show_all (bar);
|
2013-05-27 20:40:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("headerbar", window, ASIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_placessidebar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *bar;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
|
|
|
|
bar = gtk_places_sidebar_new ();
|
|
|
|
gtk_widget_set_size_request (bar, 150, 300);
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_widget_set_halign (bar, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (bar, GTK_ALIGN_CENTER);
|
2013-05-27 20:40:43 +00:00
|
|
|
|
2016-10-15 15:43:56 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Places Sidebar"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("placessidebar", vbox, ASIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_stack (void)
|
|
|
|
{
|
|
|
|
GtkWidget *stack;
|
|
|
|
GtkWidget *switcher;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *view;
|
|
|
|
|
|
|
|
stack = gtk_stack_new ();
|
|
|
|
gtk_widget_set_margin_top (stack, 10);
|
|
|
|
gtk_widget_set_margin_bottom (stack, 10);
|
|
|
|
gtk_widget_set_size_request (stack, 120, 120);
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1");
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2");
|
|
|
|
|
|
|
|
switcher = gtk_stack_switcher_new ();
|
|
|
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack));
|
|
|
|
gtk_widget_set_halign (switcher, GTK_ALIGN_CENTER);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Stack"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("stack", vbox, ASIS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static WidgetInfo *
|
|
|
|
create_stack_switcher (void)
|
|
|
|
{
|
|
|
|
GtkWidget *stack;
|
|
|
|
GtkWidget *switcher;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *view;
|
|
|
|
|
|
|
|
stack = gtk_stack_new ();
|
|
|
|
gtk_widget_set_margin_top (stack, 10);
|
|
|
|
gtk_widget_set_margin_bottom (stack, 10);
|
|
|
|
gtk_widget_set_size_request (stack, 120, 120);
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1");
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2");
|
|
|
|
|
|
|
|
switcher = gtk_stack_switcher_new ();
|
|
|
|
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack));
|
|
|
|
gtk_widget_set_halign (switcher, GTK_ALIGN_CENTER);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), switcher, FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), stack, FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_label_new ("Stack Switcher"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2013-05-27 20:40:43 +00:00
|
|
|
|
|
|
|
return new_widget_info ("stackswitcher", vbox, ASIS);
|
|
|
|
}
|
|
|
|
|
2014-10-22 05:11:34 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_sidebar (void)
|
|
|
|
{
|
|
|
|
GtkWidget *stack;
|
|
|
|
GtkWidget *sidebar;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
|
|
|
stack = gtk_stack_new ();
|
|
|
|
gtk_widget_set_size_request (stack, 120, 120);
|
|
|
|
view = gtk_label_new ("Sidebar");
|
|
|
|
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
|
|
|
|
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1");
|
|
|
|
view = gtk_text_view_new ();
|
|
|
|
gtk_widget_show (view);
|
|
|
|
gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2");
|
|
|
|
|
2015-02-12 17:09:13 +00:00
|
|
|
sidebar = gtk_stack_sidebar_new ();
|
|
|
|
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
|
2014-10-22 05:11:34 +00:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), sidebar, FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL), FALSE, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE);
|
2014-10-22 05:11:34 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
|
|
|
|
|
|
return new_widget_info ("sidebar", frame, ASIS);
|
|
|
|
}
|
|
|
|
|
2013-06-30 05:28:37 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_list_box (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *list;
|
|
|
|
GtkWidget *row;
|
|
|
|
GtkWidget *button;
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
list = gtk_list_box_new ();
|
|
|
|
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_BROWSE);
|
|
|
|
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
|
|
|
button = gtk_label_new ("List Box");
|
|
|
|
gtk_widget_set_hexpand (button, TRUE);
|
|
|
|
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (list), row);
|
|
|
|
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line One"));
|
|
|
|
button = gtk_check_button_new ();
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
gtk_widget_set_hexpand (button, TRUE);
|
|
|
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (list), row);
|
2013-07-08 14:17:18 +00:00
|
|
|
gtk_list_box_select_row (GTK_LIST_BOX (list), GTK_LIST_BOX_ROW (gtk_widget_get_parent (row)));
|
2013-06-30 05:28:37 +00:00
|
|
|
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Two"));
|
|
|
|
button = gtk_button_new_with_label ("2");
|
|
|
|
gtk_widget_set_hexpand (button, TRUE);
|
|
|
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (list), row);
|
|
|
|
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), gtk_label_new ("Line Three"));
|
|
|
|
button = gtk_entry_new ();
|
|
|
|
gtk_widget_set_hexpand (button, TRUE);
|
|
|
|
gtk_widget_set_halign (button, GTK_ALIGN_END);
|
|
|
|
gtk_container_add (GTK_CONTAINER (row), button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (list), row);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), list);
|
|
|
|
|
|
|
|
info = new_widget_info ("list-box", widget, MEDIUM);
|
|
|
|
info->no_focus = FALSE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2013-09-29 17:43:27 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_flow_box (void)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *box;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *child;
|
|
|
|
GtkWidget *button;
|
|
|
|
WidgetInfo *info;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
box = gtk_flow_box_new ();
|
|
|
|
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 2);
|
|
|
|
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (box), 2);
|
|
|
|
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_BROWSE);
|
|
|
|
button = gtk_label_new ("Child One");
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), button);
|
|
|
|
button = gtk_button_new_with_label ("Child Two");
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), button);
|
|
|
|
child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (child), gtk_label_new ("Child Three"));
|
|
|
|
button = gtk_check_button_new ();
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (child), button);
|
|
|
|
gtk_container_add (GTK_CONTAINER (box), child);
|
|
|
|
gtk_flow_box_select_child (GTK_FLOW_BOX (box),
|
|
|
|
GTK_FLOW_BOX_CHILD (gtk_widget_get_parent (child)));
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), box);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
|
|
|
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE);
|
2013-09-29 17:43:27 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Flow Box"),
|
2016-10-02 15:37:22 +00:00
|
|
|
FALSE, FALSE);
|
2013-09-29 17:43:27 +00:00
|
|
|
info = new_widget_info ("flow-box", vbox, ASIS);
|
|
|
|
info->no_focus = FALSE;
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2014-10-22 04:55:39 +00:00
|
|
|
static WidgetInfo *
|
|
|
|
create_gl_area (void)
|
|
|
|
{
|
|
|
|
WidgetInfo *info;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *gears;
|
|
|
|
|
|
|
|
widget = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
|
|
|
|
|
|
|
gears = gtk_gears_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (widget), gears);
|
|
|
|
|
|
|
|
info = new_widget_info ("glarea", widget, MEDIUM);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
GList *
|
|
|
|
get_all_widgets (void)
|
|
|
|
{
|
|
|
|
GList *retval = NULL;
|
2004-10-11 15:15:29 +00:00
|
|
|
|
2014-06-10 01:09:40 +00:00
|
|
|
retval = g_list_prepend (retval, create_search_bar ());
|
|
|
|
retval = g_list_prepend (retval, create_action_bar ());
|
2013-06-30 05:28:37 +00:00
|
|
|
retval = g_list_prepend (retval, create_list_box());
|
2013-09-29 17:43:27 +00:00
|
|
|
retval = g_list_prepend (retval, create_flow_box());
|
2013-05-27 20:40:43 +00:00
|
|
|
retval = g_list_prepend (retval, create_headerbar ());
|
|
|
|
retval = g_list_prepend (retval, create_placessidebar ());
|
|
|
|
retval = g_list_prepend (retval, create_stack ());
|
|
|
|
retval = g_list_prepend (retval, create_stack_switcher ());
|
2009-11-27 04:52:20 +00:00
|
|
|
retval = g_list_prepend (retval, create_toolpalette ());
|
2009-10-14 17:52:52 +00:00
|
|
|
retval = g_list_prepend (retval, create_spinner ());
|
2009-03-01 05:19:42 +00:00
|
|
|
retval = g_list_prepend (retval, create_about_dialog ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_accel_label ());
|
2004-08-23 21:22:55 +00:00
|
|
|
retval = g_list_prepend (retval, create_button ());
|
|
|
|
retval = g_list_prepend (retval, create_check_button ());
|
|
|
|
retval = g_list_prepend (retval, create_color_button ());
|
2004-11-28 05:09:55 +00:00
|
|
|
retval = g_list_prepend (retval, create_combo_box ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_combo_box_entry ());
|
2013-04-25 01:56:08 +00:00
|
|
|
retval = g_list_prepend (retval, create_combo_box_text ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_entry ());
|
2005-07-05 23:00:12 +00:00
|
|
|
retval = g_list_prepend (retval, create_file_button ());
|
2004-08-23 21:22:55 +00:00
|
|
|
retval = g_list_prepend (retval, create_font_button ());
|
|
|
|
retval = g_list_prepend (retval, create_frame ());
|
2004-09-15 05:03:24 +00:00
|
|
|
retval = g_list_prepend (retval, create_icon_view ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_image ());
|
|
|
|
retval = g_list_prepend (retval, create_label ());
|
2006-01-30 15:39:23 +00:00
|
|
|
retval = g_list_prepend (retval, create_link_button ());
|
2004-10-10 20:35:16 +00:00
|
|
|
retval = g_list_prepend (retval, create_menubar ());
|
|
|
|
retval = g_list_prepend (retval, create_message_dialog ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_notebook ());
|
|
|
|
retval = g_list_prepend (retval, create_panes ());
|
2004-10-10 20:35:16 +00:00
|
|
|
retval = g_list_prepend (retval, create_progressbar ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_radio ());
|
|
|
|
retval = g_list_prepend (retval, create_scales ());
|
2004-10-11 15:14:27 +00:00
|
|
|
retval = g_list_prepend (retval, create_scrolledwindow ());
|
2013-04-25 01:56:08 +00:00
|
|
|
retval = g_list_prepend (retval, create_scrollbar ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_separator ());
|
2004-10-11 15:14:27 +00:00
|
|
|
retval = g_list_prepend (retval, create_spinbutton ());
|
|
|
|
retval = g_list_prepend (retval, create_statusbar ());
|
2004-11-16 05:10:18 +00:00
|
|
|
retval = g_list_prepend (retval, create_text_view ());
|
|
|
|
retval = g_list_prepend (retval, create_toggle_button ());
|
|
|
|
retval = g_list_prepend (retval, create_toolbar ());
|
|
|
|
retval = g_list_prepend (retval, create_tree_view ());
|
|
|
|
retval = g_list_prepend (retval, create_window ());
|
2004-12-07 06:22:19 +00:00
|
|
|
retval = g_list_prepend (retval, create_filesel ());
|
2006-01-30 04:53:53 +00:00
|
|
|
retval = g_list_prepend (retval, create_assistant ());
|
2006-03-30 18:52:52 +00:00
|
|
|
retval = g_list_prepend (retval, create_recent_chooser_dialog ());
|
2006-04-21 15:09:32 +00:00
|
|
|
retval = g_list_prepend (retval, create_page_setup_dialog ());
|
|
|
|
retval = g_list_prepend (retval, create_print_dialog ());
|
2007-06-03 05:34:56 +00:00
|
|
|
retval = g_list_prepend (retval, create_volume_button ());
|
2010-11-29 16:23:07 +00:00
|
|
|
retval = g_list_prepend (retval, create_switch ());
|
2011-01-06 07:07:35 +00:00
|
|
|
retval = g_list_prepend (retval, create_appchooserbutton ());
|
|
|
|
retval = g_list_prepend (retval, create_appchooserdialog ());
|
2011-04-30 03:40:47 +00:00
|
|
|
retval = g_list_prepend (retval, create_lockbutton ());
|
2012-02-15 04:48:36 +00:00
|
|
|
retval = g_list_prepend (retval, create_fontchooserdialog ());
|
|
|
|
retval = g_list_prepend (retval, create_colorchooserdialog ());
|
2012-07-14 02:31:34 +00:00
|
|
|
retval = g_list_prepend (retval, create_menu_button ());
|
|
|
|
retval = g_list_prepend (retval, create_search_entry ());
|
2012-08-04 23:11:43 +00:00
|
|
|
retval = g_list_prepend (retval, create_level_bar ());
|
2013-04-25 01:56:08 +00:00
|
|
|
retval = g_list_prepend (retval, create_info_bar ());
|
2014-10-22 04:55:39 +00:00
|
|
|
retval = g_list_prepend (retval, create_gl_area ());
|
2014-10-22 05:11:34 +00:00
|
|
|
retval = g_list_prepend (retval, create_sidebar ());
|
2004-09-16 04:34:21 +00:00
|
|
|
|
2004-08-23 21:22:55 +00:00
|
|
|
return retval;
|
|
|
|
}
|