示例#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");
    }
}
示例#2
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);
	}
}
示例#3
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);
    }
}
示例#4
0
/**
 * For details of what is expected from an icon window and what it
 * should expect.
 *
 * See --
 *    http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.9
 */
G_GNUC_COLD void
icon_init(void)
{
    create_icon();

	gtk_widget_realize(icon);

    /*
     * For some reason, when a window is the icon for another
     * window, none of its subwindows get mapped.  This is not
     * because of GTK, but seems to be either the window manager
     * or X itself that does this.
     *
     * Also note the canvas widget is never unmapped, regardless
     * of whether the icon window is visible or not.
     */
    gtk_widget_map(canvas);
	/* FIXME: This causes a crash with twm when iconizing the main window. */
#if 0
    gdk_window_set_icon(gui_main_window()->window, icon->window, NULL, NULL);
#endif
    icon_just_mapped_fg = icon_visible_fg = icon_close_fg = FALSE;

    /*   load images   */
    con_pixbuf = create_pixbuf("smallserver.xpm");
    up_pixbuf = create_pixbuf("upload.xpm");
    down_pixbuf = create_pixbuf("download.xpm");

	status_icon_init();

	main_gui_add_timer(icon_timer);
}
static void
awt_gtk_panel_add (GtkContainer *container, GtkWidget *widget)
{
       AWTGtkPanel *panel = AWT_GTK_PANEL(container);

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

       gtk_widget_set_parent (widget, GTK_WIDGET (panel));

       /* Add at start of list using g_list_prepend to ensure widgets are added behind
          other widgets if they are added later. */

       panel->children = g_list_prepend (panel->children, widget);

       if (GTK_WIDGET_REALIZED (panel))
               gtk_widget_realize (widget);

       if (GTK_WIDGET_VISIBLE (panel) && GTK_WIDGET_VISIBLE (widget))
       {
               if (GTK_WIDGET_MAPPED (panel))
                       gtk_widget_map (widget);

               gtk_widget_queue_resize (GTK_WIDGET (panel));
       }
}
示例#6
0
文件: gdl-dock.c 项目: vldm/gdl
/**
 * gdl_dock_add_floating_item:
 * @dock: A #GdlDock widget
 * @item: A #GdlDockItem widget
 * @x: X coordinate of the floating item
 * @y: Y coordinate of the floating item
 * @width: width of the floating item
 * @height: height of the floating item
 *
 * Dock an item as a floating item. It creates a new window containing a new
 * dock widget sharing the same master where the item is docked.
 */
void
gdl_dock_add_floating_item (GdlDock        *dock,
                            GdlDockItem    *item,
                            gint            x,
                            gint            y,
                            gint            width,
                            gint            height)
{
    GdlDock *new_dock;

    g_return_if_fail (dock != NULL);
    g_return_if_fail (item != NULL);

    new_dock = GDL_DOCK (g_object_new (GDL_TYPE_DOCK,
                                       "master", gdl_dock_object_get_master (GDL_DOCK_OBJECT (dock)),
                                       "floating", TRUE,
                                       "width", width,
                                       "height", height,
                                       "floatx", x,
                                       "floaty", y,
                                       "skip-taskbar", dock->priv->skip_taskbar,
                                       NULL));

    if (gtk_widget_get_visible (GTK_WIDGET (dock))) {
        gtk_widget_show (GTK_WIDGET (new_dock));
        if (gtk_widget_get_mapped (GTK_WIDGET (dock)))
            gtk_widget_map (GTK_WIDGET (new_dock));

        /* Make the widget resize. */
        gtk_widget_queue_resize (GTK_WIDGET (new_dock));
    }

    gdl_dock_add_item (GDL_DOCK (new_dock), item, GDL_DOCK_TOP);
}
示例#7
0
void columns_add(Columns *cols, GtkWidget *child, gint colstart, gint colspan)
{
  ColumnsChild *childdata;

  g_return_if_fail(cols != NULL);
  g_return_if_fail(IS_COLUMNS(cols));
  g_return_if_fail(child != NULL);
  g_return_if_fail(gtk_widget_get_parent(child) == NULL);

  childdata = g_new(ColumnsChild, 1);
  childdata->widget = child;
  childdata->colstart = colstart;
  childdata->colspan = colspan;
  childdata->force_left = FALSE;
  childdata->same_height_as = NULL;

  cols->children = g_list_append(cols->children, childdata);
  cols->taborder = g_list_append(cols->taborder, child);

  gtk_widget_set_parent(child, GTK_WIDGET(cols));

#if GTK_CHECK_VERSION(2, 0, 0)
  gtk_container_set_focus_chain(GTK_CONTAINER(cols), cols->taborder);
#endif

  if (gtk_widget_get_realized(GTK_WIDGET(cols)))
    gtk_widget_realize(child);

  if (gtk_widget_get_visible(GTK_WIDGET(cols)) &&
      gtk_widget_get_visible(child)) {
    if (gtk_widget_get_mapped(GTK_WIDGET(cols)))
      gtk_widget_map(child);
    gtk_widget_queue_resize(child);
  }
}
/**
 * eel_gtk_container_child_add:
 *
 * @container: A GtkContainer widget.
 * @child: A non NULL unparented child.
 *
 * Add a @child to a @container.  The @child is realized, mapped
 * and resized if needed.  This is usually called from the "GtkContainer::add"
 * method of the @container.  The @child cannot be NULL.
 */
void
eel_gtk_container_child_add (GtkContainer *container,
                             GtkWidget *child)
{
    GtkWidget *widget;

    g_return_if_fail (GTK_IS_CONTAINER (container));
    g_return_if_fail (GTK_IS_WIDGET (child));

    widget = GTK_WIDGET (container);

    gtk_widget_set_parent (child, widget);

    if (gtk_widget_get_realized (widget))
    {
        gtk_widget_realize (child);
    }

    if (gtk_widget_get_mapped (widget)
            && gtk_widget_get_visible (child))
    {
        if (gtk_widget_get_mapped (widget))
        {
            gtk_widget_map (child);
        }

        gtk_widget_queue_resize (child);
    }
}
示例#9
0
static void
gtk_application_window_real_map (GtkWidget *widget)
{
    GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);

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

#ifdef GDK_WINDOWING_WAYLAND
    {
        GdkWindow *gdkwindow;
        GtkApplication *application;

        application = gtk_window_get_application (GTK_WINDOW (window));
        gdkwindow = gtk_widget_get_window (widget);

        if (GDK_IS_WAYLAND_WINDOW (gdkwindow) && window->priv->session)
        {
            gdk_wayland_window_set_dbus_properties_libgtk_only (gdkwindow,
                    g_application_get_application_id (G_APPLICATION (application)),
                    gtk_application_get_app_menu_object_path (application),
                    gtk_application_get_menubar_object_path (application),
                    window->priv->object_path,
                    g_application_get_dbus_object_path (G_APPLICATION (application)),
                    g_dbus_connection_get_unique_name (window->priv->session));
        }
    }
#endif

    GTK_WIDGET_CLASS (gtk_application_window_parent_class)->map (widget);
}
示例#10
0
void columns_add(Columns *cols, GtkWidget *child,
                 gint colstart, gint colspan)
{
    ColumnsChild *childdata;

    g_return_if_fail(cols != NULL);
    g_return_if_fail(IS_COLUMNS(cols));
    g_return_if_fail(child != NULL);
    g_return_if_fail(child->parent == NULL);

    childdata = g_new(ColumnsChild, 1);
    childdata->widget = child;
    childdata->colstart = colstart;
    childdata->colspan = colspan;
    childdata->force_left = FALSE;

    cols->children = g_list_append(cols->children, childdata);
    cols->taborder = g_list_append(cols->taborder, child);

    gtk_widget_set_parent(child, GTK_WIDGET(cols));

    if (GTK_WIDGET_REALIZED(cols))
        gtk_widget_realize(child);

    if (GTK_WIDGET_VISIBLE(cols) && GTK_WIDGET_VISIBLE(child)) {
        if (GTK_WIDGET_MAPPED(cols))
            gtk_widget_map(child);
        gtk_widget_queue_resize(child);
    }
}
示例#11
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);
}
示例#12
0
static void
exo_wrap_table_add (GtkContainer *container,
                    GtkWidget    *widget)
{
  ExoWrapTable *table = EXO_WRAP_TABLE (container);

  /* take over ownership */
  gtk_widget_set_parent (widget, GTK_WIDGET (table));

  /* add the child to our internal list */
  table->priv->children = g_list_append (table->priv->children, widget);

  /* realize the widget if required */
  if (gtk_widget_get_realized (GTK_WIDGET (container)))
    gtk_widget_realize (widget);

  /* map the widget if required */
  if (gtk_widget_get_visible (GTK_WIDGET (container)) && gtk_widget_get_visible (widget))
    {
      if (gtk_widget_get_mapped (GTK_WIDGET (container)))
        gtk_widget_map (widget);
    }

  /* queue a resize on the table */
  gtk_widget_queue_resize (GTK_WIDGET (container));
}
static void
awt_gtk_panel_map (GtkWidget *widget)
{
  AWTGtkPanel *panel;
  GtkWidget *child;
  GList *children;

  g_return_if_fail (widget != NULL);

  GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
  panel = AWT_GTK_PANEL (widget);

  children = panel->children;
  while (children)
    {
      child = children->data;
      children = children->next;

      if (GTK_WIDGET_VISIBLE (child) &&
	  !GTK_WIDGET_MAPPED (child))
	gtk_widget_map (child);
    }

  gdk_window_show (widget->window);
}
示例#14
0
void
moz_container_map (GtkWidget *widget)
{
    MozContainer *container;
    GList *tmp_list;
    GtkWidget *tmp_child;

    g_return_if_fail (IS_MOZ_CONTAINER(widget));
    container = MOZ_CONTAINER (widget);

    gtk_widget_set_mapped(widget, TRUE);

    tmp_list = container->children;
    while (tmp_list) {
        tmp_child = ((MozContainerChild *)tmp_list->data)->widget;
    
        if (gtk_widget_get_visible(tmp_child)) {
            if (!gtk_widget_get_mapped(tmp_child))
                gtk_widget_map(tmp_child);
        }
        tmp_list = tmp_list->next;
    }

    gdk_window_show (gtk_widget_get_window(widget));
}
示例#15
0
static void
gtk_pizza_map (GtkWidget *widget)
{
    GtkPizza *pizza;
    GtkPizzaChild *child;
    GList *children;

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

    GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
    pizza = GTK_PIZZA (widget);

    children = pizza->children;
    while (children)
    {
        child = children->data;
        children = children->next;

        if ( GTK_WIDGET_VISIBLE (child->widget) &&
            !GTK_WIDGET_MAPPED (child->widget) &&
            !GTK_WIDGET_IS_OFFSCREEN (child->widget))
        {
            gtk_widget_map (child->widget);
        }
    }

    gdk_window_show (widget->window);
    gdk_window_show (pizza->bin_window);
}
示例#16
0
文件: gdl-dock.c 项目: EQ4/samplecat
void
gdl_dock_add_floating_item (GdlDock        *dock,
                            GdlDockItem    *item,
                            gint            x,
                            gint            y,
                            gint            width,
                            gint            height)
{
    GdlDock *new_dock;
    
    g_return_if_fail (dock != NULL);
    g_return_if_fail (item != NULL);
    
    new_dock = GDL_DOCK (g_object_new (GDL_TYPE_DOCK, 
                                       "master", GDL_DOCK_OBJECT_GET_MASTER (dock), 
                                       "floating", TRUE,
                                       "width", width,
                                       "height", height,
                                       "floatx", x,
                                       "floaty", y,
                                       NULL));
    
    if (GTK_WIDGET_VISIBLE (dock)) {
        gtk_widget_show (GTK_WIDGET (new_dock));
        if (GTK_WIDGET_MAPPED (dock))
            gtk_widget_map (GTK_WIDGET (new_dock));
        
        /* Make the widget resize. */
        gtk_widget_queue_resize (GTK_WIDGET (new_dock));
    }

    gdl_dock_add_item (GDL_DOCK (new_dock), item, GDL_DOCK_TOP);
}
void
_shell_embedded_window_realize (ShellEmbeddedWindow *window)
{
  g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));

  if (gtk_widget_get_visible (GTK_WIDGET (window)))
    gtk_widget_map (GTK_WIDGET (window));
}
示例#18
0
void
_cinnamon_embedded_window_realize (CinnamonEmbeddedWindow *window)
{
  g_return_if_fail (CINNAMON_IS_EMBEDDED_WINDOW (window));

  if (gtk_widget_get_visible (GTK_WIDGET (window)))
    gtk_widget_map (GTK_WIDGET (window));
}
示例#19
0
static void
mate_druid_map (GtkWidget *widget)
{
	MateDruid *druid;

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

	druid = MATE_DRUID (widget);
	GTK_WIDGET_SET_FLAGS (druid, GTK_MAPPED);

#if 0
	gtk_widget_map (druid->back);
	if (druid->_priv->show_finish)
		gtk_widget_map (druid->finish);
	else
		gtk_widget_map (druid->next);
	if (druid->_priv->show_help)
		gtk_widget_map (druid->help);
	gtk_widget_map (druid->cancel);
#endif
	gtk_widget_map (druid->_priv->bbox);
	if (druid->_priv->current &&
	    GTK_WIDGET_VISIBLE (druid->_priv->current) &&
	    !GTK_WIDGET_MAPPED (druid->_priv->current)) {
		gtk_widget_map (GTK_WIDGET (druid->_priv->current));
	}
}
示例#20
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()));
}
示例#21
0
static void
foo_canvas_widget_map (FooCanvasItem *item)
{
    FooCanvasWidget *witem = FOO_CANVAS_WIDGET (item);
    if (parent_class->map)
        (* parent_class->map) (item);
    if (witem->widget && gtk_widget_get_visible (witem->widget))
        gtk_widget_map (witem->widget);
}
示例#22
0
static void
gtk_ellipsis_map (GtkWidget *widget)
{
  GtkEllipsisPrivate *priv = GTK_ELLIPSIS (widget)->priv;

  GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);

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

  if (priv->expanded)
    gtk_widget_map (GTK_BIN (widget)->child);

  else if (priv->label)
    {
      gtk_widget_map (priv->label);
      gtk_widget_map (priv->ellipsis_label);
    }
}
示例#23
0
文件: widget.c 项目: amery/clip-itk
int
clip_GTK_WIDGETMAP(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_widget_map(cwid->widget);
	return 0;
err:
	return 1;
}
static void
gtk_application_window_real_map (GtkWidget *widget)
{
  GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);

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

  GTK_WIDGET_CLASS (gtk_application_window_parent_class)->map (widget);
}
static void
hildon_home_window_map (GtkWidget *widget)
{
  HildonHomeWindow             *window;
  HildonHomeWindowPrivate      *priv;
  GtkWidget                    *child;

  window = HILDON_HOME_WINDOW (widget);
  priv = window->priv;
  child = GTK_BIN (widget)->child;

  if (GTK_WIDGET_CLASS (hildon_home_window_parent_class)->map)
    GTK_WIDGET_CLASS (hildon_home_window_parent_class)->map (widget);

  if (GTK_IS_WIDGET (child))
    gtk_widget_map (child);

  if (GTK_IS_WIDGET (priv->titlebar))
    gtk_widget_map (priv->titlebar);

}
示例#26
0
static void
gtk_expander_map (GtkWidget *widget)
{
  GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;

  if (priv->label_widget)
    gtk_widget_map (priv->label_widget);

  GTK_WIDGET_CLASS (gtk_expander_parent_class)->map (widget);

  if (priv->event_window)
    gdk_window_show (priv->event_window);
}
示例#27
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);
}
示例#28
0
void
_cinnamon_embedded_window_set_actor (CinnamonEmbeddedWindow  *window,
                                  CinnamonGtkEmbed        *actor)

{
  g_return_if_fail (CINNAMON_IS_EMBEDDED_WINDOW (window));

  window->priv->actor = actor;

  if (actor &&
      CLUTTER_ACTOR_IS_REALIZED (actor) &&
      gtk_widget_get_visible (GTK_WIDGET (window)))
    gtk_widget_map (GTK_WIDGET (window));
}
void
_shell_embedded_window_set_actor (ShellEmbeddedWindow  *window,
                                  ShellGtkEmbed        *actor)

{
  g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));

  window->priv->actor = actor;

  if (actor &&
      CLUTTER_ACTOR_IS_REALIZED (actor) &&
      gtk_widget_get_visible (GTK_WIDGET (window)))
    gtk_widget_map (GTK_WIDGET (window));
}
示例#30
0
/* FIXME: GnomeDruid bug workaround. */
static void
gb_gnome_druid_show_page (GtkWidget *parent, GtkWidget *new_page)
{
  /* Hopefully we don't need this for GNOME 2. */
#if 0
  if (GTK_WIDGET_REALIZED (parent))
    gtk_widget_realize (new_page);

  if (GTK_WIDGET_VISIBLE (parent) && GTK_WIDGET_VISIBLE (new_page))
    {
      if (GTK_WIDGET_MAPPED (parent))
	gtk_widget_map (new_page);

      gtk_widget_queue_resize (new_page);
    }
#endif
}