// -*- c++ -*- // Generated by gtkmmproc -- DO NOT MODIFY! #ifndef _GTKSOURCEVIEWMM_SOURCELANGUAGEMANAGER_H #define _GTKSOURCEVIEWMM_SOURCELANGUAGEMANAGER_H #include <glibmm.h> /* sourcebuffer.hg * * Copyright (C) 2004-2005 Jae Jang * Copyright (C) 2005-2006 Rob Page * Copyright (C)2006 Dodji Seketeli * * This library is free software; you can redistribute it and/or * modify it 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. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /// \file /// \brief SourceLanguageManager class #include <glibmm/object.h> #include <gtksourceviewmm/sourcelanguage.h> #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GtkSourceLanguageManager GtkSourceLanguageManager; typedef struct _GtkSourceLanguageManagerClass GtkSourceLanguageManagerClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ namespace gtksourceview { class SourceLanguageManager_Class; } // namespace gtksourceview namespace gtksourceview { /// \brief manages the languages supported by the SourceBuffer. class SourceLanguageManager : public Glib::Object { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: typedef SourceLanguageManager CppObjectType; typedef SourceLanguageManager_Class CppClassType; typedef GtkSourceLanguageManager BaseObjectType; typedef GtkSourceLanguageManagerClass BaseClassType; private: friend class SourceLanguageManager_Class; static CppClassType sourcelanguagemanager_class_; private: // noncopyable SourceLanguageManager(const SourceLanguageManager&); SourceLanguageManager& operator=(const SourceLanguageManager&); protected: explicit SourceLanguageManager(const Glib::ConstructParams& construct_params); explicit SourceLanguageManager(GtkSourceLanguageManager* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: virtual ~SourceLanguageManager(); #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_type() G_GNUC_CONST; static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GObject. GtkSourceLanguageManager* gobj() { return reinterpret_cast<GtkSourceLanguageManager*>(gobject_); } ///Provides access to the underlying C GObject. const GtkSourceLanguageManager* gobj() const { return reinterpret_cast<GtkSourceLanguageManager*>(gobject_); } ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. GtkSourceLanguageManager* gobj_copy(); private: protected: SourceLanguageManager(); public: /// \brief creates an instance of SourceLanguageManager /// /// \return the newly created instance of SourceLanguageManager static Glib::RefPtr<SourceLanguageManager> create(); /** Returns: a Gtk::SourceLanguageManager. Return value is owned * @return A Gtk::SourceLanguageManager. Return value is owned * by GtkSourceView library and must not be unref'ed. */ static Glib::RefPtr<SourceLanguageManager> get_default(); /** Gets the list directories where @a lm looks for language files. * @return <tt>0</tt>-terminated array containg a list of language files directories. * The array is owned by @a lm and must not be modified. */ Glib::StringArrayHandle get_search_path() const; /** Sets the list of directories where the @a lm looks for * language files. * If @a dirs is <tt>0</tt>, the search path is reset to default. * * <note> * * At the moment this function can be called only before the * language files are loaded for the first time. In practice * to set a custom search path for a Gtk::SourceLanguageManager, * you have to call this function right after creating it. * * </note> * @param dirs A <tt>0</tt>-terminated array of strings or <tt>0</tt>. */ void set_search_path(const Glib::StringArrayHandle& dirs); /** Returns: a <tt>0</tt>-terminated array of string containing the ids of the * @return A <tt>0</tt>-terminated array of string containing the ids of the * available languages or <tt>0</tt> if no language is available. The array * is owned by @a lm and must not be modified. */ Glib::StringArrayHandle get_language_ids() const; /** Gets the Gtk::SourceLanguage identified by the given @a id in the language * manager. * @param id A language id. * @return A Gtk::SourceLanguage, or <tt>0</tt> if there is no language * identified by the given @a id. Return value is owned by @a lm and should not * be freed. */ Glib::RefPtr<SourceLanguage> get_language(const Glib::ustring& id); /** Gets the Gtk::SourceLanguage identified by the given @a id in the language * manager. * @param id A language id. * @return A Gtk::SourceLanguage, or <tt>0</tt> if there is no language * identified by the given @a id. Return value is owned by @a lm and should not * be freed. */ Glib::RefPtr<const SourceLanguage> get_language(const Glib::ustring& id) const; /** Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files. Either filename or content_type may be empty. This function can be used as follows: * @param filename A filename in Glib filename encoding, or <tt>0</tt>. * @param content_type A content type (as in GIO API), or <tt>0</tt>. * @return A Gtk::SourceLanguage, or <tt>0</tt> if there is no suitable language for given @a filename and/or @a content_type. * Return value is owned by @a lm and should not be freed. */ Glib::RefPtr<SourceLanguage> guess_language(const Glib::ustring& filename, const Glib::ustring& content_type); /** Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files. Either filename or content_type may be empty. This function can be used as follows: * @param filename A filename in Glib filename encoding, or <tt>0</tt>. * @param content_type A content type (as in GIO API), or <tt>0</tt>. * @return A Gtk::SourceLanguage, or <tt>0</tt> if there is no suitable language for given @a filename and/or @a content_type. * Return value is owned by @a lm and should not be freed. */ Glib::RefPtr<const SourceLanguage> guess_language(const Glib::ustring& filename, const Glib::ustring& content_type) const; public: public: //C++ methods used to invoke GTK+ virtual functions: #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED protected: //GTK+ Virtual Functions (override these to change behaviour): #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED //Default Signal Handlers:: #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED }; } /* namespace gtksourceview */ namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates gtksourceview::SourceLanguageManager */ Glib::RefPtr<gtksourceview::SourceLanguageManager> wrap(GtkSourceLanguageManager* object, bool take_copy = false); } #endif /* _GTKSOURCEVIEWMM_SOURCELANGUAGEMANAGER_H */