From: <mie...@us...> - 2008-11-06 01:40:57
|
Revision: 3656 http://oorexx.svn.sourceforge.net/oorexx/?rev=3656&view=rev Author: miesfeld Date: 2008-11-06 01:40:04 +0000 (Thu, 06 Nov 2008) Log Message: ----------- Add a couple of methods to the MenuObject and the WindowObject in winsystm.cls Modified Paths: -------------- main/trunk/extensions/platform/windows/rxwinsys/rxwinsys.cpp main/trunk/extensions/platform/windows/rxwinsys/winsystm.cls Modified: main/trunk/extensions/platform/windows/rxwinsys/rxwinsys.cpp =================================================================== --- main/trunk/extensions/platform/windows/rxwinsys/rxwinsys.cpp 2008-11-05 18:08:28 UTC (rev 3655) +++ main/trunk/extensions/platform/windows/rxwinsys/rxwinsys.cpp 2008-11-06 01:40:04 UTC (rev 3656) @@ -3404,6 +3404,29 @@ } return 0; } + else if (!strcmp(argv[0].strptr,"GETSTYLE")) + { + CHECKARG(2,2); + GET_HANDLE(argv[1].strptr, hW); + if (hW) + { + WINDOWINFO wi; + + wi.cbSize = sizeof(WINDOWINFO); + if ( GetWindowInfo(hW, &wi) ) + { + _snprintf(retstr->strptr, RXAUTOBUFLEN, "0x%08x 0x%08x", wi.dwStyle, wi.dwExStyle); + retstr->strlength = strlen(retstr->strptr); + return 0; + } + else + { + _snprintf(retstr->strptr, RXAUTOBUFLEN, "%d", GetLastError()); + retstr->strlength = strlen(retstr->strptr); + return 0; + } + } + } else if (!strcmp(argv[0].strptr,"ENABLE")) { CHECKARG(3,3); @@ -3697,11 +3720,41 @@ } else if (!strcmp(argv[0].strptr,"STATE")) { - CHECKARG(2,2); + CHECKARG(2,4); HMENU hMenu; GET_HANDLE(argv[1].strptr, hMenu); - RETVAL(IsMenu(hMenu)); + + if ( argc == 2 ) + { + RETVAL(IsMenu(hMenu)); + } + + CHECKARG(4,4); + + UINT flags; + UINT pos = atoi(argv[3].strptr); + + flags = GetMenuState(hMenu, pos, MF_BYPOSITION); + + if ( flags == 0xffffffff ) + { + // Error, most likely no such position. Return false. + RETVAL(0); + } + + if ( argv[2].strptr[0] == 'M' ) + { + RETVAL((flags & MF_POPUP) ? 1 : 0); + } + else if ( argv[2].strptr[0] == 'C' ) + { + RETVAL((flags & MF_CHECKED) ? 1 : 0); + } + else + { + RETVAL((flags & MF_SEPARATOR) ? 1 : 0); + } } RETC(1) /* in this case 0 is an error */ Modified: main/trunk/extensions/platform/windows/rxwinsys/winsystm.cls =================================================================== --- main/trunk/extensions/platform/windows/rxwinsys/winsystm.cls 2008-11-05 18:08:28 UTC (rev 3655) +++ main/trunk/extensions/platform/windows/rxwinsys/winsystm.cls 2008-11-06 01:40:04 UTC (rev 3656) @@ -735,6 +735,9 @@ ::method State return WSCtrlWindow("GETSTATE", self~hwnd) +::method getStyle + return WSCtrlWindow("GETSTYLE", self~hwnd) + ::method Restore return WSCtrlWindow("SHOW", self~hwnd, "RESTORE") @@ -841,10 +844,9 @@ use arg message, wParam, lParam return WSCtrlSend("MSG", self~hwnd, message, wParam, lParam) --- TODO, document that cmd has to be a hexidecimal number or string in 0x format ::method SendCommand use arg cmd - self~SendMessage("0x111", cmd, 0) + self~SendMessage("0x111", cmd~d2x, 0) ::method SendMenuCommand use arg cmd @@ -1023,6 +1025,22 @@ ::method IsMenu return WSCtrlMenu("STATE", self~hwnd) +::method IsSubMenu + use strict arg pos + return WSCtrlMenu("STATE", self~hwnd, "MENU", pos) + +/* This method can not be 100% reliable. Some applications do not set the check + * mark for a menu item until the menu is displayed. To be confident of the + * result, the user should first test how a specific application behaves. + */ +::method IsChecked + use strict arg pos + return WSCtrlMenu("STATE", self~hwnd, "CHECK", pos) + +::method IsSeparator + use strict arg pos + return WSCtrlMenu("STATE", self~hwnd, "SEPARTOR", pos) + ::method IdOf use arg pos if Arg(1,'o') = 1 then return 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |