/* Copyright (C) 2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

_DEFS(atkmm,atk)

#include <glibmm/interface.h>
#include <atkmm/range.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
  typedef struct _AtkValueIface AtkValueIface;
  typedef struct _AtkValue      AtkValue;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Atk
{

/** The ATK interface implemented by valuators and components which display or select a value from a bounded range of values.
 * This should be implemented for components which either display a value from a bounded range, or which allow the user
 * to specify a value from a bounded range, or both. For instance, most sliders and range controls, as well as dials,
 * should have Atk::Object representations which implement Atk::Value on the component's behalf. Atk::Values may be
 * read-only, in which case attempts to alter the value return false to indicate failure.
 */
class ATKMM_API Value : public Glib::Interface
{
  _CLASS_INTERFACE(Value, AtkValue, ATK_VALUE, AtkValueIface, , , ATKMM_API)

public:
  _WRAP_METHOD(void get_current_value(Glib::ValueBase& value) const, atk_value_get_current_value, deprecated "Use get_value_and_text() instead.")
  _WRAP_METHOD(void get_maximum_value(Glib::ValueBase& value) const, atk_value_get_maximum_value, deprecated "Use get_range() instead.")
  _WRAP_METHOD(void get_minimum_value(Glib::ValueBase& value) const, atk_value_get_minimum_value, deprecated "Use get_range() instead.")
  _WRAP_METHOD(bool set_current_value(const Glib::ValueBase& value), atk_value_set_current_value, deprecated "Use set_value() instead.")

  /** Gets the current value and the human readable text alternative.
   *
   * @newin{2,24}
   */
  void get_value_and_text(double& value, Glib::ustring& text);
  _IGNORE(atk_value_get_value_and_text)

  _WRAP_METHOD(Range get_range() const, atk_value_get_range)

  _WRAP_METHOD(double get_increment(), atk_value_get_increment)

  _WRAP_METHOD(void set_value(const gdouble new_value), atk_value_set_value)

  _IGNORE(atk_value_get_minimum_increment)

  //TODO: atk_value_get_sub_ranges ()


protected:
  _WRAP_VFUNC(void get_current_value(Glib::ValueBase& value) const, get_current_value)
  _WRAP_VFUNC(void get_maximum_value(Glib::ValueBase& value) const, get_maximum_value)
  _WRAP_VFUNC(void get_minimum_value(Glib::ValueBase& value) const, get_minimum_value)
  _WRAP_VFUNC(bool set_current_value(const Glib::ValueBase& value), set_current_value)
};

} // namespace Atk
