1 #ifndef __UI_WIDGET_RULER_H__
2 #define __UI_WIDGET_RULER_H__
4 /** \file
5 * Gtkmm facade/wrapper around sp_rulers.
6 *
7 * Authors:
8 * Ralf Stephan <ralf@ark.in-berlin.de>
9 *
10 * Copyright (C) 2005 The Authors
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #include <gtkmm/eventbox.h>
16 #include "libnr/nr-point.h"
18 struct SPCanvasItem;
19 struct SPDesktop;
20 namespace Glib {
21 class ustring;
22 }
23 namespace Gtk {
24 class Ruler;
25 }
26 namespace Inkscape {
27 namespace UI {
28 namespace Widget {
30 class Ruler : public Gtk::EventBox
31 {
32 public:
33 void init (SPDesktop*, Gtk::Widget&);
34 void get_range (double&, double&, double&, double&);
35 void set_range (double, double, double, double);
36 void update_metric();
37 Glib::ustring get_tip();
39 protected:
40 SPDesktop *_dt;
41 SPCanvasItem *_guide;
42 Gtk::Widget *_canvas_widget;
43 Gtk::Ruler *_r;
44 bool _horiz_f, _dragging;
46 virtual bool on_button_press_event (GdkEventButton *);
47 virtual bool on_motion_notify_event (GdkEventMotion *);
48 virtual bool on_button_release_event (GdkEventButton *);
50 private:
51 void canvas_get_pointer (int&, int&);
52 NR::Point get_event_dt();
53 };
55 /// Horizontal ruler
56 class HRuler : public Ruler
57 {
58 public:
59 HRuler();
60 ~HRuler();
61 };
63 /// Vertical ruler
64 class VRuler : public Ruler
65 {
66 public:
67 VRuler();
68 ~VRuler();
69 };
71 } // namespace Widget
72 } // namespace UI
73 } // namespace Inkscape
76 #endif
79 /*
80 Local Variables:
81 mode:c++
82 c-file-style:"stroustrup"
83 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84 indent-tabs-mode:nil
85 fill-column:99
86 End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :