ide-completion-provider.h 6.48 KB
Newer Older
1 2
/* ide-completion-provider.h
 *
3
 * Copyright © 2018 Christian Hergert <chergert@redhat.com>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

19
#pragma once
20

21
#include <gtk/gtk.h>
22

23
#include "ide-context.h"
24
#include "ide-version-macros.h"
25

26 27
#include "completion/ide-completion-types.h"

28 29
G_BEGIN_DECLS

30
#define IDE_TYPE_COMPLETION_PROVIDER (ide_completion_provider_get_type ())
31

32 33
IDE_AVAILABLE_IN_3_30
G_DECLARE_INTERFACE (IdeCompletionProvider, ide_completion_provider, IDE, COMPLETION_PROVIDER, GObject)
34 35 36

struct _IdeCompletionProviderInterface
{
37
  GTypeInterface parent;
38

39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  void        (*load)              (IdeCompletionProvider    *self,
                                    IdeContext               *context);
  GIcon      *(*get_icon)          (IdeCompletionProvider    *self);
  gint        (*get_priority)      (IdeCompletionProvider    *self,
                                    IdeCompletionContext     *context);
  gchar      *(*get_title)         (IdeCompletionProvider    *self);
  void        (*populate_async)    (IdeCompletionProvider    *self,
                                    IdeCompletionContext     *context,
                                    GCancellable             *cancellable,
                                    GAsyncReadyCallback       callback,
                                    gpointer                  user_data);
  GListModel *(*populate_finish)   (IdeCompletionProvider    *self,
                                    GAsyncResult             *result,
                                    GError                  **error);
  void        (*display_proposal)  (IdeCompletionProvider    *self,
                                    IdeCompletionListBoxRow  *row,
                                    IdeCompletionContext     *context,
                                    const gchar              *typed_text,
                                    IdeCompletionProposal    *proposal);
  void        (*activate_proposal) (IdeCompletionProvider    *self,
                                    IdeCompletionContext     *context,
                                    IdeCompletionProposal    *proposal,
                                    const GdkEventKey        *key);
  gboolean    (*refilter)          (IdeCompletionProvider    *self,
                                    IdeCompletionContext     *context,
                                    GListModel               *proposals);
  gboolean    (*is_trigger)        (IdeCompletionProvider    *self,
                                    const GtkTextIter        *iter,
                                    gunichar                  ch);
  gboolean    (*key_activates)     (IdeCompletionProvider    *self,
                                    IdeCompletionProposal    *proposal,
                                    const GdkEventKey        *key);
  gchar      *(*get_comment)       (IdeCompletionProvider    *self,
                                    IdeCompletionProposal    *proposal);
73 74
};

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
IDE_AVAILABLE_IN_3_30
GIcon      *ide_completion_provider_get_icon         (IdeCompletionProvider    *self);
IDE_AVAILABLE_IN_3_30
gint        ide_completion_provider_get_priority     (IdeCompletionProvider    *self,
                                                      IdeCompletionContext     *context);
IDE_AVAILABLE_IN_3_30
gchar      *ide_completion_provider_get_title        (IdeCompletionProvider    *self);
IDE_AVAILABLE_IN_3_30
void        ide_completion_provider_populate_async   (IdeCompletionProvider    *self,
                                                      IdeCompletionContext     *context,
                                                      GCancellable             *cancellable,
                                                      GAsyncReadyCallback       callback,
                                                      gpointer                  user_data);
IDE_AVAILABLE_IN_3_30
GListModel *ide_completion_provider_populate_finish  (IdeCompletionProvider    *self,
                                                      GAsyncResult             *result,
                                                      GError                  **error);
IDE_AVAILABLE_IN_3_30
void        ide_completion_provider_display_proposal (IdeCompletionProvider    *self,
                                                      IdeCompletionListBoxRow  *row,
                                                      IdeCompletionContext     *context,
                                                      const gchar              *typed_text,
                                                      IdeCompletionProposal    *proposal);
IDE_AVAILABLE_IN_3_30
void        ide_completion_provider_activate_poposal (IdeCompletionProvider    *self,
                                                      IdeCompletionContext     *context,
                                                      IdeCompletionProposal    *proposal,
                                                      const GdkEventKey        *key);
IDE_AVAILABLE_IN_3_30
gboolean    ide_completion_provider_refilter         (IdeCompletionProvider    *self,
                                                      IdeCompletionContext     *context,
                                                      GListModel               *proposals);
IDE_AVAILABLE_IN_3_30
gboolean    ide_completion_provider_is_trigger       (IdeCompletionProvider    *self,
                                                      const GtkTextIter        *iter,
                                                      gunichar                  ch);
IDE_AVAILABLE_IN_3_30
gboolean    ide_completion_provider_key_activates    (IdeCompletionProvider    *self,
                                                      IdeCompletionProposal    *proposal,
                                                      const GdkEventKey        *key);
IDE_AVAILABLE_IN_3_30
gchar      *ide_completion_provider_get_comment      (IdeCompletionProvider    *self,
                                                      IdeCompletionProposal    *proposal);
118 119

G_END_DECLS