00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: UIObject.C,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.43 $ $Date: 2019/01/17 21:21:02 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * User Interface Object base class. All user interface modules are derived 00020 * from this; it provides methods for registering with the command processor 00021 * and 'signing up' for which commands it is interested in, as well as 00022 * generating commands and events. 00023 * 00024 ***************************************************************************/ 00025 00026 #include "UIObject.h" 00027 #include "CommandQueue.h" 00028 #include "Command.h" 00029 #include "Inform.h" 00030 #include "utilities.h" 00031 #include "VMDApp.h" 00032 00033 // class constructor: list to register with and name 00034 UIObject::UIObject(VMDApp *vmdapp) { 00035 app = vmdapp; 00036 cmdQueue = app->commandQueue; 00037 00038 // register this object 00039 cmdQueue->register_UI(this); 00040 maxCmds = Command::TOTAL; 00041 00042 // init the command flag array 00043 doCmd = new char[maxCmds]; 00044 for(int i=0; i < maxCmds; doCmd[i++] = FALSE); 00045 00046 make_callbacks = FALSE; 00047 is_on = FALSE; 00048 } 00049 00050 00051 UIObject::~UIObject(void) { 00052 cmdQueue->unregister_UI(this); 00053 delete [] doCmd; 00054 } 00055 00056 // note that we are/are not interested in a command 00057 void UIObject::command_wanted(int cmd) { 00058 if(cmd >= 0 && cmd < maxCmds) 00059 doCmd[cmd] = TRUE; 00060 } 00061 00062 void UIObject::runcommand(Command *cmd) { 00063 cmdQueue->runcommand(cmd); 00064 } 00065