andrewm@0: /* andrewm@0: TouchKeys: multi-touch musical keyboard control software andrewm@0: Copyright (c) 2013 Andrew McPherson andrewm@0: andrewm@0: This program is free software: you can redistribute it and/or modify andrewm@0: it under the terms of the GNU General Public License as published by andrewm@0: the Free Software Foundation, either version 3 of the License, or andrewm@0: (at your option) any later version. andrewm@0: andrewm@0: This program is distributed in the hope that it will be useful, andrewm@0: but WITHOUT ANY WARRANTY; without even the implied warranty of andrewm@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrewm@0: GNU General Public License for more details. andrewm@0: andrewm@0: You should have received a copy of the GNU General Public License andrewm@0: along with this program. If not, see . andrewm@0: andrewm@0: ===================================================================== andrewm@0: andrewm@0: GraphicsDisplayWindow.h: window containing an OpenGL graphics display, andrewm@0: for example the KeyboardDisplay visualization. andrewm@0: */ andrewm@0: andrewm@0: #ifndef __GRAPHICSDISPLAYWINDOW_H_AD5467BB__ andrewm@0: #define __GRAPHICSDISPLAYWINDOW_H_AD5467BB__ andrewm@0: andrewm@0: #ifndef TOUCHKEYS_NO_GUI andrewm@0: andrewm@0: #include "../JuceLibraryCode/JuceHeader.h" andrewm@17: #include "../Display/KeyboardDisplay.h" andrewm@0: #include "../Display/OpenGLJuceCanvas.h" andrewm@0: andrewm@0: //============================================================================== andrewm@0: /* andrewm@0: */ andrewm@0: class GraphicsDisplayWindow : public DocumentWindow andrewm@0: { andrewm@0: public: andrewm@17: GraphicsDisplayWindow(String name, KeyboardDisplay& display) andrewm@46: : DocumentWindow(name, Colours::lightgrey, DocumentWindow::allButtons, false), andrewm@17: display_(display) andrewm@0: { andrewm@0: // Initialize an OpenGL graphics object as the content with a default size andrewm@17: OpenGLJuceCanvas *canvas = new OpenGLJuceCanvas(display_); andrewm@0: canvas->setSize(300,200); andrewm@0: andrewm@0: // Set properties andrewm@0: setContentOwned(canvas, true); andrewm@0: setUsingNativeTitleBar(true); andrewm@0: setResizable(true, true); andrewm@17: getConstrainer()->setFixedAspectRatio(display_.keyboardAspectRatio()); andrewm@0: setBoundsConstrained(getBounds()); andrewm@0: andrewm@41: // Don't show window yet andrewm@41: setVisible(false); andrewm@0: } andrewm@0: andrewm@0: ~GraphicsDisplayWindow() andrewm@0: { andrewm@0: } andrewm@0: andrewm@0: void closeButtonPressed() andrewm@0: { andrewm@0: setVisible(false); andrewm@0: } andrewm@0: andrewm@0: andrewm@0: private: andrewm@17: KeyboardDisplay& display_; andrewm@0: andrewm@0: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GraphicsDisplayWindow) andrewm@0: }; andrewm@0: andrewm@0: #endif // TOUCHKEYS_NO_GUI andrewm@0: andrewm@0: #endif // __GRAPHICSDISPLAYWINDOW_H_AD5467BB__