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 Window::mouseMoved(gcn::MouseEvent &event) { int resizeHandles = getResizeHandles(event); // Changes the custom mouse cursor based on it's current position. switch (resizeHandles) { case BOTTOM | RIGHT: gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_RIGHT); break; case BOTTOM | LEFT: gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_LEFT); break; case BOTTOM: gui->setCursorType(Gui::CURSOR_RESIZE_DOWN); break; case RIGHT: case LEFT: gui->setCursorType(Gui::CURSOR_RESIZE_ACROSS); break; default: gui->setCursorType(Gui::CURSOR_POINTER); } if (viewport) viewport->hideBeingPopup(); }
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) { // Handle window resizing mouseResize = getResizeHandles(event); if (event.getSource() == this) requestFocus(); } }