Example #1
0
static void
flip (GtkButton *button)
{
    GSList *l;

    gtk_orientable_set_orientation (GTK_ORIENTABLE (flipbox), 1 - gtk_orientable_get_orientation (GTK_ORIENTABLE (flipbox)));

    for (l = scales; l; l = l->next)
    {
        GtkOrientable *o = l->data;
        gtk_orientable_set_orientation (o, 1 - gtk_orientable_get_orientation (o));
    }
}
Example #2
0
int
_gtk_paned_get_position2 (GtkPaned *paned)
{
	int             pos;
	GtkWidget      *w;
	GtkRequisition  requisition;
	int             size;

	if (! GTK_WIDGET_VISIBLE (paned))
		return 0;

	pos = gtk_paned_get_position (paned);
	if (pos == 0)
		return 0;

	w = gtk_widget_get_toplevel (GTK_WIDGET (paned));
	if (! GTK_WIDGET_TOPLEVEL (w))
		return 0;

	gtk_window_get_size (GTK_WINDOW (w), &(requisition.width), &(requisition.height));
	if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL)
		size = requisition.width;
	else
		size = requisition.height;

	if (size == 0)
		return 0;

	return size - pos;
}
Example #3
0
/**
 * gucharmap_charmap_get_orientation:
 * @charmap:
 *
 * Deprecated: 2.25.0
 */
GtkOrientation
gucharmap_charmap_get_orientation (GucharmapCharmap *charmap)
{
  g_return_val_if_fail (GUCHARMAP_IS_CHARMAP (charmap), GTK_ORIENTATION_HORIZONTAL);

  return gtk_orientable_get_orientation (GTK_ORIENTABLE (charmap));
}
Example #4
0
cpufreq_applet_size_request (GtkWidget *widget, GtkRequisition *requisition)
#endif
{
	CPUFreqApplet *applet;
	gint           labels_width = 0;
	gint           width;

	applet = CPUFREQ_APPLET (widget);

#if !GTK_CHECK_VERSION (3, 0, 0)
	GTK_WIDGET_CLASS (cpufreq_applet_parent_class)->size_request (widget, requisition);
#endif

	if (applet->orient == MATE_PANEL_APPLET_ORIENT_LEFT ||
	    applet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT)
		return;


 	if (applet->show_freq) {
		labels_width += cpufreq_applet_get_max_label_width (applet) + 2;
 	}
 
 	if (applet->show_perc) {
		labels_width += cpufreq_applet_get_max_perc_width (applet);
 	}
 
 	if (applet->show_unit) {
		labels_width += cpufreq_applet_get_max_unit_width (applet);
	}

	if (applet->show_icon) {
#if GTK_CHECK_VERSION (3, 0, 0)
		gint icon_width;

		gtk_widget_get_preferred_width (applet->icon, &icon_width, NULL);
		width = gtk_orientable_get_orientation (GTK_ORIENTABLE (applet->box)) == GTK_ORIENTATION_HORIZONTAL ?
			labels_width + icon_width + 2 :
			MAX (labels_width, icon_width + 2);
#else
		GtkRequisition req;

		gtk_widget_size_request (applet->icon, &req);
		width = GTK_IS_HBOX (applet->box) ?
			labels_width + req.width + 2 :
			MAX (labels_width, req.width + 2);
#endif
	} else {
		width = labels_width;
	}

#if GTK_CHECK_VERSION (3, 0, 0)
	*minimum_width = *natural_width = width;
#else
	requisition->width = width;
#endif
}
/* This function is the default implementation for the notify_gtk
 * vfunc which gets called when a property changes value on the
 * GtkWidget associated with a GtkWidgetAccessible. It constructs
 * an AtkPropertyValues structure and emits a "property_changed"
 * signal which causes the user specified AtkPropertyChangeHandler
 * to be called.
 */
static void
gtk_widget_accessible_notify_gtk (GObject    *obj,
                                  GParamSpec *pspec)
{
  GtkWidget* widget = GTK_WIDGET (obj);
  AtkObject* atk_obj = gtk_widget_get_accessible (widget);
  AtkState state;
  gboolean value;

  if (g_strcmp0 (pspec->name, "has-focus") == 0)
    /*
     * We use focus-in-event and focus-out-event signals to catch
     * focus changes so we ignore this.
     */
    return;
  else if (g_strcmp0 (pspec->name, "tooltip-text") == 0)
    {
      gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (atk_obj),
                                            widget);
      return;
    }
  else if (g_strcmp0 (pspec->name, "visible") == 0)
    {
      state = ATK_STATE_VISIBLE;
      value = gtk_widget_get_visible (widget);
    }
  else if (g_strcmp0 (pspec->name, "sensitive") == 0)
    {
      state = ATK_STATE_SENSITIVE;
      value = gtk_widget_get_sensitive (widget);
    }
  else if (g_strcmp0 (pspec->name, "orientation") == 0 &&
           GTK_IS_ORIENTABLE (widget))
    {
      GtkOrientable *orientable;

      orientable = GTK_ORIENTABLE (widget);

      state = ATK_STATE_HORIZONTAL;
      value = (gtk_orientable_get_orientation (orientable) == GTK_ORIENTATION_HORIZONTAL);
    }
  else
    return;

  atk_object_notify_state_change (atk_obj, state, value);
  if (state == ATK_STATE_SENSITIVE)
    atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED, value);

  if (state == ATK_STATE_HORIZONTAL)
    atk_object_notify_state_change (atk_obj, ATK_STATE_VERTICAL, !value);
}
Example #6
0
static int orientation_member(lua_State *L)
{
  lua_box box;
  luaA_to(L,lua_box,&box,1);
  dt_lua_orientation_t orientation;
  if(lua_gettop(L) > 2) {
    luaA_to(L,dt_lua_orientation_t,&orientation,3);
    gtk_orientable_set_orientation(GTK_ORIENTABLE(box->widget),orientation);
    return 0;
  }
  orientation = gtk_orientable_get_orientation(GTK_ORIENTABLE(box->widget));
  luaA_push(L,dt_lua_orientation_t,&orientation);
  return 1;
}
Example #7
0
/* test that g_object_new keeps the provided area */
static void
test_iconview_object_new (void)
{
    GtkWidget *view;
    GtkCellArea *area;

    area = gtk_cell_area_box_new ();
    gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
    view = g_object_new (GTK_TYPE_ICON_VIEW, "cell-area", area, NULL);
    g_assert (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)) == area);
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));

    g_object_ref_sink (view);
    g_object_unref (view);
}
Example #8
0
/* test that we have a cell area after new() */
static void
test_iconview_new (void)
{
    GtkWidget *view;
    GtkCellArea *area;

    view = gtk_icon_view_new ();

    area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
    g_assert (GTK_IS_CELL_AREA_BOX (area));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == gtk_icon_view_get_item_orientation (GTK_ICON_VIEW (view)));

    g_object_ref_sink (view);
    g_object_unref (view);
}
Example #9
0
/* test we can access the area in subclass init */
static void
test_completion_subclass2 (void)
{
    GtkEntryCompletion *c;
    GtkCellArea *area;

    subclass_init = 1;

    c = g_object_new (my_entry_completion_get_type (), NULL);
    area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c));
    g_assert (GTK_IS_CELL_AREA_BOX (area));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);

    g_object_ref_sink (c);
    g_object_unref (c);
}
Example #10
0
/* test that a completion subclass keeps the provided area */
static void
test_completion_subclass1 (void)
{
    GtkEntryCompletion *c;
    GtkCellArea *area;

    subclass_init = 0;

    area = gtk_cell_area_box_new ();
    c = g_object_new (my_entry_completion_get_type (), "cell-area", area, NULL);
    g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);

    g_object_ref_sink (c);
    g_object_unref (c);
}
Example #11
0
/* test we can access the area in subclass init */
static void
test_column_subclass2 (void)
{
    GtkTreeViewColumn *col;
    GtkCellArea *area;

    subclass_init = 1;

    col = g_object_new (my_tree_view_column_get_type (), NULL);
    area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col));
    g_assert (GTK_IS_CELL_AREA_BOX (area));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);

    g_object_ref_sink (col);
    g_object_unref (col);
}
Example #12
0
/* test that a column subclass keeps the provided area */
static void
test_column_subclass1 (void)
{
    GtkTreeViewColumn *col;
    GtkCellArea *area;

    subclass_init = 0;

    area = gtk_cell_area_box_new ();
    col = g_object_new (my_tree_view_column_get_type (), "cell-area", area, NULL);
    g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);

    g_object_ref_sink (col);
    g_object_unref (col);
}
Example #13
0
/* test we can access the area in subclass init */
static void
test_cellview_subclass2 (void)
{
    GtkWidget *view;
    GtkCellArea *area;

    subclass_init = 1;

    view = g_object_new (my_cell_view_get_type (), NULL);
    area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
    g_assert (GTK_IS_CELL_AREA_BOX (area));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);

    g_object_ref_sink (view);
    g_object_unref (view);
}
Example #14
0
/* test that a cellview subclass keeps the provided area */
static void
test_cellview_subclass1 (void)
{
    GtkWidget *view;
    GtkCellArea *area;

    subclass_init = 0;

    area = gtk_cell_area_box_new ();
    view = g_object_new (my_cell_view_get_type (), "cell-area", area, NULL);
    g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view)));
    g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_HORIZONTAL);

    g_object_ref_sink (view);
    g_object_unref (view);
}
Example #15
0
static void
my_icon_view_init (MyIconView *view)
{
    GtkCellArea *area;

    if (subclass_init == 0)
    {
        /* do nothing to area */
    }
    else if (subclass_init == 1)
    {
        area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (view));
        g_assert (GTK_IS_CELL_AREA_BOX (area));
        g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);
        gtk_orientable_set_orientation (GTK_ORIENTABLE (area), GTK_ORIENTATION_HORIZONTAL);
    }
}
Example #16
0
void
_gtk_paned_set_position2 (GtkPaned *paned,
			  int       pos)
{
	GtkWidget *top_level;
	int        size;

	top_level = gtk_widget_get_toplevel (GTK_WIDGET (paned));
	if (! GTK_WIDGET_TOPLEVEL (top_level))
		return;

	if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL)
		size = top_level->allocation.width;
	else
		size = top_level->allocation.height;

	if (pos > 0)
		gtk_paned_set_position (paned, size - pos);
}
static void
brasero_file_chooser_find_pane (GtkWidget *child,
				gpointer footer)
{
	if (GTK_IS_PANED (child)) {
		GList *children_vbox;
		GList *iter_vbox;
		GtkWidget *vbox;

		vbox = gtk_paned_get_child2 (GTK_PANED (child));
		children_vbox = gtk_container_get_children (GTK_CONTAINER (vbox));
		for (iter_vbox = children_vbox; iter_vbox; iter_vbox = iter_vbox->next) {
			if (GTK_IS_BOX (iter_vbox->data) &&
                            gtk_orientable_get_orientation (GTK_ORIENTABLE (iter_vbox->data)) == GTK_ORIENTATION_HORIZONTAL) {
				GtkPackType packing;

				gtk_box_query_child_packing (GTK_BOX (vbox),
							     GTK_WIDGET (iter_vbox->data),
							     NULL,
							     NULL,
							     NULL,
							     &packing);

				if (packing == GTK_PACK_START) {
					GtkRequisition total_request, footer_request;

					gtk_widget_get_preferred_size (GTK_WIDGET (vbox),
								 &total_request, NULL);
					gtk_widget_get_preferred_size (GTK_WIDGET (iter_vbox->data),
								 &footer_request, NULL);
					*((gint *) footer) = total_request.height - footer_request.height;
					break;
				}
			}
		}
		g_list_free (children_vbox);
	}
	else if (GTK_IS_CONTAINER (child)) {
		gtk_container_foreach (GTK_CONTAINER (child),
				       brasero_file_chooser_find_pane,
				       footer);
	}
}
Example #18
0
/* panel_window_get_orientation */
GtkOrientation panel_window_get_orientation(PanelWindow * panel)
{
#if GTK_CHECK_VERSION(2, 16, 0)
	if(panel->box != NULL)
		return gtk_orientable_get_orientation(GTK_ORIENTABLE(
					panel->box));
#endif
	switch(panel->position)
	{
		case PANEL_WINDOW_POSITION_LEFT:
		case PANEL_WINDOW_POSITION_RIGHT:
			return GTK_ORIENTATION_VERTICAL;
		case PANEL_WINDOW_POSITION_BOTTOM:
		case PANEL_WINDOW_POSITION_CENTER:
		case PANEL_WINDOW_POSITION_FLOATING:
		case PANEL_WINDOW_POSITION_MANAGED:
		case PANEL_WINDOW_POSITION_TOP:
		default:
			return GTK_ORIENTATION_HORIZONTAL;
	}
}
Example #19
0
static void
cpufreq_applet_get_preferred_width (GtkWidget *widget,
                                    gint      *minimum_width,
                                    gint      *natural_width)
{
        CPUFreqApplet *applet;
        gint           labels_width = 0;
        gint           width;

        applet = CPUFREQ_APPLET (widget);

        if (applet->orient == PANEL_APPLET_ORIENT_LEFT ||
            applet->orient == PANEL_APPLET_ORIENT_RIGHT)
                return;

        if (applet->show_freq) {
		labels_width += cpufreq_applet_get_max_label_width (applet) + 2;
	}

	if (applet->show_perc) {
		labels_width += cpufreq_applet_get_max_perc_width (applet);
	}

	if (applet->show_unit) {
		labels_width += cpufreq_applet_get_max_unit_width (applet);
	}

	if (applet->show_icon) {
		gint icon_width;

                gtk_widget_get_preferred_width (applet->icon, &icon_width, NULL);
		width = gtk_orientable_get_orientation (GTK_ORIENTABLE (applet->box)) == GTK_ORIENTATION_HORIZONTAL ?
			labels_width + icon_width + 2 :
			MAX (labels_width, icon_width + 2);
	} else {
		width = labels_width;
	}

        *minimum_width = *natural_width = width;
}
Example #20
0
/* test we get a warning if an area is provided, but ignored */
static void
test_completion_subclass3 (void)
{
    subclass_init = 1;

    if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
    {
        GtkEntryCompletion *c;
        GtkCellArea *area;

        area = gtk_cell_area_box_new ();
        c = g_object_new (my_entry_completion_get_type (), "cell-area", area, NULL);
        g_assert (area == gtk_cell_layout_get_area (GTK_CELL_LAYOUT (c)));
        g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (area)) == GTK_ORIENTATION_VERTICAL);

        g_object_ref_sink (c);
        g_object_unref (c);

        exit (0);
    }
    g_test_trap_assert_failed ();
    g_test_trap_assert_stderr ("*ignoring construct property*");
}
Example #21
0
static void
gth_auto_paned_size_allocate (GtkWidget     *widget,
			 GtkAllocation *allocation)
{
	GthAutoPaned  *self = GTH_AUTO_PANED (widget);
	GtkWidget *child1;
	GtkWidget *child2;
	gboolean   reset_position;

	child1 = gtk_paned_get_child1 (GTK_PANED (self));
	child2 = gtk_paned_get_child2 (GTK_PANED (self));

	reset_position = FALSE;
	if ((self->priv->child1_visible != _gtk_widget_get_visible (child1))
	    || (self->priv->child2_visible != _gtk_widget_get_visible (child2)))
	{
		reset_position = TRUE;
		self->priv->child1_visible = _gtk_widget_get_visible (child1);
		self->priv->child2_visible = _gtk_widget_get_visible (child2);
	}

	if (reset_position) {
		int position;

		switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (self))) {
		case GTK_ORIENTATION_HORIZONTAL:
			position = allocation->width / 2;
			break;
		case GTK_ORIENTATION_VERTICAL:
			position = allocation->height / 2;
			break;
		}
		gtk_paned_set_position (GTK_PANED (self), position);
	}

	GTK_WIDGET_CLASS (gth_auto_paned_parent_class)->size_allocate (widget, allocation);
}
Example #22
0
static gboolean
glade_gtk_box_configure_child (GladeFixed * fixed,
                               GladeWidget * child,
                               GdkRectangle * rect, GtkWidget * box)
{
  GList *list, *children;
  GtkWidget *bchild;
  GtkAllocation allocation, bchild_allocation;
  gint point, trans_point, span,
      iter_span, position, old_position, offset, orig_offset;
  gboolean found = FALSE;

  gtk_widget_get_allocation (GTK_WIDGET (glade_widget_get_object (child)), &allocation);

  if (gtk_orientable_get_orientation (GTK_ORIENTABLE (box)) == GTK_ORIENTATION_HORIZONTAL)
    {
      point = fixed->mouse_x;
      span = allocation.width;
      offset = rect->x;
      orig_offset = fixed->child_x_origin;
    }
  else
    {
      point = fixed->mouse_y;
      span = allocation.height;
      offset = rect->y;
      orig_offset = fixed->child_y_origin;
    }

  glade_widget_pack_property_get (child, "position", &old_position);

  children = gtk_container_get_children (GTK_CONTAINER (box));

  for (list = children; list; list = list->next)
    {
      bchild = list->data;

      if (bchild == GTK_WIDGET (glade_widget_get_object (child)))
        continue;

      /* Find the widget in the box where the center of
       * this rectangle fits... and set the position to that
       * position.
       */

      gtk_widget_get_allocation (GTK_WIDGET (bchild), &bchild_allocation);
      if (gtk_orientable_get_orientation (GTK_ORIENTABLE (box)) == GTK_ORIENTATION_HORIZONTAL)
        {
          gtk_widget_translate_coordinates
              (GTK_WIDGET (box), bchild, point, 0, &trans_point, NULL);

          iter_span = bchild_allocation.width;
        }
      else
        {
          gtk_widget_translate_coordinates
              (GTK_WIDGET (box), bchild, 0, point, NULL, &trans_point);
          iter_span = bchild_allocation.height;
        }

#if 0
      gtk_container_child_get (GTK_CONTAINER (box),
                               bchild, "position", &position, NULL);
      g_print ("widget: %p pos %d, point %d, trans_point %d, iter_span %d\n",
               bchild, position, point, trans_point, iter_span);
#endif

      if (iter_span <= span)
        {
          found = trans_point >= 0 && trans_point < iter_span;
        }
      else
        {
          if (offset > orig_offset)
            found = trans_point >= iter_span - span && trans_point < iter_span;
          else if (offset < orig_offset)
            found = trans_point >= 0 && trans_point < span;
        }

      if (found)
        {
          gtk_container_child_get (GTK_CONTAINER (box),
                                   bchild, "position", &position, NULL);

#if 0
          g_print ("setting position of %s from %d to %d, "
                   "(point %d iter_span %d)\n",
                   glade_widget_get_name (child), old_position, position, trans_point, iter_span);
#endif

          glade_widget_pack_property_set (child, "position", position);

          break;
        }

    }

  g_list_free (children);

  return TRUE;
}
static void
task_manager_dalog_disp_preview (TaskManagerDialog *dialog) 
{
  gint height;
  gint width;
  gint data_length;

  gint win_x,win_y,win_width,win_height;
  GtkAllocation allocation;
  GList * iter = NULL;
  gint win_count = 0;
  int i = 0;
  TaskManagerDialogPrivate * priv = GET_PRIVATE (dialog);
  GtkPositionType pos_type = awn_applet_get_pos_type (priv->applet);
  GtkOrientation current_orientation;
  gdouble scale;
  glong total_width = 0;
  glong screen_width = gdk_screen_get_width (gdk_screen_get_default ());
  glong screen_height = gdk_screen_get_height (gdk_screen_get_default ());
  
  
  current_orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (priv->items_box));
  if ( (current_orientation == GTK_ORIENTATION_VERTICAL) &&
      (( pos_type == GTK_POS_BOTTOM) || (pos_type == GTK_POS_TOP)) )
  {
    gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->items_box),GTK_ORIENTATION_HORIZONTAL);
  }
  else if ( (current_orientation == GTK_ORIENTATION_HORIZONTAL)&&
      (( pos_type == GTK_POS_LEFT) || (pos_type == GTK_POS_RIGHT)) )
  {
    gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->items_box),GTK_ORIENTATION_VERTICAL);
  }
  for (iter = g_list_first(priv->children); iter; iter=iter->next)
  {
    if (TASK_IS_WINDOW(iter->data))
    {
      win_count++;
    }
  }
  if (priv->data)
  {
    g_free (priv->data);
  }
  data_length =  win_count*6 +1;
  priv->data = g_new0 (long, data_length);
  priv->data[0] = (long) win_count;
  scale = priv->dialog_scale;

scaled_down:
  total_width = 0;
  if (screen_width && screen_height)
  {
    for (iter = g_list_first(priv->children); iter; iter=iter->next)
    {
      if (TASK_IS_WINDOW(iter->data))
      {
        wnck_window_get_geometry (task_window_get_window (iter->data),
                                  &win_x,
                                  &win_y,
                                  &win_width,
                                  &win_height);

        gtk_widget_get_allocation (GTK_WIDGET(iter->data), &allocation);
        if ((pos_type == GTK_POS_TOP) || (pos_type == GTK_POS_BOTTOM))
        {
          /*conditional operator alert*/
          height = gdk_screen_height () / (win_count?1.0/scale:1.0/scale+(win_count-2));

          width = ((float)win_width) / ((float)win_height) * height;
          total_width = total_width + width;
          if (total_width > screen_width * 0.9)
          {
            scale = scale * 0.9;
            goto scaled_down;
          }
        }
        else
        {
          /*conditional operator alert*/
          width = gdk_screen_width () / (win_count<4?1.0/scale+1:1.0/scale+1+(win_count-3));
          height = ((float)win_height) / ((float)win_width) * width;
          total_width = total_width + height;
          if (total_width > screen_height * 0.9)
          {
            scale = scale * 0.9;
            goto scaled_down;
          }
        }
      }
    }
  }
  
  for (iter = g_list_first(priv->children); iter; iter=iter->next)
  {
    if (TASK_IS_WINDOW(iter->data))
    {
      wnck_window_get_geometry (task_window_get_window (iter->data),
                                &win_x,
                                &win_y,
                                &win_width,
                                &win_height);

      gtk_widget_get_allocation (GTK_WIDGET(iter->data), &allocation);
      gtk_widget_set_tooltip_text (GTK_WIDGET (iter->data),
                                   task_window_get_name(TASK_WINDOW(iter->data)));
      /* Change these calculations. Ultimately we can be much smarter about
       layout.  After a certain point it will involve adding some more
       containers in our container....*/
      if ((pos_type == GTK_POS_TOP) || (pos_type == GTK_POS_BOTTOM))
      {
        /*conditional operator alert*/
        height = gdk_screen_height () / (win_count?1.0/scale:1.0/scale+(win_count-2));

        width = ((float)win_width) / ((float)win_height) * height;
        gtk_widget_set_size_request (GTK_WIDGET(iter->data), width, height);
      }
      else
      {
        /*conditional operator alert*/
        width = gdk_screen_width () / (win_count<4?1.0/scale+1:1.0/scale+1+(win_count-3));
        height = ((float)win_height) / ((float)win_width) * width;
        gtk_widget_set_size_request (GTK_WIDGET(iter->data), width, height);
      }      	
	    priv->data[i*6+1] = (long) 5;
	    priv->data[i*6+2] = (long) task_window_get_xid (TASK_WINDOW(iter->data));
	    priv->data[i*6+3] = (long) allocation.x+4;
	    priv->data[i*6+4] = (long) allocation.y+4;
	    priv->data[i*6+5] = (long) width-8;
	    priv->data[i*6+6] = (long) height-8;
      i++;
    }
  }

	gdk_property_change ((GTK_WIDGET(dialog))->window, 
					priv->kde_a,
 					priv->kde_a,
					32, 
					GDK_PROP_MODE_REPLACE, 
					(guchar*) priv->data,
					data_length);
}
Example #24
0
static AtkStateSet *
gtk_widget_accessible_ref_state_set (AtkObject *accessible)
{
  GtkWidget *widget;
  AtkStateSet *state_set;

  state_set = ATK_OBJECT_CLASS (_gtk_widget_accessible_parent_class)->ref_state_set (accessible);

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
  if (widget == NULL)
    atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
  else
    {
      if (gtk_widget_is_sensitive (widget))
        {
          atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
          atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
        }
  
      if (gtk_widget_get_can_focus (widget))
        {
          atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
        }
      /*
       * We do not currently generate notifications when an ATK object
       * corresponding to a GtkWidget changes visibility by being scrolled
       * on or off the screen.  The testcase for this is the main window
       * of the testgtk application in which a set of buttons in a GtkVBox
       * is in a scrolled window with a viewport.
       *
       * To generate the notifications we would need to do the following:
       * 1) Find the GtkViewport among the ancestors of the objects
       * 2) Create an accessible for the viewport
       * 3) Connect to the value-changed signal on the viewport
       * 4) When the signal is received we need to traverse the children
       *    of the viewport and check whether the children are visible or not
       *    visible; we may want to restrict this to the widgets for which
       *    accessible objects have been created.
       * 5) We probably need to store a variable on_screen in the
       *    GtkWidgetAccessible data structure so we can determine whether
       *    the value has changed.
       */
      if (gtk_widget_get_visible (widget))
        {
          atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
          if (gtk_widget_accessible_on_screen (widget) &&
              gtk_widget_get_mapped (widget) &&
              gtk_widget_accessible_all_parents_visible (widget))
            atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
        }

      if (gtk_widget_has_focus (widget) && (widget == _focus_widget))
        {
          AtkObject *focus_obj;

          focus_obj = g_object_get_data (G_OBJECT (accessible), "gail-focus-object");
          if (focus_obj == NULL)
            atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
        }

      if (gtk_widget_has_default (widget))
        atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);

      if (GTK_IS_ORIENTABLE (widget))
        {
          if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
            atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
          else
            atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
        }
    }
  return state_set;
}