andrewm@0
|
1 /*
|
andrewm@0
|
2 TouchKeys: multi-touch musical keyboard control software
|
andrewm@0
|
3 Copyright (c) 2013 Andrew McPherson
|
andrewm@0
|
4
|
andrewm@0
|
5 This program is free software: you can redistribute it and/or modify
|
andrewm@0
|
6 it under the terms of the GNU General Public License as published by
|
andrewm@0
|
7 the Free Software Foundation, either version 3 of the License, or
|
andrewm@0
|
8 (at your option) any later version.
|
andrewm@0
|
9
|
andrewm@0
|
10 This program is distributed in the hope that it will be useful,
|
andrewm@0
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
andrewm@0
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
andrewm@0
|
13 GNU General Public License for more details.
|
andrewm@0
|
14
|
andrewm@0
|
15 You should have received a copy of the GNU General Public License
|
andrewm@0
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
andrewm@0
|
17
|
andrewm@0
|
18 =====================================================================
|
andrewm@0
|
19
|
andrewm@0
|
20 GraphicsDisplayWindow.h: window containing an OpenGL graphics display,
|
andrewm@0
|
21 for example the KeyboardDisplay visualization.
|
andrewm@0
|
22 */
|
andrewm@0
|
23
|
andrewm@0
|
24 #ifndef __GRAPHICSDISPLAYWINDOW_H_AD5467BB__
|
andrewm@0
|
25 #define __GRAPHICSDISPLAYWINDOW_H_AD5467BB__
|
andrewm@0
|
26
|
andrewm@0
|
27 #ifndef TOUCHKEYS_NO_GUI
|
andrewm@0
|
28
|
andrewm@0
|
29 #include "../JuceLibraryCode/JuceHeader.h"
|
andrewm@17
|
30 #include "../Display/KeyboardDisplay.h"
|
andrewm@0
|
31 #include "../Display/OpenGLJuceCanvas.h"
|
andrewm@0
|
32
|
andrewm@0
|
33 //==============================================================================
|
andrewm@0
|
34 /*
|
andrewm@0
|
35 */
|
andrewm@0
|
36 class GraphicsDisplayWindow : public DocumentWindow
|
andrewm@0
|
37 {
|
andrewm@0
|
38 public:
|
andrewm@17
|
39 GraphicsDisplayWindow(String name, KeyboardDisplay& display)
|
andrewm@46
|
40 : DocumentWindow(name, Colours::lightgrey, DocumentWindow::allButtons, false),
|
andrewm@17
|
41 display_(display)
|
andrewm@0
|
42 {
|
andrewm@0
|
43 // Initialize an OpenGL graphics object as the content with a default size
|
andrewm@17
|
44 OpenGLJuceCanvas *canvas = new OpenGLJuceCanvas(display_);
|
andrewm@0
|
45 canvas->setSize(300,200);
|
andrewm@0
|
46
|
andrewm@0
|
47 // Set properties
|
andrewm@0
|
48 setContentOwned(canvas, true);
|
andrewm@0
|
49 setUsingNativeTitleBar(true);
|
andrewm@0
|
50 setResizable(true, true);
|
andrewm@17
|
51 getConstrainer()->setFixedAspectRatio(display_.keyboardAspectRatio());
|
andrewm@0
|
52 setBoundsConstrained(getBounds());
|
andrewm@0
|
53
|
andrewm@41
|
54 // Don't show window yet
|
andrewm@41
|
55 setVisible(false);
|
andrewm@0
|
56 }
|
andrewm@0
|
57
|
andrewm@0
|
58 ~GraphicsDisplayWindow()
|
andrewm@0
|
59 {
|
andrewm@0
|
60 }
|
andrewm@0
|
61
|
andrewm@0
|
62 void closeButtonPressed()
|
andrewm@0
|
63 {
|
andrewm@0
|
64 setVisible(false);
|
andrewm@0
|
65 }
|
andrewm@0
|
66
|
andrewm@0
|
67
|
andrewm@0
|
68 private:
|
andrewm@17
|
69 KeyboardDisplay& display_;
|
andrewm@0
|
70
|
andrewm@0
|
71 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphicsDisplayWindow)
|
andrewm@0
|
72 };
|
andrewm@0
|
73
|
andrewm@0
|
74 #endif // TOUCHKEYS_NO_GUI
|
andrewm@0
|
75
|
andrewm@0
|
76 #endif // __GRAPHICSDISPLAYWINDOW_H_AD5467BB__
|