summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2013-04-30 01:15:01 +0200
committerBenjamin Otte <otte@redhat.com>2013-05-01 16:41:11 +0200
commit6146bf7a32bf4ed6061744c30893b84991abe6b7 (patch)
treeac1e45deb9ce388da323f3c2268a3bb2a99a97af /gtk
parentea98c61f3c90cdd3b5e34fa57e510e8ca4715f09 (diff)
downloadgtk+-6146bf7a32bf4ed6061744c30893b84991abe6b7.tar.gz
gtkprivate: #define OPPOSITE_ORIENTATION
and use it
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkbox.c5
-rw-r--r--gtk/gtkcellareabox.c4
-rw-r--r--gtk/gtkpaned.c12
-rw-r--r--gtk/gtkprivate.h2
4 files changed, 13 insertions, 10 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index f4e88eb379..e60fb4fa90 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -791,10 +791,7 @@ gtk_box_compute_expand (GtkWidget *widget,
gboolean opposite_expand;
GtkOrientation opposite_orientation;
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- opposite_orientation = GTK_ORIENTATION_VERTICAL;
- else
- opposite_orientation = GTK_ORIENTATION_HORIZONTAL;
+ opposite_orientation = OPPOSITE_ORIENTATION (private->orientation);
our_expand = FALSE;
opposite_expand = FALSE;
diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c
index aa05220ae1..94915e209c 100644
--- a/gtk/gtkcellareabox.c
+++ b/gtk/gtkcellareabox.c
@@ -239,10 +239,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkCellAreaBox, gtk_cell_area_box, GTK_TYPE_CELL_AREA,
gtk_cell_area_box_cell_layout_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL));
-#define OPPOSITE_ORIENTATION(orientation) \
- ((orientation) == GTK_ORIENTATION_HORIZONTAL ? \
- GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL)
-
static void
gtk_cell_area_box_init (GtkCellAreaBox *box)
{
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 77c79ee3d5..2f266a5335 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -927,7 +927,11 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget,
if (priv->child1 && gtk_widget_get_visible (priv->child1))
{
- _gtk_widget_get_preferred_size_for_size (priv->child1, 1 - priv->orientation, size, &child_min, &child_nat, NULL, NULL);
+ _gtk_widget_get_preferred_size_for_size (priv->child1,
+ OPPOSITE_ORIENTATION (priv->orientation),
+ size,
+ &child_min, &child_nat,
+ NULL, NULL);
*minimum = child_min;
*natural = child_nat;
@@ -935,7 +939,11 @@ gtk_paned_get_preferred_size_for_opposite_orientation (GtkWidget *widget,
if (priv->child2 && gtk_widget_get_visible (priv->child2))
{
- _gtk_widget_get_preferred_size_for_size (priv->child2, 1 - priv->orientation, size, &child_min, &child_nat, NULL, NULL);
+ _gtk_widget_get_preferred_size_for_size (priv->child2,
+ OPPOSITE_ORIENTATION (priv->orientation),
+ size,
+ &child_min, &child_nat,
+ NULL, NULL);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 093334f84c..a07f7292ba 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -37,6 +37,8 @@ G_BEGIN_DECLS
#define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
+#define OPPOSITE_ORIENTATION(_orientation) (1 - (_orientation))
+
#ifdef G_DISABLE_CAST_CHECKS
/* This is true for debug no and minimum */
#define gtk_internal_return_if_fail(__expr) G_STMT_START{ (void)0; }G_STMT_END