/* styleschememanager.h
 *
 * Copyright (C) 2008 Jonathon Jongsma
 * Copyright (C) 2009, 2010, 2011 Krzesimir Nowak
 *
 * 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.
 */

#include <vector>

#include <gtksourceview/gtksourcestyleschememanager.h>

#include <gtksourceviewmm/stylescheme.h>

_DEFS(gtksourceviewmm,gtksourceview)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gsv
{

/** Class providing access to SourceStyleSchemes.
 */
class StyleSchemeManager : public Glib::Object
{
  _CLASS_GOBJECT(StyleSchemeManager, GtkSourceStyleSchemeManager, GTK_SOURCE_STYLE_SCHEME_MANAGER, Glib::Object, GObject)

protected:
  _CTOR_DEFAULT

public:
  /** Creates a new style manager.
   *
   * If you do not need more than one style manager then use get_default()
   * instead.
   *
   * @return A StyleSchemeManager.
   */
  _WRAP_CREATE()

  /** Returns the default StyleSchemeManager instance.
   *
   * @return A StyleSchemeManager.
   */
  _WRAP_METHOD(static Glib::RefPtr<StyleSchemeManager> get_default(), gtk_source_style_scheme_manager_get_default, refreturn)

#m4 _CONVERSION(`const gchar**',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3, Glib::OWNERSHIP_NONE)')

  /** Returns the current search path for the manager.
   *
   * See set_search_path() for details.
   *
   * @return An array of string containing the search path.
   */
  _WRAP_METHOD(std::vector<std::string> get_search_path() const, gtk_source_style_scheme_manager_get_search_path)

#m4 _CONVERSION(`const std::vector<std::string>&',`gchar**',`const_cast<gchar**>(Glib::ArrayHandler<std::string>::vector_to_array($3).data())')

  /** Sets the list of directories where the manager looks for style scheme
   *  files.
   *
   * @param path An empty string terminated array of strings.
   */
  _WRAP_METHOD(void set_search_path(const std::vector<std::string>& path), gtk_source_style_scheme_manager_set_search_path)

  /** Resets the list of directories where the manager looks for style scheme
   *  files to default.
   */
  void reset_search_path();

  _WRAP_METHOD(void append_search_path(const std::string& path), gtk_source_style_scheme_manager_append_search_path)

  _WRAP_METHOD(void prepend_search_path(const std::string& path), gtk_source_style_scheme_manager_prepend_search_path)

  /** Looks up style scheme by id.
   *
   * @param scheme_id Style scheme id to find.
   *
   * @return A StyleScheme object.
   */
  _WRAP_METHOD(Glib::RefPtr<StyleScheme> get_scheme(const std::string& scheme_id), gtk_source_style_scheme_manager_get_scheme, refreturn)

  /** Looks up style scheme by id.
   *
   * @param scheme_id Style scheme id to find.
   *
   * @return A StyleScheme object.
   */
  _WRAP_METHOD(Glib::RefPtr<const StyleScheme> get_scheme(const std::string& scheme_id) const, gtk_source_style_scheme_manager_get_scheme, refreturn, constversion)

  /** Mark any currently cached information about the available style schemes
   *  as invalid.
   *
   * All the available style schemes will be reloaded next time the manager is
   * accessed.
   */
  _WRAP_METHOD(void force_rescan(), gtk_source_style_scheme_manager_force_rescan)

  /** Returns the ids of the available style schemes.
   *
   * @return An array of string containing the ids of the available style
   * schemes.
   */
  _WRAP_METHOD(std::vector<std::string> get_scheme_ids() const, gtk_source_style_scheme_manager_get_scheme_ids)

  _WRAP_PROPERTY("search-path", std::vector<std::string>)
  _WRAP_PROPERTY("scheme-ids", std::vector<std::string>)
};//end class StyleSchemeManager

}//end namespace Gsv


