GtkSourceCompletionInfo

GtkSourceCompletionInfo — Calltips object

Synopsis

#include <gtksourceview/gtksource.h>

                    GtkSourceCompletionInfo;
GtkSourceCompletionInfo * gtk_source_completion_info_new
                                                        (void);
void                gtk_source_completion_info_move_to_iter
                                                        (GtkSourceCompletionInfo *info,
                                                         GtkTextView *view,
                                                         GtkTextIter *iter);
void                gtk_source_completion_info_set_widget
                                                        (GtkSourceCompletionInfo *info,
                                                         GtkWidget *widget);
GtkWidget *         gtk_source_completion_info_get_widget
                                                        (GtkSourceCompletionInfo *info);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkWidget
               +----GtkContainer
                     +----GtkBin
                           +----GtkWindow
                                 +----GtkSourceCompletionInfo

Implemented Interfaces

GtkSourceCompletionInfo implements AtkImplementorIface and GtkBuildable.

Signals

  "before-show"                                    : Action

Description

This object can be used to show a calltip or help for the current completion proposal.

The info window has always the same size as the natural size of its child widget, added with gtk_container_add(). If you want a fixed size instead, a possibility is to use a scrolled window, as the following example demonstrates.

Example 1. Fixed size with a scrolled window.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25










GtkSourceCompletionInfo *info;
GtkWidget *your_widget;
GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);

gtk_widget_set_size_request (scrolled_window, 300, 200);
gtk_container_add (GTK_CONTAINER (scrolled_window), your_widget);
gtk_container_add (GTK_CONTAINER (info), scrolled_window);


If the calltip is displayed on top of a certain widget, say a GtkTextView, you should hide it when the "focus-out-event" signal is emitted by the GtkTextView. You may also be interested by the "cursor-position" property (when its value is modified). If you use the GtkSourceCompletionInfo through the GtkSourceCompletion machinery, you don't need to worry about this.

Details

GtkSourceCompletionInfo

typedef struct _GtkSourceCompletionInfo GtkSourceCompletionInfo;

gtk_source_completion_info_new ()

GtkSourceCompletionInfo * gtk_source_completion_info_new
                                                        (void);

Returns :

a new GtkSourceCompletionInfo.

gtk_source_completion_info_move_to_iter ()

void                gtk_source_completion_info_move_to_iter
                                                        (GtkSourceCompletionInfo *info,
                                                         GtkTextView *view,
                                                         GtkTextIter *iter);

Moves the GtkSourceCompletionInfo to iter. If iter is NULL info is moved to the cursor position. Moving will respect the GdkGravity setting of the info window and will ensure the line at iter is not occluded by the window.

info :

a GtkSourceCompletionInfo.

view :

a GtkTextView on which the info window should be positioned.

iter :

a GtkTextIter. [allow-none]

gtk_source_completion_info_set_widget ()

void                gtk_source_completion_info_set_widget
                                                        (GtkSourceCompletionInfo *info,
                                                         GtkWidget *widget);

Warning

gtk_source_completion_info_set_widget has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_container_add() instead. If there is already a child widget, remove it with gtk_container_remove().

Sets the content widget of the info window. See that the previous widget will lose a reference and it can be destroyed, so if you do not want this to happen you must use g_object_ref() before calling this method.

info :

a GtkSourceCompletionInfo.

widget :

a GtkWidget. [allow-none]

gtk_source_completion_info_get_widget ()

GtkWidget *         gtk_source_completion_info_get_widget
                                                        (GtkSourceCompletionInfo *info);

Warning

gtk_source_completion_info_get_widget has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_bin_get_child() instead.

Get the current content widget.

info :

a GtkSourceCompletionInfo.

Returns :

The current content widget. [transfer none]

Signal Details

The "before-show" signal

void                user_function                      (GtkSourceCompletionInfo *info,
                                                        gpointer                 user_data)      : Action

This signal is emitted before any "show" management. You can connect to this signal if you want to change some properties or position before the real "show".

info :

The GtkSourceCompletionInfo who emits the signal

user_data :

user data set when the signal handler was connected.