Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : proto

Dir     : e17/proto/etk_server/examples


Modified Files:
        etk.php etk.pl etk.py etk.rb 
Added Files:
        todo 


Log Message:
- more functionality
- more work on examples
- temporarily added valid_funcs and valid_signals, will be autogenerated

===================================================================
RCS file: /cvs/e/e17/proto/etk_server/examples/etk.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etk.php     21 Mar 2006 08:41:15 -0000      1.4
+++ etk.php     28 Mar 2006 07:40:53 -0000      1.5
@@ -1,4 +1,3 @@
-#!/usr/local/bin/php -q
 <?php
 
 /* Etk-Php Demo. Requires Php 5.x */
@@ -16,221 +15,222 @@
     const StockSizeMedium = 1;
     const StockSizeBig = 2;
 
-    const StockNO_STOCK = 0;
-    const StockADDRESS_BOOK_NEW = 1;
-    const StockAPPOINTMENT_NEW = 2;
-    const StockBOOKMARK_NEW = 3;
-    const StockCONTACT_NEW = 4;
+    const StockNoStock = 0;
+    const StockAddressBookNew = 1;
+    const StockAppointmentNew = 2;
+    const StockBookmarkNew = 3;
+    const StockContactNew = 4;
     const StockDialogOk = 5;
     const StockDialogCancel = 6;
-    const StockDIALOG_YES = 7;
-    const StockDIALOG_NO = 8;
-    const StockDIALOG_CLOSE = 9;
-    const StockDOCUMENT_NEW = 10;
-    const StockDOCUMENT_OPEN = 11;
-    const StockDOCUMENT_PRINT = 12;
-    const StockDOCUMENT_PRINT_PREVIEW = 13;
-    const StockDOCUMENT_PROPERTIES = 14;
-    const StockDOCUMENT_SAVE_AS = 15;
-    const StockDOCUMENT_SAVE = 16;
-    const StockEDIT_CLEAR = 17;
-    const StockEDIT_COPY = 18;
-    const StockEDIT_CUT = 19;
-    const StockEDIT_FIND = 20;
-    const StockEDIT_PASTE = 21;
-    const StockEDIT_REDO = 22;
-    const StockEDIT_UNDO = 23;
-    const StockEDIT_DELETE = 24;
-    const StockEDIT_FIND_REPLACE = 25;
-    const StockEDIT_SELECT_ALL = 26;
-    const StockFOLDER_NEW = 27;
-    const StockFORMAT_INDENT_LESS = 28;
-    const StockFORMAT_INDENT_MORE = 29;
-    const StockFORMAT_JUSTIFY_CENTER = 30;
-    const StockFORMAT_JUSTIFY_FILL = 31;
-    const StockFORMAT_JUSTIFY_LEFT = 32;
-    const StockFORMAT_JUSTIFY_RIGHT = 33;
-    const StockFORMAT_TEXT_BOLD = 34;
-    const StockFORMAT_TEXT_ITALIC = 35;
-    const StockFORMAT_TEXT_STRIKETHROUGH = 36;
-    const StockFORMAT_TEXT_UNDERLINE = 37;
-    const StockGO_BOTTOM = 38;
-    const StockGO_DOWN = 39;
-    const StockGO_FIRST = 40;
-    const StockGO_HOME = 41;
-    const StockGO_JUMP = 42;
-    const StockGO_LAST = 43;
-    const StockGO_NEXT = 44;
-    const StockGO_PREVIOUS = 45;
-    const StockGO_TOP = 46;
-    const StockGO_UP = 47;
-    const StockLIST_ADD = 48;
-    const StockLIST_REMOVE = 49;
-    const StockMAIL_MESSAGE_NEW = 50;
-    const StockMAIL_FORWARD = 51;
-    const StockMAIL_MARK_JUNK = 52;
-    const StockMAIL_REPLY_ALL = 53;
-    const StockMAIL_REPLY_SENDER = 54;
-    const StockMAIL_SEND_RECEIVE = 55;
-    const StockMEDIA_EJECT = 56;
-    const StockMEDIA_PLAYBACK_PAUSE = 57;
-    const StockMEDIA_PLAYBACK_START = 58;
-    const StockMEDIA_PLAYBACK_STOP = 59;
-    const StockMEDIA_RECORD = 60;
-    const StockMEDIA_SEEK_BACKWARD = 61;
-    const StockMEDIA_SEEK_FORWARD = 62;
-    const StockMEDIA_SKIP_BACKWARD = 63;
-    const StockMEDIA_SKIP_FORWARD = 64;
-    const StockPROCESS_STOP = 65;
-    const StockSYSTEM_LOCK_SCREEN = 66;
-    const StockSYSTEM_LOG_OUT = 67;
-    const StockSYSTEM_SEARCH = 68;
-    const StockSYSTEM_SHUTDOWN = 69;
-    const StockTAB_NEW = 70;
-    const StockVIEW_REFRESH = 71;
-    const StockWINDOW_NEW = 72;
-    const StockACCESSORIES_CALCULATOR = 73;
-    const StockACCESSORIES_CHARACTER_MAP = 74;
-    const StockACCESSORIES_TEXT_EDITOR = 75;
-    const StockHELP_BROWSER = 76;
-    const StockINTERNET_GROUP_CHAT = 77;
-    const StockINTERNET_MAIL = 78;
-    const StockINTERNET_NEWS_READER = 79;
-    const StockINTERNET_WEB_BROWSER = 80;
-    const StockMULTIMEDIA_VOLUME_CONTROL = 81;
-    const StockOFFICE_CALENDAR = 82;
-    const StockPREFERENCES_DESKTOP_ACCESSIBILITY = 83;
-    const StockPREFERENCES_DESKTOP_ASSISTIVE_TECHNOLOGY = 84;
-    const StockPREFERENCES_DESKTOP_FONT = 85;
-    const StockPREFERENCES_DESKTOP_KEYBOARD_SHORTCUTS = 86;
-    const StockPREFERENCES_DESKTOP_LOCALE = 87;
-    const StockPREFERENCES_DESKTOP_REMOTE_DESKTOP = 88;
-    const StockPREFERENCES_DESKTOP_SOUND = 89;
-    const StockPREFERENCES_DESKTOP_SCREENSAVER = 90;
-    const StockPREFERENCES_DESKTOP_THEME = 91;
-    const StockPREFERENCES_DESKTOP_WALLPAPER = 92;
-    const StockPREFERENCES_SYSTEM_NETWORK_PROXY = 93;
-    const StockPREFERENCES_SYSTEM_SESSION = 94;
-    const StockPREFERENCES_SYSTEM_WINDOWS = 95;
-    const StockSYSTEM_FILE_MANAGER = 96;
-    const StockSYSTEM_INSTALLER = 97;
-    const StockSYSTEM_SOFTWARE_UPDATE = 98;
-    const StockSYSTEM_USERS = 99;
-    const StockUTILITIES_SYSTEM_MONITOR = 100;
-    const StockUTILITIES_TERMINAL = 101;
-    const StockAPPLICATIONS_ACCESSORIES = 102;
-    const StockAPPLICATIONS_DEVELOPMENT = 103;
-    const StockAPPLICATIONS_GAMES = 104;
-    const StockAPPLICATIONS_GRAPHICS = 105;
-    const StockAPPLICATIONS_INTERNET = 106;
-    const StockAPPLICATIONS_MULTIMEDIA = 107;
-    const StockAPPLICATIONS_OFFICE = 108;
-    const StockAPPLICATIONS_OTHER = 109;
-    const StockAPPLICATIONS_SYSTEM = 110;
-    const StockPREFERENCES_DESKTOP_PERIPHERALS = 111;
-    const StockPREFERENCES_DESKTOP = 112;
-    const StockPREFERENCES_SYSTEM = 113;
-    const StockAUDIO_CARD = 114;
-    const StockAUDIO_INPUT_MICROPHONE = 115;
-    const StockBATTERY = 116;
-    const StockCAMERA_PHOTO = 117;
-    const StockCAMERA_VIDEO = 118;
-    const StockCOMPUTER = 119;
-    const StockDRIVE_CDROM = 120;
-    const StockDRIVE_HARDDISK = 121;
-    const StockDRIVE_REMOVABLE_MEDIA = 122;
-    const StockINPUT_GAMING = 123;
-    const StockINPUT_KEYBOARD = 124;
-    const StockINPUT_MOUSE = 125;
-    const StockMEDIA_CDROM = 126;
-    const StockMEDIA_FLOPPY = 127;
-    const StockMULTIMEDIA_PLAYER = 128;
-    const StockNETWORK = 129;
-    const StockNETWORK_WIRELESS = 130;
-    const StockNETWORK_WIRED = 131;
-    const StockPRINTER = 132;
-    const StockPRINTER_REMOTE = 133;
-    const StockVIDEO_DISPLAY = 134;
-    const StockEMBLEM_FAVORITE = 135;
-    const StockEMBLEM_IMPORTANT = 136;
-    const StockEMBLEM_PHOTOS = 137;
-    const StockEMBLEM_READONLY = 138;
-    const StockEMBLEM_SYMBOLIC_LINK = 139;
-    const StockEMBLEM_SYSTEM = 140;
-    const StockEMBLEM_UNREADABLE = 141;
-    const StockFACE_ANGEL = 142;
-    const StockFACE_CRYING = 143;
-    const StockFACE_DEVIL_GRIN = 144;
-    const StockFACE_GLASSES = 145;
-    const StockFACE_GRIN = 146;
-    const StockFACE_KISS = 147;
-    const StockFACE_PLAIN = 148;
-    const StockFACE_SAD = 149;
-    const StockFACE_SMILE_BIG = 150;
-    const StockFACE_SMILE = 151;
-    const StockFACE_SURPRISE = 152;
-    const StockFACE_WINK = 153;
-    const StockAPPLICATION_CERTIFICATE = 154;
-    const StockAPPLICATION_X_EXECUTABLE = 155;
-    const StockAUDIO_X_GENERIC = 156;
-    const StockFONT_X_GENERIC = 157;
-    const StockIMAGE_X_GENERIC = 158;
-    const StockPACKAGE_X_GENERIC = 159;
-    const StockTEXT_HTML = 160;
-    const StockTEXT_X_GENERIC = 161;
-    const StockTEXT_X_GENERIC_TEMPLATE = 162;
-    const StockTEXT_X_SCRIPT = 163;
-    const StockVIDEO_X_GENERIC = 164;
-    const StockX_DIRECTORY_DESKTOP = 165;
-    const StockX_DIRECTORY_NORMAL_DRAG_ACCEPT = 166;
-    const StockX_DIRECTORY_NORMAL_HOME = 167;
-    const StockX_DIRECTORY_NORMAL_OPEN = 168;
-    const StockX_DIRECTORY_NORMAL = 169;
-    const StockX_DIRECTORY_NORMAL_VISITING = 170;
-    const StockX_DIRECTORY_REMOTE = 171;
-    const StockX_DIRECTORY_REMOTE_SERVER = 172;
-    const StockX_DIRECTORY_REMOTE_WORKGROUP = 173;
-    const StockX_DIRECTORY_TRASH_FULL = 174;
-    const StockX_DIRECTORY_TRASH = 175;
-    const StockX_OFFICE_ADDRESS_BOOK = 176;
-    const StockX_OFFICE_CALENDAR = 177;
-    const StockX_OFFICE_DOCUMENT = 178;
-    const StockX_OFFICE_PRESENTATION = 179;
-    const StockX_OFFICE_SPREADSHEET = 180;
-    const StockPLACES_FOLDER = 181;
-    const StockPLACES_FOLDER_REMOTE = 182;
-    const StockPLACES_FOLDER_SAVED_SEARCH = 183;
-    const StockPLACES_NETWORK_SERVER = 184;
-    const StockPLACES_NETWORK_WORKGROUP = 185;
-    const StockPLACES_START_HERE = 186;
-    const StockPLACES_USER_DESKTOP = 187;
-    const StockPLACES_USER_HOME = 188;
-    const StockPLACES_USER_TRASH = 189;
-    const StockAUDIO_VOLUME_HIGH = 190;
-    const StockAUDIO_VOLUME_LOW = 191;
-    const StockAUDIO_VOLUME_MEDIUM = 192;
-    const StockAUDIO_VOLUME_MUTED = 193;
-    const StockBATTERY_CAUTION = 194;
-    const StockDIALOG_ERROR = 195;
-    const StockDIALOG_INFORMATION = 196;
-    const StockDIALOG_WARNING = 197;
-    const StockDIALOG_QUESTION = 198;
-    const StockFOLDER_DRAG_ACCEPT = 199;
-    const StockFOLDER_OPEN = 200;
-    const StockFOLDER_VISITING = 201;
-    const StockIMAGE_LOADING = 202;
-    const StockIMAGE_MISSING = 203;
-    const StockMAIL_ATTACHMENT = 204;
-    const StockNETWORK_ERROR = 205;
-    const StockNETWORK_IDLE = 206;
-    const StockNETWORK_OFFLINE = 207;
-    const StockNETWORK_ONLINE = 208;
-    const StockNETWORK_RECEIVE = 209;
-    const StockNETWORK_TRANSMIT = 210;
-    const StockNETWORK_TRANSMIT_RECEIVE = 211;
-    const StockNETWORK_WIRELESS_ENCRYPTED = 212;
-    const StockPRINTER_ERROR = 213;
-    const StockUSER_TRASH_FULL = 214;
+    const StockDialogYes = 7;
+    const StockDialogNo = 8;
+    const StockDialogClose = 9;
+    const StockDocumentNew = 10;
+    const StockDocumentOpen = 11;
+    const StockDocumentPrint = 12;
+    const StockDocumentPrintPreview = 13;
+    const StockDocumentProperties = 14;
+    const StockDocumentSaveAs = 15;
+    const StockDocumentSave = 16;
+    const StockEditClear = 17;
+    const StockEditCopy = 18;
+    const StockEditCut = 19;
+    const StockEditFind = 20;
+    const StockEditPaste = 21;
+    const StockEditRedo = 22;
+    const StockEditUndo = 23;
+    const StockEditDelete = 24;
+    const StockEditFindReplace = 25;
+    const StockEditSelectAll = 26;
+    const StockFolderNew = 27;
+    const StockFormatIndentLess = 28;
+    const StockFormatIndentMore = 29;
+    const StockFormatJustifyCenter = 30;
+    const StockFormatJustifyFill = 31;
+    const StockFormatJustifyLeft = 32;
+    const StockFormatJustifyRight = 33;
+    const StockFormatTextBold = 34;
+    const StockFormatTextItalic = 35;
+    const StockFormatTextStrikethrough = 36;
+    const StockFormatTextUnderline = 37;
+    const StockGoBottom = 38;
+    const StockGoDown = 39;
+    const StockGoFirst = 40;
+    const StockGoHome = 41;
+    const StockGoJump = 42;
+    const StockGoLast = 43;
+    const StockGoNext = 44;
+    const StockGoPrevious = 45;
+    const StockGoTop = 46;
+    const StockGoUp = 47;
+    const StockListAdd = 48;
+    const StockListRemove = 49;
+    const StockMailMessageNew = 50;
+    const StockMailForward = 51;
+    const StockMailMarkJunk = 52;
+    const StockMailReplyAll = 53;
+    const StockMailReplySender = 54;
+    const StockMailSendReceive = 55;
+    const StockMediaEject = 56;
+    const StockMediaPlaybackPause = 57;
+    const StockMediaPlaybackStart = 58;
+    const StockMediaPlaybackStop = 59;
+    const StockMediaRecord = 60;
+    const StockMediaSeekBackward = 61;
+    const StockMediaSeekForward = 62;
+    const StockMediaSkipBackward = 63;
+    const StockMediaSkipForward = 64;
+    const StockProcessStop = 65;
+    const StockSystemLockScreen = 66;
+    const StockSystemLogOut = 67;
+    const StockSystemSearch = 68;
+    const StockSystemShutdown = 69;
+    const StockTabNew = 70;
+    const StockViewRefresh = 71;
+    const StockWindowNew = 72;
+    const StockAccessoriesCalculator = 73;
+    const StockAccessoriesCharacterMap = 74;
+    const StockAccessoriesTextEditor = 75;
+    const StockHelpBrowser = 76;
+    const StockInternetGroupChat = 77;
+    const StockInternetMail = 78;
+    const StockInternetNewsReader = 79;
+    const StockInternetWebBrowser = 80;
+    const StockMultimediaVolumeControl = 81;
+    const StockOfficeCalendar = 82;
+    const StockPreferencesDesktopAccessibility = 83;
+    const StockPreferencesDesktopAssistiveTechnology = 84;
+    const StockPreferencesDesktopFont = 85;
+    const StockPreferencesDesktopKeyboardShortcuts = 86;
+    const StockPreferencesDesktopLocale = 87;
+    const StockPreferencesDesktopRemoteDesktop = 88;
+    const StockPreferencesDesktopSound = 89;
+    const StockPreferencesDesktopScreensaver = 90;
+    const StockPreferencesDesktopTheme = 91;
+    const StockPreferencesDesktopWallpaper = 92;
+    const StockPreferencesSystemNetworkProxy = 93;
+    const StockPreferencesSystemSession = 94;
+    const StockPreferencesSystemWindows = 95;
+    const StockSystemFileManager = 96;
+    const StockSystemInstaller = 97;
+    const StockSystemSoftwareUpdate = 98;
+    const StockSystemUsers = 99;
+    const StockUtilitiesSystemMonitor = 100;
+    const StockUtilitiesTerminal = 101;
+    const StockApplicationsAccessories = 102;
+    const StockApplicationsDevelopment = 103;
+    const StockApplicationsGames = 104;
+    const StockApplicationsGraphics = 105;
+    const StockApplicationsInternet = 106;
+    const StockApplicationsMultimedia = 107;
+    const StockApplicationsOffice = 108;
+    const StockApplicationsOther = 109;
+    const StockApplicationsSystem = 110;
+    const StockPreferencesDesktopPeripherals = 111;
+    const StockPreferencesDesktop = 112;
+    const StockPreferencesSystem = 113;
+    const StockAudioCard = 114;
+    const StockAudioInputMicrophone = 115;
+    const StockBattery = 116;
+    const StockCameraPhoto = 117;
+    const StockCameraVideo = 118;
+    const StockComputer = 119;
+    const StockDriveCdrom = 120;
+    const StockDriveHarddisk = 121;
+    const StockDriveRemovableMedia = 122;
+    const StockInputGaming = 123;
+    const StockInputKeyboard = 124;
+    const StockInputMouse = 125;
+    const StockMediaCdrom = 126;
+    const StockMediaFloppy = 127;
+    const StockMultimediaPlayer = 128;
+    const StockNetwork = 129;
+    const StockNetworkWireless = 130;
+    const StockNetworkWired = 131;
+    const StockPrinter = 132;
+    const StockPrinterRemote = 133;
+    const StockVideoDisplay = 134;
+    const StockEmblemFavorite = 135;
+    const StockEmblemImportant = 136;
+    const StockEmblemPhotos = 137;
+    const StockEmblemReadonly = 138;
+    const StockEmblemSymbolicLink = 139;
+    const StockEmblemSystem = 140;
+    const StockEmblemUnreadable = 141;
+    const StockFaceAngel = 142;
+    const StockFaceCrying = 143;
+    const StockFaceDevilGrin = 144;
+    const StockFaceGlasses = 145;
+    const StockFaceGrin = 146;
+    const StockFaceKiss = 147;
+    const StockFacePlain = 148;
+    const StockFaceSad = 149;
+    const StockFaceSmileBig = 150;
+    const StockFaceSmile = 151;
+    const StockFaceSurprise = 152;
+    const StockFaceWink = 153;
+    const StockApplicationCertificate = 154;
+    const StockApplicationXExecutable = 155;
+    const StockAudioXGeneric = 156;
+    const StockFontXGeneric = 157;
+    const StockImageXGeneric = 158;
+    const StockPackageXGeneric = 159;
+    const StockTextHtml = 160;
+    const StockTextXGeneric = 161;
+    const StockTextXGenericTemplate = 162;
+    const StockTextXScript = 163;
+    const StockVideoXGeneric = 164;
+    const StockXDirectoryDesktop = 165;
+    const StockXDirectoryNormalDragAccept = 166;
+    const StockXDirectoryNormalHome = 167;
+    const StockXDirectoryNormalOpen = 168;
+    const StockXDirectoryNormal = 169;
+    const StockXDirectoryNormalVisiting = 170;
+    const StockXDirectoryRemote = 171;
+    const StockXDirectoryRemoteServer = 172;
+    const StockXDirectoryRemoteWorkgroup = 173;
+    const StockXDirectoryTrashFull = 174;
+    const StockXDirectoryTrash = 175;
+    const StockXOfficeAddressBook = 176;
+    const StockXOfficeCalendar = 177;
+    const StockXOfficeDocument = 178;
+    const StockXOfficePresentation = 179;
+    const StockXOfficeSpreadsheet = 180;
+    const StockPlacesFolder = 181;
+    const StockPlacesFolderRemote = 182;
+    const StockPlacesFolderSavedSearch = 183;
+    const StockPlacesNetworkServer = 184;
+    const StockPlacesNetworkWorkgroup = 185;
+    const StockPlacesStartHere = 186;
+    const StockPlacesUserDesktop = 187;
+    const StockPlacesUserHome = 188;
+    const StockPlacesUserTrash = 189;
+    const StockAudioVolumeHigh = 190;
+    const StockAudioVolumeLow = 191;
+    const StockAudioVolumeMedium = 192;
+    const StockAudioVolumeMuted = 193;
+    const StockBatteryCaution = 194;
+    const StockDialogError = 195;
+    const StockDialogInformation = 196;
+    const StockDialogWarning = 197;
+    const StockDialogQuestion = 198;
+    const StockFolderDragAccept = 199;
+    const StockFolderOpen = 200;
+    const StockFolderVisiting = 201;
+    const StockImageLoading = 202;
+    const StockImageMissing = 203;
+    const StockMailAttachment = 204;
+    const StockNetworkError = 205;
+    const StockNetworkIdle = 206;
+    const StockNetworkOffline = 207;
+    const StockNetworkOnline = 208;
+    const StockNetworkReceive = 209;
+    const StockNetworkTransmit = 210;
+    const StockNetworkTransmitReceive = 211;
+    const StockNetworkWirelessEncrypted = 212;
+    const StockPrinterError = 213;
+    const StockUserTrashFull = 214;
+    const StockNumStockIds = 215;
 
     const ResponseNone = -1;
     const ResponseReject = -2;
@@ -255,6 +255,7 @@
 
     function Call($str)
     {
+       print($str."\n");
        if(!$fd = fopen(FIFO, "w"))
        {
            print("Cant open fifo: ". FIFO ."\n");
@@ -299,18 +300,27 @@
     function Main()
     {
        $this->loop = Etk::True;
-
+       $arr = Array();
+       
        while ( $this->loop )
        {
            $event = Etk::Call("server_callback");
-
+           
+           if(strstr($event, " "))
+           {                   
+               $pattern = '/(num|str)="(.*?)(?<!\\\)"/';
+               $tmp = explode(" ", $event, 2);
+               $event = $tmp[0];
+               preg_match_all($pattern, $tmp[1], $arr);
+           }
+           
            if(!is_array(self::$callbacks[$event]))
              continue;
 
            if(array_count_values(self::$callbacks[$event]) > 0)
            {
                foreach(self::$callbacks[$event] as $func)
-                 $func();
+                 $func($arr);
            }
        }
     }
@@ -347,6 +357,11 @@
        $this->Call("server_signal_connect \"$name\" ".$this->Get()." 
\"".$name."_".$this->object."\"");
        $this->AddCallback($name."_".$this->object, $callback);
     }
+    
+    function Destroy()
+    {
+       $this->Call("object_destroy ".$this->Get());
+    }
 }
 
 class Widget extends Object
@@ -445,6 +460,51 @@
            $this->Call("button_image_set ".$this->Get()." ".$image->Get());
        }
     }
+    
+    function Pressed()
+    {
+       $this->Call("button_pressed ".$this->Get());
+    }
+    
+    function Released()
+    {
+       $this->Call("button_released ".$this->Get());
+    }
+    
+    function Clicked()
+    {
+       $this->Call("button_clicked ".$this->Get());
+    }
+    
+    function LabelSet($label)
+    {
+       $this->Call("button_label_set ".$this->Get());
+    }
+    
+    function LabelGet()
+    {
+       $label = $this->Call("button_label_get ".$this->Get());
+       return $this->Call("server_var_get $label");    
+    }
+    
+    function ImageSet($image)
+    {
+       $this->Call("button_image_set ".$this->Get()." ".$image->Get());
+    }
+    
+    function ImageGet()
+    {
+       return $this->Call("button_image_get ".$this->Get());
+    }
+    
+    function AlignmentSet($xalign, $yalign)
+    {
+       $this->Call("button_alignment_set ".$this->Get()." $xalign $yalign");
+    }
+    
+    function AlignmentGet(&$xalign, &$yalign)
+    {
+    }
 }
 
 class CheckButton extends Button
@@ -467,7 +527,7 @@
        $this->Set($this->Call("table_new $num_cols $num_rows $homogeneous"));
     }
 
-    function AttachDefaults(Widget $widget, $left_attach, $right_attach, 
$top_attach, $botton_attach)
+    function AttachDefaults(Widget $widget, $left_attach, $right_attach, 
$top_attach, $bottom_attach)
     {
        $this->Call("table_attach_defaults ".$this->Get()." ".$widget->Get()." 
$left_attach $right_attach $top_attach $bottom_attach");
     }
@@ -509,12 +569,12 @@
 
     function PackMainArea(Widget $widget, $expand = Etk::True, $fill = 
Etk::True, $padding = 0, $pack_at_end = Etk::False)
     {
-       $this->Call("dialog_pack_in_main_area ".$this->Get()." 
".$widget->Get()." $expand $fill $padding $pack_a_end");
+       $this->Call("dialog_pack_in_main_area ".$this->Get()." 
".$widget->Get()." $expand $fill $padding $pack_at_end");
     }
 
     function PackActionArea(Widget $widget, $expand = Etk::True, $fill = 
Etk::True, $padding = 0, $pack_at_end = Etk::False)
     {
-       $this->Call("dialog_pack_in_action_area ".$this->Get()." 
".$widget->Get()." $expand $fill $padding $pack_a_end");
+       $this->Call("dialog_pack_in_action_area ".$this->Get()." 
".$widget->Get()." $expand $fill $padding $pack_at_end");
     }
 
     function PackButtinActionArea(Button $button, $response_id, $expand = 
Etk::True, $fill = Etk::True, $padding = 0, $pack_at_end = Etk::False)
@@ -657,7 +717,7 @@
 
     function ModeSet($mode)
     {
-       $this->Call("tree_mode_set $mode");
+       $this->Call("tree_mode_set ".$this->Get()." $mode");
     }
 
     function Append()
@@ -689,6 +749,26 @@
     {
        $this->Call("tree_build ".$this->Get());
     }
+    
+    function FirstRowGet()
+    {
+       return $this->Call("tree_first_row_get ".$this->Get());
+    }
+    
+    function NextRowGet($row)
+    {
+       return $this->Call("tree_next_row_get ".$this->Get()." $row 0 0");
+    }
+    
+    function PrevRowGet($row)
+    {
+       return $this->Call("tree_prev_row_get ".$this->Get()." $row 0 0");
+    }
+    
+    function LastRowGet()
+    {
+       return $this->Call("tree_last_row_get ".$this->Get()." 0 0");
+    }
 }
 
 /* Main Application */
@@ -711,10 +791,20 @@
 $col4 = new TreeCol($tree, "Deadline", new TreeModelText($tree), 50);
 
 $tree->Build();
-$tree->Append($col1, Etk::False, $col2, "write an Etk-Php todo app", $col3, 
"High", $col4, date("d/m/y"), NULL);
-$tree->Append($col1, Etk::True, $col2, "and make it work!", $col3, "High", 
$col4, date("d/m/y"), NULL);
-$tree->Append($col1, Etk::False, $col2, "create some more classes", $col3, 
"Low", $col4, date("d/m/y"), NULL);
-$tree->Append($col1, Etk::False, $col2, "bind this to sqlite", $col3, 
"Normal", $col4, date("d/m/y"), NULL);
+//$tree->Append($col1, Etk::False, $col2, "write an Etk-Php todo app", $col3, 
"High", $col4, date("d/m/y"), NULL);
+//$tree->Append($col1, Etk::True, $col2, "and make it work!", $col3, "High", 
$col4, date("d/m/y"), NULL);
+//$tree->Append($col1, Etk::False, $col2, "create some more classes", $col3, 
"Low", $col4, date("d/m/y"), NULL);
+//$tree->Append($col1, Etk::False, $col2, "bind this to sqlite", $col3, 
"Normal", $col4, date("d/m/y"), NULL);
+$lines = file("todo");
+foreach($lines as $line)
+{    
+    
+    if(strlen(trim($line)) == 0)
+      continue;
+    
+    $items = explode('?||?||?', $line);
+    $tree->Append($col1, $items[0], $col2, $items[1], $col3, $items[2], $col4, 
$items[3], NULL);
+}  
 
 $hbox = new HBox();
 
@@ -742,39 +832,87 @@
 
 function _new_btn_clicked_cb()
 {
-    $dialog = new Dialog("My Todo");
-    $dialog->ButtonAddFromStock(Etk::StockDialogOk, Etk::ResponseOk);
-    $dialog->ButtonAddFromStock(Etk::StockDialogCancel, Etk::ResponseCancel);
-
-    $frame = new Frame("Add Task");
-    $table = new Table(2, 3, Etk::False);
-    $frame->Add($table);
-
-    $label = new Label("Task:");
-    $entry = new Entry();
-
-    $table->AttachDefaults($label, 0, 0, 0, 0);
-    $table->AttachDefaults($entry, 2, 2, 0, 0);
-
-    $label = new Label("Priority:");
-    $entry = new Entry();
-
-    $table->AttachDefaults($label, 0, 0, 1, 1);
-    $table->AttachDefaults($entry, 2, 2, 1, 1);
-
-    $label = new Label("Deadline:");
-    $entry = new Entry();
-
-    $table->AttachDefaults($label, 0, 0, 2, 2);
-    $table->AttachDefaults($entry, 2, 2, 2, 2);
+    global $dialog;
+    $dialog["dia"] = new Dialog("My Todo");
+    $dialog["dia"]->ButtonAddFromStock(Etk::StockDialogOk, Etk::ResponseOk);
+    $dialog["dia"]->ButtonAddFromStock(Etk::StockDialogCancel, 
Etk::ResponseCancel);
+
+    $dialog["fr"] = new Frame("Add Task");
+    $dialog["tbl"] = new Table(2, 3, Etk::False);
+    $dialog["fr"]->Add($dialog["tbl"]);
+
+    $dialog["lb1"] = new Label("Task:");
+    $dialog["en1"] = new Entry();
+
+    $dialog["tbl"]->AttachDefaults($dialog["lb1"], 0, 0, 0, 0);
+    $dialog["tbl"]->AttachDefaults($dialog["en1"], 2, 2, 0, 0);
+
+    $dialog["lb2"] = new Label("Priority:");
+    $dialog["en2"] = new Entry();
+
+    $dialog["tbl"]->AttachDefaults($dialog["lb2"], 0, 0, 1, 1);
+    $dialog["tbl"]->AttachDefaults($dialog["en2"], 2, 2, 1, 1);
+
+    $dialog["lb3"] = new Label("Deadline:");
+    $dialog["en3"] = new Entry();
+
+    $dialog["tbl"]->AttachDefaults($dialog["lb3"], 0, 0, 2, 2);
+    $dialog["tbl"]->AttachDefaults($dialog["en3"], 2, 2, 2, 2);
+
+    $dialog["dia"]->PackMainArea($dialog["fr"], Etk::False, Etk::False);
+    
+    $dialog["dia"]->SignalConnect("response", _new_dialog_response_cb);
+    $dialog["dia"]->ShowAll();
+}
+
+function _new_dialog_response_cb($args)
+{
+    global $dialog;
+    global $tree;
+    global $col1, $col2, $col3;
+    
+    $response = $args[2][0];
+    if($response == Etk::ResponseOk)
+    {
+       $fd = fopen("todo", "a");
+       if(!$fd)
+         return;
+       
+       $task = $dialog["en1"]->TextGet();
+       $prio = $dialog["en2"]->TextGet();
+       $date = $dialog["en3"]->TextGet();      
+       
+       fputs($fd, "0?||?||?$task?||?||?$prio?||?||?$date\n");  
+       fclose($fd);
+       
+       $tree->Append($col1, Etk::False, $col2, $task, $col3, $prio, $col4, 
$date, NULL);       
+    }
 
-    $dialog->PackMainArea($frame, Etk::False, Etk::False);
-    $dialog->ShowAll();
+    $dialog["dia"]->Destroy();
 }
 
 function _clean_btn_clicked_cb()
 {
-    printf("Clean clicked!\n");
+    global $tree;
+    global $col1, $col2, $col3;
+    
+    $row = $tree->FirstRowGet();
+    $lrow = $tree->LastRowGet();
+
+    return;
+    //print("$row = $lrow\n");
+    
+    $i = 0;    
+
+    print("row $i $row\n");
+    
+    $i++;
+    while($i < 5)
+    {
+       $row = $tree->NextRowGet($row);
+       print("row $i $row\n"); 
+       $i++;
+    }
 }
 
 function _quit_btn_clicked_cb()
===================================================================
RCS file: /cvs/e/e17/proto/etk_server/examples/etk.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk.pl      19 Mar 2006 19:06:15 -0000      1.2
+++ etk.pl      28 Mar 2006 07:40:53 -0000      1.3
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 
 $fifo = "/tmp/etk_server_fifo";
 
===================================================================
RCS file: /cvs/e/e17/proto/etk_server/examples/etk.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk.py      20 Mar 2006 17:33:04 -0000      1.2
+++ etk.py      28 Mar 2006 07:40:53 -0000      1.3
@@ -1,46 +1,98 @@
-#!/usr/bin/python
-
 import os
 import time
 
-def etk(str) :
-    out_file = open("/tmp/etk_server_fifo","w")
-    out_file.write("etk_" + str + "\0")
-    out_file.close()    
+class Etk:
+    "Etk-Python base class"        
+
+    def Init(self):
+       self.Call("init")
     
-    in_file = open("/tmp/etk_server_fifo","r")
-    text = in_file.read()
-    in_file.close()
+    def Connect(self):
+       os.system("etk_server /tmp/etk_server_fifo &")
+       time.sleep(0.5)
+        
+    def Call(self, str):
+       print("sending " + str)
+       out_file = open("/tmp/etk_server_fifo","w")
+       out_file.write("etk_" + str + "\0")
+       out_file.close()    
+       
+       in_file = open("/tmp/etk_server_fifo","r")
+       text = in_file.read()
+       in_file.close()
+       
+       return text
     
-    return text
-
-os.system("etk_server /tmp/etk_server_fifo &")
-time.sleep(0.5)
-
-etk("init")
-
-win = etk("window_new")
+    def Main(self):
+       while 1:            
+           event = self.Call("server_callback")
 
-button = etk("button_new_with_label \"Python rules!\"")
+class Object (Etk):
+    "Etk Object class, has basic object operations"
+    __object = ""
+    
+    def Get(self):
+       return self.__object
+    
+    def Set(self, o):
+       self.__object = o
+       
+    def SignalConnect(self, signal, callback):
+       self.Call("server_signal_connect \"" + signal + "\" " + self.Get() + " 
\"" + signal + "_" + object + "\"")
+       self.AddCallback(signal, callback)
+    
+    def AddCallback(self, callback):
+       print("Adding callback " + callback)
 
-etk("container_add " + win + " " + button)
-etk("window_title_set " + win + " \"Etk-Python Demo\"")
-etk("widget_show_all " + win)
+class Widget (Object):
+    "Etk Widget class, has basic widget operations"
+    
+    def __init__(self):
+       Object()
+    
+    def ShowAll(self):
+       self.Call("widget_show_all " + self.Get())
 
-etk("server_signal_connect \"clicked\" " + button + " \"button_click\"")
-etk("server_signal_connect \"delete_event\" " + win + " \"window_delete\"")
+class Button (Widget):
+    "Etk Button class, has basic button operations"
+    
+    def __init__(self):        
+       self.Set( self.Call("button_new") )
+    
+    def LabelSet(self, label):
+       self.Call("button_label_set " + self.Get() + " \"" + label + "\"")
 
-while 1:
+class Container (Widget):
+    "Etk Container class, has basic container operations"
     
-    event = etk("server_callback")
+    def __init__(self):
+       Widget()
     
-    if event == "window_delete":
-       print "Bye!"
-       break    
+    def Add(self, widget):
+       self.Call("container_add " + self.Get() + " " + widget.Get())
+
+class Window (Container):
+    "Etk Window class, has basic window operations"
     
-    if event == "button_click":
-       print "Button clicked!"
+    def __init__(self):
+       Container()
+       self.Set( self.Call("window_new") )
     
-etk("main_quit")
-etk("server_shutdown")
+    def TitleSet(self, title):
+       self.Call("window_title_set " + self.Get() + " \"" + title + "\"")
+
+etk = Etk()
+etk.Connect()
+etk.Init()
+
+window = Window()
+print("window id is " + window.Get());
+window.TitleSet("Etk-Python")
+
+button = Button()
+button.LabelSet("Python rules!")
+
+window.Add(button)
+window.ShowAll()
 
+etk.Main()
===================================================================
RCS file: /cvs/e/e17/proto/etk_server/examples/etk.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etk.rb      19 Mar 2006 18:49:41 -0000      1.2
+++ etk.rb      28 Mar 2006 07:40:53 -0000      1.3
@@ -1,5 +1,3 @@
-#!/usr/local/bin/ruby
-
 def etk(str)
 
   fifo = File.open("/tmp/etk_server_fifo", "w")




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to