summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-02-26 21:46:12 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-02-26 21:46:12 +0000
commit5d67bb43568b52c35e281c8b28f051ff2000e9b8 (patch)
treeaf0b0ca1f4f9a5cf0eb63117f2af3251505ca31e /src/ui
parentDutch translation: minor update (diff)
downloadinkscape-5d67bb43568b52c35e281c8b28f051ff2000e9b8.tar.gz
inkscape-5d67bb43568b52c35e281c8b28f051ff2000e9b8.zip
Import deprecated GtkRuler API. Probably worth tidying :-)
Fixed bugs: - https://launchpad.net/bugs/802125 (bzr r11023)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/widget/ruler.cpp9
-rw-r--r--src/ui/widget/ruler.h401
2 files changed, 403 insertions, 7 deletions
diff --git a/src/ui/widget/ruler.cpp b/src/ui/widget/ruler.cpp
index cf0241fd1..a0ad3b391 100644
--- a/src/ui/widget/ruler.cpp
+++ b/src/ui/widget/ruler.cpp
@@ -20,7 +20,6 @@
#include <glibmm/i18n.h>
-#include <gtkmm/ruler.h>
#include "helper/units.h"
#include "widgets/ruler.h"
#include "ui/widget/ruler.h"
@@ -46,7 +45,7 @@ Ruler::init(SPDesktop *dt, Gtk::Widget &w)
_canvas_widget = &w;
_dragging = false;
_guide = 0;
- sp_ruler_set_metric(GTK_RULER(_r->gobj()), SP_PT);
+ sp_ruler_set_metric(GTK_DEPRECATED_RULER(_r->gobj()), SP_PT);
_r->set_range(-500, 500, 0, 1000);
}
@@ -67,7 +66,7 @@ void
Ruler::update_metric()
{
if (!_dt) return;
- sp_ruler_set_metric(GTK_RULER(_r->gobj()), _dt->namedview->getDefaultMetric());
+ sp_ruler_set_metric(GTK_DEPRECATED_RULER(_r->gobj()), _dt->namedview->getDefaultMetric());
}
/// Returns text to be used for tooltip for ruler.
@@ -168,7 +167,7 @@ Ruler::on_button_release_event(GdkEventButton *evb)
HRuler::HRuler()
{
_dt = 0;
- _r = static_cast<Gtk::HRuler*>(Glib::wrap(static_cast<GtkWidget*> (sp_hruler_new())));
+ _r = static_cast<Gtk::Deprecated::HRuler*>(Glib::wrap(static_cast<GtkWidget*> (sp_hruler_new())));
add(*_r);
_horiz_f = true;
}
@@ -181,7 +180,7 @@ HRuler::~HRuler()
VRuler::VRuler()
{
_dt = 0;
- _r = static_cast<Gtk::VRuler*>(Glib::wrap(static_cast<GtkWidget*> (sp_vruler_new())));
+ _r = static_cast<Gtk::Deprecated::VRuler*>(Glib::wrap(static_cast<GtkWidget*> (sp_vruler_new())));
add(*_r);
_horiz_f = false;
}
diff --git a/src/ui/widget/ruler.h b/src/ui/widget/ruler.h
index 1a455a325..e29b8f8a4 100644
--- a/src/ui/widget/ruler.h
+++ b/src/ui/widget/ruler.h
@@ -18,9 +18,406 @@ class SPDesktop;
namespace Glib {
class ustring;
}
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GtkDeprecatedRuler GtkDeprecatedRuler;
+typedef struct _GtkDeprecatedRulerClass GtkDeprecatedRulerClass;
+typedef struct _GtkDeprecatedVRuler GtkDeprecatedVRuler;
+typedef struct _GtkDeprecatedVRulerClass GtkDeprecatedVRulerClass;
+typedef struct _GtkDeprecatedHRuler GtkDeprecatedHRuler;
+typedef struct _GtkDeprecatedHRulerClass GtkDeprecatedHRulerClass;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+
+// This is an import of the now-deprecated Gtk::Ruler class.
+
namespace Gtk {
- class Ruler;
+namespace Deprecated {
+class Ruler_Class;
+class VRuler_Class;
+class HRuler_Class;
+
+/** Base class for horizontal or vertical rulers.
+ *
+ * This is an abstract base for Gtk::HRuler and
+ * Gtk::VRuler. Users should only instantiate those types.
+ */
+
+class Ruler : public Widget
+{
+ public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ typedef Ruler CppObjectType;
+ typedef Ruler_Class CppClassType;
+ typedef GtkDeprecatedRuler BaseObjectType;
+ typedef GtkDeprecatedRulerClass BaseClassType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+ virtual ~Ruler();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+ friend class Ruler_Class;
+ static CppClassType ruler_class_;
+
+ // noncopyable
+ Ruler(const Ruler&);
+ Ruler& operator=(const Ruler&);
+
+protected:
+ explicit Ruler(const Glib::ConstructParams& construct_params);
+ explicit Ruler(GtkDeprecatedRuler* castitem);
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+public:
+#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 GtkObject.
+ GtkDeprecatedRuler* gobj() { return reinterpret_cast<GtkDeprecatedRuler*>(gobject_); }
+
+ ///Provides access to the underlying C GtkObject.
+ const GtkDeprecatedRuler* gobj() const { return reinterpret_cast<GtkDeprecatedRuler*>(gobject_); }
+
+
+public:
+ //C++ methods used to invoke GTK+ virtual functions:
+
+protected:
+ //GTK+ Virtual Functions (override these to change behaviour):
+
+ //Default Signal Handlers::
+
+
+private:
+
+
+protected:
+ Ruler();
+
+public:
+
+
+ /** Sets the desired metric of the ruler. The possible choices are:
+ * <ul><li>Gtk::PIXELS
+ * <li>Gtk::INCHES
+ * <li>Gtk::CENTIMETERS
+ * </ul>The default metric is Gtk::PIXELS.
+ */
+ void set_metric(MetricType metric = PIXELS);
+
+
+ /** Gets the units used for a Gtk::Ruler. See set_metric().
+ * @return The units currently used for @a ruler
+ *
+ * @a Deprecated: 2.24: Gtk::Ruler has been removed from GTK 3 for being
+ * unmaintained and too specialized. There is no replacement.
+ */
+ MetricType get_metric() const;
+
+#ifndef GTKMM_DISABLE_DEPRECATED
+
+ /** Gets the units used for a Gtk::Ruler. See set_metric().
+ * @deprecated Use the const version
+ * @return The units currently used for @a ruler
+ *
+ * @a Deprecated: 2.24: Gtk::Ruler has been removed from GTK 3 for being
+ * unmaintained and too specialized. There is no replacement.
+ */
+ MetricType get_metric();
+#endif // GTKMM_DISABLE_DEPRECATED
+
+
+#ifndef GTKMM_DISABLE_DEPRECATED
+
+//TODO: Remove these when we can break ABI:
+
+ /** @deprecated Use get_range() instead.
+ */
+ double get_range_lower() const;
+
+ /** @deprecated Use get_range() instead.
+ */
+ double get_range_upper() const;
+ #endif // GTKMM_DISABLE_DEPRECATED
+
+
+ /** sets the range of the ruler.
+ * <i>upper</i> and <i>lower</i> arguments denote the extents of the Ruler.
+ * <i>max_size</i> is the largest number displayed by the ruler.
+ * <i>position</i> gives the initial value of the ruler.
+ * Rulers do not have sane defaults so this function should always be called.
+ */
+ void set_range(double lower, double upper, double position, double max_size);
+
+ /** Retrieves values indicating the range and current position of a Gtk::Ruler.
+ * See set_range().
+ *
+ * @a Deprecated: 2.24: Gtk::Ruler has been removed from GTK 3 for being
+ * unmaintained and too specialized. There is no replacement.
+ * @param lower Location to store lower limit of the ruler, or <tt>0</tt>.
+ * @param upper Location to store upper limit of the ruler, or <tt>0</tt>.
+ * @param position Location to store the current position of the mark on the ruler, or <tt>0</tt>.
+ * @param max_size Location to store the maximum size of the ruler used when calculating
+ * the space to leave for the text, or <tt>0</tt>.
+ */
+ void get_range(double& lower, double& upper, double& position, double& max_size);
+
+
+ /** draw tick marks on the ruler
+ */
+ void draw_ticks();
+
+
+ /** draw a position indicator on the ruler
+ */
+ void draw_pos();
+
+ virtual void draw_ticks_vfunc();
+
+ virtual void draw_pos_vfunc();
+
+
+ #ifdef GLIBMM_PROPERTIES_ENABLED
+/** Lower limit of ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy<double> property_lower() ;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+/** Lower limit of ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy_ReadOnly<double> property_lower() const;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+ #ifdef GLIBMM_PROPERTIES_ENABLED
+/** Upper limit of ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy<double> property_upper() ;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+/** Upper limit of ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy_ReadOnly<double> property_upper() const;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+ #ifdef GLIBMM_PROPERTIES_ENABLED
+/** Position of mark on the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy<double> property_position() ;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+/** Position of mark on the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy_ReadOnly<double> property_position() const;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+ #ifdef GLIBMM_PROPERTIES_ENABLED
+/** Maximum size of the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy<double> property_max_size() ;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+/** Maximum size of the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy_ReadOnly<double> property_max_size() const;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+ #ifdef GLIBMM_PROPERTIES_ENABLED
+/** The metric used for the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy<MetricType> property_metric() ;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+#ifdef GLIBMM_PROPERTIES_ENABLED
+/** The metric used for the ruler.
+ *
+ * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
+ * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
+ * the value of the property changes.
+ */
+ Glib::PropertyProxy_ReadOnly<MetricType> property_metric() const;
+#endif //#GLIBMM_PROPERTIES_ENABLED
+
+
+};
+
+
+/** Vertical Ruler */
+class VRuler : public Ruler
+{
+ public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ typedef VRuler CppObjectType;
+ typedef VRuler_Class CppClassType;
+ typedef GtkDeprecatedVRuler BaseObjectType;
+ typedef GtkDeprecatedVRulerClass BaseClassType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+ virtual ~VRuler();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+ friend class VRuler_Class;
+ static CppClassType vruler_class_;
+
+ // noncopyable
+ VRuler(const VRuler&);
+ VRuler& operator=(const VRuler&);
+
+protected:
+ explicit VRuler(const Glib::ConstructParams& construct_params);
+ explicit VRuler(GtkDeprecatedVRuler* castitem);
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+public:
+#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 GtkObject.
+ GtkDeprecatedVRuler* gobj() { return reinterpret_cast<GtkDeprecatedVRuler*>(gobject_); }
+
+ ///Provides access to the underlying C GtkObject.
+ const GtkDeprecatedVRuler* gobj() const { return reinterpret_cast<GtkDeprecatedVRuler*>(gobject_); }
+
+
+public:
+ //C++ methods used to invoke GTK+ virtual functions:
+
+protected:
+ //GTK+ Virtual Functions (override these to change behaviour):
+
+ //Default Signal Handlers::
+
+
+private:
+
+
+public:
+ VRuler();
+
+
+}; //class VRuler
+
+/** Horizontal Ruler */
+class HRuler : public Ruler
+{
+ public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ typedef HRuler CppObjectType;
+ typedef HRuler_Class CppClassType;
+ typedef GtkDeprecatedHRuler BaseObjectType;
+ typedef GtkDeprecatedHRulerClass BaseClassType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+ virtual ~HRuler();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+ friend class HRuler_Class;
+ static CppClassType hruler_class_;
+
+ // noncopyable
+ HRuler(const HRuler&);
+ HRuler& operator=(const HRuler&);
+
+protected:
+ explicit HRuler(const Glib::ConstructParams& construct_params);
+ explicit HRuler(GtkDeprecatedHRuler* castitem);
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+public:
+#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 GtkObject.
+ GtkDeprecatedHRuler* gobj() { return reinterpret_cast<GtkDeprecatedHRuler*>(gobject_); }
+
+ ///Provides access to the underlying C GtkObject.
+ const GtkDeprecatedHRuler* gobj() const { return reinterpret_cast<GtkDeprecatedHRuler*>(gobject_); }
+
+
+public:
+ //C++ methods used to invoke GTK+ virtual functions:
+
+protected:
+ //GTK+ Virtual Functions (override these to change behaviour):
+
+ //Default Signal Handlers::
+
+
+private:
+
+
+public:
+ HRuler();
+
+
+}; // class HRuler
+
+
}
+}
+
+
+
namespace Inkscape {
namespace UI {
namespace Widget {
@@ -41,7 +438,7 @@ protected:
SPDesktop *_dt;
SPCanvasItem *_guide;
Gtk::Widget *_canvas_widget;
- Gtk::Ruler *_r;
+ Gtk::Deprecated::Ruler *_r;
bool _horiz_f, _dragging;
virtual bool on_button_press_event (GdkEventButton *);