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


C++ GTK_IS_TEXT_BUFFER函数代码示例

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


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

示例1: remove_tag_cb

static void
remove_tag_cb (GbColorPickerDocumentMonitor *self,
               GtkTextTag                   *tag,
               GtkTextIter                  *start,
               GtkTextIter                  *end,
               GtkTextBuffer                *buffer)
{
  GtkTextTagTable *tag_table;
  g_autofree gchar *name = NULL;
  Position spos;
  Position epos;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (GTK_IS_TEXT_TAG (tag));

  position_save (&spos, start);
  position_save (&epos, end);

  tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (self->buffer));
  g_object_get (G_OBJECT (tag), "name", &name, NULL);

  if (!dzl_str_empty0 (name) &&
      g_str_has_prefix (name, COLOR_TAG_PREFIX) &&
      gtk_text_tag_table_lookup (tag_table, name))
    gtk_text_tag_table_remove (tag_table, tag);

  position_restore (&spos, buffer, start);
  position_restore (&epos, buffer, end);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:30,代码来源:gb-color-picker-document-monitor.c

示例2: text_inserted_after_cb

static void
text_inserted_after_cb (GbColorPickerDocumentMonitor *self,
                        GtkTextIter                  *iter,
                        gchar                        *text,
                        gint                          len,
                        GtkTextBuffer                *buffer)
{
  GtkTextIter begin, end;
  gint offset;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (iter != NULL);

  begin = *iter;
  offset = gtk_text_iter_get_offset (&begin);
  gtk_text_iter_set_offset (&begin, offset - len);
  gtk_text_iter_set_line_offset (&begin, 0);

  end = *iter;
  if (!gtk_text_iter_ends_line (&end))
    gtk_text_iter_forward_to_line_end (&end);

  gb_color_picker_document_monitor_queue_colorize (self, &begin, &end);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:25,代码来源:gb-color-picker-document-monitor.c

示例3: cursor_moved_cb

static void
cursor_moved_cb (GbColorPickerDocumentMonitor *self,
                 const GtkTextIter            *location,
                 GtkTextBuffer                *buffer)
{
  g_autoptr(GstyleColor) current_color = NULL;
  GtkTextTag *tag;
  GtkTextIter cursor;
  GtkTextIter begin, end;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));

  if (self->is_in_user_action)
    {
      gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (self->buffer));
      self->is_in_user_action = FALSE;
    }

  cursor = *location;

  /* TODO: fast path: check if we are in the last already detected color tag */
  tag = gb_color_picker_helper_get_tag_at_iter (&cursor, &current_color, &begin, &end);
  if (tag != NULL)
    g_signal_emit (self, signals [COLOR_FOUND], 0, current_color);
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:26,代码来源:gb-color-picker-document-monitor.c

示例4: text_inserted_cb

static void
text_inserted_cb (GbColorPickerDocumentMonitor *self,
                  GtkTextIter                  *cursor,
                  gchar                        *text,
                  gint                          len,
                  GtkTextBuffer                *buffer)
{
  g_autoptr(GstyleColor) color = NULL;
  GtkTextTag *tag;
  GtkTextIter begin, end;

  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (self));
  g_assert (GTK_IS_TEXT_BUFFER (buffer));
  g_assert (cursor != NULL);

  tag = gb_color_picker_helper_get_tag_at_iter (cursor, &color, &begin, &end);

  if (tag != NULL )
    {
      gtk_text_iter_set_line_offset (&begin, 0);
      if (!gtk_text_iter_ends_line (&end))
        gtk_text_iter_forward_to_line_end (&end);

      gb_color_picker_document_monitor_queue_uncolorize (self, &begin, &end);
    }
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:26,代码来源:gb-color-picker-document-monitor.c

示例5: wikipad_document_notify_cursor_position

static void
wikipad_document_notify_cursor_position (GtkTextBuffer    *buffer,
                                          GParamSpec       *pspec,
                                          WikipadDocument *document)
{
  GtkTextIter iter;
  gint        line, column, selection;
  gint        tab_size;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));

  /* get the current iter position */
  gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer));

  /* get the current line number */
  line = gtk_text_iter_get_line (&iter) + 1;

  /* get the tab size */
  tab_size = WIKIPAD_SETTING_GET_INT (TAB_WIDTH);

  /* get the column */
  column = wikipad_util_get_real_line_offset (&iter, tab_size);

  /* get length of the selection */
  selection = wikipad_view_get_selection_length (document->textview, NULL);

  /* emit the signal */
  g_signal_emit (G_OBJECT (document), document_signals[CURSOR_CHANGED], 0, line, column, selection);
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:30,代码来源:wikipad-document.c

示例6: gsc_utils_replace_word

void
gsc_utils_replace_word (GtkTextBuffer *text_buffer,
                        GtkTextIter     *iter,
                        const gchar     *text,
                        gint             len)
{
    GtkTextBuffer *buffer;
    gchar *word;
    GtkTextIter word_start;
    GtkTextIter word_end;
    GtkTextMark *mark;

    g_return_if_fail (GTK_IS_TEXT_BUFFER (text_buffer));

    buffer = GTK_TEXT_BUFFER (text_buffer);
    gtk_text_buffer_begin_user_action (buffer);

    mark = gtk_text_buffer_create_mark (buffer, NULL, iter, TRUE);
    word = gsc_utils_get_word_iter (text_buffer, iter, &word_start, &word_end);
    g_free (word);

    gtk_text_buffer_delete (buffer, &word_start, &word_end);

    if (text != NULL)
    {
        gtk_text_buffer_insert (buffer, &word_start, text, len);
    }

    /* Reinitialize iter */
    gtk_text_buffer_get_iter_at_mark (buffer, iter, mark);
    gtk_text_buffer_delete_mark (buffer, mark);
    gtk_text_buffer_end_user_action (buffer);
}
开发者ID:chuchiperriman,项目名称:gtksourcecompletion,代码行数:33,代码来源:gsc-utils.c

示例7: wikipad_document_label_color

static void
wikipad_document_label_color (WikipadDocument *document)
{
  GdkColor  green = {0, 0x0000, 0x9999, 0x0000};
  GdkColor  red   = {0, 0xffff, 0x0000, 0x0000};
  GdkColor *color;

  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (document->buffer));
  g_return_if_fail (WIKIPAD_IS_FILE (document->file));

  if (document->priv->label)
    {
      /* label color */
      if (gtk_text_buffer_get_modified (document->buffer))
        color = &red;
      else if (wikipad_file_get_read_only (document->file))
        color = &green;
      else
        color = NULL;

      /* update colors */
      gtk_widget_modify_fg (document->priv->label, GTK_STATE_NORMAL, color);
      gtk_widget_modify_fg (document->priv->label, GTK_STATE_ACTIVE, color);
    }
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:26,代码来源:wikipad-document.c

示例8: gtk_text_buffer_deserialize_get_can_create_tags

/**
 * gtk_text_buffer_deserialize_get_can_create_tags:
 * @buffer: a #GtkTextBuffer
 * @format: a #GdkAtom representing a registered rich text format
 *
 * This functions returns the value set with
 * gtk_text_buffer_deserialize_set_can_create_tags()
 *
 * Return value: whether deserializing this format may create tags
 *
 * Since: 2.10
 **/
gboolean
gtk_text_buffer_deserialize_get_can_create_tags (GtkTextBuffer *buffer,
                                                 GdkAtom        format)
{
  GList *formats;
  GList *list;
  gchar *format_name;

  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
  g_return_val_if_fail (format != GDK_NONE, FALSE);

  formats = g_object_get_qdata (G_OBJECT (buffer), deserialize_quark ());

  for (list = formats; list; list = g_list_next (list))
    {
      GtkRichTextFormat *fmt = list->data;

      if (fmt->atom == format)
        {
          return fmt->can_create_tags;
        }
    }

  format_name = gdk_atom_name (format);
  g_warning ("%s: \"%s\" is not registered as deserializable format "
             "with text buffer %p",
             G_STRFUNC, format_name ? format_name : "not a GdkAtom", buffer);
  g_free (format_name);

  return FALSE;
}
开发者ID:BYC,项目名称:gtk,代码行数:43,代码来源:gtktextbufferrichtext.c

示例9: wikipad_document_notify_has_selection

static void
wikipad_document_notify_has_selection (GtkTextBuffer    *buffer,
                                        GParamSpec       *pspec,
                                        WikipadDocument *document)
{
  gint     selection;
  gboolean is_column_selection;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (WIKIPAD_IS_DOCUMENT (document));

  /* get length of the selection */
  selection = wikipad_view_get_selection_length (document->textview, &is_column_selection);

  /* don't send large numbers */
  if (selection > 1)
    selection = 1;

  /* if it's a column selection with content */
  if (selection == 1 && is_column_selection)
    selection = 2;

  /* emit the signal */
  g_signal_emit (G_OBJECT (document), document_signals[SELECTION_CHANGED], 0, selection);
}
开发者ID:paulmadore,项目名称:wikipad,代码行数:25,代码来源:wikipad-document.c

示例10: ide_highlight_engine__buffer_delete_range_cb

static void
ide_highlight_engine__buffer_delete_range_cb (IdeHighlightEngine *self,
        GtkTextIter        *range_begin,
        GtkTextIter        *range_end,
        IdeBuffer          *buffer)
{
    GtkTextBuffer *text_buffer = (GtkTextBuffer *)buffer;
    GtkTextIter begin;
    GtkTextIter end;

    IDE_ENTRY;

    g_assert (IDE_IS_HIGHLIGHT_ENGINE (self));
    g_assert (range_begin);
    g_assert (IDE_IS_BUFFER (buffer));
    g_assert (GTK_IS_TEXT_BUFFER (text_buffer));

    /*
     * No need to use the range_end since everything that
     * was after range_end will now be after range_begin
     */
    begin = *range_begin;
    end = *range_begin;

    invalidate_and_highlight (self, &begin, &end);

    IDE_EXIT;
}
开发者ID:sramkrishna,项目名称:gnome-builder,代码行数:28,代码来源:ide-highlight-engine.c

示例11: xfce_about_copyright

static void
xfce_about_copyright (GtkTextBuffer *buffer)
{
  GtkTextIter end;

  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));

  gtk_text_buffer_get_end_iter (buffer, &end);

  gtk_text_buffer_insert (buffer, &end,
      _("Xfce 4 is copyright Olivier Fourdan ([email protected]). The different "
        "components are copyrighted by their respective authors."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
  gtk_text_buffer_insert (buffer, &end,
      _("The libxfce4ui, libxfce4util and exo packages are "
        "distributed under the terms of the GNU Library General Public License as "
        "published by the Free Software Foundation; either version 2 of the License, or "
        "(at your option) any later version."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
  gtk_text_buffer_insert (buffer, &end,
      _("The packages thunar, xfce4-appfinder, xfce4-panel, xfce4-session, "
        "xfce4-settings, xfconf, xfdesktop and xfwm4 are "
        "distributed under the terms of the GNU General Public License as "
        "published by the Free Software Foundation; either version 2 of the "
        "License, or (at your option) any later version."), -1);

  gtk_text_buffer_insert (buffer, &end, "\n", -1);
}
开发者ID:xfce-mirror,项目名称:libxfce4ui,代码行数:30,代码来源:main.c

示例12: xfce_about_license

static void
xfce_about_license (GtkBuilder *builder,
                    GObject    *buffer)
{
  GObject         *dialog;
  GObject         *object;
  static gboolean  initial = TRUE;

  g_return_if_fail (GTK_IS_BUILDER (builder));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));

  object = gtk_builder_get_object (builder, "license-textview");
  gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), GTK_TEXT_BUFFER (buffer));

  dialog = gtk_builder_get_object (builder, "license-dialog");
  if (initial)
    {
      g_signal_connect (G_OBJECT (dialog), "delete-event",
           G_CALLBACK (gtk_widget_hide_on_delete), NULL);

      object = gtk_builder_get_object (builder, "license-close-button");
      g_signal_connect_swapped (G_OBJECT (object), "clicked",
          G_CALLBACK (gtk_widget_hide), dialog);

      object = gtk_builder_get_object (builder, "window");
      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (object));

      initial = FALSE;
    }

  gtk_widget_show (GTK_WIDGET (dialog));
}
开发者ID:xfce-mirror,项目名称:libxfce4ui,代码行数:32,代码来源:main.c

示例13: ide_highlight_engine__buffer_insert_text_cb

static void
ide_highlight_engine__buffer_insert_text_cb (IdeHighlightEngine *self,
        GtkTextIter        *location,
        gchar              *text,
        gint                len,
        IdeBuffer          *buffer)
{
    GtkTextBuffer *text_buffer = (GtkTextBuffer *)buffer;
    GtkTextIter begin;
    GtkTextIter end;

    IDE_ENTRY;

    g_assert (IDE_IS_HIGHLIGHT_ENGINE (self));
    g_assert (location);
    g_assert (text);
    g_assert (IDE_IS_BUFFER (buffer));
    g_assert (GTK_IS_TEXT_BUFFER (text_buffer));

    /*
     * Backward the begin iter len characters from location
     * (location points to the end of the string) in order to get
     * the iter position where our inserted text was started.
     */
    begin = *location;
    gtk_text_iter_backward_chars (&begin, g_utf8_strlen (text, len));

    end = *location;

    invalidate_and_highlight (self, &begin, &end);

    IDE_EXIT;
}
开发者ID:sramkrishna,项目名称:gnome-builder,代码行数:33,代码来源:ide-highlight-engine.c

示例14: gtk_text_buffer_register_serialize_format

/**
 * gtk_text_buffer_register_serialize_format:
 * @buffer: a #GtkTextBuffer
 * @mime_type: the format's mime-type
 * @function: the serialize function to register
 * @user_data: %function's user_data
 * @user_data_destroy: a function to call when @user_data is no longer needed
 *
 * This function registers a rich text serialization @function along with
 * its @mime_type with the passed @buffer.
 *
 * Return value: (transfer none): the #GdkAtom that corresponds to the
 *               newly registered format's mime-type.
 *
 * Since: 2.10
 **/
GdkAtom
gtk_text_buffer_register_serialize_format (GtkTextBuffer              *buffer,
                                           const gchar                *mime_type,
                                           GtkTextBufferSerializeFunc  function,
                                           gpointer                    user_data,
                                           GDestroyNotify              user_data_destroy)
{
  GList   *formats;
  GdkAtom  atom;

  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), GDK_NONE);
  g_return_val_if_fail (mime_type != NULL && *mime_type != '\0', GDK_NONE);
  g_return_val_if_fail (function != NULL, GDK_NONE);

  formats = g_object_steal_qdata (G_OBJECT (buffer), serialize_quark ());

  formats = register_format (formats, mime_type,
                             (gpointer) function,
                             user_data, user_data_destroy,
                             &atom);

  g_object_set_qdata_full (G_OBJECT (buffer), serialize_quark (),
                           formats, (GDestroyNotify) free_format_list);

  g_object_notify (G_OBJECT (buffer), "copy-target-list");

  return atom;
}
开发者ID:BYC,项目名称:gtk,代码行数:44,代码来源:gtktextbufferrichtext.c

示例15: ide_source_snippet_after_delete_range

void
ide_source_snippet_after_delete_range (IdeSourceSnippet *self,
                                       GtkTextBuffer    *buffer,
                                       GtkTextIter      *begin,
                                       GtkTextIter      *end)
{
  GtkTextMark *here;

  g_return_if_fail (IDE_IS_SOURCE_SNIPPET (self));
  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
  g_return_if_fail (begin);
  g_return_if_fail (end);

  here = gtk_text_buffer_create_mark (buffer, NULL, begin, TRUE);

  ide_source_snippet_update_context (self);
  ide_source_snippet_update_context (self);
  ide_source_snippet_rewrite_updated_chunks (self);

  gtk_text_buffer_get_iter_at_mark (buffer, begin, here);
  gtk_text_buffer_get_iter_at_mark (buffer, end, here);
  gtk_text_buffer_delete_mark (buffer, here);

#if 0
  ide_source_snippet_context_dump (self->snippet_context);
#endif
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:27,代码来源:ide-source-snippet.c


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