void ofApproxPiSetupGUI::onButton(ofxDatGuiButtonEvent e)
{
    if(e.target->getName() == "Abort")
    {
        settings->exit = true;
    }
    else
    {
        settings->exit = false;
        
        if(settings->dur_in_mins == -1)
        {
            gui->getTextInput("Duration (in mins)")->setText("*ENTER DURATION*");
            return;
        }
        
        int selected_channels = nChannels_options_int[getSelectedIndex("NChannels")];
        int available_channels = output_devices[getSelectedIndex("Audio Device")].outputChannels;
        if(selected_channels > available_channels)
        {
            gui->addLabel("***INSUFFICIENT CHANNELS ON OUTPUT DEVICE***");
            return;
        }
    }

    gui->setVisible(false);
    exit();
}
BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask)
{
	BOOL handled = FALSE;
	// do any of the tab buttons have keyboard focus?
	if (mask == MASK_NONE)
	{
		switch(key)
		{
		case KEY_DOWN:
			if (!setSelectedIndex((getSelectedIndex() + 1)))
			{
				make_ui_sound("UISndInvalidOp");
			}
			else
			{
				onCommit();
			}
			handled = TRUE;
			break;
		case KEY_UP:
			if (!setSelectedIndex((getSelectedIndex() - 1)))
			{
				make_ui_sound("UISndInvalidOp");
			}
			else
			{
				onCommit();
			}
			handled = TRUE;
			break;
		case KEY_LEFT:
			if (!setSelectedIndex((getSelectedIndex() - 1)))
			{
				make_ui_sound("UISndInvalidOp");
			}
			else
			{
				onCommit();
			}
			handled = TRUE;
			break;
		case KEY_RIGHT:
			if (!setSelectedIndex((getSelectedIndex() + 1)))
			{
				make_ui_sound("UISndInvalidOp");
			}
			else
			{
				onCommit();
			}
			handled = TRUE;
			break;
		default:
			break;
		}
	}
	return handled;
}
Ejemplo n.º 3
0
Component* TabPanel::getRightmostDecendent(void) const
{
    if(getMFTabContents()->size() > 0 &&
       getSelectedIndex() != -1)
    {
        return getTabContents(getSelectedIndex())->getRightmostDecendent();
    }
    return NULL;
}
//--------------------------------------------------------------
void ofApproxPiSetupGUI::exit(void)
{
    settings->nChannels = nChannels_options_int[getSelectedIndex("NChannels")];
    settings->windowWidth = widths_options_int[getSelectedIndex("Resolution")];
    settings->windowHeight = heights_options_int[getSelectedIndex("Resolution")];
    settings->audioDeviceID = audio_device_options_int[getSelectedIndex("Audio Device")];
    
    settings->doneSetup = true;
}
void DefaultSingleSelectionModel::setSelectedIndex(Int32 index)
{
    if(getInternalSelectedIndex() != index)
    {
        Int32 PreviousSelection(getSelectedIndex());
        setInternalSelectedIndex(index);

        produceSelectionChanged(getSelectedIndex(), PreviousSelection);
    }
}
Ejemplo n.º 6
0
void TabPanel::mousePressed(MouseEventDetails* const e)
{
    bool isContained;
    for(Int32 i(getMFTabs()->size()-1) ; i>=0 ; --i)
    {   // going backwards through through elements, so only top button is pressed
        isContained = getTabs(i)->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getTabs(i),isContained,e->getViewport());
        if(isContained)
        {
            //Give myself temporary focus
            takeFocus(true);
            if(!getTabs(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
            {
                getTabs(i)->takeFocus();
            }
            getTabs(i)->mousePressed(e);
            break;
        }
    }
    if(isContained)
    {
        //Remove my temporary focus
        giveFocus(NULL, false);
    }
    else
    {
        //Give myself permanant focus
        takeFocus();
    }

    // now do it for the content tab
    isContained = getTabContents(getSelectedIndex())->isContained(e->getLocation(), true);
    checkMouseEnterExit(e,e->getLocation(),getTabContents(getSelectedIndex()),isContained,e->getViewport());
    if(isContained)
    {
        //Give myself temporary focus
        takeFocus(true);
        if(!getTabContents(getSelectedIndex())->getType().isDerivedFrom(ComponentContainer::getClassType()))
        {
            getTabContents(getSelectedIndex())->takeFocus();
        }
        getTabContents(getSelectedIndex())->mousePressed(e);

        giveFocus(NULL, false);
    }
    else
    {
        //Give myself permanent focus
        takeFocus();
    }

    Component::mousePressed(e);
}
void COptionsOrganizerDlg::OnButtonRename() {
  const int selected = getSelectedIndex();
  if(selected >= 0) {
    m_nameListCtrl.SetFocus();
    m_nameListCtrl.EditLabel(selected);
  }
}
Ejemplo n.º 8
0
Archivo: UiUtil.cpp Proyecto: xtuer/Qt
void UiUtil::removeTableViewSelectedRow(QTableView *view) {
    QModelIndex index = getSelectedIndex(view);

    if (index.isValid()) {
        view->model()->removeRow(index.row());
    }
}
Ejemplo n.º 9
0
  void TabbedPane::removeTab( int index )
  {
    if(index < 0 || index >= (int)tabs.size())
    {
      return;
    }

    int newSelectedIndex = getSelectedIndex();

    if(newSelectedIndex > 0 && tabs.size() >= 2)
    {
      newSelectedIndex--;
    }
    else if(newSelectedIndex == 0 && tabs.size() == 1)
    {
      newSelectedIndex = -1;
    }

    tabs[index].first->setTabPane(NULL);

    tabContainer->remove(tabs[index].first);
    tabs.erase(tabs.begin() + index);

    for(std::vector<TabbedPaneListener*>::iterator it = tabListeners.begin();
      it != tabListeners.end(); ++it)
    {
      (*it)->tabRemoved(this,tabs[index].first);
    }

    setSelectedTab(newSelectedIndex);
    
  }
Ejemplo n.º 10
0
void AutofillPopupMenuClient::setSuggestions(const WebVector<WebString>& names,
                                             const WebVector<WebString>& labels,
                                             const WebVector<WebString>& icons,
                                             const WebVector<int>& uniqueIDs,
                                             int separatorIndex)
{
    ASSERT(names.size() == labels.size());
    ASSERT(names.size() == icons.size());
    ASSERT(names.size() == uniqueIDs.size());
    ASSERT(separatorIndex < static_cast<int>(names.size()));

    m_names.clear();
    m_labels.clear();
    m_icons.clear();
    m_uniqueIDs.clear();
    for (size_t i = 0; i < names.size(); ++i) {
        m_names.append(names[i]);
        m_labels.append(labels[i]);
        m_icons.append(icons[i]);
        m_uniqueIDs.append(uniqueIDs[i]);
    }

    m_separatorIndex = separatorIndex;

    // Try to preserve selection if possible.
    if (getSelectedIndex() >= static_cast<int>(names.size()))
        setSelectedIndex(-1);
}
Ejemplo n.º 11
0
void MdsEditView::slotAttributeDoubleClicked(QListViewItem *)
{
  int i = getSelectedIndex(m_listView);
  if ( i < 0 )
  {
    fprintf(stderr, "No items were selected!\n");
    return;
  }

	//CDir *pDir = m_pRec->m_pRecType->m_pDir;
	//CMDS *pMds = pDir->m_pMds;
	//CSSM_DB_RECORDTYPE dwRecType = m_pRec->m_pRecType->m_dwRecType;

  if (m_pRec->m_outputAttributeData[i].Info.AttributeFormat ==
      CSSM_DB_ATTRIBUTE_FORMAT_BLOB)
  {
    if ( m_pRec->m_outputAttributeData[i].Value->Data )
    {
      //TODO:OnEditExportBlob();
    }
    else
    {
      //TODO:OnEditImportBlob();
    }
  }
  else
  {
    slotModifyAttributeAction();
  }  
}
Ejemplo n.º 12
0
 void Menu::addItem(const std::shared_ptr<MenuItem> & item) {
     if(item) {
         items.push_back(item);
         add(item.get());
         setSelectedIndex(getSelectedIndex());
     }
 }
Ejemplo n.º 13
0
void NotificationCenterTest::connectToSwitch(Ref *sender)
{
    auto item = (MenuItemToggle*)sender;
    bool bConnected = item->getSelectedIndex() == 0 ? false : true;
    Light* pLight = (Light*)this->getChildByTag(item->getTag()-kTagConnect+kTagLight);
    pLight->setIsConnectToSwitch(bConnected);
}
Ejemplo n.º 14
0
		void BaseMenuScreen::onUpdate(ApplicationData appData)
		{
			if(getSelectedIndex() != MenuScreen::NO_SELECTION)
			{
				if(hoverPulseEnabled)
				{
					double scaleIncrement = PULSE_SPEED * appData.getFrameSpeedMultiplier();
					if(hoverPulseGrowing)
					{
						hoverPulseScale += scaleIncrement;
						if(hoverPulseScale >= PULSE_UPPERBOUND)
						{
							hoverPulseScale = PULSE_UPPERBOUND;
							hoverPulseGrowing = false;
						}
					}
					else
					{
						hoverPulseScale -= scaleIncrement;
						if(hoverPulseScale <= PULSE_LOWERBOUND)
						{
							hoverPulseScale = PULSE_LOWERBOUND;
							hoverPulseGrowing = true;
						}
					}
				}
			}
			MenuScreen::onUpdate(appData);
		}
Ejemplo n.º 15
0
Layer* TabPanel::getDrawnTabBackground(const UInt32& Index) const
{
    if(getEnabled())
    {
        if(Index == getSelectedIndex())
        {
            return getTabActiveBackground();
        }
        else if(Index == _MouseInTabLastMouse)
        {
            return getTabRolloverBackground();
        }
        else if(getTabs(Index)->getFocused())
        {
            return getTabFocusedBackground();
        }
        else
        {
            return getTabBackground();
        }
    }
    else
    {
        return getTabDisabledBackground();
    }
}
Ejemplo n.º 16
0
 void TabbedPane::keyDown( KeyEvent &keyEvent )
 {
   if(keyEvent.getExtendedKey() == EXT_KEY_LEFT)
   {
     if(getSelectedIndex() > 0)
     {
       setSelectedTab(getSelectedIndex() - 1);
       keyEvent.consume();
     }
   }
   else if(keyEvent.getExtendedKey() == EXT_KEY_RIGHT)
   {
     setSelectedTab(getSelectedIndex() + 1);
     keyEvent.consume();
   }
 }
Ejemplo n.º 17
0
/**
 * Returns the selected item
 */
wstring CListBox::getSelectedItem()
{
	if(getItemCount() == 0)
	{
		return L"";
	}
	return getItem(getSelectedIndex());
}
Ejemplo n.º 18
0
FileInfo *FileInfoListView::getSelectedFileInfo()
{
  int si = getSelectedIndex();
  if (si == -1) {
    return NULL;
  }
  return reinterpret_cast<FileInfo *>(getSelectedItem().tag);
}
Ejemplo n.º 19
0
FileInfo *FileInfoListView::getSelectedFileInfo()
{
  int si = getSelectedIndex();
  if (si == -1) {
    return NULL;
  }
  return (FileInfo *)getSelectedItem().tag;
}
Ejemplo n.º 20
0
void CList::selectPrev()
{
    int index = getSelectedIndex();
    if (index <= 0)
        selectIndex(0);
    else
        selectIndex(index-1);
}
Ejemplo n.º 21
0
void CList::selectNext()
{
    int index = getSelectedIndex();
    if (index < 0)
        selectIndex(0);
    else if (index + 1 < list->size())
        selectIndex(index+1);
}
Ejemplo n.º 22
0
// sets subnet with index as selected. returns false if no valid selection possible.
bool SM_ModelBackend::selectIndex(int index)
{
    int currentSelection=getSelectedIndex();

    if ((currentSelection!=index)&(currentSelection<SubnetList.count())) {
        getSubnet(getSelectedIndex())->setSelected(false);
        emit dataChanged();
    };

    if (index<SubnetList.count()) {
        getSubnet(index)->setSelected(true);
        emit dataChanged();
    } else {
        return false;
    };

    return true;
}
void COptionsOrganizerDlg::OnButtonMoveUp() {
  const int selected = getSelectedIndex();
  if(selected > 0) {
    if(m_nameList.move(selected, true)) {
      updateListCtrl();
      setSelectedIndex(m_nameListCtrl, selected-1);
    }
  }
}
Ejemplo n.º 24
0
	void HandleModelSelect( void )
	{
		int idx = getSelectedIndex();
		if ( idx < 0 )
			return;

		// FIXME: Do any necessary window resetting here!!!
		g_pControlPanel->OnModelChanged( models->GetModelFileName( idx ) );
	}
Ejemplo n.º 25
0
void OpenFile::accept()
{
    int index = getSelectedIndex();
    if (showNewFile && !index)
        index = -2;
    emit fileSelected(index, getSelectedFileName());
    
    OpenFileBase::accept();
}
void COptionsOrganizerDlg::OnButtonMoveDown() {
  const int selected = getSelectedIndex();
  if(selected >= 0) {
    if(m_nameList.move(selected, false)) {
      updateListCtrl();
      setSelectedIndex(m_nameListCtrl, selected+1);
    }
  }
}
Ejemplo n.º 27
0
NotificationCenterTest::NotificationCenterTest()
: _showImage(false)
{
    auto s = Director::getInstance()->getWinSize();

    auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(NotificationCenterTest::toExtensionsMainLayer, this));
    pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
    auto pBackMenu = Menu::create(pBackItem, nullptr);
    pBackMenu->setPosition( Vec2::ZERO );
    addChild(pBackMenu);

    auto label1 = Label::createWithTTF("switch off", "fonts/Marker Felt.ttf", 26);
    auto label2 = Label::createWithTTF("switch on", "fonts/Marker Felt.ttf", 26);
    auto item1 = MenuItemLabel::create(label1);
    auto item2 = MenuItemLabel::create(label2);
    auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, nullptr);
    // turn on
    item->setSelectedIndex(1);
    auto menu = Menu::create(item, nullptr);
    menu->setPosition(Vec2(s.width/2+100, s.height/2));
    addChild(menu);

    auto menuConnect = Menu::create();
    menuConnect->setPosition(Vec2::ZERO);
    addChild(menuConnect);

    for (int i = 1; i <= 3; i++)
    {
        Light* light = Light::lightWithFile("Images/Pea.png");
        light->setTag(kTagLight+i);
        light->setPosition(Vec2(100, s.height/4*i));
        addChild(light);

        auto label1 = Label::createWithTTF("not connected", "fonts/Marker Felt.ttf", 26);
        auto label2 = Label::createWithTTF("connected", "fonts/Marker Felt.ttf", 26);
        auto item1 = MenuItemLabel::create(label1);
        auto item2 = MenuItemLabel::create(label2);
        auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, nullptr);
        item->setTag(kTagConnect+i);
        item->setPosition(Vec2(light->getPosition().x, light->getPosition().y+50));
        menuConnect->addChild(item, 0);
        if (i == 2)
        {
            item->setSelectedIndex(1);
        }
        bool bConnected = item->getSelectedIndex() == 1 ? true : false;
        light->setIsConnectToSwitch(bConnected);
    }

    NotificationCenter::getInstance()->postNotification(MSG_SWITCH_STATE, (Ref*)(intptr_t)item->getSelectedIndex());

    /* for testing removeAllObservers */
    NotificationCenter::getInstance()->addObserver(this, CC_CALLFUNCO_SELECTOR(NotificationCenterTest::doNothing), "random-observer1", nullptr);
    NotificationCenter::getInstance()->addObserver(this, CC_CALLFUNCO_SELECTOR(NotificationCenterTest::doNothing), "random-observer2", nullptr);
    NotificationCenter::getInstance()->addObserver(this, CC_CALLFUNCO_SELECTOR(NotificationCenterTest::doNothing), "random-observer3", nullptr);
}
Ejemplo n.º 28
0
void AutocompletePopupMenuClient::setSuggestions(const WebVector<WebString>& suggestions)
{
    m_suggestions.clear();
    for (size_t i = 0; i < suggestions.size(); ++i)
        m_suggestions.append(suggestions[i]);

    // Try to preserve selection if possible.
    if (getSelectedIndex() >= static_cast<int>(suggestions.size()))
        setSelectedIndex(-1);
}
void COptionsOrganizerDlg::ajourButtons(int selected) {
  if(selected < 0) {
    selected = getSelectedIndex();
  }
  GetDlgItem(IDC_BUTTONRENAME  )->EnableWindow((selected >= 0             )?TRUE:FALSE);
  GetDlgItem(IDC_BUTTONDELETE  )->EnableWindow((selected >= 0             )?TRUE:FALSE);
  GetDlgItem(IDC_BUTTONMOVEUP  )->EnableWindow((selected >  0             )?TRUE:FALSE);
  GetDlgItem(IDC_BUTTONMOVEDOWN)->EnableWindow((selected >= 0)
                                            && (selected < getListSize()-1)?TRUE:FALSE);
}
Ejemplo n.º 30
0
	IFacePoserToolWindow *GetSelectedTool()
	{
		int idx = getSelectedIndex();
		int c = IFacePoserToolWindow::GetToolCount();
	
		if ( idx < 0 || idx >= c )
			return NULL;

		IFacePoserToolWindow *tool = IFacePoserToolWindow::GetTool( idx );
		return tool;
	}