Changeset 4083 in orxonox.OLD
- Timestamp:
- May 6, 2005, 2:53:28 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/gui/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui/gui_gtk.cc
r4081 r4083 1748 1748 this->changeOption = NULL; 1749 1749 this->openUpButton = NULL; 1750 this->okObject = NULL; 1751 this->okFunc = NULL; 1750 1752 1751 1753 #ifdef HAVE_GTK2 1752 1754 this->widget = gtk_file_selection_new(fileDialogName); 1755 1756 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION (this->widget), FALSE); 1757 1753 1758 g_signal_connect(GTK_FILE_SELECTION (this->widget)->cancel_button, 1754 1759 "button_release_event", … … 1781 1786 } 1782 1787 1788 void FileDialog::setOKFunc(void* okObject, bool(*function)(const char* , void*)) 1789 { 1790 this->okObject = okObject; 1791 this->okFunc = function; 1792 } 1793 1794 1783 1795 void FileDialog::setOpenUpButton(Button* openUpButton) 1784 1796 { … … 1803 1815 } 1804 1816 1817 /** 1818 \brief disables the File Operator Buttons 1819 */ 1820 void FileDialog::disableFileOpts(void) 1821 { 1822 #ifdef HAVE_GTK2 1823 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(this->widget)); 1824 #endif /* HAVE_GTK2 */ 1825 } 1826 1827 /** 1828 \brief The ok-button has been pressed 1829 */ 1805 1830 void FileDialog::okEvent(void) 1806 1831 { 1807 if (this->changeOption) 1808 #ifdef HAVE_GTK2 1809 changeOption->setValue(gtk_file_selection_get_filename(GTK_FILE_SELECTION(this->widget))); 1810 #endif /* HAVE_GTK2 */ 1811 this->close(); 1812 } 1813 1832 if (this->okFunc) 1833 { 1834 #ifdef HAVE_GTK2 1835 if(this->okFunc((const char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(this->widget)), this->okObject)) 1836 this->close(); 1837 #endif /* HAVE_GTK2 */ 1838 } 1839 else if (this->changeOption) 1840 { 1841 #ifdef HAVE_GTK2 1842 changeOption->setValue(gtk_file_selection_get_filename(GTK_FILE_SELECTION(this->widget))); 1843 #endif /* HAVE_GTK2 */ 1844 this->close(); 1845 } 1846 else 1847 this->close(); 1848 } 1849 1850 /** 1851 \biref opens up the FileDialog-Window 1852 */ 1814 1853 void FileDialog::open(void) 1815 1854 { … … 1821 1860 } 1822 1861 1862 /** 1863 \closes the FileDialog-Window 1864 */ 1823 1865 void FileDialog::close(void) 1824 1866 { -
orxonox/trunk/src/lib/gui/gui/gui_gtk.h
r4071 r4083 428 428 Button* openUpButton; 429 429 bool isOpen; 430 bool (*okFunc)(const char* , void*); 431 void* okObject; 432 430 433 public: 431 434 FileDialog(const char* fileDialogName); … … 433 436 434 437 void setChangeOption(OptionLabel* changeOption); 438 void setOKFunc(void* okObject, bool(*function)(const char* , void*)); 435 439 void setOpenUpButton(Button* openUpButton); 436 440 void setDefaultFileName(const char* defaultFileName); 437 441 void setMask(const char* mask); 442 void disableFileOpts(void); 438 443 439 444 void okEvent(); -
orxonox/trunk/src/lib/gui/gui/gui_keys.cc
r4056 r4083 69 69 this->pKeysBox = new Box('v'); 70 70 this->pKeysBox->setGroupName(player); 71 this->pKeysBox->fill(addKey(UP, " up"));72 this->pKeysBox->fill(addKey(DOWN, " down"));73 this->pKeysBox->fill(addKey(LEFT, " left"));74 this->pKeysBox->fill(addKey(RIGHT, " right"));75 this->pKeysBox->fill(addKey(SHOOT, " shoot"));71 this->pKeysBox->fill(addKey(UP, "UP")); 72 this->pKeysBox->fill(addKey(DOWN, "DOWN")); 73 this->pKeysBox->fill(addKey(LEFT, "LEFT")); 74 this->pKeysBox->fill(addKey(RIGHT, "RIGHT")); 75 this->pKeysBox->fill(addKey(SHOOT, "FIRE")); 76 76 delete windowName; 77 77 closeButton = new Button("close"); -
orxonox/trunk/src/lib/gui/gui/gui_update.cc
r4068 r4083 40 40 Button* dataDirButton; //!< A Button for the selection of the DataRepos 41 41 OptionLabel* dataDirLabel; //!< A Label fot the selection of the DataRepos 42 42 43 43 44 this->tmpDir = NULL; … … 51 52 this->updateFrame->setGroupName("update"); 52 53 this->updateBox = new Box('v'); 54 55 dataDirButton = new Button("Data Directory"); 56 dataDirLabel = new OptionLabel("DataDir", "unknown"); 57 dataDirLabel->saveability(); 58 dataDirDialog = new FileDialog("data-Repos-location"); 59 dataDirDialog->setDefaultFileName("data"); 60 dataDirDialog->setMask(DATA_IDENTIFIER); 61 this->checkDataDir("../data/" DATA_IDENTIFIER, dataDirLabel); 62 dataDirDialog->disableFileOpts(); 63 dataDirDialog->setOpenUpButton(dataDirButton); 64 //dataDirDialog->setChangeOption(dataDirLabel); 65 dataDirDialog->setOKFunc(dataDirLabel, GuiUpdate::checkDataDir); 66 updateBox->fill(dataDirButton); 67 updateBox->fill(dataDirLabel); 68 53 69 #ifdef HAVE_CURL 54 70 … … 60 76 61 77 62 dataDirButton = new Button("browse");63 dataDirLabel = new OptionLabel("DataDir", "test");64 dataDirLabel->saveability();65 dataDirDialog = new FileDialog("data-Repos-location");66 dataDirDialog->setDefaultFileName("../data");67 dataDirDialog->setOpenUpButton(dataDirButton);68 dataDirDialog->setChangeOption(dataDirLabel);69 updateBox->fill(dataDirLabel);70 updateBox->fill(dataDirButton);71 78 72 79 … … 78 85 79 86 #else /* HAVE_CURL */ 80 Label* noCurlLabel = new Label("since you do not have cURL ,\nthis option isnot availible");87 Label* noCurlLabel = new Label("since you do not have cURL-support,\nupdate options are not availible"); 81 88 this->updateBox->fill(noCurlLabel); 82 89 #endif /* HAVE_CURL */ … … 94 101 95 102 } 103 104 /** 105 \brief checks if the Folder containing selected File is data.oxd, and if so sets it. 106 \param 107 */ 108 bool GuiUpdate::checkDataDir(const char* fileName, void* object) 109 { 110 if (!strcmp(fileName+(strlen(fileName)-strlen(DATA_IDENTIFIER)), DATA_IDENTIFIER)) 111 { 112 char* tmpName = new char[strlen(fileName)-strlen(DATA_IDENTIFIER)+1]; 113 strncpy(tmpName, fileName, strlen(fileName)-strlen(DATA_IDENTIFIER)); 114 tmpName[strlen(fileName)-strlen(DATA_IDENTIFIER)] = '\0'; 115 static_cast<OptionLabel*>(object)->setValue(tmpName); 116 delete tmpName; 117 return true; 118 } 119 else 120 return false; 121 } 122 96 123 97 124 /** -
orxonox/trunk/src/lib/gui/gui/gui_update.h
r4061 r4083 10 10 #include "gui_element.h" 11 11 #include "gui_gtk.h" 12 13 14 #define DATA_IDENTIFIER "data.oxd" 12 15 13 16 #include <stdio.h> … … 59 62 static gint updateSourceFunc(GtkWidget* w, GdkEventKey* event, void* info); 60 63 #endif /* HAVE_GTK2 */ 64 65 static bool checkDataDir(const char* fileName, void* object); 61 66 62 67 #ifdef HAVE_CURL
Note: See TracChangeset
for help on using the changeset viewer.