void PlayControllerZone::mouseReleased( gcn::MouseEvent& mouseEvent ) { model().setMouse( "ZoneO", mouseEvent.getX(), mouseEvent.getY() ); // // Tenemos un area para seleccionar. adjustSelectedArea( mouseEvent.getX(), mouseEvent.getY() ); switch ( mouseEvent.getButton() ) { case gcn::MouseEvent::LEFT: view().setSelectedArea( m_selectarea ); break; case gcn::MouseEvent::RIGHT: view().setDestination( m_selectarea ); break; default: break; } mouseEvent.consume(); }
void Wellcome::mousePressed(gcn::MouseEvent &event) { gcn::Rectangle d1, d2, d3, d4; d1.setAll(mNext->getDimension().x, mNext->getDimension().y + getTitleBarHeight(), mNext->getDimension().x + mNext->getDimension().width, mNext->getDimension().y + mNext->getDimension().height + getTitleBarHeight()); d2.setAll(mPrev->getDimension().x, mPrev->getDimension().y + getTitleBarHeight(), mPrev->getDimension().x + mPrev->getDimension().width, mPrev->getDimension().y + mPrev->getDimension().height + getTitleBarHeight()); d3.setAll(mFinish->getDimension().x, mFinish->getDimension().y + getTitleBarHeight(), mFinish->getDimension().x + mFinish->getDimension().width, mFinish->getDimension().y + mFinish->getDimension().height + getTitleBarHeight()); d4.setAll(mAgain->getDimension().x, mAgain->getDimension().y + getTitleBarHeight(), mAgain->getDimension().x + mAgain->getDimension().width, mAgain->getDimension().y + mAgain->getDimension().height + getTitleBarHeight()); if(d1.isPointInRect(event.getX(), event.getY()) || d2.isPointInRect(event.getX(), event.getY()) || d3.isPointInRect(event.getX(), event.getY()) || d4.isPointInRect(event.getX(), event.getY()) || event.getY()<getTitleBarHeight()) { Window::mousePressed(event); return; } setActionEventId("next"); distributeActionEvent(); }
void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { if (!mItemMoved && mItemClicked) { const int index = getIndexFromGrid(event.getX(), event.getY()); const int itemId = itemShortcut->getItem(index); if (index == -1 || itemId < 0) return; Item *item = player_node->getInventory()->findItem(itemId); if (item) { mItemMoved = item; itemShortcut->removeItem(index); } } if (mItemMoved) { mCursorPosX = event.getX(); mCursorPosY = event.getY(); } } }
void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { if (!mEmoteMoved && mEmoteClicked) { const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) return; const int emoteId = emoteShortcut->getEmote(index); if (emoteId) { mEmoteMoved = emoteId; emoteShortcut->removeEmote(index); } } if (mEmoteMoved) { mCursorPosX = event.getX(); mCursorPosY = event.getY(); } } }
void OutfitWindow::mouseDragged(gcn::MouseEvent &event) { Window::mouseDragged(event); if (event.getButton() == gcn::MouseEvent::LEFT) { if (!mItemMoved && mItemClicked) { const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) return; const int itemId = mItems[mCurrentOutfit][index]; if (itemId < 0) return; Item *item = PlayerInfo::getInventory()->findItem(itemId); if (item) { mItemMoved = item; mItems[mCurrentOutfit][index] = -1; } } if (mItemMoved) { mCursorPosX = event.getX(); mCursorPosY = event.getY(); } } }
void TileSelector::mousePressed(gcn::MouseEvent& mouseEvent) { if (mouseEvent.getX() <= mTileSetBitmap->w && mouseEvent.getY() <= mTileSetBitmap->h) { mSelectedTile = mouseEvent.getX() / 16 + (mouseEvent.getY() / 16) * mTileSetBitmap->w / 16; generateAction(); } }
void PlayControllerZone::mouseEntered( gcn::MouseEvent& mouseEvent ) { model().setMouse( "Zone", mouseEvent.getX(), mouseEvent.getY() ); view().updateMoveView( mouseEvent.getX(), mouseEvent.getY() ); mouseEvent.consume(); }
void PlayControllerZone::mouseDragged( gcn::MouseEvent& mouseEvent ) { model().setMouse( "ZoneE", mouseEvent.getX(), mouseEvent.getY() ); adjustSelectedArea( mouseEvent.getX(), mouseEvent.getY() ); view().paintSelectedArea( m_selectarea ); mouseEvent.consume(); }
void MouseSelectionMenu::mouseMoved(gcn::MouseEvent &mouseEvent) { WidgetListIterator iter; for( iter = mWidgets.begin(); iter != mWidgets.end(); iter++ ) { if( mouseEvent.getY() > (*iter)->getY() && mouseEvent.getY() < (*iter)->getY() + (*iter)->getHeight() ) { drawRect.x = (*iter)->getX() - 1; drawRect.y = (*iter)->getY() - 1; drawRect.width = (*iter)->getWidth() + 1; drawRect.height = (*iter)->getHeight() + 1; return; } } }
void TileSelector::mouseMoved(gcn::MouseEvent& mouseEvent) { if (mouseEvent.getX() <= mTileSetBitmap->w && mouseEvent.getY() <= mTileSetBitmap->h) { mCurrentMouseX = mouseEvent.getX(); mCurrentMouseY = mouseEvent.getY(); mDrawMouseHoverTile = true; } else { mDrawMouseHoverTile = false; } }
void Windowiki::mousePressed(gcn::MouseEvent &event) { // Let Guichan move window to top and figure out title bar drag gcn::Window::mousePressed(event); const int x = event.getX(); const int y = event.getY(); mMouseResize = 0; // Activate resizing handles as appropriate if (event.getSource() == this && isResizable() && event.getButton() == gcn::MouseEvent::LEFT && !getChildrenArea().isPointInRect(x, y)) { mMouseResize |= (x > getWidth() - resizeBorderWidthiki) ? RIGHT : (x < resizeBorderWidthiki) ? LEFT : 0; mMouseResize |= (y > getHeight() - resizeBorderWidthiki) ? BOTTOM : (y < resizeBorderWidthiki) ? TOP : 0; } else if (event.getSource() == mGrip) { mDragOffsetX = x + mGrip->getX(); mDragOffsetY = y + mGrip->getY(); mMouseResize |= BOTTOM | RIGHT; mIsMoving = false; } if (event.getButton() == gcn::MouseEvent::LEFT) { const int x = event.getX(); const int y = event.getY(); // Handle close button if (mCloseButton) { gcn::Rectangle closeButtonRect( getWidth() - closeImage->getWidth() - getPadding(), getPadding(), closeImage->getWidth(), closeImage->getHeight()); if (closeButtonRect.isPointInRect(x, y)) { setVisible(false); } } // Handle window resizing } }
void DropDown::mousePressed(gcn::MouseEvent& mouseEvent) { gcn::DropDown::mousePressed(mouseEvent); if (0 <= mouseEvent.getY() && mouseEvent.getY() < getHeight() && mouseEvent.getX() >= 0 && mouseEvent.getX() < getWidth() && mouseEvent.getButton() == gcn::MouseEvent::LEFT && mDroppedDown && mouseEvent.getSource() == mListBox) { mPushed = false; foldUp(); releaseModalMouseInputFocus(); distributeActionEvent(); } }
void PlayControllerMsgCenter::mouseEntered( gcn::MouseEvent& mouseEvent ) { model().setMouse( "MsgCenter", mouseEvent.getX(), mouseEvent.getY() ); mouseEvent.consume(); }
void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) { Popup::mouseMoved(event); const int x = event.getX(); const int y = event.getY(); if (event.getSource() == mXpBar) { mTextPopup->show(x + getX(), y + getY(), strprintf("%u/%u", PlayerInfo::getAttribute(EXP), PlayerInfo::getAttribute(EXP_NEEDED)), strprintf("%s: %u", _("Need"), PlayerInfo::getAttribute(EXP_NEEDED) - PlayerInfo::getAttribute(EXP))); } else if (event.getSource() == mHpBar) { mTextPopup->show(x + getX(), y + getY(), strprintf("%u/%u", PlayerInfo::getAttribute(HP), PlayerInfo::getAttribute(MAX_HP))); } else if (event.getSource() == mMpBar) { mTextPopup->show(x + getX(), y + getY(), strprintf("%u/%u", PlayerInfo::getAttribute(MP), PlayerInfo::getAttribute(MAX_MP))); } else { mTextPopup->setVisible(false); } }
void ItemContainer::mouseReleased(gcn::MouseEvent &event) { if (mClicks == 2) return; switch (mSelectionStatus) { case SEL_SELECTING: mSelectionStatus = SEL_SELECTED; return; case SEL_DESELECTING: selectNone(); return; case SEL_DRAGGING: mSelectionStatus = SEL_SELECTED; break; case SEL_NONE: case SEL_SELECTED: default: return; }; int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; if (index == mSelectedIndex || mSelectedIndex == -1) return; Net::getInventoryHandler()->moveItem(mSelectedIndex, index); selectNone(); }
void RichTextBox::mouseMoved(gcn::MouseEvent &event) { LinkIterator i = find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); mSelectedLink = (i != mLinks.end()) ? (i - mLinks.begin()) : -1; }
void ShopListBox::mouseMoved(gcn::MouseEvent &event) { if (!mShopItems) return; int index = event.getY() / mRowHeight; if (index < 0 || index >= mShopItems->getNumberOfElements()) { mItemPopup->setVisible(false); } else { Item *item = mShopItems->at(index); if (item) { mItemPopup->setItem(item->getInfo()); mItemPopup->position(viewport->getMouseX(), viewport->getMouseY()); } else { mItemPopup->setVisible(false); } } }
void EquipmentWindow::mouseMoved(gcn::MouseEvent &event) { const int x = event.getX(); const int y = event.getY(); int mouseX, mouseY; SDL_GetMouseState(&mouseX, &mouseY); // Show ItemTooltip std::string slotName = getSlotName(x, y); if (!slotName.empty()) { mItemPopup->setEquipmentText(slotName); Item *item = getItem(x, y); if (item) { mItemPopup->setItem(item->getInfo()); } else mItemPopup->setNoItem(); mItemPopup->position(x + getX(), y + getY()); } else { mItemPopup->setVisible(false); } }
void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) { Window::mousePressed(mouseEvent); const int x = mouseEvent.getX(); const int y = mouseEvent.getY(); Item *item = 0; // Checks if any of the presses were in the equip boxes. for (int i = 0; i < mBoxesNumber; ++i) { item = mEquipment->getEquipment(i); gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY, BOX_WIDTH, BOX_HEIGHT); if (tRect.isPointInRect(x, y) && item) { setSelected(i); break; } } if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) { if (item) { /* Convert relative to the window coordinates to absolute screen * coordinates. */ const int mx = x + getX(); const int my = y + getY(); viewport->showPopup(this, mx, my, item, true, false); } } }
// Show ItemTooltip void EquipmentWindow::mouseMoved(gcn::MouseEvent &event) { Window::mouseMoved(event); if (!mShowItemInfo) { mItemPopup->setVisible(false); return; } const int x = event.getX(); const int y = event.getY(); Item* item = getItem(x, y); if (item) { int mouseX, mouseY; SDL_GetMouseState(&mouseX, &mouseY); if (item->getInfo().getName() != mItemPopup->getItemName()) mItemPopup->setItem(item->getInfo()); mItemPopup->updateColors(); mItemPopup->view(x + getX(), y + getY()); } else mItemPopup->setVisible(false); }
int Window::getResizeHandles(gcn::MouseEvent &event) { int resizeHandles = 0; const int y = event.getY(); if (mGrip && y > (int) mTitleBarHeight) { const int x = event.getX(); if (!getChildrenArea().isPointInRect(x, y) && event.getSource() == this) { resizeHandles |= (x > getWidth() - resizeBorderWidth) ? RIGHT : (x < resizeBorderWidth) ? LEFT : 0; resizeHandles |= (y > getHeight() - resizeBorderWidth) ? BOTTOM : (y < resizeBorderWidth) ? TOP : 0; } if (event.getSource() == mGrip) { mDragOffsetX = x; mDragOffsetY = y; resizeHandles |= BOTTOM | RIGHT; } } return resizeHandles; }
void EmoteShortcutContainer::mouseReleased(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { const int index = getIndexFromGrid(event.getX(), event.getY()); if (emoteShortcut->isEmoteSelected()) emoteShortcut->setEmoteSelected(0); if (index == -1) { mEmoteMoved = 0; return; } if (mEmoteMoved) { emoteShortcut->setEmotes(index, mEmoteMoved); mEmoteMoved = 0; } else if (emoteShortcut->getEmote(index) && mEmoteClicked) { emoteShortcut->useEmote(index + 1); } if (mEmoteClicked) mEmoteClicked = false; } }
void Window::mousePressed(gcn::MouseEvent &event) { // Let Guichan move window to top and figure out title bar drag gcn::Window::mousePressed(event); if (event.getButton() == gcn::MouseEvent::LEFT) { const int x = event.getX(); const int y = event.getY(); // Handle close button if (mCloseButton) { gcn::Rectangle closeButtonRect( getWidth() - mSkin->getCloseImage()->getWidth() - getPadding(), getPadding(), mSkin->getCloseImage()->getWidth(), mSkin->getCloseImage()->getHeight()); if (closeButtonRect.isPointInRect(x, y)) close(); } // Handle window resizing mouseResize = getResizeHandles(event); } }
void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { if (itemShortcut->isItemSelected()) itemShortcut->setItemSelected(-1); const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { mItemMoved = NULL; return; } if (mItemMoved) { itemShortcut->setItems(index, mItemMoved->getId()); mItemMoved = NULL; } else if (itemShortcut->getItem(index) && mItemClicked) { itemShortcut->useItem(index); } if (mItemClicked) mItemClicked = false; } }
void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) { const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) return; if (event.getButton() == gcn::MouseEvent::LEFT) { // Stores the selected item if theirs one. if (itemShortcut->isItemSelected() && inventoryWindow->isVisible()) { itemShortcut->setItem(index); itemShortcut->setItemSelected(-1); } else if (itemShortcut->getItem(index)) mItemClicked = true; } else if (event.getButton() == gcn::MouseEvent::RIGHT) { Item *item = player_node->getInventory()-> findItem(itemShortcut->getItem(index)); if (!item) return; // Convert relative to the window coordinates to absolute screen // coordinates. viewport->showPopup(viewport->getMouseX(), viewport->getMouseY(), item); } }
void WorldEditor::mousePressed(gcn::MouseEvent& mouseEvent) { if (mouseEvent.getSource() != this) { return; } if (mDrawingNewRoom) { mDrawingNewRoom = false; return; } if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) { if (mWorldPieces.find(mRoomSelector->getSelectedRoom()) == mWorldPieces.end()) { WorldPiece* worldPiece = new WorldPiece(mRoomSelector->getSelectedRoom()); mWorldPieces[mRoomSelector->getSelectedRoom()] = worldPiece; worldPiece->setPosition(mouseEvent.getX() - mouseEvent.getX() % 20, mouseEvent.getY() - mouseEvent.getY() % 15); worldPiece->addActionListener(this); add(worldPiece); } } else if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) { if (!mNewRoomDialogWindow->isVisible() && getWidgetAt(mouseEvent.getX(), mouseEvent.getY()) == NULL) { mDrawingNewRoom = true; if (mouseEvent.getX() % 20 < 10) { mNewRoomX = mouseEvent.getX() - mouseEvent.getX() % 20; } else { mNewRoomX = mouseEvent.getX() - mouseEvent.getX() % 20 + 20; } if (mouseEvent.getY() % 15 < 8) { mNewRoomY = mouseEvent.getY() - mouseEvent.getY() % 15; } else { mNewRoomY = mouseEvent.getY() - mouseEvent.getY() % 15 + 15; } mNewRoomWidth = 0; mNewRoomHeight = 0; } } }
void RichTextBox::mousePressed(gcn::MouseEvent &event) { if (!mLinkHandler) return; LinkIterator i = find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); if (i != mLinks.end()) mLinkHandler->handleLink(i->link); }
void PlayControllerZone::mousePressed( gcn::MouseEvent& mouseEvent ) { model().setMouse( "ZoneX", mouseEvent.getX(), mouseEvent.getY() ); m_firstselect.x = mouseEvent.getX(); m_firstselect.y = mouseEvent.getY(); m_selectarea.x = m_firstselect.x; m_selectarea.y = m_firstselect.y; m_selectarea.width = 0; m_selectarea.height = 0; mouseEvent.consume(); }
void GlassWidget::mouseMoved(gcn::MouseEvent &e) { if(me) { PyObject *res = PyObject_CallMethod(me, "_mouseMoved", "(ii)", e.getX(), e.getY()); if(res == NULL && PyErr_Occurred() != NULL) Py_HandleError(); else Py_XDECREF(res); } }
void ItemContainer::mouseDragged(gcn::MouseEvent &event) { if (mSelectionStatus != SEL_NONE) { mSelectionStatus = SEL_DRAGGING; mDragPosX = event.getX(); mDragPosY = event.getY(); } }