本文整理汇总了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);
}
示例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 );
}
}
示例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);
}
}
示例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);
}
}