Beispiel #1
0
/**
 * gtk_ellipsis_set_expanded:
 * @ellipsis: a #GtkEllipsis
 * @expanded: whether the child widget is revealed
 *
 * Sets the state of the ellipsis. Set to %TRUE, if you want
 * the child widget to be revealed, and %FALSE if you want the
 * child widget to be hidden.
 *
 * Since: 2.4
 **/
void
gtk_ellipsis_set_expanded (GtkEllipsis *ellipsis,
			   gboolean     expanded)
{
  GtkEllipsisPrivate *priv;

  g_return_if_fail (GTK_IS_ELLIPSIS (ellipsis));

  priv = ellipsis->priv;

  expanded = expanded != FALSE;

  if (priv->expanded != expanded)
    {
      GtkWidget *child = GTK_BIN (ellipsis)->child;
      priv->expanded = expanded;

      if (child)
	{
          if (!expanded && GTK_WIDGET_MAPPED (child))
	    gtk_widget_unmap (child);
          if (expanded && GTK_WIDGET_MAPPED (priv->label))
	    {
              if (GTK_WIDGET_REALIZED (ellipsis))
	        gdk_window_hide (priv->event_window);
	      gtk_widget_unmap (priv->ellipsis_label);
	      gtk_widget_unmap (priv->label);
	    }

          if (GTK_WIDGET_MAPPED (ellipsis))
	    {
	      if (expanded && GTK_WIDGET_VISIBLE (child))
		gtk_widget_map (child);
	      if (!expanded && GTK_WIDGET_VISIBLE (priv->label))
		{
		  gtk_widget_map (priv->label);
		  gtk_widget_map (priv->ellipsis_label);
                  if (GTK_WIDGET_REALIZED (ellipsis))
		    gdk_window_show (priv->event_window);
		}
	    }

	  gtk_widget_queue_resize (GTK_WIDGET (ellipsis));
	}

      g_object_notify (G_OBJECT (ellipsis), "expanded");
    }
}
Beispiel #2
0
static void
menu_item_style_set (GtkImage *image,
		     gpointer  data)
{
	GtkWidget   *widget;
	GdkPixbuf   *pixbuf;
	GtkIconSize  icon_size = (GtkIconSize) GPOINTER_TO_INT (data);
	int          icon_height;
	gboolean     is_mapped;

	if (!gtk_icon_size_lookup (icon_size, NULL, &icon_height))
		return;

	pixbuf = gtk_image_get_pixbuf (image);
	if (!pixbuf)
		return;

	if (gdk_pixbuf_get_height (pixbuf) == icon_height)
		return;

	widget = GTK_WIDGET (image);

	is_mapped = gtk_widget_get_mapped (widget);
	if (is_mapped)
		gtk_widget_unmap (widget);

	gtk_image_set_from_pixbuf (image, NULL);

	if (is_mapped)
		gtk_widget_map (widget);
}
Beispiel #3
0
/**
 * mate_druid_set_page:
 * @druid: A #MateDruid widget.
 * @page: The #MateDruidPage to be brought to the foreground.
 *
 * Description: This will make @page the currently showing page in the druid.
 * @page must already be in the druid.
 **/
void
mate_druid_set_page (MateDruid *druid,
		      MateDruidPage *page)
{
	GList *list;
	GtkWidget *old = NULL;
	g_return_if_fail (druid != NULL);
	g_return_if_fail (MATE_IS_DRUID (druid));
	g_return_if_fail (page != NULL);
	g_return_if_fail (MATE_IS_DRUID_PAGE (page));

	if (druid->_priv->current == page)
	     return;
	list = g_list_find (druid->_priv->children, page);
	g_return_if_fail (list != NULL);

	if ((druid->_priv->current) && (GTK_WIDGET_VISIBLE (druid->_priv->current)) && (GTK_WIDGET_MAPPED (druid))) {
		old = GTK_WIDGET (druid->_priv->current);
	}
	druid->_priv->current = MATE_DRUID_PAGE (list->data);
	mate_druid_page_prepare (druid->_priv->current);
	if (GTK_WIDGET_VISIBLE (druid->_priv->current) && (GTK_WIDGET_MAPPED (druid))) {
		gtk_widget_map (GTK_WIDGET (druid->_priv->current));
		gtk_widget_set_sensitive (GTK_WIDGET (druid->_priv->current), TRUE);
	}
	if (old && GTK_WIDGET_MAPPED (old)) {
		gtk_widget_unmap (old);
		gtk_widget_set_sensitive (old, FALSE);
	}
}
Beispiel #4
0
static void
gtk_ellipsis_unmap (GtkWidget *widget)
{
  GtkEllipsisPrivate *priv = GTK_ELLIPSIS (widget)->priv;

  if (priv->event_window)
    gdk_window_hide (priv->event_window);

  GTK_WIDGET_CLASS (gtk_ellipsis_parent_class)->unmap (widget);

  if (priv->label && GTK_WIDGET_MAPPED (priv->label))
    {
      gtk_widget_unmap (priv->ellipsis_label);
      gtk_widget_unmap (priv->label);
    }
}
void
_cinnamon_embedded_window_unrealize (CinnamonEmbeddedWindow *window)
{
  g_return_if_fail (CINNAMON_IS_EMBEDDED_WINDOW (window));

  gtk_widget_unmap (GTK_WIDGET (window));
}
void
_shell_embedded_window_unrealize (ShellEmbeddedWindow *window)
{
  g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));

  gtk_widget_unmap (GTK_WIDGET (window));
}
Beispiel #7
0
static void
gtk_pizza_position_child (GtkPizza      *pizza,
                          GtkPizzaChild *child)
{
    gint x;
    gint y;

    x = child->x - pizza->xoffset;
    y = child->y - pizza->yoffset;

    if (IS_ONSCREEN (x,y))
    {
        if (GTK_WIDGET_MAPPED (pizza) &&
          GTK_WIDGET_VISIBLE (child->widget))
        {
            if (!GTK_WIDGET_MAPPED (child->widget))
                gtk_widget_map (child->widget);
        }

        if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
            GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
    }
    else
    {
        if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
            GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);

        if (GTK_WIDGET_MAPPED (child->widget))
            gtk_widget_unmap (child->widget);
    }
}
Beispiel #8
0
/* The window is being destroyed. */
static void
vga_unrealize(GtkWidget *widget)
{
	VGAText * vga;

#ifdef VGA_DEBUG
	fprintf(stderr, "vga_unrealize()\n");
#endif

	g_return_if_fail(widget != NULL);
	g_return_if_fail(VGA_IS_TEXT(widget));
	vga = VGA_TEXT(widget);

	if (GTK_WIDGET_MAPPED(widget))
	{
		gtk_widget_unmap(widget);
	}

	/* Remove the GDK Window */
	if (widget->window != NULL)
	{
		gdk_window_destroy(widget->window);
		widget->window = NULL;
	}
	
	/* Mark that we no longer have a GDK window */
	GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
}
Beispiel #9
0
static void zbar_gtk_unrealize (GtkWidget *widget)
{
    if(GTK_WIDGET_MAPPED(widget))
        gtk_widget_unmap(widget);

    ZBarGtk *self = ZBAR_GTK(widget);
    if(!self->_private)
        return;
    ZBarGtkPrivate *zbar = ZBAR_GTK_PRIVATE(self->_private);

    if(zbar->video_enabled) {
        zbar->video_enabled = FALSE;
        GValue *msg = zbar_gtk_new_value(G_TYPE_INT);
        g_value_set_int(msg, 0);
        g_async_queue_push(zbar->queue, msg);
    }

    zbar_window_attach(zbar->window, NULL, 0);

    GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);

    gdk_window_set_user_data(widget->window, NULL);
    gdk_window_destroy(widget->window);
    widget->window = NULL;
}
int
main (int argc, char **argv)
{
        gchar *new_default_files[1] = {NULL};
	GtkSettings *settings;
	gint i;
	gtk_init (&argc, &argv);
        
        /* we get a gtkrc from GTK2_RC_FILES, remove the users theme ... */
        settings = gtk_settings_get_default ();
        g_object_set (settings, "gtk-theme-name", "Raleigh", NULL);
        
	create_testwidgets ();

	window = gtk_window_new (GTK_WINDOW_POPUP);
	box = gtk_vbox_new (FALSE, 0);
	
	gtk_container_add ((GtkContainer*)window, box);
	
	for (i = 0; i < WIDGET_COUNT; i++) {
		if (widgets[i] && !widgets[i]->parent)
			gtk_box_pack_end (GTK_BOX (box), widgets[i], FALSE, FALSE, 0);
	}

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);
	
	gtk_widget_show_all (window);
	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);
	
	for (i = 0; i < G_N_ELEMENTS (tests); i++)
		run_test (i);
	
	/* remove the rc file again. This should cause an unload of the engine
	 * and destruction of all engine objects. */
        gtk_rc_set_default_files (new_default_files);
	gtk_rc_reparse_all_for_settings (settings, TRUE);

	gtk_widget_hide (window);
	gtk_widget_unmap (window);

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);

	gtk_widget_destroy (window);

	while (gdk_events_pending ())
		gtk_main_iteration_do (FALSE);

	/* TODO: It would be really cool to check if there is no
	 * loaded engine at this point. */

	/*
	 * HRM: Calling the follwing causes an assertion failure inside cairo here -- 01.10.2010, Benjamin
	cairo_debug_reset_static_data ();
	*/

	return 0;
}
Beispiel #11
0
/* Zru¹ení GDK/X oken widgetu */
static void gtk_ev_unrealize(GtkWidget *widget)
{
    GtkEv *ev;

    g_return_if_fail(GTK_IS_EV(widget));

    ev = GTK_EV(widget);

    /* Schovat okna */
    if(GTK_WIDGET_MAPPED(widget))
        gtk_widget_unmap(widget);

    GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED);

    /* Zru¹it vnitøní okno (GtkEv.ev_win) */
    if(ev->ev_win) {
        gdk_window_set_user_data(ev->ev_win, NULL);
        gdk_window_destroy(ev->ev_win);
        ev->ev_win = NULL;
    }

    /* Zru¹it hlavní okno widgetu (GtkEv.window), zru¹it pøíznak realizace */
    if(GTK_WIDGET_CLASS(parent_class))
       GTK_WIDGET_CLASS(parent_class)->unrealize(widget);
}
Beispiel #12
0
static void
foo_canvas_widget_unmap (FooCanvasItem *item)
{
    FooCanvasWidget *witem = FOO_CANVAS_WIDGET (item);
    if (parent_class->unmap)
        (* parent_class->unmap) (item);
    gtk_widget_unmap (witem->widget);
}
Beispiel #13
0
static void
mate_druid_unmap (GtkWidget *widget)
{
	MateDruid *druid;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (MATE_IS_DRUID (widget));

	druid = MATE_DRUID (widget);
	GTK_WIDGET_UNSET_FLAGS (druid, GTK_MAPPED);
#if 0
	gtk_widget_unmap (druid->back);
	if (druid->_priv->show_finish)
		gtk_widget_unmap (druid->finish);
	else
		gtk_widget_unmap (druid->next);
	gtk_widget_unmap (druid->cancel);
	if (druid->_priv->show_help)
		gtk_widget_unmap (druid->help);
#endif
	gtk_widget_unmap (druid->_priv->bbox);
	if (druid->_priv->current &&
	    GTK_WIDGET_VISIBLE (druid->_priv->current) &&
	    GTK_WIDGET_MAPPED (druid->_priv->current))
		gtk_widget_unmap (GTK_WIDGET (druid->_priv->current));
}
Beispiel #14
0
void TestController::setHidden(bool hidden)
{
    if (!m_mainWebView)
        return;
    if (hidden)
        gtk_widget_unmap(GTK_WIDGET(m_mainWebView->platformView()));
    else
        gtk_widget_map(GTK_WIDGET(m_mainWebView->platformView()));
}
Beispiel #15
0
int
clip_GTK_WIDGETUNMAP(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_widget_unmap(cwid->widget);
	return 0;
err:
	return 1;
}
Beispiel #16
0
static void
gtk_application_window_real_unmap (GtkWidget *widget)
{
  GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);

  /* XXX could eliminate this by tweaking gtk_window_unmap */
  if (window->priv->menubar)
    gtk_widget_unmap (window->priv->menubar);

  GTK_WIDGET_CLASS (gtk_application_window_parent_class)->unmap (widget);
}
static void
gtk_expander_unmap (GtkWidget *widget)
{
  GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;

  if (priv->event_window)
    gdk_window_hide (priv->event_window);

  GTK_WIDGET_CLASS (gtk_expander_parent_class)->unmap (widget);

  if (priv->label_widget)
    gtk_widget_unmap (priv->label_widget);
}
Beispiel #18
0
static void
gdl_dock_unmap (GtkWidget *widget)
{
    GtkWidget *child;
    GdlDock   *dock;
    
    g_return_if_fail (widget != NULL);
    g_return_if_fail (GDL_IS_DOCK (widget));

    dock = GDL_DOCK (widget);

    GDL_CALL_PARENT (GTK_WIDGET_CLASS, unmap, (widget));

    if (dock->root) {
        child = GTK_WIDGET (dock->root);
        if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_MAPPED (child))
            gtk_widget_unmap (child);
    }
    
    if (dock->_priv->window)
        gtk_widget_unmap (dock->_priv->window);
}
Beispiel #19
0
static void
gdl_dock_unmap (GtkWidget *widget)
{
    GtkWidget *child;
    GdlDock   *dock;

    g_return_if_fail (widget != NULL);
    g_return_if_fail (GDL_IS_DOCK (widget));

    dock = GDL_DOCK (widget);

    GTK_WIDGET_CLASS (gdl_dock_parent_class)->unmap (widget);

    if (dock->priv->root) {
        child = GTK_WIDGET (dock->priv->root);
        if (gtk_widget_get_visible (child) && gtk_widget_get_mapped (child))
            gtk_widget_unmap (child);
    }

    if (dock->priv->window)
        gtk_widget_unmap (dock->priv->window);
}
Beispiel #20
0
void gMainWindow::remap()
{
	if (!isVisible())
		return;

	gtk_widget_unmap(border);
	gtk_widget_map(border);
	
	if (_skip_taskbar) { setSkipTaskBar(false);	setSkipTaskBar(true); }
	if (top_only) { setTopOnly(false); setTopOnly(true); }
	if (sticky) { setSticky(false); setSticky(true); }
	if (stack) { setStacking(0); setStacking(stack); }
	X11_set_window_type(handle(), _type);
}
/**
 * eel_gtk_container_child_unmap:
 *
 * @container: A GtkContainer widget.
 * @child: A child of @container or NULL;
 *
 * Unmap a child if needed.  This is usually called from the "GtkWidget::unmap"
 * method of the @container widget.  If @child is NULL, then this function is a noop.
 */
void
eel_gtk_container_child_unmap (GtkContainer *container,
                               GtkWidget *child)
{
    g_return_if_fail (GTK_IS_CONTAINER (container));

    if (child == NULL)
    {
        return;
    }

    g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));

    if (gtk_widget_get_visible (child) && gtk_widget_get_mapped (child))
    {
        gtk_widget_unmap (child);
    }
}
Beispiel #22
0
static void columns_unmap(GtkWidget *widget)
{
  Columns *cols;
  ColumnsChild *child;
  GList *children;

  g_return_if_fail(widget != NULL);
  g_return_if_fail(IS_COLUMNS(widget));

  cols = COLUMNS(widget);
  gtk_widget_set_mapped(GTK_WIDGET(cols), FALSE);

  for (children = cols->children; children && (child = children->data);
       children = children->next) {
    if (child->widget && gtk_widget_get_visible(child->widget) &&
        gtk_widget_get_mapped(child->widget))
      gtk_widget_unmap(child->widget);
  }
}
Beispiel #23
0
void gMainWindow::setUtility(bool v)
{
	bool remap = false;

	if (!isTopLevel())
		return;
	
	// TODO: works only if the window is not mapped!

	_utility = v;
	if (gtk_widget_get_mapped(border))
	{
		remap = true;
		gtk_widget_unmap(border);
	}

	gtk_window_set_type_hint(GTK_WINDOW(border), v ? GDK_WINDOW_TYPE_HINT_UTILITY : GDK_WINDOW_TYPE_HINT_NORMAL);

	if (remap)
		gtk_widget_map(border);
}
Beispiel #24
0
static void
reload_image_menu_items (void)
{
	GSList* l;

	for (l = image_menu_items; l; l = l->next) {
		GtkWidget *image = l->data;
		gboolean   is_mapped;

		is_mapped = gtk_widget_get_mapped (image);

		if (is_mapped)
			gtk_widget_unmap (image);

		gtk_image_set_from_pixbuf (GTK_IMAGE (image), NULL);

		if (is_mapped)
			gtk_widget_map (image);

	}
}
Beispiel #25
0
static void panels_unmap(GtkWidget *widget)
{
    Panels *panels;
    GtkWidget *child;
    GList *children;

    g_return_if_fail(widget != NULL);
    g_return_if_fail(IS_PANELS(widget));

    panels = PANELS(widget);
    GTK_WIDGET_UNSET_FLAGS(panels, GTK_MAPPED);

    for (children = panels->children;
         children && (child = children->data);
         children = children->next) {
        if (child &&
	    GTK_WIDGET_VISIBLE(child) &&
            GTK_WIDGET_MAPPED(child))
            gtk_widget_unmap(child);
    }
}
Beispiel #26
0
static void columns_unmap(GtkWidget *widget)
{
    Columns *cols;
    ColumnsChild *child;
    GList *children;

    g_return_if_fail(widget != NULL);
    g_return_if_fail(IS_COLUMNS(widget));

    cols = COLUMNS(widget);
    GTK_WIDGET_UNSET_FLAGS(cols, GTK_MAPPED);

    for (children = cols->children;
         children && (child = children->data);
         children = children->next) {
        if (child->widget &&
	    GTK_WIDGET_VISIBLE(child->widget) &&
            GTK_WIDGET_MAPPED(child->widget))
            gtk_widget_unmap(child->widget);
    }
}
Beispiel #27
0
/**
 * mate_druid_insert_page:
 * @druid: A #MateDruid widget.
 * @back_page: The page prior to the page to be inserted.
 * @page: The page to insert.
 *
 * Description: This will insert @page after @back_page into the list of
 * internal pages that the @druid has.  If @back_page is not present in the
 * list or %NULL, @page will be prepended to the list.  Since #MateDruid is
 * just a container, you will need to also call gtk_widget_show() on the page,
 * otherwise the page will not be shown.
 **/
void
mate_druid_insert_page (MateDruid *druid,
			 MateDruidPage *back_page,
			 MateDruidPage *page)
{
	GList *list;

	g_return_if_fail (druid != NULL);
	g_return_if_fail (MATE_IS_DRUID (druid));
	g_return_if_fail (page != NULL);
	g_return_if_fail (MATE_IS_DRUID_PAGE (page));

	list = g_list_find (druid->_priv->children, back_page);
	if (list == NULL) {
		druid->_priv->children = g_list_prepend (druid->_priv->children, page);
	} else {
		GList *new_el = g_list_alloc ();
		new_el->next = list->next;
		new_el->prev = list;
		if (new_el->next)
			new_el->next->prev = new_el;
		new_el->prev->next = new_el;
		new_el->data = (gpointer) page;
	}
	gtk_widget_set_parent (GTK_WIDGET (page), GTK_WIDGET (druid));

	if (GTK_WIDGET_REALIZED (GTK_WIDGET (druid)))
		gtk_widget_realize (GTK_WIDGET (page));

	if (GTK_WIDGET_VISIBLE (GTK_WIDGET (druid)) && GTK_WIDGET_VISIBLE (GTK_WIDGET (page))) {
		if (GTK_WIDGET_MAPPED (GTK_WIDGET (page)))
			gtk_widget_unmap (GTK_WIDGET (page));
		gtk_widget_queue_resize (GTK_WIDGET (druid));
	}

	/* if it's the first and only page, we want to bring it to the foreground. */
	if (druid->_priv->children->next == NULL)
		mate_druid_set_page (druid, page);
}
Beispiel #28
0
static void
eel_wrap_table_unmap (GtkWidget *widget)
{
    EelWrapTable *wrap_table;
    GList *iterator;

    g_assert (EEL_IS_WRAP_TABLE (widget));

    wrap_table = EEL_WRAP_TABLE (widget);

    gtk_widget_set_mapped (widget, FALSE);

    for (iterator = wrap_table->details->children; iterator; iterator = iterator->next)
    {
        GtkWidget *item;

        item = iterator->data;

        if (gtk_widget_get_visible (item) && gtk_widget_get_mapped (item))
        {
            gtk_widget_unmap (item);
        }
    }
}
Beispiel #29
0
    static void
gtk_form_position_child(GtkForm *form, GtkFormChild *child,
			gboolean force_allocate)
{
    gint x;
    gint y;

    x = child->x;
    y = child->y;

    if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) &&
	(y >= G_MINSHORT) && (y <= G_MAXSHORT))
    {
	if (!child->mapped)
	{
	    if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget))
	    {
		if (!GTK_WIDGET_MAPPED(child->widget))
		    gtk_widget_map(child->widget);

		child->mapped = TRUE;
		force_allocate = TRUE;
	    }
	}

	if (force_allocate)
	{
	    GtkAllocation allocation;

	    if (GTK_WIDGET_NO_WINDOW(child->widget))
	    {
		if (child->window)
		{
		    gdk_window_move_resize(child->window,
			    x, y,
			    child->widget->requisition.width,
			    child->widget->requisition.height);
		}

		allocation.x = 0;
		allocation.y = 0;
	    }
	    else
	    {
		allocation.x = x;
		allocation.y = y;
	    }

	    allocation.width = child->widget->requisition.width;
	    allocation.height = child->widget->requisition.height;

	    gtk_widget_size_allocate(child->widget, &allocation);
	}
    }
    else
    {
	if (child->mapped)
	{
	    child->mapped = FALSE;

	    if (GTK_WIDGET_MAPPED(child->widget))
		gtk_widget_unmap(child->widget);
	}
    }
}
Beispiel #30
0
static VALUE
rg_unmap(VALUE self)
{
    gtk_widget_unmap(_SELF(self));
    return self;
}