da.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // gvectors is a frontend to libgvectors using gtkmm.
00004 // Copyright (C) 2007  Rafael Ostertag
00005 //
00006 // This program is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU General Public License
00008 // as published by the Free Software Foundation; either version 2
00009 // of the License, or (at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
00019 // USA.
00020 //
00021 // $Id: da_8h-source.html,v 1.1 2007-09-10 23:31:14 rafi Exp $
00022 //
00023 // File:   da.h
00024 // Author: Rafael Ostertag
00025 //
00026 // Created on July 17, 2007, 9:47 PM
00027 //
00028 
00031 
00032 #ifndef _DA_H
00033 #define _DA_H
00034 
00035 #include <gtkmm.h>
00036 #include <gvectors.h>
00037 
00038 #include "vectorlist.h"
00039 
00040 // Forward declaration.
00041 class NTab;
00042 
00044 class DA : public Gtk::DrawingArea {
00045 private:
00047     Glib::RefPtr<Gdk::Window> window; // Set by prepare_for_drawing()
00049     GVectors::Coordinates common_origin; // Set by
00050                                          // prepare_for_drawing()
00053     Gtk::Allocation allocation; // Set by prepare_for_drawing()
00055     double height; // Set by prepare_for_drawing()
00057     double width; // Set by prepare_for_drawing()
00060     double line_width;
00061     
00063     GVectors::VectorStore &vstore;
00065     double scale;
00067     GVectors::Rotation rotation;
00068     
00069     bool left_mouse_button_pressed;
00078     bool use_mouse_coords_1;
00080     GVectors::Coordinates mouse_coords_1;
00082     GVectors::Coordinates mouse_coords_2;
00083     
00085     NTab& nt;
00086     
00087 protected:
00090     bool on_expose_event(GdkEventExpose* event);
00093     bool on_button_press_event(GdkEventButton *be);
00096     bool on_button_release_event(GdkEventButton *be);
00099     bool on_motion_notify_event(GdkEventMotion *em);
00101     void prepare_vectors();
00103     void prepare_for_drawing();
00104     
00105 public:
00106     DA(NTab& nt, GVectors::VectorStore& vs);
00107     virtual ~DA();
00108     
00109     void set_line_width(double lw);
00110     double get_line_width() const;
00111     
00112     void set_scale(double s);
00113     void set_rotation(GVectors::Rotation& r);
00114     
00115     double get_scale() const;
00116     GVectors::Rotation get_rotation() const;
00117     
00118     void check_dimension();
00119 };
00120 
00121 #endif  /* _DA_H */
00122 

Generated on Tue Sep 11 01:14:27 2007 for gvectors by  doxygen 1.4.7