Ardour  9.0-pre0-582-g084a23a80d
surfaces/maschine2/canvas.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_maschine2_canvas_h_
20 #define _ardour_maschine2_canvas_h_
21 
22 #include <cairomm/refptr.h>
23 #include <glibmm/threads.h>
24 
25 #include "canvas/canvas.h"
26 
27 namespace Cairo {
28  class ImageSurface;
29  class Context;
30  class Region;
31 }
32 
33 namespace ArdourSurface {
34 
35 class M2Device;
36 class Maschine2;
37 
38 /* A canvas which renders to the Push2 display */
39 
41 {
42  public:
45 
46  void request_redraw ();
48  void queue_resize ();
49  bool vblank ();
50 
51  Cairo::RefPtr<Cairo::Context> image_context() { return context; }
52 
53  ArdourCanvas::Coord width() const { return _width; }
54  ArdourCanvas::Coord height() const { return _height; }
55 
58 
59  /* API that does nothing since we have no input events */
60  void ungrab () {}
64  void re_enter() {}
65  void pick_current_item (int) {}
66  void pick_current_item (ArdourCanvas::Duple const &, int) {}
67  bool get_mouse_position (ArdourCanvas::Duple&) const { return false; }
68 
69  Glib::RefPtr<Pango::Context> get_pango_context ();
70 
71  private:
72  int _width;
73  int _height;
74 
75  Cairo::RefPtr<Cairo::Context> context;
76  Cairo::RefPtr<Cairo::Region> expose_region;
77  Glib::RefPtr<Pango::Context> pango_context;
78 
81 
82  bool expose ();
83 };
84 
85 } /* namespace ArdourSurface */
86 
87 #endif
Declaration of the main canvas classes.
void request_size(ArdourCanvas::Duple)
void request_redraw(ArdourCanvas::Rect const &)
Cairo::RefPtr< Cairo::Context > image_context()
Cairo::RefPtr< Cairo::Region > expose_region
ArdourCanvas::Coord height() const
Maschine2Canvas(Maschine2 &, M2Device *)
void unfocus(ArdourCanvas::Item *)
bool get_mouse_position(ArdourCanvas::Duple &) const
Glib::RefPtr< Pango::Context > pango_context
Cairo::RefPtr< Cairo::Context > context
void pick_current_item(ArdourCanvas::Duple const &, int)
ArdourCanvas::Rect visible_area() const
ArdourCanvas::Coord width() const
Glib::RefPtr< Pango::Context > get_pango_context()