Changeset 73


Ignore:
Timestamp:
May 23, 2001, 6:59:40 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/winh.h

    r71 r73  
    205205                                    USHORT afAttribute);
    206206
     207    BOOL XWPENTRY winhSetMenuCondCascade(HWND hwndMenu,
     208                                         LONG lDefaultItem);
     209
    207210    /*
    208211     *@@ winhRemoveMenuItem:
  • trunk/src/helpers/dosh.c

    r69 r73  
    22342234    if (strlen(pcszExecWithArgs) > 255)
    22352235        arc = ERROR_INSUFFICIENT_BUFFER;
     2236    else
    22362237    {
    22372238        CHAR szObj[CCHMAXPATH];
  • trunk/src/helpers/stringh.c

    r69 r73  
    11521152 *
    11531153 *      <B>Example:</B>
    1154  +          strhFindAttribValue("<PAGE BLAH="data">, "BLAH")
     1154 +          strhFindAttribValue("<PAGE BLAH=\"data\">", "BLAH")
    11551155 +
    11561156 +          returns ....................... ^ this address.
     
    11581158 *@@added V0.9.0 [umoeller]
    11591159 *@@changed V0.9.3 (2000-05-19) [umoeller]: some speed optimizations
     1160 *@@changed V0.9.12 (2001-05-22) [umoeller]: fixed space bug, thanks Yuri Dario
    11601161 */
    11611162
    11621163PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib)
     1164{
     1165   PSZ    prc = 0;
     1166   PSZ    pszSearchIn2, p;
     1167   ULONG  cbAttrib = strlen(pszAttrib),
     1168          ulLength = strlen(pszSearchIn);
     1169
     1170   // use alloca(), so memory is freed on function exit
     1171   pszSearchIn2 = (PSZ)alloca(ulLength + 1);
     1172   memcpy(pszSearchIn2, pszSearchIn, ulLength + 1);
     1173
     1174   // 1) find token, (space char, \n, \r, \t)
     1175   p = strtok(pszSearchIn2, " \n\r\t");
     1176   while (p)
     1177   {
     1178        CHAR c2;
     1179        PSZ pOrig;
     1180
     1181        // check tag name
     1182        if (!strnicmp(p, pszAttrib, cbAttrib))
     1183        {
     1184            // position in original string
     1185            pOrig = (PSZ)pszSearchIn + (p - pszSearchIn2);
     1186
     1187            // yes:
     1188            prc = pOrig + cbAttrib;
     1189            c2 = *prc;
     1190            while (   (   (c2 == ' ')
     1191                       || (c2 == '=')
     1192                       || (c2 == '\n')
     1193                       || (c2 == '\r')
     1194                      )
     1195                    && (c2 != 0)
     1196                  )
     1197                c2 = *++prc;
     1198
     1199            break;
     1200        }
     1201
     1202        p = strtok(NULL, " \n\r\t");
     1203   }
     1204
     1205   return (prc);
     1206}
     1207
     1208/* PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib)
    11631209{
    11641210    PSZ     prc = 0;
     
    12111257    }
    12121258    return (prc);
    1213 }
     1259} */
    12141260
    12151261/*
  • trunk/src/helpers/winh.c

    r71 r73  
    448448    }
    449449    return (hwndNewMenu);
     450}
     451
     452/*
     453 *@@ winhSetMenuCondCascade:
     454 *      sets the "conditional cascade" style
     455 *      on the specified submenu.
     456 *
     457 *      This style must always be enabled manually
     458 *      because the resource compiler won't handle it.
     459 *
     460 *      Note: Pass in the _submenu_ window handle,
     461 *      not the one of the parent. With lDefaultItem,
     462 *      specify the item ID in the submenu which is
     463 *      to be checked as the default item.
     464 *
     465 *@@added V0.9.12 (2001-05-22) [umoeller]
     466 */
     467
     468BOOL winhSetMenuCondCascade(HWND hwndMenu,          // in: submenu handle
     469                            LONG lDefaultItem)      // in: item ID of new default item
     470{
     471    // stolen from the Warp Toolkit WPS Guide
     472    ULONG ulStyle = WinQueryWindowULong(hwndMenu, QWL_STYLE);
     473    ulStyle |= MS_CONDITIONALCASCADE;
     474    WinSetWindowULong(hwndMenu, QWL_STYLE, ulStyle);
     475
     476    // make the first item in the subfolder
     477    // the default of cascading submenu */
     478    return (BOOL)(WinSendMsg(hwndMenu,
     479                             MM_SETDEFAULTITEMID,
     480                             (MPARAM)lDefaultItem,
     481                             0));
    450482}
    451483
Note: See TracChangeset for help on using the changeset viewer.