summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/ruler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget/ruler.h')
-rw-r--r--src/ui/widget/ruler.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/ui/widget/ruler.h b/src/ui/widget/ruler.h
new file mode 100644
index 000000000..74dbf028c
--- /dev/null
+++ b/src/ui/widget/ruler.h
@@ -0,0 +1,88 @@
+#ifndef __UI_WIDGET_RULER_H__
+#define __UI_WIDGET_RULER_H__
+
+/** \file
+ * Gtkmm facade/wrapper around sp_rulers.
+ *
+ * Authors:
+ * Ralf Stephan <ralf@ark.in-berlin.de>
+ *
+ * Copyright (C) 2005 The Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <gtkmm/eventbox.h>
+#include "libnr/nr-point.h"
+
+struct SPCanvasItem;
+struct SPDesktop;
+namespace Glib {
+ class ustring;
+}
+namespace Gtk {
+ class Ruler;
+}
+namespace Inkscape {
+ namespace UI {
+ namespace Widget {
+
+class Ruler : public Gtk::EventBox
+{
+public:
+ void init (SPDesktop*, Gtk::Widget&);
+ void get_range (double&, double&, double&, double&);
+ void set_range (double, double, double, double);
+ void update_metric();
+ Glib::ustring get_tip();
+
+protected:
+ SPDesktop *_dt;
+ SPCanvasItem *_guide;
+ Gtk::Widget *_canvas_widget;
+ Gtk::Ruler *_r;
+ bool _horiz_f, _dragging;
+
+ virtual bool on_button_press_event (GdkEventButton *);
+ virtual bool on_motion_notify_event (GdkEventMotion *);
+ virtual bool on_button_release_event (GdkEventButton *);
+
+private:
+ void canvas_get_pointer (int&, int&);
+ NR::Point get_event_dt();
+};
+
+/// Horizontal ruler
+class HRuler : public Ruler
+{
+public:
+ HRuler();
+ ~HRuler();
+};
+
+/// Vertical ruler
+class VRuler : public Ruler
+{
+public:
+ VRuler();
+ ~VRuler();
+};
+
+} // namespace Widget
+} // namespace UI
+} // namespace Inkscape
+
+
+#endif
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :