5bca604f0c06d7d3c0c8d746e2aabefb53d2bb43
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

1) /*
2)  * EtherPix simulator
3)  *
4)  * Copyright 2017 Stefan Schuermans <stefan schuermans info>
5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #ifndef DRAW_H
21) #define DRAW_H
22) 
23) #include <gtkmm.h>
24) 
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

25) #include "config.h"
26) 
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

27) /// drawing area
28) class Draw: public Gtk::DrawingArea
29) {
30) public:
31)   /**
32)    * @brief constructor
33)    * @param[in] Gtk Window object (a C object)
34)    * @param[in] builder reference to GTK builder object
35)    */
36)   Draw(BaseObjectType *cobject,
37)        const Glib::RefPtr<Gtk::Builder> &builder);
38) 
39)   /// virtual destructor
40)   virtual ~Draw();
41) 
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

42)   /// set configuration object
43)   void setConfig(Config const&config);
Stefan Schuermans begin of simulator: window...

Stefan Schuermans authored 7 years ago

44) 
45) protected:
46)   /**
47)    * @brief widget is (re)configured
48)    * @param[in] cfg configuration event
49)    * @return if callback was completely handled
50)    */
51)   virtual bool on_configure_event(GdkEventConfigure *cfg);
52) 
53)   /**
54)    * @brief widget is being drawn
55)    * @param[in] cairo cairo context for drawing
56)    * @return if callback was completely handled
57)    */
58)   virtual bool on_draw(const Cairo::RefPtr<Cairo::Context> &cairo);
59) 
60)   /// update image
61)   void updateImage();
62) 
63) protected:
64)   /// reference to GTK builder object
65)   Glib::RefPtr<Gtk::Builder> m_builder;
66) 
67)   /// cairo surface with current simulator image
68)   Cairo::RefPtr<Cairo::ImageSurface> m_image;
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

69) 
70)   /// configuration object
71)   Config const *m_config;