![]() |
![]() |
![]() |
GtkSourceCompletion 2.0 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#define DEFAULT_PAGE gboolean (*GscCompletionFilterFunc) (GscProposal *proposal
,gpointer user_data
); GscCompletionPriv; GscCompletion; GscCompletionClass; GscCompletion * gsc_completion_get_from_view (GtkTextView *view
); GtkWidget * gsc_completion_new (GtkTextView *view
); GtkTextView * gsc_completion_get_view (GscCompletion *self
); GscTrigger * gsc_completion_get_trigger (GscCompletion *self
,const gchar *trigger_name
); GscProvider * gsc_completion_get_provider (GscCompletion *self
,const gchar *prov_name
); gboolean gsc_completion_register_provider (GscCompletion *self
,GscProvider *provider
,GscTrigger *trigger
); gboolean gsc_completion_unregister_provider (GscCompletion *self
,GscProvider *provider
,GscTrigger *trigger
); gboolean gsc_completion_register_trigger (GscCompletion *self
,GscTrigger *trigger
); gboolean gsc_completion_unregister_trigger (GscCompletion *self
,GscTrigger *trigger
); GscTrigger * gsc_completion_get_active_trigger (GscCompletion *self
); gboolean gsc_completion_trigger_event (GscCompletion *self
,GscTrigger *trigger
); void gsc_completion_finish_completion (GscCompletion *self
); void gsc_completion_filter_proposals (GscCompletion *self
,GscCompletionFilterFunc func
,gpointer user_data
); void gsc_completion_set_active (GscCompletion *self
,gboolean active
); gboolean gsc_completion_get_active (GscCompletion *self
); GtkWidget * gsc_completion_get_bottom_bar (GscCompletion *self
); GscInfo * gsc_completion_get_info_widget (GscCompletion *self
); gint gsc_completion_get_page_pos (GscCompletion *self
,const gchar *page_name
); gint gsc_completion_get_n_pages (GscCompletion *self
); gboolean gsc_completion_set_page_pos (GscCompletion *self
,const gchar *page_name
,gint position
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkWindow +----GscCompletion
"active" gboolean : Read / Write "manage-completion-keys" gboolean : Read / Write "remember-info-visibility" gboolean : Read / Write "select-on-show" gboolean : Read / Write
This is the main completion object. It manages all providers (GscProvider) and triggers (GscTrigger) for a GtkTextView..
gboolean (*GscCompletionFilterFunc) (GscProposal *proposal
,gpointer user_data
);
|
|
|
|
Returns : |
typedef struct { /* Widget and popup variables*/ GtkWidget *info_window; GtkWidget *info_button; GtkWidget *notebook; GtkWidget *tab_label; GtkWidget *next_page_button; GtkWidget *prev_page_button; GtkWidget *bottom_bar; GList *pages; GscCompletionPage *active_page; gboolean destroy_has_run; gboolean manage_keys; gboolean remember_info_visibility; gboolean info_visible; gboolean select_on_show; /* Completion management */ GtkTextView *view; GList *triggers; GList *prov_trig; GscTrigger *active_trigger; /*TRUE if the completion mechanism is active*/ gboolean active; gulong signals_ids[LAST_EXTERNAL_SIGNAL]; } GscCompletionPriv;
typedef struct { GtkWindowClass parent_class; gboolean (* proposal_selected)(GscCompletion *completion, GscProposal *proposal); gboolean (* display_info) (GscCompletion *completion, GscProposal *proposal); } GscCompletionClass;
GscCompletion * gsc_completion_get_from_view (GtkTextView *view
);
|
The GtkTextView associated with a GscCompletion |
Returns : |
The GscCompletion associated with a view or NULL .
|
GtkWidget * gsc_completion_new (GtkTextView *view
);
|
|
Returns : |
The new GscCompletion |
GtkTextView * gsc_completion_get_view (GscCompletion *self
);
|
The GscCompletion |
Returns : |
The view associated with this completion. |
GscTrigger * gsc_completion_get_trigger (GscCompletion *self
,const gchar *trigger_name
);
|
The GscCompletion |
|
The trigger name to find |
Returns : |
The GscTrigger registered with trigger_name , NULL if it cannot
be found
|
GscProvider * gsc_completion_get_provider (GscCompletion *self
,const gchar *prov_name
);
|
The GscCompletion |
|
The provider name to find |
Returns : |
The GscProvider registered with prov_name
|
gboolean gsc_completion_register_provider (GscCompletion *self
,GscProvider *provider
,GscTrigger *trigger
);
This function register the provider into the completion and reference it. When an event is raised, completion call to the provider to get the data. When the user select a proposal, it call the provider to tell it this action and the provider do that it want (normally inserts some text)
|
the GscCompletion |
|
The GscProvider. |
|
|
Returns : |
TRUE if it was registered or FALSE if not (because it has been already registered,
or the trigger doesn't exists)
|
gboolean gsc_completion_unregister_provider (GscCompletion *self
,GscProvider *provider
,GscTrigger *trigger
);
This function unregister the provider.
|
the GscCompletion |
|
The GscProvider. |
|
The trigger what you want to unregister this provider |
Returns : |
TRUE if it was unregistered or FALSE if not (because it doesn't exists, or the trigger don't exists) |
gboolean gsc_completion_register_trigger (GscCompletion *self
,GscTrigger *trigger
);
This function register a completion trigger. If the completion is actived then this method activate the trigger. This function reference the trigger object
|
The GscCompletion |
|
The trigger to register |
Returns : |
TRUE if the trigger has been registered
|
gboolean gsc_completion_unregister_trigger (GscCompletion *self
,GscTrigger *trigger
);
This function unregister a completion trigger. If the completion is actived then this method deactivate the trigger. This function unreference the trigger object
|
The GscCompletion |
|
The trigger to unregister |
Returns : |
TRUE if the trigger has been unregistered or FALSE if not (because
the trigger has not been registered)
|
GscTrigger * gsc_completion_get_active_trigger (GscCompletion *self
);
This function return the active trigger. The active trigger is the last trigger raised if the completion is active. If the completion is not visible then there is no an active trigger.
|
The GscCompletion |
Returns : |
The trigger or NULL if completion is not active |
gboolean gsc_completion_trigger_event (GscCompletion *self
,GscTrigger *trigger
);
Calling this function, the completion call to all providers to get data and, if they return data, it shows the completion to the user.
|
the GscCompletion |
|
The trigger who trigger the event |
Returns : |
TRUE if the event has been triggered, FALSE if not
|
void gsc_completion_finish_completion (GscCompletion *self
);
This function finish the completion if it is active (visible).
|
The GscCompletion |
void gsc_completion_filter_proposals (GscCompletion *self
,GscCompletionFilterFunc func
,gpointer user_data
);
This function call to func
for all proposal of all pages. func
must
return TRUE
if the proposal is visible or FALSE
if the completion must to
hide the proposal.
|
the GscCompletion |
|
function to filter the proposals visibility |
|
user data to pass to func |
void gsc_completion_set_active (GscCompletion *self
,gboolean active
);
This function activate/deactivate the completion mechanism. The completion connects/disconnect all signals and activate/deactivate all registered triggers.
|
The GscCompletion |
|
TRUE if you want to activate the completion mechanism.
|
gboolean gsc_completion_get_active (GscCompletion *self
);
|
The GscCompletion |
Returns : |
TRUE if the completion mechanism is active, FALSE if not.
|
GtkWidget * gsc_completion_get_bottom_bar (GscCompletion *self
);
The bottom bar is the widgetwith the info button, the page name etc.
|
The GscCompletion |
Returns : |
The bottom bar widget (it is a GtkBox by now) |
GscInfo * gsc_completion_get_info_widget (GscCompletion *self
);
The info widget is the window where the completion shows the proposal info or help. DO NOT USE IT (only to connect to some signal or set the content in a custom widget).
|
The GscCompletion |
Returns : |
The internal GscInfo widget. |
gint gsc_completion_get_page_pos (GscCompletion *self
,const gchar *page_name
);
Search the page position with the given name
|
The GscCompletion |
|
The page name to search |
Returns : |
the page position or -1 if it is not found |
gint gsc_completion_get_n_pages (GscCompletion *self
);
|
The GscCompletion |
Returns : |
The number of pages |
gboolean gsc_completion_set_page_pos (GscCompletion *self
,const gchar *page_name
,gint position
);
|
The GscCompletion |
|
The page name you want to set the position (stating by 1 because 0 is the default page) |
|
The new position of the page. If this is negative, or is larger than the number of elements in the list, the new element is added on to the end of the list |
Returns : |
TRUE if the position has been set.
|
"active"
property"active" gboolean : Read / Write
TRUE
if the completion mechanism is active.
Default value: FALSE
"manage-completion-keys"
property"manage-completion-keys" gboolean : Read / Write
TRUE
if this object must control the completion keys pressed into the
GtkTextView associated (up next proposal, down previous proposal etc.)
Default value: TRUE
"remember-info-visibility"
property"remember-info-visibility" gboolean : Read / Write
TRUE
if the completion must remember the last info state
(visible or hidden)
Default value: FALSE
"display-info"
signalgboolean user_function (GscCompletion *completion, gpointer proposal, gpointer user_data) : Run Last / Action
When the user want to see the information of a proposal
|
The GscCompletion who emits the signal |
|
The GscProposal the user wants to see the information |
|
user data set when the signal handler was connected. |
"proposal-selected"
signalgboolean user_function (GscCompletion *completion, gpointer proposal, gpointer user_data) : Run Last / Action
When the user selects a proposal
|
The GscCompletion who emits the signal |
|
The selected GscProposal |
|
user data set when the signal handler was connected. |