Ardour  9.2-129-gdf5e1050bd
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 
24 #include "canvas/canvas.h"
25 
26 namespace Cairo {
27  class ImageSurface;
28  class Context;
29  class Region;
30 }
31 
32 namespace ArdourSurface {
33 
34 class M2Device;
35 class Maschine2;
36 
37 /* A canvas which renders to the Push2 display */
38 
40 {
41  public:
44 
45  void request_redraw ();
47  void queue_resize ();
48  bool vblank ();
49 
50  Cairo::RefPtr<Cairo::Context> image_context() { return context; }
51 
52  ArdourCanvas::Coord width() const { return _width; }
53  ArdourCanvas::Coord height() const { return _height; }
54 
57 
58  /* API that does nothing since we have no input events */
59  void ungrab () {}
63  void re_enter() {}
64  void pick_current_item (int) {}
65  void pick_current_item (ArdourCanvas::Duple const &, int) {}
66  bool get_mouse_position (ArdourCanvas::Duple&) const { return false; }
67 
68  Glib::RefPtr<Pango::Context> get_pango_context ();
69 
70  private:
71  int _width;
72  int _height;
73 
74  Cairo::RefPtr<Cairo::Context> context;
75  Cairo::RefPtr<Cairo::Region> expose_region;
76  Glib::RefPtr<Pango::Context> pango_context;
77 
80 
81  bool expose ();
82 };
83 
84 } /* namespace ArdourSurface */
85 
86 #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()