void ListBox::mouseReleased(MouseEvent &event) { if (mPressedIndex != getSelectionByMouse(event.getY())) return; if (mDistributeMousePressed) { mouseReleased1(event); } else { switch (event.getClickCount()) { case 1: mouseDragged(event); mOldSelected = mSelected; break; case 2: if (gui) gui->resetClickCount(); if (mOldSelected == mSelected) mouseReleased1(event); else mouseDragged(event); mOldSelected = mSelected; break; default: mouseDragged(event); mOldSelected = mSelected; break; } } mPressedIndex = -2; }
void ServerDialog::mouseClicked(MouseEvent &event) { if (event.getButton() == MouseButton::LEFT) { event.consume(); if (event.getClickCount() == 2 && event.getSource() == mServersList) { action(ActionEvent(mConnectButton, mConnectButton->getActionEventId())); } } }
void InventoryWindow::mouseClicked(MouseEvent &event) { Window::mouseClicked(event); const int clicks = event.getClickCount(); if (clicks == 2 && gui) gui->resetClickCount(); const bool mod = (isStorageActive() && inputManager.isActionActive(InputAction::STOP_ATTACK)); const bool mod2 = (tradeWindow && tradeWindow->isWindowVisible() && inputManager.isActionActive(InputAction::STOP_ATTACK)); if (mInventory) { if (!mod && !mod2 && event.getButton() == MouseButton::RIGHT) { Item *const item = mItems->getSelectedItem(); if (!item) return; /* Convert relative to the window coordinates to absolute screen * coordinates. */ const int mx = event.getX() + getX(); const int my = event.getY() + getY(); if (popupMenu) { popupMenu->showPopup(this, mx, my, item, mInventory->getType()); } } } else { return; } if (event.getButton() == MouseButton::LEFT || event.getButton() == MouseButton::RIGHT) { Item *const item = mItems->getSelectedItem(); if (!item) return; if (mod) { if (mInventory->isMainInventory()) { if (event.getButton() == MouseButton::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, inventoryWindow, item); } else { inventoryHandler->moveItem2(InventoryType::Inventory, item->getInvIndex(), item->getQuantity(), InventoryType::Storage); } } else { if (event.getButton() == MouseButton::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, inventoryWindow, item); } else { inventoryHandler->moveItem2(InventoryType::Storage, item->getInvIndex(), item->getQuantity(), InventoryType::Inventory); } } } else if (mod2 && mInventory->isMainInventory()) { if (PlayerInfo::isItemProtected(item->getId())) return; if (event.getButton() == MouseButton::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd, tradeWindow, item); } else { if (tradeWindow) tradeWindow->tradeItem(item, item->getQuantity(), true); } } else if (clicks == 2) { if (mInventory->isMainInventory()) { if (isStorageActive()) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, inventoryWindow, item); } else if (tradeWindow && tradeWindow->isWindowVisible()) { if (PlayerInfo::isItemProtected(item->getId())) return; ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd, tradeWindow, item); } else { PlayerInfo::useEquipItem(item, Sfx_true); } } else { if (isStorageActive()) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, inventoryWindow, item); } } } } }