Ardour  9.0-pre0-582-g084a23a80d
canvas/canvas/button.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011-2013 Paul Davis
3  Author: Carl Hetherington <cth@carlh.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #pragma once
21 
22 #include <cairomm/pattern.h>
23 
24 #include "canvas/visibility.h"
25 #include "canvas/rectangle.h"
26 #include "canvas/types.h"
27 
28 namespace Pango {
29  class FontDescription;
30 }
31 
32 namespace ArdourCanvas
33 {
34 class Text;
35 
37 {
38 public:
39  Button (Canvas*, double width, double height, Pango::FontDescription const &);
40  Button (Item*, double width, double height, Pango::FontDescription const &);
41 
42  Button (Canvas*, std::string const &, Pango::FontDescription const &);
43  Button (Item*, std::string const &, Pango::FontDescription const &);
44 
45  void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
46  void compute_bounding_box () const;
47 
48  void set_label (std::string const &);
49  std::string label() const;
50  Text* text() const { return _label; }
51 
52  void set_size (double w, double h);
53  void set_highlight (bool);
54 
55  private:
56  double width;
57  double height;
59  bool prelight;
60  bool highlight;
61  bool clicking;
63 
65  void init ();
66 };
67 
68 }
69 
#define LIBCANVAS_API
void set_highlight(bool)
Button(Item *, std::string const &, Pango::FontDescription const &)
void render(Rect const &, Cairo::RefPtr< Cairo::Context >) const
Button(Canvas *, std::string const &, Pango::FontDescription const &)
void compute_bounding_box() const
bool event_handler(GdkEvent *)
std::string label() const
void set_label(std::string const &)
void set_size(double w, double h)
Button(Canvas *, double width, double height, Pango::FontDescription const &)
Button(Item *, double width, double height, Pango::FontDescription const &)
gint height
Definition: xcursors.h:1
gint width
Definition: xcursors.h:1