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


C++ ToggleButton::setToggleState方法代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:chrisdonahue,项目名称:imaphone,代码行数:15,代码来源:imaphone_component.cpp

示例2: Component

EngineParameterComponent::EngineParameterComponent(EngineParameter &param)
	: 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;
	}
}
开发者ID:SireniaLizbeth,项目名称:GUI,代码行数:37,代码来源:EngineConfigWindow.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:MovementAndMeaning,项目名称:Core_MPlusM,代码行数:101,代码来源:m+mSettingsWindow.cpp

示例4: initialiseToggle

 void initialiseToggle (ToggleButton& b, const char* name, bool on)
 {
     addAndMakeVisible (b);
     b.setButtonText (name);
     b.setToggleState (on, dontSendNotification);
 }
开发者ID:AydinSakar,项目名称:JUCE,代码行数:6,代码来源:GraphicsDemo.cpp


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