gtkprivate: #define OPPOSITE_ORIENTATION

and use it
This commit is contained in:
Benjamin Otte
2013-04-30 01:15:01 +02:00
parent ea98c61f3c
commit 6146bf7a32
4 changed files with 13 additions and 10 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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);

View File

@ -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