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 MappingEditorComponent.h: Juce Component subclass from which all
|
andrewm@0
|
21 mapping editors inherit.
|
andrewm@0
|
22 */
|
andrewm@0
|
23
|
andrewm@0
|
24
|
andrewm@0
|
25 #ifndef __MAPPINGEDITORCOMPONENT_H_C93E7296__
|
andrewm@0
|
26 #define __MAPPINGEDITORCOMPONENT_H_C93E7296__
|
andrewm@0
|
27
|
andrewm@50
|
28 #ifndef TOUCHKEYS_NO_GUI
|
andrewm@50
|
29
|
andrewm@0
|
30 #include "../../JuceLibraryCode/JuceHeader.h"
|
andrewm@0
|
31
|
andrewm@0
|
32 //==============================================================================
|
andrewm@0
|
33 /*
|
andrewm@0
|
34 */
|
andrewm@0
|
35 class MappingEditorComponent : public Component
|
andrewm@0
|
36 {
|
andrewm@0
|
37 public:
|
andrewm@0
|
38 MappingEditorComponent()
|
andrewm@0
|
39 {
|
andrewm@0
|
40 // In your constructor, you should add any child components, and
|
andrewm@0
|
41 // initialise any special settings that your component needs.
|
andrewm@0
|
42
|
andrewm@0
|
43 }
|
andrewm@0
|
44
|
andrewm@0
|
45 virtual ~MappingEditorComponent()
|
andrewm@0
|
46 {
|
andrewm@0
|
47 }
|
andrewm@0
|
48
|
andrewm@0
|
49 // Method to synchronize the GUI state to the underlying
|
andrewm@0
|
50 // state of the mapping. Implemented in the subclass.
|
andrewm@0
|
51 virtual void synchronize() {}
|
andrewm@41
|
52
|
andrewm@41
|
53 // Get a human-readable name for the mapping
|
andrewm@41
|
54 // Generally, extended editors should implement this but short editors
|
andrewm@41
|
55 // don't need to
|
andrewm@41
|
56 virtual String getDescription() { return "Mapping"; }
|
andrewm@0
|
57
|
andrewm@0
|
58 virtual void paint (Graphics& g)
|
andrewm@0
|
59 {
|
andrewm@0
|
60 /* This demo code just fills the component's background and
|
andrewm@0
|
61 draws some placeholder text to get you started.
|
andrewm@0
|
62
|
andrewm@0
|
63 You should replace everything in this method with your own
|
andrewm@0
|
64 drawing code..
|
andrewm@0
|
65 */
|
andrewm@0
|
66
|
andrewm@0
|
67 g.fillAll (Colours::white); // clear the background
|
andrewm@0
|
68
|
andrewm@0
|
69 g.setColour (Colours::grey);
|
andrewm@0
|
70 g.drawRect (getLocalBounds(), 1); // draw an outline around the component
|
andrewm@0
|
71
|
andrewm@0
|
72 g.setColour (Colours::lightblue);
|
andrewm@0
|
73 g.setFont (14.0f);
|
andrewm@0
|
74 g.drawText ("MappingEditorComponent", getLocalBounds(),
|
andrewm@0
|
75 Justification::centred, true); // draw some placeholder text
|
andrewm@0
|
76 }
|
andrewm@0
|
77
|
andrewm@0
|
78 virtual void resized()
|
andrewm@0
|
79 {
|
andrewm@0
|
80 // This method is where you should set the bounds of any child
|
andrewm@0
|
81 // components that your component contains..
|
andrewm@0
|
82
|
andrewm@0
|
83 }
|
andrewm@0
|
84
|
andrewm@0
|
85 private:
|
andrewm@0
|
86 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MappingEditorComponent)
|
andrewm@0
|
87 };
|
andrewm@0
|
88
|
andrewm@50
|
89 #endif // TOUCHKEYS_NO_GUI
|
andrewm@0
|
90
|
andrewm@0
|
91 #endif // __MAPPINGEDITORCOMPONENT_H_C93E7296__
|