annotate Source/GUI/PreferencesWindow.h @ 56:b4a2d2ae43cf tip

merge
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Fri, 23 Nov 2018 15:48:14 +0000
parents 114427cb39f0
children
rev   line source
andrewm@41 1 /*
andrewm@41 2 ==============================================================================
andrewm@41 3
andrewm@41 4 PreferencesWindow.h
andrewm@41 5 Created: 17 Jun 2014 11:22:44pm
andrewm@41 6 Author: Andrew McPherson
andrewm@41 7
andrewm@41 8 ==============================================================================
andrewm@41 9 */
andrewm@41 10
andrewm@41 11 #ifndef PREFERENCESWINDOW_H_INCLUDED
andrewm@41 12 #define PREFERENCESWINDOW_H_INCLUDED
andrewm@41 13
andrewm@50 14 #ifndef TOUCHKEYS_NO_GUI
andrewm@50 15
andrewm@41 16 #include "../../JuceLibraryCode/JuceHeader.h"
andrewm@41 17 #include "PreferencesComponent.h"
andrewm@41 18 #include "../MainApplicationController.h"
andrewm@41 19
andrewm@41 20 //==============================================================================
andrewm@41 21 /*
andrewm@41 22 */
andrewm@41 23 class PreferencesWindow : public DocumentWindow, public Timer
andrewm@41 24 {
andrewm@41 25 public:
andrewm@41 26 PreferencesWindow(MainApplicationController& controller)
andrewm@46 27 : DocumentWindow("Preferences", Colours::lightgrey, DocumentWindow::allButtons, false)
andrewm@41 28 {
andrewm@41 29 // Make a new preferences component
andrewm@41 30 preferencesComponent_ = new PreferencesComponent();
andrewm@41 31 preferencesComponent_->setMainApplicationController(&controller);
andrewm@41 32
andrewm@41 33 // Set properties
andrewm@41 34 setContentOwned(preferencesComponent_, true);
andrewm@41 35 setUsingNativeTitleBar(true);
andrewm@41 36 setResizable(false, false);
andrewm@41 37
andrewm@41 38 // Don't show window yet
andrewm@45 39 setTopLeftPosition(60,60);
andrewm@41 40 setVisible(false);
andrewm@41 41
andrewm@41 42 // Start a timer that will keep the interface in sync with the application
andrewm@41 43 startTimer(50);
andrewm@41 44 }
andrewm@41 45
andrewm@41 46 ~PreferencesWindow()
andrewm@41 47 {
andrewm@41 48 }
andrewm@41 49
andrewm@41 50 // Method used by Juce timer which we will use for periodic UI updates
andrewm@41 51 // from the underlying system state
andrewm@41 52 void timerCallback() {
andrewm@41 53 preferencesComponent_->synchronize();
andrewm@41 54 }
andrewm@41 55
andrewm@41 56 void closeButtonPressed()
andrewm@41 57 {
andrewm@41 58 setVisible(false);
andrewm@41 59 }
andrewm@41 60
andrewm@41 61 private:
andrewm@41 62 PreferencesComponent *preferencesComponent_;
andrewm@41 63
andrewm@41 64 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PreferencesWindow)
andrewm@41 65 };
andrewm@41 66
andrewm@50 67 #endif // TOUCHKEYS_NO_GUI
andrewm@41 68
andrewm@41 69 #endif // PREFERENCESWINDOW_H_INCLUDED