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: vectordrawer_8h-source.html,v 1.1 2007-09-10 23:31:15 rafi Exp $ 00022 // 00023 // File: vectordrawer.h 00024 // Author: Rafael Ostertag 00025 // 00026 // Created on July 17, 2007, 10:19 PM 00027 // 00028 00031 00032 #ifndef _VECTORDRAWER_H 00033 #define _VECTORDRAWER_H 00034 00035 #include <string> 00036 00037 #include <gvectors.h> 00038 #include <gtkmm.h> 00039 00042 class VectorDrawer : public GVectors::Drawer { 00043 private: 00044 Cairo::RefPtr<Cairo::Context> cairo_ctx; 00047 double height; 00048 00051 std::string text; 00053 bool put_text; 00056 bool text_drawn; 00057 00058 public: 00059 VectorDrawer(Cairo::RefPtr<Cairo::Context> cc, double h); 00060 VectorDrawer(const VectorDrawer& vd); 00061 ~VectorDrawer(); 00063 inline void set_text(std::string& t) { text = t; text_drawn = false; } 00065 inline void set_text(const char* t) { text = t; text_drawn = false; } 00067 inline void clear_text() { text.clear(); text_drawn = false; } 00069 inline std::string& get_text() { return text; } 00071 inline void set_put_text(bool pt=true) { put_text = pt; text_drawn = false; } 00073 inline bool is_set_put_text() const { return put_text; } 00075 void line(const GVectors::Segment& segment); 00076 }; 00077 00078 #endif /* _VECTORDRAWER_H */ 00079
1.4.7