Ignore:
Timestamp:
Dec 5, 2002, 9:36:28 PM (23 years ago)
Author:
umoeller
Message:

New toolbar control.

File:
1 edited

Legend:

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

    r218 r232  
    7171    #define BM_INDETERMINATE       2   // for tri-state checkboxes: indeterminate
    7272
     73    // these undocumented msgs are posted whenever the mouse
     74    // enters or leaves a window V1.0.1 (2002-11-30) [umoeller]
     75    #ifndef WM_MOUSEENTER
     76        #define WM_MOUSEENTER   0x041E
     77        #define WM_MOUSELEAVE   0x041F
     78    #endif
     79
    7380    /* ******************************************************************
    7481     *
     
    172179     ********************************************************************/
    173180
     181    extern LONG G_cxScreen,
     182                G_cyScreen,
     183                G_cxIcon,
     184                G_cyIcon,
     185                G_lcol3DDark,
     186                G_lcol3DLight;
     187
     188    VOID XWPENTRY winhInitGlobals(VOID);
     189
    174190    ULONG XWPENTRY winhQueryWindowStyle(HWND hwnd);
    175191
     
    184200     ********************************************************************/
    185201
     202    // now including all this only with INCL_WINMENUS
     203    // V1.0.1 (2002-11-30) [umoeller]
    186204    #ifdef INCL_WINMENUS
     205
     206        #ifndef MM_QUERYITEMBYPOS16
     207            #define MM_QUERYITEMBYPOS16 0x01f3
     208            // this undocumented message is sent to retrieve the definition
     209            // of a menu item by its position.  This message will only query
     210            // an item in the specified menu.
     211            //
     212            // Parameters:
     213            //     SHORT1FROMMP(mp1) = position of item in the menu
     214            //     SHORT2FROMMP(mp1) = reserved, set to 0
     215            //     mp2 = (16 bit pointer) points to a MENUITEM structure
     216            //           to be filled in.
     217        #endif
     218        #ifndef MAKE_16BIT_POINTER
     219            #define MAKE_16BIT_POINTER(p) \
     220                    ((PVOID)MAKEULONG(LOUSHORT(p),(HIUSHORT(p) << 3) | 7))
     221            // converts a flat 32bit pointer to its 16bit offset/selector form
     222        #endif
     223
    187224        BOOL XWPENTRY winhQueryMenuItem(HWND hwndMenu,
    188225                                        USHORT usItemID,
    189226                                        BOOL fSearchSubmenus,
    190227                                        PMENUITEM pmi);
     228
     229        HWND XWPENTRY winhQuerySubmenu(HWND hMenu, SHORT sID);
     230
     231        /*
     232         * winhCreateEmptyMenu:
     233         *      this macro creates an empty menu, which can
     234         *      be used with winhInsertMenuItem etc. later.
     235         *      Useful for creating popup menus on the fly.
     236         *      Note that even though HWND_DESKTOP is specified
     237         *      here as both the parent and the owner, the
     238         *      actual owner and parent are specified later
     239         *      with WinPopupMenu.
     240         */
     241
     242        #define winhCreateEmptyMenu()                                   \
     243        WinCreateWindow(HWND_DESKTOP, WC_MENU, "", 0, 0, 0, 0, 0,       \
     244                        HWND_DESKTOP, HWND_TOP, 0, 0, 0)
     245
     246        SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
     247                                          SHORT iPosition,
     248                                          SHORT sItemId,
     249                                          const char *pcszItemTitle,
     250                                          SHORT afStyle,
     251                                          SHORT afAttr);
     252        typedef SHORT XWPENTRY WINHINSERTMENUITEM(HWND hwndMenu,
     253                                                  SHORT iPosition,
     254                                                  SHORT sItemId,
     255                                                  const char *pcszItemTitle,
     256                                                  SHORT afStyle,
     257                                                  SHORT afAttr);
     258        typedef WINHINSERTMENUITEM *PWINHINSERTMENUITEM;
     259
     260        HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
     261                                        ULONG iPosition,
     262                                        SHORT sMenuId,
     263                                        const char *pcszSubmenuTitle,
     264                                        USHORT afMenuStyle,
     265                                        SHORT sItemId,
     266                                        const char *pcszItemTitle,
     267                                        USHORT afItemStyle,
     268                                        USHORT afAttribute);
     269        typedef HWND XWPENTRY WINHINSERTSUBMENU(HWND hwndMenu,
     270                                                ULONG iPosition,
     271                                                SHORT sMenuId,
     272                                                const char *pcszSubmenuTitle,
     273                                                USHORT afMenuStyle,
     274                                                SHORT sItemId,
     275                                                const char *pcszItemTitle,
     276                                                USHORT afItemStyle,
     277                                                USHORT afAttribute);
     278        typedef WINHINSERTSUBMENU *PWINHINSERTSUBMENU;
     279
     280        BOOL XWPENTRY winhSetMenuCondCascade(HWND hwndMenu,
     281                                             LONG lDefaultItem);
     282
     283        /*
     284         *@@ winhRemoveMenuItem:
     285         *      removes a menu item (SHORT) from the
     286         *      given menu (HWND). Returns the no. of
     287         *      remaining menu items (SHORT).
     288         *
     289         *      This works for whole submenus too.
     290         */
     291
     292        #define winhRemoveMenuItem(hwndMenu, sItemID) \
     293                SHORT1FROMMR(WinSendMsg(hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(sItemID, FALSE), 0))
     294
     295        BOOL XWPENTRY winhRemoveMenuItems(HWND hwndMenu,
     296                                          const SHORT *asItemIDs,
     297                                          ULONG cItemIDs);
     298
     299        /*
     300         *@@ winhDeleteMenuItem:
     301         *      deleted a menu item (SHORT) from the
     302         *      given menu (HWND). Returns the no. of
     303         *      remaining menu items (SHORT).
     304         *
     305         *      As opposed to MM_REMOVEITEM, MM_DELETEITEM
     306         *      frees submenus and bitmaps also.
     307         *
     308         *      This works for whole submenus too.
     309         */
     310
     311        #define winhDeleteMenuItem(hwndMenu, sItemId) \
     312                (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
     313
     314        SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
     315                                               SHORT iPosition,
     316                                               SHORT sId);
     317
     318        #define COPYFL_STRIPTABS            0x0001
     319
     320        BOOL XWPENTRY winhCopyMenuItem2(HWND hmenuTarget,
     321                                        HWND hmenuSource,
     322                                        USHORT usID,
     323                                        SHORT sTargetPosition,
     324                                        ULONG fl);
     325
     326        BOOL XWPENTRY winhCopyMenuItem(HWND hmenuTarget,
     327                                       HWND hmenuSource,
     328                                       USHORT usID,
     329                                       SHORT sTargetPosition);
     330        typedef BOOL XWPENTRY WINHCOPYMENUITEM(HWND hmenuTarget,
     331                                       HWND hmenuSource,
     332                                       USHORT usID,
     333                                       SHORT sTargetPosition);
     334        typedef WINHCOPYMENUITEM *PWINHCOPYMENUITEM;
     335
     336        HWND XWPENTRY winhMergeIntoSubMenu(HWND hmenuTarget,
     337                                           SHORT sTargetPosition,
     338                                           const char *pcszTitle,
     339                                           SHORT sID,
     340                                           HWND hmenuSource);
     341        typedef HWND XWPENTRY WINHMERGEINTOSUBMENU(HWND hmenuTarget,
     342                                           SHORT sTargetPosition,
     343                                           const char *pcszTitle,
     344                                           SHORT sID,
     345                                           HWND hmenuSource);
     346        typedef WINHMERGEINTOSUBMENU *PWINHMERGEINTOSUBMENU;
     347
     348        ULONG XWPENTRY winhMergeMenus(HWND hmenuTarget,
     349                                      SHORT sTargetPosition,
     350                                      HWND hmenuSource,
     351                                      ULONG fl);
     352        typedef ULONG XWPENTRY WINHMERGEMENUS(HWND hmenuTarget,
     353                                              SHORT sTargetPosition,
     354                                              HWND hmenuSource,
     355                                              ULONG fl);
     356        typedef WINHMERGEMENUS *PWINHMERGEMENUS;
     357
     358        ULONG XWPENTRY winhClearMenu(HWND hwndMenu);
     359
     360        PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
     361                                           USHORT usItemID);
     362
     363        BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
     364                                              USHORT usItemID,
     365                                              const char *pcszAppend,
     366                                              BOOL fTab);
     367
     368        VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
     369                                            USHORT usItemId);
     370
     371        SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
     372
    191373    #endif
    192 
    193     HWND XWPENTRY winhQuerySubmenu(HWND hMenu, SHORT sID);
    194 
    195     /*
    196      * winhCreateEmptyMenu:
    197      *      this macro creates an empty menu, which can
    198      *      be used with winhInsertMenuItem etc. later.
    199      *      Useful for creating popup menus on the fly.
    200      *      Note that even though HWND_DESKTOP is specified
    201      *      here as both the parent and the owner, the
    202      *      actual owner and parent are specified later
    203      *      with WinPopupMenu.
    204      */
    205 
    206     #define winhCreateEmptyMenu()                                   \
    207     WinCreateWindow(HWND_DESKTOP, WC_MENU, "", 0, 0, 0, 0, 0,       \
    208                     HWND_DESKTOP, HWND_TOP, 0, 0, 0)
    209 
    210     SHORT XWPENTRY winhInsertMenuItem(HWND hwndMenu,
    211                                       SHORT iPosition,
    212                                       SHORT sItemId,
    213                                       const char *pcszItemTitle,
    214                                       SHORT afStyle,
    215                                       SHORT afAttr);
    216     typedef SHORT XWPENTRY WINHINSERTMENUITEM(HWND hwndMenu,
    217                                               SHORT iPosition,
    218                                               SHORT sItemId,
    219                                               const char *pcszItemTitle,
    220                                               SHORT afStyle,
    221                                               SHORT afAttr);
    222     typedef WINHINSERTMENUITEM *PWINHINSERTMENUITEM;
    223 
    224     HWND XWPENTRY winhInsertSubmenu(HWND hwndMenu,
    225                                     ULONG iPosition,
    226                                     SHORT sMenuId,
    227                                     const char *pcszSubmenuTitle,
    228                                     USHORT afMenuStyle,
    229                                     SHORT sItemId,
    230                                     const char *pcszItemTitle,
    231                                     USHORT afItemStyle,
    232                                     USHORT afAttribute);
    233     typedef HWND XWPENTRY WINHINSERTSUBMENU(HWND hwndMenu,
    234                                             ULONG iPosition,
    235                                             SHORT sMenuId,
    236                                             const char *pcszSubmenuTitle,
    237                                             USHORT afMenuStyle,
    238                                             SHORT sItemId,
    239                                             const char *pcszItemTitle,
    240                                             USHORT afItemStyle,
    241                                             USHORT afAttribute);
    242     typedef WINHINSERTSUBMENU *PWINHINSERTSUBMENU;
    243 
    244     BOOL XWPENTRY winhSetMenuCondCascade(HWND hwndMenu,
    245                                          LONG lDefaultItem);
    246 
    247     /*
    248      *@@ winhRemoveMenuItem:
    249      *      removes a menu item (SHORT) from the
    250      *      given menu (HWND). Returns the no. of
    251      *      remaining menu items (SHORT).
    252      *
    253      *      This works for whole submenus too.
    254      */
    255 
    256     #define winhRemoveMenuItem(hwndMenu, sItemID) \
    257             SHORT1FROMMR(WinSendMsg(hwndMenu, MM_REMOVEITEM, MPFROM2SHORT(sItemID, FALSE), 0))
    258 
    259     BOOL XWPENTRY winhRemoveMenuItems(HWND hwndMenu,
    260                                       const SHORT *asItemIDs,
    261                                       ULONG cItemIDs);
    262 
    263     /*
    264      *@@ winhDeleteMenuItem:
    265      *      deleted a menu item (SHORT) from the
    266      *      given menu (HWND). Returns the no. of
    267      *      remaining menu items (SHORT).
    268      *
    269      *      As opposed to MM_REMOVEITEM, MM_DELETEITEM
    270      *      frees submenus and bitmaps also.
    271      *
    272      *      This works for whole submenus too.
    273      */
    274 
    275     #define winhDeleteMenuItem(hwndMenu, sItemId) \
    276             (SHORT)WinSendMsg(hwndMenu, MM_DELETEITEM, MPFROM2SHORT(sItemId, FALSE), 0)
    277 
    278     SHORT XWPENTRY winhInsertMenuSeparator(HWND hMenu,
    279                                            SHORT iPosition,
    280                                            SHORT sId);
    281 
    282     #define COPYFL_STRIPTABS            0x0001
    283 
    284     BOOL XWPENTRY winhCopyMenuItem2(HWND hmenuTarget,
    285                                     HWND hmenuSource,
    286                                     USHORT usID,
    287                                     SHORT sTargetPosition,
    288                                     ULONG fl);
    289 
    290     BOOL XWPENTRY winhCopyMenuItem(HWND hmenuTarget,
    291                                    HWND hmenuSource,
    292                                    USHORT usID,
    293                                    SHORT sTargetPosition);
    294     typedef BOOL XWPENTRY WINHCOPYMENUITEM(HWND hmenuTarget,
    295                                    HWND hmenuSource,
    296                                    USHORT usID,
    297                                    SHORT sTargetPosition);
    298     typedef WINHCOPYMENUITEM *PWINHCOPYMENUITEM;
    299 
    300     HWND XWPENTRY winhMergeIntoSubMenu(HWND hmenuTarget,
    301                                        SHORT sTargetPosition,
    302                                        const char *pcszTitle,
    303                                        SHORT sID,
    304                                        HWND hmenuSource);
    305     typedef HWND XWPENTRY WINHMERGEINTOSUBMENU(HWND hmenuTarget,
    306                                        SHORT sTargetPosition,
    307                                        const char *pcszTitle,
    308                                        SHORT sID,
    309                                        HWND hmenuSource);
    310     typedef WINHMERGEINTOSUBMENU *PWINHMERGEINTOSUBMENU;
    311 
    312     ULONG XWPENTRY winhMergeMenus(HWND hmenuTarget,
    313                                   SHORT sTargetPosition,
    314                                   HWND hmenuSource,
    315                                   ULONG fl);
    316     typedef ULONG XWPENTRY WINHMERGEMENUS(HWND hmenuTarget,
    317                                           SHORT sTargetPosition,
    318                                           HWND hmenuSource,
    319                                           ULONG fl);
    320     typedef WINHMERGEMENUS *PWINHMERGEMENUS;
    321 
    322     ULONG XWPENTRY winhClearMenu(HWND hwndMenu);
    323 
    324     PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
    325                                        USHORT usItemID);
    326 
    327     BOOL XWPENTRY winhAppend2MenuItemText(HWND hwndMenu,
    328                                           USHORT usItemID,
    329                                           const char *pcszAppend,
    330                                           BOOL fTab);
    331 
    332     VOID XWPENTRY winhMenuRemoveEllipse(HWND hwndMenu,
    333                                         USHORT usItemId);
    334 
    335     SHORT XWPENTRY winhQueryItemUnderMouse(HWND hwndMenu, POINTL *pptlMouse, RECTL *prtlItem);
    336374
    337375    /* ******************************************************************
     
    711749    typedef WINHQUERYWINDOWFONT *PWINHQUERYWINDOWFONT;
    712750
     751    PCSZ XWPENTRY winhQueryDefaultFont(VOID);
     752
    713753    BOOL XWPENTRY winhSetWindowFont(HWND hwnd, const char *pcszFont);
    714754    typedef BOOL XWPENTRY WINHSETWINDOWFONT(HWND hwnd, const char *pcszFont);
     
    735775                                         ULONG cbData,
    736776                                         PVOID pData);
     777
     778        PPRESPARAMS XWPENTRY winhCreateDefaultPresparams(VOID);
    737779    #endif
    738780
     
    788830    typedef WINHFREE *PWINHFREE;
    789831
     832    /*
     833     *@@ winhMyAnchorBlock:
     834     *      returns the HAB of the current thread.
     835     *
     836     *      Many Win* functions require an HAB to be
     837     *      passed in. While many of them will work
     838     *      when passing in NULLHANDLE, some (such as
     839     *      WinGetMsg) won't. If you don't know the
     840     *      anchor block of the calling thread, use
     841     *      this function.
     842     *
     843     *      The HAB is simply a LONG whose hiword has
     844     *      the current PID and the lowword has the
     845     *      current TID. The previous function that
     846     *      created a temporary window to figure this
     847     *      out has been replaced with this macro, since
     848     *      WinQueryAnchorBlock(HWND_DESKTOP) yields the
     849     *      same result.
     850     *
     851     *@@added V1.0.1 (2002-11-30) [umoeller]
     852     */
     853
     854    #define winhMyAnchorBlock() WinQueryAnchorBlock(HWND_DESKTOP)
     855
     856    /*
    790857    HAB XWPENTRY winhMyAnchorBlock(VOID);
    791858    typedef HAB XWPENTRY WINHMYANCHORBLOCK(VOID);
    792859    typedef WINHMYANCHORBLOCK *PWINHMYANCHORBLOCK;
     860    */
    793861
    794862    VOID XWPENTRY winhSleep(ULONG ulSleep);
     
    804872                              const char *pcszApplication,
    805873                              const char *pcszKey);
     874
     875    HPOINTER XWPENTRY winhQueryWaitPointer(VOID);
    806876
    807877    HPOINTER XWPENTRY winhSetWaitPointer(VOID);
     
    903973                                       ULONG cbSize);
    904974
    905     /*
    906      *@@ winhQueryScreenCX:
    907      *      helper macro for getting the screen width.
    908      */
    909 
    910     #define winhQueryScreenCX() (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
    911 
    912     /*
    913      *@@ winhQueryScreenCY:
    914      *      helper macro for getting the screen height.
    915      */
    916 
    917     #define winhQueryScreenCY() (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN))
    918 
    919     /* ******************************************************************
    920      *
    921      *   Extended frame
    922      *
    923      ********************************************************************/
    924 
    925     #define XFCF_STATUSBAR          0x0001
    926 
    927     #define FID_STATUSBAR           0x8100
    928 
    929     VOID winhCalcExtFrameRect(MPARAM mp1,
    930                               MPARAM mp2,
    931                               LONG lStatusBarHeight);
    932 
    933     /*
    934      *@@ EXTFRAMECDATA:
    935      *
    936      *@@added V0.9.16 (2001-09-29) [umoeller]
    937      */
    938 
    939     typedef struct _EXTFRAMECDATA
    940     {
    941         PSWP        pswpFrame;          // in: frame wnd pos
    942         ULONG       flFrameCreateFlags; // in: FCF_* flags
    943         ULONG       flExtFlags;         // in: XFCF_* flags
    944         ULONG       ulFrameStyle;       // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
    945         const char  *pcszFrameTitle;    // in: frame title (title bar)
    946         ULONG       ulResourcesID;      // in: according to FCF_* flags
    947         const char  *pcszClassClient;   // in: client class name
    948         ULONG       flStyleClient;      // in: client style
    949         ULONG       ulID;               // in: frame window ID
    950         PVOID       pClientCtlData;     // in: pCtlData structure pointer for client
    951     } EXTFRAMECDATA, *PEXTFRAMECDATA;
    952 
    953     /*
    954      *@@ EXTFRAMEDATA:
    955      *
    956      *@@added V0.9.16 (2001-09-29) [umoeller]
    957      */
    958 
    959     typedef struct _EXTFRAMEDATA
    960     {
    961         EXTFRAMECDATA   CData;
    962 
    963         PFNWP           pfnwpOrig;      // original frame wnd proc from subclassing
    964 
    965         PVOID           pvUser;         // more data for user (e.g. for additional subclassing)
    966 
    967     } EXTFRAMEDATA, *PEXTFRAMEDATA;
    968 
    969     HWND winhCreateStatusBar(HWND hwndFrame,
    970                              HWND hwndOwner,
    971                              const char *pcszText,
    972                              const char *pcszFont,
    973                              LONG lColor);
    974 
    975     HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,
    976                                 PHWND phwndClient);
    977 
    978975    /* ******************************************************************
    979976     *
Note: See TracChangeset for help on using the changeset viewer.