summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+/gtk+-2.6.4-1.osso7/gtktable.c.diff
blob: 5f485da09b9988a213013a0ce5be1c758d90afab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--- gtk+-2.6.4/gtk/gtktable.c	2004-08-09 19:59:52.000000000 +0300
+++ gtk+-2.6.4/gtk/gtktable.c	2005-04-06 16:19:37.974765320 +0300
@@ -28,6 +28,7 @@
 #include "gtkalias.h"
 #include "gtktable.h"
 #include "gtkintl.h"
+#include "gtkbutton.h"
 
 enum
 {
@@ -507,6 +508,33 @@
   return GTK_WIDGET (table);
 }
 
+void osso_gtk_table_find_button_detail (GtkTable *table,
+					GtkTableChild *table_child)
+{
+  OssoGtkButtonAttachFlags attachflags = 0;
+  gboolean automatic_detail;
+
+  g_return_if_fail (GTK_IS_TABLE (table));
+  g_return_if_fail (table_child != NULL);
+  g_return_if_fail (GTK_IS_BUTTON (table_child->widget));
+
+  if (table_child->top_attach == 0)
+    attachflags |= OSSO_GTK_BUTTON_ATTACH_NORTH;
+
+  if (table_child->bottom_attach == table->nrows)
+    attachflags |= OSSO_GTK_BUTTON_ATTACH_SOUTH;
+
+  if (table_child->left_attach == 0)
+    attachflags |= OSSO_GTK_BUTTON_ATTACH_WEST;
+
+  if (table_child->right_attach == table->ncols)
+    attachflags |= OSSO_GTK_BUTTON_ATTACH_EAST;
+
+  g_object_get (G_OBJECT (table_child->widget), "automatic_detail", &automatic_detail, NULL);
+  if (automatic_detail == TRUE)
+    g_object_set (G_OBJECT (table_child->widget), "detail", osso_gtk_button_attach_details[attachflags], NULL);
+}
+
 void
 gtk_table_resize (GtkTable *table,
 		  guint     n_rows,
@@ -523,6 +551,18 @@
       n_cols != table->ncols)
     {
       GList *list;
+      guint recalc_column = -1;
+      guint recalc_row = -1;
+
+      if (n_rows > table->nrows)
+        recalc_row = table->nrows;
+      else
+        recalc_row = n_rows;
+
+      if (n_cols > table->ncols)
+        recalc_column = table->ncols;
+      else
+        recalc_column = n_cols;
       
       for (list = table->children; list; list = list->next)
 	{
@@ -577,6 +617,20 @@
 
 	  g_object_notify (G_OBJECT (table), "n_columns");
 	}
+
+      if ((recalc_column != -1) || (recalc_row != -1))
+	for (list = table->children; list; list = list->next)
+	{
+	  GtkTableChild *child;
+	  
+	  child = list->data;
+
+          if (GTK_IS_BUTTON (child->widget) &&
+               ((child->bottom_attach == recalc_row) ||
+               (child->right_attach == recalc_column)))
+
+	    osso_gtk_table_find_button_detail (table, child);
+	}
     }
 }
 
@@ -623,6 +677,10 @@
   table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
   table_child->yfill = (yoptions & GTK_FILL) != 0;
   table_child->ypadding = ypadding;
+
+
+  if (GTK_IS_BUTTON (table_child->widget))
+    osso_gtk_table_find_button_detail (table, table_child);
   
   table->children = g_list_prepend (table->children, table_child);