// ----------------------------------------------------------------------------
// menuCallback() - called anytime a menu selection is made
// ----------------------------------------------------------------------------
static void menuCallback(Fl_Widget* w, void* data) {
    Fl_Menu_* m = (Fl_Menu_*)w;
    const Fl_Menu_Item* mi = m->mvalue();
    if (mi != nullptr) {
        (static_cast<MainWindow*>(data))->menuCB(mi->label());
    }
}
static void stereoswap_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)v;
  if (!strcmp("On", m->text())) {
    app->display_set_stereo_swap(1);
  } else {
    app->display_set_stereo_swap(0);
  }
}
static void backgroundmode_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)(w->user_data());
  if (!strcmp("Gradient", m->text())) {
    app->display_set_background_mode(1);
  } else {
    app->display_set_background_mode(0);
  }
}
Beispiel #4
0
//-----------------------------------------------------------------------------
void test_cb(Fl_Widget* w, void*) {
	Fl_Menu_* mw = (Fl_Menu_*)w;
	const Fl_Menu_Item* m = mw->mvalue();
	if (!m)
		printf("NULL\n");
	else if (m->shortcut())
		printf("%s - %s\n", m->label(), fl_shortcut_label(m->shortcut()));
	else
		printf("%s\n", m->label());
}
Beispiel #5
0
void GUI::menuCB(Fl_Widget* w, void*)
{
	Fl_Menu_* mw = (Fl_Menu_*)w;
	const Fl_Menu_Item* m = mw->mvalue();
	if (!m) printf("no MenuItem\n");
	else
	{
		GUI* gui = GUI::getInstance();
		if (strcmp(m->label(),menuItems[1].text)==0)
		{
			gui->updateMap();//
		}
		else if (strcmp(m->label(),menuItems[2].text)==0)
		{
			gui->setLevel(1);
		}
		else if (strcmp(m->label(),menuItems[3].text)==0)
		{
			gui->setLevel(2);
		}
		else if (strcmp(m->label(),menuItems[4].text)==0)
		{
			gui->setLevel(3);
		}
		else if (strcmp(m->label(),menuItems[5].text)==0)
		{
			DialogWindow* dialog = DialogWindow::getInstance();
			Fl_Group::current(dialog);
			dialog->show();
			dialog->set_visible();
			dialog->active();
		}
		else if (strcmp(m->label(),menuItems[6].text)==0)
		{
			//给出信息对话框
			gui->RankingsDialog();
		}
		else if (strcmp(m->label(),menuItems[7].text)==0)
		{//发送退出信息给主窗体
			Fl::handle_(FL_CLOSE,gui->m_pWindow.get());
		}
		printf("%s\n", m->label());
	}
}
Beispiel #6
0
/*----------------------------------------------------*/
void 
test_cb (Fl_Widget* w, void*) 
{
  Fl_Menu_* mw = (Fl_Menu_*)w;
  const Fl_Menu_Item* m = mw->mvalue();

  if (!m) {
    printf("NULL\n");
		return;
	}

	if      (strcmp(m->label(), "Exit")==0) 
		exit(0);
	else if (strcmp(m->label(), "Min Menu")==0) {
		printf("-- Min Menu -- \n");
		window->make_current();
		fl_color(FL_RED);  
		fl_rectf(50, 50, 20, 20);

		static Fl_Button b1(60, 100, 80, 25, "&Beep");                       
		window->add(b1);

		window->redraw();
		

		/* mw->menu(big_menu); */
		/* (w->parent())->redraw(); */
		/* redraw(); */
		/* w->show(); */ /* ??? */
	} else {
		MessageBox (m->label());
	}

  if (m->shortcut())
    printf("%s - %s\n", m->label(), fl_shortcut_label(m->shortcut()));
  else
    printf("%s\n", m->label());

	/* char buffer[80]; */

}
Beispiel #7
0
 void flags_changed(const Fl_Menu_*, Fl_Widget* widget) {
     other->list()->flags_changed(other,widget);
 }
Beispiel #8
0
 Fl_Widget* child(const Fl_Menu_*, const int* indexes, int level) {
     return other->child(indexes, level);
 }
Beispiel #9
0
 int children(const Fl_Menu_*, const int* indexes, int level) {
     return other->children(indexes, level);
 }
static void proj_cb(Fl_Widget *w, void *) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)(w->user_data());
  app->display_set_projection(m->text());
}
static void rendermode_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)v;
  app->display_set_rendermode(m->text());
}
static void stereo_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)v;
  app->display_set_stereo(m->text());
}
static void axes_cb(Fl_Widget *w, void *v) {
  Fl_Menu_ *m = (Fl_Menu_ *)w;
  VMDApp *app = (VMDApp *)v;
  app->axes_set_location(m->text());
}