MainContentComponent::MainContentComponent()
{
    // Create 10 buttons.
    for (int i = 0; i < 10; ++i) {
        // Construct a button name based on the loop counter.
        String buttonName;
        buttonName << "Button " << String (i);
        
        // Create a button.
        TextButton* button = new TextButton (buttonName);
        
        // Listen for button clicks.
        button->addListener (this);
        
        // Add the button to the array.
        buttons.add (button);
        
        // Add the button to this parent component.
        addAndMakeVisible (button);
    }
    
    // Add the label to this parent component.
    addAndMakeVisible (&label);
    
    // Configure the label text display.
    label.setJustificationType (Justification::centred);
    label.setText ("no buttons clicked", dontSendNotification);
    
    setSize (500, 400);
}
Beispiel #2
0
//==============================================================================
Copier::Copier( ChaseManager* chaseManager ) :
chaseManager( chaseManager )
{
	//create 4 buttons for x1, x2, x4 and x8
	for ( int i = 0; i < 4; i++ )
	{
		TextButton* b = new TextButton( String( i ) );
		b->setButtonText( "x" + String( pow( 2, i ) ) );
		ColourLookAndFeel claf;
		b->setColour( TextButton::buttonColourId, claf.backgroundColour );
		b->addListener( this );
		addAndMakeVisible( b );
		buttons.add( b );
	}
}
Beispiel #3
0
//==============================================================================
PagePickerComponent::PagePickerComponent (int page_)
    : page (page_)
{
    for (int n=0 ; n < 24 ; n++)
    {
        TextButton* button = new TextButton();
        addAndMakeVisible (button);
        button->setButtonText (String (n + 1));
        button->setWantsKeyboardFocus (false);
        
        if (n == page)
        {
            button->setColour (TextButton::buttonColourId, Colours::lightblue);
        }
        else
        {
            button->setColour (TextButton::buttonColourId, Colours::blue);
            button->setColour (TextButton::textColourOffId, Colours::white);
        }
        button->addListener (this);
        buttons.add(button);
    }
}
Beispiel #4
0
    DialogsDemo()
    {
        setOpaque (true);

        addAndMakeVisible (nativeButton);
        nativeButton.setButtonText ("Use Native Windows");
        nativeButton.addListener (this);

        static const char* windowNames[] =
        {
            "Plain Alert Window",
            "Alert Window With Warning Icon",
            "Alert Window With Info Icon",
            "Alert Window With Question Icon",
            "OK Cancel Alert Window",
            "Alert Window With Extra Components",
            "CalloutBox",
            "Thread With Progress Window",
            "'Load' File Browser",
            "'Load' File Browser With Image Preview",
            "'Choose Directory' File Browser",
            "'Save' File Browser"
        };

        // warn in case we add any windows
        jassert (numElementsInArray (windowNames) == numDialogs);

        for (int i = 0; i < numDialogs; ++i)
        {
            TextButton* newButton = new TextButton();
            windowButtons.add (newButton);
            addAndMakeVisible (newButton);
            newButton->setButtonText (windowNames[i]);
            newButton->addListener (this);
        }
    }