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


C++ ToggleButton类代码示例

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


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

示例1: Q_UNUSED

Container *AnimationRecipe::setUpControllerContainer()
{
    bool connectResult;
    Q_UNUSED(connectResult);

    // The controllerContainer is the bottom part of the animation recipe.
    // It is where the descriptive text and a toggle button for triggering the
    // animations are kept.
    ImagePaint paint(QUrl("asset:///images/background.png"), RepeatPattern::XY);
    Container *controllerContainer = Container::create().layout(new DockLayout())
            .horizontal(HorizontalAlignment::Fill).background(paint)
            .top(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .bottom(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .left(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD))
            .right(UiValues::instance()->intValue(UiValues::UI_PADDING_STANDARD));

    // Set up the a Label with a descriptive text.
    Label *actionLabel = new Label();
    actionLabel->setText("More Eggs");
    actionLabel->textStyle()->setBase(SystemDefaults::TextStyles::titleText());

    // Set up the ToggleButton and connect to its onChanged signal. In
    // the slot function onToggleChanged, we trigger the animations.
    ToggleButton *toggle = new ToggleButton();
    toggle->setHorizontalAlignment(HorizontalAlignment::Right);
    connectResult = connect(toggle, SIGNAL(checkedChanged(bool)), this, SLOT(onToggleChanged(bool)));
    Q_ASSERT(connectResult);

    controllerContainer->add(actionLabel);
    controllerContainer->add(toggle);

    return controllerContainer;
}
开发者ID:AlessioCampanelli,项目名称:Cascades-Samples,代码行数:33,代码来源:animationrecipe.cpp

示例2: DemoPage

//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
TooltipsDemo::TooltipsDemo(Panel *parent, const char *name) : DemoPage(parent, name)
{
	ToggleButton *pButton = new ToggleButton (this, "RadioDesc5", "");
	pButton->GetTooltip()->SetTooltipFormatToSingleLine();

	LoadControlSettings("Demo/SampleToolTips.res");
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:10,代码来源:TooltipDemo.cpp

示例3: jmin

//==============================================================================
void JuceticeLookAndFeel::drawToggleButton (Graphics& g,
                                            ToggleButton& button,
                                            bool isMouseOverButton,
                                            bool isButtonDown)
{
    const int tickWidth = jmin (20, button.getHeight() - 4);

    drawTickBox (g, button, 4, (button.getHeight() - tickWidth) / 2,
                 tickWidth, tickWidth,
                 button.getToggleState(),
                 button.isEnabled(),
                 isMouseOverButton,
                 isButtonDown);

    g.setColour (button.findColour (ToggleButton::textColourId));
    g.setFont (jmin (15.0f, button.getHeight() * 0.6f));

    if (! button.isEnabled())
        g.setOpacity (0.5f);

    const int textX = tickWidth + 5;

    g.drawFittedText (button.getButtonText(),
                      textX, 4,
                      button.getWidth() - textX - 2, button.getHeight() - 8,
                      Justification::centredLeft, 10);
}
开发者ID:dennyabrain,项目名称:DISTRHO,代码行数:28,代码来源:jucetice_JuceticeLookAndFeel.cpp

示例4: Component

InstrumentListComponent::InstrumentListComponent (Sequencer* sequencer_) :
Component ("InstrumentListComponent"),
sequencer (sequencer_),
lastPattern (nullptr),
lastActiveInstrument (nullptr)
{
    Pattern* pattern = sequencer->getPattern();
    lastPattern = pattern;
    int numInstruments = pattern->getNumInstruments();    
    for (int i = 0; i < numInstruments; i++) {
        Instrument* instrument = pattern->getInstrumentAt (i);
        InstrumentComponent* instrumentComponent = new InstrumentComponent (instrument);
        addAndMakeVisible (instrumentComponent);
        instrumentComponents.add (instrumentComponent);
    }   
    
    for (int i = 0; i < numInstruments; i++) {
        ToggleButton* btn = new ToggleButton ((String)i);
        btn->setRadioGroupId (kRadioGroupId);
        btn->setColour (ToggleButton::textColourId, Colours::white);
        addAndMakeVisible (btn);
        btn->addListener (this);
        activeButtons.add (btn);
    }   
    
    startTimer (100);
}
开发者ID:mattsonic,项目名称:GateTrigger,代码行数:27,代码来源:InstrumentListComponent.cpp

示例5: ProcessToggleGroup

void ToggleButton::ProcessToggleGroup()
{
	if ( m_next && m_next != this ) {
		// One and only one button can be down.
		ToggleButton* firstDown = 0;
		ToggleButton* candidate = 0;

		if ( this->Down() )
			firstDown = this;

		for( ToggleButton* it = this->m_next; it != this; it = it->m_next ) {
			if ( firstDown )
				it->PriSetUp();
			else if ( it->Down() && it->Visible() && it->Enabled() )
				firstDown = it;
			else
				it->PriSetUp();

			if ( !firstDown && it->Visible() && it->Enabled() )
				candidate = it;
		}

		if ( !firstDown && Visible() && Enabled() )
			this->PriSetDown();
		else if ( candidate )
			candidate->PriSetDown();
		else
			this->PriSetDown();
	}
}
开发者ID:chrisBGithub,项目名称:unflobtactical,代码行数:30,代码来源:gamui.cpp

示例6: getButtonWithId

void
SelectableList::addListItem(std::string item) {

  // TODO Do not add item that already exists.
  int x{m_xCoordinate + 5};
  int y = m_yCoordinate + m_height - (5 + 30 * (1 + m_buttons.size()));
  int width{m_width - 10};
  int height{30};
  auto func = [&](int id) {
    ToggleButton* button = getButtonWithId(id);
    if (button->isToggled()) {
      // If there already is a button toggled, untoggle it.
      if (m_currentlyToggled)
        m_currentlyToggled->toggle();

      m_currentlyToggled = button;
    } else {
      // No button is toggled.
      m_currentlyToggled = nullptr;
    }
  };

  ToggleButton button = ToggleButton(
    ++idCounter, x, y, width, height, m_graphicsManager, func, item, m_layer);
  m_buttons.push_back(std::move(button));
}
开发者ID:felixbarring,项目名称:VoxelGame,代码行数:26,代码来源:selectableList.cpp

示例7: ToggleButton

bool MyApp::OnInit() 
{
	ToggleButton * tb = new ToggleButton(wxT("ToggleButton测试")) ;
	tb->Centre();
	tb->Show(true);

	return true;
}
开发者ID:xuweirong,项目名称:wxWidgets,代码行数:8,代码来源:main.cpp

示例8: set_light

void vis_settings_panel_impl::set_light(bool on)
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    if (root->isChild(setting_dlg + "/Settings/chkLights"))
    {
        ToggleButton* button = static_cast<ToggleButton*>(root->getChild(setting_dlg + "/Settings/chkLights"));
        return button->setSelected(on);
    }
}
开发者ID:yaroslav-tarasov,项目名称:test_osg,代码行数:10,代码来源:vis_settings_panel_impl.cpp

示例9: jmin

void NTLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown){
    
    float fontSize = jmin (15.0f, button.getHeight() * 0.75f);
    const int tickWidth = fontSize * 1.6f;
    
    drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
                 tickWidth, tickWidth,
                 button.getToggleState(),
                 button.isEnabled(),
                 isMouseOverButton,
                 isButtonDown);
    
    g.setColour (button.findColour (ToggleButton::textColourId));
    g.setFont (fontSize);
    
    if (! button.isEnabled())
        g.setOpacity (0.5f);
    
    const int textX = (int) tickWidth + 10;
    
    g.drawFittedText (button.getButtonText(),
                      textX, 0,
                      button.getWidth() - textX - 2, button.getHeight(),
                      Justification::centredLeft, 10);
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:25,代码来源:NTLookAndFeel.cpp

示例10: ToggleButton

ToggleButton* InfoWidget::createToggleButton(Widget* p_pMatrix, ElementType p_eType, QString p_rRefChannel)
{
    ToggleButton *tb = new ToggleButton(NULL, "intro-open.svg", "intro-close.svg", "intro-close.svg", "intro-open.svg", QSize(INFO_WIDTH, SEPARATOR_HEIGHT), false);
    TbWrapp *wrapp = new TbWrapp(p_pMatrix, tb, p_eType, p_rRefChannel);
    if (!m_rToggleButtons.contains(p_eType)) {
        m_rToggleButtons.insert(p_eType, new QMap<QString, TbWrapp*>);
    }
    m_rToggleButtons[p_eType]->insert(p_rRefChannel, wrapp);
    tb->setToolTip(m_pMatrix->getDisplayFunction(IN, "", p_eType, p_rRefChannel, true));
    tb->setValue(m_pMatrix->isVisible(p_eType, p_rRefChannel));
    return tb;
}
开发者ID:LiveMix,项目名称:LiveMix,代码行数:12,代码来源:ChannelsWidgets.cpp

示例11: readSettings

void ProgressManagerPrivate::init()
{
    readSettings();

    m_statusBarWidgetContainer = new StatusBarWidget;
    m_statusBarWidget = new QWidget;
    QHBoxLayout *layout = new QHBoxLayout(m_statusBarWidget);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    m_statusBarWidget->setLayout(layout);
    m_summaryProgressWidget = new QWidget(m_statusBarWidget);
    m_summaryProgressWidget->setVisible(!m_progressViewPinned);
    m_summaryProgressWidget->setGraphicsEffect(m_opacityEffect);
    m_summaryProgressLayout = new QHBoxLayout(m_summaryProgressWidget);
    m_summaryProgressLayout->setContentsMargins(0, 0, 0, 2);
    m_summaryProgressLayout->setSpacing(0);
    m_summaryProgressWidget->setLayout(m_summaryProgressLayout);
    m_summaryProgressBar = new ProgressBar(m_summaryProgressWidget);
    m_summaryProgressBar->setMinimumWidth(70);
    m_summaryProgressBar->setTitleVisible(false);
    m_summaryProgressBar->setSeparatorVisible(false);
    m_summaryProgressBar->setCancelEnabled(false);
    m_summaryProgressLayout->addWidget(m_summaryProgressBar);
    layout->addWidget(m_summaryProgressWidget);
    ToggleButton *toggleButton = new ToggleButton(m_statusBarWidget);
    layout->addWidget(toggleButton);
    m_statusBarWidgetContainer->setWidget(m_statusBarWidget);
    m_statusBarWidgetContainer->setPosition(StatusBarWidget::RightCorner);
    ExtensionSystem::PluginManager::addObject(m_statusBarWidgetContainer);
    m_statusBarWidget->installEventFilter(this);

    QAction *toggleProgressView = new QAction(tr("Toggle Progress Details"), this);
    toggleProgressView->setCheckable(true);
    toggleProgressView->setChecked(m_progressViewPinned);
    // we have to set an transparent icon to prevent the tool button to show text
    QPixmap p(1, 1);
    p.fill(Qt::transparent);
    toggleProgressView->setIcon(QIcon(p));
    Command *cmd = ActionManager::registerAction(toggleProgressView,
                                                 "QtCreator.ToggleProgressDetails");
    cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost()
                                               ? tr("Ctrl+Shift+0")
                                               : tr("Alt+Shift+0")));
    connect(toggleProgressView, &QAction::toggled,
            this, &ProgressManagerPrivate::progressDetailsToggled);
    toggleButton->setDefaultAction(cmd->action());

    m_progressView->setVisible(m_progressViewPinned);

    initInternal();
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:51,代码来源:progressmanager.cpp

示例12: 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

示例13: execSyncV

void ToggleButtonBase::execSyncV(      FieldContainer    &oFrom,
                                        ConstFieldMaskArg  whichField,
                                        AspectOffsetStore &oOffsets,
                                        ConstFieldMaskArg  syncMode,
                                  const UInt32             uiSyncInfo)
{
    ToggleButton *pThis = static_cast<ToggleButton *>(this);

    pThis->execSync(static_cast<ToggleButton *>(&oFrom),
                    whichField,
                    oOffsets,
                    syncMode,
                    uiSyncInfo);
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:14,代码来源:OSGToggleButtonBase.cpp

示例14: RemoveFromToggleGroup

void ToggleButton::RemoveFromToggleGroup()
{
	if ( m_next ) {
		ToggleButton* other = m_next;
		
		// unlink
		m_prev->m_next = m_next;
		m_next->m_prev = m_prev;

		// clean up the group just left.
		if ( other != this ) {
			other->ProcessToggleGroup();
		}
		m_next = m_prev = this;
	}
}
开发者ID:chrisBGithub,项目名称:unflobtactical,代码行数:16,代码来源:gamui.cpp

示例15: Container

Container *Intro::setUpExampleUI()
{
    // A small example UI, illustrating some of the core controls.
    // The UI is arranged using a Container with a stack layout.
    Container *exampleUI = new Container();
    StackLayout *exampleUILayout = new StackLayout();

    exampleUI->setLayout(exampleUILayout);

    // A TextArea with text input functionality
    TextArea *exampleTextArea = new TextArea();
    exampleTextArea->textStyle()->setBase(SystemDefaults::TextStyles::bodyText());
    exampleTextArea->setHorizontalAlignment(HorizontalAlignment::Fill);

    // An example of a Slider
    Slider *exampleSlider = new Slider();
    exampleSlider->setValue(0.5f);
    exampleSlider->setHorizontalAlignment(HorizontalAlignment::Left);
    exampleSlider->setVerticalAlignment(VerticalAlignment::Bottom);

    // A ToggleButton
    ToggleButton *exampleToggle = new ToggleButton();
    exampleToggle->setHorizontalAlignment(HorizontalAlignment::Right);

    // A regular Button
    Button *exampleButton = new Button();
    exampleButton->setText("Button");

    // Container for the buttons
    Container *buttonContainer = new Container();
    DockLayout *buttonContainerLayout = new DockLayout();

    buttonContainer->setLayout(buttonContainerLayout);
    buttonContainer->setHorizontalAlignment(HorizontalAlignment::Fill);

    // Adding the buttons to the container.
    buttonContainer->add(exampleToggle);
    buttonContainer->add(exampleButton);

    // Add the Controls to the Container, the layouting is done using
    // layout properties and margins of each control (see code above).
    exampleUI->add(exampleTextArea);
    exampleUI->add(exampleSlider);
    exampleUI->add(buttonContainer);

    return exampleUI;
}
开发者ID:Angtrim,项目名称:Cascades-Samples,代码行数:47,代码来源:intro.cpp


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