6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith/*
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * Author:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith *
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * Copyright (C) 2012 Author
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith *
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * Released under GNU GPL. Read the file 'COPYING' for more information.
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith */
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#ifndef INKSCAPE_UI_WIDGET_SPIN_SCALE_H
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#define INKSCAPE_UI_WIDGET_SPIN_SCALE_H
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
77c7ff125b9cf3d212f719f5dd1cbe67b51cf8e9Jon A. Cruz#ifdef HAVE_CONFIG_H
77c7ff125b9cf3d212f719f5dd1cbe67b51cf8e9Jon A. Cruz# include <config.h>
77c7ff125b9cf3d212f719f5dd1cbe67b51cf8e9Jon A. Cruz#endif
77c7ff125b9cf3d212f719f5dd1cbe67b51cf8e9Jon A. Cruz
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include <gtkmm/adjustment.h>
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include <gtkmm/box.h>
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include <gtkmm/scale.h>
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include <gtkmm/togglebutton.h>
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include "spinbutton.h"
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#include "attr-widget.h"
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithnamespace Inkscape {
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithnamespace UI {
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithnamespace Widget {
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith/**
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * Wrap the gimpspinscale class
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * A combo widget with label, scale slider, spinbutton and adjustment
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith */
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithclass SpinScale : public Gtk::HBox, public AttrWidget
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith{
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithpublic:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith SpinScale(const char* label, double value, double lower, double upper, double step_inc, double climb_rate,
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith SpinScale(const char* label,
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#if WITH_GTKMM_3_0
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Glib::RefPtr<Gtk::Adjustment> adj,
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#else
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Gtk::Adjustment *adj,
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#endif
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith virtual Glib::ustring get_as_attribute() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith virtual void set_from_attribute(SPObject*);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith // Shortcuts to _adjustment
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Glib::SignalProxy0<void> signal_value_changed();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith double get_value() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith void set_value(const double);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith void set_focuswidget(GtkWidget *widget);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith void set_appearance(const gchar* appearance);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#if WITH_GTKMM_3_0
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Glib::RefPtr<Gtk::Adjustment> get_adjustment();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#else
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith const Gtk::Adjustment *get_adjustment() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Gtk::Adjustment *get_adjustment();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#endif
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithprivate:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#if WITH_GTKMM_3_0
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Glib::RefPtr<Gtk::Adjustment> _adjustment;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#else
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Gtk::Adjustment *_adjustment;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#endif
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith GtkWidget *_spinscale;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith};
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith/**
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * Contains two SpinScales for controlling number-opt-number attributes.
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith *
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith * @see SpinScale
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith */
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithclass DualSpinScale : public Gtk::HBox, public AttrWidget
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith{
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithpublic:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith DualSpinScale(const char* label1, const char* label2, double value, double lower, double upper, double step_inc,
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith double climb_rate, int digits, const SPAttributeEnum, char* tip_text1, char* tip_text2);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith virtual Glib::ustring get_as_attribute() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith virtual void set_from_attribute(SPObject*);
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith sigc::signal<void>& signal_value_changed();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith const SpinScale& get_SpinScale1() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith SpinScale& get_SpinScale1();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith const SpinScale& get_SpinScale2() const;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith SpinScale& get_SpinScale2();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith //void remove_scale();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smithprivate:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith void link_toggled();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith void update_linked();
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith sigc::signal<void> _signal_value_changed;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith SpinScale _s1, _s2;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Gtk::ToggleButton _link;
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith};
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith} // namespace Widget
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith} // namespace UI
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith} // namespace Inkscape
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith#endif // INKSCAPE_UI_WIDGET_SPIN_SCALE_H
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith
375a47157c1740a5fdd9ad733c347a53381531abAlex Valavanis/*
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith Local Variables:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith mode:c++
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith c-file-style:"stroustrup"
375a47157c1740a5fdd9ad733c347a53381531abAlex Valavanis c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith indent-tabs-mode:nil
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith fill-column:99
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith End:
6bd7ac3b4704cf1cba90dd21a73bfedd6d640a16John Smith*/
375a47157c1740a5fdd9ad733c347a53381531abAlex Valavanis// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :