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


C++ ComboBox::addItem方法代码示例

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


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

示例1: onExecute

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

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

示例3: fillCombo

void CtrlrFontManager::fillCombo (ComboBox &comboToFill, const bool showOsFonts, const bool showBuiltInFonts, const bool showImportedFonts, const bool showJuceFonts)
{
    comboToFill.clear();
    int i = 0;

    if (showJuceFonts)
    {
        comboToFill.addSectionHeading ("OS Default fonts");
        for (i=0; i<juceFonts.size(); i++)
        {
            comboToFill.addItem (juceFonts[i].getTypefaceName(), allFontCount + i + 1);
        }

        allFontCount += i;
    }

    if (showBuiltInFonts)
    {
        comboToFill.addSectionHeading ("Ctrlr Built-In fonts");
        for (i=0; i<builtInFonts.size(); i++)
        {
            comboToFill.addItem (builtInFonts[i].getTypefaceName(), allFontCount + i + 1);
        }

        allFontCount += i;
    }

    if (showImportedFonts)
    {
        reloadImportedFonts();

        comboToFill.addSectionHeading ("Imported fonts (from resources)");
        for (i=0; i<importedFonts.size(); i++)
        {
            comboToFill.addItem (importedFonts[i].getTypefaceName(), allFontCount + i + 1);
        }

        allFontCount += i;
    }

    if (showOsFonts)
    {
        comboToFill.addSectionHeading ("OS Fonts");
        for (i=0; i<osFonts.size(); i++)
        {
            comboToFill.addItem (osFonts[i].getTypefaceName(), allFontCount + i + 1);
        }

        allFontCount += i;
    }
}
开发者ID:noscript,项目名称:ctrlr,代码行数:51,代码来源:CtrlrFontManager.cpp

示例4: onAddItemActivated

void ObjectEditorWidget::onAddItemActivated()
{
    if (! mCurrentObject)
        return;

    Interaction::InputEvent event = mWidgetToEvent.value(sender());
    AddActionDialog dialog(event);
    dialog.exec();

    if (dialog.result() == QDialog::Accepted && dialog.selectedAction()) {
        Action* action = dialog.selectedAction();
        action->setSceneObject(mCurrentObject);
        action->setParent(mCurrentObject);
        mCurrentObject->appendEventAction(event, action);
        ComboBox *comboBox = qobject_cast<ComboBox*>(sender());
        if(comboBox) {
            comboBox->addItem(action->icon(), action->toString(), qVariantFromValue(static_cast<QObject*>(action)));
        }
    }
}
开发者ID:daodaoliang,项目名称:moonriver,代码行数:20,代码来源:object_editor_widget.cpp

示例5: QDockWidget

QDockWidget *TikzCommandInserter::getDockWidget(QWidget *parent)
{
    QDockWidget *tikzDock = new QDockWidget(parent);
    tikzDock->setObjectName("CommandsDock");
    tikzDock->setAllowedAreas(Qt::AllDockWidgetAreas);
    tikzDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    tikzDock->setWindowTitle(m_tikzSections.title);
    tikzDock->setWhatsThis(tr("<p>This is a list of TikZ "
                              "commands.  You can insert these commands in your code by "
                              "clicking on them.  You can obtain more commands by "
                              "changing the category in the combo box.</p>"));

    QAction *focusTikzDockAction = new QAction(parent);
    focusTikzDockAction->setShortcut(QKeySequence(tr("Alt+I")));
    tikzDock->addAction(focusTikzDockAction);
    connect(focusTikzDockAction, SIGNAL(triggered()), tikzDock, SLOT(setFocus()));

    QLabel *commandsComboLabel = new QLabel(tr("Category:"));
    ComboBox *commandsCombo = new ComboBox;
    commandsCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    QStackedWidget *commandsStack = new QStackedWidget;
    connect(commandsCombo, SIGNAL(currentIndexChanged(int)), commandsStack, SLOT(setCurrentIndex(int)));

    QListWidget *tikzListWidget = new QListWidget;
    addListWidgetItems(tikzListWidget, m_tikzSections, false); // don't add children
    tikzListWidget->setMouseTracking(true);
    connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
    connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
    connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//	connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
    commandsCombo->addItem(tr("General"));
    commandsStack->addWidget(tikzListWidget);

    for (int i = 0; i < m_tikzSections.children.size(); ++i)
    {
        QListWidget *tikzListWidget = new QListWidget;
        addListWidgetItems(tikzListWidget, m_tikzSections.children.at(i));
        tikzListWidget->setMouseTracking(true);
        connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
        connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
        connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//		connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));

        QString comboItemText = m_tikzSections.children.at(i).title;
        commandsCombo->addItem(comboItemText.remove('&'));
        commandsStack->addWidget(tikzListWidget);
    }

    QGridLayout *tikzLayout = new QGridLayout;
    tikzLayout->addWidget(commandsComboLabel, 0, 0);
    tikzLayout->addWidget(commandsCombo, 0, 1);
    tikzLayout->addWidget(commandsStack, 1, 0, 1, 2);
    tikzLayout->setMargin(5);

    TikzCommandWidget *tikzWidget = new TikzCommandWidget;
    tikzWidget->setLayout(tikzLayout);
    tikzDock->setWidget(tikzWidget);
    tikzDock->setFocusProxy(commandsCombo);

    return tikzDock;
}
开发者ID:KarateSnowMachine,项目名称:qtikz-svn,代码行数:61,代码来源:tikzcommandinserter.cpp

示例6: handleCommand

void UploadWindow::handleCommand(int res)
{
    if (res == 1)
    {
        if (!smugMug.isUploading() || AlertWindow::showOkCancelBox(AlertWindow::InfoIcon, "Komodo Drop", 
            "There is an upload in progress, quit anyway?") == 1)
        {
            JUCEApplication::quit();
        }
    }
    else if (res == 2)
    {
        Settings::getInstance()->showSettingsDialog();
    }
    else if (res == 3)
    {
        AlertWindow::showMessageBox(AlertWindow::InfoIcon, "Komodo Drop " + JUCEApplication::getInstance()->getApplicationVersion(), 
            "Created By: Roland Rabien ([email protected])\nBased on JUCE (www.rawmaterialsoftware.com)");
    }
    else if (res == 4)
    {
        setVisible(!isVisible());
    }
    else if (res == 5)
    {
        if (!smugMug.isLoggedIn())
            smugMug.login(Settings::getInstance()->email, Settings::getInstance()->password);

        OwnedArray<Album> albums;
        smugMug.getAlbumList(albums);
        if (albums.size() > 0)
        {
            ComboBox* album = new ComboBox("");
            album->setSize(300, 26);
            album->setVisible(true);

            for (int i = 0; i < albums.size(); i++)
                album->addItem(albums[i]->getDisplayTitle(), i + 1);
            album->setSelectedItemIndex(0);
            
            AlertWindow aw("Komodo Drop", "Delete album:", AlertWindow::InfoIcon);
            aw.addCustomComponent(album);
            aw.addButton("ok", 1);
            aw.addButton("cancel", 2);

            if (aw.runModalLoop() == 1)
            {
                smugMug.deleteAlbum(albums[album->getSelectedId() - 1]->id);
            }
            delete album;
        }
    }
    else if (res == 6)
    {
        if (!smugMug.isLoggedIn())
            smugMug.login(Settings::getInstance()->email, Settings::getInstance()->password);

        OwnedArray<Category> categories;
        smugMug.getCategoryList(categories);
        if (categories.size())
        {
            ComboBox* cats = new ComboBox("");
            cats->setSize(300, 26);
            cats->setVisible(true);

            for (int i = 0; i < categories.size(); i++)
                cats->addItem(categories[i]->title, categories[i]->id + 1);
            cats->setSelectedItemIndex(0);
            
            AlertWindow aw("Komodo Drop", "Delete category:", AlertWindow::InfoIcon);
            aw.addCustomComponent(cats);
            aw.addButton("ok", 1);
            aw.addButton("cancel", 2);

            if (aw.runModalLoop() == 1)
            {
                smugMug.deleteCategory(cats->getSelectedId() - 1);
            }
            delete cats;
        }
    }
    else if (res == 7)
    {
        if (!smugMug.isLoggedIn())
            smugMug.login(Settings::getInstance()->email, Settings::getInstance()->password);

        OwnedArray<Category> categories;
        smugMug.getCategoryList(categories);

        OwnedArray<SubCategory> subCategories;
        smugMug.getSubCategoryList(subCategories);

        if (subCategories.size())
        {
            ComboBox* cats = new ComboBox("");
            cats->setSize(300, 26);
            cats->setVisible(true);

            for (int i = 0; i < subCategories.size(); i++)
            {
//.........这里部分代码省略.........
开发者ID:FigBug,项目名称:komododrop,代码行数:101,代码来源:UploadWindow.cpp

示例7: onExecute

void OptionsCommand::onExecute(Context* context)
{
  // Load the window widget
  UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
  Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
  Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
  Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
  Widget* cursor_color_box = app::find_widget<Widget>(window, "cursor_color_box");
  Widget* grid_color_box = app::find_widget<Widget>(window, "grid_color_box");
  Widget* pixel_grid_color_box = app::find_widget<Widget>(window, "pixel_grid_color_box");
  m_checked_bg = app::find_widget<ComboBox>(window, "checked_bg_size");
  m_checked_bg_zoom = app::find_widget<Widget>(window, "checked_bg_zoom");
  Widget* checked_bg_color1_box = app::find_widget<Widget>(window, "checked_bg_color1_box");
  Widget* checked_bg_color2_box = app::find_widget<Widget>(window, "checked_bg_color2_box");
  Button* checked_bg_reset = app::find_widget<Button>(window, "checked_bg_reset");
  Widget* undo_size_limit = app::find_widget<Widget>(window, "undo_size_limit");
  Widget* undo_goto_modified = app::find_widget<Widget>(window, "undo_goto_modified");
  Widget* button_ok = app::find_widget<Widget>(window, "button_ok");

  // Cursor color
  ColorButton* cursor_color = new ColorButton(Editor::get_cursor_color(), IMAGE_RGB);
  cursor_color->setId("cursor_color");
  cursor_color_box->addChild(cursor_color);

  // Get global settings for documents
  IDocumentSettings* docSettings = context->getSettings()->getDocumentSettings(NULL);

  // Grid color
  ColorButton* grid_color = new ColorButton(docSettings->getGridColor(), IMAGE_RGB);
  grid_color->setId("grid_color");
  grid_color_box->addChild(grid_color);

  // Pixel grid color
  ColorButton* pixel_grid_color = new ColorButton(docSettings->getPixelGridColor(), IMAGE_RGB);
  pixel_grid_color->setId("pixel_grid_color");
  pixel_grid_color_box->addChild(pixel_grid_color);

  // Others
  if (get_config_bool("Options", "MoveClick2", false))
    move_click2->setSelected(true);

  if (get_config_bool("Options", "DrawClick2", false))
    draw_click2->setSelected(true);

  if (get_config_bool("Options", "MoveSmooth", true))
    check_smooth->setSelected(true);

  // Checked background size
  m_checked_bg->addItem("16x16");
  m_checked_bg->addItem("8x8");
  m_checked_bg->addItem("4x4");
  m_checked_bg->addItem("2x2");
  m_checked_bg->setSelectedItem((int)RenderEngine::getCheckedBgType());

  // Zoom checked background
  if (RenderEngine::getCheckedBgZoom())
    m_checked_bg_zoom->setSelected(true);

  // Checked background colors
  m_checked_bg_color1 = new ColorButton(RenderEngine::getCheckedBgColor1(), IMAGE_RGB);
  m_checked_bg_color2 = new ColorButton(RenderEngine::getCheckedBgColor2(), IMAGE_RGB);

  checked_bg_color1_box->addChild(m_checked_bg_color1);
  checked_bg_color2_box->addChild(m_checked_bg_color2);

  // Reset button
  checked_bg_reset->Click.connect(Bind<void>(&OptionsCommand::onResetCheckedBg, this));

  // Undo limit
  undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));

  // Goto modified frame/layer on undo/redo
  if (get_config_bool("Options", "UndoGotoModified", true))
    undo_goto_modified->setSelected(true);

  // Show the window and wait the user to close it
  window->openWindowInForeground();

  if (window->getKiller() == button_ok) {
    int undo_size_limit_value;

    Editor::set_cursor_color(cursor_color->getColor());
    docSettings->setGridColor(grid_color->getColor());
    docSettings->setPixelGridColor(pixel_grid_color->getColor());

    set_config_bool("Options", "MoveSmooth", check_smooth->isSelected());
    set_config_bool("Options", "MoveClick2", move_click2->isSelected());
    set_config_bool("Options", "DrawClick2", draw_click2->isSelected());

    RenderEngine::setCheckedBgType((RenderEngine::CheckedBgType)m_checked_bg->getSelectedItem());
    RenderEngine::setCheckedBgZoom(m_checked_bg_zoom->isSelected());
    RenderEngine::setCheckedBgColor1(m_checked_bg_color1->getColor());
    RenderEngine::setCheckedBgColor2(m_checked_bg_color2->getColor());

    undo_size_limit_value = undo_size_limit->getTextInt();
    undo_size_limit_value = MID(1, undo_size_limit_value, 9999);
    set_config_int("Options", "UndoSizeLimit", undo_size_limit_value);
    set_config_bool("Options", "UndoGotoModified", undo_goto_modified->isSelected());

    // Save configuration
//.........这里部分代码省略.........
开发者ID:RobertLowe,项目名称:aseprite,代码行数:101,代码来源:cmd_options.cpp

示例8: addLookAndFeel

 void addLookAndFeel (LookAndFeel* laf, const String& name)
 {
     lookAndFeels.add (laf);
     lafBox.addItem (name, lafBox.getNumItems() + 1);
 }
开发者ID:Neknail,项目名称:JUCE,代码行数:5,代码来源:LookAndFeelDemo.cpp

示例9: main

int main(int argc, char * argv[])
{
  Font *font(FontFactory::create(
        (unsigned char*)_binary_sans_set_bin_start,
        (unsigned char*)_binary_sans_map_bin_start));
  TextAreaFactory::setFont(font);
  //TextAreaFactory::usePaletteData((const char*)_binary_vera_pal_bin_start, 32);
  Keyboard * keyBoard = new Keyboard();
  ScrollPane scrollPane;
  keyBoard->setTopLevel(&scrollPane);
#if 1
  TextField * tf = new TextField("Enter the value here. This line is too big to fit in");
  TextField * passwd = new TextField(std::string());
  RichTextArea * rich = (RichTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_RICH);
  Button * goBtn = new Button("Go");
  rich->appendText("This is some long text ");
  passwd->setSize(60,18);
  
  scrollPane.setTopLevel();
  scrollPane.add(rich);
  scrollPane.add(passwd);
  scrollPane.add(goBtn);
  scrollPane.setSize(Canvas::instance().width(),Canvas::instance().height());
  scrollPane.add(tf);
  scrollPane.setScrollIncrement(13);

#else
  RichTextArea * rich = (RichTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_RICH);
  TextArea * t = TextAreaFactory::create();
  EditableTextArea * t2 = (EditableTextArea*)TextAreaFactory::create(TextAreaFactory::TXT_EDIT);
  // t2->setBackgroundColor(Color(31,31,0));

  
  ScrollPane * subPane = new ScrollPane;
  subPane->add(t2);
  subPane->setTopLevel(false);
  subPane->setSize(Canvas::instance().width(),Canvas::instance().height());
  subPane->setScrollIncrement(t2->font().height());
  subPane->setStretchChildren(true);
  
  
  ComboBox * emptyCombo = new ComboBox();
  ComboBox * oneValCombo = new ComboBox();
  ComboBox * combo = new ComboBox();
  combo->setSize(60, 18);
  ComboBox * combo2 = new ComboBox();
  combo2->setSize(90, 18);
  
  std::string str("Hello World");
  Button * b1 = new Button(str);

  str = "Combo box!";
  oneValCombo->addItem(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Another One - with very wide text";
  Button * b2 = new Button(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Three- wide, but fixed width";
  Button * b3 = new Button(str);
  b3->setSize(60, 18);
  combo2->addItem(str);
  combo2->addItem(str);
  str = "Go";
  Button * b4 = new Button(str);
  //b4->setSize(6*13, 10);
  str = "Last one!";
  Button * b5 = new Button(str);
  combo->addItem(str);
  combo2->addItem(str);
  combo2->addItem(str);

  t2->setListener(keyBoard);
  
  str = "A text field that has a very, very long and pointless string";
  TextField * tf1 = new TextField(str);
  tf1->setSize(160, 18);
  tf1->setListener(keyBoard);
  combo2->addItem(str);

  TextArea * rbLabel = TextAreaFactory::create();
  str = "Radio button label.";
  rbLabel->appendText(str);

  TextArea * cbLabel = TextAreaFactory::create();
  str = "CheckBox label.";
  cbLabel->appendText(str);

  RadioButton * rb = new RadioButton();
  RadioButton * rb2 = new RadioButton();
  RadioButton * rb3 = new RadioButton();
  CheckBox * cb = new CheckBox();
  ButtonGroup bg;
  bg.add(rb);
  bg.add(rb2);
  bg.add(rb3);
  keyBoard->setTopLevel(&scrollPane);
//.........这里部分代码省略.........
开发者ID:deeice,项目名称:bunjalloo,代码行数:101,代码来源:main.cpp

示例10: TopLevelResizableLayout

MainPanel::MainPanel()
    : TopLevelResizableLayout (this)
  , m_lastTypeId (0)
{
  setOpaque (true);

  const int w = 512;
  const int h = 512 + 102;
  const int gap = 4;
  const int x0 = 4;

  m_listeners.add (this);

  int x;
  int y = 4;

  x = x0;

  {
    ComboBox* c = new ComboBox;
    c->setBounds (x, y, 160, 24);
    addToLayout (c, anchorTopLeft);
    addAndMakeVisible (c);
    buildFamilyMenu (c);
    m_menuFamily = c;    
    c->addListener (this);
  }

  x = this->getChildComponent (this->getNumChildComponents() - 1)->getBounds().getRight() + gap;

  {
    ComboBox* c = new ComboBox;
    c->setBounds (x, y, 120, 24);
    addToLayout (c, anchorTopLeft);
    addAndMakeVisible (c);
    buildFamilyMenu (c);
    m_menuType = c;    
    c->addListener (this);
  }

  x = this->getChildComponent (this->getNumChildComponents() - 1)->getBounds().getRight() + gap;

  {
    ComboBox* c = new ComboBox;
    c->setBounds (x, y, 120, 24);
    c->addItem ("Amen Break", 1);
    c->addItem ("Sine Wave (440Hz)", 2);
    c->addItem ("White Noise", 3);
    c->addItem ("Pink Noise", 4);
    addToLayout (c, anchorTopLeft);
    addAndMakeVisible (c);
    m_menuAudio = c;    
    c->addListener (this);
  }

  x = this->getChildComponent (this->getNumChildComponents() - 1)->getBounds().getRight() + gap;

  {
    CpuMeter* c = new CpuMeter (MainApp::getInstance().getAudioOutput().getAudioDeviceManager());
    c->setBounds (w - 80 - gap, y, 80, 24);
    addToLayout (c, anchorTopRight);
    addAndMakeVisible (c);
  }

  y = this->getChildComponent (this->getNumChildComponents()-1)->getBounds().getBottom() + gap;
  x = x0;

  x = w - gap;

  const int hfc = 80;

  {
    Slider* c = new Slider;
    c->setBounds (x - 20, y, 20, hfc + gap + 24);
    c->setSliderStyle (Slider::LinearVertical);
    c->setTextBoxStyle (Slider::NoTextBox, true, 0, 0);
    c->setRange (-40, 12);
    c->setValue (0);
    addAndMakeVisible (c);
    addToLayout (c, anchorTopRight);
    c->addListener (this);
    m_volumeSlider = c;
    
  }

  x = this->getChildComponent (this->getNumChildComponents() - 1)->getBounds().getX() - gap;
 
  {
    Slider* c = new Slider;
    c->setBounds (x - 20, y, 20, hfc + gap + 24);
    c->setSliderStyle (Slider::LinearVertical);
    c->setTextBoxStyle (Slider::NoTextBox, true, 0, 0);
    c->setRange (-2, 2);
    c->setValue (0);
    addAndMakeVisible (c);
    addToLayout (c, anchorTopRight);
    c->addListener (this);
    m_tempoSlider = c;
  }

//.........这里部分代码省略.........
开发者ID:EQ4,项目名称:DSPFiltersDemo,代码行数:101,代码来源:MainPanel.cpp

示例11: init

        void UITestGameState::init(GameContainer* container, StateBasedGame* game) {
            Panel* root = new Panel();
            root->setSize(container->getWidth(), container->getHeight());
            root->setShowBorder(false);

            rightPanel = new ScrollPanel();
            rightPanel->setLocation(50, 50);
            rightPanel->setWidth(container->getWidth()/2);
            rightPanel->setHeight(container->getHeight()-100);
            rightPanel->m_layout = ScrollPanel::LAYOUT_FLOW;

            Label* label2 = new Label("A Text Label #2");
            label2->setMargin(10);
            rightPanel->add(label2);

            TextField* textField2 = new TextField();
            textField2->setMargin(10);
            textField2->setSize(200, 30);
            textField2->setText("A Text Field #2");
            rightPanel->add(textField2);

            Label* label3 = new Label("A Text Label #2");
            label3->setMargin(10);
            rightPanel->add(label3);

            ComboBox* comboBox = new ComboBox();
            comboBox->setMargin(10);
            comboBox->setSize(200, 30);
            comboBox->setItemChangedEvent((void*) &itemChangedEvent);
                ComboBoxItem* comboItemOne = new ComboBoxItem();
                comboItemOne->setText("Item One");
                comboBox->addItem(comboItemOne);
                ComboBoxItem* comboItemTwo = new ComboBoxItem();
                comboItemTwo->setText("Item Two");
                comboBox->addItem(comboItemTwo);
            rightPanel->add(comboBox);

            Label* label4 = new Label("A Text Label #3");
            label4->setMargin(10);
            rightPanel->add(label4);

            CheckBox* checkBox = new CheckBox();
            checkBox->setMargin(10);
            checkBox->setChecked(false);
            checkBox->setStateChangedEvent((void*) &stateChangedEvent);
            rightPanel->add(checkBox);

            CheckBox* checkBox2 = new CheckBox();
            checkBox2->setMargin(10);
            checkBox2->setChecked(true);
            rightPanel->add(checkBox2);

            Label* label5 = new Label("A Text Label four is big");
            label5->setMargin(10);
            rightPanel->add(label5);

            Button* button = new Button();
            button->setText("Click me!");
            button->setSize(50, 50);
            button->setEvent((void*) &buttonClickEvent);
            button->setMargin(10);
            rightPanel->add(button);


            root->add(rightPanel);

            m_rootUIComponent = root;
        }
开发者ID:DTwomey,项目名称:ark2d,代码行数:68,代码来源:UITest.cpp


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