/*
 * Copyright 1998-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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/adjustment.h>

#include <gtk/gtk.h>
#include <math.h>
#include <cstring> //For strlen()
#include <memory>

using std::strlen;

namespace Gtk
{

VScale::VScale(double min, double max, double step)
:
  _CONSTRUCT_SPECIFIC(Scale, VScale)
{
  Glib::RefPtr<Adjustment> adjustment = Adjustment::create(min, min, max, step, 10 * step, step);
  set_adjustment(adjustment);

  set_digits( calc_digits_(step) );
}

VScale::VScale(const Glib::RefPtr<Adjustment>& adjustment)
:
  _CONSTRUCT_SPECIFIC(Scale, VScale)
{
  set_adjustment(adjustment);
}

VScale::VScale()
:
  _CONSTRUCT_SPECIFIC(Scale, VScale)
{
  Glib::RefPtr<Adjustment> adjustment = Adjustment::create(0.0, 0.0, 0.0,
    0.0, 0.0, 0.0);
  set_adjustment(adjustment);
}

HScale::HScale(double min, double max, double step)
:
  _CONSTRUCT_SPECIFIC(Scale, HScale)
{
  Glib::RefPtr<Adjustment> adjustment = Adjustment::create(min, min, max, step, 10 * step, step);
  set_adjustment(adjustment);

  set_digits( calc_digits_(step) );
}

HScale::HScale()
:
  _CONSTRUCT_SPECIFIC(Scale, HScale)
{
  Glib::RefPtr<Adjustment> adjustment = Adjustment::create(0.0, 0.0, 0.0,
	  0.0, 0.0, 0.0);
  set_adjustment(adjustment);
}

HScale::HScale(const Glib::RefPtr<Adjustment>& adjustment)
:
  _CONSTRUCT_SPECIFIC(Scale, HScale)
{
  set_adjustment(adjustment);
}

} // namespace Gtk
