Exemple #1
0
/*************************************************************************
	Handler for cursor activation events
*************************************************************************/
void ComboDropList::onCursorActivate(CursorInputEventArgs& e)
{
    ListWidget::onCursorActivate(e);

    if (e.source == CIS_Left)
	{
		if (d_armed && (getChildAtPosition(e.position) == 0))
		{
            // if something was selected, confirm that selection.
            if (getIndexSelectionStates().size() > 0)
            {
                WindowEventArgs args(this);
                onListSelectionAccepted(args);
            }

            releaseInput();
		}
        // if we are not already armed, in response to a left cursor activation event, we auto-arm.
		else
		{
			d_armed = true;
		}

		++e.handled;
	}

}
/*************************************************************************
	Handler for mouse button release events
*************************************************************************/
void ComboDropList::onMouseButtonUp(MouseEventArgs& e)
{
	Listbox::onMouseButtonUp(e);

	if (e.button == LeftButton)
	{
		if (d_armed && (getChildAtPosition(e.position) == 0))
		{
			// if something was selected, confirm that selection.
			if (getSelectedCount() > 0)
			{
				WindowEventArgs args(this);
				onListSelectionAccepted(args);
			}

            releaseInput();
		}
		// if we are not already armed, in response to a left button up event, we auto-arm.
		else
		{
			d_armed = true;
		}

		++e.handled;
	}

}
/*************************************************************************
	Handler for mouse movement events
*************************************************************************/
void ComboDropList::onMouseMove(MouseEventArgs& e)
{
	Listbox::onMouseMove(e);

	// if mouse is within our area (but not our children)
	if (isHit(e.position))
	{
		if (!getChildAtPosition(e.position))
		{
			// handle auto-arm
			if (d_autoArm)
			{
				d_armed = true;
			}

			if (d_armed)
			{
				//
				// Convert mouse position to absolute window pixels
				//
				Point localPos(CoordConverter::screenToWindow(*this, e.position));

				// check for an item under the mouse
				ListboxItem* selItem = getItemAtPoint(localPos);

				// if an item is under mouse, select it
				if (selItem)
				{
					setItemSelectState(selItem, true);
				}
				else
				{
					clearAllSelections();
				}

			}
		}

		e.handled = true;
	}
	// not within the list area
	else
	{
		// if left mouse button is down, clear any selection
		if (e.sysKeys & LeftMouse)
		{
			clearAllSelections();
		}

	}

}
/*************************************************************************
	Handler for mouse movement events
*************************************************************************/
void ComboDropList::onMouseMove(MouseEventArgs& e)
{
	Listbox::onMouseMove(e);

	// if mouse is within our area (but not our children)
	if (isHit(e.position))
	{
		if (!getChildAtPosition(e.position))
		{
			// handle auto-arm
			if (d_autoArm)
			{
				d_armed = true;
			}

			if (d_armed)
			{
				// check for an item under the mouse
				ListboxItem* selItem = getItemAtPoint(e.position);

				// if an item is under mouse, select it
				if (selItem)
				{
					setItemSelectState(selItem, true);
				}
				else
				{
					clearAllSelections();
				}

			}
		}

		++e.handled;
	}
	// not within the list area
	else
	{
		// if left mouse button is down, clear any selection
		if (e.sysKeys & LeftMouse)
		{
			clearAllSelections();
		}

	}

}
Exemple #5
0
/*************************************************************************
	Handler for cursor movement events
*************************************************************************/
void ComboDropList::onCursorMove(CursorInputEventArgs& e)
{
    ListWidget::onCursorMove(e);

    // if cursor is within our area (but not our children)
	if (isHit(e.position))
	{
		if (!getChildAtPosition(e.position))
		{
			// handle auto-arm
			if (d_autoArm)
			{
				d_armed = true;
			}

			if (d_armed)
			{
                // check for an item under the cursor
                StandardItem* item = d_itemModel.getItemForIndex(indexAt(e.position));

                // if an item is under cursor, select it
                if (item != 0)
                {
                    setIndexSelectionState(item, true);
                }
                else
                {
                    clearSelections();
                }
			}
		}

		++e.handled;
	}
	// not within the list area
	else
	{
		// if left cursor is held, clear any selection
		if (e.state.isHeld(CIS_Left))
		{
            clearSelections();
		}
	}
}
//----------------------------------------------------------------------------//
void GridLayoutContainer::removeChildFromPosition(size_t gridX,
                                                  size_t gridY)
{
    removeChild(getChildAtPosition(gridX, gridY));
}