/usr/include/plotmm/plot.h is in libplotmm-dev 0.1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* PlotMM Widget Library
* Copyright (C) 2004 Andy Thaller
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the LGPL
*****************************************************************************/
#ifndef PLOTMM_PLOT_H
#define PLOTMM_PLOT_H
#include <map>
#include <gtkmm/drawingarea.h>
#include <gtkmm/table.h>
#include <gtkmm/frame.h>
#include <plotmm/scale.h>
#include <plotmm/rectangle.h>
#include <plotmm/doubleintmap.h>
namespace Gdk {
class Pixmap;
}
namespace Pango {
class Layout;
class FontDescription;
}
namespace PlotMM
{
class Curve;
/*! @brief Class to draw labels in a plot.
*
*/
class PlotLabel : public Gtk::DrawingArea
{
public:
PlotLabel(Gtk::Widget *w,Gtk::Orientation o,const Glib::ustring & ="");
void set_text(const Glib::ustring &);
Glib::ustring get_text();
Pango::FontDescription *font() { return &font_; }
void set_enabled(bool b);
bool enabled() const { return enabled_; }
protected:
virtual bool on_expose_event(GdkEventExpose* event);
virtual void on_realize();
virtual void update_();
Glib::RefPtr<Gdk::Pixmap> rotate_right_(Glib::RefPtr<Gdk::Pixmap>);
Glib::RefPtr<Gdk::Pixmap> rotate_left_(Glib::RefPtr<Gdk::Pixmap>);
Glib::RefPtr<Gdk::Window> window_;
Glib::RefPtr<Gdk::GC> gc_;
Pango::FontDescription font_;
private:
Glib::RefPtr<Gdk::Pixmap> buffer_;
Glib::RefPtr<Pango::Layout> layout_;
Gtk::Widget *widget_;
Gtk::Orientation orientation_;
bool tainted_;
bool enabled_;
};
/*! @brief Class to draw curves in a plot.
*
*/
class PlotCanvas : public Gtk::DrawingArea
{
public:
PlotCanvas(Gtk::Widget *w);
virtual ~PlotCanvas();
virtual bool begin_replot();
virtual void clear();
virtual void end_replot();
sigc::signal3<void,int,int,GdkEventButton*> signal_plot_mouse_press;
sigc::signal3<void,int,int,GdkEventButton*> signal_plot_mouse_release;
sigc::signal3<void,int,int,GdkEventMotion*> signal_plot_mouse_move;
protected:
virtual bool on_expose_event(GdkEventExpose* event);
virtual void on_realize();
virtual bool on_button_press_event(GdkEventButton* event);
virtual bool on_button_release_event(GdkEventButton* event);
virtual bool on_motion_notify_event (GdkEventMotion* event);
Glib::RefPtr<Gdk::GC> gc_;
Glib::RefPtr<Gdk::Window> window_;
private:
bool replotting_;
Gdk::Color black_, grey_, white_;
Gtk::Widget *widget_;
};
/*! brief Class relating a curve to a plot.
*
*/
/*
class PlotCurve
{
public:
void set_enabled(bool b) { enabled_= b; }
bool enabled() { return enabled_; }
};
*/
/*! @brief defines available plot axes
*/
enum PlotAxisID
{
AXIS_TOP,
AXIS_BOTTOM,
AXIS_LEFT,
AXIS_RIGHT
};
/*! @brief Class implementing a plot widget.
*
*/
class Plot : public Gtk::Frame
{
public:
Plot();
virtual ~Plot();
int add_curve(const Glib::RefPtr<Curve> &,
PlotAxisID xaxis=AXIS_BOTTOM,
PlotAxisID yaxis=AXIS_LEFT,
bool enable= true);
void replot();
PlotLabel *title() { return &title_; }
Scale *scale(PlotAxisID id) { return tickMark_[id]; }
PlotLabel *label(PlotAxisID id) { return axisLabel_[id]; }
sigc::signal3<void,int,int,GdkEventButton*> signal_plot_mouse_press();
sigc::signal3<void,int,int,GdkEventButton*> signal_plot_mouse_release();
sigc::signal3<void,int,int,GdkEventMotion*> signal_plot_mouse_move();
void set_selection(const Rectangle &r);
Rectangle get_selection() { return select_; }
void enable_selection();
void disable_selection();
protected:
Gtk::Table layout_;
PlotCanvas canvas_;
std::vector<Scale*> tickMark_;
std::vector<ScaleLabels*> tickLabel_;
std::vector<PlotLabel*> axisLabel_;
PlotLabel title_;
virtual bool on_canvas_expose_event(GdkEventExpose* event);
virtual void draw_selection_();
private:
int loop;
double alpha;
int curveidx_;
bool draw_select_;
Rectangle select_;
Gdk::Color black_, grey_, white_;
struct CurveInfo {
Glib::RefPtr<Curve> curve;
PlotAxisID xaxis;
PlotAxisID yaxis;
};
std::map<int,CurveInfo> plotDict_;
};
}
#endif//PLOTMM_PLOT_H
|