当前位置: 首页>>代码示例>>C++>>正文


C++ VMDApp::menu_move方法代码示例

本文整理汇总了C++中VMDApp::menu_move方法的典型用法代码示例。如果您正苦于以下问题:C++ VMDApp::menu_move方法的具体用法?C++ VMDApp::menu_move怎么用?C++ VMDApp::menu_move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VMDApp的用法示例。


在下文中一共展示了VMDApp::menu_move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Py_BuildValue

static PyObject *location(PyObject *self, PyObject *args) {
  char *name;
  PyObject *loc;
  if (!PyArg_ParseTuple(args, (char *)"s|O", &name, &loc))
    return NULL;
  VMDApp *app = get_vmdapp();
  int x, y;
  if (PyTuple_GET_SIZE(args) > 1) {
    // parse loc argument
    if (!PyArg_ParseTuple(loc, (char *)"ii", &x, &y))
      return NULL;
    app->menu_move(name, x, y);
  }
  app->menu_location(name, x, y);
  return Py_BuildValue("(ii)", x, y);
}
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:16,代码来源:py_menu.C

示例2: text_cmd_menu

int text_cmd_menu(ClientData cd, Tcl_Interp *interp, int argc,
                     const char *argv[]) {

  VMDApp *app = (VMDApp *)cd;
  int retval = TCL_OK;

  // make sure a menu was named
  if (argc < 2) retval = TCL_HELP;

  if (argc == 2 && !strupncmp(argv[1], "list", CMDLEN)) {
      // return a list of the available menus
      for (int i=0; i<app->num_menus(); i++) 
        Tcl_AppendElement(interp,  app->menu_name(i));
  }
#ifdef VMDTK
  else if (argc > 1 && !strupncmp(argv[1], "tk", CMDLEN)) {
#ifndef MACVMD
    if ((argc == 5 || argc == 6 ) && !strupncmp(argv[2], "add", CMDLEN)) {
      VMDMenu *menu = new VMDTkMenu(argv[3], argv[4], app, interp);
      if (!app->add_menu(menu)) {
        delete menu;
        char buf[50];
        sprintf(buf, "Unable to add menu %s.\n", argv[3]);
        Tcl_SetResult(interp, buf, TCL_VOLATILE);
        retval = TCL_ERROR;
      } else {
        // tell VMD that this is a menu extension
        if (argc==6) app->menu_add_extension(argv[3],argv[5]);
        else app->menu_add_extension(argv[3],argv[3]);
  
        // tell Tcl that a new menu extension has been added
        Tcl_SetVar(interp, "vmd_menu_extension", argv[3], TCL_GLOBAL_ONLY);
      }
    } else if ((argc == 5 || argc == 6 ) && !strupncmp(argv[2], "register", CMDLEN)) {
      VMDTkMenu *menu = new VMDTkMenu(argv[3], NULL, app, interp);
      menu->register_proc(argv[4]);
      if (!app->add_menu(menu)) {
        delete menu;
        char buf[50];
        sprintf(buf, "Unable to add menu %s\n", argv[3]);
        Tcl_SetResult(interp, buf, TCL_VOLATILE);
        retval = TCL_ERROR;
      } else {
        // tell VMD that this is a menu extension
        if (argc==6) app->menu_add_extension(argv[3],argv[5]);
        else app->menu_add_extension(argv[3],argv[3]);
  
        // tell Tcl that a new menu extension has been added
        Tcl_SetVar(interp, "vmd_menu_extension", argv[3], TCL_GLOBAL_ONLY);
      }
    } else if (argc == 4 && !strupncmp(argv[2], "remove", CMDLEN)) {
      if (!app->remove_menu(argv[3])) {
        char buf[50];
        sprintf(buf, "Unable to remove menu %s\n", argv[3]);
        Tcl_SetResult(interp, buf, TCL_VOLATILE);
        retval = TCL_ERROR;
      }
      else app->menu_remove_extension(argv[3]);
    }
    else retval = TCL_HELP;
#else
    /* MACVMD just eats it, and does nothing presently */
#endif
  }
#endif
  else if (argc == 4 && !strupncmp(argv[2], "selectmol", CMDLEN)) {
    // undocumented command for internal use only!
    int ind;
    if (Tcl_GetInt(interp, argv[3], &ind) != TCL_OK) retval = TCL_HELP;
    else app->menu_select_mol(argv[1], ind);
  }
  else if(argc == 3) {
    if(!strupncmp(argv[2],"on",CMDLEN))
      app->menu_show(argv[1], 1);
    else if (!strupncmp(argv[2],"off",CMDLEN))
      app->menu_show(argv[1], 0);
    else if (!strupncmp(argv[2],"loc",CMDLEN)) {
      int x, y;
      if (app->menu_location(argv[1], x, y)) {
        char buf[20];
        sprintf(buf, "%d %d", x, y);
        Tcl_SetResult(interp, buf, TCL_VOLATILE);
      } 
      else {
        Tcl_AppendResult(interp, "menu loc: menu '", argv[1], 
          "' does not exist.", NULL);
        retval = TCL_ERROR;
      }
    } 
    else if (!strupncmp(argv[2], "status", CMDLEN))
      Tcl_AppendResult(interp, app->menu_status(argv[1]) ? "on" : "off", NULL);
    else  retval = TCL_HELP;
  }
  else if (argc == 5 && !strupncmp(argv[2],"move",CMDLEN))
    app->menu_move(argv[1], atoi(argv[3]), atoi(argv[4]));
  else
    retval = TCL_HELP;
  
  if (retval == TCL_HELP) {
    Tcl_SetResult(interp, 
//.........这里部分代码省略.........
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:101,代码来源:cmd_menu.C


注:本文中的VMDApp::menu_move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。