Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 923bf3c625 | |||
| d36604ae41 | |||
| 48d73e164e | |||
| b1277f32de | |||
| ffd12347be | |||
| fc2b45cb50 | |||
| 79c9a7ec5e | |||
| b89a059967 | |||
| fc72a20782 | |||
| 6748d421b6 | |||
| 87a46136b3 | |||
| 47c00c7ad4 | |||
| ce4382e444 | |||
| 74f03f97b1 | |||
| c0c10b993a | |||
| 127e8d8a1b | |||
| 9816a939b7 | |||
| 1b5b4812b9 | |||
| b20c7555fe | |||
| 33ff8e3488 | |||
| b2a5e870df | |||
| 42efae2d47 | |||
| 6919f989f7 | |||
| 82e9821dd8 | |||
| 1113402c7b | |||
| 2d2a6d2bf4 | |||
| 6fb824a0b3 | |||
| 26ae475590 | |||
| 3b35e523fd | |||
| 6c6f1b3dcd | |||
| 30c5e6fe7a | |||
| fda93a2977 | |||
| 151e5c58a8 | |||
| 32baa433b7 | |||
| b00d7d6585 | |||
| 954890278f | |||
| c07c77a489 | |||
| 85641efa08 | |||
| c43a02ba55 |
@@ -30,6 +30,7 @@ demos = \
|
||||
pickers.c \
|
||||
pixbufs.c \
|
||||
printing.c \
|
||||
resolution_independence.c \
|
||||
rotated_text.c \
|
||||
search_entry.c \
|
||||
sizegroup.c \
|
||||
|
||||
@@ -553,7 +553,8 @@ do_appwindow (GtkWidget *do_widget)
|
||||
0, 0);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
200, 200);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (200),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
|
||||
contents = gtk_text_view_new ();
|
||||
gtk_widget_grab_focus (contents);
|
||||
|
||||
@@ -58,14 +58,32 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
gtk_assistant_set_page_complete (assistant, current_page, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
on_unit_changed (GtkWidget *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
int n;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *page;
|
||||
|
||||
/* update icons on all pages */
|
||||
for (n = 0; n < 3; n++)
|
||||
{
|
||||
page = gtk_assistant_get_nth_page (GTK_ASSISTANT (assistant), n);
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
create_page1 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *box, *label, *entry;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
label = gtk_label_new ("You must fill out this entry to continue:");
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||
@@ -91,8 +109,8 @@ create_page2 (GtkWidget *assistant)
|
||||
GtkWidget *box, *checkbutton;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_vbox_new (12, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
box = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
||||
"even if you do not check this");
|
||||
@@ -134,7 +152,7 @@ do_assistant (GtkWidget *do_widget)
|
||||
{
|
||||
assistant = gtk_assistant_new ();
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, 300);
|
||||
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, GTK_SIZE_ONE_TWELFTH_EM (300));
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (assistant),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@@ -151,6 +169,10 @@ do_assistant (GtkWidget *do_widget)
|
||||
G_CALLBACK (on_assistant_apply), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "prepare",
|
||||
G_CALLBACK (on_assistant_prepare), NULL);
|
||||
|
||||
/* need to reset the header pixbufs to correct size when the units change */
|
||||
g_signal_connect (G_OBJECT (assistant), "unit-changed",
|
||||
G_CALLBACK (on_unit_changed), NULL);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (assistant))
|
||||
|
||||
+24
-24
@@ -6,10 +6,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_bbox (gint horizontal,
|
||||
char *title,
|
||||
gint spacing,
|
||||
gint layout)
|
||||
create_bbox (gint horizontal,
|
||||
char *title,
|
||||
GtkSize spacing,
|
||||
gint layout)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *bbox;
|
||||
@@ -22,7 +22,7 @@ create_bbox (gint horizontal,
|
||||
else
|
||||
bbox = gtk_vbutton_box_new ();
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), bbox);
|
||||
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
|
||||
@@ -61,56 +61,56 @@ do_button_box (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_vbox);
|
||||
|
||||
frame_horz = gtk_frame_new ("Horizontal Button Boxes");
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
|
||||
create_bbox (TRUE, "Spread", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "Edge", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "Start", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "End", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
frame_vert = gtk_frame_new ("Vertical Button Boxes");
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
|
||||
create_bbox (FALSE, "Spread", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "Edge", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "Start", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "End", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -354,8 +354,8 @@ create_frame (ChangeDisplayInfo *info,
|
||||
|
||||
*frame = gtk_frame_new (title);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (*frame), hbox);
|
||||
|
||||
scrollwin = gtk_scrolled_window_new (NULL, NULL);
|
||||
@@ -372,7 +372,7 @@ create_frame (ChangeDisplayInfo *info,
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
||||
|
||||
*button_vbox = gtk_vbox_new (FALSE, 5);
|
||||
*button_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE, 0);
|
||||
|
||||
if (!info->size_group)
|
||||
@@ -611,15 +611,15 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), GTK_SIZE_ONE_TWELFTH_EM (300), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
g_signal_connect (info->window, "response",
|
||||
G_CALLBACK (response_cb), info);
|
||||
g_signal_connect (info->window, "destroy",
|
||||
G_CALLBACK (destroy_cb), &info);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->window)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
@@ -207,7 +207,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
@@ -215,8 +215,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the first entry */
|
||||
@@ -232,8 +232,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the second entry */
|
||||
@@ -249,8 +249,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("Images can be transferred via the clipboard, too");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the first image */
|
||||
|
||||
@@ -87,10 +87,10 @@ do_colorsel (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
@@ -108,7 +108,7 @@ do_colorsel (GtkWidget *do_widget)
|
||||
G_CALLBACK (expose_event_callback), NULL);
|
||||
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 200, 200);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (200), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
/* set the color */
|
||||
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
|
||||
|
||||
|
||||
+13
-16
@@ -11,8 +11,10 @@
|
||||
|
||||
enum
|
||||
{
|
||||
PIXBUF_COL,
|
||||
TEXT_COL
|
||||
STOCK_ID_COL,
|
||||
TEXT_COL,
|
||||
|
||||
NUM_COLUMNS,
|
||||
};
|
||||
|
||||
static gchar *
|
||||
@@ -50,7 +52,6 @@ create_stock_icon_store (void)
|
||||
};
|
||||
|
||||
GtkStockItem item;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *cellview;
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
@@ -59,29 +60,25 @@ create_stock_icon_store (void)
|
||||
|
||||
cellview = gtk_cell_view_new ();
|
||||
|
||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (stock_id); i++)
|
||||
{
|
||||
if (stock_id[i])
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (cellview, stock_id[i],
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
gtk_stock_lookup (stock_id[i], &item);
|
||||
gtk_stock_lookup (stock_id[i], &item);
|
||||
label = strip_underscore (item.label);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
PIXBUF_COL, pixbuf,
|
||||
STOCK_ID_COL, stock_id[i],
|
||||
TEXT_COL, label,
|
||||
-1);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (label);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
PIXBUF_COL, NULL,
|
||||
TEXT_COL, "separator",
|
||||
-1);
|
||||
}
|
||||
@@ -343,9 +340,9 @@ do_combobox (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/* A combobox demonstrating cell renderers, separators and
|
||||
@@ -355,7 +352,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
model = create_stock_icon_store ();
|
||||
@@ -366,7 +363,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
|
||||
"pixbuf", PIXBUF_COL,
|
||||
"stock-id", STOCK_ID_COL,
|
||||
NULL);
|
||||
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
|
||||
@@ -396,7 +393,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
model = create_capital_store ();
|
||||
@@ -425,7 +422,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
box = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
combo = gtk_combo_box_entry_new_text ();
|
||||
|
||||
@@ -148,8 +148,9 @@
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_width">440</property>
|
||||
<!-- 100 mm = 10 cm ~= 4 inches -->
|
||||
<property name="default_height">100 mm</property>
|
||||
<property name="default_width">36.6667em</property>
|
||||
<property name="title">GtkBuilder demo</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
|
||||
+11
-11
@@ -51,16 +51,16 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table),
|
||||
@@ -112,17 +112,17 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
frame = gtk_frame_new ("Dialogs");
|
||||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
/* Standard message dialog */
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
button = gtk_button_new_with_mnemonic ("_Message Dialog");
|
||||
g_signal_connect (button, "clicked",
|
||||
@@ -132,7 +132,7 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);
|
||||
|
||||
/* Interactive dialog*/
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
@@ -143,8 +143,8 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
|
||||
@@ -245,10 +245,10 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
@@ -266,7 +266,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (100), GTK_SIZE_ONE_TWELFTH_EM (100));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
@@ -288,7 +288,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (100), GTK_SIZE_ONE_TWELFTH_EM (100));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
|
||||
@@ -328,11 +328,11 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
@@ -365,7 +365,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (sw), treeview);
|
||||
|
||||
/* some buttons */
|
||||
hbox = gtk_hbox_new (TRUE, 4);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Add item");
|
||||
@@ -378,7 +378,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
G_CALLBACK (remove_item), treeview);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (320), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -58,9 +58,9 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
|
||||
|
||||
@@ -32,9 +32,9 @@ do_expander (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
label = gtk_label_new ("Expander demo. Click on the triangle for details.");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
@@ -267,7 +267,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (450), GTK_SIZE_ONE_TWELFTH_EM (450));
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
GError *error;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (650), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
|
||||
@@ -332,10 +332,10 @@ do_images (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (cleanup_callback), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -173,9 +173,9 @@ do_list_store (GtkWidget *do_widget)
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
|
||||
@@ -206,7 +206,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
add_columns (GTK_TREE_VIEW (treeview));
|
||||
|
||||
/* finish & show */
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 280, 250);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (280), GTK_SIZE_ONE_TWELFTH_EM (250));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -764,9 +764,9 @@ create_text (GtkTextBuffer **buffer,
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
@@ -792,7 +792,7 @@ create_tree (void)
|
||||
|
||||
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_widget_set_size_request (tree_view, 200, -1);
|
||||
gtk_widget_set_size_request (tree_view, GTK_SIZE_ONE_TWELFTH_EM (200), -1);
|
||||
|
||||
/* this code only supports 1 level of children. If we
|
||||
* want more we probably have to use a recursing function.
|
||||
@@ -946,6 +946,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
|
||||
gtk_enable_resolution_independence ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
setup_default_icon ();
|
||||
@@ -969,7 +970,7 @@ main (int argc, char **argv)
|
||||
gtk_label_new_with_mnemonic ("_Info"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title",
|
||||
"font", "Sans 18",
|
||||
"scale", PANGO_SCALE_XX_LARGE,
|
||||
NULL);
|
||||
g_object_unref (info_buffer);
|
||||
|
||||
@@ -999,9 +1000,9 @@ main (int argc, char **argv)
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"foreground", "DarkGoldenrod4",
|
||||
NULL);
|
||||
g_object_unref (source_buffer);
|
||||
g_object_unref (source_buffer);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (600), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ create_pane_options (GtkPaned *paned,
|
||||
GtkWidget *check_button;
|
||||
|
||||
frame = gtk_frame_new (frame_label);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
|
||||
table = gtk_table_new (3, 2, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
@@ -138,14 +138,14 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
hpaned = gtk_hpaned_new ();
|
||||
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_size_request (frame, 60, 60);
|
||||
gtk_widget_set_size_request (frame, GTK_SIZE_ONE_TWELFTH_EM (60), GTK_SIZE_ONE_TWELFTH_EM (60));
|
||||
gtk_paned_add1 (GTK_PANED (hpaned), frame);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Hi there");
|
||||
@@ -153,12 +153,12 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_size_request (frame, 80, 60);
|
||||
gtk_widget_set_size_request (frame, GTK_SIZE_ONE_TWELFTH_EM (80), GTK_SIZE_ONE_TWELFTH_EM (60));
|
||||
gtk_paned_add2 (GTK_PANED (hpaned), frame);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_size_request (frame, 60, 80);
|
||||
gtk_widget_set_size_request (frame, GTK_SIZE_ONE_TWELFTH_EM (60), GTK_SIZE_ONE_TWELFTH_EM (80));
|
||||
gtk_paned_add2 (GTK_PANED (vpaned), frame);
|
||||
|
||||
/* Now create toggle buttons to control sizing */
|
||||
|
||||
@@ -18,19 +18,20 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (3));
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
label = gtk_label_new ("Color:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
/* Resolution Independence
|
||||
*
|
||||
* This demonstates resolution independence features available since
|
||||
* version 2.14 of GTK+. Use the slider to change the effective DPI
|
||||
* per monitor. Note that the changes will only affect windows from
|
||||
* this process.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
#include "config.h"
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWindowGroup *window_group = NULL;
|
||||
static GtkWidget *hscale;
|
||||
static GtkWidget *label;
|
||||
static GtkWidget *button;
|
||||
static gdouble button_dpi;
|
||||
|
||||
#define INCHES_TO_MM 25.4
|
||||
|
||||
#define MIN_DPI 24.0
|
||||
#define MAX_DPI 480.0
|
||||
#define STEP_DPI 1.0
|
||||
|
||||
static void
|
||||
update (void)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gint monitor_num;
|
||||
char *plug_name;
|
||||
char *s;
|
||||
gdouble dpi;
|
||||
char *font_name;
|
||||
GtkSettings *settings;
|
||||
int width_mm;
|
||||
int height_mm;
|
||||
GdkRectangle geometry;
|
||||
|
||||
plug_name = NULL;
|
||||
font_name = NULL;
|
||||
width_mm = -1;
|
||||
height_mm = -1;
|
||||
geometry.x = -1;
|
||||
geometry.y = -1;
|
||||
geometry.width = -1;
|
||||
geometry.height = -1;
|
||||
|
||||
screen = gtk_window_get_screen (GTK_WINDOW (window));
|
||||
monitor_num = gtk_widget_get_monitor_num (window);
|
||||
if (screen != NULL && monitor_num >= 0)
|
||||
{
|
||||
plug_name = gdk_screen_get_monitor_plug_name (screen, monitor_num);
|
||||
width_mm = gdk_screen_get_monitor_width_mm (screen, monitor_num);
|
||||
height_mm = gdk_screen_get_monitor_height_mm (screen, monitor_num);
|
||||
gdk_screen_get_monitor_geometry (screen, monitor_num, &geometry);
|
||||
}
|
||||
if (screen != NULL)
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
else
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_get (settings, "gtk-font-name", &font_name, NULL);
|
||||
|
||||
s = g_strdup_printf ("Monitor %d (%s) @ %dx%d+%d+%d\n"
|
||||
"%d mm x %d mm\n"
|
||||
"DPI: %.1f x %.1f\n"
|
||||
"Font \"%s\"\n"
|
||||
"1 em -> %g pixels\n"
|
||||
"1 mm -> %g pixels",
|
||||
monitor_num,
|
||||
plug_name != NULL ? plug_name : "unknown name",
|
||||
geometry.width, geometry.height, geometry.x, geometry.y,
|
||||
width_mm, height_mm,
|
||||
INCHES_TO_MM * geometry.width / width_mm,
|
||||
INCHES_TO_MM * geometry.height / height_mm,
|
||||
font_name,
|
||||
gtk_size_to_pixel_double (screen, monitor_num, gtk_size_em (1.0)),
|
||||
gtk_size_to_pixel_double (screen, monitor_num, gtk_size_mm (1.0)));
|
||||
gtk_label_set_text (GTK_LABEL (label), s);
|
||||
g_free (s);
|
||||
|
||||
button_dpi = MIN (INCHES_TO_MM * geometry.width / width_mm,
|
||||
INCHES_TO_MM * geometry.height / height_mm);
|
||||
s = g_strdup_printf ("Set DPI to %.1f", button_dpi);
|
||||
gtk_button_set_label (GTK_BUTTON (button), s);
|
||||
g_free (s);
|
||||
|
||||
dpi = -1;
|
||||
if (screen != NULL)
|
||||
{
|
||||
dpi = gdk_screen_get_resolution_for_monitor (screen, monitor_num);
|
||||
gtk_range_set_value (GTK_RANGE (hscale), dpi);
|
||||
}
|
||||
|
||||
g_free (plug_name);
|
||||
g_free (font_name);
|
||||
}
|
||||
|
||||
static void
|
||||
window_mapped (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
unit_changed (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
monitor_num_notify (GtkWindow *window, GParamSpec *psec, gpointer user_data)
|
||||
{
|
||||
g_debug ("notify::monitor-num");
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
update_value (void)
|
||||
{
|
||||
gdouble slider_value;
|
||||
|
||||
slider_value = gtk_range_get_value (GTK_RANGE (hscale));
|
||||
if (slider_value >= MIN_DPI && slider_value <= MAX_DPI)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gint monitor_num;
|
||||
|
||||
screen = gtk_window_get_screen (GTK_WINDOW (window));
|
||||
monitor_num = gtk_widget_get_monitor_num (window);
|
||||
if (screen != NULL && monitor_num >= 0)
|
||||
{
|
||||
gdk_screen_set_resolution_for_monitor (screen, monitor_num, slider_value);
|
||||
g_signal_emit_by_name (screen, "monitors-changed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean is_pressed = FALSE;
|
||||
|
||||
static gboolean
|
||||
hscale_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
{
|
||||
is_pressed = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
hscale_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
{
|
||||
is_pressed = FALSE;
|
||||
update_value ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
hscale_value_changed (GtkRange *range, gpointer user_data)
|
||||
{
|
||||
if (!is_pressed)
|
||||
update_value ();
|
||||
}
|
||||
|
||||
static char *
|
||||
hscale_format_value (GtkScale *scale, gdouble value, gpointer user_data)
|
||||
{
|
||||
return g_strdup_printf ("%g DPI", value);
|
||||
}
|
||||
|
||||
static void
|
||||
dpi_button_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (hscale), button_dpi);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_resolution_independence (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
|
||||
if (window != NULL)
|
||||
goto have_window;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Resolution Independence");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "gtk-fullscreen");
|
||||
|
||||
g_signal_connect (G_OBJECT (window), "map", G_CALLBACK (window_mapped), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "notify::monitor-num", G_CALLBACK (monitor_num_notify), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "unit-changed", G_CALLBACK (unit_changed), NULL);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, gtk_size_em (1));
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hscale = gtk_hscale_new_with_range (MIN_DPI, MAX_DPI, STEP_DPI);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hscale, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (hscale), "value-changed", G_CALLBACK (hscale_value_changed), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "button-press-event", G_CALLBACK (hscale_button_press_event), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "button-release-event", G_CALLBACK (hscale_button_release_event), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "format-value", G_CALLBACK (hscale_format_value), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), gtk_size_em (1));
|
||||
gtk_widget_set_size_request (window, GTK_SIZE_ONE_TWELFTH_EM (500), -1);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
button = gtk_button_new ();
|
||||
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (dpi_button_clicked), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
/* avoid dialogs (e.g. printing) grabbing focus from us */
|
||||
if (window_group == NULL)
|
||||
window_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (window_group, GTK_WINDOW (window));
|
||||
|
||||
/* make sure we're on top */
|
||||
gtk_window_set_keep_above (GTK_WINDOW (window), TRUE);
|
||||
|
||||
have_window:
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -189,7 +189,8 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
gtk_size_em ((4 * RADIUS)), gtk_size_em ((4 * RADIUS)));
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_hbox_new (TRUE, 0);
|
||||
@@ -207,7 +208,6 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
G_CALLBACK (rotated_text_expose_event), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
|
||||
@@ -115,9 +115,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
@@ -127,9 +127,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
add_row (GTK_TABLE (table), 0, size_group, "_Foreground", color_options);
|
||||
@@ -141,9 +141,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
add_row (GTK_TABLE (table), 0, size_group, "_Dashing", dash_options);
|
||||
|
||||
@@ -420,12 +420,12 @@ do_stock_browser (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), -1, 500);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), -1, GTK_SIZE_ONE_TWELFTH_EM (500));
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
@@ -494,8 +494,8 @@ do_stock_browser (GtkWidget *do_widget)
|
||||
frame = gtk_frame_new ("Selected Item");
|
||||
gtk_container_add (GTK_CONTAINER (align), frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
display = g_new (StockItemDisplay, 1);
|
||||
|
||||
@@ -182,9 +182,9 @@ do_textscroll (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (600), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 6);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
create_text_view (hbox, TRUE);
|
||||
|
||||
+13
-10
@@ -114,7 +114,7 @@ create_tags (GtkTextBuffer *buffer)
|
||||
"justification", GTK_JUSTIFY_RIGHT, NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (buffer, "wide_margins",
|
||||
"left_margin", 50, "right_margin", 50,
|
||||
"left_margin", GTK_SIZE_ONE_TWELFTH_EM (50), "right_margin", GTK_SIZE_ONE_TWELFTH_EM (50),
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (buffer, "strikethrough",
|
||||
@@ -139,9 +139,9 @@ create_tags (GtkTextBuffer *buffer)
|
||||
gtk_text_buffer_create_tag (buffer, "rtl_quote",
|
||||
"wrap_mode", GTK_WRAP_WORD,
|
||||
"direction", GTK_TEXT_DIR_RTL,
|
||||
"indent", 30,
|
||||
"left_margin", 20,
|
||||
"right_margin", 20,
|
||||
"indent", GTK_SIZE_ONE_TWELFTH_EM (30),
|
||||
"left_margin", GTK_SIZE_ONE_TWELFTH_EM (20),
|
||||
"right_margin", GTK_SIZE_ONE_TWELFTH_EM (20),
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,10 @@ insert_text (GtkTextBuffer *buffer)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gtk_size_to_pixel (NULL, 0, GTK_SIZE_ONE_TWELFTH_EM (32)),
|
||||
gtk_size_to_pixel (NULL, 0, GTK_SIZE_ONE_TWELFTH_EM (32)),
|
||||
GDK_INTERP_BILINEAR);
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled;
|
||||
|
||||
@@ -409,7 +412,7 @@ attach_widgets (GtkTextView *text_view)
|
||||
{
|
||||
widget = gtk_hscale_new (NULL);
|
||||
gtk_range_set_range (GTK_RANGE (widget), 0, 100);
|
||||
gtk_widget_set_size_request (widget, 70, -1);
|
||||
gtk_widget_set_size_request (widget, GTK_SIZE_ONE_TWELFTH_EM (70), -1);
|
||||
}
|
||||
else if (i == 3)
|
||||
{
|
||||
@@ -454,7 +457,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (450), GTK_SIZE_ONE_TWELFTH_EM (450));
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
@@ -463,7 +466,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (window), vpaned);
|
||||
|
||||
/* For convenience, we just use the autocreated buffer from
|
||||
@@ -534,7 +537,7 @@ recursive_attach_view (int depth,
|
||||
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &color);
|
||||
|
||||
align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (align), 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (align), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (event_box), align);
|
||||
gtk_container_add (GTK_CONTAINER (align), child_view);
|
||||
@@ -590,7 +593,7 @@ easter_egg_callback (GtkWidget *button,
|
||||
window_ptr = &window;
|
||||
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (300), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* havoc column */
|
||||
@@ -313,7 +313,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* tim column */
|
||||
@@ -336,7 +336,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* owen column */
|
||||
@@ -358,7 +358,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* dave column */
|
||||
@@ -380,7 +380,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
}
|
||||
|
||||
@@ -402,8 +402,8 @@ do_tree_store (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
@@ -435,7 +435,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
/* expand all rows after the treeview widget has been realized */
|
||||
g_signal_connect (treeview, "realize",
|
||||
G_CALLBACK (gtk_tree_view_expand_all), NULL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (50), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -204,7 +204,7 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Type\n<alt>\nto start");
|
||||
gtk_widget_set_size_request (label, 200, 200);
|
||||
gtk_widget_set_size_request (label, GTK_SIZE_ONE_TWELFTH_EM (200), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
|
||||
|
||||
@@ -213,8 +213,8 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
|
||||
@@ -225,8 +225,12 @@ gdk_screen_broadcast_client_message
|
||||
gdk_screen_get_setting
|
||||
gdk_screen_get_font_options
|
||||
gdk_screen_set_font_options
|
||||
gdk_screen_get_font_options_for_monitor
|
||||
gdk_screen_set_font_options_for_monitor
|
||||
gdk_screen_get_resolution
|
||||
gdk_screen_set_resolution
|
||||
gdk_screen_get_resolution_for_monitor
|
||||
gdk_screen_set_resolution_for_monitor
|
||||
gdk_screen_get_active_window
|
||||
gdk_screen_get_window_stack
|
||||
<SUBSECTION Spawning>
|
||||
@@ -874,6 +878,7 @@ gdk_pango_renderer_set_stipple
|
||||
gdk_pango_renderer_set_override_color
|
||||
gdk_pango_context_get
|
||||
gdk_pango_context_get_for_screen
|
||||
gdk_pango_context_get_for_screen_for_monitor
|
||||
gdk_pango_context_set_colormap
|
||||
GdkPangoAttrEmbossed
|
||||
GdkPangoAttrEmbossColor
|
||||
|
||||
@@ -345,7 +345,10 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/layout-rlbt.png \
|
||||
$(srcdir)/images/layout-rltb.png \
|
||||
$(srcdir)/images/layout-tblr.png \
|
||||
$(srcdir)/images/layout-tbrl.png
|
||||
$(srcdir)/images/layout-tbrl.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-6.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-12.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-24.png
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref
|
||||
FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html \
|
||||
|
||||
@@ -126,6 +126,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
|
||||
<xi:include href="xml/gtktypeutils.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
<xi:include href="xml/filesystem.xml" />
|
||||
<xi:include href="xml/gtksize.xml" />
|
||||
</part>
|
||||
|
||||
<part id="gtkobjects">
|
||||
|
||||
@@ -328,6 +328,7 @@ GtkAlignment
|
||||
gtk_alignment_new
|
||||
gtk_alignment_set
|
||||
gtk_alignment_get_padding
|
||||
gtk_alignment_get_padding_unit
|
||||
gtk_alignment_set_padding
|
||||
<SUBSECTION Standard>
|
||||
GTK_ALIGNMENT
|
||||
@@ -471,9 +472,11 @@ gtk_box_pack_end_defaults
|
||||
gtk_box_get_homogeneous
|
||||
gtk_box_set_homogeneous
|
||||
gtk_box_get_spacing
|
||||
gtk_box_get_spacing_unit
|
||||
gtk_box_set_spacing
|
||||
gtk_box_reorder_child
|
||||
gtk_box_query_child_packing
|
||||
gtk_box_query_child_packing_unit
|
||||
gtk_box_set_child_packing
|
||||
<SUBSECTION Standard>
|
||||
GTK_BOX
|
||||
@@ -1033,6 +1036,7 @@ gtk_container_unset_focus_chain
|
||||
gtk_container_class_find_child_property
|
||||
gtk_container_class_install_child_property
|
||||
gtk_container_class_list_child_properties
|
||||
gtk_container_get_border_width_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_CONTAINER
|
||||
GTK_IS_CONTAINER
|
||||
@@ -1414,6 +1418,7 @@ gtk_expander_set_expanded
|
||||
gtk_expander_get_expanded
|
||||
gtk_expander_set_spacing
|
||||
gtk_expander_get_spacing
|
||||
gtk_expander_get_spacing_unit
|
||||
gtk_expander_set_label
|
||||
gtk_expander_get_label
|
||||
gtk_expander_set_use_underline
|
||||
@@ -1931,14 +1936,19 @@ gtk_icon_view_set_columns
|
||||
gtk_icon_view_get_columns
|
||||
gtk_icon_view_set_item_width
|
||||
gtk_icon_view_get_item_width
|
||||
gtk_icon_view_get_item_width_unit
|
||||
gtk_icon_view_set_spacing
|
||||
gtk_icon_view_get_spacing
|
||||
gtk_icon_view_get_spacing_unit
|
||||
gtk_icon_view_set_row_spacing
|
||||
gtk_icon_view_get_row_spacing
|
||||
gtk_icon_view_get_row_spacing_unit
|
||||
gtk_icon_view_set_column_spacing
|
||||
gtk_icon_view_get_column_spacing
|
||||
gtk_icon_view_get_column_spacing_unit
|
||||
gtk_icon_view_set_margin
|
||||
gtk_icon_view_get_margin
|
||||
gtk_icon_view_get_margin_unit
|
||||
gtk_icon_view_select_path
|
||||
gtk_icon_view_unselect_path
|
||||
gtk_icon_view_path_is_selected
|
||||
@@ -2016,6 +2026,7 @@ gtk_image_set
|
||||
gtk_image_get
|
||||
gtk_image_set_pixel_size
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_get_pixel_size_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_IMAGE
|
||||
GTK_IS_IMAGE
|
||||
@@ -2627,6 +2638,7 @@ gtk_misc_set_alignment
|
||||
gtk_misc_set_padding
|
||||
gtk_misc_get_alignment
|
||||
gtk_misc_get_padding
|
||||
gtk_misc_get_padding_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_MISC
|
||||
GTK_IS_MISC
|
||||
@@ -3630,10 +3642,14 @@ gtk_table_set_row_spacings
|
||||
gtk_table_set_col_spacings
|
||||
gtk_table_set_homogeneous
|
||||
gtk_table_get_default_row_spacing
|
||||
gtk_table_get_default_row_spacing_unit
|
||||
gtk_table_get_homogeneous
|
||||
gtk_table_get_row_spacing
|
||||
gtk_table_get_row_spacing_unit
|
||||
gtk_table_get_col_spacing
|
||||
gtk_table_get_col_spacing_unit
|
||||
gtk_table_get_default_col_spacing
|
||||
gtk_table_get_default_col_spacing_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_TABLE
|
||||
GTK_IS_TABLE
|
||||
@@ -4013,18 +4029,24 @@ gtk_text_view_set_overwrite
|
||||
gtk_text_view_get_overwrite
|
||||
gtk_text_view_set_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines_unit
|
||||
gtk_text_view_set_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines_unit
|
||||
gtk_text_view_set_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap_unit
|
||||
gtk_text_view_set_justification
|
||||
gtk_text_view_get_justification
|
||||
gtk_text_view_set_left_margin
|
||||
gtk_text_view_get_left_margin
|
||||
gtk_text_view_get_left_margin_unit
|
||||
gtk_text_view_set_right_margin
|
||||
gtk_text_view_get_right_margin
|
||||
gtk_text_view_get_right_margin_unit
|
||||
gtk_text_view_set_indent
|
||||
gtk_text_view_get_indent
|
||||
gtk_text_view_get_indent_unit
|
||||
gtk_text_view_set_tabs
|
||||
gtk_text_view_get_tabs
|
||||
gtk_text_view_set_accepts_tab
|
||||
@@ -4749,6 +4771,7 @@ gtk_tree_view_column_set_cell_data_func
|
||||
gtk_tree_view_column_clear_attributes
|
||||
gtk_tree_view_column_set_spacing
|
||||
gtk_tree_view_column_get_spacing
|
||||
gtk_tree_view_column_get_spacing_unit
|
||||
gtk_tree_view_column_set_visible
|
||||
gtk_tree_view_column_get_visible
|
||||
gtk_tree_view_column_set_resizable
|
||||
@@ -4757,11 +4780,14 @@ gtk_tree_view_column_set_sizing
|
||||
gtk_tree_view_column_get_sizing
|
||||
gtk_tree_view_column_get_width
|
||||
gtk_tree_view_column_get_fixed_width
|
||||
gtk_tree_view_column_get_fixed_width_unit
|
||||
gtk_tree_view_column_set_fixed_width
|
||||
gtk_tree_view_column_set_min_width
|
||||
gtk_tree_view_column_get_min_width
|
||||
gtk_tree_view_column_get_min_width_unit
|
||||
gtk_tree_view_column_set_max_width
|
||||
gtk_tree_view_column_get_max_width
|
||||
gtk_tree_view_column_get_max_width_unit
|
||||
gtk_tree_view_column_clicked
|
||||
gtk_tree_view_column_set_title
|
||||
gtk_tree_view_column_get_title
|
||||
@@ -4810,6 +4836,7 @@ GtkTreeViewMappingFunc
|
||||
GtkTreeViewSearchEqualFunc
|
||||
gtk_tree_view_new
|
||||
gtk_tree_view_get_level_indentation
|
||||
gtk_tree_view_get_level_indentation_unit
|
||||
gtk_tree_view_get_show_expanders
|
||||
gtk_tree_view_set_level_indentation
|
||||
gtk_tree_view_set_show_expanders
|
||||
@@ -4984,13 +5011,17 @@ GtkCellRendererMode
|
||||
GtkCellRenderer
|
||||
GtkCellRendererClass
|
||||
gtk_cell_renderer_get_size
|
||||
gtk_cell_renderer_get_size_unit
|
||||
gtk_cell_renderer_render
|
||||
gtk_cell_renderer_activate
|
||||
gtk_cell_renderer_start_editing
|
||||
gtk_cell_renderer_editing_canceled
|
||||
gtk_cell_renderer_stop_editing
|
||||
gtk_cell_renderer_get_fixed_size
|
||||
gtk_cell_renderer_get_fixed_size_unit
|
||||
gtk_cell_renderer_set_fixed_size
|
||||
gtk_cell_renderer_get_tree_view_column
|
||||
gtk_cell_renderer_get_tree_view
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CELL_RENDERER
|
||||
@@ -5525,6 +5556,15 @@ gtk_widget_set_has_tooltip
|
||||
gtk_widget_trigger_tooltip_query
|
||||
gtk_widget_get_snapshot
|
||||
gtk_widget_get_window
|
||||
gtk_widget_get_monitor_num
|
||||
gtk_widget_get_size_request_unit
|
||||
gtk_widget_size_to_pixel
|
||||
gtk_widget_size_to_pixel_double
|
||||
gtk_widget_style_get_property_unit
|
||||
gtk_widget_style_get_unit_valist
|
||||
gtk_widget_style_get_unit
|
||||
gtk_widget_get_unit_valist
|
||||
gtk_widget_get_unit
|
||||
<SUBSECTION>
|
||||
gtk_requisition_copy
|
||||
gtk_requisition_free
|
||||
@@ -5611,6 +5651,7 @@ gtk_window_get_deletable
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_default_size_unit
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_frame_dimensions
|
||||
gtk_window_get_has_frame
|
||||
@@ -5646,6 +5687,7 @@ gtk_window_set_icon_name
|
||||
gtk_window_set_auto_startup_notification
|
||||
gtk_window_get_opacity
|
||||
gtk_window_set_opacity
|
||||
gtk_window_get_monitor_num
|
||||
<SUBSECTION Standard>
|
||||
GTK_WINDOW
|
||||
GTK_IS_WINDOW
|
||||
@@ -5814,6 +5856,9 @@ gtk_style_set_font
|
||||
gtk_style_get_style_property
|
||||
gtk_style_get_valist
|
||||
gtk_style_get
|
||||
gtk_style_get_style_property_unit
|
||||
gtk_style_get_unit_valist
|
||||
gtk_style_get_unit
|
||||
gtk_draw_hline
|
||||
gtk_draw_vline
|
||||
gtk_draw_shadow
|
||||
@@ -6490,7 +6535,10 @@ gtk_icon_set_ref
|
||||
gtk_icon_set_render_icon
|
||||
gtk_icon_set_unref
|
||||
gtk_icon_size_lookup
|
||||
gtk_icon_size_lookup_unit
|
||||
gtk_icon_size_lookup_for_settings
|
||||
gtk_icon_size_lookup_for_settings_for_monitor
|
||||
gtk_icon_size_lookup_for_settings_unit
|
||||
gtk_icon_size_register
|
||||
gtk_icon_size_register_alias
|
||||
gtk_icon_size_from_name
|
||||
@@ -7036,3 +7084,31 @@ GTK_TYPE_ORIENTABLE
|
||||
<SUBSECTION Private>
|
||||
gtk_orientable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Units</TITLE>
|
||||
<FILE>gtksize</FILE>
|
||||
GtkSize
|
||||
GtkUSize
|
||||
GtkSizeUnit
|
||||
gtk_size_em
|
||||
gtk_size_mm
|
||||
gtk_size_get_em
|
||||
gtk_size_get_mm
|
||||
GTK_SIZE_ONE_TWELFTH_EM
|
||||
GTK_SIZE_MAXPIXEL
|
||||
GTK_SIZE_MINPIXEL
|
||||
gtk_size_get_unit
|
||||
gtk_size_to_pixel
|
||||
gtk_size_to_pixel_double
|
||||
gtk_size_to_string
|
||||
gtk_param_spec_size
|
||||
gtk_value_set_size
|
||||
gtk_value_get_size
|
||||
gtk_value_size_skip_conversion
|
||||
gtk_param_spec_usize
|
||||
gtk_value_set_usize
|
||||
gtk_value_get_usize
|
||||
gtk_value_usize_skip_conversion
|
||||
gtk_enable_resolution_independence
|
||||
</SECTION>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,229 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Units
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GtkSize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GtkUSize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkSizeUnit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_SIZE_UNIT_PIXEL:
|
||||
@GTK_SIZE_UNIT_EM:
|
||||
@GTK_SIZE_UNIT_MM:
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_em ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@em:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_mm ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mm:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_em ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_mm ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_ONE_TWELFTH_EM ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_MAXPIXEL ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_MINPIXEL ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_unit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_pixel ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@screen:
|
||||
@monitor_num:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_pixel_double ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@screen:
|
||||
@monitor_num:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_param_spec_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@nick:
|
||||
@blurb:
|
||||
@minimum:
|
||||
@maximum:
|
||||
@default_value:
|
||||
@flags:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_set_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@v_size:
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_get_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_size_skip_conversion ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_param_spec_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@nick:
|
||||
@blurb:
|
||||
@minimum:
|
||||
@maximum:
|
||||
@default_value:
|
||||
@flags:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_set_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@v_size:
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_get_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_usize_skip_conversion ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_enable_resolution_independence ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
@@ -889,6 +889,7 @@ gdk_pango_attr_embossed_new
|
||||
gdk_pango_attr_stipple_new
|
||||
gdk_pango_context_get
|
||||
gdk_pango_context_get_for_screen
|
||||
gdk_pango_context_get_for_screen_for_monitor
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gdk_pango_context_set_colormap
|
||||
#endif
|
||||
@@ -1008,8 +1009,12 @@ gdk_screen_get_monitor_at_point
|
||||
gdk_screen_get_monitor_at_window
|
||||
gdk_screen_set_font_options
|
||||
gdk_screen_get_font_options
|
||||
gdk_screen_set_font_options_for_monitor
|
||||
gdk_screen_get_font_options_for_monitor
|
||||
gdk_screen_set_resolution
|
||||
gdk_screen_get_resolution
|
||||
gdk_screen_get_resolution_for_monitor
|
||||
gdk_screen_set_resolution_for_monitor
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1496,5 +1496,41 @@ gdk_pango_context_get_for_screen (GdkScreen *screen)
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pango_context_get_for_screen_for_monitor:
|
||||
* @screen: the #GdkScreen for which the context is to be created.
|
||||
* @monitor_num: monitor number or -1 to use default monitor
|
||||
*
|
||||
* Like gdk_pango_context_get_for_screen() but also takes a monitor
|
||||
* number.
|
||||
*
|
||||
* Return value: a new #PangoContext for @screen
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
PangoContext *
|
||||
gdk_pango_context_get_for_screen_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
PangoFontMap *fontmap;
|
||||
PangoContext *context;
|
||||
const cairo_font_options_t *options;
|
||||
double dpi;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
fontmap = pango_cairo_font_map_get_default ();
|
||||
|
||||
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
|
||||
|
||||
options = gdk_screen_get_font_options_for_monitor (screen, monitor_num);
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
|
||||
dpi = gdk_screen_get_resolution_for_monitor (screen, monitor_num);
|
||||
pango_cairo_context_set_resolution (context, dpi);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
#define __GDK_PANGO_C__
|
||||
#include "gdkaliasdef.c"
|
||||
|
||||
@@ -104,6 +104,9 @@ void gdk_pango_renderer_set_override_color (GdkPangoRenderer *gdk_renderer,
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
PangoContext *gdk_pango_context_get_for_screen_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
PangoContext *gdk_pango_context_get_for_screen (GdkScreen *screen);
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
PangoContext *gdk_pango_context_get (void);
|
||||
|
||||
@@ -428,6 +428,25 @@ gdk_screen_set_font_options (GdkScreen *screen,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_font_options_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @options: a #cairo_font_options_t, or %NULL to unset any
|
||||
* previously set default font options.
|
||||
*
|
||||
* Like gdk_screen_set_font_options() but per monitor.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gdk_screen_set_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
const cairo_font_options_t *options)
|
||||
{
|
||||
/* TODO: need to implement per-monitor font options */
|
||||
return gdk_screen_set_font_options (screen, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_font_options:
|
||||
* @screen: a #GdkScreen
|
||||
@@ -447,6 +466,26 @@ gdk_screen_get_font_options (GdkScreen *screen)
|
||||
return screen->font_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_font_options_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number or -1 for default monitor
|
||||
*
|
||||
* Like gdk_screen_get_font_options() but per monitor.
|
||||
*
|
||||
* Return value: the current font options, or %NULL if no default
|
||||
* font options have been set.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
const cairo_font_options_t *
|
||||
gdk_screen_get_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
/* TODO: need to implement per-monitor font options */
|
||||
return gdk_screen_get_font_options (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_resolution:
|
||||
* @screen: a #GdkScreen
|
||||
@@ -497,6 +536,50 @@ gdk_screen_get_resolution (GdkScreen *screen)
|
||||
return screen->resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_resolution_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number or -1 for default monitor
|
||||
*
|
||||
* Like gdk_screen_get_resolution() but per monitor.
|
||||
*
|
||||
* Returns: the current resolution or -1 if no resolution has been
|
||||
* set.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
gdouble
|
||||
gdk_screen_get_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
#if 0
|
||||
/* Nifty trick to test RI - monitor 0 will have 3 times the user configured DPI */
|
||||
return (monitor_num == 0 ? 3.0 : 1.0) * gdk_screen_get_resolution (screen);
|
||||
#endif
|
||||
/* TODO: need to implement per-monitor resolution */
|
||||
return gdk_screen_get_resolution (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_resolution_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number
|
||||
* @dpi: the resolution in "dots per inch". (Physical inches aren't actually
|
||||
* involved; the terminology is conventional.)
|
||||
*
|
||||
* Like gdk_screen_set_resolution() but per monitor.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gdk_screen_set_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
gdouble dpi)
|
||||
{
|
||||
/* TODO: need to implement per-monitor resolution */
|
||||
gdk_screen_set_resolution (screen, dpi);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_screen_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
||||
@@ -118,10 +118,23 @@ void gdk_screen_set_font_options (GdkScreen
|
||||
const cairo_font_options_t *options);
|
||||
const cairo_font_options_t *gdk_screen_get_font_options (GdkScreen *screen);
|
||||
|
||||
void gdk_screen_set_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
const cairo_font_options_t *options);
|
||||
const cairo_font_options_t *gdk_screen_get_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
void gdk_screen_set_resolution (GdkScreen *screen,
|
||||
gdouble dpi);
|
||||
gdouble gdk_screen_get_resolution (GdkScreen *screen);
|
||||
|
||||
gdouble gdk_screen_get_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
void gdk_screen_set_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
gdouble dpi);
|
||||
|
||||
GdkWindow *gdk_screen_get_active_window (GdkScreen *screen);
|
||||
GList *gdk_screen_get_window_stack (GdkScreen *screen);
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ gtk_public_h_sources = \
|
||||
gtkseparatortoolitem.h \
|
||||
gtkshow.h \
|
||||
gtksettings.h \
|
||||
gtksize.h \
|
||||
gtksizegroup.h \
|
||||
gtksocket.h \
|
||||
gtkspinbutton.h \
|
||||
@@ -549,6 +550,7 @@ gtk_base_c_sources = \
|
||||
gtkseparatormenuitem.c \
|
||||
gtkseparatortoolitem.c \
|
||||
gtksettings.c \
|
||||
gtksize.c \
|
||||
gtksizegroup.c \
|
||||
gtkshow.c \
|
||||
gtksocket.c \
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
#include <gtk/gtkseparatortoolitem.h>
|
||||
#include <gtk/gtksettings.h>
|
||||
#include <gtk/gtkshow.h>
|
||||
#include <gtk/gtksize.h>
|
||||
#include <gtk/gtksizegroup.h>
|
||||
#include <gtk/gtksocket.h>
|
||||
#include <gtk/gtkspinbutton.h>
|
||||
|
||||
@@ -266,6 +266,7 @@ gtk_adjustment_value_changed
|
||||
#if IN_HEADER(__GTK_ALIGNMENT_H__)
|
||||
#if IN_FILE(__GTK_ALIGNMENT_C__)
|
||||
gtk_alignment_get_padding
|
||||
gtk_alignment_get_padding_unit
|
||||
gtk_alignment_get_type G_GNUC_CONST
|
||||
gtk_alignment_new
|
||||
gtk_alignment_set
|
||||
@@ -470,6 +471,7 @@ gtk_bin_get_type G_GNUC_CONST
|
||||
#if IN_FILE(__GTK_BOX_C__)
|
||||
gtk_box_get_homogeneous
|
||||
gtk_box_get_spacing
|
||||
gtk_box_get_spacing_unit
|
||||
gtk_box_get_type G_GNUC_CONST
|
||||
gtk_box_pack_end
|
||||
gtk_box_pack_start
|
||||
@@ -478,6 +480,7 @@ gtk_box_pack_end_defaults
|
||||
gtk_box_pack_start_defaults
|
||||
#endif
|
||||
gtk_box_query_child_packing
|
||||
gtk_box_query_child_packing_unit
|
||||
gtk_box_reorder_child
|
||||
gtk_box_set_child_packing
|
||||
gtk_box_set_homogeneous
|
||||
@@ -625,12 +628,16 @@ gtk_cell_renderer_activate
|
||||
gtk_cell_renderer_editing_canceled
|
||||
#endif
|
||||
gtk_cell_renderer_get_fixed_size
|
||||
gtk_cell_renderer_get_fixed_size_unit
|
||||
gtk_cell_renderer_get_size
|
||||
gtk_cell_renderer_get_size_unit
|
||||
gtk_cell_renderer_get_type G_GNUC_CONST
|
||||
gtk_cell_renderer_render
|
||||
gtk_cell_renderer_set_fixed_size
|
||||
gtk_cell_renderer_start_editing
|
||||
gtk_cell_renderer_stop_editing
|
||||
gtk_cell_renderer_get_tree_view_column
|
||||
gtk_cell_renderer_get_tree_view
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1008,6 +1015,7 @@ gtk_container_set_focus_vadjustment
|
||||
gtk_container_set_reallocate_redraws
|
||||
gtk_container_set_resize_mode
|
||||
gtk_container_unset_focus_chain
|
||||
gtk_container_get_border_width_unit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1434,6 +1442,7 @@ gtk_expander_get_expanded
|
||||
gtk_expander_get_label
|
||||
gtk_expander_get_label_widget
|
||||
gtk_expander_get_spacing
|
||||
gtk_expander_get_spacing_unit
|
||||
gtk_expander_get_type G_GNUC_CONST
|
||||
gtk_expander_get_use_markup
|
||||
gtk_expander_get_use_underline
|
||||
@@ -1816,6 +1825,7 @@ gtk_hseparator_new
|
||||
#if IN_FILE(__GTK_HSV_C__)
|
||||
gtk_hsv_get_color
|
||||
gtk_hsv_get_metrics
|
||||
gtk_hsv_get_metrics_unit
|
||||
gtk_hsv_get_type G_GNUC_CONST
|
||||
gtk_hsv_is_adjusting
|
||||
gtk_hsv_new
|
||||
@@ -1838,7 +1848,10 @@ gtk_icon_factory_remove_default
|
||||
gtk_icon_size_from_name
|
||||
gtk_icon_size_get_name
|
||||
gtk_icon_size_lookup
|
||||
gtk_icon_size_lookup_unit
|
||||
gtk_icon_size_lookup_for_settings
|
||||
gtk_icon_size_lookup_for_settings_for_monitor
|
||||
gtk_icon_size_lookup_for_settings_unit
|
||||
gtk_icon_size_register
|
||||
gtk_icon_size_register_alias
|
||||
gtk_icon_set_add_source
|
||||
@@ -1952,10 +1965,13 @@ gtk_icon_theme_set_search_path_utf8
|
||||
#if IN_HEADER(__GTK_ICON_VIEW_H__)
|
||||
#if IN_FILE(__GTK_ICON_VIEW_C__)
|
||||
gtk_icon_view_get_column_spacing
|
||||
gtk_icon_view_get_column_spacing_unit
|
||||
gtk_icon_view_get_columns
|
||||
gtk_icon_view_get_cursor
|
||||
gtk_icon_view_get_item_width
|
||||
gtk_icon_view_get_item_width_unit
|
||||
gtk_icon_view_get_margin
|
||||
gtk_icon_view_get_margin_unit
|
||||
gtk_icon_view_get_markup_column
|
||||
gtk_icon_view_get_model
|
||||
gtk_icon_view_get_orientation
|
||||
@@ -1964,9 +1980,11 @@ gtk_icon_view_get_item_at_pos
|
||||
gtk_icon_view_convert_widget_to_bin_window_coords
|
||||
gtk_icon_view_get_pixbuf_column
|
||||
gtk_icon_view_get_row_spacing
|
||||
gtk_icon_view_get_row_spacing_unit
|
||||
gtk_icon_view_get_selected_items
|
||||
gtk_icon_view_get_selection_mode
|
||||
gtk_icon_view_get_spacing
|
||||
gtk_icon_view_get_spacing_unit
|
||||
gtk_icon_view_get_text_column
|
||||
gtk_icon_view_get_type G_GNUC_CONST
|
||||
gtk_icon_view_get_visible_range
|
||||
@@ -2024,6 +2042,7 @@ gtk_image_get_icon_set
|
||||
gtk_image_get_image
|
||||
gtk_image_get_pixbuf
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_get_pixel_size_unit
|
||||
gtk_image_get_pixmap
|
||||
gtk_image_get_stock
|
||||
gtk_image_get_gicon
|
||||
@@ -2535,6 +2554,7 @@ gtk_message_dialog_get_image
|
||||
#if IN_FILE(__GTK_MISC_C__)
|
||||
gtk_misc_get_alignment
|
||||
gtk_misc_get_padding
|
||||
gtk_misc_get_padding_unit
|
||||
gtk_misc_get_type G_GNUC_CONST
|
||||
gtk_misc_set_alignment
|
||||
gtk_misc_set_padding
|
||||
@@ -3773,10 +3793,14 @@ gtk_stock_set_translate_func
|
||||
gtk_table_attach
|
||||
gtk_table_attach_defaults
|
||||
gtk_table_get_col_spacing
|
||||
gtk_table_get_col_spacing_unit
|
||||
gtk_table_get_default_col_spacing
|
||||
gtk_table_get_default_col_spacing_unit
|
||||
gtk_table_get_default_row_spacing
|
||||
gtk_table_get_default_row_spacing_unit
|
||||
gtk_table_get_homogeneous
|
||||
gtk_table_get_row_spacing
|
||||
gtk_table_get_row_spacing_unit
|
||||
gtk_table_get_type G_GNUC_CONST
|
||||
gtk_table_new
|
||||
gtk_table_resize
|
||||
@@ -4124,18 +4148,24 @@ gtk_text_view_get_cursor_visible
|
||||
gtk_text_view_get_default_attributes
|
||||
gtk_text_view_get_editable
|
||||
gtk_text_view_get_indent
|
||||
gtk_text_view_get_indent_unit
|
||||
gtk_text_view_get_iter_at_location
|
||||
gtk_text_view_get_iter_at_position
|
||||
gtk_text_view_get_iter_location
|
||||
gtk_text_view_get_justification
|
||||
gtk_text_view_get_left_margin
|
||||
gtk_text_view_get_left_margin_unit
|
||||
gtk_text_view_get_line_at_y
|
||||
gtk_text_view_get_line_yrange
|
||||
gtk_text_view_get_overwrite
|
||||
gtk_text_view_get_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines_unit
|
||||
gtk_text_view_get_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines_unit
|
||||
gtk_text_view_get_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap_unit
|
||||
gtk_text_view_get_right_margin
|
||||
gtk_text_view_get_right_margin_unit
|
||||
gtk_text_view_get_tabs
|
||||
gtk_text_view_get_type G_GNUC_CONST
|
||||
gtk_text_view_get_visible_rect
|
||||
@@ -4610,8 +4640,11 @@ gtk_tree_view_column_get_cell_renderers
|
||||
gtk_tree_view_column_get_clickable
|
||||
gtk_tree_view_column_get_expand
|
||||
gtk_tree_view_column_get_fixed_width
|
||||
gtk_tree_view_column_get_fixed_width_unit
|
||||
gtk_tree_view_column_get_max_width
|
||||
gtk_tree_view_column_get_max_width_unit
|
||||
gtk_tree_view_column_get_min_width
|
||||
gtk_tree_view_column_get_min_width_unit
|
||||
gtk_tree_view_column_get_reorderable
|
||||
gtk_tree_view_column_get_resizable
|
||||
gtk_tree_view_column_get_sizing
|
||||
@@ -4619,6 +4652,7 @@ gtk_tree_view_column_get_sort_column_id
|
||||
gtk_tree_view_column_get_sort_indicator
|
||||
gtk_tree_view_column_get_sort_order
|
||||
gtk_tree_view_column_get_spacing
|
||||
gtk_tree_view_column_get_spacing_unit
|
||||
gtk_tree_view_column_get_title
|
||||
gtk_tree_view_column_get_tree_view
|
||||
gtk_tree_view_column_get_type G_GNUC_CONST
|
||||
@@ -4687,6 +4721,7 @@ gtk_tree_view_get_headers_visible
|
||||
gtk_tree_view_get_hover_expand
|
||||
gtk_tree_view_get_hover_selection
|
||||
gtk_tree_view_get_level_indentation
|
||||
gtk_tree_view_get_level_indentation_unit
|
||||
gtk_tree_view_get_model
|
||||
gtk_tree_view_get_path_at_pos
|
||||
gtk_tree_view_get_reorderable
|
||||
@@ -5033,6 +5068,15 @@ gtk_widget_unmap
|
||||
gtk_widget_unparent
|
||||
gtk_widget_unrealize
|
||||
gtk_widget_get_window
|
||||
gtk_widget_get_monitor_num
|
||||
gtk_widget_get_size_request_unit
|
||||
gtk_widget_size_to_pixel
|
||||
gtk_widget_size_to_pixel_double
|
||||
gtk_widget_style_get_property_unit
|
||||
gtk_widget_style_get_unit_valist
|
||||
gtk_widget_style_get_unit
|
||||
gtk_widget_get_unit_valist
|
||||
gtk_widget_get_unit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5055,6 +5099,7 @@ gtk_window_get_default_widget
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_default_size_unit
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_focus
|
||||
gtk_window_get_focus_on_map
|
||||
@@ -5157,6 +5202,7 @@ gtk_window_stick
|
||||
gtk_window_unfullscreen
|
||||
gtk_window_unmaximize
|
||||
gtk_window_unstick
|
||||
gtk_window_get_monitor_num
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5168,6 +5214,30 @@ gtk_win32_embed_widget_get_type G_GNUC_CONST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_SIZE_H__)
|
||||
#if IN_FILE(__GTK_SIZE_C__)
|
||||
gtk_enable_resolution_independence
|
||||
gtk_size_em
|
||||
gtk_size_mm
|
||||
gtk_size_get_unit
|
||||
gtk_size_get_em
|
||||
gtk_size_get_mm
|
||||
gtk_size_to_pixel
|
||||
gtk_size_to_pixel_double
|
||||
gtk_size_to_string
|
||||
gtk_param_size_get_type G_GNUC_CONST
|
||||
gtk_param_spec_size
|
||||
gtk_value_set_size
|
||||
gtk_value_get_size
|
||||
gtk_value_size_skip_conversion
|
||||
gtk_param_usize_get_type G_GNUC_CONST
|
||||
gtk_param_spec_usize
|
||||
gtk_value_set_usize
|
||||
gtk_value_get_usize
|
||||
gtk_value_usize_skip_conversion
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_INFO_BAR_H__)
|
||||
#if IN_FILE(__GTK_INFO_BAR_C__)
|
||||
gtk_info_bar_get_type G_GNUC_CONST
|
||||
|
||||
+15
-15
@@ -489,15 +489,15 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
priv->wrap_license = FALSE;
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Widgets */
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, TRUE, TRUE, 0);
|
||||
|
||||
priv->logo_image = gtk_image_new ();
|
||||
@@ -2127,12 +2127,12 @@ display_credits_dialog (GtkWidget *button,
|
||||
NULL);
|
||||
credits_dialog = GTK_DIALOG (dialog);
|
||||
gtk_dialog_set_has_separator (credits_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (credits_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (credits_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
priv->credits_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), GTK_SIZE_ONE_TWELFTH_EM (360), GTK_SIZE_ONE_TWELFTH_EM (260));
|
||||
gtk_dialog_set_default_response (credits_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
@@ -2145,7 +2145,7 @@ display_credits_dialog (GtkWidget *button,
|
||||
&(priv->credits_dialog));
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
if (priv->authors != NULL)
|
||||
@@ -2204,12 +2204,12 @@ display_license_dialog (GtkWidget *button,
|
||||
NULL);
|
||||
licence_dialog = GTK_DIALOG (dialog);
|
||||
gtk_dialog_set_has_separator (licence_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (licence_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (licence_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
priv->license_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 320);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), GTK_SIZE_ONE_TWELFTH_EM (420), GTK_SIZE_ONE_TWELFTH_EM (320));
|
||||
gtk_dialog_set_default_response (licence_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
@@ -2222,7 +2222,7 @@ display_license_dialog (GtkWidget *button,
|
||||
&(priv->license_dialog));
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (sw), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
|
||||
+80
-53
@@ -48,10 +48,10 @@ enum {
|
||||
|
||||
struct _GtkAlignmentPrivate
|
||||
{
|
||||
guint padding_top;
|
||||
guint padding_bottom;
|
||||
guint padding_left;
|
||||
guint padding_right;
|
||||
GtkUSize padding_top;
|
||||
GtkUSize padding_bottom;
|
||||
GtkUSize padding_left;
|
||||
GtkUSize padding_right;
|
||||
};
|
||||
|
||||
static void gtk_alignment_size_request (GtkWidget *widget,
|
||||
@@ -132,13 +132,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TOP_PADDING,
|
||||
g_param_spec_uint("top-padding",
|
||||
P_("Top Padding"),
|
||||
P_("The padding to insert at the top of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("top-padding",
|
||||
P_("Top Padding"),
|
||||
P_("The padding to insert at the top of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:bottom-padding:
|
||||
@@ -149,13 +147,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BOTTOM_PADDING,
|
||||
g_param_spec_uint("bottom-padding",
|
||||
P_("Bottom Padding"),
|
||||
P_("The padding to insert at the bottom of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("bottom-padding",
|
||||
P_("Bottom Padding"),
|
||||
P_("The padding to insert at the bottom of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:left-padding:
|
||||
@@ -166,13 +162,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LEFT_PADDING,
|
||||
g_param_spec_uint("left-padding",
|
||||
P_("Left Padding"),
|
||||
P_("The padding to insert at the left of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("left-padding",
|
||||
P_("Left Padding"),
|
||||
P_("The padding to insert at the left of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:right-padding:
|
||||
@@ -183,13 +177,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RIGHT_PADDING,
|
||||
g_param_spec_uint("right-padding",
|
||||
P_("Right Padding"),
|
||||
P_("The padding to insert at the right of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("right-padding",
|
||||
P_("Right Padding"),
|
||||
P_("The padding to insert at the right of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkAlignmentPrivate));
|
||||
}
|
||||
@@ -279,7 +271,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
/* Padding: */
|
||||
case PROP_TOP_PADDING:
|
||||
gtk_alignment_set_padding (alignment,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_bottom,
|
||||
priv->padding_left,
|
||||
priv->padding_right);
|
||||
@@ -287,7 +279,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
case PROP_BOTTOM_PADDING:
|
||||
gtk_alignment_set_padding (alignment,
|
||||
priv->padding_top,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_left,
|
||||
priv->padding_right);
|
||||
break;
|
||||
@@ -295,7 +287,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
gtk_alignment_set_padding (alignment,
|
||||
priv->padding_top,
|
||||
priv->padding_bottom,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_right);
|
||||
break;
|
||||
case PROP_RIGHT_PADDING:
|
||||
@@ -303,7 +295,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
priv->padding_top,
|
||||
priv->padding_bottom,
|
||||
priv->padding_left,
|
||||
g_value_get_uint (value));
|
||||
gtk_value_get_usize (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -341,16 +333,16 @@ gtk_alignment_get_property (GObject *object,
|
||||
|
||||
/* Padding: */
|
||||
case PROP_TOP_PADDING:
|
||||
g_value_set_uint (value, priv->padding_top);
|
||||
gtk_value_set_usize (value, priv->padding_top, alignment);
|
||||
break;
|
||||
case PROP_BOTTOM_PADDING:
|
||||
g_value_set_uint (value, priv->padding_bottom);
|
||||
gtk_value_set_usize (value, priv->padding_bottom, alignment);
|
||||
break;
|
||||
case PROP_LEFT_PADDING:
|
||||
g_value_set_uint (value, priv->padding_left);
|
||||
gtk_value_set_usize (value, priv->padding_left, alignment);
|
||||
break;
|
||||
case PROP_RIGHT_PADDING:
|
||||
g_value_set_uint (value, priv->padding_right);
|
||||
gtk_value_set_usize (value, priv->padding_right, alignment);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -431,8 +423,8 @@ gtk_alignment_size_request (GtkWidget *widget,
|
||||
requisition->height += child_requisition.height;
|
||||
|
||||
/* Request extra space for the padding: */
|
||||
requisition->width += (priv->padding_left + priv->padding_right);
|
||||
requisition->height += (priv->padding_top + priv->padding_bottom);
|
||||
requisition->width += (gtk_widget_size_to_pixel (widget, priv->padding_left) + gtk_widget_size_to_pixel (widget, priv->padding_right));
|
||||
requisition->height += (gtk_widget_size_to_pixel (widget, priv->padding_top) + gtk_widget_size_to_pixel (widget, priv->padding_bottom));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,8 +455,8 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
border_width = GTK_CONTAINER (alignment)->border_width;
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
|
||||
padding_horizontal = priv->padding_left + priv->padding_right;
|
||||
padding_vertical = priv->padding_top + priv->padding_bottom;
|
||||
padding_horizontal = gtk_widget_size_to_pixel (widget, priv->padding_left) + gtk_widget_size_to_pixel (widget, priv->padding_right);
|
||||
padding_vertical = gtk_widget_size_to_pixel (widget, priv->padding_top) + gtk_widget_size_to_pixel (widget, priv->padding_bottom);
|
||||
|
||||
width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
|
||||
height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
|
||||
@@ -484,11 +476,11 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
child_allocation.height = height;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
|
||||
child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + gtk_widget_size_to_pixel (widget, priv->padding_right);
|
||||
else
|
||||
child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
||||
child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + gtk_widget_size_to_pixel (widget, priv->padding_left);
|
||||
|
||||
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
||||
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + gtk_widget_size_to_pixel (widget, priv->padding_top);
|
||||
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
@@ -511,10 +503,10 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
*/
|
||||
void
|
||||
gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
guint padding_top,
|
||||
guint padding_bottom,
|
||||
guint padding_left,
|
||||
guint padding_right)
|
||||
GtkUSize padding_top,
|
||||
GtkUSize padding_bottom,
|
||||
GtkUSize padding_left,
|
||||
GtkUSize padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
@@ -562,8 +554,9 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
* @padding_left: location to store the padding for the left of the widget, or %NULL
|
||||
* @padding_right: location to store the padding for the right of the widget, or %NULL
|
||||
*
|
||||
* Gets the padding on the different sides of the widget.
|
||||
* See gtk_alignment_set_padding ().
|
||||
* Gets the padding in pixels on the different sides of the widget.
|
||||
* See gtk_alignment_set_padding (). Use gtk_alignment_get_padding_unit() to
|
||||
* preserve units.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
@@ -578,6 +571,40 @@ gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
if(padding_top)
|
||||
*padding_top = gtk_widget_size_to_pixel (alignment, priv->padding_top);
|
||||
if(padding_bottom)
|
||||
*padding_bottom = gtk_widget_size_to_pixel (alignment, priv->padding_bottom);
|
||||
if(padding_left)
|
||||
*padding_left = gtk_widget_size_to_pixel (alignment, priv->padding_left);
|
||||
if(padding_right)
|
||||
*padding_right = gtk_widget_size_to_pixel (alignment, priv->padding_right);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_alignment_get_padding_unit:
|
||||
* @alignment: a #GtkAlignment
|
||||
* @padding_top: location to store the padding for the top of the widget, or %NULL
|
||||
* @padding_bottom: location to store the padding for the bottom of the widget, or %NULL
|
||||
* @padding_left: location to store the padding for the left of the widget, or %NULL
|
||||
* @padding_right: location to store the padding for the right of the widget, or %NULL
|
||||
*
|
||||
* Like gtk_alignment_get_padding() but preserves the unit.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
void
|
||||
gtk_alignment_get_padding_unit (GtkAlignment *alignment,
|
||||
GtkUSize *padding_top,
|
||||
GtkUSize *padding_bottom,
|
||||
GtkUSize *padding_left,
|
||||
GtkUSize *padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
if(padding_top)
|
||||
*padding_top = priv->padding_top;
|
||||
|
||||
+10
-4
@@ -77,10 +77,10 @@ void gtk_alignment_set (GtkAlignment *alignment,
|
||||
gfloat yscale);
|
||||
|
||||
void gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
guint padding_top,
|
||||
guint padding_bottom,
|
||||
guint padding_left,
|
||||
guint padding_right);
|
||||
GtkUSize padding_top,
|
||||
GtkUSize padding_bottom,
|
||||
GtkUSize padding_left,
|
||||
GtkUSize padding_right);
|
||||
|
||||
void gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
guint *padding_top,
|
||||
@@ -88,6 +88,12 @@ void gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
guint *padding_left,
|
||||
guint *padding_right);
|
||||
|
||||
void gtk_alignment_get_padding_unit (GtkAlignment *alignment,
|
||||
GtkUSize *padding_top,
|
||||
GtkUSize *padding_bottom,
|
||||
GtkUSize *padding_left,
|
||||
GtkUSize *padding_right);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
||||
+12
-5
@@ -31,7 +31,7 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
#define MIN_ARROW_SIZE 15
|
||||
#define MIN_ARROW_SIZE GTK_SIZE_ONE_TWELFTH_EM(15)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -50,7 +50,8 @@ static void gtk_arrow_get_property (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
static gboolean gtk_arrow_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
static void gtk_arrow_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
|
||||
G_DEFINE_TYPE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
|
||||
|
||||
@@ -68,6 +69,7 @@ gtk_arrow_class_init (GtkArrowClass *class)
|
||||
gobject_class->get_property = gtk_arrow_get_property;
|
||||
|
||||
widget_class->expose_event = gtk_arrow_expose;
|
||||
widget_class->size_request = gtk_arrow_size_request;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ARROW_TYPE,
|
||||
@@ -148,9 +150,6 @@ gtk_arrow_init (GtkArrow *arrow)
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW);
|
||||
|
||||
GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
|
||||
GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
|
||||
|
||||
arrow->arrow_type = GTK_ARROW_RIGHT;
|
||||
arrow->shadow_type = GTK_SHADOW_OUT;
|
||||
}
|
||||
@@ -200,6 +199,14 @@ gtk_arrow_set (GtkArrow *arrow,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_arrow_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkArrow *arrow = GTK_ARROW (widget);
|
||||
requisition->width = gtk_widget_size_to_pixel (arrow, MIN_ARROW_SIZE) + GTK_MISC (arrow)->xpad * 2;
|
||||
requisition->height = gtk_widget_size_to_pixel (arrow, MIN_ARROW_SIZE) + GTK_MISC (arrow)->ypad * 2;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_arrow_expose (GtkWidget *widget,
|
||||
|
||||
+20
-23
@@ -46,8 +46,8 @@
|
||||
|
||||
#define GTK_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ASSISTANT, GtkAssistantPrivate))
|
||||
|
||||
#define HEADER_SPACING 12
|
||||
#define ACTION_AREA_SPACING 12
|
||||
#define HEADER_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
#define ACTION_AREA_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
|
||||
typedef struct _GtkAssistantPage GtkAssistantPage;
|
||||
|
||||
@@ -277,21 +277,17 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("header-padding",
|
||||
P_("Header Padding"),
|
||||
P_("Number of pixels around the header."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("header-padding",
|
||||
P_("Header Padding"),
|
||||
P_("Number of pixels around the header."),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-padding",
|
||||
P_("Content Padding"),
|
||||
P_("Number of pixels around the content pages."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-padding",
|
||||
P_("Content Padding"),
|
||||
P_("Number of pixels around the content pages."),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (1),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkAssistant:page-type:
|
||||
@@ -727,7 +723,8 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
|
||||
|
||||
gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (assistant),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
@@ -744,7 +741,7 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
gtk_widget_show (priv->sidebar_image);
|
||||
|
||||
/* Action area */
|
||||
priv->action_area = gtk_hbox_new (FALSE, 6);
|
||||
priv->action_area = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
assistant->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
assistant->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
|
||||
@@ -1104,7 +1101,7 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
|
||||
if (page->header_image)
|
||||
{
|
||||
w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
|
||||
w += gdk_pixbuf_get_width (page->header_image) + gtk_widget_size_to_pixel (widget, HEADER_SPACING);
|
||||
h = MAX (h, gdk_pixbuf_get_height (page->header_image));
|
||||
}
|
||||
|
||||
@@ -1125,7 +1122,7 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
|
||||
gtk_widget_size_request (priv->action_area, &child_requisition);
|
||||
width = MAX (width, child_requisition.width);
|
||||
height += child_requisition.height + ACTION_AREA_SPACING;
|
||||
height += child_requisition.height + gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING);
|
||||
|
||||
width += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
height += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
@@ -1196,7 +1193,7 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
priv->header_image->allocation.height + 2 * header_padding + content_padding;
|
||||
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
|
||||
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
|
||||
priv->header_image->allocation.height - 2 * header_padding - ACTION_AREA_SPACING - priv->action_area->allocation.height - 2 * content_padding;
|
||||
priv->header_image->allocation.height - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING) - priv->action_area->allocation.height - 2 * content_padding;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (priv->sidebar_image))
|
||||
{
|
||||
@@ -1327,7 +1324,7 @@ assistant_paint_colored_box (GtkWidget *widget)
|
||||
border_width,
|
||||
border_width,
|
||||
widget->allocation.width - 2 * border_width,
|
||||
widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - ACTION_AREA_SPACING);
|
||||
widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
|
||||
cairo_fill (cr);
|
||||
|
||||
/* content box */
|
||||
@@ -1348,7 +1345,7 @@ assistant_paint_colored_box (GtkWidget *widget)
|
||||
priv->header_image->allocation.height + content_padding + 2 * header_padding + border_width,
|
||||
content_width,
|
||||
widget->allocation.height - 2 * border_width - priv->action_area->allocation.height -
|
||||
priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
|
||||
priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
+38
-46
@@ -64,9 +64,9 @@ static void gtk_button_box_get_child_property (GtkContainer *container,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
#define DEFAULT_CHILD_MIN_WIDTH 85
|
||||
#define DEFAULT_CHILD_MIN_HEIGHT 27
|
||||
#define DEFAULT_CHILD_IPAD_X 4
|
||||
#define DEFAULT_CHILD_MIN_WIDTH GTK_SIZE_ONE_TWELFTH_EM(85)
|
||||
#define DEFAULT_CHILD_MIN_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(27)
|
||||
#define DEFAULT_CHILD_IPAD_X GTK_SIZE_ONE_TWELFTH_EM(4)
|
||||
#define DEFAULT_CHILD_IPAD_Y 0
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
|
||||
@@ -95,40 +95,32 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
* libgobject allows that.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-min-width",
|
||||
P_("Minimum child width"),
|
||||
P_("Minimum width of buttons inside the box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_MIN_WIDTH,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-min-width",
|
||||
P_("Minimum child width"),
|
||||
P_("Minimum width of buttons inside the box"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_MIN_WIDTH,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-min-height",
|
||||
P_("Minimum child height"),
|
||||
P_("Minimum height of buttons inside the box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_MIN_HEIGHT,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-min-height",
|
||||
P_("Minimum child height"),
|
||||
P_("Minimum height of buttons inside the box"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_MIN_HEIGHT,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-internal-pad-x",
|
||||
P_("Child internal width padding"),
|
||||
P_("Amount to increase child's size on either side"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_IPAD_X,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-internal-pad-x",
|
||||
P_("Child internal width padding"),
|
||||
P_("Amount to increase child's size on either side"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_IPAD_X,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-internal-pad-y",
|
||||
P_("Child internal height padding"),
|
||||
P_("Amount to increase child's size on the top and bottom"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_IPAD_Y,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-internal-pad-y",
|
||||
P_("Child internal height padding"),
|
||||
P_("Amount to increase child's size on the top and bottom"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_IPAD_Y,
|
||||
GTK_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAYOUT_STYLE,
|
||||
g_param_spec_enum ("layout-style",
|
||||
@@ -150,7 +142,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
static void
|
||||
gtk_button_box_init (GtkButtonBox *button_box)
|
||||
{
|
||||
GTK_BOX (button_box)->spacing = 0;
|
||||
gtk_box_set_spacing (GTK_BOX (button_box), 0);
|
||||
button_box->child_min_width = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_min_height = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
|
||||
@@ -236,7 +228,7 @@ gtk_button_box_get_child_property (GtkContainer *container,
|
||||
|
||||
void
|
||||
gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
gint width, gint height)
|
||||
GtkSize width, GtkSize height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
|
||||
@@ -246,7 +238,7 @@ gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
|
||||
void
|
||||
gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
|
||||
gint ipad_x, gint ipad_y)
|
||||
GtkSize ipad_x, GtkSize ipad_y)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
|
||||
@@ -281,8 +273,8 @@ gtk_button_box_get_child_size (GtkButtonBox *widget,
|
||||
g_return_if_fail (width != NULL);
|
||||
g_return_if_fail (height != NULL);
|
||||
|
||||
*width = widget->child_min_width;
|
||||
*height = widget->child_min_height;
|
||||
*width = gtk_widget_size_to_pixel (widget, widget->child_min_width);
|
||||
*height = gtk_widget_size_to_pixel (widget, widget->child_min_height);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -293,8 +285,8 @@ gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
|
||||
g_return_if_fail (ipad_x != NULL);
|
||||
g_return_if_fail (ipad_y != NULL);
|
||||
|
||||
*ipad_x = widget->child_ipad_x;
|
||||
*ipad_y = widget->child_ipad_y;
|
||||
*ipad_x = gtk_widget_size_to_pixel (widget, widget->child_ipad_x);
|
||||
*ipad_y = gtk_widget_size_to_pixel (widget, widget->child_ipad_y);
|
||||
}
|
||||
|
||||
GtkButtonBoxStyle
|
||||
@@ -433,14 +425,14 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
"child-internal-pad-y", &ipad_y_default,
|
||||
NULL);
|
||||
|
||||
child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_width : width_default;
|
||||
child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_height : height_default;
|
||||
ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_x : ipad_x_default;
|
||||
ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_y : ipad_y_default;
|
||||
child_min_width = gtk_widget_size_to_pixel (widget, bbox->child_min_width) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_min_width) : width_default;
|
||||
child_min_height = gtk_widget_size_to_pixel (widget, bbox->child_min_height) !=GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_min_height) : height_default;
|
||||
ipad_x = gtk_widget_size_to_pixel (widget, bbox->child_ipad_x) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_ipad_x) : ipad_x_default;
|
||||
ipad_y = gtk_widget_size_to_pixel (widget, bbox->child_ipad_y) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_ipad_y) : ipad_y_default;
|
||||
|
||||
nchildren = 0;
|
||||
nsecondaries = 0;
|
||||
|
||||
+9
-8
@@ -52,10 +52,10 @@ typedef struct _GtkButtonBoxClass GtkButtonBoxClass;
|
||||
struct _GtkButtonBox
|
||||
{
|
||||
GtkBox box;
|
||||
gint GSEAL (child_min_width);
|
||||
gint GSEAL (child_min_height);
|
||||
gint GSEAL (child_ipad_x);
|
||||
gint GSEAL (child_ipad_y);
|
||||
GtkSize GSEAL (child_min_width);
|
||||
GtkSize GSEAL (child_min_height);
|
||||
GtkSize GSEAL (child_ipad_x);
|
||||
GtkSize GSEAL (child_ipad_y);
|
||||
GtkButtonBoxStyle GSEAL (layout_style);
|
||||
};
|
||||
|
||||
@@ -81,17 +81,18 @@ void gtk_button_box_set_child_secondary (GtkButtonBox *widget,
|
||||
#define gtk_button_box_get_spacing(b) gtk_box_get_spacing (GTK_BOX (b))
|
||||
|
||||
void gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
gint min_width,
|
||||
gint min_height);
|
||||
GtkSize min_width,
|
||||
GtkSize min_height);
|
||||
void gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
|
||||
gint ipad_x,
|
||||
gint ipad_y);
|
||||
GtkSize ipad_x,
|
||||
GtkSize ipad_y);
|
||||
void gtk_button_box_get_child_size (GtkButtonBox *widget,
|
||||
gint *min_width,
|
||||
gint *min_height);
|
||||
void gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
|
||||
gint *ipad_x,
|
||||
gint *ipad_y);
|
||||
/* no unit getters because these functions are deprecated already */
|
||||
#endif
|
||||
|
||||
/* Internal method - do not use. */
|
||||
|
||||
+220
-45
@@ -48,7 +48,6 @@ enum {
|
||||
CHILD_PROP_POSITION
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GtkBoxPrivate GtkBoxPrivate;
|
||||
|
||||
struct _GtkBoxPrivate
|
||||
@@ -56,10 +55,16 @@ struct _GtkBoxPrivate
|
||||
GtkOrientation orientation;
|
||||
guint default_expand : 1;
|
||||
guint spacing_set : 1;
|
||||
GtkSize spacing_unit;
|
||||
GHashTable *child_map;
|
||||
};
|
||||
|
||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
||||
typedef struct
|
||||
{
|
||||
GtkUSize padding_unit;
|
||||
} GtkBoxChildPrivate;
|
||||
|
||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
||||
|
||||
static void gtk_box_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -94,24 +99,55 @@ static void gtk_box_get_child_property (GtkContainer *container,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static GType gtk_box_child_type (GtkContainer *container);
|
||||
|
||||
static void gtk_box_finalize (GObject *object);
|
||||
static void gtk_box_unit_changed (GtkWidget *widget);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
|
||||
NULL));
|
||||
|
||||
static void
|
||||
add_priv_child (GtkBox *box, GtkBoxChild *child, GtkBoxChildPrivate *priv_child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
g_hash_table_insert (priv->child_map, child, priv_child);
|
||||
}
|
||||
|
||||
static GtkBoxChildPrivate *
|
||||
get_priv_child (GtkBox *box, GtkBoxChild *child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxChildPrivate *priv_child;
|
||||
|
||||
priv_child = g_hash_table_lookup (priv->child_map, child);
|
||||
if (G_UNLIKELY (priv_child == NULL))
|
||||
g_warning ("GtkBox: No private child for child; the application is munging box->child directly!");
|
||||
|
||||
return priv_child;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_priv_child (GtkBox *box, GtkBoxChild *child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
if (G_UNLIKELY (!g_hash_table_remove (priv->child_map, child)))
|
||||
g_warning ("GtkBox: No private child for child; the application is munging box->child directly!");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_class_init (GtkBoxClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
|
||||
|
||||
object_class->set_property = gtk_box_set_property;
|
||||
object_class->get_property = gtk_box_get_property;
|
||||
|
||||
gobject_class->set_property = gtk_box_set_property;
|
||||
gobject_class->get_property = gtk_box_get_property;
|
||||
gobject_class->finalize = gtk_box_finalize;
|
||||
|
||||
widget_class->size_request = gtk_box_size_request;
|
||||
widget_class->size_allocate = gtk_box_size_allocate;
|
||||
widget_class->unit_changed = gtk_box_unit_changed;
|
||||
|
||||
container_class->add = gtk_box_add;
|
||||
container_class->remove = gtk_box_remove;
|
||||
@@ -120,21 +156,19 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
container_class->set_child_property = gtk_box_set_child_property;
|
||||
container_class->get_child_property = gtk_box_get_child_property;
|
||||
|
||||
g_object_class_override_property (object_class,
|
||||
g_object_class_override_property (gobject_class,
|
||||
PROP_ORIENTATION,
|
||||
"orientation");
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SPACING,
|
||||
g_param_spec_int ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("The amount of space between children"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
gtk_param_spec_size ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("The amount of space between children"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HOMOGENEOUS,
|
||||
g_param_spec_boolean ("homogeneous",
|
||||
P_("Homogeneous"),
|
||||
@@ -158,11 +192,11 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_PADDING,
|
||||
g_param_spec_uint ("padding",
|
||||
P_("Padding"),
|
||||
P_("Extra space to put between the child and its neighbors, in pixels"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("padding",
|
||||
P_("Padding"),
|
||||
P_("Extra space to put between the child and its neighbors, in pixels"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_PACK_TYPE,
|
||||
g_param_spec_enum ("pack-type",
|
||||
@@ -178,13 +212,25 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
-1, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkBoxPrivate));
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkBoxPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_finalize (GObject *object)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
/* TODO: should check that hash table is empty */
|
||||
g_hash_table_unref (priv->child_map);
|
||||
|
||||
G_OBJECT_CLASS (gtk_box_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_init (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
|
||||
@@ -193,9 +239,14 @@ gtk_box_init (GtkBox *box)
|
||||
box->spacing = 0;
|
||||
box->homogeneous = FALSE;
|
||||
|
||||
private->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
private->default_expand = FALSE;
|
||||
private->spacing_set = FALSE;
|
||||
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
priv->default_expand = FALSE;
|
||||
priv->spacing_set = FALSE;
|
||||
priv->spacing_unit = 0;
|
||||
priv->child_map = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -214,7 +265,7 @@ gtk_box_set_property (GObject *object,
|
||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_box_set_spacing (box, g_value_get_int (value));
|
||||
gtk_box_set_spacing (box, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
gtk_box_set_homogeneous (box, g_value_get_boolean (value));
|
||||
@@ -232,15 +283,15 @@ gtk_box_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, private->orientation);
|
||||
g_value_set_enum (value, priv->orientation);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, box->spacing);
|
||||
gtk_value_set_size (value, priv->spacing_unit, box);
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, box->homogeneous);
|
||||
@@ -650,7 +701,7 @@ gtk_box_set_child_property (GtkContainer *container,
|
||||
child,
|
||||
expand,
|
||||
fill,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
pack_type);
|
||||
break;
|
||||
case CHILD_PROP_PACK_TYPE:
|
||||
@@ -702,7 +753,7 @@ gtk_box_get_child_property (GtkContainer *container,
|
||||
g_value_set_boolean (value, fill);
|
||||
break;
|
||||
case CHILD_PROP_PADDING:
|
||||
g_value_set_uint (value, padding);
|
||||
gtk_value_set_usize (value, padding, container);
|
||||
break;
|
||||
case CHILD_PROP_PACK_TYPE:
|
||||
g_value_set_enum (value, pack_type);
|
||||
@@ -731,10 +782,11 @@ gtk_box_pack (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GtkBoxChild *child_info;
|
||||
GtkBoxChildPrivate *priv_child_info;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
@@ -742,13 +794,17 @@ gtk_box_pack (GtkBox *box,
|
||||
|
||||
child_info = g_new (GtkBoxChild, 1);
|
||||
child_info->widget = child;
|
||||
child_info->padding = padding;
|
||||
child_info->padding = gtk_widget_size_to_pixel (box, padding);
|
||||
child_info->expand = expand ? TRUE : FALSE;
|
||||
child_info->fill = fill ? TRUE : FALSE;
|
||||
child_info->pack = pack_type;
|
||||
child_info->is_secondary = FALSE;
|
||||
|
||||
priv_child_info = g_new (GtkBoxChildPrivate, 1);
|
||||
priv_child_info->padding_unit = padding;
|
||||
|
||||
box->children = g_list_append (box->children, child_info);
|
||||
add_priv_child (box, child_info, priv_child_info);
|
||||
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
|
||||
@@ -813,7 +869,7 @@ gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding)
|
||||
GtkUSize padding)
|
||||
{
|
||||
gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_START);
|
||||
}
|
||||
@@ -845,7 +901,7 @@ gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding)
|
||||
GtkUSize padding)
|
||||
{
|
||||
gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_END);
|
||||
}
|
||||
@@ -945,15 +1001,19 @@ gtk_box_get_homogeneous (GtkBox *box)
|
||||
*/
|
||||
void
|
||||
gtk_box_set_spacing (GtkBox *box,
|
||||
gint spacing)
|
||||
GtkSize spacing)
|
||||
{
|
||||
GtkBoxPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
if (spacing != box->spacing)
|
||||
{
|
||||
box->spacing = spacing;
|
||||
_gtk_box_set_spacing_set (box, TRUE);
|
||||
priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
if (spacing != priv->spacing_unit)
|
||||
{
|
||||
box->spacing = gtk_widget_size_to_pixel (box, spacing);
|
||||
priv->spacing_unit = spacing;
|
||||
_gtk_box_set_spacing_set (box, TRUE);
|
||||
g_object_notify (G_OBJECT (box), "spacing");
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||
@@ -1001,6 +1061,28 @@ _gtk_box_get_spacing_set (GtkBox *box)
|
||||
return private->spacing_set;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_get_spacing_unit:
|
||||
* @box: a #GtkBox
|
||||
*
|
||||
* Like gtk_box_get_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: spacing between children
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkSize
|
||||
gtk_box_get_spacing_unit (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_BOX (box), 0);
|
||||
|
||||
priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
return priv->spacing_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_reorder_child:
|
||||
* @box: a #GtkBox
|
||||
@@ -1112,6 +1194,64 @@ gtk_box_query_child_packing (GtkBox *box,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_query_child_packing_unit:
|
||||
* @box: a #GtkBox
|
||||
* @child: the #GtkWidget of the child to query
|
||||
* @expand: pointer to return location for #GtkBox:expand child property
|
||||
* @fill: pointer to return location for #GtkBox:fill child property
|
||||
* @padding: pointer to return location for #GtkBox:padding child property
|
||||
* @pack_type: pointer to return location for #GtkBox:pack-type child property
|
||||
*
|
||||
* Like gtk_box_query_child_packing_unit() but preserves units.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
void
|
||||
gtk_box_query_child_packing_unit (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean *expand,
|
||||
gboolean *fill,
|
||||
GtkUSize *padding,
|
||||
GtkPackType *pack_type)
|
||||
{
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
GtkBoxChildPrivate *priv_child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = box->children;
|
||||
while (list)
|
||||
{
|
||||
child_info = list->data;
|
||||
if (child_info->widget == child)
|
||||
break;
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
priv_child_info = get_priv_child (box, child_info);
|
||||
|
||||
if (expand)
|
||||
*expand = child_info->expand;
|
||||
if (fill)
|
||||
*fill = child_info->fill;
|
||||
if (padding)
|
||||
{
|
||||
if (priv_child_info != NULL)
|
||||
*padding = priv_child_info->padding_unit;
|
||||
else
|
||||
*padding = child_info->padding;
|
||||
}
|
||||
if (pack_type)
|
||||
*pack_type = child_info->pack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_set_child_packing:
|
||||
* @box: a #GtkBox
|
||||
@@ -1128,11 +1268,12 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
GtkBoxChildPrivate *priv_child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
@@ -1150,11 +1291,15 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
if (list)
|
||||
{
|
||||
priv_child_info = get_priv_child (box, child_info);
|
||||
|
||||
child_info->expand = expand != FALSE;
|
||||
gtk_widget_child_notify (child, "expand");
|
||||
child_info->fill = fill != FALSE;
|
||||
gtk_widget_child_notify (child, "fill");
|
||||
child_info->padding = padding;
|
||||
child_info->padding = gtk_widget_size_to_pixel (box, padding);
|
||||
if (priv_child_info != NULL)
|
||||
priv_child_info->padding_unit = padding;
|
||||
gtk_widget_child_notify (child, "padding");
|
||||
if (pack_type == GTK_PACK_END)
|
||||
child_info->pack = GTK_PACK_END;
|
||||
@@ -1212,6 +1357,8 @@ gtk_box_remove (GtkContainer *container,
|
||||
was_visible = GTK_WIDGET_VISIBLE (widget);
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
remove_priv_child (box, child);
|
||||
|
||||
box->children = g_list_remove_link (box->children, children);
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
@@ -1260,5 +1407,33 @@ gtk_box_forall (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxChild *child;
|
||||
GtkBoxChildPrivate *priv_child;
|
||||
GList *children;
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_box_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_box_parent_class)->unit_changed (widget);
|
||||
|
||||
box->spacing = gtk_widget_size_to_pixel (box, priv->spacing_unit);
|
||||
|
||||
children = box->children;
|
||||
while (children != NULL)
|
||||
{
|
||||
child = children->data;
|
||||
priv_child = get_priv_child (box, child);
|
||||
|
||||
if (priv_child != NULL)
|
||||
child->padding = gtk_widget_size_to_pixel (box, priv_child->padding_unit);
|
||||
|
||||
children = children->next;
|
||||
}
|
||||
}
|
||||
|
||||
#define __GTK_BOX_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+20
-14
@@ -76,22 +76,21 @@ struct _GtkBoxChild
|
||||
};
|
||||
|
||||
|
||||
GType gtk_box_get_type (void) G_GNUC_CONST;
|
||||
GType gtk_box_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* _gtk_box_new (GtkOrientation orientation,
|
||||
gboolean homogeneous,
|
||||
gint spacing);
|
||||
|
||||
void gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding);
|
||||
void gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding);
|
||||
|
||||
void gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
GtkUSize padding);
|
||||
void gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
GtkUSize padding);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
void gtk_box_pack_start_defaults (GtkBox *box,
|
||||
GtkWidget *widget);
|
||||
@@ -103,8 +102,9 @@ void gtk_box_set_homogeneous (GtkBox *box,
|
||||
gboolean homogeneous);
|
||||
gboolean gtk_box_get_homogeneous (GtkBox *box);
|
||||
void gtk_box_set_spacing (GtkBox *box,
|
||||
gint spacing);
|
||||
GtkSize spacing);
|
||||
gint gtk_box_get_spacing (GtkBox *box);
|
||||
GtkSize gtk_box_get_spacing_unit (GtkBox *box);
|
||||
|
||||
void gtk_box_reorder_child (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
@@ -116,11 +116,17 @@ void gtk_box_query_child_packing (GtkBox *box,
|
||||
gboolean *fill,
|
||||
guint *padding,
|
||||
GtkPackType *pack_type);
|
||||
void gtk_box_query_child_packing_unit (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean *expand,
|
||||
gboolean *fill,
|
||||
GtkUSize *padding,
|
||||
GtkPackType *pack_type);
|
||||
void gtk_box_set_child_packing (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type);
|
||||
|
||||
/* internal API */
|
||||
|
||||
@@ -1152,6 +1152,51 @@ gtk_builder_value_from_string (GtkBuilder *builder,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GtkParamSpecUnit, GtkParamSpecUUnit have fundamental types
|
||||
* G_TYPE_INT resp. G_TYPE_UINT so cannot handle in the switch;
|
||||
* do it separately
|
||||
*/
|
||||
if (GTK_IS_PARAM_SPEC_SIZE (pspec) || GTK_IS_PARAM_SPEC_USIZE (pspec))
|
||||
{
|
||||
gdouble val;
|
||||
GtkSize size;
|
||||
gchar *endptr;
|
||||
|
||||
errno = 0;
|
||||
val = strtod (string, &endptr);
|
||||
if (errno != 0 || endptr == string)
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Could not parse %s `%s'",
|
||||
GTK_IS_PARAM_SPEC_SIZE (pspec) ? "GtkSize" : "GtkUSize",
|
||||
string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_str_has_suffix (string, "em"))
|
||||
size = gtk_size_em (val);
|
||||
else if (g_str_has_suffix (string, "mm"))
|
||||
size = gtk_size_mm (val);
|
||||
else
|
||||
size = (gint) val;
|
||||
|
||||
if (GTK_IS_PARAM_SPEC_SIZE (pspec))
|
||||
{
|
||||
g_value_init (value, G_TYPE_INT);
|
||||
gtk_value_size_skip_conversion (value);
|
||||
gtk_value_set_size (value, size, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_init (value, G_TYPE_UINT);
|
||||
gtk_value_usize_skip_conversion (value);
|
||||
gtk_value_set_usize (value, size, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return gtk_builder_value_from_string_type (builder,
|
||||
G_PARAM_SPEC_VALUE_TYPE (pspec),
|
||||
string, value, error);
|
||||
|
||||
+63
-34
@@ -41,9 +41,32 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
static const GtkBorder default_default_border = { 1, 1, 1, 1 };
|
||||
static const GtkBorder default_default_outside_border = { 0, 0, 0, 0 };
|
||||
static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
|
||||
static void
|
||||
set_default_default_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->right = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->top = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->bottom = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
}
|
||||
|
||||
static void
|
||||
set_default_default_outside_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = 0;
|
||||
border->right = 0;
|
||||
border->top = 0;
|
||||
border->bottom = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
set_default_inner_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->right = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->top = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->bottom = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
}
|
||||
|
||||
/* Time out before giving up on getting a key release when animating
|
||||
* the close button.
|
||||
@@ -442,21 +465,17 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-displacement-x",
|
||||
P_("Child X Displacement"),
|
||||
P_("How far in the x direction to move the child when the button is depressed"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-displacement-x",
|
||||
P_("Child X Displacement"),
|
||||
P_("How far in the x direction to move the child when the button is depressed"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-displacement-y",
|
||||
P_("Child Y Displacement"),
|
||||
P_("How far in the y direction to move the child when the button is depressed"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-displacement-y",
|
||||
P_("Child Y Displacement"),
|
||||
P_("How far in the y direction to move the child when the button is depressed"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkButton:displace-focus:
|
||||
@@ -495,13 +514,11 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
* Since: 2.10
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("image-spacing",
|
||||
P_("Image spacing"),
|
||||
P_("Spacing in pixels between the image and label"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
2,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("image-spacing",
|
||||
P_("Image spacing"),
|
||||
P_("Spacing in pixels between the image and label"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkSettings::gtk-button-images:
|
||||
@@ -933,7 +950,7 @@ gtk_button_construct_child (GtkButton *button)
|
||||
GtkWidget *align;
|
||||
GtkWidget *image = NULL;
|
||||
gchar *label_text = NULL;
|
||||
gint image_spacing;
|
||||
GtkSize image_spacing;
|
||||
|
||||
if (!button->constructed)
|
||||
return;
|
||||
@@ -941,9 +958,9 @@ gtk_button_construct_child (GtkButton *button)
|
||||
if (!button->label_text && !priv->image)
|
||||
return;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (button),
|
||||
"image-spacing", &image_spacing,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (button),
|
||||
"image-spacing", &image_spacing,
|
||||
NULL);
|
||||
|
||||
if (priv->image && !priv->image_is_stock)
|
||||
{
|
||||
@@ -1241,9 +1258,9 @@ gtk_button_update_image_spacing (GtkButton *button)
|
||||
child = GTK_BIN (child)->child;
|
||||
if (GTK_IS_BOX (child))
|
||||
{
|
||||
gtk_widget_style_get (GTK_WIDGET (button),
|
||||
"image-spacing", &spacing,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (button),
|
||||
"image-spacing", &spacing,
|
||||
NULL);
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (child), spacing);
|
||||
}
|
||||
@@ -1273,11 +1290,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*default_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*default_border = default_default_border;
|
||||
set_default_default_border (widget, default_border);
|
||||
}
|
||||
|
||||
if (default_outside_border)
|
||||
@@ -1286,11 +1307,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*default_outside_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*default_outside_border = default_default_outside_border;
|
||||
set_default_default_outside_border (widget, default_outside_border);
|
||||
}
|
||||
|
||||
if (inner_border)
|
||||
@@ -1299,11 +1324,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*inner_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*inner_border = default_inner_border;
|
||||
set_default_inner_border (widget, inner_border);
|
||||
}
|
||||
|
||||
if (interior_focus)
|
||||
|
||||
+183
-38
@@ -43,6 +43,9 @@ typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
|
||||
struct _GtkCellRendererPrivate
|
||||
{
|
||||
GdkColor cell_background;
|
||||
GtkUSize xpad_unit;
|
||||
GtkUSize ypad_unit;
|
||||
GtkTreeViewColumn *column;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +82,8 @@ G_DEFINE_ABSTRACT_TYPE (GtkCellRenderer, gtk_cell_renderer, GTK_TYPE_OBJECT)
|
||||
static void
|
||||
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||
cell->visible = TRUE;
|
||||
cell->width = -1;
|
||||
@@ -87,6 +92,8 @@ gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||
cell->yalign = 0.5;
|
||||
cell->xpad = 0;
|
||||
cell->ypad = 0;
|
||||
priv->xpad_unit = 0;
|
||||
priv->ypad_unit = 0;
|
||||
cell->sensitive = TRUE;
|
||||
cell->is_expander = FALSE;
|
||||
cell->is_expanded = FALSE;
|
||||
@@ -217,43 +224,35 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_XPAD,
|
||||
g_param_spec_uint ("xpad",
|
||||
P_("xpad"),
|
||||
P_("The xpad"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("xpad",
|
||||
P_("xpad"),
|
||||
P_("The xpad"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_YPAD,
|
||||
g_param_spec_uint ("ypad",
|
||||
P_("ypad"),
|
||||
P_("The ypad"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("ypad",
|
||||
P_("ypad"),
|
||||
P_("The ypad"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_WIDTH,
|
||||
g_param_spec_int ("width",
|
||||
P_("width"),
|
||||
P_("The fixed width"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("width",
|
||||
P_("width"),
|
||||
P_("The fixed width"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HEIGHT,
|
||||
g_param_spec_int ("height",
|
||||
P_("height"),
|
||||
P_("The fixed height"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("height",
|
||||
P_("height"),
|
||||
P_("The fixed height"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_IS_EXPANDER,
|
||||
@@ -336,16 +335,16 @@ gtk_cell_renderer_get_property (GObject *object,
|
||||
g_value_set_float (value, cell->yalign);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
g_value_set_uint (value, cell->xpad);
|
||||
gtk_value_set_usize (value, priv->xpad_unit, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
g_value_set_uint (value, cell->ypad);
|
||||
gtk_value_set_usize (value, priv->ypad_unit, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_int (value, cell->width);
|
||||
gtk_value_set_size (value, cell->width, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_int (value, cell->height);
|
||||
gtk_value_set_size (value, cell->height, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
g_value_set_boolean (value, cell->is_expander);
|
||||
@@ -382,6 +381,7 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@@ -404,16 +404,18 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
cell->yalign = g_value_get_float (value);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
cell->xpad = g_value_get_uint (value);
|
||||
priv->xpad_unit = gtk_value_get_usize (value);
|
||||
cell->xpad = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), priv->xpad_unit);
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
cell->ypad = g_value_get_uint (value);
|
||||
priv->ypad_unit = gtk_value_get_usize (value);
|
||||
cell->ypad = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), priv->ypad_unit);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
cell->width = g_value_get_int (value);
|
||||
cell->width = gtk_value_get_size (value);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
cell->height = g_value_get_int (value);
|
||||
cell->height = gtk_value_get_size (value);
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
cell->is_expander = g_value_get_boolean (value);
|
||||
@@ -492,6 +494,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
||||
*
|
||||
* Please note that the values set in @width and @height, as well as those
|
||||
* in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
|
||||
*
|
||||
* Returns values in pixels. To preserve the units use
|
||||
* gtk_cell_renderer_get_size_unit().
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
@@ -508,6 +513,59 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||
|
||||
if (width && cell->width != -1)
|
||||
{
|
||||
real_width = NULL;
|
||||
*width = gtk_widget_size_to_pixel (widget, cell->width);
|
||||
}
|
||||
if (height && cell->height != -1)
|
||||
{
|
||||
real_height = NULL;
|
||||
*height = gtk_widget_size_to_pixel (widget, cell->height);
|
||||
}
|
||||
|
||||
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
|
||||
widget,
|
||||
(GdkRectangle *) cell_area,
|
||||
x_offset,
|
||||
y_offset,
|
||||
real_width,
|
||||
real_height);
|
||||
if (real_width)
|
||||
*real_width = gtk_widget_size_to_pixel (widget, *real_width);
|
||||
if (real_height)
|
||||
*real_height = gtk_widget_size_to_pixel (widget, *real_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_size_unit:
|
||||
* @cell: a #GtkCellRenderer
|
||||
* @widget: the widget the renderer is rendering to
|
||||
* @cell_area: The area a cell will be allocated, or %NULL
|
||||
* @x_offset: location to return x offset of cell relative to @cell_area, or %NULL
|
||||
* @y_offset: location to return y offset of cell relative to @cell_area, or %NULL
|
||||
* @width: location to return width needed to render a cell, or %NULL
|
||||
* @height: location to return height needed to render a cell, or %NULL
|
||||
*
|
||||
* Like gtk_cell_renderer_get_size() but preserves the units.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_size_unit (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
GtkSize *width,
|
||||
GtkSize *height)
|
||||
{
|
||||
gint *real_width = width;
|
||||
gint *real_height = height;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||
|
||||
if (width && cell->width != -1)
|
||||
{
|
||||
real_width = NULL;
|
||||
@@ -689,8 +747,8 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
gint width,
|
||||
gint height)
|
||||
GtkSize width,
|
||||
GtkSize height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (width >= -1 && height >= -1);
|
||||
@@ -722,6 +780,9 @@ gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
* @height: location to fill in with the fixed height of the widget, or %NULL
|
||||
*
|
||||
* Fills in @width and @height with the appropriate size of @cell.
|
||||
*
|
||||
* Returns values in pixels. To preserve the units use
|
||||
* gtk_cell_renderer_get_fixed_size_unit().
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
@@ -730,6 +791,29 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (width)
|
||||
(* width) = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), cell->width);
|
||||
if (height)
|
||||
(* height) = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), cell->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_fixed_size_unit:
|
||||
* @cell: A #GtkCellRenderer
|
||||
* @width: location to fill in with the fixed width of the widget, or %NULL
|
||||
* @height: location to fill in with the fixed height of the widget, or %NULL
|
||||
*
|
||||
* Like gtk_cell_renderer_get_fixed_size_unit() but preserves the unit information.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_fixed_size_unit (GtkCellRenderer *cell,
|
||||
GtkSize *width,
|
||||
GtkSize *height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (width)
|
||||
(* width) = cell->width;
|
||||
if (height)
|
||||
@@ -787,5 +871,66 @@ gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_cell_renderer_set_tree_view_column (GtkCellRenderer *cell,
|
||||
GtkTreeViewColumn *column)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
priv->column = column;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_tree_view_column:
|
||||
* @cell: A #GtkCellRenderer
|
||||
*
|
||||
* Gets the #GtkTreeViewColumn wherein @cell has been
|
||||
* inserted. Returns %NULL if @cell is currently not inserted into any
|
||||
* tree column.
|
||||
*
|
||||
* Returns: the #GtkTreeViewColumn that @cell has been inserted into,
|
||||
* %NULL otherwise
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkTreeViewColumn *
|
||||
gtk_cell_renderer_get_tree_view_column (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||
|
||||
priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
return priv->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_tree_view:
|
||||
* @cell: A #GtkCellRenderer
|
||||
*
|
||||
* Gets the #GtkTreeView wherein the column that @cell has been
|
||||
* inserted belongs to. Returns %NULL if @cell is currently not
|
||||
* inserted into any tree column or if the tree column is currently
|
||||
* not inserted into any tree.
|
||||
*
|
||||
* Returns: a #GtkTreeView
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_cell_renderer_get_tree_view (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||
|
||||
priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
if (priv->column == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_tree_view_column_get_tree_view (priv->column);
|
||||
}
|
||||
|
||||
#define __GTK_CELL_RENDERER_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+23
-6
@@ -26,6 +26,9 @@
|
||||
|
||||
#include <gtk/gtkcelleditable.h>
|
||||
|
||||
/* forward declaration */
|
||||
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
@@ -62,8 +65,8 @@ struct _GtkCellRenderer
|
||||
gfloat GSEAL (xalign);
|
||||
gfloat GSEAL (yalign);
|
||||
|
||||
gint GSEAL (width);
|
||||
gint GSEAL (height);
|
||||
GtkSize GSEAL (width);
|
||||
GtkSize GSEAL (height);
|
||||
|
||||
guint16 GSEAL (xpad);
|
||||
guint16 GSEAL (ypad);
|
||||
@@ -87,8 +90,8 @@ struct _GtkCellRendererClass
|
||||
GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height);
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
void (* render) (GtkCellRenderer *cell,
|
||||
GdkDrawable *window,
|
||||
GtkWidget *widget,
|
||||
@@ -131,6 +134,13 @@ void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void gtk_cell_renderer_get_size_unit (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
void gtk_cell_renderer_render (GtkCellRenderer *cell,
|
||||
GdkWindow *window,
|
||||
GtkWidget *widget,
|
||||
@@ -153,11 +163,18 @@ GtkCellEditable *gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags);
|
||||
void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
gint width,
|
||||
gint height);
|
||||
GtkSize width,
|
||||
GtkSize height);
|
||||
void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void gtk_cell_renderer_get_fixed_size_unit (GtkCellRenderer *cell,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
|
||||
GtkTreeViewColumn *gtk_cell_renderer_get_tree_view_column (GtkCellRenderer *cell);
|
||||
|
||||
GtkWidget *gtk_cell_renderer_get_tree_view (GtkCellRenderer *cell);
|
||||
|
||||
/* For use by cell renderer implementations only */
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
@@ -510,9 +510,10 @@ gtk_cell_renderer_pixbuf_create_themed_pixbuf (GtkCellRendererPixbuf *cellpixbuf
|
||||
icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
|
||||
if (!gtk_icon_size_lookup_for_settings (settings,
|
||||
priv->stock_size,
|
||||
&width, &height))
|
||||
if (!gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (widget),
|
||||
priv->stock_size,
|
||||
&width, &height))
|
||||
{
|
||||
g_warning ("Invalid icon size %u\n", priv->stock_size);
|
||||
width = height = 24;
|
||||
|
||||
+11
-12
@@ -71,7 +71,7 @@ enum {
|
||||
PROP_INDICATOR_SIZE
|
||||
};
|
||||
|
||||
#define TOGGLE_WIDTH 13
|
||||
#define TOGGLE_WIDTH GTK_SIZE_ONE_TWELFTH_EM(13)
|
||||
|
||||
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -154,13 +154,11 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INDICATOR_SIZE,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
TOGGLE_WIDTH,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, TOGGLE_WIDTH,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
@@ -210,7 +208,8 @@ gtk_cell_renderer_toggle_get_property (GObject *object,
|
||||
g_value_set_boolean (value, celltoggle->radio);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
g_value_set_int (value, priv->indicator_size);
|
||||
gtk_value_set_size (value, priv->indicator_size,
|
||||
gtk_cell_renderer_get_tree_view (GTK_CELL_RENDERER (celltoggle)));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -245,7 +244,7 @@ gtk_cell_renderer_toggle_set_property (GObject *object,
|
||||
celltoggle->radio = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
priv->indicator_size = g_value_get_int (value);
|
||||
priv->indicator_size = gtk_value_get_size (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -287,8 +286,8 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
|
||||
|
||||
calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
|
||||
calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
|
||||
calc_width = (gint) cell->xpad * 2 + gtk_widget_size_to_pixel (widget, priv->indicator_size);
|
||||
calc_height = (gint) cell->ypad * 2 + gtk_widget_size_to_pixel (widget, priv->indicator_size);
|
||||
|
||||
if (width)
|
||||
*width = calc_width;
|
||||
|
||||
+12
-16
@@ -32,8 +32,8 @@
|
||||
#include "gtkalias.h"
|
||||
|
||||
|
||||
#define INDICATOR_SIZE 13
|
||||
#define INDICATOR_SPACING 2
|
||||
#define INDICATOR_SIZE GTK_SIZE_ONE_TWELFTH_EM(13)
|
||||
#define INDICATOR_SPACING GTK_SIZE_ONE_TWELFTH_EM(2)
|
||||
|
||||
|
||||
static void gtk_check_button_size_request (GtkWidget *widget,
|
||||
@@ -65,21 +65,17 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
||||
class->draw_indicator = gtk_real_check_button_draw_indicator;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
INDICATOR_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, INDICATOR_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
INDICATOR_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around check or radio indicator"),
|
||||
0, G_MAXINT, INDICATOR_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -117,13 +117,11 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
13,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (13),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
widget_class->expose_event = gtk_check_menu_item_expose;
|
||||
|
||||
|
||||
+23
-2
@@ -129,6 +129,7 @@ static void gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
guint32 time,
|
||||
GtkColorButton *color_button);
|
||||
|
||||
static void gtk_color_button_unit_changed (GtkWidget *widget);
|
||||
|
||||
static guint color_button_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -154,6 +155,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
widget_class->realize = gtk_color_button_realize;
|
||||
widget_class->unrealize = gtk_color_button_unrealize;
|
||||
widget_class->style_set = gtk_color_button_style_set;
|
||||
widget_class->unit_changed = gtk_color_button_unit_changed;
|
||||
button_class->clicked = gtk_color_button_clicked;
|
||||
klass->color_set = NULL;
|
||||
|
||||
@@ -534,7 +536,7 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
gtk_container_add (GTK_CONTAINER (color_button), alignment);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
@@ -550,7 +552,9 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
||||
g_object_unref (layout);
|
||||
|
||||
gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
|
||||
gtk_widget_set_size_request (color_button->priv->draw_area,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (rect.width - 2),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (rect.height - 2));
|
||||
g_signal_connect (color_button->priv->draw_area, "expose-event",
|
||||
G_CALLBACK (expose_event), color_button);
|
||||
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
|
||||
@@ -993,5 +997,22 @@ gtk_color_button_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkColorButton *color_button = GTK_COLOR_BUTTON (widget);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
if (color_button->priv->pixbuf != NULL)
|
||||
g_object_unref (color_button->priv->pixbuf);
|
||||
color_button->priv->pixbuf = NULL;
|
||||
}
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_color_button_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_color_button_parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
#define __GTK_COLOR_BUTTON_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+16
-14
@@ -65,8 +65,8 @@
|
||||
#define GTK_CUSTOM_PALETTE_WIDTH 10
|
||||
#define GTK_CUSTOM_PALETTE_HEIGHT 2
|
||||
|
||||
#define CUSTOM_PALETTE_ENTRY_WIDTH 20
|
||||
#define CUSTOM_PALETTE_ENTRY_HEIGHT 20
|
||||
#define CUSTOM_PALETTE_ENTRY_WIDTH GTK_SIZE_ONE_TWELFTH_EM(20)
|
||||
#define CUSTOM_PALETTE_ENTRY_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(20)
|
||||
|
||||
/* The cursor for the dropper */
|
||||
#define DROPPER_WIDTH 17
|
||||
@@ -340,24 +340,26 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
priv->default_set = FALSE;
|
||||
priv->default_alpha_set = FALSE;
|
||||
|
||||
top_hbox = gtk_hbox_new (FALSE, 12);
|
||||
top_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
priv->triangle_colorsel = gtk_hsv_new ();
|
||||
g_signal_connect (priv->triangle_colorsel, "changed",
|
||||
G_CALLBACK (hsv_changed), colorsel);
|
||||
gtk_hsv_set_metrics (GTK_HSV (priv->triangle_colorsel), 174, 15);
|
||||
gtk_hsv_set_metrics (GTK_HSV (priv->triangle_colorsel),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (174),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (15));
|
||||
gtk_box_pack_start (GTK_BOX (top_hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0);
|
||||
gtk_widget_set_tooltip_text (priv->triangle_colorsel,
|
||||
_("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, -1, 30);
|
||||
gtk_widget_set_size_request (frame, -1, GTK_SIZE_ONE_TWELFTH_EM (30));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
color_sample_new (colorsel);
|
||||
gtk_container_add (GTK_CONTAINER (frame), priv->sample_area);
|
||||
@@ -377,12 +379,12 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
gtk_widget_set_tooltip_text (button,
|
||||
_("Click the eyedropper, then click a color anywhere on your screen to select that color."));
|
||||
|
||||
top_right_vbox = gtk_vbox_new (FALSE, 6);
|
||||
top_right_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
|
||||
table = gtk_table_new (8, 6, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (top_right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), table, 0, 0, COLORSEL_HUE,
|
||||
_("Position on the color wheel."));
|
||||
@@ -417,7 +419,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
priv->opacity_entry = gtk_entry_new ();
|
||||
gtk_widget_set_tooltip_text (priv->opacity_entry,
|
||||
_("Transparency of the color."));
|
||||
gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
|
||||
gtk_widget_set_size_request (priv->opacity_entry, gtk_widget_size_to_pixel (colorsel, GTK_SIZE_ONE_TWELFTH_EM (40)), -1);
|
||||
|
||||
g_signal_connect (priv->opacity_entry, "activate",
|
||||
G_CALLBACK (opacity_entry_changed), colorsel);
|
||||
@@ -456,8 +458,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
|
||||
/* Set up the palette */
|
||||
table = gtk_table_new (GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, TRUE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
|
||||
{
|
||||
for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
|
||||
@@ -466,7 +468,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
}
|
||||
}
|
||||
set_selected_palette (colorsel, 0, 0);
|
||||
priv->palette_frame = gtk_vbox_new (FALSE, 6);
|
||||
priv->palette_frame = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
label = gtk_label_new_with_mnemonic (_("_Palette:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (priv->palette_frame), label, FALSE, FALSE, 0);
|
||||
|
||||
@@ -132,13 +132,13 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
|
||||
GtkDialog *dialog = GTK_DIALOG (colorseldiag);
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
colorseldiag->colorsel = gtk_color_selection_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), colorseldiag->colorsel);
|
||||
|
||||
+20
-7
@@ -243,6 +243,7 @@ static void gtk_combo_box_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_combo_box_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_combo_box_unit_changed (GtkWidget *widget);
|
||||
|
||||
static ComboCellInfo *gtk_combo_box_get_cell_info (GtkComboBox *combo_box,
|
||||
GtkCellRenderer *cell);
|
||||
@@ -499,6 +500,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
widget_class->grab_focus = gtk_combo_box_grab_focus;
|
||||
widget_class->style_set = gtk_combo_box_style_set;
|
||||
widget_class->state_changed = gtk_combo_box_state_changed;
|
||||
widget_class->unit_changed = gtk_combo_box_unit_changed;
|
||||
|
||||
gtk_object_class = (GtkObjectClass *)klass;
|
||||
gtk_object_class->destroy = gtk_combo_box_destroy;
|
||||
@@ -861,13 +863,11 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
* Since: 2.12
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("arrow-size",
|
||||
P_("Arrow Size"),
|
||||
P_("The minimum size of the arrow in the combo box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
15,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("arrow-size",
|
||||
P_("Arrow Size"),
|
||||
P_("The minimum size of the arrow in the combo box"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (15),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkComboBox:shadow-type:
|
||||
@@ -5925,5 +5925,18 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable,
|
||||
data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
gtk_combo_box_check_appearance (combo_box);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
|
||||
#define __GTK_COMBO_BOX_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+68
-13
@@ -58,6 +58,13 @@ enum {
|
||||
PROP_CHILD
|
||||
};
|
||||
|
||||
#define GTK_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CONTAINER, GtkContainerPrivate))
|
||||
|
||||
struct _GtkContainerPrivate
|
||||
{
|
||||
GtkUSize border_width_unit;
|
||||
};
|
||||
|
||||
#define PARAM_SPEC_PARAM_ID(pspec) ((pspec)->param_id)
|
||||
#define PARAM_SPEC_SET_PARAM_ID(pspec, id) ((pspec)->param_id = (id))
|
||||
|
||||
@@ -101,6 +108,8 @@ static void gtk_container_unmap (GtkWidget *widget);
|
||||
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
|
||||
static void gtk_container_unit_changed (GtkWidget *widget);
|
||||
|
||||
/* GtkBuildable */
|
||||
static void gtk_container_buildable_init (GtkBuildableIface *iface);
|
||||
static void gtk_container_buildable_add_child (GtkBuildable *buildable,
|
||||
@@ -223,6 +232,7 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
widget_class->map = gtk_container_map;
|
||||
widget_class->unmap = gtk_container_unmap;
|
||||
widget_class->focus = gtk_container_focus;
|
||||
widget_class->unit_changed = gtk_container_unit_changed;
|
||||
|
||||
class->add = gtk_container_add_unimplemented;
|
||||
class->remove = gtk_container_remove_unimplemented;
|
||||
@@ -242,13 +252,11 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BORDER_WIDTH,
|
||||
g_param_spec_uint ("border-width",
|
||||
P_("Border width"),
|
||||
P_("The width of the empty border outside the containers children"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("border-width",
|
||||
P_("Border width"),
|
||||
P_("The width of the empty border outside the containers children"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CHILD,
|
||||
g_param_spec_object ("child",
|
||||
@@ -291,6 +299,8 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
_gtk_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkContainerPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1042,8 +1052,10 @@ gtk_container_remove_unimplemented (GtkContainer *container,
|
||||
static void
|
||||
gtk_container_init (GtkContainer *container)
|
||||
{
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
container->focus_child = NULL;
|
||||
container->border_width = 0;
|
||||
priv->border_width_unit = 0;
|
||||
container->need_resize = FALSE;
|
||||
container->resize_mode = GTK_RESIZE_PARENT;
|
||||
container->reallocate_redraws = FALSE;
|
||||
@@ -1079,7 +1091,7 @@ gtk_container_set_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BORDER_WIDTH:
|
||||
gtk_container_set_border_width (container, g_value_get_uint (value));
|
||||
gtk_container_set_border_width (container, gtk_value_get_usize (value));
|
||||
break;
|
||||
case PROP_RESIZE_MODE:
|
||||
gtk_container_set_resize_mode (container, g_value_get_enum (value));
|
||||
@@ -1100,11 +1112,12 @@ gtk_container_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (object);
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BORDER_WIDTH:
|
||||
g_value_set_uint (value, container->border_width);
|
||||
gtk_value_set_usize (value, priv->border_width_unit, container);
|
||||
break;
|
||||
case PROP_RESIZE_MODE:
|
||||
g_value_set_enum (value, container->resize_mode);
|
||||
@@ -1134,13 +1147,18 @@ gtk_container_get_property (GObject *object,
|
||||
**/
|
||||
void
|
||||
gtk_container_set_border_width (GtkContainer *container,
|
||||
guint border_width)
|
||||
GtkUSize border_width)
|
||||
{
|
||||
GtkContainerPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
if (container->border_width != border_width)
|
||||
priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
if (priv->border_width_unit != border_width)
|
||||
{
|
||||
container->border_width = border_width;
|
||||
container->border_width = gtk_widget_size_to_pixel (container, border_width);
|
||||
priv->border_width_unit = border_width;
|
||||
g_object_notify (G_OBJECT (container), "border-width");
|
||||
|
||||
if (GTK_WIDGET_REALIZED (container))
|
||||
@@ -1152,9 +1170,11 @@ gtk_container_set_border_width (GtkContainer *container,
|
||||
* gtk_container_get_border_width:
|
||||
* @container: a #GtkContainer
|
||||
*
|
||||
* Retrieves the border width of the container. See
|
||||
* Retrieves the border width of the container in pixels. See
|
||||
* gtk_container_set_border_width().
|
||||
*
|
||||
* Use gtk_container_get_border_width_unit() to preserve units.
|
||||
*
|
||||
* Return value: the current border width
|
||||
**/
|
||||
guint
|
||||
@@ -1165,6 +1185,28 @@ gtk_container_get_border_width (GtkContainer *container)
|
||||
return container->border_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_container_get_border_width_unit:
|
||||
* @container: a #GtkContainer
|
||||
*
|
||||
* Like gtk_container_get_border_width() but preserves the unit.
|
||||
*
|
||||
* Return value: the current border width
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkUSize
|
||||
gtk_container_get_border_width_unit (GtkContainer *container)
|
||||
{
|
||||
GtkContainerPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
|
||||
|
||||
priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
return priv->border_width_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_container_add:
|
||||
* @container: a #GtkContainer
|
||||
@@ -2734,5 +2776,18 @@ gtk_container_propagate_expose (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (widget);
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
container->border_width = gtk_widget_size_to_pixel (container, priv->border_width_unit);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
#define __GTK_CONTAINER_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+3
-1
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkContainer GtkContainer;
|
||||
typedef struct _GtkContainerClass GtkContainerClass;
|
||||
typedef struct _GtkContainerPrivate GtkContainerPrivate;
|
||||
|
||||
struct _GtkContainer
|
||||
{
|
||||
@@ -106,8 +107,9 @@ struct _GtkContainerClass
|
||||
|
||||
GType gtk_container_get_type (void) G_GNUC_CONST;
|
||||
void gtk_container_set_border_width (GtkContainer *container,
|
||||
guint border_width);
|
||||
GtkUSize border_width);
|
||||
guint gtk_container_get_border_width (GtkContainer *container);
|
||||
GtkUSize gtk_container_get_border_width_unit (GtkContainer *container);
|
||||
void gtk_container_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
void gtk_container_remove (GtkContainer *container,
|
||||
|
||||
+30
-38
@@ -187,13 +187,11 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the main dialog area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
2,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the main dialog area"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
|
||||
GTK_PARAM_READABLE));
|
||||
/**
|
||||
* GtkDialog:content-area-spacing:
|
||||
*
|
||||
@@ -205,30 +203,24 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
* Since: 2.16
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the main dialog area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the main dialog area"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the button area at the bottom of the dialog"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
5,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the button area at the bottom of the dialog"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (5),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
binding_set = gtk_binding_set_by_class (class);
|
||||
|
||||
@@ -238,17 +230,17 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
static void
|
||||
update_spacings (GtkDialog *dialog)
|
||||
{
|
||||
gint content_area_border;
|
||||
gint content_area_spacing;
|
||||
gint button_spacing;
|
||||
gint action_area_border;
|
||||
GtkSize content_area_border;
|
||||
GtkSize content_area_spacing;
|
||||
GtkSize button_spacing;
|
||||
GtkSize action_area_border;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (dialog),
|
||||
"content-area-border", &content_area_border,
|
||||
"content-area-spacing", &content_area_spacing,
|
||||
"button-spacing", &button_spacing,
|
||||
"action-area-border", &action_area_border,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (dialog),
|
||||
"content-area-border", &content_area_border,
|
||||
"content-area-spacing", &content_area_spacing,
|
||||
"button-spacing", &button_spacing,
|
||||
"action-area-border", &action_area_border,
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
|
||||
content_area_border);
|
||||
|
||||
+30
-4
@@ -68,7 +68,7 @@
|
||||
|
||||
#define GTK_ENTRY_COMPLETION_KEY "gtk-entry-completion-key"
|
||||
|
||||
#define MIN_ENTRY_WIDTH 150
|
||||
#define MIN_ENTRY_WIDTH GTK_SIZE_ONE_TWELFTH_EM(150)
|
||||
#define DRAW_TIMEOUT 20
|
||||
#define COMPLETION_TIMEOUT 300
|
||||
#define PASSWORD_HINT_MAX 8
|
||||
@@ -85,12 +85,20 @@
|
||||
((pos) == GTK_ENTRY_ICON_PRIMARY || \
|
||||
(pos) == GTK_ENTRY_ICON_SECONDARY)
|
||||
|
||||
static const GtkBorder default_inner_border = { 2, 2, 2, 2 };
|
||||
static GQuark quark_inner_border = 0;
|
||||
static GQuark quark_password_hint = 0;
|
||||
static GQuark quark_cursor_hadjustment = 0;
|
||||
static GQuark quark_capslock_feedback = 0;
|
||||
|
||||
static void
|
||||
set_default_inner_border (GtkEntry *entry, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->right = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->top = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->bottom = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
}
|
||||
|
||||
typedef struct _GtkEntryPrivate GtkEntryPrivate;
|
||||
|
||||
#define GTK_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY, GtkEntryPrivate))
|
||||
@@ -381,6 +389,7 @@ static void gtk_entry_toggle_overwrite (GtkEntry *entry);
|
||||
static void gtk_entry_select_all (GtkEntry *entry);
|
||||
static void gtk_entry_real_activate (GtkEntry *entry);
|
||||
static gboolean gtk_entry_popup_menu (GtkWidget *widget);
|
||||
static void gtk_entry_unit_changed (GtkWidget *widget);
|
||||
|
||||
static void keymap_direction_changed (GdkKeymap *keymap,
|
||||
GtkEntry *entry);
|
||||
@@ -580,6 +589,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
|
||||
|
||||
widget_class->popup_menu = gtk_entry_popup_menu;
|
||||
widget_class->unit_changed = gtk_entry_unit_changed;
|
||||
|
||||
gtk_object_class->destroy = gtk_entry_destroy;
|
||||
|
||||
@@ -2788,7 +2798,7 @@ gtk_entry_size_request (GtkWidget *widget,
|
||||
_gtk_entry_effective_inner_border (entry, &inner_border);
|
||||
|
||||
if (entry->width_chars < 0)
|
||||
requisition->width = MIN_ENTRY_WIDTH + xborder * 2 + inner_border.left + inner_border.right;
|
||||
requisition->width = gtk_widget_size_to_pixel (entry, MIN_ENTRY_WIDTH) + xborder * 2 + inner_border.left + inner_border.right;
|
||||
else
|
||||
{
|
||||
gint char_width = pango_font_metrics_get_approximate_char_width (metrics);
|
||||
@@ -2955,12 +2965,16 @@ _gtk_entry_effective_inner_border (GtkEntry *entry,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (entry, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (entry, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (entry, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (entry, tmp_border->bottom);
|
||||
*border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
return;
|
||||
}
|
||||
|
||||
*border = default_inner_border;
|
||||
set_default_inner_border (entry, border);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -9836,5 +9850,17 @@ keymap_state_changed (GdkKeymap *keymap,
|
||||
remove_capslock_feedback (entry);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_entry_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unit_changed (widget);
|
||||
|
||||
gtk_entry_reset_layout (entry);
|
||||
}
|
||||
|
||||
#define __GTK_ENTRY_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+40
-27
@@ -38,8 +38,8 @@
|
||||
|
||||
#define GTK_EXPANDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_EXPANDER, GtkExpanderPrivate))
|
||||
|
||||
#define DEFAULT_EXPANDER_SIZE 10
|
||||
#define DEFAULT_EXPANDER_SPACING 2
|
||||
#define DEFAULT_EXPANDER_SIZE GTK_SIZE_ONE_TWELFTH_EM(10)
|
||||
#define DEFAULT_EXPANDER_SPACING GTK_SIZE_ONE_TWELFTH_EM(2)
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -215,13 +215,11 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SPACING,
|
||||
g_param_spec_int ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space to put between the label and the child"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space to put between the label and the child"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LABEL_WIDGET,
|
||||
@@ -232,22 +230,18 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("expander-size",
|
||||
P_("Expander Size"),
|
||||
P_("Size of the expander arrow"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_EXPANDER_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("expander-size",
|
||||
P_("Expander Size"),
|
||||
P_("Size of the expander arrow"),
|
||||
0, G_MAXINT, DEFAULT_EXPANDER_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("expander-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around expander arrow"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_EXPANDER_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("expander-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around expander arrow"),
|
||||
0, G_MAXINT, DEFAULT_EXPANDER_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
widget_class->activate_signal =
|
||||
g_signal_new (I_("activate"),
|
||||
@@ -330,7 +324,7 @@ gtk_expander_set_property (GObject *object,
|
||||
gtk_expander_set_use_markup (expander, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_expander_set_spacing (expander, g_value_get_int (value));
|
||||
gtk_expander_set_spacing (expander, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_LABEL_WIDGET:
|
||||
gtk_expander_set_label_widget (expander, g_value_get_object (value));
|
||||
@@ -365,7 +359,7 @@ gtk_expander_get_property (GObject *object,
|
||||
g_value_set_boolean (value, priv->use_markup);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, priv->spacing);
|
||||
gtk_value_set_size (value, priv->spacing, expander);
|
||||
break;
|
||||
case PROP_LABEL_WIDGET:
|
||||
g_value_set_object (value,
|
||||
@@ -1459,7 +1453,7 @@ gtk_expander_get_expanded (GtkExpander *expander)
|
||||
**/
|
||||
void
|
||||
gtk_expander_set_spacing (GtkExpander *expander,
|
||||
gint spacing)
|
||||
GtkSize spacing)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||
g_return_if_fail (spacing >= 0);
|
||||
@@ -1478,7 +1472,8 @@ gtk_expander_set_spacing (GtkExpander *expander,
|
||||
* gtk_expander_get_spacing:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Gets the value set by gtk_expander_set_spacing().
|
||||
* Gets the value set by gtk_expander_set_spacing() in pixels. Use
|
||||
* gtk_expander_get_spacing_unit() to preserve units.
|
||||
*
|
||||
* Return value: spacing between the expander and child.
|
||||
*
|
||||
@@ -1489,6 +1484,24 @@ gtk_expander_get_spacing (GtkExpander *expander)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0);
|
||||
|
||||
return gtk_widget_size_to_pixel (expander, expander->priv->spacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_expander_get_spacing_unit:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Like gtk_expander_set_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: spacing between the expander and child.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkSize
|
||||
gtk_expander_get_spacing_unit (GtkExpander *expander)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0);
|
||||
|
||||
return expander->priv->spacing;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -71,8 +71,9 @@ gboolean gtk_expander_get_expanded (GtkExpander *expander);
|
||||
|
||||
/* Spacing between the expander/label and the child */
|
||||
void gtk_expander_set_spacing (GtkExpander *expander,
|
||||
gint spacing);
|
||||
GtkSize spacing);
|
||||
gint gtk_expander_get_spacing (GtkExpander *expander);
|
||||
GtkSize gtk_expander_get_spacing_unit (GtkExpander *expander);
|
||||
|
||||
void gtk_expander_set_label (GtkExpander *expander,
|
||||
const gchar *label);
|
||||
|
||||
@@ -232,6 +232,7 @@ static void gtk_file_chooser_button_style_set (GtkWidget *wi
|
||||
GtkStyle *old_style);
|
||||
static void gtk_file_chooser_button_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen);
|
||||
static void gtk_file_chooser_button_unit_changed (GtkWidget *widget);
|
||||
|
||||
/* Utility Functions */
|
||||
static GtkIconTheme *get_icon_theme (GtkWidget *widget);
|
||||
@@ -342,6 +343,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
||||
widget_class->map = gtk_file_chooser_button_map;
|
||||
widget_class->style_set = gtk_file_chooser_button_style_set;
|
||||
widget_class->screen_changed = gtk_file_chooser_button_screen_changed;
|
||||
widget_class->unit_changed = gtk_file_chooser_button_unit_changed;
|
||||
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
|
||||
|
||||
/**
|
||||
@@ -449,7 +451,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
|
||||
gtk_container_add (GTK_CONTAINER (button), priv->button);
|
||||
gtk_widget_show (priv->button);
|
||||
|
||||
box = gtk_hbox_new (FALSE, 4);
|
||||
box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
@@ -1269,8 +1271,10 @@ change_icon_theme (GtkFileChooserButton *button)
|
||||
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (button)));
|
||||
|
||||
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
if (gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (button)),
|
||||
GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
priv->icon_size = MAX (width, height);
|
||||
else
|
||||
priv->icon_size = FALLBACK_ICON_SIZE;
|
||||
@@ -2916,5 +2920,16 @@ gtk_file_chooser_button_get_focus_on_click (GtkFileChooserButton *button)
|
||||
return button->priv->focus_on_click;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_button_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->unit_changed (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
||||
}
|
||||
|
||||
#define __GTK_FILE_CHOOSER_BUTTON_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+37
-20
@@ -248,7 +248,7 @@ typedef enum {
|
||||
/* Icon size for if we can't get it from the theme */
|
||||
#define FALLBACK_ICON_SIZE 16
|
||||
|
||||
#define PREVIEW_HBOX_SPACING 12
|
||||
#define PREVIEW_HBOX_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
#define NUM_LINES 45
|
||||
#define NUM_CHARS 60
|
||||
|
||||
@@ -278,6 +278,7 @@ static void gtk_file_chooser_default_style_set (GtkWidget *
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_file_chooser_default_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *previous_screen);
|
||||
static void gtk_file_chooser_default_unit_changed (GtkWidget *widget);
|
||||
static void gtk_file_chooser_default_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
@@ -567,6 +568,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
|
||||
widget_class->style_set = gtk_file_chooser_default_style_set;
|
||||
widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
|
||||
widget_class->size_allocate = gtk_file_chooser_default_size_allocate;
|
||||
widget_class->unit_changed = gtk_file_chooser_default_unit_changed;
|
||||
|
||||
signals[LOCATION_POPUP] =
|
||||
g_signal_new_class_handler (I_("location-popup"),
|
||||
@@ -802,7 +804,7 @@ _gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
|
||||
impl->sort_order = GTK_SORT_ASCENDING;
|
||||
impl->recent_manager = gtk_recent_manager_get_default ();
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (impl), 12);
|
||||
gtk_box_set_spacing (GTK_BOX (impl), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
set_file_system_backend (impl);
|
||||
|
||||
@@ -3988,7 +3990,7 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Shortcuts tree */
|
||||
@@ -3998,7 +4000,7 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
|
||||
|
||||
/* Box for buttons */
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 6);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_size_group_add_widget (size_group, hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
@@ -4742,7 +4744,7 @@ file_pane_create (GtkFileChooserDefault *impl,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Box for lists and preview */
|
||||
@@ -4758,13 +4760,13 @@ file_pane_create (GtkFileChooserDefault *impl,
|
||||
|
||||
/* Preview */
|
||||
|
||||
impl->preview_box = gtk_vbox_new (FALSE, 12);
|
||||
impl->preview_box = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0);
|
||||
/* Don't show preview box initially */
|
||||
|
||||
/* Filter combo */
|
||||
|
||||
impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12);
|
||||
impl->filter_combo_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
widget = filter_create (impl);
|
||||
|
||||
@@ -4917,13 +4919,13 @@ save_widgets_create (GtkFileChooserDefault *impl)
|
||||
|
||||
location_switch_to_path_bar (impl);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Label */
|
||||
|
||||
@@ -5259,10 +5261,10 @@ browse_widgets_create (GtkFileChooserDefault *impl)
|
||||
|
||||
/* size group is used by the [+][-] buttons and the filter combo */
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Location widgets */
|
||||
impl->browse_path_bar_hbox = gtk_hbox_new (FALSE, 12);
|
||||
impl->browse_path_bar_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), impl->browse_path_bar_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (impl->browse_path_bar_hbox);
|
||||
|
||||
@@ -5271,7 +5273,6 @@ browse_widgets_create (GtkFileChooserDefault *impl)
|
||||
gtk_size_group_set_ignore_hidden (impl->browse_path_bar_size_group, FALSE);
|
||||
|
||||
/* Location button */
|
||||
|
||||
location_button_create (impl);
|
||||
gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->location_button, FALSE, FALSE, 0);
|
||||
|
||||
@@ -5290,7 +5291,7 @@ browse_widgets_create (GtkFileChooserDefault *impl)
|
||||
|
||||
/* Box for the location label and entry */
|
||||
|
||||
impl->location_entry_box = gtk_hbox_new (FALSE, 12);
|
||||
impl->location_entry_box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), impl->location_entry_box, FALSE, FALSE, 0);
|
||||
|
||||
impl->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
|
||||
@@ -5891,7 +5892,10 @@ change_icon_theme (GtkFileChooserDefault *impl)
|
||||
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
|
||||
|
||||
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
|
||||
if (gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (impl)),
|
||||
GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
impl->icon_size = MAX (width, height);
|
||||
else
|
||||
impl->icon_size = FALLBACK_ICON_SIZE;
|
||||
@@ -8027,6 +8031,8 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
|
||||
return g_slist_reverse (list);
|
||||
}
|
||||
|
||||
/* RI TODO: find_good_size_from_style() probably needs to be removed; just use em's instead */
|
||||
|
||||
/* Guesses a size based upon font sizes */
|
||||
static void
|
||||
find_good_size_from_style (GtkWidget *widget,
|
||||
@@ -8093,7 +8099,7 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
|
||||
GTK_WIDGET_VISIBLE (impl->preview_widget))
|
||||
{
|
||||
gtk_widget_size_request (impl->preview_box, &req);
|
||||
*default_width += PREVIEW_HBOX_SPACING + req.width;
|
||||
*default_width += gtk_widget_size_to_pixel (impl, PREVIEW_HBOX_SPACING) + req.width;
|
||||
}
|
||||
|
||||
if (impl->extra_widget &&
|
||||
@@ -9485,13 +9491,13 @@ search_setup_widgets (GtkFileChooserDefault *impl)
|
||||
GtkWidget *label;
|
||||
GtkWidget *image;
|
||||
|
||||
impl->search_hbox = gtk_hbox_new (FALSE, 12);
|
||||
|
||||
impl->search_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Image */
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_size_group_add_widget (GTK_SIZE_GROUP (impl->browse_path_bar_size_group), image);
|
||||
gtk_box_pack_start (GTK_BOX (impl->search_hbox), image, FALSE, FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (impl->search_hbox), image, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Label */
|
||||
|
||||
@@ -10225,7 +10231,7 @@ recent_hide_entry (GtkFileChooserDefault *impl)
|
||||
/* Image */
|
||||
image = gtk_image_new_from_icon_name ("document-open-recent", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_size_group_add_widget (impl->browse_path_bar_size_group, image);
|
||||
gtk_box_pack_start (GTK_BOX (impl->recent_hbox), image, FALSE, FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (impl->recent_hbox), image, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Label */
|
||||
label = gtk_label_new (NULL);
|
||||
@@ -11862,3 +11868,14 @@ search_model_sort_new (GtkFileChooserDefault *impl,
|
||||
|
||||
return GTK_TREE_MODEL (model);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_default_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unit_changed (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_DEFAULT (widget));
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
|
||||
dialog->priv->response_requested = FALSE;
|
||||
|
||||
gtk_dialog_set_has_separator (fc_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* We do a signal connection here rather than overriding the method in
|
||||
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
|
||||
@@ -278,7 +278,7 @@ gtk_file_chooser_dialog_constructor (GType type,
|
||||
g_signal_connect (priv->widget, "response-requested",
|
||||
G_CALLBACK (file_chooser_widget_response_requested), object);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (priv->widget);
|
||||
|
||||
+17
-17
@@ -97,10 +97,10 @@
|
||||
#include <sys/cygwin.h> /* For cygwin_conv_to_posix_path */
|
||||
#endif
|
||||
|
||||
#define DIR_LIST_WIDTH 180
|
||||
#define DIR_LIST_HEIGHT 180
|
||||
#define FILE_LIST_WIDTH 180
|
||||
#define FILE_LIST_HEIGHT 180
|
||||
#define DIR_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM(180)
|
||||
#define DIR_LIST_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(180)
|
||||
#define FILE_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM(180)
|
||||
#define FILE_LIST_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(180)
|
||||
|
||||
/* The Hurd doesn't define either PATH_MAX or MAXPATHLEN, so we put this
|
||||
* in here, since the rest of the code in the file does require some
|
||||
@@ -638,7 +638,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
||||
|
||||
/* The dialog-sized vertical box */
|
||||
filesel->main_vbox = dialog->vbox;
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
/* The horizontal box containing create, rename etc. buttons */
|
||||
filesel->button_area = gtk_hbutton_box_new ();
|
||||
@@ -651,7 +651,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
||||
gtk_file_selection_show_fileop_buttons (filesel);
|
||||
|
||||
/* hbox for pulldown menu */
|
||||
pulldown_hbox = gtk_hbox_new (TRUE, 5);
|
||||
pulldown_hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), pulldown_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (pulldown_hbox);
|
||||
|
||||
@@ -664,11 +664,11 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
||||
/* The horizontal box containing the directory and file listboxes */
|
||||
|
||||
spacer = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_set_size_request (spacer, -1, 5);
|
||||
gtk_widget_set_size_request (spacer, -1, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), spacer, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spacer);
|
||||
|
||||
list_hbox = gtk_hbox_new (FALSE, 5);
|
||||
list_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (list_hbox);
|
||||
if (WANT_HPANED)
|
||||
@@ -681,7 +681,7 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
||||
list_container = list_hbox;
|
||||
|
||||
spacer = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_set_size_request (spacer, -1, 5);
|
||||
gtk_widget_set_size_request (spacer, -1, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (filesel->main_vbox), spacer, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spacer);
|
||||
|
||||
@@ -782,8 +782,8 @@ gtk_file_selection_init (GtkFileSelection *filesel)
|
||||
gtk_widget_grab_default (filesel->ok_button);
|
||||
|
||||
/* The selection entry widget */
|
||||
entry_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 2);
|
||||
entry_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (entry_vbox);
|
||||
|
||||
eventbox = gtk_event_box_new ();
|
||||
@@ -1399,21 +1399,21 @@ gtk_file_selection_create_dir (GtkWidget *widget,
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show( vbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Folder name:"));
|
||||
gtk_misc_set_alignment(GTK_MISC (label), 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* The directory entry widget */
|
||||
fs->fileop_entry = gtk_entry_new ();
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), fs->fileop_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
|
||||
TRUE, TRUE, 5);
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
GTK_WIDGET_SET_FLAGS (fs->fileop_entry, GTK_CAN_DEFAULT);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (fs->fileop_entry), TRUE);
|
||||
gtk_widget_show (fs->fileop_entry);
|
||||
@@ -1659,7 +1659,7 @@ gtk_file_selection_rename_file (GtkWidget *widget,
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show(vbox);
|
||||
@@ -1667,14 +1667,14 @@ gtk_file_selection_rename_file (GtkWidget *widget,
|
||||
buf = g_strdup_printf (_("Rename file \"%s\" to:"), fs->fileop_file);
|
||||
label = gtk_label_new (buf);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_widget_show (label);
|
||||
g_free (buf);
|
||||
|
||||
/* New filename entry */
|
||||
fs->fileop_entry = gtk_entry_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
|
||||
TRUE, TRUE, 5);
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
GTK_WIDGET_SET_FLAGS (fs->fileop_entry, GTK_CAN_DEFAULT);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (fs->fileop_entry), TRUE);
|
||||
gtk_widget_show (fs->fileop_entry);
|
||||
|
||||
+24
-28
@@ -86,23 +86,19 @@ gtk_fixed_class_init (GtkFixedClass *class)
|
||||
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_X,
|
||||
g_param_spec_int ("x",
|
||||
P_("X position"),
|
||||
P_("X position of child widget"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("x",
|
||||
P_("X position"),
|
||||
P_("X position of child widget"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_Y,
|
||||
g_param_spec_int ("y",
|
||||
P_("Y position"),
|
||||
P_("Y position of child widget"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("y",
|
||||
P_("Y position"),
|
||||
P_("Y position of child widget"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static GType
|
||||
@@ -149,8 +145,8 @@ get_child (GtkFixed *fixed,
|
||||
void
|
||||
gtk_fixed_put (GtkFixed *fixed,
|
||||
GtkWidget *widget,
|
||||
gint x,
|
||||
gint y)
|
||||
GtkSize x,
|
||||
GtkSize y)
|
||||
{
|
||||
GtkFixedChild *child_info;
|
||||
|
||||
@@ -171,9 +167,9 @@ static void
|
||||
gtk_fixed_move_internal (GtkFixed *fixed,
|
||||
GtkWidget *widget,
|
||||
gboolean change_x,
|
||||
gint x,
|
||||
GtkSize x,
|
||||
gboolean change_y,
|
||||
gint y)
|
||||
GtkSize y)
|
||||
{
|
||||
GtkFixedChild *child;
|
||||
|
||||
@@ -208,8 +204,8 @@ gtk_fixed_move_internal (GtkFixed *fixed,
|
||||
void
|
||||
gtk_fixed_move (GtkFixed *fixed,
|
||||
GtkWidget *widget,
|
||||
gint x,
|
||||
gint y)
|
||||
GtkSize x,
|
||||
GtkSize y)
|
||||
{
|
||||
gtk_fixed_move_internal (fixed, widget, TRUE, x, TRUE, y);
|
||||
}
|
||||
@@ -226,14 +222,14 @@ gtk_fixed_set_child_property (GtkContainer *container,
|
||||
case CHILD_PROP_X:
|
||||
gtk_fixed_move_internal (GTK_FIXED (container),
|
||||
child,
|
||||
TRUE, g_value_get_int (value),
|
||||
TRUE, gtk_value_get_size (value),
|
||||
FALSE, 0);
|
||||
break;
|
||||
case CHILD_PROP_Y:
|
||||
gtk_fixed_move_internal (GTK_FIXED (container),
|
||||
child,
|
||||
FALSE, 0,
|
||||
TRUE, g_value_get_int (value));
|
||||
TRUE, gtk_value_get_size (value));
|
||||
break;
|
||||
default:
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
@@ -255,10 +251,10 @@ gtk_fixed_get_child_property (GtkContainer *container,
|
||||
switch (property_id)
|
||||
{
|
||||
case CHILD_PROP_X:
|
||||
g_value_set_int (value, fixed_child->x);
|
||||
gtk_value_set_size (value, fixed_child->x, container);
|
||||
break;
|
||||
case CHILD_PROP_Y:
|
||||
g_value_set_int (value, fixed_child->y);
|
||||
gtk_value_set_size (value, fixed_child->y, container);
|
||||
break;
|
||||
default:
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
@@ -324,10 +320,10 @@ gtk_fixed_size_request (GtkWidget *widget,
|
||||
gtk_widget_size_request (child->widget, &child_requisition);
|
||||
|
||||
requisition->height = MAX (requisition->height,
|
||||
child->y +
|
||||
gtk_widget_size_to_pixel (fixed, child->y) +
|
||||
child_requisition.height);
|
||||
requisition->width = MAX (requisition->width,
|
||||
child->x +
|
||||
gtk_widget_size_to_pixel (fixed, child->x) +
|
||||
child_requisition.width);
|
||||
}
|
||||
}
|
||||
@@ -372,8 +368,8 @@ gtk_fixed_size_allocate (GtkWidget *widget,
|
||||
if (GTK_WIDGET_VISIBLE (child->widget))
|
||||
{
|
||||
gtk_widget_get_child_requisition (child->widget, &child_requisition);
|
||||
child_allocation.x = child->x + border_width;
|
||||
child_allocation.y = child->y + border_width;
|
||||
child_allocation.x = gtk_widget_size_to_pixel (fixed, child->x) + border_width;
|
||||
child_allocation.y = gtk_widget_size_to_pixel (fixed, child->y) + border_width;
|
||||
|
||||
if (GTK_WIDGET_NO_WINDOW (widget))
|
||||
{
|
||||
|
||||
+6
-6
@@ -64,8 +64,8 @@ struct _GtkFixedClass
|
||||
struct _GtkFixedChild
|
||||
{
|
||||
GtkWidget *widget;
|
||||
gint x;
|
||||
gint y;
|
||||
GtkSize x;
|
||||
GtkSize y;
|
||||
};
|
||||
|
||||
|
||||
@@ -73,12 +73,12 @@ GType gtk_fixed_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_fixed_new (void);
|
||||
void gtk_fixed_put (GtkFixed *fixed,
|
||||
GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
GtkSize x,
|
||||
GtkSize y);
|
||||
void gtk_fixed_move (GtkFixed *fixed,
|
||||
GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
GtkSize x,
|
||||
GtkSize y);
|
||||
void gtk_fixed_set_has_window (GtkFixed *fixed,
|
||||
gboolean has_window);
|
||||
gboolean gtk_fixed_get_has_window (GtkFixed *fixed);
|
||||
|
||||
+2
-2
@@ -785,13 +785,13 @@ gtk_font_button_create_inside (GtkFontButton *font_button)
|
||||
font_button->priv->font_label = gtk_label_new (_("Font"));
|
||||
|
||||
gtk_label_set_justify (GTK_LABEL (font_button->priv->font_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_box_pack_start (GTK_BOX (widget), font_button->priv->font_label, TRUE, TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (widget), font_button->priv->font_label, TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
if (font_button->priv->show_size)
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (widget), gtk_vseparator_new (), FALSE, FALSE, 0);
|
||||
font_button->priv->size_label = gtk_label_new ("14");
|
||||
gtk_box_pack_start (GTK_BOX (widget), font_button->priv->size_label, FALSE, FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (widget), font_button->priv->size_label, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
}
|
||||
|
||||
gtk_widget_show_all (widget);
|
||||
|
||||
+21
-19
@@ -78,14 +78,14 @@
|
||||
|
||||
/* This is the initial and maximum height of the preview entry (it expands
|
||||
when large font sizes are selected). Initial height is also the minimum. */
|
||||
#define INITIAL_PREVIEW_HEIGHT 44
|
||||
#define MAX_PREVIEW_HEIGHT 300
|
||||
#define INITIAL_PREVIEW_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(44)
|
||||
#define MAX_PREVIEW_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(300)
|
||||
|
||||
/* These are the sizes of the font, style & size lists. */
|
||||
#define FONT_LIST_HEIGHT 136
|
||||
#define FONT_LIST_WIDTH 190
|
||||
#define FONT_STYLE_LIST_WIDTH 170
|
||||
#define FONT_SIZE_LIST_WIDTH 60
|
||||
#define FONT_LIST_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(136)
|
||||
#define FONT_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM(190)
|
||||
#define FONT_STYLE_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM(170)
|
||||
#define FONT_SIZE_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM(60)
|
||||
|
||||
/* These are what we use as the standard font sizes, for the size list.
|
||||
*/
|
||||
@@ -302,34 +302,34 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (fontsel), 12);
|
||||
gtk_box_set_spacing (GTK_BOX (fontsel), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
fontsel->size = 12 * PANGO_SCALE;
|
||||
|
||||
/* Create the table of font, style & size. */
|
||||
table = gtk_table_new (3, 3, FALSE);
|
||||
gtk_widget_show (table);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0);
|
||||
|
||||
#ifdef INCLUDE_FONT_ENTRIES
|
||||
fontsel->font_entry = gtk_entry_new ();
|
||||
gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_entry), FALSE);
|
||||
gtk_widget_set_size_request (fontsel->font_entry, 20, -1);
|
||||
gtk_widget_set_size_request (fontsel->font_entry, GTK_SIZE_ONE_TWELFTH_EM (20), -1);
|
||||
gtk_widget_show (fontsel->font_entry);
|
||||
gtk_table_attach (GTK_TABLE (table), fontsel->font_entry, 0, 1, 1, 2,
|
||||
GTK_FILL, 0, 0, 0);
|
||||
|
||||
fontsel->font_style_entry = gtk_entry_new ();
|
||||
gtk_editable_set_editable (GTK_EDITABLE (fontsel->font_style_entry), FALSE);
|
||||
gtk_widget_set_size_request (fontsel->font_style_entry, 20, -1);
|
||||
gtk_widget_set_size_request (fontsel->font_style_entry, GTK_SIZE_ONE_TWELFTH_EM (20), -1);
|
||||
gtk_widget_show (fontsel->font_style_entry);
|
||||
gtk_table_attach (GTK_TABLE (table), fontsel->font_style_entry, 1, 2, 1, 2,
|
||||
GTK_FILL, 0, 0, 0);
|
||||
#endif /* INCLUDE_FONT_ENTRIES */
|
||||
|
||||
fontsel->size_entry = gtk_entry_new ();
|
||||
gtk_widget_set_size_request (fontsel->size_entry, 20, -1);
|
||||
gtk_widget_set_size_request (fontsel->size_entry, GTK_SIZE_ONE_TWELFTH_EM (20), -1);
|
||||
gtk_widget_show (fontsel->size_entry);
|
||||
gtk_table_attach (GTK_TABLE (table), fontsel->size_entry, 2, 3, 1, 2,
|
||||
GTK_FILL, 0, 0, 0);
|
||||
@@ -524,7 +524,7 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
|
||||
}
|
||||
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_widget_show (vbox);
|
||||
gtk_box_pack_start (GTK_BOX (fontsel), vbox, FALSE, TRUE, 0);
|
||||
|
||||
@@ -1155,7 +1155,9 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
|
||||
gtk_widget_size_request (preview_entry, NULL);
|
||||
|
||||
/* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
|
||||
new_height = CLAMP (preview_entry->requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
|
||||
new_height = CLAMP (preview_entry->requisition.height,
|
||||
gtk_widget_size_to_pixel (fontsel, INITIAL_PREVIEW_HEIGHT),
|
||||
gtk_widget_size_to_pixel (fontsel, MAX_PREVIEW_HEIGHT));
|
||||
|
||||
if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
|
||||
gtk_widget_set_size_request (preview_entry, -1, new_height);
|
||||
@@ -1605,10 +1607,10 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
|
||||
GtkDialog *dialog = GTK_DIALOG (fontseldiag);
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
@@ -1617,7 +1619,7 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
|
||||
fontseldiag->main_vbox = dialog->vbox;
|
||||
|
||||
fontseldiag->fontsel = gtk_font_selection_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fontseldiag->fontsel), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fontseldiag->fontsel), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_widget_show (fontseldiag->fontsel);
|
||||
gtk_box_pack_start (GTK_BOX (fontseldiag->main_vbox),
|
||||
fontseldiag->fontsel, TRUE, TRUE, 0);
|
||||
|
||||
+8
-8
@@ -33,8 +33,8 @@
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
#define LABEL_PAD 1
|
||||
#define LABEL_SIDE_PAD 2
|
||||
#define LABEL_PAD GTK_SIZE_ONE_TWELFTH_EM(1)
|
||||
#define LABEL_SIDE_PAD GTK_SIZE_ONE_TWELFTH_EM(2)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -560,7 +560,7 @@ gtk_frame_paint (GtkWidget *widget,
|
||||
y -= height_extra;
|
||||
height += height_extra;
|
||||
|
||||
x2 = widget->style->xthickness + (frame->child_allocation.width - child_requisition.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_SIDE_PAD;
|
||||
x2 = widget->style->xthickness + (frame->child_allocation.width - child_requisition.width - 2 * gtk_widget_size_to_pixel (frame, LABEL_PAD) - 2 * gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD)) * xalign + gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD);
|
||||
|
||||
/* If the label is completely over or under the frame we can omit the gap */
|
||||
if (frame->label_yalign == 0.0 || frame->label_yalign == 1.0)
|
||||
@@ -574,7 +574,7 @@ gtk_frame_paint (GtkWidget *widget,
|
||||
area, widget, "frame",
|
||||
x, y, width, height,
|
||||
GTK_POS_TOP,
|
||||
x2, child_requisition.width + 2 * LABEL_PAD);
|
||||
x2, child_requisition.width + 2 * gtk_widget_size_to_pixel (frame, LABEL_PAD));
|
||||
}
|
||||
else
|
||||
gtk_paint_shadow (widget->style, widget->window,
|
||||
@@ -610,7 +610,7 @@ gtk_frame_size_request (GtkWidget *widget,
|
||||
{
|
||||
gtk_widget_size_request (frame->label_widget, &child_requisition);
|
||||
|
||||
requisition->width = child_requisition.width + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
|
||||
requisition->width = child_requisition.width + 2 * gtk_widget_size_to_pixel (frame, LABEL_PAD) + 2 * gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD);
|
||||
requisition->height =
|
||||
MAX (0, child_requisition.height - widget->style->ythickness);
|
||||
}
|
||||
@@ -674,9 +674,9 @@ gtk_frame_size_allocate (GtkWidget *widget,
|
||||
else
|
||||
xalign = 1 - frame->label_xalign;
|
||||
|
||||
child_allocation.x = frame->child_allocation.x + LABEL_SIDE_PAD +
|
||||
(frame->child_allocation.width - child_requisition.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_PAD;
|
||||
child_allocation.width = MIN (child_requisition.width, new_allocation.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD);
|
||||
child_allocation.x = frame->child_allocation.x + gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD) +
|
||||
(frame->child_allocation.width - child_requisition.width - 2 * gtk_widget_size_to_pixel (frame, LABEL_PAD) - 2 * gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD)) * xalign + gtk_widget_size_to_pixel (frame, LABEL_PAD);
|
||||
child_allocation.width = MIN (child_requisition.width, new_allocation.width - 2 * gtk_widget_size_to_pixel (frame, LABEL_PAD) - 2 * gtk_widget_size_to_pixel (frame, LABEL_SIDE_PAD));
|
||||
|
||||
child_allocation.y = frame->child_allocation.y - MAX (child_requisition.height, widget->style->ythickness);
|
||||
child_allocation.height = child_requisition.height;
|
||||
|
||||
+5
-5
@@ -258,7 +258,7 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
|
||||
curve->gamma = 1.0;
|
||||
|
||||
curve->table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (curve->table), 3);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (curve->table), GTK_SIZE_ONE_TWELFTH_EM (3));
|
||||
gtk_container_add (GTK_CONTAINER (curve), curve->table);
|
||||
|
||||
curve->curve = gtk_curve_new ();
|
||||
@@ -266,7 +266,7 @@ gtk_gamma_curve_init (GtkGammaCurve *curve)
|
||||
G_CALLBACK (curve_type_changed_callback), curve);
|
||||
gtk_table_attach_defaults (GTK_TABLE (curve->table), curve->curve, 0, 1, 0, 1);
|
||||
|
||||
vbox = gtk_vbox_new (/* homogeneous */ FALSE, /* spacing */ 3);
|
||||
vbox = gtk_vbox_new (/* homogeneous */ FALSE, /* spacing */ GTK_SIZE_ONE_TWELFTH_EM (3));
|
||||
gtk_table_attach (GTK_TABLE (curve->table), vbox, 1, 2, 0, 1, 0, 0, 0, 0);
|
||||
|
||||
/* toggle buttons: */
|
||||
@@ -412,18 +412,18 @@ button_clicked_callback (GtkWidget *w, gpointer data)
|
||||
vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
|
||||
|
||||
hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Gamma value"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (label);
|
||||
|
||||
sprintf (buf, "%g", c->gamma);
|
||||
c->gamma_text = gtk_entry_new ();
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), c->gamma_text);
|
||||
gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (c->gamma_text);
|
||||
|
||||
/* fill in action area: */
|
||||
|
||||
+39
-40
@@ -54,10 +54,9 @@ enum {
|
||||
PROP_CHILD_DETACHED
|
||||
};
|
||||
|
||||
#define DRAG_HANDLE_SIZE 10
|
||||
#define CHILDLESS_SIZE 25
|
||||
#define GHOST_HEIGHT 3
|
||||
#define TOLERANCE 5
|
||||
#define DRAG_HANDLE_SIZE GTK_SIZE_ONE_TWELFTH_EM(10)
|
||||
#define CHILDLESS_SIZE GTK_SIZE_ONE_TWELFTH_EM(25)
|
||||
#define TOLERANCE GTK_SIZE_ONE_TWELFTH_EM(5)
|
||||
|
||||
enum {
|
||||
SIGNAL_CHILD_ATTACHED,
|
||||
@@ -530,13 +529,13 @@ gtk_handle_box_size_request (GtkWidget *widget,
|
||||
if (handle_position == GTK_POS_LEFT ||
|
||||
handle_position == GTK_POS_RIGHT)
|
||||
{
|
||||
requisition->width = DRAG_HANDLE_SIZE;
|
||||
requisition->width = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
requisition->height = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
requisition->width = 0;
|
||||
requisition->height = DRAG_HANDLE_SIZE;
|
||||
requisition->height = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
}
|
||||
|
||||
/* if our child is not visible, we still request its size, since we
|
||||
@@ -582,8 +581,8 @@ gtk_handle_box_size_request (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
requisition->width += CHILDLESS_SIZE;
|
||||
requisition->height += CHILDLESS_SIZE;
|
||||
requisition->width += gtk_widget_size_to_pixel (widget, CHILDLESS_SIZE);
|
||||
requisition->height += gtk_widget_size_to_pixel (widget, CHILDLESS_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -630,9 +629,9 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
|
||||
child_allocation.x = border_width;
|
||||
child_allocation.y = border_width;
|
||||
if (handle_position == GTK_POS_LEFT)
|
||||
child_allocation.x += DRAG_HANDLE_SIZE;
|
||||
child_allocation.x += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
else if (handle_position == GTK_POS_TOP)
|
||||
child_allocation.y += DRAG_HANDLE_SIZE;
|
||||
child_allocation.y += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
|
||||
if (hb->child_detached)
|
||||
{
|
||||
@@ -647,9 +646,9 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (handle_position == GTK_POS_LEFT ||
|
||||
handle_position == GTK_POS_RIGHT)
|
||||
float_width += DRAG_HANDLE_SIZE;
|
||||
float_width += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
else
|
||||
float_height += DRAG_HANDLE_SIZE;
|
||||
float_height += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (hb))
|
||||
{
|
||||
@@ -670,9 +669,9 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (handle_position == GTK_POS_LEFT ||
|
||||
handle_position == GTK_POS_RIGHT)
|
||||
child_allocation.width -= DRAG_HANDLE_SIZE;
|
||||
child_allocation.width -= gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
else
|
||||
child_allocation.height -= DRAG_HANDLE_SIZE;
|
||||
child_allocation.height -= gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (hb))
|
||||
gdk_window_move_resize (hb->bin_window,
|
||||
@@ -702,17 +701,17 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
|
||||
if (handle_position == GTK_POS_LEFT ||
|
||||
handle_position == GTK_POS_RIGHT)
|
||||
{
|
||||
x = handle_position == GTK_POS_LEFT ? 0 : widget->allocation.width - DRAG_HANDLE_SIZE;
|
||||
x = handle_position == GTK_POS_LEFT ? 0 : widget->allocation.width - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
y = 0;
|
||||
width = DRAG_HANDLE_SIZE;
|
||||
width = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
height = widget->allocation.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = handle_position == GTK_POS_TOP ? 0 : widget->allocation.height - DRAG_HANDLE_SIZE;
|
||||
y = handle_position == GTK_POS_TOP ? 0 : widget->allocation.height - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
width = widget->allocation.width;
|
||||
height = DRAG_HANDLE_SIZE;
|
||||
height = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
}
|
||||
gtk_paint_shadow (widget->style,
|
||||
widget->window,
|
||||
@@ -729,16 +728,16 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
|
||||
widget->window,
|
||||
GTK_WIDGET_STATE (widget),
|
||||
NULL, widget, "handlebox",
|
||||
handle_position == GTK_POS_LEFT ? DRAG_HANDLE_SIZE : 0,
|
||||
handle_position == GTK_POS_LEFT ? widget->allocation.width : widget->allocation.width - DRAG_HANDLE_SIZE,
|
||||
handle_position == GTK_POS_LEFT ? gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE) : 0,
|
||||
handle_position == GTK_POS_LEFT ? widget->allocation.width : widget->allocation.width - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE),
|
||||
widget->allocation.height / 2);
|
||||
else
|
||||
gtk_paint_vline (widget->style,
|
||||
widget->window,
|
||||
GTK_WIDGET_STATE (widget),
|
||||
NULL, widget, "handlebox",
|
||||
handle_position == GTK_POS_TOP ? DRAG_HANDLE_SIZE : 0,
|
||||
handle_position == GTK_POS_TOP ? widget->allocation.height : widget->allocation.height - DRAG_HANDLE_SIZE,
|
||||
handle_position == GTK_POS_TOP ? gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE) : 0,
|
||||
handle_position == GTK_POS_TOP ? widget->allocation.height : widget->allocation.height - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE),
|
||||
widget->allocation.width / 2);
|
||||
}
|
||||
|
||||
@@ -915,14 +914,14 @@ gtk_handle_box_paint (GtkWidget *widget,
|
||||
case GTK_POS_LEFT:
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = DRAG_HANDLE_SIZE;
|
||||
rect.width = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
rect.height = height;
|
||||
handle_orientation = GTK_ORIENTATION_VERTICAL;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
rect.x = width - DRAG_HANDLE_SIZE;
|
||||
rect.x = width - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
rect.y = 0;
|
||||
rect.width = DRAG_HANDLE_SIZE;
|
||||
rect.width = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
rect.height = height;
|
||||
handle_orientation = GTK_ORIENTATION_VERTICAL;
|
||||
break;
|
||||
@@ -930,14 +929,14 @@ gtk_handle_box_paint (GtkWidget *widget,
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = width;
|
||||
rect.height = DRAG_HANDLE_SIZE;
|
||||
rect.height = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
handle_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
rect.x = 0;
|
||||
rect.y = height - DRAG_HANDLE_SIZE;
|
||||
rect.y = height - gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
rect.width = width;
|
||||
rect.height = DRAG_HANDLE_SIZE;
|
||||
rect.height = gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
handle_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
break;
|
||||
default:
|
||||
@@ -1047,10 +1046,10 @@ gtk_handle_box_button_press (GtkWidget *widget,
|
||||
switch (handle_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
in_handle = event->x < DRAG_HANDLE_SIZE;
|
||||
in_handle = event->x < gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
in_handle = event->y < DRAG_HANDLE_SIZE;
|
||||
in_handle = event->y < gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
in_handle = event->x > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.width;
|
||||
@@ -1206,18 +1205,18 @@ gtk_handle_box_motion (GtkWidget *widget,
|
||||
switch (snap_edge)
|
||||
{
|
||||
case GTK_POS_TOP:
|
||||
is_snapped = abs (hb->attach_allocation.y - new_y) < TOLERANCE;
|
||||
is_snapped = abs (hb->attach_allocation.y - new_y) < gtk_widget_size_to_pixel (widget, TOLERANCE);
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
is_snapped = abs (hb->attach_allocation.y + (gint)hb->attach_allocation.height -
|
||||
new_y - (gint)hb->float_allocation.height) < TOLERANCE;
|
||||
new_y - (gint)hb->float_allocation.height) < gtk_widget_size_to_pixel (widget, TOLERANCE);
|
||||
break;
|
||||
case GTK_POS_LEFT:
|
||||
is_snapped = abs (hb->attach_allocation.x - new_x) < TOLERANCE;
|
||||
is_snapped = abs (hb->attach_allocation.x - new_x) < gtk_widget_size_to_pixel (widget, TOLERANCE);
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
is_snapped = abs (hb->attach_allocation.x + (gint)hb->attach_allocation.width -
|
||||
new_x - (gint)hb->float_allocation.width) < TOLERANCE;
|
||||
new_x - (gint)hb->float_allocation.width) < gtk_widget_size_to_pixel (widget, TOLERANCE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1249,10 +1248,10 @@ gtk_handle_box_motion (GtkWidget *widget,
|
||||
break;
|
||||
}
|
||||
|
||||
is_snapped = ((attach_pos1 - TOLERANCE < float_pos1) &&
|
||||
(attach_pos2 + TOLERANCE > float_pos2)) ||
|
||||
((float_pos1 - TOLERANCE < attach_pos1) &&
|
||||
(float_pos2 + TOLERANCE > attach_pos2));
|
||||
is_snapped = ((attach_pos1 - gtk_widget_size_to_pixel (widget, TOLERANCE) < float_pos1) &&
|
||||
(attach_pos2 + gtk_widget_size_to_pixel (widget, TOLERANCE) > float_pos2)) ||
|
||||
((float_pos1 - gtk_widget_size_to_pixel (widget, TOLERANCE) < attach_pos1) &&
|
||||
(float_pos2 + gtk_widget_size_to_pixel (widget, TOLERANCE) > attach_pos2));
|
||||
}
|
||||
|
||||
if (is_snapped)
|
||||
@@ -1322,9 +1321,9 @@ gtk_handle_box_motion (GtkWidget *widget,
|
||||
height = child_requisition.height + 2 * GTK_CONTAINER (hb)->border_width;
|
||||
|
||||
if (handle_position == GTK_POS_LEFT || handle_position == GTK_POS_RIGHT)
|
||||
width += DRAG_HANDLE_SIZE;
|
||||
width += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
else
|
||||
height += DRAG_HANDLE_SIZE;
|
||||
height += gtk_widget_size_to_pixel (widget, DRAG_HANDLE_SIZE);
|
||||
|
||||
gdk_window_move_resize (hb->float_window, new_x, new_y, width, height);
|
||||
gdk_window_reparent (hb->bin_window, hb->float_window, 0, 0);
|
||||
|
||||
+24
-3
@@ -30,10 +30,26 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
static gint override_default_spacing = -1;
|
||||
static gint get_default_spacing (void);
|
||||
static void set_default_spacing (gint size);
|
||||
|
||||
static gint default_spacing = 30;
|
||||
static gint default_layout_style = GTK_BUTTONBOX_EDGE;
|
||||
|
||||
static gint
|
||||
get_default_spacing (void)
|
||||
{
|
||||
if (override_default_spacing != -1)
|
||||
return override_default_spacing;
|
||||
return GTK_SIZE_ONE_TWELFTH_EM(30);
|
||||
}
|
||||
|
||||
static void
|
||||
set_default_spacing (gint size)
|
||||
{
|
||||
override_default_spacing = size;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GtkHButtonBox, gtk_hbutton_box, GTK_TYPE_BUTTON_BOX)
|
||||
|
||||
static void
|
||||
@@ -64,7 +80,7 @@ gtk_hbutton_box_new (void)
|
||||
void
|
||||
gtk_hbutton_box_set_spacing_default (gint spacing)
|
||||
{
|
||||
default_spacing = spacing;
|
||||
set_default_spacing (spacing);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +100,12 @@ gtk_hbutton_box_set_layout_default (GtkButtonBoxStyle layout)
|
||||
gint
|
||||
gtk_hbutton_box_get_spacing_default (void)
|
||||
{
|
||||
return default_spacing;
|
||||
/* This function is just broken: since the default spacing is a
|
||||
* constant number of resolution independent units (e.g. 2.5em), the
|
||||
* pixel size will vary depending on what screen the widget will
|
||||
* appear on (different DPI etc.).
|
||||
*/
|
||||
return gtk_size_to_pixel (NULL, 0, get_default_spacing ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
+47
-19
@@ -43,10 +43,10 @@
|
||||
#include "gtkalias.h"
|
||||
|
||||
/* Default width/height */
|
||||
#define DEFAULT_SIZE 100
|
||||
#define DEFAULT_SIZE GTK_SIZE_ONE_TWELFTH_EM(100)
|
||||
|
||||
/* Default ring width */
|
||||
#define DEFAULT_RING_WIDTH 10
|
||||
#define DEFAULT_RING_WIDTH GTK_SIZE_ONE_TWELFTH_EM(10)
|
||||
|
||||
|
||||
/* Dragging modes */
|
||||
@@ -64,8 +64,8 @@ typedef struct {
|
||||
double v;
|
||||
|
||||
/* Size and ring width */
|
||||
int size;
|
||||
int ring_width;
|
||||
GtkSize size;
|
||||
GtkSize ring_width;
|
||||
|
||||
/* Window for capturing events */
|
||||
GdkWindow *window;
|
||||
@@ -349,8 +349,8 @@ gtk_hsv_size_request (GtkWidget *widget,
|
||||
"focus-padding", &focus_pad,
|
||||
NULL);
|
||||
|
||||
requisition->width = priv->size + 2 * (focus_width + focus_pad);
|
||||
requisition->height = priv->size + 2 * (focus_width + focus_pad);
|
||||
requisition->width = gtk_widget_size_to_pixel (widget, priv->size) + 2 * (focus_width + focus_pad);
|
||||
requisition->height = gtk_widget_size_to_pixel (widget, priv->size) + 2 * (focus_width + focus_pad);
|
||||
}
|
||||
|
||||
/* Size_allocate handler for the HSV color selector */
|
||||
@@ -547,8 +547,8 @@ compute_triangle (GtkHSV *hsv,
|
||||
|
||||
center_x = GTK_WIDGET (hsv)->allocation.width / 2.0;
|
||||
center_y = GTK_WIDGET (hsv)->allocation.height / 2.0;
|
||||
outer = priv->size / 2.0;
|
||||
inner = outer - priv->ring_width;
|
||||
outer = gtk_widget_size_to_pixel (hsv, priv->size) / 2.0;
|
||||
inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
|
||||
angle = priv->h * 2.0 * G_PI;
|
||||
|
||||
*hx = floor (center_x + cos (angle) * inner + 0.5);
|
||||
@@ -572,11 +572,10 @@ is_in_ring (GtkHSV *hsv,
|
||||
gdouble inner, outer;
|
||||
|
||||
priv = hsv->priv;
|
||||
|
||||
center_x = GTK_WIDGET (hsv)->allocation.width / 2.0;
|
||||
center_y = GTK_WIDGET (hsv)->allocation.height / 2.0;
|
||||
outer = priv->size / 2.0;
|
||||
inner = outer - priv->ring_width;
|
||||
outer = gtk_widget_size_to_pixel (hsv, priv->size / 2.0);
|
||||
inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
|
||||
|
||||
dx = x - center_x;
|
||||
dy = center_y - y;
|
||||
@@ -922,8 +921,8 @@ paint_ring (GtkHSV *hsv,
|
||||
center_x = widget->allocation.width / 2.0;
|
||||
center_y = widget->allocation.height / 2.0;
|
||||
|
||||
outer = priv->size / 2.0;
|
||||
inner = outer - priv->ring_width;
|
||||
outer = gtk_widget_size_to_pixel (hsv, priv->size) / 2.0;
|
||||
inner = outer - gtk_widget_size_to_pixel (hsv, priv->ring_width);
|
||||
|
||||
/* Create an image initialized with the ring colors */
|
||||
|
||||
@@ -997,11 +996,11 @@ paint_ring (GtkHSV *hsv,
|
||||
cairo_set_source_surface (cr, source, x, y);
|
||||
cairo_surface_destroy (source);
|
||||
|
||||
cairo_set_line_width (cr, priv->ring_width);
|
||||
cairo_set_line_width (cr, gtk_widget_size_to_pixel (hsv, priv->ring_width));
|
||||
cairo_new_path (cr);
|
||||
cairo_arc (cr,
|
||||
center_x, center_y,
|
||||
priv->size / 2. - priv->ring_width / 2.,
|
||||
gtk_widget_size_to_pixel (hsv, priv->size) / 2. - gtk_widget_size_to_pixel (hsv, priv->ring_width) / 2.,
|
||||
0, 2 * G_PI);
|
||||
cairo_stroke (cr);
|
||||
|
||||
@@ -1459,8 +1458,8 @@ gtk_hsv_get_color (GtkHSV *hsv,
|
||||
*/
|
||||
void
|
||||
gtk_hsv_set_metrics (GtkHSV *hsv,
|
||||
gint size,
|
||||
gint ring_width)
|
||||
GtkSize size,
|
||||
GtkSize ring_width)
|
||||
{
|
||||
HSVPrivate *priv;
|
||||
int same_size;
|
||||
@@ -1468,7 +1467,7 @@ gtk_hsv_set_metrics (GtkHSV *hsv,
|
||||
g_return_if_fail (GTK_IS_HSV (hsv));
|
||||
g_return_if_fail (size > 0);
|
||||
g_return_if_fail (ring_width > 0);
|
||||
g_return_if_fail (2 * ring_width + 1 <= size);
|
||||
g_return_if_fail (2 * gtk_widget_size_to_pixel (hsv, ring_width) + 1 <= gtk_widget_size_to_pixel (hsv, size));
|
||||
|
||||
priv = hsv->priv;
|
||||
|
||||
@@ -1489,7 +1488,8 @@ gtk_hsv_set_metrics (GtkHSV *hsv,
|
||||
* @size: Return value for the diameter of the hue ring
|
||||
* @ring_width: Return value for the width of the hue ring
|
||||
*
|
||||
* Queries the size and ring width of an HSV color selector.
|
||||
* Queries the size and ring width of an HSV color selector in pixels.
|
||||
* Use gtk_hsv_get_metrics_unit() to preserve units.
|
||||
*
|
||||
* Since: 2.14
|
||||
*/
|
||||
@@ -1504,6 +1504,34 @@ gtk_hsv_get_metrics (GtkHSV *hsv,
|
||||
|
||||
priv = hsv->priv;
|
||||
|
||||
if (size)
|
||||
*size = gtk_widget_size_to_pixel (hsv, priv->size);
|
||||
|
||||
if (ring_width)
|
||||
*ring_width = gtk_widget_size_to_pixel (hsv, priv->ring_width);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_hsv_get_metrics_unit:
|
||||
* @hsv: An HSV color selector.
|
||||
* @size: Return value for the diameter of the hue ring.
|
||||
* @ring_width: Return value for the width of the hue ring.
|
||||
*
|
||||
* Like gtk_hsv_get_metrics() but preserves the unit.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gtk_hsv_get_metrics_unit (GtkHSV *hsv,
|
||||
GtkSize *size,
|
||||
GtkSize *ring_width)
|
||||
{
|
||||
HSVPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_HSV (hsv));
|
||||
|
||||
priv = hsv->priv;
|
||||
|
||||
if (size)
|
||||
*size = priv->size;
|
||||
|
||||
|
||||
+5
-2
@@ -89,11 +89,14 @@ void gtk_hsv_get_color (GtkHSV *hsv,
|
||||
gdouble *s,
|
||||
gdouble *v);
|
||||
void gtk_hsv_set_metrics (GtkHSV *hsv,
|
||||
gint size,
|
||||
gint ring_width);
|
||||
GtkSize size,
|
||||
GtkSize ring_width);
|
||||
void gtk_hsv_get_metrics (GtkHSV *hsv,
|
||||
gint *size,
|
||||
gint *ring_width);
|
||||
void gtk_hsv_get_metrics_unit (GtkHSV *hsv,
|
||||
GtkSize *size,
|
||||
GtkSize *ring_width);
|
||||
gboolean gtk_hsv_is_adjusting (GtkHSV *hsv);
|
||||
|
||||
/* Convert colors between the RGB and HSV color spaces */
|
||||
|
||||
+133
-26
@@ -607,33 +607,33 @@ init_icon_sizes (void)
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].size = GTK_ICON_SIZE_MENU;
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].name = "gtk-menu";
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].width = 16;
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].height = 16;
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].width = GTK_SIZE_ONE_TWELFTH_EM (16);
|
||||
icon_sizes[GTK_ICON_SIZE_MENU].height = GTK_SIZE_ONE_TWELFTH_EM (16);
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].size = GTK_ICON_SIZE_BUTTON;
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].name = "gtk-button";
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].width = 20;
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].height = 20;
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].width = GTK_SIZE_ONE_TWELFTH_EM (20);
|
||||
icon_sizes[GTK_ICON_SIZE_BUTTON].height = GTK_SIZE_ONE_TWELFTH_EM (20);
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].name = "gtk-small-toolbar";
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = 18;
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = 18;
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = GTK_SIZE_ONE_TWELFTH_EM (18);
|
||||
icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = GTK_SIZE_ONE_TWELFTH_EM (18);
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].name = "gtk-large-toolbar";
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = 24;
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].height = 24;
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = GTK_SIZE_ONE_TWELFTH_EM (24);
|
||||
icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].height = GTK_SIZE_ONE_TWELFTH_EM (24);
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_DND].size = GTK_ICON_SIZE_DND;
|
||||
icon_sizes[GTK_ICON_SIZE_DND].name = "gtk-dnd";
|
||||
icon_sizes[GTK_ICON_SIZE_DND].width = 32;
|
||||
icon_sizes[GTK_ICON_SIZE_DND].height = 32;
|
||||
icon_sizes[GTK_ICON_SIZE_DND].width = GTK_SIZE_ONE_TWELFTH_EM (32);
|
||||
icon_sizes[GTK_ICON_SIZE_DND].height = GTK_SIZE_ONE_TWELFTH_EM (32);
|
||||
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].size = GTK_ICON_SIZE_DIALOG;
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].name = "gtk-dialog";
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].width = 48;
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].height = 48;
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].width = GTK_SIZE_ONE_TWELFTH_EM (48);
|
||||
icon_sizes[GTK_ICON_SIZE_DIALOG].height = GTK_SIZE_ONE_TWELFTH_EM (48);
|
||||
|
||||
g_assert ((GTK_ICON_SIZE_DIALOG + 1) == NUM_BUILTIN_SIZES);
|
||||
|
||||
@@ -838,6 +838,15 @@ icon_size_settings_changed (GtkSettings *settings,
|
||||
gtk_rc_reset_styles (settings);
|
||||
}
|
||||
|
||||
static void
|
||||
monitors_changed (GtkSettings *settings,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
icon_size_set_all_from_settings (settings);
|
||||
|
||||
gtk_rc_reset_styles (settings);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_sizes_init_for_settings (GtkSettings *settings)
|
||||
{
|
||||
@@ -851,9 +860,11 @@ icon_sizes_init_for_settings (GtkSettings *settings)
|
||||
|
||||
static gboolean
|
||||
icon_size_lookup_intern (GtkSettings *settings,
|
||||
gint monitor_num,
|
||||
GtkIconSize size,
|
||||
gint *widthp,
|
||||
gint *heightp)
|
||||
gint *heightp,
|
||||
gboolean preserve_unit)
|
||||
{
|
||||
GArray *settings_sizes;
|
||||
gint width_for_settings = -1;
|
||||
@@ -890,10 +901,12 @@ icon_size_lookup_intern (GtkSettings *settings,
|
||||
}
|
||||
|
||||
if (widthp)
|
||||
*widthp = width_for_settings >= 0 ? width_for_settings : icon_sizes[size].width;
|
||||
*widthp = preserve_unit ? (width_for_settings >= 0 ? width_for_settings : icon_sizes[size].width) :
|
||||
gtk_size_to_pixel (settings->screen, monitor_num, width_for_settings >= 0 ? width_for_settings : icon_sizes[size].width);
|
||||
|
||||
if (heightp)
|
||||
*heightp = height_for_settings >= 0 ? height_for_settings : icon_sizes[size].height;
|
||||
*heightp = preserve_unit ? (height_for_settings >= 0 ? height_for_settings : icon_sizes[size].height) :
|
||||
gtk_size_to_pixel (settings->screen, monitor_num, height_for_settings >= 0 ? height_for_settings : icon_sizes[size].height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -929,7 +942,63 @@ gtk_icon_size_lookup_for_settings (GtkSettings *settings,
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
|
||||
|
||||
return icon_size_lookup_intern (settings, size, width, height);
|
||||
/* choose the first monitor; should probably also deprecate this function - or make GtkSettings per monitor */
|
||||
return icon_size_lookup_intern (settings, 0, size, width, height, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_size_lookup_for_settings_for_monitor:
|
||||
* @settings: a #GtkSettings object, used to determine
|
||||
* which set of user preferences to used.
|
||||
* @monitor_num: the monitor number or -1 to use default monitor
|
||||
* @size: an icon size
|
||||
* @width: location to store icon width
|
||||
* @height: location to store icon height
|
||||
*
|
||||
* Like gtk_icon_size_lookup_for_settings() but takes a monitor number
|
||||
* as well.
|
||||
*
|
||||
* Return value: %TRUE if @size was a valid size
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
gboolean
|
||||
gtk_icon_size_lookup_for_settings_for_monitor (GtkSettings *settings,
|
||||
gint monitor_num,
|
||||
GtkIconSize size,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
|
||||
|
||||
return icon_size_lookup_intern (settings, monitor_num, size, width, height, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_size_lookup_for_settings_unit:
|
||||
* @settings: a #GtkSettings object, used to determine
|
||||
* which set of user preferences to used.
|
||||
* @monitor_num: the monitor number or -1 to use default monitor
|
||||
* @size: an icon size
|
||||
* @width: location to store icon width
|
||||
* @height: location to store icon height
|
||||
*
|
||||
* Like gtk_icon_size_lookup_for_settings_for_monitor() but preserves the unit.
|
||||
*
|
||||
* Return value: %TRUE if @size was a valid size
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
gboolean
|
||||
gtk_icon_size_lookup_for_settings_unit (GtkSettings *settings,
|
||||
gint monitor_num,
|
||||
GtkIconSize size,
|
||||
GtkSize *width,
|
||||
GtkSize *height)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
|
||||
|
||||
return icon_size_lookup_intern (settings, monitor_num, size, width, height, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -964,6 +1033,31 @@ gtk_icon_size_lookup (GtkIconSize size,
|
||||
size, widthp, heightp);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_size_lookup_unit:
|
||||
* @size: an icon size
|
||||
* @width: location to store icon width
|
||||
* @height: location to store icon height
|
||||
*
|
||||
* Like gtk_icon_size_lookup() but preserves the unit.
|
||||
*
|
||||
* Return value: %TRUE if @size was a valid size
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
gboolean
|
||||
gtk_icon_size_lookup_unit (GtkIconSize size,
|
||||
GtkSize *widthp,
|
||||
GtkSize *heightp)
|
||||
{
|
||||
GTK_NOTE (MULTIHEAD,
|
||||
g_warning ("gtk_icon_size_lookup ()) is not multihead safe"));
|
||||
|
||||
return gtk_icon_size_lookup_for_settings_unit (gtk_settings_get_default (),
|
||||
-1,
|
||||
size, widthp, heightp);
|
||||
}
|
||||
|
||||
static GtkIconSize
|
||||
icon_size_register_intern (const gchar *name,
|
||||
gint width,
|
||||
@@ -1052,7 +1146,7 @@ gtk_icon_size_register_alias (const gchar *alias,
|
||||
|
||||
init_icon_sizes ();
|
||||
|
||||
if (!icon_size_lookup_intern (NULL, target, NULL, NULL))
|
||||
if (!icon_size_lookup_intern (NULL, 0, target, NULL, NULL, FALSE))
|
||||
g_warning ("gtk_icon_size_register_alias: Icon size %u does not exist", target);
|
||||
|
||||
ia = g_hash_table_lookup (icon_aliases, alias);
|
||||
@@ -1125,12 +1219,14 @@ static GdkPixbuf *find_in_cache (GtkIconSet *icon_set,
|
||||
GtkStyle *style,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size);
|
||||
GtkIconSize size,
|
||||
gint monitor_num);
|
||||
static void add_to_cache (GtkIconSet *icon_set,
|
||||
GtkStyle *style,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size,
|
||||
gint monitor_num,
|
||||
GdkPixbuf *pixbuf);
|
||||
/* Clear icon set contents, drop references to all contained
|
||||
* GdkPixbuf objects and forget all GtkIconSources. Used to
|
||||
@@ -1338,8 +1434,8 @@ sizes_equivalent (GtkIconSize lhs,
|
||||
|
||||
gint r_w, r_h, l_w, l_h;
|
||||
|
||||
icon_size_lookup_intern (NULL, rhs, &r_w, &r_h);
|
||||
icon_size_lookup_intern (NULL, lhs, &l_w, &l_h);
|
||||
icon_size_lookup_intern (NULL, 0, rhs, &r_w, &r_h, FALSE);
|
||||
icon_size_lookup_intern (NULL, 0, lhs, &l_w, &l_h, FALSE);
|
||||
|
||||
return r_w == l_w && r_h == l_h;
|
||||
#endif
|
||||
@@ -1433,6 +1529,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source,
|
||||
gint width, height, pixel_size;
|
||||
gint *sizes, *s, dist;
|
||||
GError *error = NULL;
|
||||
gint monitor_num;
|
||||
|
||||
if (widget && gtk_widget_has_screen (widget))
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
@@ -1448,7 +1545,8 @@ render_icon_name_pixbuf (GtkIconSource *icon_source,
|
||||
icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
|
||||
if (!gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
|
||||
monitor_num = widget != NULL ? gtk_widget_get_monitor_num (widget) : -1;
|
||||
if (!gtk_icon_size_lookup_for_settings_for_monitor (settings, monitor_num, size, &width, &height))
|
||||
{
|
||||
if (size == (GtkIconSize)-1)
|
||||
{
|
||||
@@ -1656,6 +1754,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
|
||||
const char *detail)
|
||||
{
|
||||
GdkPixbuf *icon;
|
||||
gint monitor_num;
|
||||
|
||||
g_return_val_if_fail (icon_set != NULL, NULL);
|
||||
g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL);
|
||||
@@ -1663,10 +1762,14 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
|
||||
if (icon_set->sources == NULL)
|
||||
return render_fallback_image (style, direction, state, size, widget, detail);
|
||||
|
||||
monitor_num = widget != NULL ? gtk_widget_get_monitor_num (widget) : -1;
|
||||
if (monitor_num < 0)
|
||||
monitor_num = 0;
|
||||
|
||||
if (detail == NULL)
|
||||
{
|
||||
icon = find_in_cache (icon_set, style, direction,
|
||||
state, size);
|
||||
state, size, monitor_num);
|
||||
|
||||
if (icon)
|
||||
{
|
||||
@@ -1675,7 +1778,6 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
icon = find_and_render_icon_source (icon_set, style, direction, state, size,
|
||||
widget, detail);
|
||||
|
||||
@@ -1683,7 +1785,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
|
||||
icon = render_fallback_image (style, direction, state, size, widget, detail);
|
||||
|
||||
if (detail == NULL)
|
||||
add_to_cache (icon_set, style, direction, state, size, icon);
|
||||
add_to_cache (icon_set, style, direction, state, size, monitor_num, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
@@ -2427,6 +2529,7 @@ struct _CachedIcon
|
||||
GtkTextDirection direction;
|
||||
GtkStateType state;
|
||||
GtkIconSize size;
|
||||
gint monitor_num;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
};
|
||||
@@ -2457,7 +2560,8 @@ find_in_cache (GtkIconSet *icon_set,
|
||||
GtkStyle *style,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size)
|
||||
GtkIconSize size,
|
||||
gint monitor_num)
|
||||
{
|
||||
GSList *tmp_list;
|
||||
GSList *prev;
|
||||
@@ -2473,7 +2577,8 @@ find_in_cache (GtkIconSet *icon_set,
|
||||
if (icon->style == style &&
|
||||
icon->direction == direction &&
|
||||
icon->state == state &&
|
||||
(size == (GtkIconSize)-1 || icon->size == size))
|
||||
(size == (GtkIconSize)-1 || icon->size == size) &&
|
||||
icon->monitor_num == monitor_num)
|
||||
{
|
||||
if (prev)
|
||||
{
|
||||
@@ -2499,6 +2604,7 @@ add_to_cache (GtkIconSet *icon_set,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size,
|
||||
gint monitor_num,
|
||||
GdkPixbuf *pixbuf)
|
||||
{
|
||||
CachedIcon *icon;
|
||||
@@ -2523,6 +2629,7 @@ add_to_cache (GtkIconSet *icon_set,
|
||||
icon->direction = direction;
|
||||
icon->state = state;
|
||||
icon->size = size;
|
||||
icon->monitor_num = monitor_num;
|
||||
icon->pixbuf = pixbuf;
|
||||
|
||||
if (icon->style)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkrc.h>
|
||||
#include <gtk/gtksize.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -100,11 +101,24 @@ GtkIconSet* gtk_icon_factory_lookup_default (const gchar *stock_id);
|
||||
gboolean gtk_icon_size_lookup (GtkIconSize size,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gtk_icon_size_lookup_unit (GtkIconSize size,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
#endif /* GDK_MULTIHEAD_SAFE */
|
||||
gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,
|
||||
GtkIconSize size,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gtk_icon_size_lookup_for_settings_for_monitor (GtkSettings *settings,
|
||||
gint monitor_num,
|
||||
GtkIconSize size,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gtk_icon_size_lookup_for_settings_unit (GtkSettings *settings,
|
||||
gint monitor_num,
|
||||
GtkIconSize size,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
|
||||
GtkIconSize gtk_icon_size_register (const gchar *name,
|
||||
gint width,
|
||||
|
||||
+170
-75
@@ -45,8 +45,8 @@
|
||||
|
||||
#undef DEBUG_ICON_VIEW
|
||||
|
||||
#define SCROLL_EDGE_SIZE 15
|
||||
#define ITEM_PADDING 6
|
||||
#define SCROLL_EDGE_SIZE GTK_SIZE_ONE_TWELFTH_EM(15)
|
||||
#define ITEM_PADDING GTK_SIZE_ONE_TWELFTH_EM(6)
|
||||
|
||||
#define GTK_ICON_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ICON_VIEW, GtkIconViewPrivate))
|
||||
|
||||
@@ -644,11 +644,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ITEM_WIDTH,
|
||||
g_param_spec_int ("item-width",
|
||||
P_("Width for each item"),
|
||||
P_("The width used for each item"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("item-width",
|
||||
P_("Width for each item"),
|
||||
P_("The width used for each item"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkIconView:spacing:
|
||||
@@ -660,11 +660,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SPACING,
|
||||
g_param_spec_int ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space which is inserted between cells of an item"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space which is inserted between cells of an item"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkIconView:row-spacing:
|
||||
@@ -676,11 +676,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ROW_SPACING,
|
||||
g_param_spec_int ("row-spacing",
|
||||
P_("Row Spacing"),
|
||||
P_("Space which is inserted between grid rows"),
|
||||
0, G_MAXINT, 6,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("row-spacing",
|
||||
P_("Row Spacing"),
|
||||
P_("Space which is inserted between grid rows"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkIconView:column-spacing:
|
||||
@@ -692,11 +692,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_COLUMN_SPACING,
|
||||
g_param_spec_int ("column-spacing",
|
||||
P_("Column Spacing"),
|
||||
P_("Space which is inserted between grid columns"),
|
||||
0, G_MAXINT, 6,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("column-spacing",
|
||||
P_("Column Spacing"),
|
||||
P_("Space which is inserted between grid columns"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkIconView:margin:
|
||||
@@ -708,11 +708,11 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MARGIN,
|
||||
g_param_spec_int ("margin",
|
||||
P_("Margin"),
|
||||
P_("Space which is inserted at the edges of the icon view"),
|
||||
0, G_MAXINT, 6,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("margin",
|
||||
P_("Margin"),
|
||||
P_("Space which is inserted at the edges of the icon view"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
@@ -1103,9 +1103,9 @@ gtk_icon_view_init (GtkIconView *icon_view)
|
||||
icon_view->priv->columns = -1;
|
||||
icon_view->priv->item_width = -1;
|
||||
icon_view->priv->spacing = 0;
|
||||
icon_view->priv->row_spacing = 6;
|
||||
icon_view->priv->column_spacing = 6;
|
||||
icon_view->priv->margin = 6;
|
||||
icon_view->priv->row_spacing = GTK_SIZE_ONE_TWELFTH_EM (6);
|
||||
icon_view->priv->column_spacing = GTK_SIZE_ONE_TWELFTH_EM (6);
|
||||
icon_view->priv->margin = GTK_SIZE_ONE_TWELFTH_EM (6);
|
||||
|
||||
icon_view->priv->draw_focus = TRUE;
|
||||
}
|
||||
@@ -1194,19 +1194,19 @@ gtk_icon_view_set_property (GObject *object,
|
||||
gtk_icon_view_set_columns (icon_view, g_value_get_int (value));
|
||||
break;
|
||||
case PROP_ITEM_WIDTH:
|
||||
gtk_icon_view_set_item_width (icon_view, g_value_get_int (value));
|
||||
gtk_icon_view_set_item_width (icon_view, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_icon_view_set_spacing (icon_view, g_value_get_int (value));
|
||||
gtk_icon_view_set_spacing (icon_view, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_ROW_SPACING:
|
||||
gtk_icon_view_set_row_spacing (icon_view, g_value_get_int (value));
|
||||
gtk_icon_view_set_row_spacing (icon_view, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_COLUMN_SPACING:
|
||||
gtk_icon_view_set_column_spacing (icon_view, g_value_get_int (value));
|
||||
gtk_icon_view_set_column_spacing (icon_view, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_MARGIN:
|
||||
gtk_icon_view_set_margin (icon_view, g_value_get_int (value));
|
||||
gtk_icon_view_set_margin (icon_view, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_REORDERABLE:
|
||||
gtk_icon_view_set_reorderable (icon_view, g_value_get_boolean (value));
|
||||
@@ -1256,19 +1256,19 @@ gtk_icon_view_get_property (GObject *object,
|
||||
g_value_set_int (value, icon_view->priv->columns);
|
||||
break;
|
||||
case PROP_ITEM_WIDTH:
|
||||
g_value_set_int (value, icon_view->priv->item_width);
|
||||
gtk_value_set_size (value, icon_view->priv->item_width, icon_view);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, icon_view->priv->spacing);
|
||||
gtk_value_set_size (value, icon_view->priv->spacing, icon_view);
|
||||
break;
|
||||
case PROP_ROW_SPACING:
|
||||
g_value_set_int (value, icon_view->priv->row_spacing);
|
||||
gtk_value_set_size (value, icon_view->priv->row_spacing, icon_view);
|
||||
break;
|
||||
case PROP_COLUMN_SPACING:
|
||||
g_value_set_int (value, icon_view->priv->column_spacing);
|
||||
gtk_value_set_size (value, icon_view->priv->column_spacing, icon_view);
|
||||
break;
|
||||
case PROP_MARGIN:
|
||||
g_value_set_int (value, icon_view->priv->margin);
|
||||
gtk_value_set_size (value, icon_view->priv->margin, icon_view);
|
||||
break;
|
||||
case PROP_REORDERABLE:
|
||||
g_value_set_boolean (value, icon_view->priv->reorderable);
|
||||
@@ -2664,8 +2664,8 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
||||
"focus-line-width", &focus_width,
|
||||
NULL);
|
||||
|
||||
x += icon_view->priv->margin + focus_width;
|
||||
current_width += 2 * (icon_view->priv->margin + focus_width);
|
||||
x += gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin) + focus_width;
|
||||
current_width += 2 * (gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin) + focus_width);
|
||||
|
||||
items = first_item;
|
||||
while (items)
|
||||
@@ -2673,9 +2673,9 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
||||
GtkIconViewItem *item = items->data;
|
||||
|
||||
gtk_icon_view_calculate_item_size (icon_view, item);
|
||||
colspan = 1 + (item->width - 1) / (item_width + icon_view->priv->column_spacing);
|
||||
colspan = 1 + (item->width - 1) / (item_width + gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing));
|
||||
|
||||
item->width = colspan * item_width + (colspan - 1) * icon_view->priv->column_spacing;
|
||||
item->width = colspan * item_width + (colspan - 1) * gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing);
|
||||
|
||||
current_width += item->width;
|
||||
|
||||
@@ -2686,12 +2686,12 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
||||
break;
|
||||
}
|
||||
|
||||
current_width += icon_view->priv->column_spacing + 2 * focus_width;
|
||||
current_width += gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing) + 2 * focus_width;
|
||||
|
||||
item->y = *y + focus_width;
|
||||
item->x = x;
|
||||
|
||||
x = current_width - (icon_view->priv->margin + focus_width);
|
||||
x = current_width - (gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin) + focus_width);
|
||||
|
||||
for (i = 0; i < icon_view->priv->n_cells; i++)
|
||||
max_height[i] = MAX (max_height[i], item->box[i].height);
|
||||
@@ -2722,8 +2722,8 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
||||
gtk_icon_view_calculate_item_size2 (icon_view, item, max_height);
|
||||
|
||||
/* We may want to readjust the new y coordinate. */
|
||||
if (item->y + item->height + focus_width + icon_view->priv->row_spacing > *y)
|
||||
*y = item->y + item->height + focus_width + icon_view->priv->row_spacing;
|
||||
if (item->y + item->height + focus_width + gtk_widget_size_to_pixel (icon_view, icon_view->priv->row_spacing) > *y)
|
||||
*y = item->y + item->height + focus_width + gtk_widget_size_to_pixel (icon_view, icon_view->priv->row_spacing);
|
||||
}
|
||||
|
||||
g_free (max_height);
|
||||
@@ -2775,7 +2775,7 @@ gtk_icon_view_layout (GtkIconView *icon_view)
|
||||
|
||||
widget = GTK_WIDGET (icon_view);
|
||||
|
||||
item_width = icon_view->priv->item_width;
|
||||
item_width = gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width);
|
||||
|
||||
if (item_width < 0)
|
||||
{
|
||||
@@ -2789,7 +2789,7 @@ gtk_icon_view_layout (GtkIconView *icon_view)
|
||||
|
||||
|
||||
icons = icon_view->priv->items;
|
||||
y += icon_view->priv->margin;
|
||||
y += gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin);
|
||||
row = 0;
|
||||
|
||||
if (icons)
|
||||
@@ -2810,7 +2810,7 @@ gtk_icon_view_layout (GtkIconView *icon_view)
|
||||
if (maximum_width != icon_view->priv->width)
|
||||
icon_view->priv->width = maximum_width;
|
||||
|
||||
y += icon_view->priv->margin;
|
||||
y += gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin);
|
||||
|
||||
if (y != icon_view->priv->height)
|
||||
icon_view->priv->height = y;
|
||||
@@ -2911,22 +2911,22 @@ adjust_wrap_width (GtkIconView *icon_view,
|
||||
NULL);
|
||||
|
||||
|
||||
if (icon_view->priv->item_width > 0)
|
||||
item_width = icon_view->priv->item_width;
|
||||
if (gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width) > 0)
|
||||
item_width = gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width);
|
||||
else
|
||||
item_width = item->width;
|
||||
|
||||
if (item->width == -1)
|
||||
{
|
||||
if (item_width > 0)
|
||||
wrap_width = item_width - pixbuf_width - icon_view->priv->spacing;
|
||||
wrap_width = item_width - pixbuf_width - gtk_widget_size_to_pixel (icon_view, icon_view->priv->spacing);
|
||||
else
|
||||
wrap_width = MAX (2 * pixbuf_width, 50);
|
||||
}
|
||||
else if (icon_view->priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||
wrap_width = item_width;
|
||||
else
|
||||
wrap_width = item_width - pixbuf_width - icon_view->priv->spacing;
|
||||
wrap_width = item_width - pixbuf_width - gtk_widget_size_to_pixel (icon_view, icon_view->priv->spacing);
|
||||
|
||||
wrap_width -= ITEM_PADDING * 2;
|
||||
|
||||
@@ -2960,7 +2960,7 @@ gtk_icon_view_calculate_item_size (GtkIconView *icon_view,
|
||||
|
||||
gtk_icon_view_set_cell_data (icon_view, item);
|
||||
|
||||
spacing = icon_view->priv->spacing;
|
||||
spacing = gtk_widget_size_to_pixel (icon_view, icon_view->priv->spacing);
|
||||
|
||||
item->width = 0;
|
||||
item->height = 0;
|
||||
@@ -3008,7 +3008,7 @@ gtk_icon_view_calculate_item_size2 (GtkIconView *icon_view,
|
||||
|
||||
gtk_icon_view_set_cell_data (icon_view, item);
|
||||
|
||||
spacing = icon_view->priv->spacing;
|
||||
spacing = gtk_widget_size_to_pixel (icon_view, icon_view->priv->spacing);
|
||||
|
||||
item->height = 0;
|
||||
for (i = 0; i < icon_view->priv->n_cells; i++)
|
||||
@@ -3451,8 +3451,8 @@ gtk_icon_view_get_item_at_coords (GtkIconView *icon_view,
|
||||
{
|
||||
GtkIconViewItem *item = items->data;
|
||||
|
||||
if (x >= item->x - icon_view->priv->column_spacing/2 && x <= item->x + item->width + icon_view->priv->column_spacing/2 &&
|
||||
y >= item->y - icon_view->priv->row_spacing/2 && y <= item->y + item->height + icon_view->priv->row_spacing/2)
|
||||
if (x >= item->x - gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing)/2 && x <= item->x + item->width + gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing)/2 &&
|
||||
y >= item->y - gtk_widget_size_to_pixel (icon_view, icon_view->priv->row_spacing)/2 && y <= item->y + item->height + gtk_widget_size_to_pixel (icon_view, icon_view->priv->row_spacing)/2)
|
||||
{
|
||||
if (only_in_cell || cell_at_pos)
|
||||
{
|
||||
@@ -6019,7 +6019,7 @@ gtk_icon_view_get_columns (GtkIconView *icon_view)
|
||||
*/
|
||||
void
|
||||
gtk_icon_view_set_item_width (GtkIconView *icon_view,
|
||||
gint item_width)
|
||||
GtkSize item_width)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
|
||||
@@ -6041,7 +6041,8 @@ gtk_icon_view_set_item_width (GtkIconView *icon_view,
|
||||
* gtk_icon_view_get_item_width:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Returns the value of the ::item-width property.
|
||||
* Returns the value of the ::item-width property in pixels. To preserve
|
||||
* the units use gtk_icon_view_get_item_width_unit().
|
||||
*
|
||||
* Return value: the width of a single item, or -1
|
||||
*
|
||||
@@ -6052,6 +6053,24 @@ gtk_icon_view_get_item_width (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_view_get_item_width_unit:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Like gtk_icon_view_get_item_width() but preserves the unit.
|
||||
*
|
||||
* Return value: the width_unit of a single item, or -1
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_icon_view_get_item_width_unit (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return icon_view->priv->item_width;
|
||||
}
|
||||
|
||||
@@ -6069,7 +6088,7 @@ gtk_icon_view_get_item_width (GtkIconView *icon_view)
|
||||
*/
|
||||
void
|
||||
gtk_icon_view_set_spacing (GtkIconView *icon_view,
|
||||
gint spacing)
|
||||
GtkSize spacing)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
|
||||
@@ -6089,7 +6108,8 @@ gtk_icon_view_set_spacing (GtkIconView *icon_view,
|
||||
* gtk_icon_view_get_spacing:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Returns the value of the ::spacing property.
|
||||
* Returns the value of the ::spacing property in pixels. To preserve the units
|
||||
* use gtk_icon_view_get_spacing_unit().
|
||||
*
|
||||
* Return value: the space between cells
|
||||
*
|
||||
@@ -6100,6 +6120,24 @@ gtk_icon_view_get_spacing (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return gtk_widget_size_to_pixel (icon_view, icon_view->priv->spacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_view_get_spacing_unit:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Like gtk_icon_view_get_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: the space between cells
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_icon_view_get_spacing_unit (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return icon_view->priv->spacing;
|
||||
}
|
||||
|
||||
@@ -6115,7 +6153,7 @@ gtk_icon_view_get_spacing (GtkIconView *icon_view)
|
||||
*/
|
||||
void
|
||||
gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
|
||||
gint row_spacing)
|
||||
GtkSize row_spacing)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
|
||||
@@ -6135,7 +6173,8 @@ gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
|
||||
* gtk_icon_view_get_row_spacing:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Returns the value of the ::row-spacing property.
|
||||
* Returns the value of the ::row-spacing property in pixels. To preserve the
|
||||
* units use gtk_icon_view_get_row_spacing_unit().
|
||||
*
|
||||
* Return value: the space between rows
|
||||
*
|
||||
@@ -6146,6 +6185,24 @@ gtk_icon_view_get_row_spacing (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return gtk_widget_size_to_pixel (icon_view, icon_view->priv->row_spacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_view_get_row_spacing_unit:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Like gtk_icon_view_get_row_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: the space between rows
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_icon_view_get_row_spacing_unit (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return icon_view->priv->row_spacing;
|
||||
}
|
||||
|
||||
@@ -6161,7 +6218,7 @@ gtk_icon_view_get_row_spacing (GtkIconView *icon_view)
|
||||
*/
|
||||
void
|
||||
gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
|
||||
gint column_spacing)
|
||||
GtkSize column_spacing)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
|
||||
@@ -6181,7 +6238,8 @@ gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
|
||||
* gtk_icon_view_get_column_spacing:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Returns the value of the ::column-spacing property.
|
||||
* Returns the value of the ::column-spacing property in pixels. To preserve
|
||||
* the units use gtk_icon_view_get_column_spacing_unit().
|
||||
*
|
||||
* Return value: the space between columns
|
||||
*
|
||||
@@ -6192,6 +6250,24 @@ gtk_icon_view_get_column_spacing (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return gtk_widget_size_to_pixel (icon_view, icon_view->priv->column_spacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_view_get_column_spacing_unit:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Like gtk_icon_view_get_column_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: the space between columns
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_icon_view_get_column_spacing_unit (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return icon_view->priv->column_spacing;
|
||||
}
|
||||
|
||||
@@ -6208,7 +6284,7 @@ gtk_icon_view_get_column_spacing (GtkIconView *icon_view)
|
||||
*/
|
||||
void
|
||||
gtk_icon_view_set_margin (GtkIconView *icon_view,
|
||||
gint margin)
|
||||
GtkSize margin)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
|
||||
@@ -6228,7 +6304,8 @@ gtk_icon_view_set_margin (GtkIconView *icon_view,
|
||||
* gtk_icon_view_get_margin:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Returns the value of the ::margin property.
|
||||
* Returns the value of the ::margin property in pixels. To preserve the units
|
||||
* use gtk_icon_view_get_margin_unit().
|
||||
*
|
||||
* Return value: the space at the borders
|
||||
*
|
||||
@@ -6239,6 +6316,24 @@ gtk_icon_view_get_margin (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return gtk_widget_size_to_pixel (icon_view, icon_view->priv->margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_view_get_margin_unit:
|
||||
* @icon_view: a #GtkIconView
|
||||
*
|
||||
* Like gtk_icon_view_get_margin() but preserves the unit.
|
||||
*
|
||||
* Return value: the space at the borders
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_icon_view_get_margin_unit (GtkIconView *icon_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), -1);
|
||||
|
||||
return icon_view->priv->margin;
|
||||
}
|
||||
|
||||
@@ -6418,13 +6513,13 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
|
||||
gdk_window_get_geometry (GTK_WIDGET (icon_view)->window, &x, &y, &width, &height, NULL);
|
||||
|
||||
/* see if we are near the edge. */
|
||||
voffset = py - (y + 2 * SCROLL_EDGE_SIZE);
|
||||
voffset = py - (y + 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE));
|
||||
if (voffset > 0)
|
||||
voffset = MAX (py - (y + height - 2 * SCROLL_EDGE_SIZE), 0);
|
||||
voffset = MAX (py - (y + height - 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE)), 0);
|
||||
|
||||
hoffset = px - (x + 2 * SCROLL_EDGE_SIZE);
|
||||
hoffset = px - (x + 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE));
|
||||
if (hoffset > 0)
|
||||
hoffset = MAX (px - (x + width - 2 * SCROLL_EDGE_SIZE), 0);
|
||||
hoffset = MAX (px - (x + width - 2 * gtk_widget_size_to_pixel (icon_view, SCROLL_EDGE_SIZE)), 0);
|
||||
|
||||
if (voffset != 0)
|
||||
{
|
||||
@@ -8293,7 +8388,7 @@ gtk_icon_view_item_accessible_text_get_character_extents (AtkText *text,
|
||||
atk_component_get_position (ATK_COMPONENT (text), x, y, coord_type);
|
||||
*x += item->item->layout_x - item->item->x + char_rect.x / PANGO_SCALE;
|
||||
/* Look at gtk_icon_view_paint_item() to see where the text is. */
|
||||
*x -= ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2,
|
||||
*x -= ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width)) - gtk_widget_size_to_pixel (icon_view, item->item->width)) / 2,
|
||||
*y += item->item->layout_y - item->item->y + char_rect.y / PANGO_SCALE;
|
||||
*width = char_rect.width / PANGO_SCALE;
|
||||
*height = char_rect.height / PANGO_SCALE;
|
||||
@@ -8329,7 +8424,7 @@ gtk_icon_view_item_accessible_text_get_offset_at_point (AtkText *text,
|
||||
gtk_icon_view_update_item_text (icon_view, item->item);
|
||||
atk_component_get_position (ATK_COMPONENT (text), &l_x, &l_y, coord_type);
|
||||
x -= l_x + item->item->layout_x - item->item->x;
|
||||
x += ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2,
|
||||
x += ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, gtk_widget_size_to_pixel (icon_view, icon_view->priv->item_width)) - gtk_widget_size_to_pixel (icon_view, item->item->width)) / 2,
|
||||
y -= l_y + item->item->layout_y - item->item->y;
|
||||
item_text = pango_layout_get_text (icon_view->priv->layout);
|
||||
if (!pango_layout_xy_to_index (icon_view->priv->layout,
|
||||
|
||||
+10
-5
@@ -111,20 +111,25 @@ void gtk_icon_view_set_columns (GtkIconView *icon_view,
|
||||
gint columns);
|
||||
gint gtk_icon_view_get_columns (GtkIconView *icon_view);
|
||||
void gtk_icon_view_set_item_width (GtkIconView *icon_view,
|
||||
gint item_width);
|
||||
GtkSize item_width);
|
||||
gint gtk_icon_view_get_item_width (GtkIconView *icon_view);
|
||||
GtkSize gtk_icon_view_get_item_width_unit (GtkIconView *icon_view);
|
||||
void gtk_icon_view_set_spacing (GtkIconView *icon_view,
|
||||
gint spacing);
|
||||
GtkSize spacing);
|
||||
gint gtk_icon_view_get_spacing (GtkIconView *icon_view);
|
||||
GtkSize gtk_icon_view_get_spacing_unit (GtkIconView *icon_view);
|
||||
void gtk_icon_view_set_row_spacing (GtkIconView *icon_view,
|
||||
gint row_spacing);
|
||||
GtkSize row_spacing);
|
||||
gint gtk_icon_view_get_row_spacing (GtkIconView *icon_view);
|
||||
GtkSize gtk_icon_view_get_row_spacing_unit (GtkIconView *icon_view);
|
||||
void gtk_icon_view_set_column_spacing (GtkIconView *icon_view,
|
||||
gint column_spacing);
|
||||
GtkSize column_spacing);
|
||||
gint gtk_icon_view_get_column_spacing (GtkIconView *icon_view);
|
||||
GtkSize gtk_icon_view_get_column_spacing_unit (GtkIconView *icon_view);
|
||||
void gtk_icon_view_set_margin (GtkIconView *icon_view,
|
||||
gint margin);
|
||||
GtkSize margin);
|
||||
gint gtk_icon_view_get_margin (GtkIconView *icon_view);
|
||||
GtkSize gtk_icon_view_get_margin_unit (GtkIconView *icon_view);
|
||||
|
||||
|
||||
GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
|
||||
|
||||
+56
-17
@@ -44,7 +44,7 @@ struct _GtkImagePrivate
|
||||
/* Only used with GTK_IMAGE_ANIMATION, GTK_IMAGE_PIXBUF */
|
||||
gchar *filename;
|
||||
|
||||
gint pixel_size;
|
||||
GtkSize pixel_size;
|
||||
};
|
||||
|
||||
#define GTK_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_IMAGE, GtkImagePrivate))
|
||||
@@ -61,6 +61,7 @@ static void gtk_image_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
static void gtk_image_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *prev_screen);
|
||||
static void gtk_image_unit_changed (GtkWidget *widget);
|
||||
static void gtk_image_destroy (GtkObject *object);
|
||||
static void gtk_image_reset (GtkImage *image);
|
||||
static void gtk_image_calc_size (GtkImage *image);
|
||||
@@ -124,6 +125,7 @@ gtk_image_class_init (GtkImageClass *class)
|
||||
widget_class->unrealize = gtk_image_unrealize;
|
||||
widget_class->style_set = gtk_image_style_set;
|
||||
widget_class->screen_changed = gtk_image_screen_changed;
|
||||
widget_class->unit_changed = gtk_image_unit_changed;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PIXBUF,
|
||||
@@ -201,12 +203,11 @@ gtk_image_class_init (GtkImageClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PIXEL_SIZE,
|
||||
g_param_spec_int ("pixel-size",
|
||||
P_("Pixel size"),
|
||||
P_("Pixel size to use for named icon"),
|
||||
-1, G_MAXINT,
|
||||
-1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("pixel-size",
|
||||
P_("Pixel size"),
|
||||
P_("Pixel size to use for named icon"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PIXBUF_ANIMATION,
|
||||
@@ -365,7 +366,7 @@ gtk_image_set_property (GObject *object,
|
||||
image->icon_size = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_PIXEL_SIZE:
|
||||
gtk_image_set_pixel_size (image, g_value_get_int (value));
|
||||
gtk_image_set_pixel_size (image, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_PIXBUF_ANIMATION:
|
||||
gtk_image_set_from_animation (image,
|
||||
@@ -451,7 +452,7 @@ gtk_image_get_property (GObject *object,
|
||||
g_value_set_int (value, image->icon_size);
|
||||
break;
|
||||
case PROP_PIXEL_SIZE:
|
||||
g_value_set_int (value, priv->pixel_size);
|
||||
gtk_value_set_size (value, priv->pixel_size, image);
|
||||
break;
|
||||
case PROP_PIXBUF_ANIMATION:
|
||||
if (image->storage_type != GTK_IMAGE_ANIMATION)
|
||||
@@ -1540,12 +1541,13 @@ ensure_pixbuf_for_icon_name (GtkImage *image)
|
||||
{
|
||||
if (priv->pixel_size != -1)
|
||||
{
|
||||
width = height = priv->pixel_size;
|
||||
width = height = gtk_widget_size_to_pixel (image, priv->pixel_size);
|
||||
flags |= GTK_ICON_LOOKUP_FORCE_SIZE;
|
||||
}
|
||||
else if (!gtk_icon_size_lookup_for_settings (settings,
|
||||
image->icon_size,
|
||||
&width, &height))
|
||||
else if (!gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (image)),
|
||||
image->icon_size,
|
||||
&width, &height))
|
||||
{
|
||||
if (image->icon_size == -1)
|
||||
{
|
||||
@@ -1623,12 +1625,13 @@ ensure_pixbuf_for_gicon (GtkImage *image)
|
||||
{
|
||||
if (priv->pixel_size != -1)
|
||||
{
|
||||
width = height = priv->pixel_size;
|
||||
width = height = gtk_widget_size_to_pixel (image, priv->pixel_size);
|
||||
flags |= GTK_ICON_LOOKUP_FORCE_SIZE;
|
||||
}
|
||||
else if (!gtk_icon_size_lookup_for_settings (settings,
|
||||
image->icon_size,
|
||||
&width, &height))
|
||||
else if (!gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (image)),
|
||||
image->icon_size,
|
||||
&width, &height))
|
||||
{
|
||||
if (image->icon_size == -1)
|
||||
width = height = 48;
|
||||
@@ -2318,6 +2321,7 @@ gtk_image_set_pixel_size (GtkImage *image,
|
||||
* @image: a #GtkImage
|
||||
*
|
||||
* Gets the pixel size used for named icons.
|
||||
* Use gtk_image_get_pixel_size_unit() to preserve units.
|
||||
*
|
||||
* Returns: the pixel size used for named icons.
|
||||
*
|
||||
@@ -2332,6 +2336,28 @@ gtk_image_get_pixel_size (GtkImage *image)
|
||||
|
||||
priv = GTK_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
return gtk_widget_size_to_pixel (image, priv->pixel_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_image_get_pixel_size_unit:
|
||||
* @image: a #GtkImage
|
||||
*
|
||||
* Like gtk_image_get_pixel_size() but preserves the unit.
|
||||
*
|
||||
* Returns: the size used for named icons.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkSize
|
||||
gtk_image_get_pixel_size_unit (GtkImage *image)
|
||||
{
|
||||
GtkImagePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_IMAGE (image), -1);
|
||||
|
||||
priv = GTK_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
return priv->pixel_size;
|
||||
}
|
||||
|
||||
@@ -2367,5 +2393,18 @@ gtk_image_set_from_file (GtkImage *image,
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_image_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkImage *image = GTK_IMAGE (widget);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_image_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_image_parent_class)->unit_changed (widget);
|
||||
|
||||
icon_theme_changed (image);
|
||||
}
|
||||
|
||||
|
||||
#define __GTK_IMAGE_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+2
-1
@@ -204,7 +204,7 @@ void gtk_image_set_from_gicon (GtkImage *image,
|
||||
GIcon *icon,
|
||||
GtkIconSize size);
|
||||
void gtk_image_set_pixel_size (GtkImage *image,
|
||||
gint pixel_size);
|
||||
GtkSize pixel_size);
|
||||
|
||||
GtkImageType gtk_image_get_storage_type (GtkImage *image);
|
||||
|
||||
@@ -229,6 +229,7 @@ void gtk_image_get_gicon (GtkImage *image,
|
||||
GIcon **gicon,
|
||||
GtkIconSize *size);
|
||||
gint gtk_image_get_pixel_size (GtkImage *image);
|
||||
GtkSize gtk_image_get_pixel_size_unit (GtkImage *image);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
/* These three are deprecated */
|
||||
|
||||
+28
-28
@@ -436,13 +436,13 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
* Since: 2.18
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the content area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
8,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the content area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (8),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkInfoBar:content-area-spacing:
|
||||
@@ -453,13 +453,13 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
* Since: 2.18
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
16,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (16),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkInfoBar:button-spacing:
|
||||
@@ -469,13 +469,13 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
* Since: 2.18
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkInfoBar:action-area-border:
|
||||
@@ -485,13 +485,13 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
|
||||
* Since: 2.18
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the action area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
5,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the action area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (5),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkInfoBar:use-tooltip-style:
|
||||
|
||||
+24
-23
@@ -84,11 +84,11 @@ enum
|
||||
};
|
||||
|
||||
|
||||
#define AXIS_LIST_WIDTH 160
|
||||
#define AXIS_LIST_HEIGHT 175
|
||||
#define AXIS_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM (160)
|
||||
#define AXIS_LIST_HEIGHT GTK_SIZE_ONE_TWELFTH_EM (175)
|
||||
|
||||
#define KEYS_LIST_WIDTH 200
|
||||
#define KEYS_LIST_HEIGHT 175
|
||||
#define KEYS_LIST_WIDTH GTK_SIZE_ONE_TWELFTH_EM (200)
|
||||
#define KEYS_LIST_HEIGHT GTK_SIZE_ONE_TWELFTH_EM (175)
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
@@ -192,20 +192,20 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
|
||||
gtk_window_set_title (GTK_WINDOW (inputd), _("Input"));
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
/* main vbox */
|
||||
|
||||
private->main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (private->main_vbox), 5);
|
||||
private->main_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (private->main_vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (inputd)->vbox), private->main_vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
private->no_devices_label = gtk_label_new (_("No extended input devices"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (private->main_vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (private->main_vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (inputd)->vbox),
|
||||
private->no_devices_label,
|
||||
TRUE, TRUE, 0);
|
||||
@@ -214,7 +214,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
|
||||
|
||||
private->device_menu = gtk_menu_new ();
|
||||
|
||||
util_box = gtk_hbox_new (FALSE, 12);
|
||||
util_box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (private->main_vbox), util_box, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Device:"));
|
||||
@@ -279,7 +279,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
|
||||
label = gtk_label_new (_("Axes"));
|
||||
|
||||
inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (inputd->axis_listbox), 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (inputd->axis_listbox), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
@@ -297,7 +297,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
|
||||
label = gtk_label_new (_("Keys"));
|
||||
|
||||
inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (inputd->keys_listbox), 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (inputd->keys_listbox), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_widget_set_size_request (inputd->keys_listbox,
|
||||
KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (inputd->keys_listbox),
|
||||
@@ -543,8 +543,8 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
|
||||
gtk_widget_destroy (inputd->axis_list);
|
||||
}
|
||||
inputd->axis_list = gtk_table_new (GDK_AXIS_LAST, 2, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (inputd->axis_list), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (inputd->axis_list), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (inputd->axis_list), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (inputd->axis_list), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
viewport = gtk_viewport_new (NULL, NULL);
|
||||
old_child = gtk_bin_get_child (GTK_BIN (inputd->axis_listbox));
|
||||
@@ -567,7 +567,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
|
||||
label = gtk_label_new_with_mnemonic (_(axis_use_strings[i]));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (inputd->axis_list), label, 0, 1, i, i+1,
|
||||
GTK_FILL, 0, 2, 2);
|
||||
GTK_FILL, 0, GTK_SIZE_ONE_TWELFTH_EM (2), GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
|
||||
/* and the use option menu */
|
||||
menu = gtk_menu_new();
|
||||
@@ -594,7 +594,8 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info)
|
||||
inputd->axis_items[i] = option_menu = gtk_option_menu_new ();
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
|
||||
gtk_table_attach (GTK_TABLE (inputd->axis_list), option_menu,
|
||||
1, 2, i, i+1, GTK_EXPAND | GTK_FILL, 0, 2, 2);
|
||||
1, 2, i, i+1, GTK_EXPAND | GTK_FILL, 0,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (2), GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
|
||||
gtk_widget_show (option_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
@@ -698,8 +699,8 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info)
|
||||
}
|
||||
|
||||
inputd->keys_list = gtk_table_new (info->num_keys, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (inputd->keys_list), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (inputd->keys_list), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (inputd->keys_list), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (inputd->keys_list), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
viewport = gtk_viewport_new (NULL, NULL);
|
||||
old_child = gtk_bin_get_child (GTK_BIN (inputd->keys_listbox));
|
||||
@@ -726,14 +727,14 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info)
|
||||
g_snprintf (buffer, sizeof (buffer), "_%d:", i+1);
|
||||
label = gtk_label_new_with_mnemonic (buffer);
|
||||
gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1,
|
||||
GTK_FILL, 0, 2, 2);
|
||||
GTK_FILL, 0, GTK_SIZE_ONE_TWELFTH_EM (2), GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* the entry */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_attach (GTK_TABLE (inputd->keys_list), hbox, 1, 2, i, i+1,
|
||||
GTK_EXPAND | GTK_FILL, 0, 2, 2);
|
||||
GTK_EXPAND | GTK_FILL, 0, GTK_SIZE_ONE_TWELFTH_EM (2), GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
key->entry = gtk_entry_new ();
|
||||
|
||||
+16
-2
@@ -224,6 +224,7 @@ static void gtk_label_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *old_toplevel);
|
||||
static void gtk_label_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen);
|
||||
static void gtk_label_unit_changed (GtkWidget *widget);
|
||||
static gboolean gtk_label_popup_menu (GtkWidget *widget);
|
||||
|
||||
static void gtk_label_create_window (GtkLabel *label);
|
||||
@@ -357,6 +358,7 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
widget_class->mnemonic_activate = gtk_label_mnemonic_activate;
|
||||
widget_class->drag_data_get = gtk_label_drag_data_get;
|
||||
widget_class->grab_focus = gtk_label_grab_focus;
|
||||
widget_class->unit_changed = gtk_label_unit_changed;
|
||||
widget_class->popup_menu = gtk_label_popup_menu;
|
||||
widget_class->focus = gtk_label_focus;
|
||||
|
||||
@@ -1540,6 +1542,18 @@ label_shortcut_setting_changed (GtkSettings *settings)
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
|
||||
gtk_label_recalculate (label);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_label_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen)
|
||||
@@ -2931,7 +2945,7 @@ gtk_label_ensure_layout (GtkLabel *label)
|
||||
|
||||
aux_info = _gtk_widget_get_aux_info (widget, FALSE);
|
||||
if (aux_info && aux_info->width > 0)
|
||||
pango_layout_set_width (label->layout, aux_info->width * PANGO_SCALE);
|
||||
pango_layout_set_width (label->layout, gtk_widget_size_to_pixel (widget, aux_info->width) * PANGO_SCALE);
|
||||
else
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (label));
|
||||
@@ -3051,7 +3065,7 @@ gtk_label_size_request (GtkWidget *widget,
|
||||
if ((label->wrap || label->ellipsize ||
|
||||
priv->width_chars > 0 || priv->max_width_chars > 0) &&
|
||||
aux_info && aux_info->width > 0)
|
||||
width += aux_info->width;
|
||||
width += gtk_widget_size_to_pixel (widget, aux_info->width);
|
||||
else if (label->ellipsize || priv->width_chars > 0 || priv->max_width_chars > 0)
|
||||
{
|
||||
width += PANGO_PIXELS (get_label_char_width (label));
|
||||
|
||||
+6
-6
@@ -2465,15 +2465,15 @@ gtk_print (gchar *str)
|
||||
gtk_widget_show (box1);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 0, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
@@ -2498,8 +2498,8 @@ gtk_print (gchar *str)
|
||||
gtk_widget_show (separator);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
|
||||
+26
-31
@@ -588,40 +588,32 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-padding",
|
||||
P_("Vertical Padding"),
|
||||
P_("Extra space at the top and bottom of the menu"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("vertical-padding",
|
||||
P_("Vertical Padding"),
|
||||
P_("Extra space at the top and bottom of the menu"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (1),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("horizontal-padding",
|
||||
P_("Horizontal Padding"),
|
||||
P_("Extra space at the left and right edges of the menu"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("horizontal-padding",
|
||||
P_("Horizontal Padding"),
|
||||
P_("Extra space at the left and right edges of the menu"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-offset",
|
||||
P_("Vertical Offset"),
|
||||
P_("When the menu is a submenu, position it this number of pixels offset vertically"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("vertical-offset",
|
||||
P_("Vertical Offset"),
|
||||
P_("When the menu is a submenu, position it this number of pixels offset vertically"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("horizontal-offset",
|
||||
P_("Horizontal Offset"),
|
||||
P_("When the menu is a submenu, position it this number of pixels offset horizontally"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
-2,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("horizontal-offset",
|
||||
P_("Horizontal Offset"),
|
||||
P_("When the menu is a submenu, position it this number of pixels offset horizontally"),
|
||||
GTK_SIZE_MINPIXEL, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (-2),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boolean ("double-arrows",
|
||||
@@ -2000,7 +1992,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
|
||||
gtk_window_set_transient_for (GTK_WINDOW (menu->tearoff_window),
|
||||
GTK_WINDOW (toplevel));
|
||||
|
||||
menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE);
|
||||
menu->tearoff_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox);
|
||||
|
||||
gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
|
||||
@@ -2438,13 +2430,16 @@ gtk_menu_size_request (GtkWidget *widget,
|
||||
guint toggle_spacing;
|
||||
guint indicator_size;
|
||||
|
||||
gtk_style_get (widget->style,
|
||||
/* gtk_style_get() returns sizes in pixels with no consideration for
|
||||
the monitor the widget is displayed on */
|
||||
gtk_style_get_unit (widget->style,
|
||||
GTK_TYPE_CHECK_MENU_ITEM,
|
||||
"toggle-spacing", &toggle_spacing,
|
||||
"indicator-size", &indicator_size,
|
||||
NULL);
|
||||
|
||||
max_toggle_size = indicator_size + toggle_spacing;
|
||||
max_toggle_size = gtk_widget_size_to_pixel (widget, indicator_size) +
|
||||
gtk_widget_size_to_pixel (widget, toggle_spacing);
|
||||
}
|
||||
|
||||
for (i = 0; i < gtk_menu_get_n_rows (menu); i++)
|
||||
|
||||
+6
-8
@@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
#define BORDER_SPACING 0
|
||||
#define DEFAULT_IPADDING 1
|
||||
#define DEFAULT_IPADDING GTK_SIZE_ONE_TWELFTH_EM(1)
|
||||
|
||||
/* Properties */
|
||||
enum {
|
||||
@@ -198,13 +198,11 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("internal-padding",
|
||||
P_("Internal padding"),
|
||||
P_("Amount of border space between the menubar shadow and the menu items"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_IPADDING,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("internal-padding",
|
||||
P_("Internal padding"),
|
||||
P_("Amount of border space between the menubar shadow and the menu items"),
|
||||
0, G_MAXINT, DEFAULT_IPADDING,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_settings_install_property (g_param_spec_int ("gtk-menu-bar-popup-delay",
|
||||
P_("Delay before drop down menus appear"),
|
||||
|
||||
+15
-21
@@ -332,31 +332,25 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
gtk_rc_property_parse_enum);
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("horizontal-padding",
|
||||
"Horizontal Padding",
|
||||
"Padding to left and right of the menu item",
|
||||
0,
|
||||
G_MAXINT,
|
||||
3,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("horizontal-padding",
|
||||
"Horizontal Padding",
|
||||
"Padding to left and right of the menu item",
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (3),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("toggle-spacing",
|
||||
"Icon Spacing",
|
||||
"Space between icon and label",
|
||||
0,
|
||||
G_MAXINT,
|
||||
5,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("toggle-spacing",
|
||||
"Icon Spacing",
|
||||
"Space between icon and label",
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (5),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("arrow-spacing",
|
||||
"Arrow Spacing",
|
||||
"Space between label and arrow",
|
||||
0,
|
||||
G_MAXINT,
|
||||
10,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("arrow-spacing",
|
||||
"Arrow Spacing",
|
||||
"Space between label and arrow",
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (10),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_float ("arrow-scaling",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user