initial: added first widget

This commit is contained in:
2017-06-19 16:59:27 -04:00
parent 755ee11d51
commit 1842a6cfeb
6 changed files with 185 additions and 49 deletions

View File

@@ -12,13 +12,15 @@
#include "PluginEditor.h"
//==============================================================================
LampshadeAudioProcessorEditor::LampshadeAudioProcessorEditor (LampshadeAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p)
: AudioProcessorEditor (&p), processor (p), nlines (3), lineThickness(4)
{
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (400, 300);
component.setTextBoxStyle(Slider::NoTextBox, true, 0, 0);
setSize(400, 300);
component.setLookAndFeel(gui);
addAndMakeVisible(component);
}
LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor()
@@ -29,15 +31,15 @@ LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor()
void LampshadeAudioProcessorEditor::paint (Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
g.setColour (Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
g.fillAll(Colours::white);
for (int i = 1; i < nlines; i++) {
g.drawLine(0, getHeight()*((float)i / nlines), getWidth(), getHeight()*((float)i / nlines), lineThickness);
g.drawLine(getWidth()*((float) i /nlines), 0, getWidth()*((float) i /nlines), getHeight(), lineThickness);
}
}
void LampshadeAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
component.setBounds(getWidth()/nlines+lineThickness/2, getHeight()/nlines+lineThickness/2, getWidth()/nlines-lineThickness+1, getHeight()/nlines-lineThickness);
}