• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ToggleButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Vec2

void UILayer::initButtons( void )
{
    //정지 팝업띄우는 버튼
    Button* stop = Button::buttonWithFrameImageFile("stop.png", "stop.png");
    stop->setPosition(DTool::getCenter(this) + Vec2(264, 456));
    stop->addAction([this]()
    {
        PopupStop* popupStop = PopupStop::create("", "popup_stop.png");
        popupStop->showPopup(this);
    },
    TOUCH_DOWN);
    
    addChild(stop);
    
    //하트버튼
    ToggleButton* heart = ToggleButton::buttonWithFrameImageFile("btn_heart_on.png", "btn_heart_off.png");
    heart->setPosition(DTool::getCenter(this) + Vec2(254, 180));
    addChild(heart);
}
开发者ID:devYongJun,项目名称:Wizard,代码行数:19,代码来源:UILayer.cpp


示例17: ignoreUnused

void ProjucerLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown)
{
    ignoreUnused (isMouseOverButton, isButtonDown);

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

    bool isTextEmpty = button.getButtonText().isEmpty();
    bool isPropertyComponentChild = (dynamic_cast<BooleanPropertyComponent*> (button.getParentComponent()) != nullptr);

    auto bounds = button.getLocalBounds();

    auto sideLength = isPropertyComponentChild ? 25 : bounds.getHeight();

    auto rectBounds = isTextEmpty ? bounds
                                  : bounds.removeFromLeft (jmin (sideLength, bounds.getWidth() / 3));

    rectBounds = rectBounds.withSizeKeepingCentre (sideLength, sideLength).reduced (4);

    g.setColour (button.findColour (ToggleButton::tickDisabledColourId));
    g.drawRoundedRectangle (rectBounds.toFloat(), 2.0f, 1.0f);

    if (button.getToggleState())
    {
        g.setColour (button.findColour (ToggleButton::tickColourId));
        const auto tick = getTickShape (0.75f);
        g.fillPath (tick, tick.getTransformToScaleToFit (rectBounds.reduced (2).toFloat(), false));
    }

    if (! isTextEmpty)
    {
        bounds.removeFromLeft (5);

        const auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);

        g.setFont (fontSize);
        g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId)
                                              : button.findColour (ToggleButton::textColourId));

        g.drawFittedText (button.getButtonText(), bounds, Justification::centredLeft, 2);
    }
}
开发者ID:azeteg,项目名称:HISE,代码行数:42,代码来源:jucer_ProjucerLookAndFeel.cpp


示例18: drawToggleButton

void TextLookAndFeel::drawToggleButton(Graphics& g, ToggleButton& button,
                                       bool isMouseOverButton, bool isButtonDown) {
  if (button.getToggleState())
    g.setColour(Colour(0xffffc400));
  else
    g.setColour(Colour(0xff313131));
  g.fillRect(button.getLocalBounds());

  g.setColour(Colour(0xff565656));
  g.drawRect(button.getLocalBounds());

  if (isButtonDown) {
    g.setColour(Colour(0x11000000));
    g.fillRect(button.getLocalBounds());
  }
  else if (isMouseOverButton) {
    g.setColour(Colour(0x11ffffff));
    g.fillRect(button.getLocalBounds());
  }
}
开发者ID:hztirf,项目名称:helm,代码行数:20,代码来源:text_look_and_feel.cpp


示例19: CellChecked

void TicTacToeLogic::CellChecked(BaseComponent* sender, const RoutedEventArgs& e)
{
    ToggleButton* btn = NsStaticCast<ToggleButton*>(sender);
    Cell& cell = *Boxing::Unbox<Cell*>(NsStaticCast<Boxing::BoxedValue*>(btn->GetTag()));

    MarkCell(cell);

    NsString winPlay;
    if (HasWon(winPlay))
    {
        WinGame(winPlay);
    }
    else if (HasTied())
    {
        TieGame();
    }
    else
    {
        SwitchPlayer();
    }
}
开发者ID:bitdesign,项目名称:OgreBindings,代码行数:21,代码来源:TicTacToeLogic.cpp


示例20: DoTick

void ParticleScene::DoTick( U32 deltaTime )
{
	for( int i=0; i<buttonArr.Size(); ++i ) {
		ToggleButton* toggle = buttonArr[i]->ToToggleButton();
		if ( toggle && toggle->Down() ) {
			Vector3F pos = { SIZE/2, 0.01f, SIZE/2 };
			Vector3F normal = { 0, 1, 0 };
			//Vector3F dir = { 1, 0, 0 };
			ParticleDef* def = &particleDefArr[i];

			if ( def->spread == ParticleDef::SPREAD_POINT ) {
				engine->particleSystem->EmitPD( *def, pos, normal, deltaTime );
			}
			else {
				Rectangle3F r;
				r.Set( pos.x-0.5f, pos.y, pos.z-0.5f, pos.x+0.5f, pos.y, pos.z+0.5f ); 
				engine->particleSystem->EmitPD( *def, r, normal, deltaTime );
			}
		}
	}
}
开发者ID:fordream,项目名称:alteraorbis,代码行数:21,代码来源:particlescene.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Token类代码示例发布时间:2022-05-31
下一篇:
C++ Todo类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap