1 // -*- c++ -*-
2 // Generated by gmmproc 2.46.1 -- DO NOT MODIFY!
3 #ifndef _GTKSOURCEVIEWMM_COMPLETION_H
4 #define _GTKSOURCEVIEWMM_COMPLETION_H
5 
6 
7 #include <glibmm/ustring.h>
8 #include <sigc++/sigc++.h>
9 
10 /* completion.h
11  *
12  * Copyright (C) 2009, 2010, 2011 Krzesimir Nowak
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28 
29 #include <vector>
30 
31 #include <glibmm/object.h>
32 
33 #include <gtksourceviewmm/completioncontext.h>
34 #include <gtksourceviewmm/completionprovider.h>
35 #include <gtksourceviewmm/view.h>
36 #include <gtksourceviewmm/completioninfo.h>
37 
38 
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
40 typedef struct _GtkSourceCompletion GtkSourceCompletion;
41 typedef struct _GtkSourceCompletionClass GtkSourceCompletionClass;
42 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
43 
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 namespace Gsv
47 { class Completion_Class; } // namespace Gsv
48 #endif //DOXYGEN_SHOULD_SKIP_THIS
49 
50 namespace Gsv
51 {
52 
53 class CompletionContext;
54 class CompletionProvider;
55 
56 class SourceCompletionError : public Glib::Error
57 {
58 public:
59   /**
60    */
61   enum Code
62   {
63     ALREADY_BOUND,
64     NOT_BOUND
65   };
66 
67   SourceCompletionError(Code error_code, const Glib::ustring& error_message);
68   explicit SourceCompletionError(GError* gobject);
69   Code code() const;
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 private:
73 
74   static void throw_func(GError* gobject);
75 
76   friend void wrap_init(); // uses throw_func()
77 
78   #endif //DOXYGEN_SHOULD_SKIP_THIS
79 };
80 
81 } // namespace Gsv
82 
83 #ifndef DOXYGEN_SHOULD_SKIP_THIS
84 namespace Glib
85 {
86 
87 template <>
88 class Value<Gsv::SourceCompletionError::Code> : public Glib::Value_Enum<Gsv::SourceCompletionError::Code>
89 {
90 public:
91   static GType value_type() G_GNUC_CONST;
92 };
93 
94 } // namespace Glib
95 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
96 
97 
98 namespace Gsv
99 {
100 
101 
102 /** Main Completion Object
103  *
104  * @newin{2,10}
105  */
106 
107 class Completion : public Glib::Object
108 {
109 
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
111 
112 public:
113   typedef Completion CppObjectType;
114   typedef Completion_Class CppClassType;
115   typedef GtkSourceCompletion BaseObjectType;
116   typedef GtkSourceCompletionClass BaseClassType;
117 
118   // noncopyable
119   Completion(const Completion&) = delete;
120   Completion& operator=(const Completion&) = delete;
121 
122 private:  friend class Completion_Class;
123   static CppClassType completion_class_;
124 
125 protected:
126   explicit Completion(const Glib::ConstructParams& construct_params);
127   explicit Completion(GtkSourceCompletion* castitem);
128 
129 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
130 
131 public:
132 
133   Completion(Completion&& src) noexcept;
134   Completion& operator=(Completion&& src) noexcept;
135 
136   virtual ~Completion() noexcept;
137 
138   /** Get the GType for this class, for use with the underlying GObject type system.
139    */
140   static GType get_type()      G_GNUC_CONST;
141 
142 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143 
144 
145   static GType get_base_type() G_GNUC_CONST;
146 #endif
147 
148   ///Provides access to the underlying C GObject.
gobj()149   GtkSourceCompletion*       gobj()       { return reinterpret_cast<GtkSourceCompletion*>(gobject_); }
150 
151   ///Provides access to the underlying C GObject.
gobj()152   const GtkSourceCompletion* gobj() const { return reinterpret_cast<GtkSourceCompletion*>(gobject_); }
153 
154   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
155   GtkSourceCompletion* gobj_copy();
156 
157 private:
158 
159 public:
160 
161 
162   /** Add a new CompletionProvider to the completion object.
163    *
164    * This will add a reference provider.
165    *
166    * @param provider A CompletionProvider.
167    *
168    * @return @c true if provider was successfully added, otherwise error is
169    * thrown.
170    *
171    * @newin{2,10}
172    */
173   bool add_provider(const Glib::RefPtr<CompletionProvider>& provider);
174 
175 
176   /** Remove provider from the completion.
177    *
178    * @param provider A CompletionProvider.
179    *
180    * @return @c true if provider was successfully removed, otherwise error is
181    * thrown.
182    *
183    * @newin{2,10}
184    */
185   bool remove_provider(const Glib::RefPtr<CompletionProvider>& provider);
186 
187 
188   /** Get list of providers registered on completion.
189    *
190    * @return List of CompletionProvider.
191    *
192    * @newin{2,10}
193    */
194   std::vector<Glib::RefPtr<CompletionProvider> > get_providers() const;
195 
196 
197   /** Starts a new completion with the specified CompletionContext and
198    *  a list of potential candidate providers for completion.
199    *
200    * @param providers A list of CompletionProvider.
201    * @param context The CompletionContext with which to start the
202    * completion.
203    *
204    * @return @c true if it was possible to the show completion window.
205    *
206    * @newin{2,10}
207    */
208   bool show(const std::vector<Glib::RefPtr<CompletionProvider> >& providers, const Glib::RefPtr<CompletionContext>& context);
209 
210 
211   /** Hides the completion if it is active (visible).
212    *
213    * @newin{2,10}
214    */
215   void hide();
216 
217 
218   /** Gets the CompletionInfo window.
219    *
220    * The info widget is the window where the completion displays optional extra information of the proposal.
221    *
222    * @return The CompletionInfo window.
223    *
224    * @newin{2,10}
225    */
226   CompletionInfo* get_info_window();
227 
228 
229   /** Gets the CompletionInfo window.
230    *
231    * The info widget is the window where the completion displays optional extra information of the proposal.
232    *
233    * @return The CompletionInfo window.
234    *
235    * @newin{2,10}
236    */
237   const CompletionInfo* get_info_window() const;
238 
239 
240   /** Gets the View associated with completion.
241    *
242    * @return The View associated with completion.
243    *
244    * @newin{2,10}
245    */
246   View* get_view();
247 
248 
249   /** Gets the View associated with completion.
250    *
251    * @return The View associated with completion.
252    *
253    * @newin{2,10}
254    */
255   const View* get_view() const;
256 
257   // TODO: Does "The reference being returned is a 'floating' reference, so if you invoke gtk_source_completion_show with this context you don't need to unref it." something mean for us? krnowak
258 
259 
260   /** Create a new CompletionContext for completion.
261    *
262    * The position at which the completion using the new context will consider
263    * completion can be provided by @a position.
264    *
265    * @param position A Gtk::TextIter.
266    *
267    * @return A new CompletionContext.
268    *
269    * @newin{2,10}
270    */
271   Glib::RefPtr<CompletionContext> create_context(const Gtk::TextIter& position);
272 
273   // TODO: better wording could be used here - it is too convoluted. krnowak
274   /** Create a new CompletionContext for completion.
275    *
276    * The position at which the completion using the new context will consider
277    * completion is current cursor position.
278    *
279    * @return A new CompletionContext.
280    *
281    * @newin{2,10}
282    */
283   Glib::RefPtr<CompletionContext> create_context();
284 
285 
286 #ifndef GTKSOURCEVIEWMM_DISABLE_DEPRECATED
287 
288   /** Move the completion window to a specific iter.
289    *
290    * @param iter A Gtk::TextIter.
291    *
292    * @newin{2,10}
293    */
294   void move_window(const Gtk::TextIter& iter);
295 #endif // GTKSOURCEVIEWMM_DISABLE_DEPRECATED
296 
297 
298   /** Block interactive completion.
299    *
300    * This can be used to disable interactive completion when inserting or
301    * deleting text from the buffer associated with the completion. Use
302    * unblock_interactive() to enable interactive completion again.
303    *
304    * @newin{2,10}
305    */
306   void block_interactive();
307 
308 
309   /** Unblock interactive completion.
310    *
311    * This can be used after using block_interactive() to enable interactive
312    * completion again.
313    *
314    * @newin{2,10}
315    */
316   void unblock_interactive();
317 
318 
319   /** Emitted when the completion window is hidden.
320    *
321    * The default handler will actually hide the window.
322    *
323    * @newin{2,10}
324    *
325    * @par Slot Prototype:
326    * <tt>void on_my_%hide()</tt>
327    *
328    */
329 
330   Glib::SignalProxy0< void > signal_hide();
331 
332 
333   /** Emitted just before starting to populate the completion with providers.
334    *
335    * You can use this signal to add additional attributes in the context.
336    *
337    * @par Handler parameters:
338    * context The context for current completion.
339    *
340    * @newin{2,10}
341    *
342    * @par Slot Prototype:
343    * <tt>void on_my_%populate_context(const Glib::RefPtr<CompletionContext>& context)</tt>
344    *
345    */
346 
347   Glib::SignalProxy1< void,const Glib::RefPtr<CompletionContext>& > signal_populate_context();
348 
349 
350   /** Emitted when the completion window is shown.
351    *
352    * The default handler will actually show the window.
353    *
354    * @newin{2,10}
355    *
356    * @par Slot Prototype:
357    * <tt>void on_my_%show()</tt>
358    *
359    */
360 
361   Glib::SignalProxy0< void > signal_show();
362 
363 // those are keybinding signals, so ignore them
364 
365 
366   /** Number of proposal accelerators to show.
367    *
368    * @return A PropertyProxy that allows you to get or set the value of the property,
369    * or receive notification when the value of the property changes.
370    */
371   Glib::PropertyProxy< guint > property_accelerators() ;
372 
373 /** Number of proposal accelerators to show.
374    *
375    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
376    * or receive notification when the value of the property changes.
377    */
378   Glib::PropertyProxy_ReadOnly< guint > property_accelerators() const;
379 
380   /** Completion popup delay for interactive completion.
381    *
382    * @return A PropertyProxy that allows you to get or set the value of the property,
383    * or receive notification when the value of the property changes.
384    */
385   Glib::PropertyProxy< guint > property_auto_complete_delay() ;
386 
387 /** Completion popup delay for interactive completion.
388    *
389    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
390    * or receive notification when the value of the property changes.
391    */
392   Glib::PropertyProxy_ReadOnly< guint > property_auto_complete_delay() const;
393 
394   /** Proposal scrolling page size.
395    *
396    * @return A PropertyProxy that allows you to get or set the value of the property,
397    * or receive notification when the value of the property changes.
398    */
399   Glib::PropertyProxy< guint > property_proposal_page_size() ;
400 
401 /** Proposal scrolling page size.
402    *
403    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
404    * or receive notification when the value of the property changes.
405    */
406   Glib::PropertyProxy_ReadOnly< guint > property_proposal_page_size() const;
407 
408   /** Provider scrolling page size.
409    *
410    * @return A PropertyProxy that allows you to get or set the value of the property,
411    * or receive notification when the value of the property changes.
412    */
413   Glib::PropertyProxy< guint > property_provider_page_size() ;
414 
415 /** Provider scrolling page size.
416    *
417    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
418    * or receive notification when the value of the property changes.
419    */
420   Glib::PropertyProxy_ReadOnly< guint > property_provider_page_size() const;
421 
422   /** Remember the last info window visibility state.
423    *
424    * @return A PropertyProxy that allows you to get or set the value of the property,
425    * or receive notification when the value of the property changes.
426    */
427   Glib::PropertyProxy< bool > property_remember_info_visibility() ;
428 
429 /** Remember the last info window visibility state.
430    *
431    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
432    * or receive notification when the value of the property changes.
433    */
434   Glib::PropertyProxy_ReadOnly< bool > property_remember_info_visibility() const;
435 
436   /** Select first proposal when completion is shown.
437    *
438    * @return A PropertyProxy that allows you to get or set the value of the property,
439    * or receive notification when the value of the property changes.
440    */
441   Glib::PropertyProxy< bool > property_select_on_show() ;
442 
443 /** Select first proposal when completion is shown.
444    *
445    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
446    * or receive notification when the value of the property changes.
447    */
448   Glib::PropertyProxy_ReadOnly< bool > property_select_on_show() const;
449 
450   /** Show provider headers when proposals from multiple providers are available.
451    *
452    * @return A PropertyProxy that allows you to get or set the value of the property,
453    * or receive notification when the value of the property changes.
454    */
455   Glib::PropertyProxy< bool > property_show_headers() ;
456 
457 /** Show provider headers when proposals from multiple providers are available.
458    *
459    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
460    * or receive notification when the value of the property changes.
461    */
462   Glib::PropertyProxy_ReadOnly< bool > property_show_headers() const;
463 
464   /** Show provider and proposal icons in the completion popup.
465    *
466    * @return A PropertyProxy that allows you to get or set the value of the property,
467    * or receive notification when the value of the property changes.
468    */
469   Glib::PropertyProxy< bool > property_show_icons() ;
470 
471 /** Show provider and proposal icons in the completion popup.
472    *
473    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
474    * or receive notification when the value of the property changes.
475    */
476   Glib::PropertyProxy_ReadOnly< bool > property_show_icons() const;
477 
478   /** The GtkSourceView bound to the completion.
479    *
480    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
481    * or receive notification when the value of the property changes.
482    */
483   Glib::PropertyProxy_ReadOnly< View* > property_view() const;
484 
485 
486 public:
487 
488 public:
489   //C++ methods used to invoke GTK+ virtual functions:
490 
491 protected:
492   //GTK+ Virtual Functions (override these to change behaviour):
493 
494   //Default Signal Handlers::
495   /// This is a default handler for the signal signal_hide().
496   virtual void on_hide();
497   /// This is a default handler for the signal signal_populate_context().
498   virtual void on_populate_context(const Glib::RefPtr<CompletionContext>& context);
499   /// This is a default handler for the signal signal_show().
500   virtual void on_show();
501 
502 
503 };
504 
505 } /* namespace Gsv */
506 
507 
508 namespace Glib
509 {
510   /** A Glib::wrap() method for this object.
511    *
512    * @param object The C instance.
513    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
514    * @result A C++ instance that wraps this C instance.
515    *
516    * @relates Gsv::Completion
517    */
518   Glib::RefPtr<Gsv::Completion> wrap(GtkSourceCompletion* object, bool take_copy = false);
519 }
520 
521 
522 #endif /* _GTKSOURCEVIEWMM_COMPLETION_H */
523 
524