- clean working copy for leaving SVN
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
Demonstration "Hello World" application in JUCE
|
||||
Copyright 2008 by Julian Storer.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "MainComponent.h"
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
This is the top-level window that we'll pop up. Inside it, we'll create and
|
||||
show a component from the MainComponent.cpp file (you can open this file using
|
||||
the Jucer to edit it).
|
||||
*/
|
||||
class HelloWorldWindow : public DocumentWindow
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
HelloWorldWindow()
|
||||
: DocumentWindow ("JUCE Hello World!",
|
||||
Colours::lightgrey,
|
||||
DocumentWindow::allButtons,
|
||||
true)
|
||||
{
|
||||
// Create an instance of our main content component, and add it to our window..
|
||||
setContentOwned (new MainComponent(), true);
|
||||
|
||||
// Centre the window on the screen
|
||||
centreWithSize (getWidth(), getHeight());
|
||||
|
||||
// And show it!
|
||||
setVisible (true);
|
||||
}
|
||||
|
||||
~HelloWorldWindow()
|
||||
{
|
||||
// (the content component will be deleted automatically, so no need to do it here)
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void closeButtonPressed() override
|
||||
{
|
||||
// When the user presses the close button, we'll tell the app to quit. This
|
||||
// HelloWorldWindow object will be deleted by the JUCEHelloWorldApplication class.
|
||||
JUCEApplication::quit();
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** This is the application object that is started up when Juce starts. It handles
|
||||
the initialisation and shutdown of the whole application.
|
||||
*/
|
||||
class JUCEHelloWorldApplication : public JUCEApplication
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
JUCEHelloWorldApplication() {}
|
||||
|
||||
//==============================================================================
|
||||
void initialise (const String& commandLine) override
|
||||
{
|
||||
// For this demo, we'll just create the main window...
|
||||
helloWorldWindow = new HelloWorldWindow();
|
||||
|
||||
/* ..and now return, which will fall into to the main event
|
||||
dispatch loop, and this will run until something calls
|
||||
JUCEAppliction::quit().
|
||||
|
||||
In this case, JUCEAppliction::quit() will be called by the
|
||||
hello world window being clicked.
|
||||
*/
|
||||
}
|
||||
|
||||
void shutdown() override
|
||||
{
|
||||
// This method is where you should clear-up your app's resources..
|
||||
|
||||
// The helloWorldWindow variable is a ScopedPointer, so setting it to a null
|
||||
// pointer will delete the window.
|
||||
helloWorldWindow = nullptr;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const String getApplicationName() override
|
||||
{
|
||||
return "Hello World for JUCE";
|
||||
}
|
||||
|
||||
const String getApplicationVersion() override
|
||||
{
|
||||
// The ProjectInfo::versionString value is automatically updated by the Jucer, and
|
||||
// can be found in the JuceHeader.h file that it generates for our project.
|
||||
return ProjectInfo::versionString;
|
||||
}
|
||||
|
||||
bool moreThanOneInstanceAllowed() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void anotherInstanceStarted (const String& commandLine) override
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
ScopedPointer<HelloWorldWindow> helloWorldWindow;
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// This macro creates the application's main() function..
|
||||
START_JUCE_APPLICATION (JUCEHelloWorldApplication)
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This is an automatically generated GUI class created by the Introjucer!
|
||||
|
||||
Be careful when adding custom code to these files, as only the code within
|
||||
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
|
||||
and re-saved.
|
||||
|
||||
Created with Introjucer version: 3.1.0
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-13 by Raw Material Software Ltd.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
//[Headers] You can add your own extra header files here...
|
||||
//[/Headers]
|
||||
|
||||
#include "MainComponent.h"
|
||||
|
||||
|
||||
//[MiscUserDefs] You can add your own user definitions and misc code here...
|
||||
//[/MiscUserDefs]
|
||||
|
||||
//==============================================================================
|
||||
MainComponent::MainComponent ()
|
||||
{
|
||||
addAndMakeVisible (helloWorldLabel = new Label (String::empty,
|
||||
"Hello World!"));
|
||||
helloWorldLabel->setFont (Font (40.00f, Font::bold));
|
||||
helloWorldLabel->setJustificationType (Justification::centred);
|
||||
helloWorldLabel->setEditable (false, false, false);
|
||||
helloWorldLabel->setColour (Label::textColourId, Colours::black);
|
||||
helloWorldLabel->setColour (TextEditor::textColourId, Colours::black);
|
||||
helloWorldLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
||||
|
||||
addAndMakeVisible (quitButton = new TextButton (String::empty));
|
||||
quitButton->setButtonText ("Quit");
|
||||
quitButton->addListener (this);
|
||||
|
||||
|
||||
//[UserPreSize]
|
||||
//[/UserPreSize]
|
||||
|
||||
setSize (600, 300);
|
||||
|
||||
|
||||
//[Constructor] You can add your own custom stuff here..
|
||||
//[/Constructor]
|
||||
}
|
||||
|
||||
MainComponent::~MainComponent()
|
||||
{
|
||||
//[Destructor_pre]. You can add your own custom destruction code here..
|
||||
//[/Destructor_pre]
|
||||
|
||||
helloWorldLabel = nullptr;
|
||||
quitButton = nullptr;
|
||||
|
||||
|
||||
//[Destructor]. You can add your own custom destruction code here..
|
||||
//[/Destructor]
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void MainComponent::paint (Graphics& g)
|
||||
{
|
||||
//[UserPrePaint] Add your own custom painting code here..
|
||||
//[/UserPrePaint]
|
||||
|
||||
g.fillAll (Colour (0xffc1d0ff));
|
||||
|
||||
g.setColour (Colours::white);
|
||||
g.fillPath (internalPath1);
|
||||
g.setColour (Colour (0xff6f6f6f));
|
||||
g.strokePath (internalPath1, PathStrokeType (5.200f));
|
||||
|
||||
//[UserPaint] Add your own custom painting code here..
|
||||
//[/UserPaint]
|
||||
}
|
||||
|
||||
void MainComponent::resized()
|
||||
{
|
||||
helloWorldLabel->setBounds (152, 80, 296, 48);
|
||||
quitButton->setBounds (getWidth() - 176, getHeight() - 60, 120, 32);
|
||||
internalPath1.clear();
|
||||
internalPath1.startNewSubPath (136.0f, 80.0f);
|
||||
internalPath1.quadraticTo (176.0f, 24.0f, 328.0f, 32.0f);
|
||||
internalPath1.quadraticTo (472.0f, 40.0f, 472.0f, 104.0f);
|
||||
internalPath1.quadraticTo (472.0f, 192.0f, 232.0f, 176.0f);
|
||||
internalPath1.lineTo (184.0f, 216.0f);
|
||||
internalPath1.lineTo (200.0f, 168.0f);
|
||||
internalPath1.quadraticTo (96.0f, 136.0f, 136.0f, 80.0f);
|
||||
internalPath1.closeSubPath();
|
||||
|
||||
//[UserResized] Add your own custom resize handling here..
|
||||
//[/UserResized]
|
||||
}
|
||||
|
||||
void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
||||
{
|
||||
//[UserbuttonClicked_Pre]
|
||||
//[/UserbuttonClicked_Pre]
|
||||
|
||||
if (buttonThatWasClicked == quitButton)
|
||||
{
|
||||
//[UserButtonCode_quitButton] -- add your button handler code here..
|
||||
|
||||
JUCEApplication::quit();
|
||||
|
||||
//[/UserButtonCode_quitButton]
|
||||
}
|
||||
|
||||
//[UserbuttonClicked_Post]
|
||||
//[/UserbuttonClicked_Post]
|
||||
}
|
||||
|
||||
|
||||
|
||||
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
||||
//[/MiscUserCode]
|
||||
|
||||
|
||||
//==============================================================================
|
||||
#if 0
|
||||
/* -- Introjucer information section --
|
||||
|
||||
This is where the Introjucer stores the metadata that describe this GUI layout, so
|
||||
make changes in here at your peril!
|
||||
|
||||
BEGIN_JUCER_METADATA
|
||||
|
||||
<JUCER_COMPONENT documentType="Component" className="MainComponent" componentName=""
|
||||
parentClasses="public Component" constructorParams="" variableInitialisers=""
|
||||
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330000013"
|
||||
fixedSize="1" initialWidth="600" initialHeight="300">
|
||||
<BACKGROUND backgroundColour="ffc1d0ff">
|
||||
<PATH pos="0 0 100 100" fill="solid: ffffffff" hasStroke="1" stroke="5.19999981, mitered, butt"
|
||||
strokeColour="solid: ff6f6f6f" nonZeroWinding="1">s 136 80 q 176 24 328 32 q 472 40 472 104 q 472 192 232 176 l 184 216 l 200 168 q 96 136 136 80 x</PATH>
|
||||
</BACKGROUND>
|
||||
<LABEL name="" id="be4f6f2e5725a063" memberName="helloWorldLabel" virtualName=""
|
||||
explicitFocusOrder="0" pos="152 80 296 48" textCol="ff000000"
|
||||
edTextCol="ff000000" edBkgCol="0" labelText="Hello World!" editableSingleClick="0"
|
||||
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
|
||||
fontsize="40" bold="1" italic="0" justification="36"/>
|
||||
<TEXTBUTTON name="" id="bcf4f7b0888effe5" memberName="quitButton" virtualName=""
|
||||
explicitFocusOrder="0" pos="176R 60R 120 32" buttonText="Quit"
|
||||
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
||||
</JUCER_COMPONENT>
|
||||
|
||||
END_JUCER_METADATA
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
//[EndFile] You can add extra defines here...
|
||||
//[/EndFile]
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This is an automatically generated GUI class created by the Introjucer!
|
||||
|
||||
Be careful when adding custom code to these files, as only the code within
|
||||
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
|
||||
and re-saved.
|
||||
|
||||
Created with Introjucer version: 3.1.0
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-13 by Raw Material Software Ltd.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_HEADER_9002020A4DD09B20__
|
||||
#define __JUCE_HEADER_9002020A4DD09B20__
|
||||
|
||||
//[Headers] -- You can add your own extra header files here --
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
//[/Headers]
|
||||
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
//[Comments]
|
||||
An auto-generated component, created by the Jucer.
|
||||
|
||||
Describe your class and how it works here!
|
||||
//[/Comments]
|
||||
*/
|
||||
class MainComponent : public Component,
|
||||
public ButtonListener
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
MainComponent ();
|
||||
~MainComponent();
|
||||
|
||||
//==============================================================================
|
||||
//[UserMethods] -- You can add your own custom methods in this section.
|
||||
//[/UserMethods]
|
||||
|
||||
void paint (Graphics& g);
|
||||
void resized();
|
||||
void buttonClicked (Button* buttonThatWasClicked);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
//[UserVariables] -- You can add your own custom variables in this section.
|
||||
//[/UserVariables]
|
||||
|
||||
//==============================================================================
|
||||
ScopedPointer<Label> helloWorldLabel;
|
||||
ScopedPointer<TextButton> quitButton;
|
||||
Path internalPath1;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
|
||||
};
|
||||
|
||||
//[EndFile] You can add extra defines here...
|
||||
//[/EndFile]
|
||||
|
||||
#endif // __JUCE_HEADER_9002020A4DD09B20__
|
||||
Reference in New Issue
Block a user