示例#1
0
static gboolean
gtk_css_matcher_widget_path_has_region (const GtkCssMatcher *matcher,
                                        const char          *region,
                                        GtkRegionFlags       flags)
{
  const GtkWidgetPath *siblings;
  GtkRegionFlags region_flags;
  
  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
  if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
    {
      if (!gtk_widget_path_iter_has_region (siblings, matcher->path.sibling_index, region, &region_flags))
        return FALSE;
    }
  else
    {
      if (!gtk_widget_path_iter_has_region (matcher->path.path, matcher->path.index, region, &region_flags))
        return FALSE;
    }

  if ((flags & region_flags) != flags)
    return FALSE;

  return TRUE;
}
示例#2
0
static VALUE
rg_iter_has_region(VALUE self, VALUE pos, VALUE name)
{
    GtkRegionFlags flags;
    gboolean result;

    result = gtk_widget_path_iter_has_region(_SELF(self), NUM2INT(pos), RVAL2CSTR(name), &flags);

    return result ? GTKREGIONFLAGS2RVAL(flags) : Qnil;
}
示例#3
0
static gboolean
gtk_css_matcher_widget_path_has_region (const GtkCssMatcher *matcher,
                                        const char          *region,
                                        GtkRegionFlags       flags)
{
  const GtkWidgetPath *siblings;
  GtkRegionFlags region_flags;
  
  if (matcher->path.decl)
    {
      GQuark q = g_quark_try_string (region);

      if (q && gtk_css_node_declaration_has_region (matcher->path.decl, q, &region_flags))
        goto found;
    }

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
  if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
    {
      if (!gtk_widget_path_iter_has_region (siblings, matcher->path.sibling_index, region, &region_flags))
        return FALSE;
    }
  else
    {
      if (!gtk_widget_path_iter_has_region (matcher->path.path, matcher->path.index, region, &region_flags))
        return FALSE;
    }
G_GNUC_END_IGNORE_DEPRECATIONS

found:
  if ((flags & region_flags) != flags)
    return FALSE;

  return TRUE;
}