Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

MenuBar.cpp

00001 #include <glui.h>
00002 #include <iostream>
00003 #include <string>
00004 
00005 #include "LifeVariables.h"
00006 #include "MenuBar.h"
00007 #include "RawReader.h"
00008 
00009 using namespace std;
00010 
00011 MenuBar::MenuBar(int mainWindowRef, int position) {
00012     
00013     this->fileInfoStr ="File: -";
00014     this->renderModeStr = "RenderMode: -";
00015 
00016     selectedFile = 0;
00017 
00018     if((mainWindowRef==0)&&(position==0)) {
00019         panel = GLUI_Master.create_glui("Menu", 0,150,100);
00020     }
00021     else {
00022         panel = GLUI_Master.create_glui_subwindow(mainWindowRef, position);
00023         panel->set_main_gfx_window(mainWindowRef);
00024     }   
00025 
00026     openFileList = panel->add_listbox("File: ", &selectedFile);
00027   
00028     // add button to confirm file settings
00029     panel->add_column(false);  
00030     setFileBtn = panel->add_button("Open", OPEN_FILE_ID, eventListener);
00031         
00032     // add button to reset the search path
00033     panel->add_column(false);
00034     addPathBtn= panel->add_button("Set Path", SHOWOPENFILEDLG_ID, eventListener);
00035 
00036     // add button to set the render mode
00037     //panel->add_column(false);  
00038     //switchModeBtn = panel->add_button("Switch Mode", MODESELECT_ID, eventListener);
00039     //switchModeBtn->disable();
00040 
00041     this->updateFileList();
00042 }
00043 
00044 
00045 void MenuBar::updateFileList() {
00046     openFileList->disable();
00047     setFileBtn->disable();
00048 
00049     this->renderModeStr = "-";
00050     this->fileInfoStr = "-";
00051 
00052     if(reader->isDirOpen()) {
00053         // delete the existing list
00054         int c = 0;
00055         while(openFileList->delete_item(c)) {
00056             c++;
00057         }
00058         // insert the new list
00059         for(int i = 0; i< reader->fileList.size(); i++) {
00060             openFileList->add_item(i, reader->getFileNameAt(i));      
00061         }
00062         openFileList->enable();
00063         setFileBtn->enable();
00064     }
00065 }
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 

Generated on Mon Dec 12 15:20:26 2005 for CCube by  doxygen 1.4.1