Open Ephys GUI
 All Classes Functions Variables Pages
ParameterEditor.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __PARAMETEREDITOR_H_44537DA9__
25 #define __PARAMETEREDITOR_H_44537DA9__
26 
27 #include "../../../JuceLibraryCode/JuceHeader.h"
28 #include "../GenericProcessor.h"
29 #include "ChannelSelector.h"
30 #include "../Parameter.h"
31 #include <stdio.h>
32 
33 /**
34 
35  Automatically creates an interactive editor for a particular
36  parameter.
37 
38  @see GenericEditor, GenericProcessor, Parameter
39 
40 */
41 
42 class ParameterEditor : public Component,
43  public Button::Listener,
44  public Slider::Listener
45 
46 {
47 public:
48  ParameterEditor(GenericProcessor* proc, Parameter& p, Font labelFont);
49  ~ParameterEditor();
50 
51 
52  int desiredWidth;
53  int desiredHeight;
54 
55  void parentHierarchyChanged();
56 
57  void buttonClicked(Button* button);
58  void sliderValueChanged(Slider* slider);
59 
60  void setChannelSelector(ChannelSelector* ch)
61  {
62  channelSelector = ch;
63  }
64 
65 private:
66 
67  Array<Slider*> sliderArray;
68  Array<Button*> buttonArray;
69  Array<int> buttonIdArray;
70  Array<int> sliderIdArray;
71 
72  GenericProcessor* processor;
73  ChannelSelector* channelSelector;
74 
75  enum {
76  LEFT,
77  MIDDLE,
78  RIGHT
79  };
80 
81 };
82 
83 class ParameterButton : public Button
84 
85 {
86 public:
87  ParameterButton(var value, int buttonType, Font labelFont);
88  ~ParameterButton() {}
89 
90 
91 private:
92  void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
93 
94  void resized();
95 
96  int type;
97 
98  Path outlinePath;
99 
100  const String valueString;
101 
102  Font font;
103 
104  ColourGradient selectedGrad;
105  ColourGradient selectedOverGrad;
106  ColourGradient neutralGrad;
107  ColourGradient neutralOverGrad;
108 
109  enum {
110  LEFT,
111  MIDDLE,
112  RIGHT
113  };
114 
115 };
116 
117 class ParameterCheckbox : public Button
118 
119 {
120 public:
121  ParameterCheckbox(bool defaultState);
122  ~ParameterCheckbox() {}
123 
124 private:
125  void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
126 
127  ColourGradient selectedGrad;
128  ColourGradient selectedOverGrad;
129  ColourGradient neutralGrad;
130  ColourGradient neutralOverGrad;
131 };
132 
133 class ParameterSlider : public Slider
134 
135 {
136 public:
137  ParameterSlider(float min, float max, float defaultValue, Font f);
138  ~ParameterSlider() {}
139 
140 private:
141  void paint(Graphics& g);//Button(Graphics& g, bool isMouseOver, bool isButtonDown);
142 
143  Path makeRotaryPath(double, double, double);
144 
145  Font font;
146  // ColourGradient selectedGrad;
147  // ColourGradient selectedOverGrad;
148  // ColourGradient neutralGrad;
149  // ColourGradient neutralOverGrad;
150 };
151 
152 
153 #endif // __PARAMETEREDITOR_H_44537DA9__