void LLGestureComboList::onItemSelected(const LLSD& data)
{
	const std::string name = mList->getSelectedItemLabel();

	S32 cur_id = getCurrentIndex();
	mLastSelectedIndex = cur_id;
	if (cur_id != mList->getItemCount()-1 && cur_id != -1)
	{
		mButton->setLabel(name);
	}

	// hiding the list reasserts the old value stored in the text editor/dropdown button
	hideList();

	// commit does the reverse, asserting the value in the list
	onCommit();
}
Beispiel #2
0
	void ComboBox::notifyListLostFocus(Widget* _sender, Widget* _new)
	{
		if (mDropMouse)
		{
			mDropMouse = false;
			Widget* focus = InputManager::getInstance().getMouseFocusWidget();

			// кнопка сама уберет список
			if (focus == mButton)
				return;

			// в режиме дропа все окна учавствуют
			if (mModeDrop && focus == mClient)
				return;
		}

		hideList();
	}
Beispiel #3
0
	void Combobox::onListClick(const events::ClickEvent& e) 
	{
		if(m_list)
		{
			hideList();

			ListBox* lb = static_cast<ListBox*>(m_list.get());
			if(lb)
			{
				Label* st = lb->GetSelectedItem();
				setText(st ? st->getText() : "");
			}
			else
			{
				setText("");
			}

		}
	}
Beispiel #4
0
void LLComboBox::onItemSelected(const LLSD& data)
{
	mLastSelectedIndex = getCurrentIndex();
	if (mLastSelectedIndex != -1)
	{
		setLabel(getSelectedItemLabel());

		if (mAllowTextEntry)
		{
			gFocusMgr.setKeyboardFocus(mTextEntry);
			mTextEntry->selectAll();
		}
	}
	// hiding the list reasserts the old value stored in the text editor/dropdown button
	hideList();

	// commit does the reverse, asserting the value in the list
	onCommit();
}
Beispiel #5
0
	void Combobox::onBtnClick(const events::ClickEvent& e) 
	{
		if(m_list)
		{
			if (m_list->getVisible())
			{
				hideList();
			}
			else
			{
				m_system.getRootWindow().addChildWindow(m_list.get());
				m_list->setSize(Size(m_area.getSize().width, m_list->getSize().height));
				m_list->setVisible(true);
				m_list->moveToFront();
				point pt = transformToRootCoord(point(m_area.m_left, m_area.m_bottom));
				m_list->setPosition(pt);
				setInputFocus(true);
			}
		}
	}
Beispiel #6
0
BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
{
	BOOL result = FALSE;
	if (hasFocus())
	{
		if (mList->getVisible() 
			&& key == KEY_ESCAPE && mask == MASK_NONE)
		{
			hideList();
			return TRUE;
		}
		//give list a chance to pop up and handle key
		LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
		if (last_selected_item)
		{
			// highlight the original selection before potentially selecting a new item
			mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
		}
		result = mList->handleKeyHere(key, mask);

		// will only see return key if it is originating from line editor
		// since the dropdown button eats the key
		if (key == KEY_RETURN)
		{
			// don't show list and don't eat key input when committing
			// free-form text entry with RETURN since user already knows
            // what they are trying to select
			return FALSE;
		}
		// if selection has changed, pop open list
		else if (mList->getLastSelectedItem() != last_selected_item 
					|| ((key == KEY_DOWN || key == KEY_UP)
						&& mList->getCanSelect()
						&& !mList->isEmpty()))
		{
			showList();
		}
	}
	return result;
}
void LLGestureComboList::onButtonCommit()
{
	if (!mList->getVisible())
	{
		// highlight the last selected item from the original selection before potentially selecting a new item
		// as visual cue to original value of combo box
		LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
		if (last_selected_item)
		{
			mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
		}

		if (mList->getItemCount() != 0)
		{
			showList();
		}
	}
	else
	{
		hideList();
	} 
}
Beispiel #8
0
void LLComboBox::onButtonMouseDown()
{
	if (!mList->getVisible())
	{
		// this might change selection, so do it first
		prearrangeList();

		// highlight the last selected item from the original selection before potentially selecting a new item
		// as visual cue to original value of combo box
		LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
		if (last_selected_item)
		{
			mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
		}

		if (mList->getItemCount() != 0)
		{
			showList();
		}

		setFocus( TRUE );

		// pass mouse capture on to list if button is depressed
		if (mButton->hasMouseCapture())
		{
			gFocusMgr.setMouseCapture(mList);

			// But keep the "pressed" look, which buttons normally lose when they
			// lose focus
			mButton->setForcePressedState(true);
		}
	}
	else
	{
		hideList();
	} 

}
Beispiel #9
0
	bool Combobox::onMouseButton(EventArgs::MouseButtons btn, EventArgs::ButtonState state)
	{
		hideList();

		return Editbox::onMouseButton(btn, state);
	}
Beispiel #10
0
void LLComboBox::onLostTop()
{
	hideList();
}