本文整理汇总了C++中ToggleButton::setToggleState方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::setToggleState方法的具体用法?C++ ToggleButton::setToggleState怎么用?C++ ToggleButton::setToggleState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToggleButton
的用法示例。
在下文中一共展示了ToggleButton::setToggleState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color_radios_clear
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void imaphone_component::color_radios_clear(ToggleButton* exclude=nullptr) {
if (exclude != nullptr) {
exclude->setToggleState(true, NotificationType::dontSendNotification);
}
for (std::vector<ToggleButton*>::iterator it = color_radios->begin(); it != color_radios->end(); ++it) {
ToggleButton* current = (*it);
if (current == exclude) {
continue;
}
else {
current->setToggleState(false, NotificationType::dontSendNotification);
}
}
}
示例2: Component
EngineParameterComponent::EngineParameterComponent(EngineParameter ¶m)
: Component(param.name), type(param.type), parameter(param)
{
if (param.type == EngineParameter::BOOL)
{
ToggleButton* but = new ToggleButton();
but->setToggleState(param.boolParam.value,dontSendNotification);
but->setBounds(120,0,20,20);
addAndMakeVisible(but);
control = but;
}
else
{
Label* lab = new Label();
lab->setFont(Font("Small Text",10,Font::plain));
switch (param.type)
{
case EngineParameter::INT:
lab->setText(String(param.intParam.value),dontSendNotification);
lab->setBounds(120,0,50,20);
break;
case EngineParameter::FLOAT:
lab->setText(String(param.floatParam.value),dontSendNotification);
lab->setBounds(120,0,50,20);
break;
case EngineParameter::STR:
lab->setText(String(param.strParam.value),dontSendNotification);
lab->setBounds(120,0,150,20);
}
lab->setEditable(true);
lab->setColour(Label::ColourIds::backgroundColourId,Colours::lightgrey);
lab->setColour(Label::ColourIds::outlineColourId,Colours::black);
lab->addListener(this);
addAndMakeVisible(lab);
control = lab;
}
}
示例3: TextValidator
void
SettingsWindow::setUpStandardFields(int & widthSoFar,
int & heightSoFar)
{
ODL_OBJENTER(); //####
ODL_P2("widthSoFar = ", &widthSoFar, "heightSoFar = ", &heightSoFar); //####
Component * content = getContentComponent();
int buttonHeight = GetButtonHeight();
Point<int> dimensions;
size_t numDescriptors = _descriptors.size();
widthSoFar = heightSoFar = 0;
_topText.setFont(_regularFont);
if ((0 < numDescriptors) || _canSetEndpoint || _canSetPort || _canSetTag || _canUseModifier)
{
_topText.setText(String("The ") + _execType + " has one or more arguments, that need to be "
"provided before it can be launched.", dontSendNotification);
}
else
{
_topText.setText(String("The ") + _execType + " has no arguments or options, so it can be "
"launched right now.", dontSendNotification);
}
CommonVisuals::CalculateTextArea(dimensions, _regularFont, _topText.getText());
_topText.setBounds(FormField::kButtonGap, FormField::kButtonGap + getTitleBarHeight(),
dimensions.getX() + FormField::kButtonGap, dimensions.getY());
content->addAndMakeVisible(&_topText, 0);
heightSoFar = _topText.getY() + _topText.getHeight() + FormField::kButtonGap;
widthSoFar = jmax(widthSoFar, _topText.getX() + _topText.getWidth());
if (_canSetEndpoint)
{
_endpointField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
"(Optional) Endpoint to use", heightSoFar, false,
false, NULL,
new TextValidator(*_endpointDescriptor),
kEndpointFieldName);
_endpointField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _endpointField->getMinimumWidth());
heightSoFar = (_endpointField->getY() + _endpointField->getHeight() +
(FormField::kButtonGap / 2));
}
if (_canSetPort)
{
_portField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
"(Optional) Network port to use", heightSoFar, false,
false, NULL, new TextValidator(*_portDescriptor),
kPortFieldName);
_portField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _portField->getMinimumWidth());
heightSoFar = _portField->getY() + _portField->getHeight() + (FormField::kButtonGap / 2);
}
if (_canSetTag)
{
_tagField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
String("(Optional) Tag for the ") + _execType,
heightSoFar, false, false, NULL, NULL, kTagFieldName);
_tagField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _tagField->getMinimumWidth());
heightSoFar = _tagField->getY() + _tagField->getHeight() + (FormField::kButtonGap / 2);
}
if (_canUseModifier)
{
_tagModifierGroup = new GroupComponent("", "(Optional) Tag modifier");
_tagModifierGroup->setBounds(FormField::kFieldInset, heightSoFar,
widthSoFar - (FormField::kButtonGap +
FormField::kFieldInset),
static_cast<int>(2 * _regularFont.getHeight()) +
FormField::kButtonGap);
for (int ii = 0; 4 >= ii; ++ii)
{
ToggleButton * tb = new ToggleButton(String(ii) + ((1 == ii) ? " byte" : " bytes"));
_tagModifierGroup->addAndMakeVisible(tb);
_tagModifierButtons.add(tb);
tb->setComponentID(String(ii));
tb->setRadioGroupId(kTagModifierGroupId);
tb->setBounds(FormField::kFieldInset + (kTagModifierButtonWidth * ii),
FormField::kButtonGap + static_cast<int>(_regularFont.getHeight() / 2),
kTagModifierButtonWidth, static_cast<int>(_regularFont.getHeight()));
tb->setTooltip("Modify tag with " + String(ii) + ((1 == ii) ?
" byte of the IP address" :
" bytes of the IP address"));
if (0 == ii)
{
tb->setToggleState(true, dontSendNotification);
}
}
content->addAndMakeVisible(_tagModifierGroup);
heightSoFar = (_tagModifierGroup->getY() + _tagModifierGroup->getHeight() +
(FormField::kButtonGap / 2));
widthSoFar = jmax(widthSoFar, _tagModifierGroup->getX() +
_tagModifierGroup->getWidth());
}
// Check for one or more file descriptors.
for (size_t ii = 0; numDescriptors > ii; ++ii)
{
bool forOutput;
//.........这里部分代码省略.........
示例4: initialiseToggle
void initialiseToggle (ToggleButton& b, const char* name, bool on)
{
addAndMakeVisible (b);
b.setButtonText (name);
b.setToggleState (on, dontSendNotification);
}