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


C++ ComboBox类代码示例

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


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

示例1: boxBounds

void ProjucerLookAndFeel::drawComboBox (Graphics& g, int width, int height, bool,
                                        int, int, int, int, ComboBox& box)
{
    const auto cornerSize = box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr ? 0.0f : 1.5f;
    Rectangle<int> boxBounds (0, 0, width, height);

    auto isChoiceCompChild = (box.findParentComponentOfClass<ChoicePropertyComponent>() != nullptr);

    if (isChoiceCompChild)
    {
        box.setColour (ComboBox::textColourId, findColour (widgetTextColourId));

        g.setColour (findColour (widgetBackgroundColourId));
        g.fillRect (boxBounds);

        auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).reduced (0, 2).toFloat();
        g.setColour (Colours::black);
        g.fillPath (getChoiceComponentArrowPath (arrowZone));
    }
    else
    {
        g.setColour (box.findColour (ComboBox::outlineColourId));
        g.drawRoundedRectangle (boxBounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);

        auto arrowZone = boxBounds.removeFromRight (boxBounds.getHeight()).toFloat();
        g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f)));
        g.fillPath (getArrowPath (arrowZone, 2, true, Justification::centred));

    }
}
开发者ID:azeteg,项目名称:HISE,代码行数:30,代码来源:jucer_ProjucerLookAndFeel.cpp

示例2: onProcessMessage

bool ComboBoxListBox::onProcessMessage(Message* msg)
{
  switch (msg->type()) {

    case kMouseUpMessage:
      m_comboBox->closeListBox();
      return true;

    case kKeyDownMessage:
      if (hasFocus()) {
        KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
        KeyScancode scancode = keymsg->scancode();

        if (scancode == kKeySpace ||
            scancode == kKeyEnter ||
            scancode == kKeyEnterPad) {
          m_comboBox->closeListBox();
          return true;
        }
      }
      break;
  }

  return ListBox::onProcessMessage(msg);
}
开发者ID:BlueHeisenberg,项目名称:aseprite,代码行数:25,代码来源:combobox.cpp

示例3: OnTextChanged

//-----------------------------------------------------------------------------
// Purpose: Called when the game dir combo box is changed
//-----------------------------------------------------------------------------
void CBaseMapsPage::OnTextChanged(Panel *panel, const char *text)
{
    if (!Q_stricmp(text, m_szComboAllText))
    {
        ComboBox *box = dynamic_cast<ComboBox *>(panel);
        if (box)
        {
            box->SetText("");
            text = "";
        }
    }

    // get filter settings from controls
    UpdateFilterSettings();
    // apply settings
    ApplyGameFilters();

    if (m_bFiltersVisible && (panel == m_pGameModeFilter || panel == m_pDifficultyFilter || panel == m_pMapFilter
         || panel == m_pMapLayoutFilter))
    {
        // if they changed filter settings then cancel the refresh because the old list they are getting
        // will be for the wrong map or gametype, so stop and start a refresh
        StopRefresh();
        //If the filters have changed, we'll want to send a new request with the new data
        //MOM_TODO: uncomment this: StartRefresh()
    }
}
开发者ID:Asunaya,项目名称:game,代码行数:30,代码来源:BaseMapsPage.cpp

示例4: OnTextChanged

//-----------------------------------------------------------------------------
// Purpose: Called when the game dir combo box is changed
//-----------------------------------------------------------------------------
void CBaseGamesPage::OnTextChanged(Panel *panel, const char *text)
{
	if (!Q_stricmp(text, m_szComboAllText))
	{
		ComboBox *box = dynamic_cast<ComboBox *>(panel);
		if (box)
		{
			box->SetText("");
			text = "";
		}
	}

	// get filter settings from controls
	UpdateFilterSettings();

	// apply settings
	ApplyGameFilters();

	if ( m_bFiltersVisible && ( panel == m_pGameFilter || panel == m_pLocationFilter ) )
	{
		// if they changed games and/or region then cancel the refresh because the old list they are getting
		// will be for the wrong game, so stop and start a refresh
		StopRefresh(); 
		GetNewServerList(); 
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:29,代码来源:BaseGamesPage.cpp

示例5: OnTextChanged

//-----------------------------------------------------------------------------
// Purpose: Handles changes to combo boxes
//-----------------------------------------------------------------------------
void CMOMSpectatorMenu::OnTextChanged(KeyValues *data)
{
    Panel *panel = reinterpret_cast<Panel *>(data->GetPtr("panel"));

    ComboBox *box = dynamic_cast<ComboBox *>(panel);

    if (box == m_pConfigSettings) // don't change the text in the config setting combo
    {
        m_pConfigSettings->SetText("#Spec_Options");
    }
    else if (box == m_pPlayerList)
    {
        KeyValues *kv = box->GetActiveItemUserData();
        if (kv && GameResources())
        {
            const char *player = kv->GetString("player");

            int currentPlayerNum = GetSpectatorTarget();
            const char *currentPlayerName = GameResources()->GetPlayerName(currentPlayerNum);

            if (!FStrEq(currentPlayerName, player))
            {
                char command[128];
                Q_snprintf(command, sizeof(command), "spec_player \"%s\"", player);
                engine->ClientCmd(command);
            }
        }
    }
}
开发者ID:Asunaya,项目名称:game,代码行数:32,代码来源:momSpectatorGUI.cpp

示例6: drawComboBox

//==============================================================================
void OldSchoolLookAndFeel::drawComboBox (Graphics& g, int width, int height,
                                         const bool isButtonDown,
                                         int buttonX, int buttonY,
                                         int buttonW, int buttonH,
                                         ComboBox& box)
{
    g.fillAll (box.findColour (ComboBox::backgroundColourId));

    g.setColour (box.findColour ((isButtonDown) ? ComboBox::buttonColourId
                                                : ComboBox::backgroundColourId));
    g.fillRect (buttonX, buttonY, buttonW, buttonH);

    g.setColour (box.findColour (ComboBox::outlineColourId));
    g.drawRect (0, 0, width, height);

    const float arrowX = 0.2f;
    const float arrowH = 0.3f;

    if (box.isEnabled())
    {
        Path p;
        p.addTriangle (buttonX + buttonW * 0.5f,            buttonY + buttonH * (0.45f - arrowH),
                       buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
                       buttonX + buttonW * arrowX,          buttonY + buttonH * 0.45f);

        p.addTriangle (buttonX + buttonW * 0.5f,            buttonY + buttonH * (0.55f + arrowH),
                       buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
                       buttonX + buttonW * arrowX,          buttonY + buttonH * 0.55f);

        g.setColour (box.findColour ((isButtonDown) ? ComboBox::backgroundColourId
                                                    : ComboBox::buttonColourId));
        g.fillPath (p);
    }
}
开发者ID:randi2kewl,项目名称:ShoutOut,代码行数:35,代码来源:juce_OldSchoolLookAndFeel.cpp

示例7: main

int main(int argc, char **argv)
{
  QApplication app(argc,argv);
  ComboBox *window = new ComboBox();

  app.setMainWidget(window);
  window->show();

  return app.exec();
}
开发者ID:AKSahai,项目名称:Linux_Programming,代码行数:10,代码来源:ComboBox.cpp

示例8: reader

void SpriteSizeCommand::onExecute(Context* context)
{
  const ContextReader reader(UIContext::instance()); // TODO use the context in sprite size command
  const Sprite* sprite(reader.sprite());

  // load the window widget
  base::UniquePtr<Window> window(app::load_widget<Window>("sprite_size.xml", "sprite_size"));
  m_widthPx = app::find_widget<Entry>(window, "width_px");
  m_heightPx = app::find_widget<Entry>(window, "height_px");
  m_widthPerc = app::find_widget<Entry>(window, "width_perc");
  m_heightPerc = app::find_widget<Entry>(window, "height_perc");
  m_lockRatio = app::find_widget<CheckBox>(window, "lock_ratio");
  ComboBox* method = app::find_widget<ComboBox>(window, "method");
  Widget* ok = app::find_widget<Widget>(window, "ok");

  m_widthPx->setTextf("%d", sprite->width());
  m_heightPx->setTextf("%d", sprite->height());

  m_lockRatio->Click.connect(Bind<void>(&SpriteSizeCommand::onLockRatioClick, this));
  m_widthPx->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onWidthPxChange, this));
  m_heightPx->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onHeightPxChange, this));
  m_widthPerc->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onWidthPercChange, this));
  m_heightPerc->EntryChange.connect(Bind<void>(&SpriteSizeCommand::onHeightPercChange, this));

  method->addItem("Nearest-neighbor");
  method->addItem("Bilinear");
  method->setSelectedItemIndex(get_config_int("SpriteSize", "Method",
                                              doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR));

  window->remapWindow();
  window->centerWindow();

  load_window_pos(window, "SpriteSize");
  window->setVisible(true);
  window->openWindowInForeground();
  save_window_pos(window, "SpriteSize");

  if (window->getKiller() == ok) {
    int new_width = m_widthPx->getTextInt();
    int new_height = m_heightPx->getTextInt();
    ResizeMethod resize_method =
      (ResizeMethod)method->getSelectedItemIndex();

    set_config_int("SpriteSize", "Method", resize_method);

    {
      SpriteSizeJob job(reader, new_width, new_height, resize_method);
      job.startJob();
      job.waitJob();
    }

    ContextWriter writer(reader);
    update_screen_for_document(writer.document());
  }
}
开发者ID:pedromaltez-forks,项目名称:aseprite,代码行数:55,代码来源:cmd_sprite_size.cpp

示例9: updateCameraList

    void updateCameraList()
    {
        cameraSelectorComboBox.clear();
        cameraSelectorComboBox.addItem ("No camera", 1);
        cameraSelectorComboBox.addSeparator();

        StringArray cameras = CameraDevice::getAvailableDevices();

        for (int i = 0; i < cameras.size(); ++i)
            cameraSelectorComboBox.addItem (cameras[i], i + 2);
    }
开发者ID:bacchus,项目名称:JUCE,代码行数:11,代码来源:CameraDemo.cpp

示例10:

void
OptDlg::OnExit(AWEvent* event)
{
    ComboBox* cmb = (ComboBox*) event->window;

    if (!cmb || cmb->IsListShowing())
    return;

    if (description)
    description->SetText("");
}
开发者ID:Banbury,项目名称:starshatter-open,代码行数:11,代码来源:OptDlg.cpp

示例11: detachChild

void DemoState::createPlainWindow() {
	detachChild("plainWindow");

	plainWindow = new Window("plainWindow", Vector2(100, 100), Vector2(300, 200), ColourRGBA(ColourRGBA::CYAN));
	plainWindow->setDraggable(true);
	plainWindow->setResizable(true);
	plainWindow->setGradiant(TO_BOTTOM, 4.0f);

	ComboBox* gradiants = new ComboBox("gradiantCombo", Vector2(120, 80), 120);
	gradiants->setOptions(5, "To bottom", "To top", "To left", "To right", "None");
	gradiants->attachChild(new Label("gradLabel", "Gradiant:", 10, Vector2(-55, 10)));
	plainWindow->attachChild(gradiants);
	attachChild(plainWindow);
}
开发者ID:Sypanite,项目名称:GUI-Framework,代码行数:14,代码来源:DemoState.cpp

示例12: execSyncV

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

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

示例13:

void CtrlrCombo::CtrlrComboLF::positionComboBoxText (ComboBox& box, Label& label)
{
	int bw			= owner.getProperty (Ids::uiComboButtonWidth);

	if ((bool)owner.getProperty (Ids::uiComboButtonWidthOverride) == true)
	{
		label.setBounds (1, 1, box.getWidth() - bw, box.getHeight() - 2);
	}
	else
	{
		label.setBounds (1, 1, box.getWidth() + 3 - box.getHeight(), box.getHeight() - 2);
	}

    label.setFont (getComboBoxFont (box));
}
开发者ID:atomicstack,项目名称:ctrlr,代码行数:15,代码来源:CtrlrCombo.cpp

示例14: processResultsFromSetupItems

    Result processResultsFromSetupItems (Component& setupComp)
    {
        ComboBox* cb = dynamic_cast<ComboBox*> (setupComp.findChildWithID ("filesToCreate"));
        jassert (cb != nullptr);
        createMainCpp = createWindow = false;

        switch (cb->getSelectedItemIndex())
        {
            case 0:     createMainCpp = true;  break;
            case 1:     createMainCpp = createWindow = true;  break;
            case 2:     break;
            default:    jassertfalse; break;
        }

        return Result::ok();
    }
开发者ID:lucem,项目名称:JUCE,代码行数:16,代码来源:jucer_NewProjectWizard.cpp

示例15: ComboItemSelected

void CCDFrameInterface::ComboItemSelected(ComboBox& sender, int itemIndex) {
	if (sender == GUI->CCDDevice_Combo){
		m_Device = sender.ItemText(itemIndex);
		if (ThePixInsightINDIInterface != 0) {

			PixInsightINDIInstance* pInstance = &ThePixInsightINDIInterface->instance;

			if (pInstance==NULL)
				return;

			INDIPropertyListItem CCDProp;
			// check for cooler connection (e.g. Atik cameras)
			GUI->Temperature_Timer.Start();
			if (pInstance->getINDIPropertyItem(m_Device,
					"COOLER_CONNECTION", "CONNECT_COOLER", CCDProp)) {
				if(CCDProp.PropertyValue==String("OFF")){
					INDINewPropertyListItem newPropertyListItem;
					newPropertyListItem.Device=m_Device;
					newPropertyListItem.Property = String("COOLER_CONNECTION");
					newPropertyListItem.Element = String("CONNECT_COOLER");
					newPropertyListItem.PropertyType = String("INDI_SWITCH");

					newPropertyListItem.NewPropertyValue = String("ON");
					pInstance->sendNewPropertyValue(newPropertyListItem,true);

				}
			}

		}
	}
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:31,代码来源:CCDFrameInterface.cpp


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