Ardour  9.0-pre0-582-g084a23a80d
widgets/widgets/frame.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 _WIDGETS_FRAME_H_
20 #define _WIDGETS_FRAME_H_
21 
22 #include <optional>
23 #include <gtkmm/bin.h>
24 
25 #include "gtkmm2ext/colors.h"
26 #include "gtkmm2ext/cairo_theme.h"
27 #include "widgets/visibility.h"
28 
29 namespace ArdourWidgets {
30 
32 {
33 public:
34  enum Orientation {
36  Vertical
37  };
38 
39  Frame (Orientation orientation = Horizontal, bool force_boxy = false);
40  ~Frame ();
41 
42  void set_label (std::string const&);
43  void set_padding (int);
46 
47  void set_draw (bool yn);
48  bool draw() const { return _draw; }
49 
50 protected:
56  void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
57  void on_name_changed ();
58 
59 private:
60  Glib::RefPtr<Gtk::Style> get_parent_style ();
61 
65  sigc::connection _parent_style_change;
66  Glib::RefPtr<Pango::Layout> _layout;
67  std::string _label_text;
68  std::optional<Gdk::Color> _edge_color;
70 
71  int _border;
72  int _padding;
78  int _alloc_x0;
79  int _alloc_y0;
80  bool _boxy;
81  bool _draw;
82 };
83 
84 } // namespace ArdourWidgets
85 
86 #endif
void on_size_request(GtkRequisition *)
This is a default handler for the signal signal_size_request().
sigc::connection _parent_style_change
void set_label(std::string const &)
void on_add(Gtk::Widget *)
This is a default handler for the signal signal_add().
void on_size_allocate(Gtk::Allocation &)
This is a default handler for the signal signal_size_allocate().
bool on_expose_event(GdkEventExpose *)
This is a default handler for the signal signal_expose_event().
void set_draw(bool yn)
Frame(Orientation orientation=Horizontal, bool force_boxy=false)
void set_edge_color(Gtkmm2ext::Color)
Glib::RefPtr< Pango::Layout > _layout
Glib::RefPtr< Gtk::Style > get_parent_style()
void on_remove(Gtk::Widget *)
This is a default handler for the signal signal_remove().
std::optional< Gdk::Color > _edge_color
void on_style_changed(const Glib::RefPtr< Gtk::Style > &)
Definition: bin.h:55
@ Horizontal
Definition: editing.h:250
@ Vertical
Definition: editing.h:249
uint32_t Color
Definition: colors.h:33
#define LIBWIDGETS_API