Example #1
0
bool ApplicationModel::onItemButtonPressEvent(const Glib::RefPtr<Goocanvas::Item>& item,
                    GdkEventButton* event)
{
    if(item && Glib::RefPtr<InternalPortModel>::cast_dynamic(item->get_model()))
        return Glib::RefPtr<InternalPortModel>::cast_dynamic(item->get_model())->onItemButtonPressEvent(item, event);

    if(event->type == GDK_2BUTTON_PRESS)
    {
       //parentWindow->onUpdateApplicationProperty(application);
       return true;
    }

    if(event->button == 1)
    {
        _dragging = item ;
        _drag_x = (int) event->x ;
        _drag_y = (int) event->y ;
        return false;
    }
    else
    if(event->button == 3)
    {
        MainWindow* wnd = parentWindow->getMainWindow();
        wnd->m_refActionGroup->get_action("EditDelete")->set_sensitive(selected);
        wnd->m_refActionGroup->get_action("EditCopy")->set_sensitive(selected);
        Gtk::Menu* pMenu = dynamic_cast<Gtk::Menu*>(
        wnd->m_refUIManager->get_widget("/PopupModuleModel"));
        if(pMenu)
            pMenu->popup(event->button, event->time);
    }

    return true;
}
Example #2
0
bool GtkGraph::on_button_press_event(GdkEventButton *event)
{
	if(event->button == 3) // if right-click
	{

		std::stringstream option(gt::Settings::settings["GraphIntervals"]);
		std::vector<unsigned> intervals;
		do
		{
			unsigned tmp;
			option >> tmp;
			intervals.push_back(tmp);
		}while(!option.eof());

		Gtk::Menu   *rcMenu = Gtk::manage(new Gtk::Menu());
		std::vector<Gtk::MenuItem*> rcItems;
		rcItems.resize(intervals.size());
		for(unsigned i = 0;i<intervals.size();++i)
		{
			rcItems[i] = Gtk::manage(new Gtk::MenuItem(timestr(intervals[i])));
			rcItems[i]->signal_activate().connect([this,i,intervals](){m_displaySize = intervals[i];});
			rcMenu->add(*(rcItems[i]));
		}

		rcMenu->show_all();
		rcMenu->popup(event->button, event->time);
	}
Example #3
0
void MessagesList::onTreeButtonPressed(GdkEventButton* event)
{
    if((event->type == GDK_BUTTON_PRESS) && (event->button == 3))
    {
        Gtk::Menu* pMenu = dynamic_cast<Gtk::Menu*>(
                    m_refUIManager->get_widget("/PopupMenu"));
        if(pMenu)
        pMenu->popup(event->button, event->time);
    }
}
Example #4
0
void Creater::on_treeview_button_press(GdkEventButton * event)
{
	if (event->type == GDK_BUTTON_PRESS)
	{
		if (event->button == 3)
		{
			Gtk::Menu * menu = dynamic_cast<Gtk::Menu *>(refuimanager_->get_widget("/PopupMenu"));
			menu->popup(event->button, event->time);
		}
	}
}
Example #5
0
bool
URIEntry::menu_button_event(GdkEvent* ev)
{
	if (ev->type != GDK_BUTTON_PRESS) {
		return false;
	}

	Gtk::Menu* menu = Gtk::manage(build_value_menu());
	menu->popup(ev->button.button, ev->button.time);

	return true;
}
bool ExternalPortModel::onItemButtonPressEvent(const Glib::RefPtr<Goocanvas::Item>& item, 
                    GdkEventButton* event)
{
    if(bNested)
        return true;

    if(event->button == 1)
    {
        _dragging = item ;
        _drag_x = (int) event->x ;
        _drag_y = (int) event->y ;
    }
    else
    if(event->button == 3)
    {
        MainWindow* wnd = parentWindow->getMainWindow();
        wnd->m_refActionGroup->get_action("EditDelete")->set_sensitive(selected);
        if(getType() == INPUTD)
        {
            parentWindow->m_currentPortModel = Glib::RefPtr<PortModel>::cast_dynamic(item->get_parent()->get_model());
            wnd->m_refActionGroup->get_action("InsertPortArbitrator")->set_sensitive(true);
            Gtk::Menu* pMenu = dynamic_cast<Gtk::Menu*>(
            wnd->m_refUIManager->get_widget("/PopupExtInputPortModel"));
            if(pMenu)
                pMenu->popup(event->button, event->time);

        }
        else
        {
            Gtk::Menu* pMenu = dynamic_cast<Gtk::Menu*>(
            wnd->m_refUIManager->get_widget("/PopupExtPortModel"));
            if(pMenu)
                pMenu->popup(event->button, event->time);
        }                
    }

    return true;
}
Example #7
0
bool InternalPortModel::onItemButtonPressEvent(const Glib::RefPtr<Goocanvas::Item>& item,
                    GdkEventButton* event)
{
    if((event->button == 3) && (getType() == INPUTD))
    {
        MainWindow* wnd = parentWindow->getMainWindow();
        parentWindow->m_currentPortModel = Glib::RefPtr<PortModel>::cast_dynamic(item->get_parent()->get_model());
        wnd->m_refActionGroup->get_action("InsertPortArbitrator")->set_sensitive(true);
        Gtk::Menu* pMenu = dynamic_cast<Gtk::Menu*>(
        wnd->m_refUIManager->get_widget("/PopupIntPortModel"));
        if(pMenu)
            pMenu->popup(event->button, event->time);
    }
    return true;
}
void mforms::gtk::MenuItemImpl::popup_menu(mforms::ContextMenu *menu, View *owner, base::Point location) {
  Gtk::Menu *mb = cast<Gtk::Menu *>(menu->get_data_ptr());
  //
  mb->popup(3, gtk_get_current_event_time()); // 3 is normally right mouse button, according to doc
}
Example #9
0
void Main_window::on_tray_popup_menu(int button, int activate_time)
{
	Gtk::Menu* menu = dynamic_cast<Gtk::Menu*>(this->gui->ui_manager->get_widget("/tray_popup_menu"));
	menu->popup(button, activate_time);
}