//---------------------------------------------------------------------------
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);
}
Example #2
0
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());
}
Example #3
0
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
	}
}