home *** CD-ROM | disk | FTP | other *** search
- <?php
-
- if (!class_exists('gtk')) {
- if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
- dl('php_gtk.dll');
- else
- dl('php_gtk.so');
- }
-
- function delete_event()
- {
- return false;
- }
-
- function destroy()
- {
- gtk::main_quit();
- }
-
- function create_shortcut()
- {
- global $dir_entry, $name_entry, $adr_entry;
-
- $filename = $dir_entry->get_text().$name_entry->get_text();
- $file = fopen($filename, "w") or die("\nSoubor nelze vytvorit!\n");
-
- fputs($file, "[DEFAULT]\nBASEURL=".$adr_entry->get_text()."\n");
- fputs($file, "[InternetShortcut]\nURL=".$adr_entry->get_text()."\n");
-
- fclose($file) or die("Soubor nelze uzavrit!");
-
- $name_entry->set_text(".url");
- $name_entry->set_position(0);
- $adr_entry->set_text("http://");
- }
-
- $window = &new GtkWindow();
- $window->connect("destroy","destroy");
- $window->connect("delete_event","delete_event");
- $window->set_usize(350, 150);
- $window->set_title("Novy zastupce URL");
- $window->set_border_width(4);
- $window->set_position(GTK_WIN_POS_CENTER);
-
- $table = &new GtkTable(4, 2);
- $window->add($table);
-
- $dir_label = &new GtkLabel("Adresar");
- $table->attach($dir_label, 0, 1, 0, 1);
- $name_label = &new GtkLabel("Jmeno");
- $table->attach($name_label, 0, 1, 1, 2);
- $adr_label = &new GtkLabel("URL adresa");
- $table->attach($adr_label, 0, 1, 2, 3);
-
- $dir_entry = &new GtkEntry();
- $dir_entry->set_text("C:\\Documents and Settings\\petr\\Plocha\\");
- $table->attach($dir_entry, 1, 2, 0, 1);
- $name_entry = &new GtkEntry();
- $name_entry->set_text(".url");
- $name_entry->set_position(0);
- $table->attach($name_entry, 1, 2, 1, 2);
- $adr_entry = &new GtkEntry();
- $adr_entry->set_text("http://");
- $table->attach($adr_entry, 1, 2, 2, 3);
-
- $button = &new GtkButton("Create!");
- $button->connect("clicked", "create_shortcut");
- $table->attach($button, 0, 2, 3, 4);
-
- $tip = &new GtkTooltips();
- $tip->set_delay(200);
- $tip->set_tip($button, "Vytvori zastupce URL");
-
- $window->set_focus($name_entry);
- $window->show_all();
-
- gtk::main();
-
- ?>