Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../JuceLibraryCode/JuceHeader.h"
- #include "InputForm.h"
- InputForm::InputForm()
- {
- addAndMakeVisible(m_usernameLabel);
- m_usernameLabel.setText("Username:", dontSendNotification);
- m_usernameLabel.attachToComponent(&m_usernameInput, true);
- m_usernameLabel.setColour(Label::textColourId, Colours::orange);
- m_usernameLabel.setJustificationType(Justification::right);
- addAndMakeVisible(m_passwordLabel);
- m_passwordLabel.setText("Password:", dontSendNotification);
- m_passwordLabel.attachToComponent(&m_passwordInput, true);
- m_passwordLabel.setColour(Label::textColourId, Colours::orange);
- m_passwordLabel.setJustificationType(Justification::right);
- addAndMakeVisible(m_usernameInput);
- m_usernameInput.setEditable(true);
- m_usernameInput.setColour(Label::backgroundColourId, Colours::darkblue);
- m_usernameInput.setJustificationType(Justification::left);
- addAndMakeVisible(m_passwordInput);
- m_passwordInput.setEditable(true);
- m_passwordInput.setColour(Label::backgroundColourId, Colours::darkblue);
- m_passwordInput.setJustificationType(Justification::left);
- }
- InputForm::~InputForm()
- {
- }
- void InputForm::paint (Graphics& g)
- {
- g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); // clear the background
- g.setColour (Colours::grey);
- g.drawRect (getLocalBounds(), 1);
- }
- void InputForm::resized()
- {
- auto marginX = 10;
- auto marginY = 10;
- auto localBounds = getLocalBounds();
- auto usernameRect = localBounds.removeFromTop(50);
- m_usernameLabel.setBounds(usernameRect.removeFromLeft(usernameRect.getWidth() / 5).reduced(marginX, marginY));
- m_usernameInput.setBounds(usernameRect.reduced(marginX, marginY));
- auto passwordRect = localBounds.removeFromTop(50);
- m_passwordLabel.setBounds(passwordRect.removeFromLeft(passwordRect.getWidth() / 5).reduced(marginX));
- m_passwordInput.setBounds(passwordRect.reduced(marginX, marginY));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement