]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmisc.c
treeview: remove extra padding handling
[~andy/gtk] / gtk / gtkmisc.c
index ea5adc4ee046bd1218545598c53ca131f43b13a4..4bd162ccda0b4b5b3e538ffd33f6f406fe31ed51 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -399,7 +397,41 @@ gtk_misc_realize (GtkWidget *widget)
 
       window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
       gtk_widget_set_window (widget, window);
-      gdk_window_set_user_data (window, widget);
+      gtk_widget_register_window (widget, window);
       gdk_window_set_background_pattern (window, NULL);
     }
 }
+
+/* Semi-private function used by gtk widgets inheriting from
+ * GtkMisc that takes into account both css padding and border
+ * and the padding specified with the GtkMisc properties.
+ */
+void
+_gtk_misc_get_padding_and_border (GtkMisc   *misc,
+                                  GtkBorder *border)
+{
+  GtkStyleContext *context;
+  GtkStateFlags state;
+  GtkBorder tmp;
+  gint xpad, ypad;
+
+  g_return_if_fail (GTK_IS_MISC (misc));
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (misc));
+  state = gtk_widget_get_state_flags (GTK_WIDGET (misc));
+
+  gtk_style_context_get_padding (context, state, border);
+
+  gtk_misc_get_padding (misc, &xpad, &ypad);
+  border->top += ypad;
+  border->left += xpad;
+  border->bottom += ypad;
+  border->right += xpad;
+
+  gtk_style_context_get_border (context, state, &tmp);
+  border->top += tmp.top;
+  border->right += tmp.right;
+  border->bottom += tmp.bottom;
+  border->left += tmp.left;
+}
+