Changeset 4068 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 5, 2005, 9:34:08 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_exec.cc
r4062 r4068 69 69 this->saveSettings->saveability(); 70 70 execBox->fill(this->saveSettings); 71 71 72 verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem"); 72 73 verboseMode->setFlagName("verbose", "v", 2); 73 74 verboseMode->saveability(); 74 75 execBox->fill(verboseMode); 76 75 77 alwaysShow = new CheckButton("Always Show this Menu"); 76 78 alwaysShow->setFlagName("gui", "g", 0); 77 79 alwaysShow->saveability(); 78 80 execBox->fill(alwaysShow); 81 79 82 quit = new Button("Quit"); 80 83 #ifdef HAVE_GTK2 -
orxonox/trunk/src/lib/gui/gui/gui_gtk.cc
r4062 r4068 772 772 \brief Creates a new Frame with name title 773 773 */ 774 Frame::Frame(c har* frameName)774 Frame::Frame(const char* frameName) 775 775 { 776 776 #ifdef HAVE_GTK2 … … 1475 1475 strcpy(this->cValue, newValue); 1476 1476 #ifdef HAVE_GTK2 1477 gtk_label_set_text(GTK_LABEL(this->widget), this->cValue);1477 gtk_label_set_text(GTK_LABEL(this->widget), newValue); 1478 1478 #endif /* HAVE_GTK2 */ 1479 1479 } … … 1495 1495 { 1496 1496 #ifdef HAVE_GTK2 1497 this->cValue = (char*)gtk_label_get_text(GTK_LABEL(this->widget));1497 this->cValue = (char*)gtk_label_get_text(GTK_LABEL(this->widget)); 1498 1498 #else /* HAVE_GTK2 */ 1499 1499 PRINT(0)("\nPlease give me a new input for %s: ", this->title); … … 1736 1736 strcpy(this->title, name); 1737 1737 } 1738 1739 1740 ///////////////// 1741 /* FILE DIALOG */ 1742 ///////////////// 1743 /** 1744 \brief Creates a new FileDialog 1745 \param fileDialogName a Name for the Dialog 1746 */ 1747 FileDialog::FileDialog(const char* fileDialogName) 1748 { 1749 this->isOption = 0; 1750 this->isOpen = false; 1751 this->changeOption = NULL; 1752 this->openUpButton = NULL; 1753 1754 #ifdef HAVE_GTK2 1755 this->widget = gtk_file_selection_new(fileDialogName); 1756 g_signal_connect(GTK_FILE_SELECTION (this->widget)->cancel_button, 1757 "button_release_event", 1758 G_CALLBACK (FileDialog::dialogClose), 1759 this); 1760 g_signal_connect(GTK_FILE_SELECTION (this->widget), 1761 "delete_event", 1762 G_CALLBACK (FileDialog::dialogClose), 1763 this); 1764 g_signal_connect(GTK_FILE_SELECTION (this->widget)->ok_button, 1765 "button_release_event", 1766 G_CALLBACK (FileDialog::dialogOK), 1767 this); 1768 #endif /* HAVE_GTK2 */ 1769 if (fileDialogName) 1770 this->setTitle(fileDialogName); 1771 } 1772 1773 /** 1774 \brief destructs a FileDialog 1775 */ 1776 FileDialog::~FileDialog(void) 1777 { 1778 PRINTF(5)("deleting FileDialog %s\n", this->title); 1779 } 1780 1781 void FileDialog::setChangeOption(OptionLabel* changeOption) 1782 { 1783 this->changeOption = changeOption; 1784 } 1785 1786 void FileDialog::setOpenUpButton(Button* openUpButton) 1787 { 1788 this->openUpButton = openUpButton; 1789 1790 openUpButton->connectSignal("button_release_event", this, FileDialog::dialogOpen); 1791 } 1792 1793 1794 void FileDialog::setDefaultFileName(const char* defaultFileName) 1795 { 1796 #ifdef HAVE_GTK2 1797 gtk_file_selection_set_filename (GTK_FILE_SELECTION(this->widget), defaultFileName); 1798 #endif /* HAVE_GTK2 */ 1799 } 1800 1801 void FileDialog::setMask(const char* mask) 1802 { 1803 #ifdef HAVE_GTK2 1804 gtk_file_selection_complete(GTK_FILE_SELECTION(this->widget), mask); 1805 #endif /* HAVE_GTK2 */ 1806 } 1807 1808 void FileDialog::okEvent(void) 1809 { 1810 if (this->changeOption) 1811 #ifdef HAVE_GTK2 1812 changeOption->setValue(gtk_file_selection_get_filename(GTK_FILE_SELECTION(this->widget))); 1813 #endif /* HAVE_GTK2 */ 1814 this->close(); 1815 } 1816 1817 void FileDialog::open(void) 1818 { 1819 isOpen = true; 1820 #ifdef HAVE_GTK2 1821 gtk_widget_show_all(this->widget); 1822 gtk_grab_add(this->widget); 1823 #endif /* HAVE_GTK2 */ 1824 } 1825 1826 void FileDialog::close(void) 1827 { 1828 this->isOpen = false; 1829 #ifdef HAVE_GTK2 1830 gtk_grab_remove(this->widget); 1831 gtk_widget_hide(this->widget); 1832 #endif /* HAVE_GTK2 */ 1833 } 1834 1835 #ifdef HAVE_GTK2 1836 gint FileDialog::dialogOK(GtkWidget* widget, GdkEvent* event, void* dialog) 1837 { 1838 static_cast<FileDialog*>(dialog)->okEvent(); 1839 } 1840 #else /* HAVE_GTK2 */ 1841 int FileDialog::dialogOK(void* widget, void* event, void* dialog){} 1842 #endif /* HAVE_GTK2 */ 1843 1844 #ifdef HAVE_GTK2 1845 gint FileDialog::dialogOpen(GtkWidget* widget, GdkEvent* event, void* dialog) 1846 { 1847 static_cast<FileDialog*>(dialog)->open(); 1848 } 1849 #else /* HAVE_GTK2 */ 1850 int FileDialog::dialogOpen(void* widget, void* event, void* dialog){} 1851 #endif /* HAVE_GTK2 */ 1852 1853 #ifdef HAVE_GTK2 1854 gint FileDialog::dialogClose(GtkWidget* widget, GdkEvent* event, void* dialog) 1855 { 1856 static_cast<FileDialog*>(dialog)->close(); 1857 } 1858 #else /* HAVE_GTK2 */ 1859 int FileDialog::dialogClose(void* widget, void* event, void* dialog){} 1860 #endif /* HAVE_GTK2 */ -
orxonox/trunk/src/lib/gui/gui/gui_gtk.h
r4064 r4068 28 28 #include <gtk/gtkeventbox.h> 29 29 #include <gtk/gtkprogressbar.h> 30 #include <gtk/gtkfilesel.h> 30 31 #endif /* HAVE_GTK2 */ 31 32 … … 184 185 { 185 186 public: 186 Frame(c har* frameName = NULL);187 Frame(const char* frameName = NULL); 187 188 virtual ~Frame(void); 188 189 … … 420 421 }; 421 422 422 //gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data); 423 //! A FileDialog is a window with wich one can select a File 424 class FileDialog : public Widget 425 { 426 private: 427 OptionLabel* changeOption; 428 Button* openUpButton; 429 bool isOpen; 430 public: 431 FileDialog(const char* fileDialogName); 432 virtual ~FileDialog(void); 433 434 void setChangeOption(OptionLabel* changeOption); 435 void setOpenUpButton(Button* openUpButton); 436 void setDefaultFileName(const char* defaultFileName); 437 void setMask(const char* mask); 438 439 void okEvent(); 440 void open(); 441 void close(); 442 443 #ifdef HAVE_GTK2 444 static gint dialogOK(GtkWidget* widget, GdkEvent* event, void* dialog); 445 static gint dialogOpen(GtkWidget* widget, GdkEvent* event, void* dialog); 446 static gint dialogClose(GtkWidget* widget, GdkEvent* event, void* dialog); 447 #else /* HAVE_GTK2 */ 448 static int dialogOK(void* widget, void* event, void* dialog); 449 static int dialogOpen(void* widget, void* event, void* dialog); 450 static int dialogClose(void* widget, void* event, void* dialog); 451 #endif /* HAVE_GTK2 */ 452 }; 423 453 424 454 #endif /* _GUI_GTK_H */ -
orxonox/trunk/src/lib/gui/gui/gui_update.cc
r4064 r4068 37 37 GuiUpdate::GuiUpdate(void) 38 38 { 39 FileDialog* dataDirDialog; //!< A FileDialog for the selection of the DataRepos 40 Button* dataDirButton; //!< A Button for the selection of the DataRepos 41 OptionLabel* dataDirLabel; //!< A Label fot the selection of the DataRepos 42 39 43 this->tmpDir = NULL; 40 44 this->homeDir = NULL; … … 54 58 this->autoUpdate->setFlagName("update", "u", 0); 55 59 this->autoUpdate->saveability(); 60 61 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 56 72 57 73 this->updateSourceWindowCreate(); … … 67 83 this->updateFrame->fill(this->updateBox); 68 84 this->setMainWidget(this->updateFrame); 85 86 69 87 } 70 88 -
orxonox/trunk/src/lib/gui/gui/gui_video.cc
r4064 r4068 154 154 155 155 closeButton = new Button("close"); 156 #ifdef HAVE_GTK2 156 157 closeButton->connectSignal("button_press_event", advancedWindow, Window::windowClose); 158 #endif /* HAVE_GTK2 */ 157 159 158 160 advancedBox->fill(closeButton);
Note: See TracChangeset
for help on using the changeset viewer.