当前位置: 首页>>代码示例>>C++>>正文


C++ TextButton::addListener方法代码示例

本文整理汇总了C++中TextButton::addListener方法的典型用法代码示例。如果您正苦于以下问题:C++ TextButton::addListener方法的具体用法?C++ TextButton::addListener怎么用?C++ TextButton::addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextButton的用法示例。


在下文中一共展示了TextButton::addListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: String

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);
}
开发者ID:bingo2011,项目名称:codes_GettingStartedWithJuce,代码行数:30,代码来源:MainComponent.cpp

示例2: TextButton

//==============================================================================
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 );
	}
}
开发者ID:jorisdejong,项目名称:Chaser,代码行数:16,代码来源:Copier.cpp

示例3: page

//==============================================================================
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);
    }
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例4: DialogsDemo

    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);
        }
    }
开发者ID:mmgeddie,项目名称:seniordesign,代码行数:36,代码来源:DialogsDemo.cpp


注:本文中的TextButton::addListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。