Back to index

easystroke  0.5.5.1
trace.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008-2009, Thomas Jaeger <ThJaeger@gmail.com>
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00011  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
00013  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00014  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 #ifndef __TRACE_H__
00017 #define __TRACE_H__
00018 
00019 #include <exception>
00020 #include <glibmm/i18n.h>
00021 
00022 struct DBusException: public std::exception {
00023        virtual const char* what() const throw() { return _("Connection to DBus failed"); }
00024 };
00025 
00026 class Trace {
00027 public:
00028        struct Point { float x; float y; };
00029 private:
00030        Point last;
00031        bool active;
00032 protected:
00033        virtual void draw(Point p, Point q) = 0;
00034        virtual void start_() = 0;
00035        virtual void end_() = 0;
00036 public:
00037        Trace() : active(false) {}
00038        void draw(Point p) { draw(last, p); last = p; }
00039        void start(Point p);
00040        void end();
00041        virtual void timeout() {}
00042        virtual ~Trace() {}
00043 };
00044 
00045 class Trivial : public Trace {
00046        virtual void draw(Point p, Point q) {}
00047        virtual void start_() {}
00048        virtual void end_() {}
00049 public:
00050 };
00051 
00052 #endif