Exemple #1
0
/**
 * _gtk_size_group_compute_requisition:
 * @widget: a #GtkWidget
 * @requisition: location to store computed requisition.
 * 
 * Compute the requisition of a widget taking into account grouping of
 * the widget's requisition with other widgets.
 **/
void
_gtk_size_group_compute_requisition (GtkWidget      *widget,
				     GtkRequisition *requisition)
{
  gint width;
  gint height;

  initialize_size_group_quarks ();

  if (get_size_groups (widget))
    {
      /* Only do the full computation if we actually have size groups */
      
      width = compute_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL);
      height = compute_dimension (widget, GTK_SIZE_GROUP_VERTICAL);

      if (requisition)
	{
	  requisition->width = width;
	  requisition->height = height;
	}
    }
  else
    {
      do_size_request (widget);
      
      if (requisition)
	get_fast_child_requisition (widget, requisition);
    }
}
Exemple #2
0
RGEO_BEGIN_C


/**** INTERNAL UTILITY FUNCTIONS ****/


// Determine the dimension of the given geometry. Empty collections have dimension -1.
// Recursively checks collection elemenets.

static int compute_dimension(GEOSContextHandle_t context, const GEOSGeometry* geom)
{
  int result;
  int size;
  int i;
  int dim;

  result = -1;
  if (geom) {
    switch (GEOSGeomTypeId_r(context, geom)) {
    case GEOS_POINT:
      result = 0;
      break;
    case GEOS_MULTIPOINT:
      if (!GEOSisEmpty_r(context, geom)) {
        result = 0;
      }
      break;
    case GEOS_LINESTRING:
    case GEOS_LINEARRING:
      result = 1;
      break;
    case GEOS_MULTILINESTRING:
      if (!GEOSisEmpty_r(context, geom)) {
        result = 1;
      }
      break;
    case GEOS_POLYGON:
      result = 2;
      break;
    case GEOS_MULTIPOLYGON:
      if (!GEOSisEmpty_r(context, geom)) {
        result = 2;
      }
      break;
    case GEOS_GEOMETRYCOLLECTION:
      size = GEOSGetNumGeometries_r(context, geom);
      for (i=0; i<size; ++i) {
        dim = compute_dimension(context, GEOSGetGeometryN_r(context, geom, i));
        if (dim > result) {
          result = dim;
        }
      }
      break;
    }
  }
  return result;
}
Exemple #3
0
static VALUE method_geometry_dimension(VALUE self)
{
  VALUE result = Qnil;
  RGeo_GeometryData* self_data = RGEO_GEOMETRY_DATA_PTR(self);
  const GEOSGeometry* self_geom = self_data->geom;
  if (self_geom) {
    result = INT2NUM(compute_dimension(self_data->geos_context, self_geom));
  }
  return result;
}
Exemple #4
0
MxPropSlim::MxPropSlim(MxStdModel *m0)
: MxStdSlim(m0),
__quadrics(m0->vert_count()),
edge_links(m0->vert_count())
{
	consider_color();
	consider_texture();
	consider_normals();

	D = compute_dimension(m);

	will_decouple_quadrics = false;
	contraction_callback = NULL;
}
Exemple #5
0
/**
 * _gtk_size_group_bump_requisition:
 * @widget: a #GtkWidget
 * @mode: either %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_VERTICAL, depending
 *        on the dimension in which to bump the size.
 * @minimum: a pointer to the widget's minimum size
 * @natural: a pointer to the widget's natural size
 *
 * Refreshes the sizegroup while returning the groups requested
 * value in the dimension @mode.
 *
 * This function is used both to update sizegroup minimum and natural size 
 * information and widget minimum and natural sizes in multiple passes from 
 * the size request apis.
 */
void
_gtk_size_group_bump_requisition (GtkWidget        *widget,
				  GtkSizeGroupMode  mode,
				  gint             *minimum,
				  gint             *natural)
{
  if (!_gtk_widget_get_sizegroup_bumping (widget))
    {
      /* Avoid recursion here */
      _gtk_widget_set_sizegroup_bumping (widget, TRUE);

      if (_gtk_widget_get_sizegroups (widget))
	compute_dimension (widget, mode, minimum, natural);

      _gtk_widget_set_sizegroup_bumping (widget, FALSE);
    }
}
Exemple #6
0
void MxPropSlim::consider_normals(bool will)
{
	use_normals = will && (m->normal_binding() == MX_PERVERTEX);
	D = compute_dimension(m);
}
Exemple #7
0
void MxPropSlim::consider_texture(bool will)
{
	use_texture = will && (m->texcoord_binding() == MX_PERVERTEX);
	D = compute_dimension(m);
}
Exemple #8
0
void MxPropSlim::consider_color(bool will)
{
	use_color = will && (m->color_binding() == MX_PERVERTEX);
	D = compute_dimension(m);
}