Changeset 3430 in orxonox.OLD for orxonox/branches/trackManager/src/gui
- Timestamp:
- Mar 1, 2005, 9:50:30 AM (20 years ago)
- Location:
- orxonox/branches/trackManager
- Files:
-
- 20 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/trackManager
- Property svn:externals set to
-
orxonox/branches/trackManager/src/gui/Makefile.am
r3144 r3430 1 AM_CXXFLAGS=$(GTK2_CFLAGS) $( MSBITFIELDS)2 #AM_LDFLAGS=$(GTK2_LIBS) 3 LIBS=$(GTK2_LIBS) 1 AM_CXXFLAGS=$(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 2 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 3 LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 4 4 5 5 bin_PROGRAMS=gui … … 11 11 orxonox_gui_flags.cc \ 12 12 orxonox_gui_banner.cc \ 13 orxonox_gui_keys.cc 13 orxonox_gui_keys.cc \ 14 orxonox_gui_update.cc 14 15 15 16 noinst_HEADERS=orxonox_gui.h \ … … 20 21 orxonox_gui_flags.h \ 21 22 orxonox_gui_banner.h \ 22 orxonox_gui_keys.h 23 orxonox_gui_keys.h \ 24 orxonox_gui_update.h 23 25 24 26 # uncomment the following if orxonox requires the mathlibrary -
orxonox/branches/trackManager/src/gui/Makefile.in
r3219 r3430 56 56 orxonox_gui_video.$(OBJEXT) orxonox_gui_audio.$(OBJEXT) \ 57 57 orxonox_gui_exec.$(OBJEXT) orxonox_gui_flags.$(OBJEXT) \ 58 orxonox_gui_banner.$(OBJEXT) orxonox_gui_keys.$(OBJEXT) 58 orxonox_gui_banner.$(OBJEXT) orxonox_gui_keys.$(OBJEXT) \ 59 orxonox_gui_update.$(OBJEXT) 59 60 gui_OBJECTS = $(am_gui_OBJECTS) 60 61 gui_LDADD = $(LDADD) … … 69 70 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox_gui_gtk.Po \ 70 71 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox_gui_keys.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox_gui_update.Po \ 71 73 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox_gui_video.Po 72 74 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ … … 94 96 CPP = @CPP@ 95 97 CPPFLAGS = @CPPFLAGS@ 98 CURL_CFLAGS = @CURL_CFLAGS@ 99 CURL_LIBS = @CURL_LIBS@ 96 100 CXX = @CXX@ 97 101 CXXDEPMODE = @CXXDEPMODE@ … … 109 113 EGREP = @EGREP@ 110 114 EXEEXT = @EXEEXT@ 115 GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ 116 GTHREAD_LIBS = @GTHREAD_LIBS@ 111 117 GTK2_CFLAGS = @GTK2_CFLAGS@ 112 118 GTK2_LIBS = @GTK2_LIBS@ 119 HAVE_CURL_FALSE = @HAVE_CURL_FALSE@ 120 HAVE_CURL_TRUE = @HAVE_CURL_TRUE@ 121 HAVE_GTHREAD_FALSE = @HAVE_GTHREAD_FALSE@ 122 HAVE_GTHREAD_TRUE = @HAVE_GTHREAD_TRUE@ 113 123 HAVE_GTK2_FALSE = @HAVE_GTK2_FALSE@ 114 124 HAVE_GTK2_TRUE = @HAVE_GTK2_TRUE@ … … 119 129 LDFLAGS = @LDFLAGS@ 120 130 LIBOBJS = @LIBOBJS@ 121 #AM_LDFLAGS=$(GTK2_LIBS) 122 LIBS = $(GTK2_LIBS) 131 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 132 LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 123 133 LTLIBOBJS = @LTLIBOBJS@ 124 134 MAKEINFO = @MAKEINFO@ … … 135 145 SHELL = @SHELL@ 136 146 STRIP = @STRIP@ 147 SUB_PROJECTS_FALSE = @SUB_PROJECTS_FALSE@ 148 SUB_PROJECTS_TRUE = @SUB_PROJECTS_TRUE@ 137 149 VERSION = @VERSION@ 138 150 ac_ct_CC = @ac_ct_CC@ … … 178 190 target_os = @target_os@ 179 191 target_vendor = @target_vendor@ 180 AM_CXXFLAGS = $(GTK2_CFLAGS) $( MSBITFIELDS)192 AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 181 193 gui_SOURCES = orxonox_gui.cc \ 182 194 orxonox_gui_gtk.cc \ … … 186 198 orxonox_gui_flags.cc \ 187 199 orxonox_gui_banner.cc \ 188 orxonox_gui_keys.cc 200 orxonox_gui_keys.cc \ 201 orxonox_gui_update.cc 189 202 190 203 noinst_HEADERS = orxonox_gui.h \ … … 195 208 orxonox_gui_flags.h \ 196 209 orxonox_gui_banner.h \ 197 orxonox_gui_keys.h 210 orxonox_gui_keys.h \ 211 orxonox_gui_update.h 198 212 199 213 … … 280 294 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox_gui_gtk.Po@am__quote@ 281 295 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox_gui_keys.Po@am__quote@ 296 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox_gui_update.Po@am__quote@ 282 297 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox_gui_video.Po@am__quote@ 283 298 -
orxonox/branches/trackManager/src/gui/orxonox_gui.cc
r3187 r3430 24 24 */ 25 25 26 #include <unistd.h> 27 26 28 #include "orxonox_gui.h" 27 29 #include "orxonox_gui_video.h" … … 31 33 #include "orxonox_gui_banner.h" 32 34 #include "orxonox_gui_keys.h" 35 #include "orxonox_gui_update.h" 33 36 34 37 Window* orxonoxGUI; … … 39 42 OrxonoxGuiBanner* banner; 40 43 OrxonoxGuiKeys* keys; 44 OrxonoxGuiUpdate* update; 45 int verbose = 4; 41 46 42 int main( int argc, char *argv[])47 int main(int argc, char *argv[]) 43 48 { 44 49 OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); … … 51 56 \brief Initializes the Gui 52 57 */ 53 OrxonoxGui::OrxonoxGui 58 OrxonoxGui::OrxonoxGui(int argc, char *argv[]) 54 59 { 55 #ifdef HAVE_GTK2 56 initGTK(argc, argv); 57 #endif /* HAVE_GTK2 */ 58 orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); 59 #ifdef HAVE_GTK2 60 orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); 61 orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); 62 #endif /* HAVE_GTK2 */ 60 initGUI(argc, argv); 61 62 orxonoxGUI = new Window( "grafical orxonox loader, "PACKAGE_VERSION); 63 63 64 64 Box* windowBox = new Box ('h'); … … 67 67 windowBox->fill (banner->getWidget()); 68 68 69 Box* optionBox = new Box 69 Box* optionBox = new Box('v'); 70 70 71 Box* avBox = new Box 71 Box* avBox = new Box('h'); 72 72 73 video = new OrxonoxGuiVideo 74 avBox->fill (video->getWidget());75 audio = new OrxonoxGuiAudio 76 avBox->fill (audio->getWidget());73 video = new OrxonoxGuiVideo(); 74 avBox->fill(video->getWidget()); 75 audio = new OrxonoxGuiAudio(); 76 avBox->fill(audio->getWidget()); 77 77 78 optionBox->fill 78 optionBox->fill(avBox); 79 79 80 keys = new OrxonoxGuiKeys 81 optionBox->fill (keys->getWidget());80 keys = new OrxonoxGuiKeys(); 81 optionBox->fill(keys->getWidget()); 82 82 83 exec = new OrxonoxGuiExec (orxonoxGUI);84 optionBox->fill (exec->getWidget());83 exec = new OrxonoxGuiExec(); 84 optionBox->fill(exec->getWidget()); 85 85 86 flags = new OrxonoxGuiFlags (orxonoxGUI); 86 flags = new OrxonoxGuiFlags(); 87 88 optionBox->fill(flags->getWidget()); 89 windowBox->fill(optionBox); 90 91 update = new OrxonoxGuiUpdate(); 92 optionBox->fill(update->getWidget()); 93 94 orxonoxGUI->fill(windowBox); 95 96 // Reading Values from File 97 exec->setFilename("~/.orxonox.conf"); 98 exec->readFromFile(orxonoxGUI); 99 // Merging changes to the Options from appended flags. 100 for (int optCount = 1; optCount < argc; optCount++) 101 orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0); 102 103 flags->setTextFromFlags(orxonoxGUI); 104 orxonoxGUI->showall(); 105 106 //// Handling special Cases. /// 107 108 // case update // 109 #ifdef HAVE_CURL 110 if (static_cast<Option*>(orxonoxGUI->findWidgetByName("auto update", 0))->value == 1) 111 { 112 update->checkForUpdates(); 113 } 114 #endif /* HAVE_CURL */ 115 116 // case start-with-gui. 117 if (!access(exec->getConfigFile(), F_OK) && static_cast<Option*>(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0) 118 OrxonoxGuiExec::startOrxonox(NULL, exec); 119 else 120 { 121 mainloopGUI(); 122 } 123 124 } 87 125 88 126 89 optionBox->fill (flags->getWidget ()); 90 windowBox->fill (optionBox); 91 92 orxonoxGUI->fill (windowBox); 93 flags->setTextFromFlags (orxonoxGUI); 94 95 exec->setFilename ("~/.orxonox.conf"); 96 exec->readFromFile (orxonoxGUI); 97 // orxonoxGUI->walkThrough(orxonoxGUI->listOptions); 98 99 orxonoxGUI->showall (); 100 101 102 #ifdef HAVE_GTK2 103 mainloopGTK(); 104 #else /* HAVE_GTK2 */ 105 cout << " Listing all the Orxonox Options: \n"; 106 cout << " #############################\n"; 107 orxonoxGUI->walkThrough(orxonoxGUI->listOptions); 108 109 cout << "\nDo you want me to save the the above values now? [Yn] "; 110 char c = getchar(); 111 if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave()) 112 exec->writeToFile (Window::mainWindow); 113 114 #endif /* HAVE_GTK2 */ 115 127 /** 128 \brief Destructor. 129 */ 130 OrxonoxGui::~OrxonoxGui(void) 131 { 132 delete video; 133 delete audio; 134 delete exec; 135 delete flags; 136 delete banner; 137 delete keys; 138 delete update; 116 139 } -
orxonox/branches/trackManager/src/gui/orxonox_gui.h
r3187 r3430 25 25 { 26 26 public: 27 OrxonoxGui 28 ~OrxonoxGui ();27 OrxonoxGui(int argc, char *argv[]); 28 ~OrxonoxGui(void); 29 29 30 30 }; 31 31 32 33 34 32 #endif /* _ORXONOX_GUI_H */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_audio.cc
r2739 r3430 29 29 \brief Creates an Audio-Frame 30 30 */ 31 OrxonoxGuiAudio::OrxonoxGuiAudio ()31 OrxonoxGuiAudio::OrxonoxGuiAudio(void) 32 32 { 33 audioFrame = new Frame("Audio-Options:");34 audioBox = new Box('v');35 audioFrame->setGroupName("audio");33 this->audioFrame = new Frame("Audio-Options:"); 34 this->audioBox = new Box('v'); 35 this->audioFrame->setGroupName("audio"); 36 36 37 enableSound = new CheckButton("Disable Sound");38 enableSound->setFlagName ("no-sound", 0);39 enableSound->saveable = true;40 audioBox->fill (enableSound);41 Label* musicVolumeLabel = new Label 42 audioBox->fill(musicVolumeLabel);43 musicVolume = new Slider("Music Volume", 0, 100);44 musicVolume->setFlagName("music-volume", "m", 80);45 musicVolume->saveable = true;46 audioBox->fill (musicVolume);37 this->enableSound = new CheckButton("Disable Sound"); 38 this->enableSound->setFlagName ("no-sound", 0); 39 this->enableSound->saveability(); 40 this->audioBox->fill(this->enableSound); 41 Label* musicVolumeLabel = new Label("Music Volume"); 42 this->audioBox->fill(musicVolumeLabel); 43 this->musicVolume = new Slider("Music Volume", 0, 100); 44 this->musicVolume->setFlagName("music-volume", "m", 80); 45 this->musicVolume->saveability(); 46 this->audioBox->fill (this->musicVolume); 47 47 Label* effectsVolumeLabel = new Label ("Effects Volume"); 48 audioBox->fill (effectsVolumeLabel);49 effectsVolume = new Slider ("Effects Volume", 0, 100);50 effectsVolume->setFlagName ("effects-volume", "e", 80);51 effectsVolume->saveable = true;52 audioBox->fill (effectsVolume);48 this->audioBox->fill (effectsVolumeLabel); 49 this->effectsVolume = new Slider ("Effects Volume", 0, 100); 50 this->effectsVolume->setFlagName ("effects-volume", "e", 80); 51 this->effectsVolume->saveability(); 52 this->audioBox->fill (this->effectsVolume); 53 53 54 audioFrame->fill (audioBox); 54 this->audioFrame->fill (this->audioBox); 55 } 56 57 /** 58 \brief Destructs the Audio-Stuff 59 */ 60 OrxonoxGuiAudio::~OrxonoxGuiAudio(void) 61 { 62 // nothing to do here. 55 63 } 56 64 … … 59 67 \return Returns the Audio-frame 60 68 */ 61 Widget* OrxonoxGuiAudio::getWidget ()69 Widget* OrxonoxGuiAudio::getWidget(void) 62 70 { 63 return audioFrame;71 return this->audioFrame; 64 72 } -
orxonox/branches/trackManager/src/gui/orxonox_gui_audio.h
r3187 r3430 19 19 Slider* effectsVolume; //!< A Slider for effects volume. 20 20 public: 21 OrxonoxGuiAudio ();22 ~OrxonoxGuiAudio ();21 OrxonoxGuiAudio(void); 22 ~OrxonoxGuiAudio(void); 23 23 24 Widget* getWidget ();24 Widget* getWidget(void); 25 25 }; 26 26 #endif /* _ORXONOX_GUI_AUDIO_H */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_banner.cc
r3165 r3430 29 29 \brief Creates a new BannerEventBox and its content. 30 30 */ 31 OrxonoxGuiBanner::OrxonoxGuiBanner ()31 OrxonoxGuiBanner::OrxonoxGuiBanner(void) 32 32 { 33 33 // Banner Itself // 34 bannerEventBox = new EventBox("BannerEventBox");35 bannerImage = new Image("banner.xpm");36 bannerEventBox->fill(bannerImage);34 this->bannerEventBox = new EventBox("BannerEventBox"); 35 this->bannerImage = new Image("banner.xpm"); 36 this->bannerEventBox->fill(this->bannerImage); 37 37 38 38 // Banner Window // 39 logoWindow = new Window("Logo");39 this->logoWindow = new Window("Logo"); 40 40 41 41 #ifdef HAVE_GTK2 42 bannerEventBox->connectSignal ("button_press_event",logoWindow, Window::windowOpen);42 this->bannerEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowOpen); 43 43 44 logoWindow->connectSignal("destroy",logoWindow, Window::windowClose);45 logoWindow->connectSignal("delete_event",logoWindow, Window::windowClose);44 this->logoWindow->connectSignal("destroy", this->logoWindow, Window::windowClose); 45 this->logoWindow->connectSignal("delete_event", this->logoWindow, Window::windowClose); 46 46 #endif /* HAVE_GTK2 */ 47 logoEventBox = new EventBox();48 logoBox = new Box('v');49 logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION);50 logoImage = new Image("banner.xpm");51 logoEventBox->fill(logoImage);47 this->logoEventBox = new EventBox(); 48 this->logoBox = new Box('v'); 49 this->logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION); 50 this->logoImage = new Image("banner.xpm"); 51 this->logoEventBox->fill(this->logoImage); 52 52 53 logoBox->fill(logoLabel);54 logoBox->fill(logoEventBox);53 this->logoBox->fill(this->logoLabel); 54 this->logoBox->fill(this->logoEventBox); 55 55 #ifdef HAVE_GTK2 56 logoEventBox->connectSignal("button_press_event",logoWindow, Window::windowClose);56 this->logoEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowClose); 57 57 #endif /* HAVE_GTK2 */ 58 58 59 logoWindow->fill (logoBox);59 this->logoWindow->fill(this->logoBox); 60 60 61 Window::addWindow (logoWindow);61 Window::addWindow(this->logoWindow); 62 62 } 63 63 … … 65 65 \brief Destructs it. 66 66 */ 67 OrxonoxGuiBanner::~OrxonoxGuiBanner ()67 OrxonoxGuiBanner::~OrxonoxGuiBanner(void) 68 68 { 69 // nothing to do here 69 70 } 70 71 … … 73 74 \return The EventBox, that holds the Banner. 74 75 */ 75 Widget* OrxonoxGuiBanner::getWidget ()76 Widget* OrxonoxGuiBanner::getWidget(void) 76 77 { 77 return bannerEventBox;78 return this->bannerEventBox; 78 79 } 79 80 -
orxonox/branches/trackManager/src/gui/orxonox_gui_banner.h
r3187 r3430 29 29 30 30 public: 31 OrxonoxGuiBanner ();32 ~OrxonoxGuiBanner ();31 OrxonoxGuiBanner(void); 32 ~OrxonoxGuiBanner(void); 33 33 34 Widget* getWidget ();34 Widget* getWidget(void); 35 35 36 36 }; -
orxonox/branches/trackManager/src/gui/orxonox_gui_exec.cc
r3187 r3430 28 28 #include <string> 29 29 30 HashTable* orxonoxFlagHash; 31 30 32 /** 31 33 \brief Creates the Exec-Frame 32 \param orxonoxGUI ExecFrame needs to know where to get the Options from 33 */ 34 OrxonoxGuiExec::OrxonoxGuiExec (Window* orxonoxGUI) 35 { 36 configFile = (char*)malloc (512*sizeof (char)); 37 38 execFrame = new Frame ("Execute-Tags:"); 39 execBox = new Box ('v'); 40 execFrame->setGroupName ("misc"); 34 */ 35 OrxonoxGuiExec::OrxonoxGuiExec(void) 36 { 37 configFile =(char*)malloc(512*sizeof(char)); 38 39 this->execFrame = new Frame("Execute-Tags:"); 40 this->execBox = new Box('v'); 41 this->execFrame->setGroupName("misc"); 41 42 42 start = new Button("Start");43 this->start = new Button("Start"); 43 44 #ifdef HAVE_GTK2 44 start->connectSignal ("clicked", startOrxonox);45 this->start->connectSignal("clicked", this, startOrxonox); 45 46 #endif /* HAVE_GTK2 */ 46 execBox->fill(start);47 saveSettings = new CheckButton("Save Settings");48 saveSettings->value = 1;49 saveSettings->saveable = true;50 execBox->fill (saveSettings);51 verboseMode = new Menu ("verbose mode", "no output", "verbose", "debug", "lastItem");52 verboseMode->setFlagName("verbose", "v", 0);53 verboseMode->saveable = true;54 execBox->fill (verboseMode);55 alwaysShow = new CheckButton("Always Show this Menu");56 alwaysShow->setFlagName("gui", "g", 0);57 alwaysShow->saveable = true;58 execBox->fill (alwaysShow);59 quit = new Button("Quit");47 this->execBox->fill(start); 48 this->saveSettings = new CheckButton("Save Settings"); 49 this->saveSettings->value = 1; 50 this->saveSettings->saveability(); 51 this->execBox->fill(this->saveSettings); 52 this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem"); 53 this->verboseMode->setFlagName("verbose", "v", 0); 54 this->verboseMode->saveability(); 55 this->execBox->fill(this->verboseMode); 56 this->alwaysShow = new CheckButton("Always Show this Menu"); 57 this->alwaysShow->setFlagName("gui", "g", 0); 58 this->alwaysShow->saveability(); 59 this->execBox->fill(this->alwaysShow); 60 this->quit = new Button("Quit"); 60 61 #ifdef HAVE_GTK2 61 quit->connectSignal ("clicked", orxonoxGUI->orxonox_gui_quit); 62 this->quit->connectSignal("clicked", this, OrxonoxGuiExec::quitOrxonox); 63 // Window::mainWindow->connectSignal("remove", this, OrxonoxGuiExec::quitOrxonox); 64 Window::mainWindow->connectSignal("destroy", this, OrxonoxGuiExec::quitOrxonox); 62 65 #endif /* HAVE_GTK2 */ 63 execBox->fill (quit); 64 65 execFrame->fill (execBox); 66 this->execBox->fill(this->quit); 67 68 this->execFrame->fill(this->execBox); 69 } 70 71 /** 72 \brief Destructs the Execution-stuff 73 */ 74 OrxonoxGuiExec::~OrxonoxGuiExec(void) 75 { 76 if(this->configFile) 77 delete []this->configFile; 66 78 } 67 79 … … 70 82 \return Returns the Exec-frame 71 83 */ 72 Widget* OrxonoxGuiExec::getWidget ()84 Widget* OrxonoxGuiExec::getWidget(void) 73 85 { 74 86 return execFrame; … … 78 90 79 91 /** 80 \brief Sets the location of the configuration File.\n 81 * The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows 92 \brief Sets the location of the configuration File. 82 93 \param filename the location of the configFile 83 */ 84 void OrxonoxGuiExec::setFilename (char* filename) 85 { 86 char* buffer = (char*) malloc (512*sizeof(buffer)); 87 sprintf (buffer, "%s", filename); 88 if (!strncmp (buffer, "~/", 2)) 94 95 \todo: memory allocation could be better. 96 97 The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows 98 */ 99 void OrxonoxGuiExec::setFilename(char* filename) 100 { 101 char* buffer = (char*)malloc(2048*sizeof(char)); 102 sprintf(buffer, "%s", filename); 103 if(!strncmp(buffer, "~/", 2)) 89 104 { 90 105 #ifdef __WIN32__ 91 sprintf (configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);106 sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2); 92 107 #else 93 sprintf (configFile, "%s/%s", getenv("HOME"), buffer+2);108 sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2); 94 109 #endif 95 110 } 96 else if (buffer) 97 sprintf(configFile, "%s", buffer); 98 delete buffer; 111 else if(buffer) 112 strcpy(this->configFile, buffer); 113 free (buffer); 114 } 115 116 /** 117 \returns The name of the Configuration-File 118 */ 119 char* OrxonoxGuiExec::getConfigFile(void) 120 { 121 return this->configFile; 99 122 } 100 123 … … 103 126 \return 1 if it should 0 if not/ 104 127 */ 105 int OrxonoxGuiExec::shouldsave 106 { 107 return (static_cast<Option*>(saveSettings)->value);128 int OrxonoxGuiExec::shouldsave() 129 { 130 return(static_cast<Option*>(this->saveSettings)->value); 108 131 } 109 132 … … 112 135 \param widget from which Widget on should be saved. 113 136 114 this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText 115 */ 116 void OrxonoxGuiExec::writeToFile 117 { 118 CONFIG_FILE = fopen(configFile, "w");119 if (CONFIG_FILE)120 writeFileText(widget, 0);121 fclose (CONFIG_FILE);137 this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText(Widget* widget) will execute the real writing process. 138 */ 139 void OrxonoxGuiExec::writeToFile(Widget* widget) 140 { 141 this->CONFIG_FILE = fopen(configFile, "w"); 142 if(this->CONFIG_FILE) 143 this->writeFileText(widget, 0); 144 fclose(this->CONFIG_FILE); 122 145 } 123 146 … … 127 150 \param depth initially "0", and grows higher, while new Groups are bundeled. 128 151 */ 129 void OrxonoxGuiExec::writeFileText 152 void OrxonoxGuiExec::writeFileText(Widget* widget, int depth) 130 153 { 131 154 int counter = 0; 132 while (counter < depth &&((widget->isOption>0133 && (static_cast<Option*>(widget)->saveable))134 || 135 136 { 137 fprintf (CONFIG_FILE, " ", depth);155 while(counter < depth &&((widget->isOption>0 156 &&(static_cast<Option*>(widget)->isSaveable())) 157 ||(widget->isOption<0 158 && static_cast<Packer*>(widget)->getGroupName()))) 159 { 160 fprintf(this->CONFIG_FILE, " ", depth); 138 161 counter++; 139 162 } 140 163 141 164 // check if it is a Packer, and if it is, check if it has a name and if there is something in it. 142 if 143 { 144 if 145 { 146 fprintf 147 writeFileText(static_cast<Packer*>(widget)->down, depth+1);165 if(widget->isOption <0) 166 { 167 if(static_cast<Packer*>(widget)->getGroupName()) 168 { 169 fprintf(CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName()); 170 this->writeFileText(static_cast<Packer*>(widget)->down, depth+1); 148 171 fprintf(CONFIG_FILE, "\n"); 149 172 } 150 173 else 151 174 { 152 writeFileText(static_cast<Packer*>(widget)->down, depth);175 this->writeFileText(static_cast<Packer*>(widget)->down, depth); 153 176 } 154 177 } 155 // if 156 // printf ("%s\n",widget->label);157 if 158 if (static_cast<Option*>(widget)->saveable)178 // if(widget->isOption == 0) 179 // printf("%s\n",widget->title); 180 if(widget->isOption >= 1) 181 if (static_cast<Option*>(widget)->isSaveable()) 159 182 { 160 183 char Buffer[256]; 161 184 char* space2under; 162 strcpy (Buffer, static_cast<Option*>(widget)->label);163 if (strchr(Buffer, '_'))185 strcpy(Buffer, static_cast<Option*>(widget)->title); 186 if(strchr(Buffer, '_')) 164 187 cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl; 165 while 188 while(space2under = strchr(Buffer, ' ')) 166 189 { 167 190 space2under[0] = '_'; 168 191 } 169 if 170 fprintf 171 else if 172 fprintf 192 if(widget->isOption <=3) 193 fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value); 194 else if(widget->isOption == 5) 195 fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue); 173 196 } 174 197 175 if 176 writeFileText(widget->next, depth);198 if(widget->next != NULL) 199 this->writeFileText(widget->next, depth); 177 200 } 178 201 … … 181 204 \param widget from which Widget on should be saved. 182 205 */ 183 void OrxonoxGuiExec::readFromFile (Widget* widget) 184 { 185 CONFIG_FILE = fopen (configFile, "r"); 186 if (CONFIG_FILE) 206 void OrxonoxGuiExec::readFromFile(Widget* widget) 207 { 208 this->CONFIG_FILE = fopen(configFile, "r"); 209 VarInfo varInfo; 210 if(this->CONFIG_FILE) 187 211 { 188 212 Widget* groupWidget = widget; … … 190 214 char Variable[256]= ""; 191 215 char* Value; 192 while (fscanf (CONFIG_FILE, "%s", Buffer) != EOF)216 while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF) 193 217 { 194 218 // group-search // 195 if (!strncmp(Buffer, "[", 1))219 if(!strncmp(Buffer, "[", 1)) 196 220 { 197 if ((groupWidget = locateGroup(widget, Buffer, 1))==NULL)221 if((groupWidget = locateGroup(widget, Buffer, 1))==NULL) 198 222 { 199 223 cout << "!!There is no group called " << Buffer << " in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n"; 200 224 groupWidget = widget; 201 225 } 226 else 227 PRINT(3)("Group %s located.\n", static_cast<Packer*>(groupWidget)->groupName); 202 228 } 203 229 // option-setting // 204 if (!strcmp(Buffer, "="))230 if(!strcmp(Buffer, "=")) 205 231 { 206 232 char* under2space; 207 while 233 while(under2space = strchr(Variable, '_')) 208 234 { 209 sprintf 235 sprintf(under2space, " %s", under2space+1); 210 236 } 211 237 212 fscanf (CONFIG_FILE, "%s", Buffer); 213 Value = Buffer; 214 readFileText (groupWidget, Variable, Value, 0); 215 sprintf (Variable, ""); 238 fscanf(this->CONFIG_FILE, "%s", Buffer); 239 varInfo.variableName = Variable; 240 varInfo.variableValue = Buffer; 241 groupWidget->walkThrough(this->readFileText, &varInfo, 0); 242 sprintf(Variable, ""); 216 243 } 217 sprintf (Variable, "%s", Buffer); 218 } 219 widget->walkThrough(widget->setOptions); 220 } 221 } 244 sprintf(Variable, "%s", Buffer); 245 } 246 widget->walkThrough(widget->setOptions, 0); 247 } 248 } 249 222 250 /** 223 251 \brief Maps Confugurations to the Options. 224 252 \param widget which widget downwards 225 \param variableName the name of the Variable that should be set up. 226 \param variableValue the Value of the Variable that should be set up 227 \param depth the depth of the local Widget 228 */ 229 void OrxonoxGuiExec::readFileText (Widget* widget, char* variableName, char* variableValue, int depth) 230 { 231 if (widget->isOption >= 1 && widget->isOption <= 3) 232 { 233 if (!strcmp (static_cast<Option*>(widget)->label, variableName)) 234 static_cast<Option*>(widget)->value = atoi(variableValue); 235 } 236 else if (widget->isOption == 5) 237 { 238 if (!strcmp (static_cast<Option*>(widget)->label, variableName)) 239 static_cast<OptionLabel*>(widget)->setValue(variableValue); 240 } 241 if (widget->isOption < 0) 242 { 243 readFileText (static_cast<Packer*>(widget)->down, variableName, variableValue, depth+1); 244 } 245 246 if (widget->next != NULL && depth !=0) 247 readFileText (widget->next, variableName, variableValue, depth); 253 \param varInfo Information about the Variable to read 254 */ 255 void OrxonoxGuiExec::readFileText(Widget* widget, void* varInfo) 256 { 257 VarInfo* info =(VarInfo*)varInfo; 258 if(widget->title && !strcmp(widget->title, info->variableName)) 259 { 260 PRINT(3)("Located Option %s.\n", widget->title); 261 if(widget->isOption >= 1 && widget->isOption <= 3) 262 { 263 static_cast<Option*>(widget)->value = atoi(info->variableValue); 264 static_cast<Option*>(widget)->redraw(); //!< \todo change this to setValue. 265 } 266 else if(widget->isOption == 5) 267 static_cast<OptionLabel*>(widget)->setValue(info->variableValue); 268 } 248 269 } 249 270 … … 254 275 \param depth The Depth of the search seen from the first widget we searched from. 255 276 \returns The Widget that holds the Group, or the NULL if the Group wasn't found. 277 278 \todo do this in gui-gtk. 256 279 */ 257 280 Widget* OrxonoxGuiExec::locateGroup(Widget* widget, char* groupName, int depth) … … 260 283 261 284 // removes the trailing and ending [ ]. 262 if (!strncmp(groupName, "[", 1))285 if(!strncmp(groupName, "[", 1)) 263 286 { 264 287 groupName = groupName+1; … … 266 289 } 267 290 268 if 269 { 270 if 291 if(widget->isOption < 0) 292 { 293 if(static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName())) 271 294 { 272 295 return widget; … … 274 297 else 275 298 { 276 if ((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)299 if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL) 277 300 return tmp; 278 301 } 279 302 } 280 303 281 if 282 { 283 if ((tmp = locateGroup(widget->next, groupName, depth)) != NULL)304 if(widget->next != NULL && depth != 0) 305 { 306 if((tmp = locateGroup(widget->next, groupName, depth)) != NULL) 284 307 return tmp; 285 308 } … … 289 312 #ifdef HAVE_GTK2 290 313 /** 291 \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n 292 This is a Signal and can be executed through Widget::signal_connect 314 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 293 315 \param widget the widget that executed the start command 294 316 \param data additional data 295 */ 296 gint startOrxonox (GtkWidget *widget, Widget* data) 297 { 317 318 This is a Signal and can be executed through Widget::signal_connect 319 */ 320 int OrxonoxGuiExec::startOrxonox(GtkWidget* widget, void* data) 321 { 322 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 323 if(exec->shouldsave()) 324 exec->writeToFile(Window::mainWindow); 298 325 cout << "Starting Orxonox" <<endl; 299 } 326 gtk_main_quit(); 327 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell) 328 } 329 330 /** 331 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 332 \param widget the widget that executed the start command 333 \param data additional data 334 335 This is a Signal and can be executed through Widget::signal_connect 336 */ 337 int OrxonoxGuiExec::quitOrxonox(GtkWidget* widget, void* data) 338 { 339 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 340 PRINT(3)( "Quitting Orxonox %p\n", exec); 341 if(exec->shouldsave()) 342 exec->writeToFile(Window::mainWindow); 343 gtk_main_quit(); 344 } 345 #else /* HAVE_GTK2 */ 346 /** 347 \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n 348 \param widget the widget that executed the start command 349 \param data additional data 350 */ 351 int OrxonoxGuiExec::startOrxonox(void* widget, void* data) 352 { 353 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 354 PRINT(3)("Starting Orxonox\n"); 355 if(exec->shouldsave()) 356 exec->writeToFile(Window::mainWindow); 357 system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell) 358 } 359 /** 360 \brief Quits ORXONOX. 361 \param widget the widget that executed the Quit command 362 \param data additional data 363 364 This is a Signal and can be executed through Widget::signal_connect 365 */ 366 int OrxonoxGuiExec::quitOrxonox(void* widget, void* data) 367 { 368 OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data; 369 PRINT(3)("Quiting Orxonox"); 370 if(exec->shouldsave()) 371 exec->writeToFile(Window::mainWindow); 372 } 373 300 374 #endif /* HAVE_GTK2 */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_exec.h
r3187 r3430 24 24 char* configFile; //!< The name of the .orxonox.conf(ig)-file. 25 25 FILE* CONFIG_FILE; //!< Filehandler for reading and writing. 26 27 //! A struct that holds informations about variables. 28 struct VarInfo 29 { 30 char* variableName; //!< The Name of this variable; 31 char* variableValue; //!< The Value this variable gets. 32 }; 26 33 27 34 public: 28 OrxonoxGuiExec (Window* orxonoxGUI);29 ~OrxonoxGuiExec ();35 OrxonoxGuiExec(void); 36 ~OrxonoxGuiExec(void); 30 37 31 Widget* getWidget ();38 Widget* getWidget(void); 32 39 33 void setFilename (char* filename); 34 int shouldsave (); 35 void writeToFile (Widget* widget); 36 void writeFileText (Widget* widget, int depth); 37 void readFromFile (Widget* widget); 38 void readFileText (Widget* widget, char* variableName, char* variableValue, int depth); 40 void setFilename(char* filename); 41 char* getConfigFile(void); 42 int shouldsave(void); 43 void writeToFile(Widget* widget); 44 void writeFileText(Widget* widget, int depth); 45 void readFromFile(Widget* widget); 46 static void readFileText(Widget* widget, void* varInfo); 39 47 Widget* locateGroup(Widget* widget, char* groupName, int depth); 40 48 49 #ifdef HAVE_GTK2 50 static int startOrxonox(GtkWidget *widget, void* data); 51 static int quitOrxonox(GtkWidget *widget, void* data); 52 #else /* HAVE_GTK2 */ 53 static int startOrxonox(void* widget, void* data); 54 static int quitOrxonox(void* widget, void* data); 55 #endif /* HAVE_GTK2 */ 41 56 }; 42 #ifdef HAVE_GTK2 43 gint startOrxonox (GtkWidget *widget, Widget* data); 44 #endif /* HAVE_GTK2 */ 57 58 59 struct HashTable 60 { 61 char* name; 62 char* value; 63 HashTable* next; 64 }; 65 66 45 67 #endif /* _ORXONOX_GUI_EXEC_H */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_flags.cc
r3158 r3430 28 28 /** 29 29 \brief Creates the Flags-Frame 30 \param widget The Widget from which the data will be parsed31 30 */ 32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)31 OrxonoxGuiFlags::OrxonoxGuiFlags(void) 33 32 { 34 flagText = (char*) malloc (1024); 33 this->flagsFrame = new Frame("Orxonox-Startup-Flags:"); 34 this->flagsBox = new Box('v'); 35 35 36 flagsFrame = new Frame ("Orxonox-Startup-Flags:"); 37 flagsBox = new Box ('v'); 36 this->flagsLabel = new Label(); 37 this->flagsLabel->setSize(260,60); 38 this->flagsBox->fill(flagsLabel); 39 this->shortFlags = new CheckButton("shortFlags"); 40 this->flagsBox->fill(shortFlags); 38 41 39 flagsLabel = new Label (); 40 flagsLabel->setSize (260,60); 41 flagsBox->fill (flagsLabel); 42 shortFlags = new CheckButton ("shortFlags"); 43 flagsBox->fill (shortFlags); 42 this->flagsFrame->fill(flagsBox); 43 } 44 44 45 flagsFrame->fill (flagsBox); 45 /** 46 \brief Destructs the Flags-stuff 47 */ 48 OrxonoxGuiFlags::~OrxonoxGuiFlags(void) 49 { 50 // nothing to do here 46 51 } 47 52 … … 50 55 \returns Frame that holds the Flagtext. 51 56 */ 52 Widget* OrxonoxGuiFlags::getWidget ()57 Widget* OrxonoxGuiFlags::getWidget(void) 53 58 { 54 return flagsFrame;59 return this->flagsFrame; 55 60 } 56 61 … … 59 64 \param widget the Widget from which on to scan for deeper Options and their settings. 60 65 */ 61 void OrxonoxGuiFlags::setTextFromFlags 66 void OrxonoxGuiFlags::setTextFromFlags(Widget* widget) 62 67 { 63 sprintf (flagText, ""); 64 strcat (flagText, "orxonox"); 65 FlagsText (widget); 66 flagsLabel->setText (flagText); 68 FlagInfo flagInfo; 69 flagInfo.shortFlags = this->shortFlags; 70 flagInfo.flagsLabel = this->flagsLabel; 71 72 this->flagsLabel->ereaseText(); 73 this->flagsLabel->appendText("orxonox"); 74 widget->walkThrough(OrxonoxGuiFlags::flagsText, &flagInfo, 0); 75 // flagsLabel->setTitle(flagText); 67 76 } 68 77 … … 70 79 \brief this actually sets the flagtext, and appends it to flagText 71 80 \param widget like OrxonoxGuiFlags::setTextFromFlags(widget) 81 \param flagInfo Information aboout the Flag that should be updated. 72 82 */ 73 void OrxonoxGuiFlags:: FlagsText(Widget* widget)83 void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo) 74 84 { 75 if (widget->isOption >= 1) 76 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue && (static_cast<Option*>(widget)->flagName || static_cast<Option*>(widget)->flagNameShort )) 85 FlagInfo* info =(FlagInfo*)flagInfo; 86 if(widget->isOption >= 1) 87 if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue ) 77 88 { 78 if (shortFlags->isActive())89 if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort) 79 90 { 80 strcat (flagText," -");81 strcat (flagText,static_cast<Option*>(widget)->flagNameShort);91 info->flagsLabel->appendText(" -"); 92 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort); 82 93 } 83 else 94 else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName) 84 95 { 85 strcat (flagText," --");86 strcat (flagText,static_cast<Option*>(widget)->flagName);96 info->flagsLabel->appendText(" --"); 97 info->flagsLabel->appendText(static_cast<Option*>(widget)->flagName); 87 98 } 88 if (static_cast<Option*>(widget)->isOption == 2) 99 100 if(static_cast<Option*>(widget)->isOption == 2) 89 101 { 90 sprintf (flagText, "%s=%i", flagText, static_cast<Option*>(widget)->value); 102 info->flagsLabel->appendText("="); 103 info->flagsLabel->appendInt(static_cast<Option*>(widget)->value); 91 104 } 92 105 } 93 switch (widget->isOption)94 {95 case -1:96 FlagsText (static_cast<Container*>(widget)->down);97 break;98 case -2:99 FlagsText (static_cast<Box*>(widget)->down);100 break;101 }102 103 if (widget->next != NULL)104 FlagsText (widget->next);105 106 } -
orxonox/branches/trackManager/src/gui/orxonox_gui_flags.h
r3187 r3430 17 17 CheckButton* shortFlags; //!< CheckButton to change the display of short and long flags \todo show long if long not availible... 18 18 Label* flagsLabel; //!< The Label of the Flags 19 char* flagText; //!< The Text of the Label. \todo Delete when Object is destroyed.20 19 21 20 public: 22 OrxonoxGuiFlags (Widget* widget);23 ~OrxonoxGuiFlags ();21 OrxonoxGuiFlags(void); 22 ~OrxonoxGuiFlags(void); 24 23 25 void setTextFromFlags 26 void OrxonoxGuiFlags::FlagsText(Widget* widget);24 void setTextFromFlags(Widget* widget); 25 static void flagsText(Widget* widget, void* flagInfo); 27 26 28 Widget* getWidget (); 27 struct FlagInfo 28 { 29 CheckButton* shortFlags; 30 Label* flagsLabel; 31 }; 32 Widget* getWidget(void); 29 33 }; 30 34 #endif /* _ORXONOX_GUI_FLAGS_H */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.cc
r3192 r3430 34 34 // temporarily. 35 35 #include "orxonox_gui_flags.h" 36 #include "orxonox_gui_exec.h"37 36 extern Window* orxonoxGUI; 38 37 extern OrxonoxGuiFlags* flags; 39 extern OrxonoxGuiExec* exec; 40 41 #ifdef HAVE_GTK2 38 42 39 /** 43 40 \brief Initializes the Guis GTK-stuff. … … 45 42 \param argv The Argument strings. 46 43 */ 47 bool initGTK(int argc, char *argv[]) 48 { 49 gtk_init (&argc, &argv); 44 bool initGUI(int argc, char *argv[]) 45 { 46 #ifdef HAVE_GTK2 47 #ifdef HAVE_GTHREAD 48 PRINTF(3)("Initializing the ThreadSystem of the GUI\n"); 49 g_thread_init(NULL); 50 gdk_threads_init(); 51 #endif /* HAVE_GTHREAD */ 52 gtk_init(&argc, &argv); 50 53 gtk_rc_parse( "rc" ); 51 } 52 53 /** 54 \brief enters the GTK-main-loop 55 */ 56 bool mainloopGTK(void) 57 { 54 #endif /* HAVE_GTK2 */ 55 } 56 57 58 /** 59 \brief enters the GUI's main-loop 60 */ 61 bool mainloopGUI(void) 62 { 63 #ifdef HAVE_GTK2 64 gdk_threads_enter(); 58 65 gtk_main(); 59 } 60 #endif /* HAVE_GTK2 */ 66 gdk_threads_leave(); 67 delete Window::mainWindow; 68 #else /* HAVE_GTK2 */ 69 char boolAns = 'y'; 70 char ans[10]; 71 while(true) 72 { 73 PRINT(0)(" Listing all the Orxonox Options: \n"); 74 PRINT(0)(" #############################\n"); 75 Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1); 76 77 PRINT(0)("\nDo you want change any of the above values now? [Yn] "); 78 cin >>boolAns ; 79 if (boolAns =='n' || boolAns=='N') 80 break; 81 82 PRINT(0)("\n Listing all groups\n"); 83 PRINT(0)(" #################\n"); 84 int groupCount = 0; 85 Window::mainWindow->walkThrough(Widget::listGroups, &groupCount, 1); 86 87 PRINT(0)("\nIn which Group? [1-%d] ", groupCount); 88 Packer* group; 89 while(true) 90 { 91 cin >> ans; 92 int ansIp = atoi(ans); 93 if (ansIp <= groupCount) 94 { 95 group = static_cast<Packer*>(Window::mainWindow->findGroupByNumber(&ansIp, 1)); 96 break; 97 } 98 else 99 PRINT(0)("\nChoose a smaler Number please: [1-%d] ", groupCount); 100 } 101 PRINT(0)("\n\nGroup: [%s]\n\n", group->groupName); 102 int optionCount = 0; 103 group->walkThrough(Widget::listOptions, &optionCount, 0); 104 PRINT(0)("\nWhich Option? [1-%d] ", optionCount); 105 Option* option; 106 while(true) 107 { 108 cin >> ans; 109 int ansIp = atoi(ans); 110 if (ansIp <= groupCount) 111 { 112 option = static_cast<Option*>(group->findOptionByNumber(&ansIp, 0)); 113 break; 114 } 115 else 116 PRINT(0)("\nChoose a smaler Number please: [1-%d] ", optionCount); 117 } 118 PRINT(0)("\n\n:: %s ::\n", option->title); 119 option->changeOption(); 120 121 // here follows the rest.... this will be nasty. 122 //! \todo move this into the gui-gtk-file 123 //! \todo finish it. 124 } 125 #endif /* HAVE_GTK2 */ 126 127 } 128 129 130 ////////////////////////////// 131 /// DEFINING WIDGET-CLASES /// 132 ////////////////////////////// 61 133 62 134 /* WIDGET */ … … 66 138 This is still pretty crappy. 67 139 */ 68 Widget::~Widget() 69 { 70 // cout << "hiding: " <<this->label <<"\n"; 71 this->hide(); 72 // cout << "check if Packer: "<<this->label <<"\n"; 73 if (this->isOption < 0) 74 { 75 // cout << "get Down "<<this->label <<"\n"; 76 static_cast<Packer*>(this)->down->~Widget(); 77 } 78 // cout << "next != NULL?: " <<this->label <<"\n"; 79 if (this->next != NULL) 80 this->next->~Widget(); 81 cout << "delete Widget: " <<this->label <<"\n"; 82 // delete widget; 140 Widget::~Widget(void) 141 { 142 this->destroy(); 83 143 } 84 144 … … 87 147 Initializes the next Pointer and the other Widget-specific Defaults. 88 148 */ 89 void Widget::init( )149 void Widget::init(void) 90 150 { 91 151 next = NULL; 92 label= NULL;152 this->title = NULL; 93 153 return; 94 154 } 95 155 96 156 /** 157 \brief Destroys a Widget 158 */ 159 void Widget::destroy(void) 160 { 161 if (this->title) 162 { 163 delete []this->title; 164 } 165 166 PRINTF(4)("deleting the Widget part.\n"); 167 168 PRINTF(4)("deleting recursively\n"); 169 170 // deleting next item if existent 171 if (this->next) 172 delete this->next; 173 this->next = NULL; 174 175 //! \todo not hiding widget, deleting. 176 // this->hide(); 177 // delete this->widget; 178 } 179 180 /** 97 181 \brief makes the widget visible. 98 182 */ 99 void Widget::show( )100 { 101 #ifdef HAVE_GTK2 102 gtk_widget_show 183 void Widget::show(void) 184 { 185 #ifdef HAVE_GTK2 186 gtk_widget_show(this->widget); 103 187 #endif /* HAVE_GTK2 */ 104 188 } … … 107 191 \brief hides the widget. 108 192 */ 109 void Widget::hide( )110 { 111 #ifdef HAVE_GTK2 112 gtk_widget_hide 193 void Widget::hide(void) 194 { 195 #ifdef HAVE_GTK2 196 gtk_widget_hide(this->widget); 113 197 #endif /* HAVE_GTK2 */ 114 198 } … … 122 206 { 123 207 #ifdef HAVE_GTK2 124 gtk_widget_set_usize (this->widget, width, height); 125 #endif /* HAVE_GTK2 */ 126 } 127 128 #ifdef HAVE_GTK2 129 /** 130 \brief Connect any signal to any given Sub-widget 131 */ 132 gulong Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)) 133 { 134 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL); 135 } 136 137 /** 138 \brief Connect a signal with additionally passing the whole Object 139 */ 140 gulong Widget::connectSignal (char* event, gint (*signal)( GtkWidget*, Widget *)) 141 { 142 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), this); 143 } 144 145 /** 146 \brief Connect a signal with additionally passing a whole external Object 147 */ 148 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *)) 149 { 150 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj); 151 } 152 153 /** 154 \brief Connect a signal with additionally passing a whole external Object 155 */ 156 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *)) 157 { 158 return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj); 159 } 160 161 void Widget::disconnectSignal (gulong signalID) 162 { 163 g_signal_handler_disconnect (G_OBJECT (this->widget), signalID); 164 } 165 #endif /* HAVE_GTK2 */ 208 gtk_widget_set_usize(this->widget, width, height); 209 #endif /* HAVE_GTK2 */ 210 } 211 212 /** 213 \brief searches through widgets for a Name. 214 */ 215 Widget* Widget::findWidgetByName(char* name, unsigned int depth) 216 { 217 218 if (this->title && !strcmp(this->title, name)) 219 return this; 220 221 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 222 { 223 Widget* tmp = static_cast<Packer*>(this)->down->findWidgetByName(name, depth+1); 224 if (tmp) 225 return tmp; 226 } 227 228 if (depth>0 && this->next) 229 return this->next->findWidgetByName(name, depth); 230 231 return NULL; 232 } 166 233 167 234 /** 168 235 \brief Moves through all the Widgets downwards from this and executes the function on them. 169 \param Function must be of type void and takes a Widget* as an Input. 170 */ 171 void Widget::walkThrough (void (*function)(Widget*)) 236 \param function must be of type void and takes a Widget* as an Input. 237 \param depth the current depth. if > 0 then the next Widget will also be walked through. 238 */ 239 void Widget::walkThrough(void(*function)(Widget*), unsigned int depth) 172 240 { 173 241 function(this); 174 242 if (this->isOption < 0) 175 243 { 176 static_cast<Packer*>(this)->down->walkThrough (function);244 static_cast<Packer*>(this)->down->walkThrough(function, depth+1); 177 245 } 178 246 179 if (this->next != NULL) 180 this->next->walkThrough(function); 247 if (this->next && depth != 0) 248 this->next->walkThrough(function, depth); 249 } 250 251 /** 252 \brief Moves through all the Widgets downwards from this and executes the function on them. 253 \param function must be of type void and takes a Widget* as an Input. 254 \param data Additional Data you want to pass to the function. 255 \param depth the current depth. if > 0 then the next Widget will also be walked through. 256 */ 257 void Widget::walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth) 258 { 259 function(this, data); 260 if (this->isOption < 0) 261 { 262 static_cast<Packer*>(this)->down->walkThrough(function, data, depth+1); 263 } 264 if (this->next && depth != 0) 265 this->next->walkThrough(function, data, depth); 181 266 } 182 267 183 268 /** 184 \brief This is for listing the option of "widget"269 \brief This is for listing the options of "widget" 185 270 \param widget specifies the widget that should be listed 186 271 */ 187 void Widget::listOptions 272 void Widget::listOptionsAndGroups(Widget* widget) 188 273 { 189 274 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 190 275 cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n"; 191 276 if (widget->isOption >= 1 && widget->isOption <= 3) 192 cout << " " << static_cast<Option*>(widget)-> label<<" is : " << static_cast<Option*>(widget)->value <<endl;277 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 193 278 else if (widget->isOption == 5) 194 cout << " " << static_cast<Option*>(widget)->label <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 195 } 196 279 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 280 } 281 282 /** 283 \brief This is for listing the options of "widget" 284 \param widget specifies the widget that should be listed 285 */ 286 void Widget::listOptions(Widget* widget) 287 { 288 if (widget->isOption >= 1 && widget->isOption <= 3) 289 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 290 else if (widget->isOption == 5) 291 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 292 } 293 294 /** 295 \brief This is for listing the options of "widget" 296 \param widget specifies the widget that should be listed 297 \param data A Counter, that always knows how many Options have been found yet. 298 */ 299 void Widget::listOptions(Widget* widget, void* data) 300 { 301 302 if (widget->isOption >= 1 && widget->isOption <= 3) 303 { 304 int* count =(int*)data; 305 *count = *count +1; 306 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 307 } 308 else if (widget->isOption == 5) 309 { 310 int* count =(int*)data; 311 *count = *count +1; 312 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 313 } 314 } 315 316 /** 317 \brief Finds an Option by a given number(the n'th option found away from this Widget) 318 \param number The Count of options to wait(by reference) 319 \param depth The depth of the sarch. if 0 it will not search next pointer 320 321 \todo should return Option* would be much sexier. 322 */ 323 Widget* Widget::findOptionByNumber(int* number, unsigned int depth) 324 { 325 if (isOption > 0) 326 { 327 --*number; 328 if (*number <= 0) 329 { 330 return this; 331 } 332 } 333 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 334 { 335 Widget* tmp = static_cast<Packer*>(this)->down->findOptionByNumber(number, depth+1); 336 if (tmp) 337 return tmp; 338 } 339 if (depth>0 && this->next) 340 return this->next->findOptionByNumber(number, depth); 341 342 return NULL; 343 } 344 345 /** 346 \brief This is for listing the groups of "widget" 347 \param widget specifies the widget that should be listed 348 */ 349 void Widget::listGroups(Widget* widget) 350 { 351 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 352 cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n"; 353 } 354 355 /** 356 \brief This is for listing the Groups of "widget". It also displays the n'th number found. 357 \param widget specifies the widget that should be listed 358 \param data the Counter, that will show the number(this function will raise it by one if a Group is fount. 359 */ 360 void Widget::listGroups(Widget* widget, void* data) 361 { 362 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 363 { 364 int* count =(int*)data; 365 *count = *count +1; 366 cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n"; 367 } 368 } 369 370 /** 371 \brief Finds a Group by a given number(the n'th Group found away from this Widget) 372 \param number The Count of options to wait(by reference) 373 \param depth The depth of the sarch. if 0 it will not search next pointer 374 */ 375 Widget* Widget::findGroupByNumber(int* number, unsigned int depth) 376 { 377 if (isOption < 0 && static_cast<Packer*>(this)->groupName) 378 { 379 --*number; 380 if (*number <= 0) 381 { 382 return this; 383 } 384 } 385 if (this->isOption < 0 && static_cast<Packer*>(this)->down) 386 { 387 Widget* tmp = static_cast<Packer*>(this)->down->findGroupByNumber(number, depth+1); 388 if (tmp) 389 return tmp; 390 } 391 if (depth>0 && this->next) 392 return this->next->findGroupByNumber(number, depth); 393 394 return NULL; 395 } 396 197 397 /** 198 398 \brief This is for setting the option of "widget" 199 399 \param widget specifies the widget that should be set. 200 400 */ 201 void Widget::setOptions 401 void Widget::setOptions(Widget* widget) 202 402 { 203 403 if (widget->isOption >= 1) 204 static_cast<Option*>(widget)->redraw();// <<" is : " << static_cast<Option*>(this)->value <<endl; 205 } 206 207 #ifdef HAVE_GTK2 404 static_cast<Option*>(widget)->redraw(); 405 } 406 407 /** 408 \brief Walks through all the Flags given at startuptime. 409 */ 410 void Widget::flagCheck(Widget* widget, void* flagName) 411 { 412 if (widget->isOption>=1) 413 { 414 Option* option =(Option*)widget; 415 char* name =(char*)flagName; 416 char* value = NULL; 417 bool found = false; 418 // check if long flag matches 419 if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) &&(name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') )) 420 { 421 found = true; 422 if (name[strlen(option->flagName)+2] == '=') 423 { 424 value = name+strlen(option->flagName)+3; 425 } 426 } 427 else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&&(name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches 428 { 429 found = true; 430 if (name[strlen(option->flagNameShort)+1] == '=') 431 { 432 value = name+strlen(option->flagNameShort)+2; 433 } 434 } 435 436 if (found) 437 { 438 PRINT(3)("found matching Flag %s\n", name); 439 if (value) 440 { 441 PRINT(3)("with Value %s\n", value); 442 option->value = atoi(value); 443 } 444 else 445 { 446 option->value = !option->defaultValue; 447 } 448 option->redraw(); 449 } 450 451 } 452 } 453 454 #ifdef HAVE_GTK2 455 /** 456 \brief Connect any signal to any given Sub-widget 457 */ 458 gulong Widget::connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void *)) 459 { 460 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), NULL); 461 } 462 463 /** 464 \brief Connect a signal with additionally passing the whole Object 465 */ 466 gulong Widget::connectSignal(char* event, gint(*signal)( GtkWidget*, Widget *)) 467 { 468 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), this); 469 } 470 471 /** 472 \brief Connect a signal with additionally passing a whole external Object 473 */ 474 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void *)) 475 { 476 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 477 } 478 479 /** 480 \brief Connect a signal with additionally passing a whole external Object 481 */ 482 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void *)) 483 { 484 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 485 } 486 487 /** 488 \brief Connect a signal with additionally passing a whole external Object 489 */ 490 gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void *)) 491 { 492 return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj); 493 } 494 495 void Widget::disconnectSignal(gulong signalID) 496 { 497 g_signal_handler_disconnect(G_OBJECT(this->widget), signalID); 498 } 208 499 209 500 /** … … 213 504 \param nothing nothin. 214 505 */ 215 gint Widget::doNothingSignal 506 gint Widget::doNothingSignal(GtkWidget *widget, GdkEvent* event, void* nothing) 216 507 { 217 508 } … … 228 519 Sets the down-pinter to NULL and other PackerSpecific-values to their defaults. 229 520 */ 230 void Packer::init 231 { 232 down = NULL;233 groupName = NULL;521 void Packer::init(void) 522 { 523 this->down = NULL; 524 this->groupName = NULL; 234 525 235 526 … … 239 530 240 531 /** 532 \brief Destroys a Packer. 533 */ 534 void Packer::destroy(void) 535 { 536 PRINTF(4)("deleting the Packer part.\n"); 537 538 if (this->groupName) 539 delete []this->groupName; 540 541 //deleting recursively. 542 if (this->down) 543 delete this->down; 544 this->down = NULL; 545 546 static_cast<Widget*>(this)->destroy(); 547 } 548 549 /** 241 550 \brief Sets the group name under which all the lower widgets of this will be saved. 242 551 \param name The name of the group. 243 552 */ 244 void Packer::setGroupName 245 { 246 if ( groupName)247 delete groupName;248 groupName = new char[strlen(name)+1];249 strcpy( groupName, name);553 void Packer::setGroupName(char* name) 554 { 555 if (this->groupName) 556 delete []this->groupName; 557 this->groupName = new char[strlen(name)+1]; 558 strcpy(this->groupName, name); 250 559 } 251 560 … … 254 563 \returns name The name of the group. 255 564 */ 256 char* Packer::getGroupName 257 { 258 return groupName;565 char* Packer::getGroupName(void) 566 { 567 return this->groupName; 259 568 } 260 569 … … 266 575 sets the Container-Specific defaults. 267 576 */ 268 void Container::init 269 { 270 isOption = -1;577 void Container::init(void) 578 { 579 this->isOption = -1; 271 580 272 581 static_cast<Packer*>(this)->init(); 273 582 274 583 return; 584 } 585 586 /** 587 \brief Destroys a Container. 588 */ 589 void Container::destroy(void) 590 { 591 PRINTF(4)("deleting the Container part.\n"); 592 593 static_cast<Packer*>(this)->destroy(); 275 594 } 276 595 … … 281 600 It does this by filling up the down pointer only if down points to NULL. 282 601 */ 283 void Container::fill 602 void Container::fill(Widget *lowerWidget) 284 603 { 285 604 if (this->down == NULL) 286 605 { 287 606 #ifdef HAVE_GTK2 288 gtk_container_add (GTK_CONTAINER(this->widget), lowerWidget->widget);607 gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget); 289 608 #endif /* HAVE_GTK2 */ 290 609 this->down = lowerWidget; 291 610 } 292 611 else 293 cout << "!!error!! You try to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n"<<endl;294 } 295 296 // gtk_container_set_border_width (GTK_CONTAINER(widget), 5);612 PRINTF(1)("!!error!! You try to put more than one Widget into a Container. \nNot including this item.\nThis is only possible with Boxes.\n"); 613 } 614 615 // gtk_container_set_border_width(GTK_CONTAINER(widget), 5); 297 616 298 617 /* WINDOW */ … … 303 622 \brief Adds a new Window Windows to the List of Windows. 304 623 \param windowToAdd The Windows that should be added to the List 305 \todo this instead of windowToAdd 624 \todo this instead of windowToAdd(possibly) 306 625 */ 307 626 void Window::addWindow(Window* windowToAdd) … … 314 633 315 634 Widget* tmpWindow = mainWindow; 316 while 635 while(tmpWindow->next) 317 636 tmpWindow = tmpWindow->next; 318 637 tmpWindow->next = windowToAdd; … … 322 641 323 642 324 325 643 /** 326 644 \brief Creating a new Window without a Name 327 645 */ 328 Window::Window 646 Window::Window(void) 329 647 { 330 648 this->init(); … … 335 653 \param windowName the name the window should get. 336 654 */ 337 Window::Window (char* windowName) 655 656 Window::Window(char* windowName) 338 657 { 339 658 this->init(); 340 this->setTitle (windowName); 659 this->setTitle(windowName); 660 } 661 662 /** 663 \brief Destructs a Window. 664 */ 665 Window::~Window(void) 666 { 667 this->destroy(); 341 668 } 342 669 … … 344 671 \brief initializes a new Window 345 672 */ 346 void Window::init( )673 void Window::init(void) 347 674 { 348 675 if (!mainWindow) … … 354 681 355 682 #ifdef HAVE_GTK2 356 widget = gtk_window_new 357 gtk_window_set_policy 683 widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); 684 gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE); 358 685 #if !defined(__WIN32__) 359 // gtk_window_set_decorated (GTK_WINDOW(widget), FALSE);686 // gtk_window_set_decorated(GTK_WINDOW(widget), FALSE); 360 687 #endif 361 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 362 #endif /* HAVE_GTK2 */ 688 gtk_container_set_border_width(GTK_CONTAINER(widget), 3); 689 #endif /* HAVE_GTK2 */ 690 } 691 692 /** 693 \brief Destroys a Window. 694 */ 695 void Window::destroy(void) 696 { 697 if (this->title) 698 PRINTF(3)("deleting the Window: %s\n", this->title); 699 else 700 PRINTF(3)("deleting the Window.\n"); 701 // this->hide(); 702 static_cast<Container*>(this)->destroy(); 703 363 704 } 364 705 … … 366 707 \brief Shows all Widgets that are included within this->widget. 367 708 */ 368 void Window::showall ()369 { 370 if (! isOpen)371 { 372 // printf 373 #ifdef HAVE_GTK2 374 gtk_widget_show_all (widget);709 void Window::showall(void) 710 { 711 if (!this->isOpen) 712 { 713 // printf("showall\n"); 714 #ifdef HAVE_GTK2 715 gtk_widget_show_all(this->widget); 375 716 #endif /* HAVE_GTK2 */ 376 isOpen = true;717 this->isOpen = true; 377 718 } 378 719 else 379 720 { 380 // printf 381 #ifdef HAVE_GTK2 382 gtk_widget_show (widget);721 // printf("showone\n"); 722 #ifdef HAVE_GTK2 723 gtk_widget_show(this->widget); 383 724 #endif /* HAVE_GTK2 */ 384 725 } … … 389 730 \param title title the Window should get. 390 731 */ 391 void Window::setTitle 392 { 393 if ( label)394 delete [] label;395 label= new char[strlen(title)+1];396 strcpy( label, title);397 #ifdef HAVE_GTK2 398 gtk_window_set_title (GTK_WINDOW(widget), title);732 void Window::setTitle(char* title) 733 { 734 if (this->title) 735 delete []this->title; 736 this->title = new char[strlen(title)+1]; 737 strcpy(this->title, title); 738 #ifdef HAVE_GTK2 739 gtk_window_set_title(GTK_WINDOW(widget), title); 399 740 #endif /* HAVE_GTK2 */ 400 741 } … … 403 744 \brief opens up a Window and fixes the Focus to it 404 745 */ 405 void Window::open( )746 void Window::open(void) 406 747 { 407 748 if (this != mainWindow) … … 409 750 isOpen = true; 410 751 #ifdef HAVE_GTK2 411 gtk_widget_show_all( widget);412 gtk_grab_add( widget);752 gtk_widget_show_all(this->widget); 753 gtk_grab_add(this->widget); 413 754 #endif /* HAVE_GTK2 */ 414 755 } … … 418 759 \brief closes up a Window and removes the Focus from it 419 760 */ 420 void Window::close( )761 void Window::close(void) 421 762 { 422 763 if (this != mainWindow) 423 764 { 424 isOpen = false;425 #ifdef HAVE_GTK2 426 gtk_grab_remove( widget);427 gtk_widget_hide (widget);428 #endif /* HAVE_GTK2 */ 429 } 430 } 431 432 #ifdef HAVE_GTK2 433 /** 434 \brief opens up a window 765 this->isOpen = false; 766 #ifdef HAVE_GTK2 767 gtk_grab_remove(this->widget); 768 gtk_widget_hide(this->widget); 769 #endif /* HAVE_GTK2 */ 770 } 771 } 772 773 #ifdef HAVE_GTK2 774 /** 775 \brief opens up a window(not topmost Window). 435 776 this is the Signal that does it. !!SIGNALS ARE STATIC!! 436 777 \param widget the widget that did it. … … 438 779 \param window the Window that should be opened 439 780 */ 440 gint Window::windowOpen 781 gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window) 441 782 { 442 783 static_cast<Window*>(window)->open(); … … 444 785 445 786 /** 446 \brief closes a window 787 \brief closes a window(not topmost Window). 447 788 this is the Signal that does it. !!SIGNALS ARE STATIC!! 448 789 \param widget the widget that did it! … … 450 791 \param window the Window that should be closed 451 792 */ 452 gint Window::windowClose 793 gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window) 453 794 { 454 795 static_cast<Window*>(window)->close(); 455 796 } 456 797 457 /**458 * Quits the orxonox_GUI.459 * This can be called as a Signal and is therefor static460 \param widget The widget that called this function461 \param event the event that happened to execute this function462 \param data some data passed with the Signal463 */464 gint Window::orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data)465 {466 if (exec->shouldsave())467 exec->writeToFile (Window::mainWindow);468 469 gtk_main_quit();470 return FALSE;471 }472 798 #endif /* HAVE_GTK2 */ 473 799 … … 478 804 \brief Creates a new Frame without a name 479 805 */ 480 Frame::Frame 806 Frame::Frame(void) 481 807 { 482 808 this->init(); … … 486 812 \brief Creates a new Frame with name title 487 813 */ 488 Frame::Frame 814 Frame::Frame(char* title) 489 815 { 490 816 this->init(); … … 492 818 } 493 819 820 /** 821 \brief destrcucts a Frame 822 */ 823 Frame::~Frame(void) 824 { 825 this->destroy(); 826 } 827 494 828 /** 495 829 \brief Initializes a new Frame with default settings 496 830 */ 497 void Frame::init( )831 void Frame::init(void) 498 832 { 499 833 static_cast<Container*>(this)->init(); 500 834 501 835 #ifdef HAVE_GTK2 502 widget = gtk_frame_new (""); 503 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 504 #endif /* HAVE_GTK2 */ 836 this->widget = gtk_frame_new(""); 837 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 838 #endif /* HAVE_GTK2 */ 839 } 840 841 /** 842 \brief Destroys a Frame. 843 */ 844 void Frame::destroy(void) 845 { 846 if (this->title) 847 PRINTF(3)("deleting the Frame: %s\n", this->title); 848 else 849 PRINTF(3)("deleting the Frame.\n"); 850 851 static_cast<Container*>(this)->destroy(); 505 852 } 506 853 … … 509 856 \param title The title the Frame should get. 510 857 */ 511 void Frame::setTitle 512 { 513 if ( label)514 delete [] label;515 label= new char[strlen(title)+1];516 strcpy( label, title);517 #ifdef HAVE_GTK2 518 gtk_frame_set_label (GTK_FRAME(widget), title);858 void Frame::setTitle(char* title) 859 { 860 if (this->title) 861 delete []this->title; 862 this->title = new char[strlen(title)+1]; 863 strcpy(this->title, title); 864 #ifdef HAVE_GTK2 865 gtk_frame_set_label(GTK_FRAME(widget), title); 519 866 #endif /* HAVE_GTK2 */ 520 867 } … … 525 872 \brief Creates a new EventBox with default settings. 526 873 */ 527 EventBox::EventBox ()874 EventBox::EventBox(void) 528 875 { 529 876 this->init(); 530 877 } 878 531 879 /** 532 880 \brief Creates a new EventBox with name title 533 \param title title the Eventbox should get 534 */ 535 EventBox::EventBox 881 \param title title the Eventbox should get(only data-structure-internal) 882 */ 883 EventBox::EventBox(char* title) 536 884 { 537 885 this->init(); … … 540 888 541 889 /** 890 \brief destructs an EventBox. 891 */ 892 EventBox::~EventBox(void) 893 { 894 this->destroy(); 895 896 } 897 898 /** 542 899 \brief Initializes a new EventBox 543 900 */ 544 901 void EventBox::init(void) 545 902 { 546 isOption = -1;903 this->isOption = -1; 547 904 548 905 static_cast<Container*>(this)->init(); 549 906 550 907 #ifdef HAVE_GTK2 551 widget = gtk_event_box_new (); 552 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 553 #endif /* HAVE_GTK2 */ 554 } 555 556 /** 557 \brief Sets the Title of the EventBox (not implemented) 558 \param title Name the EventBox should get (only datastructure-internal). 559 */ 560 void EventBox::setTitle (char* title) 561 { 562 if (label) 563 delete []label; 564 label = new char[strlen(title)+1]; 565 strcpy(label, title); 908 this->widget = gtk_event_box_new(); 909 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 910 #endif /* HAVE_GTK2 */ 911 } 912 913 /** 914 \brief Destroys an EventBox. 915 */ 916 void EventBox::destroy(void) 917 { 918 if (this->title) 919 PRINTF(3)("deleting the EventBox: %s\n", this->title); 920 else 921 PRINTF(3)("deleting the EventBox.\n"); 922 923 static_cast<Container*>(this)->destroy(); 924 } 925 926 /** 927 \brief Sets the Title of the EventBox(not implemented) 928 \param title Name the EventBox should get(only datastructure-internal). 929 */ 930 void EventBox::setTitle(char* title) 931 { 932 if (this->title) 933 delete []this->title; 934 this->title = new char[strlen(title)+1]; 935 strcpy(this->title, title); 566 936 } 567 937 … … 571 941 \brief Creates a new horizontal Box 572 942 */ 573 Box::Box 943 Box::Box(void) 574 944 { 575 945 this->init('h'); … … 580 950 \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally 581 951 */ 582 Box::Box 952 Box::Box(char boxtype) 583 953 { 584 954 this->init(boxtype); 955 } 956 957 /** 958 \brief destructs a Box. 959 */ 960 Box::~Box(void) 961 { 962 this->destroy(); 585 963 } 586 964 … … 591 969 void Box::init(char boxtype) 592 970 { 593 isOption = -2;971 this->isOption = -2; 594 972 595 973 static_cast<Packer*>(this)->init(); … … 597 975 if (boxtype == 'v') 598 976 { 599 widget = gtk_vbox_new(FALSE, 0);977 this->widget = gtk_vbox_new(FALSE, 0); 600 978 } 601 979 else 602 980 { 603 widget = gtk_hbox_new (FALSE, 0); 604 } 605 #endif /* HAVE_GTK2 */ 606 981 this->widget = gtk_hbox_new(FALSE, 0); 982 } 983 #endif /* HAVE_GTK2 */ 984 } 985 986 /** 987 \brief Destroys a Box. 988 */ 989 void Box::destroy(void) 990 { 991 if (this->title) 992 PRINTF(3)("deleting the Box: %s\n", this->title); 993 else 994 PRINTF(3)("deleting the Box.\n"); 995 996 static_cast<Packer*>(this)->destroy(); 607 997 } 608 998 … … 613 1003 It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next 614 1004 */ 615 void Box::fill (Widget *lowerWidget)616 { 617 #ifdef HAVE_GTK2 618 gtk_box_pack_start (GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0);1005 void Box::fill(Widget* lowerWidget) 1006 { 1007 #ifdef HAVE_GTK2 1008 gtk_box_pack_start(GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0); 619 1009 #endif /* HAVE_GTK2 */ 620 1010 if (this->down == NULL) … … 624 1014 Widget* tmp; 625 1015 tmp = this->down; 626 while 1016 while(tmp->next != NULL) 627 1017 { 628 1018 tmp = tmp->next; … … 632 1022 } 633 1023 634 /* IMAGE */ 635 636 /** 637 \brief Creates a new Image 638 \param imagename the location of the Image on the Hard Disc 639 */ 640 Image::Image (char* imagename) 641 { 642 this->init(); 643 if (label) 644 delete []label; 645 label = new char[strlen(imagename)+1]; 646 strcpy(label, imagename); 647 648 #ifdef HAVE_GTK2 649 widget = gtk_image_new_from_file (imagename); 650 #endif /* HAVE_GTK2 */ 651 } 652 653 /** 654 \brief Initializes a new Image 655 */ 656 void Image::init() 657 { 658 isOption = 0; 659 660 static_cast<Widget*>(this)->init(); 661 } 662 1024 /** 1025 \brief Sets the Title of a Box. 1026 \param title the new Title to set. 1027 */ 1028 void Box::setTitle(char* title) 1029 { 1030 if (this->title) 1031 delete []this->title; 1032 this->title = new char[strlen(title)+1]; 1033 strcpy(this->title, title); 1034 } 663 1035 664 1036 /* OPTION */ … … 668 1040 sets all Option-Specific-Values to their defaults. 669 1041 */ 670 void Option::init( )671 { 672 value = 0;673 flagName = NULL;674 flagNameShort = NULL;675 saveable = false;676 defaultValue = 0;1042 void Option::init(void) 1043 { 1044 this->value = 0; 1045 this->flagName = NULL; 1046 this->flagNameShort = NULL; 1047 this->saveable = false; 1048 this->defaultValue = 0; 677 1049 678 1050 static_cast<Widget*>(this)->init(); 679 1051 680 1052 return; 1053 } 1054 1055 /** 1056 \brief Destroys an Option. 1057 */ 1058 void Option::destroy(void) 1059 { 1060 PRINTF(4)("deleting the Option Part.\n"); 1061 if (this->flagName) 1062 delete []this->flagName; 1063 if (this->flagNameShort) 1064 delete []this->flagNameShort; 1065 1066 static_cast<Widget*>(this)->destroy(); 681 1067 } 682 1068 … … 685 1071 !! Options will be saved if flagname is different from NULL !! 686 1072 \param flagname the Name that will be displayed in the output 687 \param defaultvalue the default Value for this Option 688 */ 689 void Option::setFlagName 690 { 691 if ( flagName)692 delete flagName;693 flagName = new char [strlen(flagname)+1];694 strcpy( flagName, flagname);695 defaultValue = defaultvalue;696 697 // cout << "Set Flagname of " << label<< " to " << flagname << endl;1073 \param defaultvalue the default Value for this Option(see definition of defaultvalue 1074 */ 1075 void Option::setFlagName(char* flagname, int defaultvalue) 1076 { 1077 if (this->flagName) 1078 delete this->flagName; 1079 this->flagName = new char [strlen(flagname)+1]; 1080 strcpy(this->flagName, flagname); 1081 this->defaultValue = defaultvalue; 1082 1083 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; 698 1084 } 699 1085 700 1086 /** 701 \brief see Option::setFlagName 1087 \brief see Option::setFlagName(char* flagname, int defaultvalue) 702 1088 \param flagname the Name that will be displayed in the output 703 \param defaultvalue the default Value for this Option 1089 \param defaultvalue the default Value for this Option(see definition of defaultvalue 704 1090 \param flagnameshort a short flagname to be displayed in the output 705 1091 */ 706 void Option::setFlagName (char* flagname, char* flagnameshort, int defaultvalue) 707 { 708 if (flagName) 709 delete flagName; 710 flagName = new char [strlen(flagname)+1]; 711 strcpy(flagName, flagname); 712 713 if (flagNameShort) 714 delete flagNameShort; 715 flagNameShort = new char [strlen(flagnameshort)+1]; 716 strcpy(flagNameShort, flagnameshort); 717 defaultValue = defaultvalue; 718 // cout << "Set Flagname of " << label << " to " << flagname << endl; 719 } 1092 void Option::setFlagName(char* flagname, char* flagnameshort, int defaultvalue) 1093 { 1094 if (this->flagName) 1095 delete []this->flagName; 1096 this->flagName = new char [strlen(flagname)+1]; 1097 strcpy(this->flagName, flagname); 1098 1099 if (this->flagNameShort) 1100 delete []this->flagNameShort; 1101 this->flagNameShort = new char [strlen(flagnameshort)+1]; 1102 strcpy(this->flagNameShort, flagnameshort); 1103 this->defaultValue = defaultvalue; 1104 // cout << "Set Flagname of " << this->title << " to " << flagname << endl; 1105 } 1106 1107 /** 1108 \brief Sets the saveable-state of the option to true. 1109 */ 1110 void Option::saveability(void) 1111 { 1112 this->saveable = true; 1113 } 1114 1115 /** 1116 \brief Sets the saveable-state of the option. 1117 \param isSaveable the saveable-state to set. 1118 */ 1119 void Option::saveability(bool isSaveable) 1120 { 1121 this->saveable = isSaveable; 1122 } 1123 1124 /** 1125 \returns The saveable-state. 1126 */ 1127 bool Option::isSaveable(void) 1128 { 1129 return this->saveable; 1130 } 1131 1132 #ifdef HAVE_GTK2 1133 /** 1134 \brief Signal OptionChange writes the Value from the Slider to its Object-Database. 1135 \param widget The widget(Slider) that has a changed Value 1136 \param slider the Slider-Object that should receive the change. 1137 */ 1138 gint Option::OptionChange(GtkWidget *widget, Widget* option) 1139 { 1140 static_cast<Option*>(option)->changeOption(); 1141 flags->setTextFromFlags(Window::mainWindow); //// must be different !!! 1142 } 1143 #endif /* HAVE_GTK2 */ 720 1144 721 1145 … … 733 1157 734 1158 /** 1159 \brief destructs a Button. 1160 */ 1161 Button::~Button(void) 1162 { 1163 this->destroy(); 1164 } 1165 1166 /** 735 1167 \brief Initializes a new Button 736 1168 */ … … 742 1174 743 1175 #ifdef HAVE_GTK2 744 widget = gtk_button_new_with_label (""); 745 #endif /* HAVE_GTK2 */ 1176 widget = gtk_button_new_with_label(""); 1177 #endif /* HAVE_GTK2 */ 1178 } 1179 1180 /** 1181 \brief Destroys a Button. 1182 */ 1183 void Button::destroy(void) 1184 { 1185 if (this->title) 1186 PRINTF(3)("deleting the Label: %s\n", this->title); 1187 else 1188 PRINTF(3)("deleting the Label.\n"); 1189 1190 static_cast<Option*>(this)->destroy(); 746 1191 } 747 1192 … … 750 1195 \param title The name the Button should get 751 1196 */ 752 void Button::setTitle 753 { 754 if ( label)755 delete [] label;756 label= new char[strlen(title)+1];757 strcpy( label, title);758 #ifdef HAVE_GTK2 759 gtk_button_set_label 1197 void Button::setTitle(char *title) 1198 { 1199 if (this->title) 1200 delete []this->title; 1201 this->title = new char[strlen(title)+1]; 1202 strcpy(this->title, title); 1203 #ifdef HAVE_GTK2 1204 gtk_button_set_label(GTK_BUTTON(widget), title); 760 1205 #endif /* HAVE_GTK2 */ 761 1206 } … … 765 1210 not implemented yet 766 1211 */ 767 void Button::redraw () 768 { 1212 void Button::redraw(void) 1213 { 1214 } 1215 1216 /** 1217 \brief Button can not be changed, optionChange is empty) 1218 1219 \todo Actions for non-GTK-mode 1220 */ 1221 void Button::changeOption(void) 1222 { 1223 // This will possibly be used for ACTIONS ! 769 1224 } 770 1225 … … 775 1230 \param buttonname The name the CheckButton should display. 776 1231 */ 777 CheckButton::CheckButton 1232 CheckButton::CheckButton(char* buttonname) 778 1233 { 779 1234 this->init(); … … 781 1236 782 1237 #ifdef HAVE_GTK2 783 this->connectSignal ("clicked", this->OptionChange); 784 #endif /* HAVE_GTK2 */ 1238 this->connectSignal("clicked", this->OptionChange); 1239 #endif /* HAVE_GTK2 */ 1240 } 1241 1242 /** 1243 \brief destructs a CheckButton. 1244 */ 1245 CheckButton::~CheckButton(void) 1246 { 1247 this->destroy(); 785 1248 } 786 1249 … … 790 1253 void CheckButton::init(void) 791 1254 { 792 isOption = 1;1255 this->isOption = 1; 793 1256 794 1257 static_cast<Option*>(this)->init(); 795 1258 796 1259 #ifdef HAVE_GTK2 797 widget = gtk_check_button_new_with_label (""); 798 #endif /* HAVE_GTK2 */ 1260 this->widget = gtk_check_button_new_with_label(""); 1261 #endif /* HAVE_GTK2 */ 1262 } 1263 1264 /** 1265 \brief Destroys a CheckButton. 1266 */ 1267 void CheckButton::destroy(void) 1268 { 1269 if (this->title) 1270 PRINTF(3)("deleting the CheckButton: %s\n", this->title); 1271 else 1272 PRINTF(3)("deleting the CheckButton.\n"); 1273 1274 static_cast<Option*>(this)->destroy(); 799 1275 } 800 1276 … … 805 1281 void CheckButton::setTitle(char* title) 806 1282 { 807 if ( label)808 delete [] label;809 label= new char[strlen(title)+1];810 strcpy( label, title);1283 if (this->title) 1284 delete []this->title; 1285 this->title = new char[strlen(title)+1]; 1286 strcpy(this->title, title); 811 1287 #ifdef HAVE_GTK2 812 1288 gtk_button_set_label(GTK_BUTTON(widget), title); … … 814 1290 } 815 1291 816 bool CheckButton::isActive( )1292 bool CheckButton::isActive(void) 817 1293 { 818 1294 #ifdef HAVE_GTK2 … … 821 1297 } 822 1298 823 #ifdef HAVE_GTK2 824 /** 825 \brief Signal OptionChange writes the Value from the CheckButton to its Object-Database. 826 \param widget The widget(CheckButton) that has a changed Value 827 \param checkbutton the CheckButton-Object that should receive the change. 828 */ 829 gint CheckButton::OptionChange (GtkWidget *widget, Widget* checkbutton) 830 { 831 static_cast<CheckButton*>(checkbutton)->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((CheckButton*)checkbutton->widget)); 832 flags->setTextFromFlags(orxonoxGUI); ////// must be different!!! 833 cout << static_cast<CheckButton*>(checkbutton)->label << " set to: " << static_cast<CheckButton*>(checkbutton)->value << endl; 834 } 835 #endif /* HAVE_GTK2 */ 836 837 /** 838 \brief Redraws the CheckButton (if option has changed). 1299 /** 1300 \brief Changed the Option, call this Function 1301 */ 1302 void CheckButton::changeOption(void) 1303 { 1304 #ifdef HAVE_GTK2 1305 this->value =(int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this->widget)); 1306 #else /* HAVE_GTK2 */ 1307 char tmpChar[20]; 1308 cout << "\nPlease give me a new value for " << this->title << " [0,1](defualt:" << this->defaultValue << "): "; 1309 cin >> tmpChar; 1310 1311 if ((this->value = atoi(tmpChar))=!0) 1312 this->value = 1; 1313 #endif /* HAVE_GTK2 */ 1314 cout << this->title << " set to: " << this->value << endl; 1315 } 1316 1317 1318 /** 1319 \brief Redraws the CheckButton(if option has changed). 839 1320 Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change 840 1321 */ 841 void CheckButton::redraw ()842 { 843 #ifdef HAVE_GTK2 844 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);1322 void CheckButton::redraw(void) 1323 { 1324 #ifdef HAVE_GTK2 1325 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(this->widget), value); 845 1326 #endif /* HAVE_GTK2 */ 846 1327 } … … 854 1335 \param end The maximal Value of the slider. 855 1336 */ 856 Slider::Slider 1337 Slider::Slider(char* slidername, int start, int end) 857 1338 { 858 1339 this->init(start, end); … … 860 1341 this->setTitle(slidername); 861 1342 #ifdef HAVE_GTK2 862 this->connectSignal ("value_changed", this->OptionChange); 863 #endif /* HAVE_GTK2 */ 1343 this->connectSignal("value_changed", this->OptionChange); 1344 #endif /* HAVE_GTK2 */ 1345 } 1346 1347 /** 1348 \brief destructs a Slider. 1349 */ 1350 Slider::~Slider(void) 1351 { 1352 this->destroy(); 864 1353 } 865 1354 866 1355 /** 867 1356 \brief Initializes a Slider with start and end Values 868 params: see Slider::Slider 1357 params: see Slider::Slider(char* slidername, int start, int end) 869 1358 */ 870 1359 void Slider::init(int start, int end) 871 1360 { 872 isOption = 2;1361 this->isOption = 2; 873 1362 874 1363 static_cast<Option*>(this)->init(); 875 1364 876 #ifdef HAVE_GTK2 877 widget = gtk_hscale_new_with_range (start, end, 5); 878 #endif /* HAVE_GTK2 */ 1365 this->start = start; 1366 this->end = end; 1367 #ifdef HAVE_GTK2 1368 widget = gtk_hscale_new_with_range(this->start, this->end, 5); 1369 #endif /* HAVE_GTK2 */ 1370 } 1371 1372 /** 1373 \brief Destroys a Slider. 1374 */ 1375 void Slider::destroy(void) 1376 { 1377 if (this->title) 1378 PRINTF(3)("deleting the Slider: %s\n", this->title); 1379 else 1380 PRINTF(3)("deleting the Slider.\n"); 1381 1382 static_cast<Option*>(this)->destroy(); 1383 879 1384 } 880 1385 … … 885 1390 void Slider::setTitle(char* title) 886 1391 { 887 if ( label)888 delete [] label;889 label= new char[strlen(title)+1];890 strcpy( label, title);1392 if (this->title) 1393 delete []this->title; 1394 this->title = new char[strlen(title)+1]; 1395 strcpy(this->title, title); 891 1396 } 892 1397 … … 900 1405 } 901 1406 902 #ifdef HAVE_GTK2903 /**904 \brief Signal OptionChange writes the Value from the Slider to its Object-Database.905 \param widget The widget(Slider) that has a changed Value906 \param slider the Slider-Object that should receive the change.907 */908 gint Slider::OptionChange (GtkWidget *widget, Widget* slider)909 {910 static_cast<Slider*>(slider)->value = (int)gtk_range_get_value (GTK_RANGE ((Slider*)slider->widget));911 flags->setTextFromFlags(orxonoxGUI); //// must be different !!!912 cout << static_cast<Slider*>(slider)->label << " set to: "<< static_cast<Slider*>(slider)->value << endl;913 }914 #endif /* HAVE_GTK2 */915 916 1407 /** 917 1408 \brief Redraws the widget 918 Example: see void CheckButton::redraw () 919 */ 920 void Slider::redraw () 921 { 922 #ifdef HAVE_GTK2 923 gtk_range_set_value (GTK_RANGE (widget), value); 924 #endif /* HAVE_GTK2 */ 1409 Example: see void CheckButton::redraw(void) 1410 */ 1411 void Slider::redraw(void) 1412 { 1413 #ifdef HAVE_GTK2 1414 gtk_range_set_value(GTK_RANGE(this->widget), value); 1415 #endif /* HAVE_GTK2 */ 1416 } 1417 1418 /** 1419 \brief Changed the Option, call this Function 1420 */ 1421 void Slider::changeOption(void) 1422 { 1423 #ifdef HAVE_GTK2 1424 this->value =(int)gtk_range_get_value(GTK_RANGE(this->widget)); 1425 #else /* HAVE_GTK2 */ 1426 char tmpChar[20]; 1427 cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](defualt:" << this->defaultValue << "): "; 1428 cin >> tmpChar; 1429 1430 if ((this->value = atoi(tmpChar))> this->end) 1431 this->value = this->end; 1432 if (this->value <= this->start) 1433 this->value = this->start; 1434 #endif /* HAVE_GTK2 */ 1435 cout << this->title << " set to: " << this->value << endl; 925 1436 } 926 1437 … … 933 1444 \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!! 934 1445 */ 935 Menu::Menu 1446 Menu::Menu(char* menuname, ...) 936 1447 { 937 1448 this->init(); … … 941 1452 942 1453 #ifdef HAVE_GTK2 /////////////////////// REINPLEMENT 943 va_start 944 while (strcmp (itemName = va_arg(itemlist, char*), "lastItem"))1454 va_start(itemlist, menuname); 1455 while(strcmp(itemName = va_arg(itemlist, char*), "lastItem")) 945 1456 { 946 1457 this->addItem(itemName); … … 950 1461 951 1462 #ifdef HAVE_GTK2 952 gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); 953 this->connectSignal ("changed", this->OptionChange); 954 #endif /* HAVE_GTK2 */ 1463 gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu); 1464 this->connectSignal("changed", this->OptionChange); 1465 #endif /* HAVE_GTK2 */ 1466 } 1467 1468 /** 1469 \brief destructs a Menu. 1470 */ 1471 Menu::~Menu(void) 1472 { 1473 this->destroy(); 955 1474 } 956 1475 … … 960 1479 void Menu::init(void) 961 1480 { 962 isOption = 2;1481 this->isOption = 2; 963 1482 964 1483 static_cast<Option*>(this)->init(); 965 1484 966 1485 #ifdef HAVE_GTK2 967 widget = gtk_option_menu_new (); 968 menu = gtk_menu_new (); 969 #endif /* HAVE_GTK2 */ 970 971 } 1486 this->widget = gtk_option_menu_new(); 1487 this->menu = gtk_menu_new(); 1488 #endif /* HAVE_GTK2 */ 1489 1490 } 1491 1492 /** 1493 \brief Destroys a Menu. 1494 */ 1495 void Menu::destroy(void) 1496 { 1497 if (this->title) 1498 PRINTF(3)("deleting the Menu: %s\n", this->title); 1499 else 1500 PRINTF(3)("deleting the Menu.\n"); 1501 //! \todo destroy menu 1502 1503 static_cast<Option*>(this)->destroy(); 1504 } 1505 972 1506 973 1507 /** … … 977 1511 void Menu::setTitle(char* title) 978 1512 { 979 if ( label)980 delete [] label;981 label= new char[strlen(title)+1];982 strcpy( label, title);1513 if (this->title) 1514 delete []this->title; 1515 this->title = new char[strlen(title)+1]; 1516 strcpy(this->title, title); 983 1517 } 984 1518 … … 986 1520 \brief appends a new Item to the Menu-List. 987 1521 \param itemName the itemName to be appendet. 988 */ 989 void Menu::addItem (char* itemName) 990 { 991 #ifdef HAVE_GTK2 992 item = gtk_menu_item_new_with_label (itemName); 993 gtk_menu_shell_append(GTK_MENU_SHELL (menu), item); 994 #endif /* HAVE_GTK2 */ 995 } 996 997 #ifdef HAVE_GTK2 998 /** 999 \brief Signal OptionChange writes the Value from the Menu to its Object-Database. 1000 \param widget The widget(Menu) that has a changed Value 1001 \param menu the Menu-Object that should receive the change. 1002 */ 1003 gint Menu::OptionChange (GtkWidget *widget, Widget* menu) 1004 { 1005 static_cast<Menu*>(menu)->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (menu->widget)); 1006 flags->setTextFromFlags(orxonoxGUI); //// must be different !!! 1007 cout << static_cast<Menu*>(menu)->label << " changed to : " << static_cast<Menu*>(menu)->value << endl; 1008 } 1009 #endif /* HAVE_GTK2 */ 1522 1523 \todo make the item-list readable without GTK 1524 */ 1525 void Menu::addItem(char* itemName) 1526 { 1527 #ifdef HAVE_GTK2 1528 this->item = gtk_menu_item_new_with_label(itemName); 1529 gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item); 1530 #endif /* HAVE_GTK2 */ 1531 } 1010 1532 1011 1533 /** 1012 1534 \brief Redraws the widget 1013 Example: see void CheckButton::redraw () 1014 */ 1015 void Menu::redraw () 1016 { 1017 #ifdef HAVE_GTK2 1018 gtk_option_menu_set_history (GTK_OPTION_MENU (widget), value); 1019 #endif /* HAVE_GTK2 */ 1020 } 1535 Example: see void CheckButton::redraw(void) 1536 */ 1537 void Menu::redraw(void) 1538 { 1539 #ifdef HAVE_GTK2 1540 gtk_option_menu_set_history(GTK_OPTION_MENU(this->widget), this->value); 1541 #endif /* HAVE_GTK2 */ 1542 } 1543 1544 /** 1545 \brief Changed the Option, call this Function 1546 */ 1547 void Menu::changeOption(void) 1548 { 1549 #ifdef HAVE_GTK2 1550 this->value =(int)gtk_option_menu_get_history(GTK_OPTION_MENU(this->widget)); 1551 #else /* HAVE_GTK2 */ 1552 char tmpChar[20]; 1553 cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): "; 1554 cin >> tmpChar; 1555 this->value = atoi(tmpChar); 1556 1557 #endif /* HAVE_GTK2 */ 1558 cout << this->title << " set to: " << this->value << endl; 1559 } 1560 1561 /* OPTION LABEL */ 1021 1562 1022 1563 /** 1023 1564 \brief Creates a new OptionLabel with a LabelName and a Value. 1024 1565 \param label The name of the OptionLabel. 1025 \param value The Value of the OptionLabel 1566 \param value The Value of the OptionLabel(what will be displayed). 1026 1567 */ 1027 1568 OptionLabel::OptionLabel(char* label, char* value) 1028 1569 { 1029 init(); 1030 setTitle(label); 1031 setValue(value); 1570 this->init(); 1571 this->setTitle(label); 1572 this->setValue(value); 1573 } 1574 1575 /** 1576 \brief destructs an OptionLabel. 1577 */ 1578 OptionLabel::~OptionLabel(void) 1579 { 1580 this->destroy(); 1032 1581 } 1033 1582 … … 1037 1586 void OptionLabel::init(void) 1038 1587 { 1588 this->isOption = 5; 1039 1589 static_cast<Option*>(this)->init(); 1040 isOption = 5; 1590 1041 1591 cValue = NULL; 1042 1592 1043 1593 #ifdef HAVE_GTK2 1044 widget = gtk_label_new (""); 1045 #endif /* HAVE_GTK2 */ 1046 } 1594 this->widget = gtk_label_new(""); 1595 #endif /* HAVE_GTK2 */ 1596 } 1597 1598 /** 1599 \brief Destroys a OptionLabel. 1600 */ 1601 void OptionLabel::destroy(void) 1602 { 1603 if (this->title) 1604 PRINTF(3)("deleting the OptionLabel: %s\n", this->title); 1605 else 1606 PRINTF(3)("deleting the OptionLabel.\n"); 1607 if (this->cValue) 1608 delete []this->cValue; 1609 1610 static_cast<Option*>(this)->destroy(); 1611 } 1612 1047 1613 1048 1614 /** … … 1052 1618 void OptionLabel::setValue(char* newValue) 1053 1619 { 1054 if ( cValue)1055 delete cValue;1056 cValue = new char [strlen(newValue)+1];1057 strcpy( cValue, newValue);1058 #ifdef HAVE_GTK2 1059 gtk_label_set_text (GTK_LABEL (widget),cValue);1620 if (this->cValue) 1621 delete []this->cValue; 1622 this->cValue = new char [strlen(newValue)+1]; 1623 strcpy(this->cValue, newValue); 1624 #ifdef HAVE_GTK2 1625 gtk_label_set_text(GTK_LABEL(this->widget), this->cValue); 1060 1626 #endif /* HAVE_GTK2 */ 1061 1627 } … … 1067 1633 void OptionLabel::setTitle(char* title) 1068 1634 { 1069 if (label) 1070 delete []label; 1071 label = new char [strlen(title)+1]; 1072 strcpy(label, title); 1073 #ifdef HAVE_GTK2 1074 gtk_label_set_text (GTK_LABEL (widget), title); 1075 #endif /* HAVE_GTK2 */ 1076 } 1077 1078 /** 1079 \brief Redraws an OptionLabel (not implemented yet, but it works). 1635 if (this->title) 1636 delete []this->title; 1637 this->title = new char [strlen(title)+1]; 1638 strcpy(this->title, title); 1639 this->redraw(); 1640 } 1641 1642 /** 1643 \brief Redraws an OptionLabel(not implemented yet, but it works). 1080 1644 */ 1081 1645 void OptionLabel::redraw(void) 1082 1646 { 1083 1084 } 1647 #ifdef HAVE_GTK2 1648 gtk_label_set_text(GTK_LABEL(widget), title); 1649 #endif /* HAVE_GTK2 */ 1650 } 1651 1652 /** 1653 \brief Changed the Option, call this Function 1654 */ 1655 void OptionLabel::changeOption(void) 1656 { 1657 #ifdef HAVE_GTK2 1658 this->cValue =(char*)gtk_label_get_text(GTK_LABEL(this->widget)); 1659 #else /* HAVE_GTK2 */ 1660 cout << "\nPlease give me a new input for " << this->title << ": "; 1661 cin >> this->cValue; 1662 #endif /* HAVE_GTK2 */ 1663 cout << this->title << " set to: " << this->cValue << endl; 1664 } 1665 1085 1666 1086 1667 /** … … 1088 1669 You migth consider adding Label::setTitle with this. 1089 1670 */ 1090 Label::Label ()1671 Label::Label(void) 1091 1672 { 1092 1673 this->init(); … … 1097 1678 \param text The text to be displayed. 1098 1679 */ 1099 Label:: Label 1680 Label:: Label(char* text) 1100 1681 { 1101 1682 this->init(); 1102 this->setText(text); 1683 this->setTitle(text); 1684 } 1685 1686 /** 1687 \brief destructs a Label. 1688 */ 1689 Label::~Label(void) 1690 { 1691 this->destroy(); 1103 1692 } 1104 1693 … … 1108 1697 void Label::init(void) 1109 1698 { 1110 isOption = 0;1699 this->isOption = 0; 1111 1700 1112 1701 static_cast<Widget*>(this)->init(); 1113 1702 1114 1703 #ifdef HAVE_GTK2 1115 widget = gtk_label_new (""); 1116 gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE); 1117 #endif /* HAVE_GTK2 */ 1704 this->widget = gtk_label_new(""); 1705 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1706 #endif /* HAVE_GTK2 */ 1707 } 1708 1709 /** 1710 \brief Destroys a Label. 1711 */ 1712 void Label::destroy(void) 1713 { 1714 if (this->title) 1715 PRINTF(3)("deleting the Label: %s\n", this->title); 1716 else 1717 PRINTF(3)("deleting the Label.\n"); 1718 1719 static_cast<Widget*>(this)->destroy(); 1118 1720 } 1119 1721 … … 1122 1724 \param text The text to be inserted into the Label. 1123 1725 */ 1124 void Label::setText (char* text) 1125 { 1126 if (label) 1127 delete []label; 1128 label = new char[strlen(text)+1]; 1129 strcpy(label, text); 1130 #ifdef HAVE_GTK2 1131 gtk_label_set_text (GTK_LABEL (this->widget), text); 1132 #endif /* HAVE_GTK2 */ 1133 } 1726 void Label::setTitle(char* text) 1727 { 1728 if (this->title) 1729 delete []this->title; 1730 this->title = new char[strlen(text)+1]; 1731 strcpy(this->title, text); 1732 #ifdef HAVE_GTK2 1733 gtk_label_set_text(GTK_LABEL(this->widget), this->title); 1734 #endif /* HAVE_GTK2 */ 1735 } 1736 1737 /** 1738 \brief ereases the Text of a Label 1739 */ 1740 void Label::ereaseText(void) 1741 { 1742 this->setTitle(""); 1743 } 1744 1745 /** 1746 \brief appends some Text to a Label 1747 \param textToAppend The text that will be appended to this Label 1748 */ 1749 void Label::appendText(char* textToAppend) 1750 { 1751 if (this->title) 1752 { 1753 char* tmpTitle = new char[strlen(this->title)+strlen(textToAppend)+1]; 1754 strcpy(tmpTitle, title); 1755 strcat(tmpTitle, textToAppend); 1756 delete []this->title; 1757 this->title = tmpTitle; 1758 } 1759 else 1760 { 1761 this->title = new char[strlen(textToAppend)]; 1762 } 1763 1764 #ifdef HAVE_GTK2 1765 gtk_label_set_text(GTK_LABEL(this->widget), title); 1766 #endif /* HAVE_GTK2 */ 1767 } 1768 1769 /** 1770 \brief Appends some integer to the Label 1771 \param intToAppend The Int that will be added. 1772 1773 it does this by just converting the int into a char* and send it to appendText 1774 */ 1775 void Label::appendInt(int intToAppend) 1776 { 1777 char append [32]; 1778 sprintf(append, "%d", intToAppend); 1779 this->appendText(append); 1780 } 1781 1134 1782 1135 1783 /** … … 1137 1785 \return The Text the Label holds. 1138 1786 */ 1139 char* Label::getText () 1140 { 1141 return label; 1142 } 1787 char* Label::getText(void) 1788 { 1789 return this->title; 1790 } 1791 1792 /** 1793 \brief Creates a new ProgressBar. 1794 */ 1795 ProgressBar::ProgressBar(void) 1796 { 1797 this->init(); 1798 } 1799 1800 /** 1801 \brief Creates a new ProgressBar. 1802 \param label The name you want to get the ProgressBar. 1803 */ 1804 ProgressBar::ProgressBar(char* label) 1805 { 1806 this->init(); 1807 this->setTitle(label); 1808 } 1809 1810 /** 1811 \brief destructs a ProgressBar 1812 */ 1813 ProgressBar::~ProgressBar(void) 1814 { 1815 this->destroy(); 1816 } 1817 1818 /** 1819 \brief Initializes a ProgressBar 1820 */ 1821 void ProgressBar::init(void) 1822 { 1823 this->isOption = 0; 1824 this->progress = 0.0; 1825 this->totalSize = 0.0; 1826 1827 static_cast<Widget*>(this)->init(); 1828 #ifdef HAVE_GTK2 1829 this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); 1830 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1831 #endif /* HAVE_GTK2 */ 1832 } 1833 1834 /** 1835 \brief Destroys a ProgressBar. 1836 */ 1837 void ProgressBar::destroy(void) 1838 { 1839 if (this->title) 1840 PRINTF(3)("deleting the ProgressBar: %s\n", this->title); 1841 else 1842 PRINTF(3)("deleting the ProgressBar.\n"); 1843 1844 static_cast<Widget*>(this)->destroy(); 1845 } 1846 1847 /** 1848 \brief Sets a ned Title to the ProgressBar. 1849 \param title The now title of the ProgressBar. 1850 */ 1851 void ProgressBar::setTitle(char* title) 1852 { 1853 if (this->title) 1854 delete []this->title; 1855 this->title = new char [strlen(title)+1]; 1856 strcpy(this->title, title); 1857 } 1858 1859 /** 1860 \brief Sets the Total size of the Bar.(ex. The maximum one can download) 1861 */ 1862 void ProgressBar::setTotalSize(double totalSize) 1863 { 1864 this->totalSize = totalSize; 1865 } 1866 1867 /** 1868 \brief Sets the progress maximum is this->totalSize 1869 */ 1870 void ProgressBar::setProgress(double progress) 1871 { 1872 this->progress = progress; 1873 1874 if (this->progress > this->totalSize) 1875 this->progress = this->totalSize; 1876 1877 #ifdef HAVE_GTK2 1878 gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize); 1879 #endif /* HAVE_GTK2 */ 1880 PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize); 1881 } 1882 1883 /** 1884 \brief returns the Progress Status 1885 */ 1886 double ProgressBar::getProgress(void) 1887 { 1888 return this->progress; 1889 } 1890 1891 /* IMAGE */ 1892 1893 /** 1894 \brief Creates a new Image 1895 \param imagename the location of the Image on the Hard Disc 1896 */ 1897 Image::Image(char* imagename) 1898 { 1899 this->init(); 1900 if (this->title) 1901 delete []this->title; 1902 this->title = new char[strlen(imagename)+1]; 1903 strcpy(this->title, imagename); 1904 1905 #ifdef HAVE_GTK2 1906 widget = gtk_image_new_from_file(imagename); 1907 #endif /* HAVE_GTK2 */ 1908 } 1909 1910 /** 1911 \brief destructs an Image. 1912 */ 1913 Image::~Image(void) 1914 { 1915 this->destroy(); 1916 } 1917 1918 /** 1919 \brief Initializes a new Image 1920 */ 1921 void Image::init(void) 1922 { 1923 isOption = 0; 1924 1925 static_cast<Widget*>(this)->init(); 1926 } 1927 1928 /** 1929 \brief Destroys a Image. 1930 */ 1931 void Image::destroy(void) 1932 { 1933 if (this->title) 1934 PRINTF(3)("deleting the Image: %s\n", this->title); 1935 else 1936 PRINTF(3)("deleting the Image.\n"); 1937 1938 static_cast<Widget*>(this)->destroy(); 1939 } 1940 1941 /** 1942 \brief Sets a ned Title to the Image. 1943 \param title The now title of the OptionLabel. 1944 */ 1945 void Image::setTitle(char* title) 1946 { 1947 if (this->title) 1948 delete []this->title; 1949 this->title = new char [strlen(title)+1]; 1950 strcpy(this->title, title); 1951 } -
orxonox/branches/trackManager/src/gui/orxonox_gui_gtk.h
r3187 r3430 3 3 \brief Contains all th different Widgets. 4 4 */ 5 6 5 #ifndef _ORXONOX_GUI_GTK_H 7 6 #define _ORXONOX_GUI_GTK_H … … 10 9 #include <config.h> 11 10 #endif 11 12 //! verbose level, soon obsolete 13 extern int verbose; // soon obsolete here 14 15 #include "../debug.h" 12 16 13 17 #ifdef HAVE_GTK2 … … 26 30 #include <gtk/gtkimage.h> 27 31 #include <gtk/gtkeventbox.h> 28 #endif /* HAVE_GTK2 */ 29 30 #ifdef HAVE_GTK2 31 bool initGTK(int argc, char *argv[]); 32 bool mainloopGTK(void); 33 #endif /* HAVE_GTK2 */ 34 32 #include <gtk/gtkprogressbar.h> 33 #endif /* HAVE_GTK2 */ 34 35 bool initGUI(int argc, char* argv[]); 36 bool mainloopGUI(void); 35 37 36 38 //! This is the topmost object that can be displayed all others are derived from it. … … 40 42 41 43 public: 42 ~Widget (); 43 44 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 45 #ifdef HAVE_GTK2 46 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 47 #endif /* HAVE_GTK2 */ 48 void init(void); 49 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option 50 /** 51 \briefdefines isOption states 52 */ 44 virtual ~Widget(void); 45 void init(void); 46 void destroy(void); 47 48 void show(void); 49 void hide(void); 50 void setSize(int width, int height); 51 virtual void setTitle(char* title) = 0; //!< An abstract Function, that sets the title of Widgets. 52 53 Widget* findWidgetByName(char* name, unsigned int depth); 54 void walkThrough(void(*function)(Widget*), unsigned int depth); 55 void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth); 56 static void listOptionsAndGroups(Widget* widget); 57 static void listOptions(Widget* widget); 58 static void listOptions(Widget* widget, void* data); 59 Widget* findOptionByNumber(int* number, unsigned int depth); 60 static void listGroups(Widget* widget); 61 static void listGroups(Widget* widget, void* data); 62 Widget* findGroupByNumber(int* number, unsigned int depth); 63 static void setOptions(Widget* widget); 64 static void flagCheck(Widget* widget, void* flagName); 65 66 #ifdef HAVE_GTK2 67 // Connection - Functions 68 69 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 70 gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* )); 71 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* )); 72 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void* )); 73 gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* )); 74 void disconnectSignal(gulong signalID); 75 76 // Signals 77 static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing); 78 #endif /* HAVE_GTK2 */ 79 80 Widget* next; //!< next always points to the next Widget in the list. Every Widget has a next one, or has NULL as next 81 #ifdef HAVE_GTK2 82 GtkWidget* widget; //!< widget is the gtk_widget that the specific Object Contains. 83 #endif /* HAVE_GTK2 */ 84 int isOption; //!< with this Paramenter one can set the option-type: -2:Container, -1: Box, 0: not an Option, 1: Bool-option, 2: int-option, 3: float option, 4:char option, 5: char* option 85 86 //! defines isOption states 53 87 enum option { containerType = -2, boxType = -1, nothingType = 0, boolType = 1, intType = 2}; 54 char* label; //!< The name of the Widget. Some do display it, Options need it to save; 55 #ifdef HAVE_GTK2 56 gulong connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 57 gulong connectSignal (char* event, gint (*signal)(GtkWidget*, Widget *)); 58 gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *)); 59 gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *)); 60 void disconnectSignal (gulong signalID); 61 #endif /* HAVE_GTK2 */ 62 void show (); 63 void hide (); 64 void setSize(int width, int height); 65 66 void walkThrough (void (*function)(Widget*)); 67 static void listOptions (Widget* widget); 68 static void setOptions (Widget* widget); 69 70 #ifdef HAVE_GTK2 71 static gint doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing); 72 #endif /* HAVE_GTK2 */ 88 char* title; //!< The name of the Widget. Some do display it, Options need it to save; 73 89 }; 74 90 … … 81 97 82 98 void init(void); 83 void setGroupName (char* name); 84 char* getGroupName (void); 99 void destroy(void); 100 101 void setGroupName(char* name); 102 char* getGroupName(void); 103 104 virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers. 85 105 }; 86 106 … … 94 114 { 95 115 private: 96 int borderwidth; 97 int policy; 98 99 public: 100 void init(void); 101 // void setBorderWidth (int borderwidth); 102 // virtual void setTitle (char* title) = 0; 103 void fill (Widget *lowerWidget); 116 int borderwidth; //!< The width of The Container Boarder. 117 int policy; //!< The Update Policy of a Container. 118 119 public: 120 void init(void); 121 void destroy(void); 122 123 // void setBorderWidth(int borderwidth); 124 // virtual void setTitle(char* title) = 0; 125 void fill(Widget* lowerWidget); 104 126 }; 105 127 … … 112 134 { 113 135 private: 114 bool isOpen; //!< A bool Variable that checks if a Window is already open.115 public: 116 static Window* mainWindow; //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window.136 bool isOpen; //!< A bool Variable that checks if a Window is already open. 137 public: 138 static Window* mainWindow; //!< Pointer to the First Window that was opened. By default this should be the GUI's main-Window. 117 139 static void addWindow(Window* windowToAdd); 118 140 119 Window (void); 120 Window (char* windowName); 121 void init (); 122 123 void setTitle (char* title); 124 void showall (); 125 void open(); 126 void close(); 127 128 #ifdef HAVE_GTK2 129 static gint windowOpen (GtkWidget *widget, GdkEvent* event, void* window); 130 static gint windowClose (GtkWidget *widget, GdkEvent* event, void* window); 131 static gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data); 141 Window(void); 142 Window(char* windowName); 143 ~Window(void); 144 void init(void); 145 void destroy(void); 146 147 void setTitle(char* title); 148 void showall(void); 149 void open(void); 150 void close(void); 151 152 #ifdef HAVE_GTK2 153 // Signals 154 static gint windowOpen(GtkWidget* widget, GdkEvent* event, void* window); 155 static gint windowClose(GtkWidget* widget, GdkEvent* event, void* window); 132 156 #endif /* HAVE_GTK2 */ 133 157 }; … … 141 165 { 142 166 public: 143 Frame (char* frameName); 144 Frame (void); 145 void init(void); 146 147 void setTitle (char* title); 167 Frame(void); 168 Frame(char* frameName); 169 ~Frame(void); 170 void init(void); 171 void destroy(void); 172 173 void setTitle(char* title); 148 174 }; 149 175 … … 155 181 { 156 182 public: 157 EventBox (char* eventBoxName); 158 EventBox (void); 159 void init(void); 160 161 void setTitle (char* title); 183 EventBox(void); 184 EventBox(char* eventBoxName); 185 ~EventBox(void); 186 void init(void); 187 void destroy(void); 188 189 void setTitle(char* title); 162 190 }; 163 191 … … 166 194 A Box can Contain multiple Widgets, that are ordered either horizontally or vertically 167 195 I defined the standartbox to be horizontally. 168 A Box is always filled left->right (horizontally) or up->down(vertically)196 A Box is always filled left->right(horizontally) or up->down(vertically) 169 197 */ 170 198 class Box : public Packer 171 199 { 172 200 public: 173 Box (void); 174 Box (char boxtype); 201 Box(void); 202 Box(char boxtype); 203 ~Box(void); 175 204 void init(char boxtype); 176 177 void fill (Widget* lowerWidget); 178 205 void destroy(void); 206 207 void fill(Widget* lowerWidget); 208 209 void setTitle(char* title); 210 }; 211 212 //! An Option is a Widget that contains something that may change its state. 213 /** 214 * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something 215 */ 216 class Option : public Widget 217 { 218 protected: 219 bool saveable; //!< Options can be Saved. 220 221 public: 222 void init(void); 223 void destroy(void); 224 225 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume 226 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 227 char* flagNameShort; //!< like flag_name but shorter 228 int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value) 229 230 void saveability(void); 231 void saveability(bool isSaveable); 232 bool isSaveable(void); 233 void setFlagName(char* flagname, int defaultvalue); 234 void setFlagName(char* flagname, char* flagnameshort, int defaultvalue); 235 virtual void redraw(void) = 0; //!< A Option must be able to redraw itself. 236 virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself. 237 #ifdef HAVE_GTK2 238 // Signals 239 static gint OptionChange(GtkWidget* widget, Widget* option); //!< Signal for Options that change. 240 #endif /* HAVE_GTK2 */ 241 }; 242 243 //! Buttons can be pressed, and released. 244 /** 245 * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it. 246 */ 247 class Button : public Option 248 { 249 public: 250 Button(char* buttonname); 251 ~Button(void); 252 void init(void); 253 void destroy(void); 254 255 void setTitle(char* title); 256 void redraw(void); 257 void changeOption(void); 258 }; 259 260 //! CheckButtons are a key in configuring bool Variables 261 /** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc. 262 */ 263 class CheckButton : public Option 264 { 265 public: 266 CheckButton(char* buttonname); 267 ~CheckButton(void); 268 void init(void); 269 void destroy(void); 270 271 void setTitle(char* title); 272 bool isActive(void); //!< a Bool value to see, if this CheckButton is active. 273 void redraw(void); 274 void changeOption(void); 275 }; 276 277 //! Sliders are Options that can be modified in their value 278 /** 279 * good for volume, brightness, etc. 280 */ 281 class Slider : public Option 282 { 283 private: 284 int start; //!< The beginning of the Slider-range. 285 int end; //!< The end of the Slider-range. 286 public: 287 Slider(char* slidername, int start, int end); 288 ~Slider(void); 289 void init(int start, int end); 290 void destroy(void); 291 292 void setTitle(char* title); 293 void setValue(int value); 294 void redraw(void); 295 void changeOption(void); 296 }; 297 298 //! A Menu is an Option that has a dropdown menu, where you can chose between different Items 299 class Menu : public Option 300 { 301 private: 302 #ifdef HAVE_GTK2 303 GtkWidget* menu; //!< The menu That will hold the Options. 304 GtkWidget* item; //!< One Item From a Menu. 305 #endif /* HAVE_GTK2 */ 306 va_list itemlist; //!< The list to readin multiple Options. 307 308 public: 309 Menu(char* menuname, ...); 310 ~Menu(void); 311 void init(void); 312 void destroy(void); 313 314 void setTitle(char* title); 315 void addItem(char* itemName); 316 void redraw(void); 317 void changeOption(void); 318 }; 319 320 //! A OptionLabel is a simple Label, that holds a char*, and will be updated, if changed. 321 class OptionLabel : public Option 322 { 323 private: 324 325 public: 326 OptionLabel(char* label, char* value); 327 ~OptionLabel(void); 328 void init(void); 329 void destroy(void); 330 331 332 void setValue(char* newValue); 333 void setTitle(char* title); 334 void redraw(void); 335 void changeOption(void); 336 337 char* cValue; //!< The Value the Label will have. \todo make private 338 339 }; 340 341 //! A label is a Widget, that displays a text 342 class Label : public Widget 343 { 344 public: 345 Label(void); 346 Label(char* text); 347 ~Label(void); 348 void init(void); 349 void destroy(void); 350 351 void setTitle(char* text); 352 void ereaseText(void); 353 void appendText(char* textToAppend); 354 void appendInt(int intToAppend); 355 char* getText(void); 356 }; 357 358 //! A ProgressBar is a Widget, that can display a Progress 359 class ProgressBar : public Widget 360 { 361 public: 362 ProgressBar(void); 363 ProgressBar(char* label); 364 ~ProgressBar(void); 365 void init(void); 366 void destroy(void); 367 368 void setTitle(char* title); 369 void setProgress(double progress); 370 void setTotalSize(double totalSize); 371 double getProgress(void); 372 373 private: 374 double totalSize; //!< The total Size of a download Bar 375 double progress; //!< The progress of a Bar. 376 #ifdef HAVE_GTK2 377 GtkAdjustment* adjustment; 378 #endif /* HAVE_GTK2 */ 179 379 }; 180 380 … … 187 387 { 188 388 public: 189 Image (char* imgaename); 190 void init(void); 191 }; 192 193 //! An Option is a Widget that contains something that may change its state. 194 /** 195 * Options are the essence of a GUI, they: Configure, Start, Quit, Execute, and make it worth something 196 */ 197 class Option : public Widget 198 { 199 public: 200 //virtual gint OptionChange (GtkWidget *widget, GdkEvent *event, gpointer data); 201 void init(void); 202 203 int value; //!< every option has a value either true or false (0,1) or something else like 25 for 25% of the volume 204 char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI. 205 char* flagNameShort; //!< like flag_name but shorter 206 int defaultValue; //!< A default value is good, for hiding a option if it is not needed. (hidden if value == default_value) 207 bool saveable; //!< Options can be Saved. 208 209 void setFlagName (char* flagname, int defaultvalue); 210 void setFlagName (char* flagname, char* flagnameshort, int defaultvalue); 211 virtual void redraw () = 0; //!< A Option must be able to redraw itself. 212 }; 213 214 //! Buttons can be pressed, and released. 215 /** 216 * Buttons are mainly there for executing some action like Starting the Programm, or Quiting it. 217 */ 218 class Button : public Option 219 { 220 public: 221 Button (char* buttonname); 222 void init(void); 223 224 void setTitle(char* title); 225 226 void redraw(); 227 }; 228 229 //! CheckButtons are a key in configuring bool Variables 230 /** CheckButtons can configure bool Variables like wireframe on/off, enable_sound etc. 231 */ 232 class CheckButton : public Option 233 { 234 public: 235 CheckButton (char* buttonname); 236 #ifdef HAVE_GTK2 237 static gint OptionChange (GtkWidget* widget, Widget* checkbutton); 238 #endif /* HAVE_GTK2 */ 239 240 void init(void); 241 void setTitle(char* title); 242 243 bool isActive(); 244 void redraw (); 245 }; 246 247 //! Sliders are Options that can be modified in their value 248 /** 249 * good for volume, brightness, etc. 250 */ 251 class Slider : public Option 252 { 253 public: 254 Slider (char* slidername,int start, int end); 255 void init(int start, int end); 256 257 void setTitle(char* title); 258 void setValue(int value); 259 260 #ifdef HAVE_GTK2 261 static gint OptionChange (GtkWidget* widget, Widget* slider); 262 #endif /* HAVE_GTK2 */ 263 void redraw(); 264 }; 265 266 //! A Menu is an Option that has a dropdown menu, where you can chose between different Items 267 class Menu : public Option 268 { 269 private: 270 #ifdef HAVE_GTK2 271 GtkWidget* menu; //!< The menu That will hold the Options. 272 GtkWidget* item; //!< One Item From a Menu. 273 #endif /* HAVE_GTK2 */ 274 va_list itemlist; //!> The list to readin multiple Options. 275 276 public: 277 Menu (char* menuname, ...); 278 void init(void); 279 280 void setTitle(char* title); 281 282 void addItem(char* itemName); 283 #ifdef HAVE_GTK2 284 static gint OptionChange (GtkWidget* widget, Widget* menu); 285 #endif /* HAVE_GTK2 */ 286 void redraw(); 287 }; 288 289 //! A CharLabel is a simple Label, that holds a char*, and will be updated, if changed. 290 class OptionLabel : public Option 291 { 292 public: 293 OptionLabel(char* label, char* value); 294 void init(void); 295 296 char* cValue; //!< The Value the Label will have. 297 298 void setValue(char* newValue); 299 void setTitle(char* title); 300 void redraw(); 301 }; 302 303 //! A label is a Widget, that displays a text 304 class Label : public Widget 305 { 306 public: 307 Label (); 308 Label (char* text); 309 void init(void); 310 311 void setText (char* text); 312 char* getText (); 313 }; 314 315 316 //gint orxonox_gui_quit (GtkWidget *widget, GdkEvent *event, gpointer data); 389 Image(char* imgaename); 390 ~Image(void); 391 void init(void); 392 void destroy(void); 393 394 void setTitle(char* title); 395 }; 396 397 //gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data); 317 398 318 399 #endif /* _ORXONOX_GUI_GTK_H */ -
orxonox/branches/trackManager/src/gui/orxonox_gui_keys.cc
r3187 r3430 29 29 \brief Creates an Keyboard-Frame 30 30 */ 31 OrxonoxGuiKeys::OrxonoxGuiKeys ()32 { 33 keysFrame = new Frame("Keyboard-Options:");31 OrxonoxGuiKeys::OrxonoxGuiKeys(void) 32 { 33 this->keysFrame = new Frame("Keyboard-Options:"); 34 34 // keysFrame->setGroupName("Keyboard"); 35 keysBox = new Box ('h'); 36 player1 = new Player("player1"); 37 player2 = new Player("player2"); 38 39 keysBox->fill(player1->getOpenButton()); 40 keysBox->fill(player2->getOpenButton()); 41 42 keysFrame->fill (keysBox); 35 this->keysBox = new Box('h'); 36 this->player1 = new Player("player1"); 37 this->player2 = new Player("player2"); 38 39 this->keysBox->fill(this->player1->getOpenButton()); 40 this->keysBox->fill(this->player2->getOpenButton()); 41 42 this->keysFrame->fill(this->keysBox); 43 } 44 45 /** 46 \brief Destructs the Keys-stuff 47 */ 48 OrxonoxGuiKeys::~OrxonoxGuiKeys(void) 49 { 50 // nothing to do here. 43 51 } 44 52 … … 47 55 \return Returns the Audio-frame 48 56 */ 49 Widget* OrxonoxGuiKeys::getWidget ()50 { 51 return keysFrame;57 Widget* OrxonoxGuiKeys::getWidget(void) 58 { 59 return this->keysFrame; 52 60 } 53 61 … … 60 68 Player::Player(char* player) 61 69 { 62 char windowName[100] = "Keyboard settings of "; 63 strcat (windowName, player); 64 pKeyWindow = new Window(windowName); 65 pKeyFrame = new Frame (windowName); 66 pKeysBox = new Box('v'); 67 pKeysBox->setGroupName (player); 68 pKeysBox->fill(addKey(UP, "up")); 69 pKeysBox->fill(addKey(DOWN, "down")); 70 pKeysBox->fill(addKey(LEFT, "left")); 71 pKeysBox->fill(addKey(RIGHT, "right")); 72 pKeysBox->fill(addKey(SHOOT, "shoot")); 73 70 char* windowName = new char[strlen(player)+25]; 71 strcpy(windowName, "Keyboard settings of "); 72 strcat(windowName, player); 73 this->pKeyWindow = new Window(windowName); 74 this->pKeyFrame = new Frame(windowName); 75 this->pKeysBox = new Box('v'); 76 this->pKeysBox->setGroupName(player); 77 this->pKeysBox->fill(addKey(UP, "up")); 78 this->pKeysBox->fill(addKey(DOWN, "down")); 79 this->pKeysBox->fill(addKey(LEFT, "left")); 80 this->pKeysBox->fill(addKey(RIGHT, "right")); 81 this->pKeysBox->fill(addKey(SHOOT, "shoot")); 82 delete windowName; 74 83 closeButton = new Button("close"); 75 84 #ifdef HAVE_GTK2 76 closeButton->connectSignal("button_press_event",pKeyWindow, Window::windowClose);77 #endif /* HAVE_GTK2 */ 78 79 pKeysBox->fill(closeButton);80 pKeyFrame->fill(pKeysBox);81 pKeyWindow->fill(pKeyFrame);82 Window::addWindow( pKeyWindow);83 #ifdef HAVE_GTK2 84 pKeyWindow->connectSignal("destroy",pKeyWindow, Window::windowClose);85 pKeyWindow->connectSignal("delete_event",pKeyWindow, Window::windowClose);86 #endif /* HAVE_GTK2 */ 87 88 openButton = new Button(player);89 #ifdef HAVE_GTK2 90 openButton->connectSignal("button_press_event",pKeyWindow, Window::windowOpen);91 #endif /* HAVE_GTK2 */ 92 93 inputWindow = new Window("inputWindow");94 95 inputButton = new Button("test");96 inputWindow->fill(inputButton);97 #ifdef HAVE_GTK2 98 inputWindow->connectSignal("destroy", Widget::doNothingSignal);99 inputWindow->connectSignal("delete_event", Widget::doNothingSignal);85 this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose); 86 #endif /* HAVE_GTK2 */ 87 88 this->pKeysBox->fill(this->closeButton); 89 this->pKeyFrame->fill(this->pKeysBox); 90 this->pKeyWindow->fill(this->pKeyFrame); 91 Window::addWindow(this->pKeyWindow); 92 #ifdef HAVE_GTK2 93 this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose); 94 this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose); 95 #endif /* HAVE_GTK2 */ 96 97 this->openButton = new Button(player); 98 #ifdef HAVE_GTK2 99 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen); 100 #endif /* HAVE_GTK2 */ 101 102 this->inputWindow = new Window("inputWindow"); 103 104 this->inputButton = new Button("test"); 105 this->inputWindow->fill(inputButton); 106 #ifdef HAVE_GTK2 107 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 108 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 100 109 #endif /* HAVE_GTK2 */ 101 110 … … 108 117 \returns A widget that has the Key-Box 109 118 */ 110 Widget* Player::addKey 111 { 112 inputKey[key] = new InputKey;113 inputKey[key]->pKeyBox = new Box();114 inputKey[key]->pKeyButton = new Button(name);115 inputKey[key]->pKeyOLabel = new OptionLabel(name, name);116 inputKey[key]->pKeyOLabel->saveable = true;119 Widget* Player::addKey(KEYS key, char* name) 120 { 121 this->inputKey[key] = new InputKey; 122 this->inputKey[key]->pKeyBox = new Box(); 123 this->inputKey[key]->pKeyButton = new Button(name); 124 this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name); 125 this->inputKey[key]->pKeyOLabel->saveability(); 117 126 118 127 #ifdef HAVE_GTK2 119 128 //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb); 120 inputKey[key]->pKeyButton->connectSignal("button_press_event",inputKey[key], inputWindowEvent);121 #endif /* HAVE_GTK2 */ 122 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyButton);123 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyOLabel);124 return inputKey[key]->pKeyBox;129 this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent); 130 #endif /* HAVE_GTK2 */ 131 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton); 132 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel); 133 return this->inputKey[key]->pKeyBox; 125 134 } 126 135 … … 128 137 \returns the OpenButton of a Player 129 138 */ 130 Button* Player::getOpenButton( )131 { 132 return openButton;133 } 134 135 /** 136 \brief sets a new Key 139 Button* Player::getOpenButton(void) 140 { 141 return this->openButton; 142 } 143 144 /** 145 \brief sets a new Key(only output) 137 146 \param key the new Key. 138 147 */ … … 163 172 gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey) 164 173 { 165 InputKey* inputkey = 174 InputKey* inputkey =(InputKey*) inputKey; 166 175 char title [20]; 167 176 … … 256 265 char* tmp; 257 266 sprintf(tmp, "%c", event->keyval); 258 printf 267 printf("other key %s \n", tmp); 259 268 strcpy(title, tmp); 260 269 break; 261 270 } 262 271 263 inputkey->pKeyOLabel->setValue 272 inputkey->pKeyOLabel->setValue(title); 264 273 inputButton->disconnectSignal(keySignal); 265 274 inputWindow->close(); -
orxonox/branches/trackManager/src/gui/orxonox_gui_keys.h
r3187 r3430 15 15 \brief defines the Possible Player Keys 16 16 */ 17 enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT};17 enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT}; 18 18 19 19 class Player; … … 29 29 30 30 public: 31 OrxonoxGuiKeys ();32 ~OrxonoxGuiKeys ();31 OrxonoxGuiKeys(void); 32 ~OrxonoxGuiKeys(void); 33 33 34 Widget* getWidget ();34 Widget* getWidget(void); 35 35 }; 36 36 … … 64 64 Player(char* player); 65 65 66 Widget* addKey 66 Widget* addKey(KEYS key, char* name); 67 67 68 Button* getOpenButton( );68 Button* getOpenButton(void); 69 69 70 70 #ifdef HAVE_GTK2 -
orxonox/branches/trackManager/src/gui/orxonox_gui_video.cc
r3187 r3430 30 30 \brief Creates the Video-Option-Frame 31 31 */ 32 OrxonoxGuiVideo::OrxonoxGuiVideo ()32 OrxonoxGuiVideo::OrxonoxGuiVideo(void) 33 33 { 34 videoFrame = new Frame("Video-Options:");35 videoBox = new Box('v');36 videoFrame->setGroupName("video");34 this->videoFrame = new Frame("Video-Options:"); 35 this->videoBox = new Box('v'); 36 this->videoFrame->setGroupName("video"); 37 37 38 fullscreen = new CheckButton("Fullscreen-mode");39 fullscreen->setFlagName("windowed", "q", 1);40 fullscreen->saveable = true;41 videoBox->fill(fullscreen);42 wireframe = new CheckButton("WireFrame-mode");43 wireframe->setFlagName("wireframe", "w", 0);44 wireframe->saveable = true;45 videoBox->fill(wireframe);38 this->fullscreen = new CheckButton("Fullscreen-mode"); 39 this->fullscreen->setFlagName("windowed", "q", 1); 40 this->fullscreen->saveability(); 41 this->videoBox->fill(fullscreen); 42 this->wireframe = new CheckButton("WireFrame-mode"); 43 this->wireframe->setFlagName("wireframe", "w", 0); 44 this->wireframe->saveability(); 45 this->videoBox->fill(wireframe); 46 46 47 videoFrame->fill (videoBox); 47 this->advancedWindowCreate(); 48 this->videoBox->fill(this->advancedWindowGetButton()); 49 50 this->videoFrame->fill(videoBox); 51 } 52 53 /** 54 \brief Destructs the Video-stuff 55 */ 56 OrxonoxGuiVideo::~OrxonoxGuiVideo(void) 57 { 58 // nothing to do here. 48 59 } 49 60 … … 51 62 \return Returns the Video-frame 52 63 */ 53 Widget* OrxonoxGuiVideo::getWidget ()64 Widget* OrxonoxGuiVideo::getWidget(void) 54 65 { 55 return videoFrame;66 return this->videoFrame; 56 67 } 68 69 70 /** 71 \brief Creates a window, and all it contains for the Source-update. 72 */ 73 void OrxonoxGuiVideo::advancedWindowCreate(void) 74 { 75 // the button, that opens this Window. 76 this->advancedButton = new Button("advanced"); 77 78 // the Window itself 79 this->advancedWindow = new Window("Advanced Video Options"); 80 this->advancedWindow->setGroupName("advancedVideoOptions"); 81 82 this->advancedBox = new Box('v'); 83 84 // Advanced Performance Options 85 this->shadows = new CheckButton("Shadows"); 86 this->shadows->saveability(); 87 this->advancedBox->fill(this->shadows); 88 89 this->fog = new CheckButton("Fog"); 90 this->fog->saveability(); 91 this->advancedBox->fill(this->fog); 92 93 this->reflections = new CheckButton("Reflections"); 94 this->reflections->saveability(); 95 this->advancedBox->fill(this->reflections); 96 97 this->textures = new CheckButton("Textures"); 98 this->textures->saveability(); 99 this->advancedBox->fill(this->textures); 100 101 this->textureDetail = new Menu("Texture Detail", "low", "medium", "high", "lastItem"); 102 this->textureDetail->saveability(); 103 this->advancedBox->fill(this->textureDetail); 104 105 this->modelDetailLabel = new Label("Model Detail"); 106 this->advancedBox->fill(this->modelDetailLabel); 107 this->modelDetail = new Menu("Model Detail", "low", "medium", "high", "lastItem"); 108 this->modelDetail->saveability(); 109 this->advancedBox->fill(this->modelDetail); 110 111 this->antiAliasingLabel = new Label("Anti-Aliasing-depth:"); 112 this->advancedBox->fill(this->antiAliasingLabel); 113 this->antiAliasing = new Menu("Anti Aliasing", "0", "1", "2", "4", "8", "lastItem"); 114 this->antiAliasing->saveability(); 115 this->advancedBox->fill(this->antiAliasing); 116 117 this->filterMethodLabel = new Label("Filtering Method:"); 118 this->advancedBox->fill(this->filterMethodLabel); 119 this->filterMethod = new Menu("Filtering Method", "none", "linear", "bilinear", "trilinear", "anisortopic", "lastItem"); 120 this->filterMethod->saveability(); 121 this->advancedBox->fill(this->filterMethod); 122 123 this->closeButton = new Button("close"); 124 this->advancedBox->fill(this->closeButton); 125 126 this->advancedWindow->fill(advancedBox); 127 #ifdef HAVE_GTK2 128 this->advancedButton->connectSignal("button_press_event", this->advancedWindow, Window::windowOpen); 129 this->closeButton->connectSignal("button_press_event", this->advancedWindow, Window::windowClose); 130 this->advancedWindow->connectSignal("destroy", this->advancedWindow, Window::windowClose); 131 this->advancedWindow->connectSignal("delete_event", this->advancedWindow, Window::windowClose); 132 #endif /* HAVE_GTK2 */ 133 Window::addWindow(this->advancedWindow); 134 135 } 136 137 /** 138 \returns A Pointer to the Button of the UpdaterSourceWindow 139 */ 140 Button* OrxonoxGuiVideo::advancedWindowGetButton(void) 141 { 142 return this->advancedButton; 143 } 144 -
orxonox/branches/trackManager/src/gui/orxonox_gui_video.h
r3187 r3430 16 16 CheckButton* fullscreen; //!< CheckButton for fullscreen-mode 17 17 CheckButton* wireframe; //!< CheckButton for wireframe Mode. 18 19 // advanced-Performance-Options 20 Window* advancedWindow; //!< A Window to display advanced options. 21 Button* advancedButton; //!< A Button to open the Advanced Video Performance Window. 22 Box* advancedBox; //!< A Box to pack the options into. 23 CheckButton* shadows; //!< CheckButton for shadows 24 CheckButton* fog; //!< CheckButton for fog. 25 CheckButton* reflections; //!< CheckButton for reflections 26 CheckButton* textures; //!< CheckButton for textures 27 Menu* textureDetail; //!< Menu for the Texture-Detail. 28 29 Label* modelDetailLabel; //!< Label for model-detail. 30 Menu* modelDetail; //!< model-detail. 31 32 Label* antiAliasingLabel; //!< Label for the anti-aliasing mode. 33 Menu* antiAliasing; //!< Menu for the Antialiasing-mode. 34 35 Label* filterMethodLabel; //!< Label for filtering-Method. 36 Menu* filterMethod; //!< Menu for filtering Method. 37 38 Button* closeButton; //!< A Button to close the Advanced-settingsWindow. 39 40 Button* advancedWindowGetButton(void); 41 void advancedWindowCreate(void); 42 18 43 public: 19 OrxonoxGuiVideo ();20 ~OrxonoxGuiVideo ();44 OrxonoxGuiVideo(void); 45 ~OrxonoxGuiVideo(void); 21 46 22 Widget* getWidget ();47 Widget* getWidget(void); 23 48 }; 24 49 #endif /* _ORXONOX_GUI_VIDEO_H */ -
orxonox/branches/trackManager/src/gui/rc
r2595 r3430 120 120 # just listed in this document for the users reference. 121 121 122 widget_class "GtkWindow" style "window"123 widget_class "GtkFrame" style "window"124 widget_class "Gtk*EventBox" style "window"125 widget_class "GtkDialog" style "window"126 widget_class "GtkFileSelection" style "window"127 widget_class "*Gtk*Scale" style "scale"128 widget_class "*GtkCheckButton*" style "toggle_button"129 widget_class "*Gtk*Menu*" style "toggle_button"130 widget_class "*GtkRadioButton*" style "toggle_button"131 widget_class "*GtkButton*" style "button"132 widget_class "*Ruler" style "ruler"133 widget_class "*GtkText" style "text"134 widget_class "*GtkLabel" style "text"122 widget_class "GtkWindow" style "window" 123 widget_class "GtkFrame" style "window" 124 widget_class "Gtk*EventBox" style "window" 125 widget_class "GtkDialog" style "window" 126 widget_class "GtkFileSelection" style "window" 127 widget_class "*Gtk*Scale" style "scale" 128 widget_class "*GtkCheckButton*" style "toggle_button" 129 widget_class "*Gtk*Menu*" style "toggle_button" 130 widget_class "*GtkRadioButton*" style "toggle_button" 131 widget_class "*GtkButton*" style "button" 132 widget_class "*Ruler" style "ruler" 133 widget_class "*GtkText" style "text" 134 widget_class "*GtkLabel" style "text" 135 135 136 136
Note: See TracChangeset
for help on using the changeset viewer.