Flip stacked regions order so that the highest layer is at the top of the pile. ...
[ardour.git] / gtk2_ardour / port_matrix.h
1 /*
2     Copyright (C) 2002-2007 Paul Davis 
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
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_ui_port_matrix_h__
21 #define __ardour_ui_port_matrix_h__
22
23 #include <gtkmm/box.h>
24 #include <gtkmm/checkbutton.h>
25 #include <gtkmm/table.h>
26 #include <gtkmm/frame.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/scrolledwindow.h>
29
30 #include "ardour_dialog.h"
31 #include "port_group.h"
32 #include "matrix.h"
33
34 namespace ARDOUR {
35         class Session;
36         class IO;
37         class PortInsert;
38 }
39
40 class PortMatrix : public Gtk::VBox {
41   public:
42         PortMatrix (ARDOUR::Session&, ARDOUR::DataType, bool, PortGroupList::Mask);
43         ~PortMatrix ();
44
45         void redisplay ();
46
47         enum Result {
48                 Cancelled,
49                 Accepted
50         };
51
52         sigc::signal<void, Result> Finished;
53
54         void set_type (ARDOUR::DataType);
55         void set_offer_inputs (bool);
56         bool offering_input() const { return _offer_inputs; }
57
58         virtual void set_state (int, std::string const &, bool, uint32_t) = 0;
59         virtual bool get_state (int, std::string const &) const = 0;
60         virtual uint32_t n_rows () const = 0;
61         virtual uint32_t maximum_rows () const = 0;
62         virtual uint32_t minimum_rows () const = 0;
63         virtual std::string row_name (int) const = 0;
64         virtual void add_row () = 0;
65         virtual void remove_row (int) = 0;
66         virtual std::string row_descriptor () const = 0;
67
68         Gtk::Widget& scrolled_window() { return _scrolled_window; }
69
70   protected:
71
72         bool _offer_inputs;
73         void set_ports (const std::list<std::string>&);
74
75   private:
76         PortGroupList _port_group_list;
77         ARDOUR::DataType _type;
78         Matrix matrix;
79         std::vector<PortGroupUI*> _port_group_ui;
80         std::vector<Gtk::EventBox*> _row_labels;
81         Gtk::VBox* _row_labels_vbox;
82         Gtk::HBox _overall_hbox;
83         Gtk::VBox _side_vbox;
84         Gtk::HBox _port_group_hbox;
85         Gtk::ScrolledWindow _scrolled_window;
86         Gtk::Label* _side_vbox_pad;
87         Gtk::HBox _visibility_checkbutton_box;
88
89         void setup ();
90         void clear ();
91         void setup_dimensions ();
92         bool row_label_button_pressed (GdkEventButton*, int);
93         void reset_visibility ();
94 };
95
96 #endif