void MainSynthWindow::toggleConnects (void)
{
    Gtk::MenuItem *me = (Gtk::MenuItem *)&menuJack_.items()[0];
    Gtk::MenuItem *dis = (Gtk::MenuItem *)&menuJack_.items()[1];
    bool c = me->is_sensitive();
    me->set_sensitive(!c);
    dis->set_sensitive(c);
}
void TableofcontentsNoteAddin::populate_toc_menu (Gtk::Menu *toc_menu, bool has_action_entries)
//populate a menu with Note's table of contents
{
    // Clear out the old list
    std::vector<Gtk::Widget*> menu_items = toc_menu->get_children();
    for(std::vector<Gtk::Widget*>::reverse_iterator iter = menu_items.rbegin();
            iter != menu_items.rend(); ++iter) {
        toc_menu->remove(**iter);
    }

    // Build a new list
    std::list<TableofcontentsMenuItem*> items;
    get_tableofcontents_menu_items(items);

    for(std::list<TableofcontentsMenuItem*>::iterator iter = items.begin();
            iter != items.end(); ++iter) {
        TableofcontentsMenuItem *item(*iter);
        item->show_all();
        toc_menu->append(*item);
    }

    // Action menu items, or nothing
    if (has_action_entries == false) {
        if (toc_menu->get_children().size() == 0) { // no toc items, and no action entries = empty menu
            Gtk::MenuItem *item = manage(new Gtk::MenuItem(_("(empty table of contents)")));
            item->set_sensitive(false);
            item->show();
            toc_menu->append(*item);
        }
    }
    else {
        Gtk::MenuItem *item;

        if (toc_menu->get_children().size() != 0) { //there are toc items, we add a separator
            item = manage(new Gtk::SeparatorMenuItem ());
            item->show ();
            toc_menu->append(*item);
        }

        item = manage(new Gtk::MenuItem (_("Heading 1")));
        item->add_accelerator("activate", get_note()->get_window()->get_accel_group(), GDK_KEY_1, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
        item->signal_activate().connect(sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_level_1_activated));
        item->show ();
        toc_menu->append(*item);

        item = manage(new Gtk::MenuItem (_("Heading 2")));
        item->add_accelerator("activate", get_note()->get_window()->get_accel_group(), GDK_KEY_2, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
        item->signal_activate().connect(sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_level_2_activated));
        item->show ();
        toc_menu->append(*item);

        item = manage(new Gtk::MenuItem (_("Table of Contents Help")));
        item->signal_activate().connect(sigc::mem_fun(*this, &TableofcontentsNoteAddin::on_toc_help_activated));
        item->show ();
        toc_menu->append(*item);
    }

}
Exemple #3
0
//------------------------------------------------------------------------------
void mforms::gtk::MenuImpl::set_item_enabled(Menu *self, int i, bool flag)
{
    MenuImpl* menu = self->get_data<MenuImpl>();
    if (menu)  {
        Gtk::MenuItem *item = menu->item_at(i);
        if (item)
            item->set_sensitive(flag);
    }
}
Exemple #4
0
void Menu::setTaskIsSelected(bool show)
{
	std::list<Gtk::MenuItem*>::iterator iter;
	for (iter = taskIDDependentMenus.begin(); iter != taskIDDependentMenus.end(); ++iter)
	{
		Gtk::MenuItem* menuItem = *iter;
		menuItem->set_sensitive(show);
	}

}