//--------------------------------------------------------------------------- void WtRubiksClockWidget::OnClicked(const Wt::WMouseEvent& e) { const int x = e.widget().x; const int y = e.widget().y; const bool is_left_button = e.button() == Wt::WMouseEvent::LeftButton || e.wheelDelta() > 0; m_widget->Click(x,y,is_left_button); }
void EventsDemo::describe(const Wt::WMouseEvent &e) { std::stringstream ss; ss << "Button: " << e.button() << "<br/>" << "Modifiers: " << modifiersToString(e.modifiers()) << "<br/>" << "Document coordinates: " << e.document() << "<br/>" << "Window coordinates: " << e.window() << "<br/>" << "Screen coordinates: " << e.screen() << "<br/>" << "Widget coordinates: " << e.widget() << "<br/>" << "DragDelta coordinates: " << e.dragDelta() << "<br/>" << "Wheel delta: " << e.wheelDelta() << "<br/>"; mouseEventDescription_->setText(ss.str()); }
//--------------------------------------------------------------------------- void WtSelectPlayerWidget::OnClick(const Wt::WMouseEvent& e) { const int sprite_width = m_computer_grey->width(); const int sprite_height = m_computer_grey->height(); const int mouse_x = e.widget().x; const int mouse_y = e.widget().y; const int index = mouse_y / sprite_height; const bool is_human = ( mouse_x / sprite_width == 0); m_is_player_human[index] = is_human; m_signal_on_clicked(); this->update(); }
void RSWappFriendsPage::showCustomPopupMenu(const Wt::WModelIndex& item, const Wt::WMouseEvent& event) { #ifdef DEBUG_FRIENDSPAGE std::cerr << "Custom poopup menu requested." << std::endl; #endif if (event.button() == Wt::WMouseEvent::LeftButton) { // Select the item, it was not yet selected. // if (!_tableView->isSelected(item)) _tableView->select(item); if (_popupMenu) delete _popupMenu ; // request information about the hash std::string friend_id(boost::any_cast<Wt::WString>(_tableView->model()->data(item,Wt::UserRole)).toUTF8()); _selected_friend = friend_id ; #ifdef DEBUG_FRIENDSPAGE std::cerr << "Making menu for friend id " << friend_id << std::endl; #endif _popupMenu = new Wt::WPopupMenu(); _popupMenu->addItem("Show details"); _popupMenu->addItem("Deny friend"); /* * This is one method of executing a popup, which does not block a * thread for a reentrant event loop, and thus scales. * * Alternatively you could call WPopupMenu::exec(), which returns * the result, but while waiting for it, blocks the thread. */ _popupMenu->aboutToHide().connect(this, &RSWappFriendsPage::popupAction); _popupMenu->popup(event); #ifdef DEBUG_FRIENDSPAGE std::cerr << "Popuping up menu!" << std::endl; #endif } }
void ribi::WtDialWidget::OnClicked(const Wt::WMouseEvent& e) { m_widget->Click(e.widget().x,e.widget().y); }