1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //    midi_editor_layout.h
5 //  (C) Copyright 2020 Tim E. Real (terminator356 on sourceforge)
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; version 2 of
10 //  the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 //=========================================================
22 
23 #ifndef __MIDI_EDITOR_LAYOUT_H__
24 #define __MIDI_EDITOR_LAYOUT_H__
25 
26 #include <QWidget>
27 #include <QGridLayout>
28 #include <QHBoxLayout>
29 #include <QAbstractButton>
30 #include <QRect>
31 
32 namespace MusEGui {
33 
34 //---------------------------------------------------------
35 //   MidiEditorCanvasLayout
36 //   For laying out a canvas as a last splitter widget and
37 //    automatically adjusting the width of its corresponding
38 //    horizontal scrollbar which is in another layout.
39 //---------------------------------------------------------
40 
41 class MidiEditorCanvasLayout : public QGridLayout
42       {
43       Q_OBJECT
44       QHBoxLayout* _hBox;
45 
46     public:
QGridLayout(parent)47       MidiEditorCanvasLayout(QWidget *parent, QHBoxLayout* hBox = nullptr) : QGridLayout(parent), _hBox(hBox) { };
hBox()48       QHBoxLayout* hBox() { return _hBox; }
setHBox(QHBoxLayout * l)49       void setHBox(QHBoxLayout* l) { _hBox = l; }
50       virtual void setGeometry(const QRect &rect);
51       };
52 
53 //---------------------------------------------------------
54 //   MidiEditorHScrollLayout
55 //   For laying out the bottom buttons and hscroll in the arranger.
56 //---------------------------------------------------------
57 
58 class MidiEditorHScrollLayout : public QHBoxLayout
59       {
60       Q_OBJECT
61       QWidget* _button1;
62       QWidget* _button2;
63       QWidget* _sb;
64       QWidget* _corner;
65 
66       // This is not actually in the layout, but used anyway.
67       QWidget* _editor;
68 
69       QWidgetItem* _button1Li;
70       QWidgetItem* _button2Li;
71       QSpacerItem* _spacerLi;
72       QWidgetItem* _sbLi;
73       QWidgetItem* _cornerLi;
74 
75     public:
76       MidiEditorHScrollLayout(QWidget *parent,
77                             QWidget* button1,
78                             QWidget* button2,
79                             QWidget* sb,
80                             QWidget* corner = nullptr,
81                             QWidget* editor = nullptr);
editor()82       QWidget* editor() { return _editor; }
setEditor(QWidget * w)83       void setEditor(QWidget* w) { _editor = w; }
84       virtual void setGeometry(const QRect &rect);
85       };
86 
87 }
88 
89 #endif
90 
91 
92