当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_HEADER_BAR函数代码示例

本文整理汇总了C++中GTK_HEADER_BAR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_HEADER_BAR函数的具体用法?C++ GTK_HEADER_BAR怎么用?C++ GTK_HEADER_BAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_HEADER_BAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create_header_bar

GtkWidget *
create_header_bar (GtkWidget *dialog, const gchar *title)
{
    static GtkWidget *header_bar = NULL;
    header_bar = gtk_header_bar_new();
    gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header_bar), FALSE);
    gtk_header_bar_set_title (GTK_HEADER_BAR (header_bar), title);
    gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header_bar), FALSE);
    gtk_window_set_titlebar (GTK_WINDOW (dialog), header_bar);

    return header_bar;
}
开发者ID:paolostivanin,项目名称:GTKCrypto,代码行数:12,代码来源:common-widgets.c

示例2: glade_gtk_header_bar_set_size

static void
glade_gtk_header_bar_set_size (GObject * object,
                               const GValue * value)
{
  GList *l, *next, *children;
  GtkWidget *child;
  guint new_size, old_size, i;

  g_return_if_fail (GTK_IS_HEADER_BAR (object));

  d(g_message ("Setting size to %d", g_value_get_int (value)));

  if (glade_util_object_is_loading (object))
    return;

  children = gtk_container_get_children (GTK_CONTAINER (object));
  l = children;
  while (l)
    {
      next = l->next;
      if (l->data == gtk_header_bar_get_custom_title (GTK_HEADER_BAR (object)) ||
          (!glade_widget_get_from_gobject (l->data) && !GLADE_IS_PLACEHOLDER (l->data)))
        children = g_list_delete_link (children, l);
      l = next;
    }
 
  old_size = g_list_length (children);
  new_size = g_value_get_int (value);

  if (old_size == new_size)
    {
      g_list_free (children);
      return;
    }

  for (i = old_size; i < new_size; i++)
    {
      GtkWidget *placeholder = glade_placeholder_new ();
      gtk_header_bar_pack_start (GTK_HEADER_BAR (object), placeholder);
    }
  for (l = g_list_last (children); l && old_size > new_size; l = l->prev)
    {
      child = l->data;
      if (glade_widget_get_from_gobject (child) || !GLADE_IS_PLACEHOLDER (child))
        continue;

      gtk_container_remove (GTK_CONTAINER (object), child);
      old_size--;
    }

  g_list_free (children);
}
开发者ID:metaltrrocker,项目名称:glade,代码行数:52,代码来源:glade-gtk-header-bar.c

示例3: gs_editor_refresh_file

static void
gs_editor_refresh_file (GsEditor *self, GFile *file)
{
	GtkWidget *widget;

	/* set subtitle */
	widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "headerbar_main"));
	if (file != NULL) {
		g_autofree gchar *basename = g_file_get_basename (file);
		gtk_header_bar_set_subtitle (GTK_HEADER_BAR (widget), basename);
	} else {
		gtk_header_bar_set_subtitle (GTK_HEADER_BAR (widget), NULL);
	}
}
开发者ID:GNOME,项目名称:gnome-software,代码行数:14,代码来源:gs-editor.c

示例4: change_subtitle

static void
change_subtitle (GtkButton *button, gpointer data)
{
  GtkWidget *headerbar = GTK_WIDGET (data);

  if (gtk_header_bar_get_subtitle (GTK_HEADER_BAR (headerbar)) == NULL)
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (headerbar), "(subtle subtitle)");
    }
  else
    {
      gtk_header_bar_set_subtitle (GTK_HEADER_BAR (headerbar), NULL);
    }
}
开发者ID:BoozzyAmdJin,项目名称:gtk-,代码行数:14,代码来源:testheaderbar.c

示例5: change_title

static void
change_title (GtkButton *button, gpointer data)
{
  GtkWidget *headerbar = GTK_WIDGET (data);

  if (gtk_header_bar_get_custom_title (GTK_HEADER_BAR (headerbar)) == NULL)
    {
      gtk_header_bar_set_custom_title (GTK_HEADER_BAR (headerbar), gtk_check_button_new_with_label ("Middle"));
    }
  else
    {
      gtk_header_bar_set_custom_title (GTK_HEADER_BAR (headerbar), NULL);
      gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Middle");
    }
}
开发者ID:BoozzyAmdJin,项目名称:gtk-,代码行数:15,代码来源:testheaderbar.c

示例6: garu_headerbar_init_playback_buttons

static void
garu_headerbar_init_playback_buttons (GaruHeaderbar *self)
{
  GSettings       *settings;
  GaruApplication *app;
  GtkWidget       *box, *button, *image;

  app = GARU_APPLICATION (g_application_get_default ());
  settings = garu_application_get_settings (app);

  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);

  /* shuffle */
  button = garu_utils_new_icon_button ("media-playlist-shuffle-symbolic",
				       TRUE, FALSE);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);
  /* repeat */
  button = garu_utils_new_icon_button ("media-playlist-repeat-symbolic",
				       TRUE, FALSE);
  
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);
  /* volume */
  button = gtk_volume_button_new ();
  gtk_scale_button_set_value (GTK_SCALE_BUTTON (button), 1);
  g_settings_bind (settings, "volume", button, "value",
                   G_SETTINGS_BIND_DEFAULT);
  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  gtk_header_bar_pack_end (GTK_HEADER_BAR (self), box);
  gtk_widget_show (box);
}
开发者ID:mgyugcha,项目名称:garu-music-player,代码行数:34,代码来源:garu-headerbar.c

示例7: garu_headerbar_init

static void
garu_headerbar_init (GaruHeaderbar *self)
{
  GaruApplication *app;
  GSettings       *settings;
  GaruPlayer      *player;

  self->timeout_id = 0;

  garu_headerbar_init_playback_buttons (self);
  garu_headerbar_init_song_box (self);
  garu_headerbar_init_control_buttons (self);

  gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self), TRUE);

  app = GARU_APPLICATION (g_application_get_default ());
  settings = garu_application_get_settings (app);
  player = garu_application_get_player (app);


  /* signals */
  g_settings_bind (settings, "show-settings-button",
                   self, "show-settings-button", G_SETTINGS_BIND_GET);
  g_signal_connect (player, "playing",
                    G_CALLBACK (garu_headerbar_new_playing), self);
}
开发者ID:mgyugcha,项目名称:garu-music-player,代码行数:26,代码来源:garu-headerbar.c

示例8: fake_gtk_header_bar_set_property

static void fake_gtk_header_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
    /* We haven't determined the property yet... */
    if (G_UNLIKELY(PROP_SHOW_CLOSE_BUTTON == -1)) {
        GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(object), "show-close-button");
        if (spec)
            /* Technically, this is marked as internal in GParamSpec,
             * but it's the only way to access that trivially. It's
             * been stable in gobject for over a decade now. */
            PROP_SHOW_CLOSE_BUTTON = spec->param_id;
        else
            /* We couldn't find out, for some reason. The value -2
             * will never match a valid property id, so should be safe. */
            PROP_SHOW_CLOSE_BUTTON = -2;
    }

    /* In theory, we shouldn't need to override this, since
     * set_property in the gtk3 source code just calls that function,
     * but with active compiler optimization, an inline version of it
     * may be copied into set_propery, so we also need to override
     * this here. */
    if(G_UNLIKELY((int)prop_id == PROP_SHOW_CLOSE_BUTTON))
        gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (object), FALSE);
    else
        orig_gtk_header_bar_set_property (object, prop_id, value, pspec);
}
开发者ID:smcv,项目名称:gtk3-nocsd,代码行数:26,代码来源:gtk3-nocsd.c

示例9: setup_search

static void
setup_search (GtkAppChooserDialog *self)
{
  gboolean use_header;

  g_object_get (self, "use-header-bar", &use_header, NULL);
  if (use_header)
    {
      GtkWidget *button;
      GtkWidget *image;
      GtkWidget *header;

      button = gtk_toggle_button_new ();
      gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
      image = gtk_image_new_from_icon_name ("edit-find-symbolic", GTK_ICON_SIZE_MENU);
      gtk_widget_show (image);
      gtk_container_add (GTK_CONTAINER (button), image);
      gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
      gtk_style_context_remove_class (gtk_widget_get_style_context (button), "text-button");
      gtk_widget_show (button);

      header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
      gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);

      g_object_bind_property (button, "active",
                              self->priv->search_bar, "search-mode-enabled",
                              G_BINDING_BIDIRECTIONAL);
      g_object_bind_property (self->priv->search_entry, "sensitive",
                              button, "sensitive",
                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
    }
}
开发者ID:RavikumarTulugu,项目名称:antkorp,代码行数:32,代码来源:gtkappchooserdialog.c

示例10: reader_window_load_document

gboolean
reader_window_load_document(ReaderWindow *reader,
                            const gchar *filename)
{
	ReaderWindowPrivate *priv = READER_WINDOW_PRIVATE(reader);
	if (reader_document_view_load_document(READER_DOCUMENT_VIEW(priv->view), filename))
	{
		CainteoirDocument *doc = reader_document_view_get_document(READER_DOCUMENT_VIEW(priv->view));
		CainteoirMetadata *metadata = cainteoir_document_get_metadata(doc);
		gchar *title = cainteoir_metadata_get_string(metadata, CAINTEOIR_METADATA_TITLE);

		reader_application_set_active_document(priv->application, doc);

		const gchar *doc_title = title ? title : i18n("Cainteoir Text-to-Speech");
		gtk_header_bar_set_title(GTK_HEADER_BAR(priv->header), doc_title);

		if (title) g_free(title);
		g_object_unref(G_OBJECT(metadata));
		g_object_unref(G_OBJECT(doc));

		reset_timebar(priv);
		return TRUE;
	}
	return FALSE;
}
开发者ID:happytcj,项目名称:cainteoir-gtk,代码行数:25,代码来源:reader_window.cpp

示例11: create_page

/*
 * create_page:
 * @child: the #CheeseWidget to pack into the container
 * @button: the #GtkButton for taking a photo
 *
 * Create the widgets for the #CheeseAvatarWidget and pack them into a
 * container.
 *
 * Returns: a #GtkBox containing the individual #CheeseAvatarWidget widgets
 */
static GtkWidget *
create_page (GtkWidget *child,
             GtkWidget *button)
{
    GtkWidget *vgrid, *bar;
    GtkStyleContext *context;

    vgrid = gtk_grid_new ();
    gtk_grid_attach (GTK_GRID (vgrid),
                     child, 0, 0, 1, 1);
    gtk_widget_set_hexpand (child, TRUE);
    gtk_widget_set_vexpand (child, TRUE);

    bar = gtk_header_bar_new ();
    context = gtk_widget_get_style_context (GTK_WIDGET (bar));
    gtk_style_context_remove_class (context, "header-bar");
    gtk_style_context_add_class (context, "inline-toolbar");
    gtk_style_context_add_class (context, "toolbar");
    gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);

    g_object_set (G_OBJECT (button), "margin-top", 6, "margin-bottom", 6, NULL);
    gtk_header_bar_set_custom_title (GTK_HEADER_BAR (bar), button);
    gtk_grid_attach (GTK_GRID (vgrid),
                     bar, 0, 1, 1, 1);

    return vgrid;
}
开发者ID:GNOME,项目名称:cheese,代码行数:37,代码来源:cheese-avatar-widget.c

示例12: gs_shell_set_header_end_widget

static void
gs_shell_set_header_end_widget (GsShell *shell, GtkWidget *widget)
{
	GsShellPrivate *priv = gs_shell_get_instance_private (shell);
	GtkWidget *old_widget;
	GtkWidget *header;

	old_widget = priv->header_end_widget;
	header = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));

	if (priv->header_end_widget == widget)
		return;

	if (widget != NULL) {
		g_object_ref (widget);
		gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget);
	}

	priv->header_end_widget = widget;

	if (old_widget != NULL) {
		gtk_container_remove (GTK_CONTAINER (header), old_widget);
		g_object_unref (old_widget);
	}
}
开发者ID:RigoBono,项目名称:gnome-software,代码行数:25,代码来源:gs-shell.c

示例13: glade_gtk_header_bar_add_child

void
glade_gtk_header_bar_add_child (GladeWidgetAdaptor *adaptor,
                                GObject *parent,
                                GObject *child)
{
  GladeWidget *gbox, *gchild;
  gint size;
  gchar *special_child_type;

  gchild = glade_widget_get_from_gobject (child);
  if (gchild)
    glade_widget_set_pack_action_visible (gchild, "remove_slot", FALSE);

  special_child_type = g_object_get_data (child, "special-child-type");

  d(g_message ("Add %s %p (special: %s)",
	       GLADE_IS_PLACEHOLDER (child) ? "placeholder" : "child",
	       child, special_child_type));

  if (special_child_type && !strcmp (special_child_type, "title"))
    {
      gtk_header_bar_set_custom_title (GTK_HEADER_BAR (parent), GTK_WIDGET (child));
      return;
    }

  GWA_GET_CLASS (GTK_TYPE_CONTAINER)->add (adaptor, parent, child);
  
  gbox = glade_widget_get_from_gobject (parent);
  if (!glade_widget_superuser ())
    {
      glade_widget_property_get (gbox, "size", &size);
      glade_widget_property_set (gbox, "size", size);
    }
}
开发者ID:metaltrrocker,项目名称:glade,代码行数:34,代码来源:glade-gtk-header-bar.c

示例14: ASSERT

void WebInspectorProxy::updateInspectorWindowTitle() const
{
    ASSERT(m_inspectorWindow);
    if (m_inspectedURLString.isEmpty()) {
        gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), _("Web Inspector"));
        return;
    }

#if GTK_CHECK_VERSION(3, 10, 0)
    gtk_header_bar_set_title(GTK_HEADER_BAR(m_headerBar), _("Web Inspector"));
    gtk_header_bar_set_subtitle(GTK_HEADER_BAR(m_headerBar), m_inspectedURLString.utf8().data());
#else
    GUniquePtr<gchar> title(g_strdup_printf("%s - %s", _("Web Inspector"), m_inspectedURLString.utf8().data()));
    gtk_window_set_title(GTK_WINDOW(m_inspectorWindow), title.get());
#endif
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:16,代码来源:WebInspectorProxyGtk.cpp

示例15: ASSERT

void WebInspectorProxy::createInspectorWindow()
{
    if (m_client.openWindow(this))
        return;

    ASSERT(!m_inspectorWindow);
    m_inspectorWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    GtkWidget* inspectedViewParent = gtk_widget_get_toplevel(inspectedPage()->viewWidget());
    if (WebCore::widgetIsOnscreenToplevelWindow(inspectedViewParent))
        gtk_window_set_transient_for(GTK_WINDOW(m_inspectorWindow), GTK_WINDOW(inspectedViewParent));

#if GTK_CHECK_VERSION(3, 10, 0)
    m_headerBar = gtk_header_bar_new();
    gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(m_headerBar), TRUE);
    gtk_window_set_titlebar(GTK_WINDOW(m_inspectorWindow), m_headerBar);
    gtk_widget_show(m_headerBar);
#endif

    updateInspectorWindowTitle();
    gtk_window_set_default_size(GTK_WINDOW(m_inspectorWindow), initialWindowWidth, initialWindowHeight);

    gtk_container_add(GTK_CONTAINER(m_inspectorWindow), m_inspectorView);
    gtk_widget_show(m_inspectorView);

    g_object_add_weak_pointer(G_OBJECT(m_inspectorWindow), reinterpret_cast<void**>(&m_inspectorWindow));
    gtk_window_present(GTK_WINDOW(m_inspectorWindow));
}
开发者ID:GuoCheng111,项目名称:webkit,代码行数:28,代码来源:WebInspectorProxyGtk.cpp


注:本文中的GTK_HEADER_BAR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。