Open Ephys GUI
 All Classes Functions Variables Pages
UIComponent.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 __UICOMPONENT_H_D97C73CF__
25 #define __UICOMPONENT_H_D97C73CF__
26 
27 #include "../../JuceLibraryCode/JuceHeader.h"
28 #include "InfoLabel.h"
29 #include "ControlPanel.h"
30 #include "ProcessorList.h"
31 #include "EditorViewport.h"
32 #include "DataViewport.h"
33 #include "MessageCenter.h"
34 #include "../Processors/ProcessorGraph.h"
35 #include "../Audio/AudioComponent.h"
36 #include "../MainWindow.h"
37 
38 #include "../OpenGL.h"
39 
40 /**
41 
42  Creates objects for user interaction.
43 
44  The UIComponent can relay messages its sub-components, such as
45  the MessageCenter
46 
47  @see ControlPanel, ProcessorList, EditorViewport, DataViewport,
48  MessageCenter, Configuration
49 
50 */
51 
52 class MainWindow;
53 class ProcessorList;
54 
56 
57 class UIComponent : public Component,
58  public ActionBroadcaster,
59  public MenuBarModel,
60  public ApplicationCommandTarget,
61  public DragAndDropContainer // required for
62  // drag-and-drop
63  // internal components
64 
65 
66 {
67 public:
68  UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio);
69  ~UIComponent();
70 
71  EditorViewport* getEditorViewport() {return editorViewport;}
72  ProcessorList* getProcessorList() {return processorList;}
73  DataViewport* getDataViewport() {return dataViewport;}
74  ProcessorGraph* getProcessorGraph() {return processorGraph;}
75  ControlPanel* getControlPanel() {return controlPanel;}
76  MessageCenter* getMessageCenter() {return messageCenter;}
77  UIComponent* getUIComponent() {return this;}
78  AudioComponent* getAudioComponent() {return audio;}
79 
80  //void transmitMessage(const String& message);
81  void disableCallbacks();
82  void disableDataViewport();
83 
84  void childComponentChanged();
85 
86  const StringArray getMenuBarNames();
87  const PopupMenu getMenuForIndex(int topLevelMenuIndex, const String& menuName);
88  void menuItemSelected(int menuItemID, int topLevelMenuIndex);
89 
90  //ApplicationCommandTarget interface:
91  ApplicationCommandTarget* getNextCommandTarget();
92  void getAllCommands (Array <CommandID>& commands);
93  void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
94  bool perform (const InvocationInfo& info);
95 
96 private:
97 
98  DataViewport* dataViewport;
99  EditorViewport* editorViewport;
100  EditorViewportButton* editorViewportButton;
101  ProcessorList* processorList;
102  ControlPanel* controlPanel;
103  MessageCenter* messageCenter;
104  InfoLabel* infoLabel;
105 
106  MainWindow* mainWindow;
107  TooltipWindow tooltipWindow;
108 
109  ProcessorGraph* processorGraph;
110  AudioComponent* audio;
111 
112  void resized();
113 
114  enum CommandIDs
115  {
116  openConfiguration = 0x2001,
117  saveConfiguration = 0x2002,
118  undo = 0x2003,
119  redo = 0x2004,
120  copySignalChain = 0x2005,
121  pasteSignalChain = 0x2006,
122  clearSignalChain = 0x2007,
123  toggleProcessorList = 0x2008,
124  toggleSignalChain = 0x2009,
125  toggleFileInfo = 0x2010,
126  showHelp = 0x2011
127  };
128 
129  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UIComponent);
130 
131 };
132 
133 
134 
135 class EditorViewportButton : public OpenGLComponent
136 {
137 public:
140 
141  bool isOpen() {return open;}
142 
143  void newOpenGLContextCreated();
144  void renderOpenGL();
145 
146  void drawName();
147  void drawButton();
148 
149  void toggleState();
150 
151  void mouseDown(const MouseEvent& e);
152 
153 private:
154 
155  UIComponent* UI;
156  bool open;
157 
158  FTPixmapFont* font;
159 
160 };
161 
162 #endif // __UICOMPONENT_H_D97C73CF__