Changeset 232


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

New toolbar control.

Location:
trunk
Files:
2 added
20 edited

Legend:

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

    r229 r232  
    3939    /* ******************************************************************
    4040     *
     41     *   Shared stuff
     42     *
     43     ********************************************************************/
     44
     45    MRESULT ctlSendWmControl(HWND hwndControl,
     46                             USHORT usCode,
     47                             MPARAM mp2);
     48
     49    BOOL ctlPostWmControl(HWND hwndControl,
     50                          USHORT usCode,
     51                          MPARAM mp2);
     52
     53    /*
     54     *@@ SYSCOLORSET:
     55     *
     56     *@@added V1.0.1 (2002-11-30) [umoeller]
     57     */
     58
     59    typedef struct _SYSCOLORSET
     60    {
     61        BOOL    fInheritPP;
     62
     63        LONG    lBackIndex,
     64                lForeIndex;
     65    } SYSCOLORSET, *PSYSCOLORSET;
     66
     67    /*
     68     *@@ DEFWINDOWDATA:
     69     *
     70     *@@added V1.0.1 (2002-11-30) [umoeller]
     71     */
     72
     73    typedef struct _DEFWINDATA
     74    {
     75        HWND        hwnd;
     76        HAB         hab;
     77
     78        PFNWP       pDefWindowProc;
     79        const SYSCOLORSET *pSysColorSet;
     80
     81        LONG        lcolBackground,
     82                    lcolForeground;
     83
     84        SIZEL       szlWin;             // current window dimensions
     85
     86        PSZ         pszText;            // window text or NULL
     87
     88    } DEFWINDATA, *PDEFWINDATA;
     89
     90    VOID ctlInitDWD(HWND hwnd,
     91                    MPARAM mp2,
     92                    PDEFWINDATA pdwd,
     93                    PFNWP pDefWindowProc,
     94                    const SYSCOLORSET *pSysColorSet);
     95
     96    VOID ctlRefreshColors(PDEFWINDATA pdwd);
     97
     98    MRESULT ctlDefWindowProc(PDEFWINDATA pdwd, ULONG msg, MPARAM mp1, MPARAM mp2);
     99
     100    /* ******************************************************************
     101     *
    41102     *   "Separator line" control
    42103     *
    43104     ********************************************************************/
    44105
    45     #define WC_SEPARATORLINE        "XwpSeparatorLine"
     106    #define WC_CCTL_SEPARATOR       "ComctlSeparator"
     107
     108    #define SEPS_HORIZONTAL         0x0000
     109    #define SEPS_VERTICAL           0x0001
    46110
    47111    BOOL ctlRegisterSeparatorLine(HAB hab);
    48 
    49     /* ******************************************************************
    50      *
    51      *   "XButton" control
    52      *
    53      ********************************************************************/
    54 
    55     /*
    56      *@@ XBUTTONDATA:
    57      *      paint data for ctlPaintXButton.
    58      *
    59      *@@added V0.9.13 (2001-06-21) [umoeller]
    60      */
    61 
    62     typedef struct _XBUTTONDATA
    63     {
    64         RECTL       rcl;                // size of button (in presentation space
    65                                         // coordinates); exclusive!
    66 
    67         ULONG       cxIconOrBitmap,     // icon size
    68                     cyIconOrBitmap;
    69 
    70         LONG        lcol3DDark,         // lo-3D color
    71                     lcol3DLight,        // hi-3D color
    72                     lMiddle;            // color for center (button background)
    73 
    74         HPOINTER    hptr;               // icon to paint or NULLHANDLE
    75 
    76     } XBUTTONDATA, *PXBUTTONDATA;
    77 
    78     #define XBF_FLAT                0x00000001
    79     #define XBF_BITMAP              0x00000002
    80 
    81     #define XBF_PRESSED             0x00010000
    82     #define XBF_BACKGROUND          0x00020000
    83     #define XBF_INUSE               0x00040000
    84 
    85     VOID ctlPaintXButton(HPS hps,
    86                          ULONG fl,
    87                          PXBUTTONDATA pxbd);
    88112
    89113    /* ******************************************************************
     
    670694     ********************************************************************/
    671695
     696    #define WC_CCTL_TOOLTIP         "ComctlTooltipClass"
     697                    // define identifier changed V1.0.1 (2002-11-30) [umoeller]
     698
    672699    // addt'l tooltip window styles: use lower 16 bits
    673700    #define TTS_ALWAYSTIP           0x0001
     
    927954    #define TTN_POP             1002
    928955
    929     #define COMCTL_TOOLTIP_CLASS    "ComctlTooltipClass"
    930 
    931956    BOOL ctlRegisterTooltip(HAB hab);
    932957
    933958    MRESULT EXPENTRY ctl_fnwpTooltip(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
     959
     960    /* ******************************************************************
     961     *
     962     *   "Tool bar button" control
     963     *
     964     ********************************************************************/
     965
     966    #define WC_CCTL_TOOLBAR         "ComctlToolbarClass"
     967
     968    // toolbar button styles: use lower 16 bits
     969    #define TBBS_BIGICON            0x0001
     970    #define TBBS_MINIICON           0x0002
     971    #define TBBS_BITMAP             0x0004
     972    #define TBBS_TEXT               0x0008
     973
     974    #define TBBS_CHECK              0x0010
     975    #define TBBS_RADIO              0x0020
     976    #define TBBS_CHECKINITIAL       0x0040
     977
     978    #define TBBS_AUTORESIZE         0x0100
     979    #define TBBS_HILITE             0x0200
     980    #define TBBS_FLAT               0x0400
     981    #define TBBS_DROPMNEMONIC       0x0800
     982
     983    #define TBBS_COMMAND            0x1000
     984    #define TBBS_SYSCOMMAND         0x2000
     985
     986    // tool bar button messages
     987
     988    #define TBBM_CHECK              (WM_USER + 1)
     989
     990    #define TBBM_QUERYCHECK         (WM_USER + 2)
     991
     992    /*
     993     *@@ XBUTTONDATA:
     994     *      paint data for ctlPaintTBButton.
     995     *
     996     *@@added V0.9.13 (2001-06-21) [umoeller]
     997     */
     998
     999    typedef struct _XBUTTONDATA
     1000    {
     1001        DEFWINDATA  dwd;              // color for center (button background)
     1002
     1003        SIZEL       szlIconOrBitmap;
     1004
     1005        HPOINTER    hptr;               // icon to paint or NULLHANDLE
     1006
     1007        // BOOL        fPaintButtonSunk;
     1008
     1009    } XBUTTONDATA, *PXBUTTONDATA;
     1010
     1011    /*
     1012     *@@ XBUTTONSTATE:
     1013     *
     1014     *@@added V1.0.1 (2002-11-30) [umoeller]
     1015     */
     1016
     1017    typedef struct _XBUTTONSTATE
     1018    {
     1019        BOOL        fMB1Pressed;            // if TRUE, mouse button is currently pressed
     1020        BOOL        fIgnoreMB1Up;
     1021        BOOL        fPaintButtonSunk;       // if TRUE, button control is to be painted "down"
     1022        BOOL        fMouseCaptured;         // if TRUE, mouse is currently captured
     1023        BOOL        fMouseOver;
     1024    } XBUTTONSTATE, *PXBUTTONSTATE;
     1025
     1026    // the following styles are only for painting and not stored
     1027    #define TBBS_BACKGROUND          0x00010000
     1028    #define TBBS_INUSE               0x00020000
     1029
     1030    VOID ctlPaintTBButton(HPS hps,
     1031                          ULONG fl,
     1032                          PXBUTTONDATA pbd,
     1033                          PXBUTTONSTATE pbs);
     1034
     1035    MRESULT EXPENTRY ctl_fnwpToolbarButton(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
     1036
     1037    /* ******************************************************************
     1038     *
     1039     *   "Tool bar" control
     1040     *
     1041     ********************************************************************/
     1042
     1043    #define WC_CCTL_TBBUTTON        "ComCtlToolbarButton"
     1044                    // define identifier changed V1.0.1 (2002-11-30) [umoeller]
     1045
     1046    // tool bar window styles: use lower 16 bits
     1047    #define TBS_TOOLTIPS            0x0001
     1048    #define TBS_AUTORESIZE          0x0002
     1049
     1050    /*
     1051     *@@ TOOLBARCONTROL:
     1052     *
     1053     *@@added V1.0.1 (2002-11-30) [umoeller]
     1054     */
     1055
     1056    typedef struct _TOOLBARCONTROL
     1057    {
     1058        PCSZ        pcszClass;
     1059        PCSZ        pcszTitle;
     1060        ULONG       flStyle;
     1061        ULONG       id;
     1062        LONG        cx,
     1063                    cy;
     1064    } TOOLBARCONTROL, *PTOOLBARCONTROL;
     1065
     1066    /*
     1067     *@@ TOOLBARCDATA:
     1068     *
     1069     *@@added V1.0.1 (2002-11-30) [umoeller]
     1070     */
     1071
     1072    typedef struct _TOOLBARCDATA
     1073    {
     1074        USHORT      cb;
     1075
     1076        HWND        hwndControlsOwner;
     1077
     1078        ULONG       cControls;
     1079        PTOOLBARCONTROL patbc;
     1080
     1081    } TOOLBARCDATA, *PTOOLBARCDATA;
     1082
     1083    #define TBM_ADDCONTROLS         (WM_USER + 1)
     1084
     1085    /*
     1086     *@@ TBN_RESIZED:
     1087     *      notification code posted with WM_CONTROL when
     1088     *      a tool bar has resized itself, e.g. because
     1089     *      controls were added or removed.
     1090     *
     1091     *      Parameters:
     1092     *
     1093     *      --  SHORT1FROMMP(mp1): ID of the tool bar control.
     1094     *
     1095     *      --  SHORT2FROMMP(mp1): TBN_RESIZED code.
     1096     *
     1097     *      --  mp2: unused.
     1098     *
     1099     *@@added V1.0.1 (2002-11-30) [umoeller]
     1100     */
     1101
     1102    #define TBN_RESIZED             1
     1103
     1104    MRESULT EXPENTRY ctl_fnwpToolbar(HWND hwndToolbar, ULONG msg, MPARAM mp1, MPARAM mp2);
     1105
     1106    BOOL ctlRegisterToolbar(HAB hab);
     1107
     1108    HWND ctlCreateToolBar(HWND hwndParent,
     1109                          HWND hwndOwner,
     1110                          ULONG flStyle,
     1111                          HWND hwndControlsOwner,
     1112                          ULONG cControls,
     1113                          PTOOLBARCONTROL patbc);
     1114
     1115    /* ******************************************************************
     1116     *
     1117     *   Extended frame
     1118     *
     1119     ********************************************************************/
     1120
     1121    #define FID_TOOLBAR             0x8101
     1122    #define FID_STATUSBAR           0x8100
     1123
     1124    /*
     1125     *@@ EXTFRAMECDATA:
     1126     *
     1127     *@@added V0.9.16 (2001-09-29) [umoeller]
     1128     */
     1129
     1130    typedef struct _EXTFRAMECDATA
     1131    {
     1132        PSWP        pswpFrame;          // in: frame wnd pos (can be NULL)
     1133        ULONG       flFrame;            // in: standard FCF_* flags
     1134        ULONG       flExtFrame;         // in: XFCF_* flags
     1135                #define XFCF_STATUSBAR          0x0001
     1136                            // create a status bar for the frame
     1137                #define XFCF_TOOLBAR            0x0002
     1138                            // create a tool bar for the frame
     1139                #define XFCF_FORCETBOWNER       0x0004
     1140                            // if set, we will enfore that all toolbar controls have
     1141                            // the main frame as their owner, otherwise they'll have
     1142                            // the frame's client, if one exists
     1143        ULONG       flStyleFrame;       // in: frame style (WS_* flags, e.g. WS_VISIBLE | WS_ANIMATE)
     1144        PCSZ        pcszFrameTitle;     // in: frame title (title bar)
     1145        ULONG       ulResourcesID;      // in: according to FCF_* flags
     1146
     1147        PCSZ        pcszClassClient;    // in: client class name or NULL for no client
     1148        ULONG       flStyleClient;      // in: client style (WS_* flags, e.g. WS_VISIBLE)
     1149
     1150        ULONG       ulID;               // in: frame window ID
     1151        PVOID       pClientCtlData;     // in: pCtlData structure pointer for client
     1152
     1153        HINI        hiniSaveWinPos;     // in: HINI for saving window position or NULLHANDLE
     1154        PCSZ        pcszIniApp,
     1155                    pcszIniKey;
     1156
     1157        ULONG       cTBControls;        // in: count of tool bar controls in paTBControls or 0
     1158        PTOOLBARCONTROL paTBControls;
     1159
     1160    } EXTFRAMECDATA, *PEXTFRAMECDATA;
     1161
     1162    /*
     1163     *@@ XFRAMECONTROLS:
     1164     *
     1165     *@@added V1.0.1 (2002-11-30) [umoeller]
     1166     */
     1167
     1168    typedef struct _XFRAMECONTROLS
     1169    {
     1170        PFNWP           pfnwpOrig;      // original frame wnd proc from subclassing
     1171
     1172        HWND            hwndToolBar,
     1173                        hwndStatusBar;
     1174
     1175        LONG            lToolBarHeight,
     1176                        lStatusBarHeight;
     1177
     1178    } XFRAMECONTROLS, *PXFRAMECONTROLS;
     1179
     1180    /*
     1181     *@@ EXTFRAMEDATA:
     1182     *
     1183     *@@added V0.9.16 (2001-09-29) [umoeller]
     1184     */
     1185
     1186    typedef struct _EXTFRAMEDATA
     1187    {
     1188        EXTFRAMECDATA   CData;
     1189
     1190        XFRAMECONTROLS  xfc;
     1191
     1192        PVOID           pvUser;         // more data for user (e.g. for additional subclassing)
     1193
     1194    } EXTFRAMEDATA, *PEXTFRAMEDATA;
     1195
     1196    MRESULT ctlFormatExtFrame(HWND hwndFrame,
     1197                              PXFRAMECONTROLS pxfc,
     1198                              MPARAM mp1,
     1199                              MPARAM mp2);
     1200
     1201    VOID ctlCalcExtFrameRect(MPARAM mp1,
     1202                             MPARAM mp2,
     1203                             LONG lStatusBarHeight);
     1204
     1205    HWND ctlCreateStatusBar(HWND hwndFrame,
     1206                            HWND hwndOwner,
     1207                            const char *pcszText,
     1208                            const char *pcszFont,
     1209                            LONG lColor);
     1210
     1211    HWND ctlCreateStdWindow(PEXTFRAMECDATA pData,
     1212                            PHWND phwndClient);
    9341213
    9351214    /* ******************************************************************
  • trunk/include/helpers/dialog.h

    r229 r232  
    485485
    486486    // the following require #include helpers\comctl.h
    487     #define CONTROLDEF_SEPARATORLINE(id, cx, cy) { WC_SEPARATORLINE, NULL, \
     487    #define CONTROLDEF_SEPARATORLINE(id, cx, cy) { WC_CCTL_SEPARATOR, NULL, \
    488488            WS_VISIBLE, \
    489489            id, NULL, {cx, cy}, COMMON_SPACING }
  • trunk/include/helpers/gpih.h

    r214 r232  
    4444    VOID gpihInflateRect(PRECTL prcl,
    4545                         LONG l);
     46
     47    VOID gpihCopyRectIncl(PRECTL prclGpi,
     48                          PRECTL prclWin);
    4649
    4750    /* ******************************************************************
  • trunk/include/helpers/standards.h

    r132 r232  
    116116    #define STRINGORNULL(s) (s) ? (s) : "NULL"
    117117
     118    /*
     119     *@@ STOREIFMAX:
     120     *      helpful macro to store a in b if it is
     121     *      larger than b.
     122     *
     123     *@@added V1.0.1 (2002-11-30) [umoeller]
     124     */
     125
     126    #define STOREIFMAX(a, b) if ((a) > (b)) { b = a; }
     127
    118128#endif
    119129
  • 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     *
  • trunk/src/helpers/_call_filedlg.c

    r227 r232  
    1111#define INCL_WINFRAMEMGR
    1212#define INCL_WINMENUS
     13#define INCL_WINBUTTONS
     14#define INCL_WINPOINTERS
    1315#define INCL_WINSTDFILE
    1416
     
    2426
    2527#include "helpers\call_file_dlg.c"
     28#include "helpers\comctl.h"
     29#include "helpers\standards.h"
    2630#include "helpers\winh.h"
     31#include "helpers\gpih.h"
     32
     33PCSZ    WC_CLIENT = "MyClient";
    2734
    2835/*
     
    8390
    8491/*
     92 *@@ fnwpClient:
     93 *
     94 */
     95
     96MRESULT EXPENTRY fnwpClient(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     97{
     98    MRESULT mrc = 0;
     99
     100    switch (msg)
     101    {
     102        case WM_PAINT:
     103        {
     104            HPS hps;
     105            RECTL rcl;
     106            if (hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl))
     107            {
     108                gpihSwitchToRGB(hps);
     109                WinFillRect(hps, &rcl, RGBCOL_GRAY);
     110                WinEndPaint(hps);
     111            }
     112        }
     113        break;
     114
     115        default:
     116            mrc = WinDefWindowProc(hwnd, msg, mp1, mp2);
     117    }
     118
     119    return mrc;
     120}
     121
     122/*
    85123 *@@ main:
    86124 *
     
    92130    HMQ             hmq;
    93131
    94     ULONG           flFrame =     FCF_TITLEBAR
    95                                 | FCF_SYSMENU
    96                                 | FCF_MINMAX
    97                                 | FCF_SIZEBORDER
    98                                 | FCF_NOBYTEALIGN
    99                                 | FCF_SHELLPOSITION
    100                                 | FCF_TASKLIST;
     132    #define TBBS_COMMON TBBS_AUTORESIZE | TBBS_FLAT | TBBS_HILITE | WS_VISIBLE
     133
     134    CHAR            szOpen[200],
     135                    szExit[200];
     136
     137    TOOLBARCONTROL  aControls[] =
     138        {
     139            WC_CCTL_TBBUTTON,
     140            szExit,
     141            TBBS_COMMON | TBBS_BIGICON | TBBS_TEXT | TBBS_SYSCOMMAND,
     142            SC_CLOSE,
     143            10,
     144            10,
     145
     146            WC_CCTL_TBBUTTON,
     147            szExit,
     148            TBBS_COMMON | TBBS_BIGICON /* TBBS_TEXT | */ ,
     149            0,
     150            10,
     151            10,
     152
     153            WC_CCTL_TBBUTTON,
     154            szExit,
     155            TBBS_COMMON | TBBS_MINIICON /* TBBS_TEXT | */ ,
     156            0,
     157            10,
     158            10,
     159
     160            WC_CCTL_TBBUTTON,
     161            szOpen,
     162            TBBS_COMMON | TBBS_MINIICON | TBBS_TEXT,
     163            1000,
     164            10,
     165            10,
     166
     167            WC_CCTL_TBBUTTON,
     168            "Toggle\ntest",
     169            TBBS_COMMON | TBBS_TEXT | TBBS_CHECK,
     170            1001,
     171            10,
     172            10,
     173
     174            WC_CCTL_SEPARATOR,
     175            NULL,
     176            WS_VISIBLE | SEPS_VERTICAL,
     177            1002,
     178            10,
     179            10,
     180
     181            WC_CCTL_TBBUTTON,
     182            "Group 1",
     183            TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP | TBBS_CHECKINITIAL,
     184            1101,
     185            10,
     186            10,
     187
     188            WC_CCTL_TBBUTTON,
     189            "Group 2",
     190            TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP,
     191            1102,
     192            10,
     193            10,
     194
     195            WC_CCTL_TBBUTTON,
     196            "Group 3",
     197            TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP,
     198            1103,
     199            10,
     200            10,
     201
     202        };
     203
     204    EXTFRAMECDATA   xfd =
     205        {
     206            NULL,                               // pswpFrame
     207            FCF_TITLEBAR
     208                  | FCF_SYSMENU
     209                  | FCF_MINMAX
     210                  | FCF_SIZEBORDER
     211                  | FCF_NOBYTEALIGN
     212                  | FCF_SHELLPOSITION
     213                  | FCF_TASKLIST,
     214            XFCF_TOOLBAR | XFCF_FORCETBOWNER | XFCF_STATUSBAR,
     215            WS_VISIBLE,                         // ulFrameStyle
     216            "Test File Dialog",                 // pcszFrameTitle
     217            0,                                  // ulResourcesID
     218            WC_CLIENT,                          // pcszClassClient
     219            WS_VISIBLE,                         // flStyleClient
     220            0,                                  // ulID
     221            NULL,
     222            HINI_USER,
     223            "XWorkplace Test Apps",
     224            "CallFileDlgPos",
     225
     226            ARRAYITEMCOUNT(aControls),
     227            aControls
     228        };
    101229
    102230    HWND            hwndFrame,
    103231                    hwndClient,
     232                    hwndStatusBar,
     233                    hwndToolBar,
    104234                    hwndMenu,
    105235                    hwndSubmenu;
     
    109239    hmq = WinCreateMsgQueue(hab, 0);
    110240
    111     hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
    112                                    WS_VISIBLE,
    113                                    &flFrame,
    114                                    NULL,
    115                                    "Test File Dialog",
    116                                    WS_VISIBLE,
    117                                    0,
    118                                    0,
    119                                    &hwndClient);
     241    winhInitGlobals();
     242
     243    ctlRegisterToolbar(hab);
     244    ctlRegisterSeparatorLine(hab);
     245
     246    WinRegisterClass(hab,
     247                     (PSZ)WC_CLIENT,
     248                     fnwpClient,
     249                     0,
     250                     4);
     251
     252    sprintf(szOpen,
     253            "#%d#Open",
     254            WinQuerySysPointer(HWND_DESKTOP,
     255                               SPTR_ICONINFORMATION,
     256                               FALSE));
     257
     258    sprintf(szExit,
     259            "#%d#Exit",
     260            WinQuerySysPointer(HWND_DESKTOP,
     261                               SPTR_ICONWARNING,
     262                               FALSE));
     263
     264    hwndFrame = ctlCreateStdWindow(&xfd, &hwndClient);
     265
     266    hwndToolBar = WinWindowFromID(hwndFrame, FID_TOOLBAR);
     267    hwndStatusBar = WinWindowFromID(hwndFrame, FID_STATUSBAR);
     268
     269    WinSetWindowText(hwndToolBar, "Tool bar");
     270    WinSetWindowText(hwndStatusBar, "Status bar");
    120271
    121272    hwndMenu = WinCreateMenu(hwndFrame,
     
    128279                                    MIS_TEXT | MIS_SUBMENU,
    129280                                    1000,
    130                                     "~Show dialog",
     281                                    "Open...",
    131282                                    MIS_TEXT,
    132283                                    0);
     
    135286                       MIT_END,
    136287                       SC_CLOSE,
    137                        "~Close",
     288                       "~Quit",
    138289                       MIS_SYSCOMMAND | MIS_TEXT,
    139290                       0);
  • trunk/src/helpers/_test_dialog.c

    r222 r232  
    3030#include "setup.h"                      // code generation and debugging options
    3131
    32 #include "R:\projects\R_cvs\xworkplace\include\dlgids.h"
     32#include "K:\projects\cvs\xworkplace\include\dlgids.h"
    3333
    3434#include "helpers\comctl.h"
  • trunk/src/helpers/animate.c

    r184 r232  
    5858#include "setup.h"                      // code generation and debugging options
    5959
    60 // #include "helpers\animate.h"
    61 
    62 // #include "helpers\winh.h"
    63 // #include "helpers\gpih.h"
     60#include "helpers\winh.h"
    6461
    6562/*
     
    108105        BITMAPINFOHEADER bih;
    109106        GpiQueryBitmapParameters(hbm, &bih);
    110         /* ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN)
    111                         - BMPSPACING
    112                         - bih.cy; */
    113         ptl.x = (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)
    114                         - bih.cx) / 2;
    115         ptl.y = (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN)
    116                         - bih.cy) / 2;
     107        ptl.x = (G_cxScreen - bih.cx) / 2;
     108        ptl.y = (G_cyScreen - bih.cy) / 2;
    117109
    118110        // we now use ul for the current animation step,
  • trunk/src/helpers/cctl_chart.c

    r222 r232  
    14961496                          LONG lIndex)
    14971497{
    1498     HWND hwndOwner;
    1499 
    1500     if (hwndOwner = WinQueryWindow(hwndChart, QW_OWNER))
    1501     {
    1502         EMPHASISNOTIFY en;
    1503         en.hwndSource = hwndChart;
    1504         en.lIndex = lIndex;        // can be -1
    1505         en.ulEmphasis = ulEmphasis;
    1506         en.ptl.x = SHORT1FROMMP(mp1Mouse);
    1507         en.ptl.y = SHORT2FROMMP(mp1Mouse);
    1508 
    1509         WinSendMsg(hwndOwner,
    1510                    WM_CONTROL,
    1511                    MPFROM2SHORT(WinQueryWindowUShort(hwndChart,
    1512                                                      QWS_ID),
    1513                                 usNotify),
    1514                    &en);
    1515     }
     1498    EMPHASISNOTIFY en;
     1499    en.hwndSource = hwndChart;
     1500    en.lIndex = lIndex;        // can be -1
     1501    en.ulEmphasis = ulEmphasis;
     1502    en.ptl.x = SHORT1FROMMP(mp1Mouse);
     1503    en.ptl.y = SHORT2FROMMP(mp1Mouse);
     1504
     1505    ctlSendWmControl(hwndChart,
     1506                     usNotify,
     1507                     &en);
    15161508}
    15171509
  • trunk/src/helpers/cctl_combo.c

    r222 r232  
    408408                    // our own owner, but replace the id
    409409                    // with the combo box id
    410                     WinPostMsg(WinQueryWindow(hwnd, QW_OWNER),
    411                                WM_CONTROL,
    412                                MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID),
    413                                             uscode),
    414                                mp2);
     410                    ctlPostWmControl(hwnd,
     411                                     uscode,
     412                                     mp2);
    415413
    416414                    // do not call parent
  • trunk/src/helpers/cctl_tooltip.c

    r229 r232  
    112112{
    113113    return WinRegisterClass(hab,
    114                             COMCTL_TOOLTIP_CLASS,
     114                            WC_CCTL_TOOLTIP,
    115115                            ctl_fnwpTooltip,
    116116                            CS_HITTEST,     // class styles;
     
    295295    if (!FindSubclassedTool(hwndTool))
    296296    {
    297         PFNWP   pfnwpOrig = WinSubclassWindow(hwndTool,
    298                                               ctl_fnwpSubclassedTool);
    299         if (pfnwpOrig)
     297        PFNWP   pfnwpOrig;
     298        if (pfnwpOrig = WinSubclassWindow(hwndTool,
     299                                          ctl_fnwpSubclassedTool))
    300300        {
    301             PSUBCLASSEDTOOL pst = (PSUBCLASSEDTOOL)malloc(sizeof(SUBCLASSEDTOOL));
    302             if (pst)
     301            PSUBCLASSEDTOOL pst;
     302            if (pst = (PSUBCLASSEDTOOL)malloc(sizeof(SUBCLASSEDTOOL)))
    303303            {
    304304                pst->pfnwpOrig = pfnwpOrig;
     
    361361    HAB         hab;                // from WM_CREATE
    362362    USHORT      usTooltipID;        // from WM_CREATE
    363 
    364     LONG        cxScreen,
    365                 cyScreen;
    366363
    367364    BOOL        fIsActive;          // TRUE per default; changed by TTM_ACTIVATE
     
    457454        pttd->usTooltipID = pcs->id;
    458455
    459         pttd->cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
    460         pttd->cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
    461 
    462456        pttd->fIsActive = TRUE;
    463457
     
    11331127    if (ptlTooltip.y < 0)
    11341128        ptlTooltip.y = 0;
    1135     if (ptlTooltip.x + cx > pttd->cxScreen)
    1136         ptlTooltip.x = pttd->cxScreen-cx;
    1137     if (ptlTooltip.y + cy > pttd->cyScreen)
    1138         ptlTooltip.y = pttd->cyScreen-cy;
     1129    if (ptlTooltip.x + cx > G_cxScreen)
     1130        ptlTooltip.x = G_cxScreen - cx;
     1131    if (ptlTooltip.y + cy > G_cyScreen)
     1132        ptlTooltip.y = G_cyScreen - cy;
    11391133
    11401134    // if shadow is enabled,
     
    13501344 +          ctlRegisterTooltip(hab);
    13511345 +          hwndTooltip = WinCreateWindow(HWND_DESKTOP, // parent
    1352  +                           COMCTL_TOOLTIP_CLASS, // wnd class (comctl.h)
     1346 +                           WC_CCTL_TOOLTIP, // wnd class (comctl.h)
    13531347 +                           NULL,          // window text
    13541348 +                           TTS_ALWAYSTIP, // window style, ignored except for TTS_* flags
  • trunk/src/helpers/cnrh.c

    r229 r232  
    21422142                           (   poi->rclItem.xLeft
    21432143                             + (poi->rclItem.xRight - poi->rclItem.xLeft
    2144                                 - WinQuerySysValue(HWND_DESKTOP, SV_CXICON) / 2
     2144                                - G_cxIcon / 2
    21452145                               ) / 2
    21462146                           ),
    21472147                           (   poi->rclItem.yBottom
    21482148                             + (poi->rclItem.yTop - poi->rclItem.yBottom
    2149                                 - WinQuerySysValue(HWND_DESKTOP, SV_CYICON) / 2
     2149                                - G_cyIcon / 2
    21502150                               ) / 2
    21512151                           ),
  • trunk/src/helpers/comctl.c

    r229 r232  
    9090#define INCL_WINSTDCNR
    9191#define INCL_WINENTRYFIELDS
     92#define INCL_WINSHELLDATA
    9293
    9394#define INCL_GPIPRIMITIVES
     
    112113#include "helpers\linklist.h"
    113114#include "helpers\winh.h"
     115#include "helpers\standards.h"
    114116
    115117#include "helpers\comctl.h"
    116118
    117119#pragma hdrstop
     120
     121/* ******************************************************************
     122 *
     123 *   Shared stuff
     124 *
     125 ********************************************************************/
     126
     127/*
     128 *@@ ctlSendWmControl:
     129 *      little helper that post a WM_CONTROL message to
     130 *      a control's owner.
     131 *
     132 *@@added V1.0.1 (2002-11-30) [umoeller]
     133 */
     134
     135MRESULT ctlSendWmControl(HWND hwndControl,     // in: control who's posting
     136                         USHORT usCode,        // in: code for SHORT2FROMMP(mp1)
     137                         MPARAM mp2)           // in: mp2 from WM_CONTROL
     138{
     139    HWND hwndOwner;
     140
     141    if (hwndOwner = WinQueryWindow(hwndControl, QW_OWNER))
     142        return WinSendMsg(hwndOwner,
     143                          WM_CONTROL,
     144                          MPFROM2SHORT(WinQueryWindowUShort(hwndControl, QWS_ID),
     145                                       usCode),
     146                          mp2);
     147
     148    return NULL;
     149}
     150
     151/*
     152 *@@ ctlPostWmControl:
     153 *      little helper that post a WM_CONTROL message to
     154 *      a control's owner.
     155 *
     156 *@@added V1.0.1 (2002-11-30) [umoeller]
     157 */
     158
     159BOOL ctlPostWmControl(HWND hwndControl,     // in: control who's posting
     160                      USHORT usCode,        // in: code for SHORT2FROMMP(mp1)
     161                      MPARAM mp2)           // in: mp2 from WM_CONTROL
     162{
     163    HWND hwndOwner;
     164
     165    if (hwndOwner = WinQueryWindow(hwndControl, QW_OWNER))
     166        return WinPostMsg(hwndOwner,
     167                          WM_CONTROL,
     168                          MPFROM2SHORT(WinQueryWindowUShort(hwndControl, QWS_ID),
     169                                       usCode),
     170                          mp2);
     171
     172    return FALSE;
     173}
     174
     175/*
     176 *@@ ctlInitDWD:
     177 *      ininitializes the DEFWINDATA struct for the
     178 *      given window. This must be called in WM_CREATE
     179 *      of a window proc if it intends to use
     180 *      ctlDefWindowProc as its default window procedure.
     181 *
     182 *@@added V1.0.1 (2002-11-30) [umoeller]
     183 */
     184
     185VOID ctlInitDWD(HWND hwnd,
     186                MPARAM mp2,
     187                PDEFWINDATA pdwd,
     188                PFNWP pDefWindowProc,
     189                const SYSCOLORSET *pSysColorSet)
     190{
     191    pdwd->hwnd = hwnd;
     192    pdwd->szlWin.cx = ((PCREATESTRUCT)mp2)->cx;
     193    pdwd->szlWin.cy = ((PCREATESTRUCT)mp2)->cy;
     194    pdwd->hab = WinQueryAnchorBlock(hwnd);
     195    pdwd->pDefWindowProc = pDefWindowProc;
     196    pdwd->pSysColorSet = pSysColorSet;
     197
     198    ctlRefreshColors(pdwd);
     199}
     200
     201/*
     202 *@@ ctlRefreshColors:
     203 *
     204 *@@added V1.0.1 (2002-11-30) [umoeller]
     205 */
     206
     207VOID ctlRefreshColors(PDEFWINDATA pdwd)
     208{
     209    pdwd->lcolBackground = winhQueryPresColor2(pdwd->hwnd,
     210                                               PP_BACKGROUNDCOLOR,
     211                                               PP_BACKGROUNDCOLORINDEX,
     212                                               pdwd->pSysColorSet->fInheritPP,
     213                                               pdwd->pSysColorSet->lBackIndex);
     214    pdwd->lcolForeground = winhQueryPresColor2(pdwd->hwnd,
     215                                               PP_FOREGROUNDCOLOR,
     216                                               PP_FOREGROUNDCOLORINDEX,
     217                                               pdwd->pSysColorSet->fInheritPP,
     218                                               pdwd->pSysColorSet->lForeIndex);
     219}
     220
     221/*
     222 *@@ ctlDefWindowProc:
     223 *      replacement default window procedure for controls that
     224 *      have a custom window class and do not inherit from
     225 *      standard OS/2 controls.
     226 *
     227 *      If a window proc wishes to use this, it must allocate
     228 *      its own private window data in WM_CREATE (preferrably in
     229 *      QWL_USER + 1) and have room for a DEFWINDATA struct in
     230 *      there. It must call ctlInitDWD in WM_CREATE also which
     231 *      initializes that structure. It can then safely pass
     232 *      messages to this function.
     233 *
     234 *@@added V1.0.1 (2002-11-30) [umoeller]
     235 */
     236
     237MRESULT ctlDefWindowProc(PDEFWINDATA pdwd, ULONG msg, MPARAM mp1, MPARAM mp2)
     238{
     239    MRESULT mrc = 0;
     240
     241    switch (msg)
     242    {
     243        case WM_SYSCOLORCHANGE:
     244        case WM_PRESPARAMCHANGED:
     245            ctlRefreshColors(pdwd);
     246        break;
     247
     248        default:
     249            mrc = pdwd->pDefWindowProc(pdwd->hwnd, msg, mp1, mp2);
     250    }
     251
     252    return mrc;
     253}
    118254
    119255/* ******************************************************************
     
    131267 *
    132268 *@@added V0.9.20 (2002-08-10) [umoeller]
     269 *@@changed V1.0.1 (2002-11-30) [umoeller]: added SEPS_VERTICAL
    133270 */
    134271
     
    150287                gpihSwitchToRGB(hps);
    151288
    152                 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0));
    153 
    154                 ptl.x = rcl.xLeft;
    155                 ptl.y = (rcl.yTop - rcl.yBottom) / 2 - 1;
    156                 GpiMove(hps, &ptl);
    157                 ptl.x = rcl.xRight;
    158                 GpiLine(hps, &ptl);
    159 
    160                 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0));
    161 
    162                 ptl.x = rcl.xLeft;
    163                 ++ptl.y;
    164                 GpiMove(hps, &ptl);
    165                 ptl.x = rcl.xRight;
    166                 GpiLine(hps, &ptl);
     289                WinFillRect(hps,
     290                            &rcl,
     291                            winhQueryPresColor2(hwnd,
     292                                                PP_BACKGROUNDCOLOR,
     293                                                PP_BACKGROUNDCOLORINDEX,
     294                                                TRUE,
     295                                                SYSCLR_WINDOW));
     296
     297                if (WinQueryWindowULong(hwnd, QWL_STYLE) & SEPS_VERTICAL)
     298                {
     299                    GpiSetColor(hps, G_lcol3DDark);
     300
     301                    ptl.x = (rcl.xRight - rcl.xLeft) / 2 - 1;
     302                    ptl.y = rcl.yBottom;
     303                    GpiMove(hps, &ptl);
     304                    ptl.y = rcl.yTop;
     305                    GpiLine(hps, &ptl);
     306
     307                    GpiSetColor(hps, G_lcol3DLight);
     308
     309                    ptl.y = rcl.yBottom;
     310                    ++ptl.x;
     311                    GpiMove(hps, &ptl);
     312                    ptl.y = rcl.yTop;
     313                    GpiLine(hps, &ptl);
     314                }
     315                else
     316                {
     317                    GpiSetColor(hps, G_lcol3DLight);
     318
     319                    ptl.x = rcl.xLeft;
     320                    ptl.y = (rcl.yTop - rcl.yBottom) / 2 - 1;
     321                    GpiMove(hps, &ptl);
     322                    ptl.x = rcl.xRight;
     323                    GpiLine(hps, &ptl);
     324
     325                    GpiSetColor(hps, G_lcol3DDark);
     326
     327                    ptl.x = rcl.xLeft;
     328                    ++ptl.y;
     329                    GpiMove(hps, &ptl);
     330                    ptl.x = rcl.xRight;
     331                    GpiLine(hps, &ptl);
     332                }
    167333
    168334                WinEndPaint(hps);
     
    179345
    180346/*
    181  *@@ ctlMakeSeparatorLine:
    182  *      turns the given static control into a 3D separator line.
     347 *@@ ctlRegisterSeparatorLine:
     348 *      registers the separator line control, which is a dull
     349 *      static displaying a 3D line for use as a separator
     350 *      in dialogs.
     351 *
     352 *      In addition to the standard WS_* styles, the control
     353 *      supports the SEPS_VERTICAL style bit. If set, the
     354 *      separator is vertical; if not, it is horizontal.
    183355 *
    184356 *@@added V1.0.0 (2002-08-12) [umoeller]
     
    195367
    196368        return WinRegisterClass(hab,
    197                                 WC_SEPARATORLINE,
     369                                WC_CCTL_SEPARATOR,
    198370                                fnwpSeparatorLine,
    199371                                (ciStatic.flClassStyle & ~CS_PUBLIC),
     
    203375
    204376    return FALSE;
    205 }
    206 
    207 /* ******************************************************************
    208  *
    209  *   "XButton" control
    210  *
    211  ********************************************************************/
    212 
    213 /*
    214  *@@ ctlPaintXButton:
    215  *      paints an X-button control. Can be called externally
    216  *      for just painting a button even if this is not really
    217  *      a window.
    218  *
    219  *      WARNING: this is work in progress and will change into
    220  *      the future. Eventually this will turn into a full
    221  *      button control replacement.
    222  *
    223  *@@added V0.9.13 (2001-06-21) [umoeller]
    224  *@@changed V0.9.16 (2001-10-24) [umoeller]: fixed wrong hatch color and paint offset
    225  *@@changed V0.9.16 (2001-10-28) [umoeller]: added bitmap support, fixed bad clip rectangle
    226  *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color
    227  */
    228 
    229 VOID ctlPaintXButton(HPS hps,               // in: presentation space (RGB mode)
    230                      ULONG fl,              // in: XBF_* flags
    231                      PXBUTTONDATA pxbd)     // in: button data
    232 {
    233     ULONG   ulBorder = 0,
    234             cx,
    235             cy,
    236             ulOfs = 0;
    237     LONG    lLeft,
    238             lRight,
    239             lColorMiddle = pxbd->lMiddle;
    240     RECTL   rclWin;
    241 
    242     memcpy(&rclWin, &pxbd->rcl, sizeof(RECTL));
    243 
    244     if (0 == (fl & XBF_FLAT))
    245         ulBorder = 2;
    246 
    247     gpihSwitchToRGB(hps);
    248 
    249     if (fl & XBF_PRESSED)
    250     {
    251         // paint button "down":
    252         lLeft = pxbd->lcol3DDark;
    253         lRight = pxbd->lcol3DLight;
    254         // add offset for icon painting at the bottom
    255         ulOfs += 1;
    256         if (ulBorder == 0)
    257             ulBorder = 1;
    258 
    259         // make the depressed color darker
    260         // V0.9.20 (2002-07-31) [umoeller]
    261         gpihManipulateRGB(&lColorMiddle,
    262                           .95);
    263     }
    264     else
    265     {
    266         lLeft = pxbd->lcol3DLight;
    267         lRight = pxbd->lcol3DDark;
    268     }
    269 
    270     if (ulBorder)
    271     {
    272         // button border:
    273         // now paint button frame
    274 
    275         // make rcl inclusive
    276         rclWin.xRight--;
    277         rclWin.yTop--;
    278         gpihDraw3DFrame(hps,
    279                         &rclWin,        // inclusive
    280                         ulBorder,
    281                         lLeft,
    282                         lRight);
    283 
    284         // now paint button middle
    285         rclWin.xLeft += ulBorder;
    286         rclWin.yBottom += ulBorder;
    287         rclWin.xRight -= ulBorder - 1;  // make exclusive again
    288         rclWin.yTop -= ulBorder - 1;    // make exclusive again
    289     }
    290 
    291     if (fl & XBF_BACKGROUND)
    292         WinFillRect(hps,
    293                     &rclWin,        // exclusive
    294                     lColorMiddle);
    295 
    296     // get icon
    297     if (pxbd->hptr)
    298     {
    299         // calculate x and y to be centered in rectangle
    300         POINTL  ptl;
    301 
    302         cx = rclWin.xRight - rclWin.xLeft;
    303         cy = rclWin.yTop - rclWin.yBottom;
    304 
    305         ptl.x = rclWin.xLeft + ((cx - pxbd->cxIconOrBitmap) / 2);
    306         ptl.y = rclWin.yBottom + ((cy - pxbd->cyIconOrBitmap) / 2);
    307 
    308         if (fl & XBF_INUSE)
    309         {
    310             // caller wants in-use (hatched) emphasis:
    311             // draw a box then
    312             POINTL ptl2;
    313             ptl2.x = ptl.x - 2;
    314             ptl2.y = ptl.y - 2;
    315             GpiMove(hps,
    316                     &ptl2);     // &ptl
    317                                 // duh, typo V0.9.16 (2001-10-24) [umoeller]
    318             GpiSetPattern(hps, PATSYM_DIAG1);
    319             GpiSetColor(hps, RGBCOL_BLACK);     // V0.9.16 (2001-10-24) [umoeller]
    320             ptl2.x = ptl.x + pxbd->cxIconOrBitmap + 1; // inclusive!
    321             ptl2.y = ptl.y + pxbd->cyIconOrBitmap + 1; // inclusive!
    322             GpiBox(hps,
    323                    DRO_FILL,
    324                    &ptl2,
    325                    0,
    326                    0);
    327         }
    328 
    329         // now paint icon
    330 
    331         // make rcl inclusive           // V0.9.16 (2001-10-28) [umoeller]
    332         rclWin.xRight--;
    333         rclWin.yTop--;
    334         GpiIntersectClipRectangle(hps,
    335                                   &rclWin);    // inclusive!
    336 
    337         // center this in remaining rectl
    338         ptl.x += ulOfs;
    339         ptl.y -= ulOfs;
    340         if (fl & XBF_BITMAP)
    341             // V0.9.16 (2001-10-28) [umoeller]
    342             WinDrawBitmap(hps,
    343                           pxbd->hptr,           // a bitmap really
    344                           NULL,                 // entire bitmap
    345                           &ptl,
    346                           0,
    347                           0,
    348                           DBM_NORMAL);
    349         else
    350             WinDrawPointer(hps,
    351                            // center this in remaining rectl
    352                            ptl.x, //  + ulOfs,
    353                            ptl.y, //  - ulOfs,
    354                            pxbd->hptr,
    355                            DP_MINI);
    356     }
    357377}
    358378
     
    10971117            WinQueryWindowRect(hwndStatic, &pa->rclIcon);
    10981118            pa->OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
    1099             pa->szlIcon.cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
    1100             pa->szlIcon.cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
     1119            pa->szlIcon.cx = G_cxIcon;
     1120            pa->szlIcon.cy = G_cyIcon;
    11011121        }
    11021122    }
     
    16281648                    // doesn't send any notifications, we
    16291649                    // use EN_CHANGED
    1630                     WinSendMsg(WinQueryWindow(hwndStatic, QW_OWNER),
    1631                                WM_CONTROL,
    1632                                MPFROM2SHORT(WinQueryWindowUShort(hwndStatic, QWS_ID),
    1633                                             EN_CHANGE),
    1634                                (MPARAM)hwndStatic);
     1650                    ctlSendWmControl(hwndStatic,
     1651                                     EN_CHANGE,
     1652                                     (MPARAM)hwndStatic);
    16351653                break;
    16361654            }
  • trunk/src/helpers/dialog.c

    r229 r232  
    10011001            rcl.yTop = pColumn->szlProposed.cy;
    10021002        else
    1003             rcl.yTop = winhQueryScreenCY() * 2 / 3;
     1003            rcl.yTop = G_cyScreen * 2 / 3;
    10041004
    10051005        winhDrawFormattedText(pDlgData->hps,
     
    11851185
    11861186                case SS_ICON:
    1187                     pColumn->szlAuto.cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
    1188                     pColumn->szlAuto.cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
     1187                    pColumn->szlAuto.cx = G_cxIcon;
     1188                    pColumn->szlAuto.cy = G_cyIcon;
    11891189                break;
    11901190            }
  • trunk/src/helpers/except.c

    r229 r232  
    788788 *      writes no trap logs).
    789789 *
     790 *      Registering hooks affects all threads that use
     791 *      the exception handlers.
     792 *
    790793 *      The hooks are as follows:
    791794 *
  • trunk/src/helpers/gpih.c

    r229 r232  
    134134{
    135135    if (prcl)
    136     {
    137136        return (    (x >= prcl->xLeft)
    138137                 && (x <= prcl->xRight)
     
    140139                 && (y <= prcl->yTop)
    141140               );
    142     }
    143141
    144142    return FALSE;
     
    163161        prcl->yTop += l;
    164162    }
     163}
     164
     165/*
     166 *@@ gpihCopyRectIncl:
     167 *      copies prclWin to prclGpi, making it
     168 *      inclusive-inclusive for use with GPI
     169 *      functions.
     170 *
     171 *@@added V1.0.1 (2002-11-30) [umoeller]
     172 */
     173
     174VOID gpihCopyRectIncl(PRECTL prclGpi,       // out: GPI rectangle
     175                      PRECTL prclWin)       // in: WIN rectangle
     176{
     177    prclGpi->xLeft = prclWin->xLeft;
     178    prclGpi->yBottom = prclWin->yBottom;
     179    prclGpi->xRight = prclWin->xRight - 1;
     180    prclGpi->yTop = prclWin->yTop - 1;
    165181}
    166182
     
    16871703}
    16881704
     1705static const BITMAPINFOHEADER2 G_bih2Template[] =
     1706    {
     1707        sizeof(BITMAPINFOHEADER2), // ULONG      cbFix;
     1708        0,                  // ULONG      cx;               // tbr
     1709        0,                  // ULONG      cy;               // tbr
     1710        0,                  // USHORT     cPlanes;          // tbr
     1711        0,                  // USHORT     cBitCount;        // tbr
     1712        BCA_UNCOMP,         // ULONG      ulCompression;
     1713        0,                  // ULONG      cbImage;
     1714        70,                 // ULONG      cxResolution;
     1715        70,                 // ULONG      cyResolution;
     1716        2,                  // ULONG      cclrUsed;
     1717        0,                  // ULONG      cclrImportant;
     1718        BRU_METRIC,         // USHORT     usUnits;
     1719                                    // measure units for cxResolution/cyResolution: pels per meter
     1720        0,                  // USHORT     usReserved;
     1721        BRA_BOTTOMUP,       // USHORT     usRecording;
     1722                                    // scan lines are bottom to top (default)
     1723
     1724        BRH_NOTHALFTONED,   // USHORT     usRendering;
     1725                                    // other algorithms aren't documented anyway
     1726        0,                  // ULONG      cSize1;
     1727                                    // parameter for halftoning (undocumented anyway)
     1728        0,                  // ULONG      cSize2;
     1729                                    // parameter for halftoning (undocumented anyway)
     1730        BCE_RGB,            // ULONG      ulColorEncoding;
     1731                                    // only possible value
     1732        0                   // ULONG      ulIdentifier;
     1733                                    // application-specific data
     1734    };
     1735
    16891736/*
    16901737 *@@ gpihCreateBitmap2:
     
    17031750 *
    17041751 *@@added V0.9.16 (2001-12-18) [umoeller]
     1752 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    17051753 */
    17061754
     
    17111759                          ULONG cBitCount)   // in: either 1, 4, or 24; if 0, current screen value
    17121760{
    1713     HBITMAP hbm = NULLHANDLE;
    17141761    LONG alData[2];
    17151762    BITMAPINFOHEADER2 bih2;
    1716     // PBITMAPINFO2 pbmi = NULL;
    17171763
    17181764    // determine the device's plane/bit-count format;
     
    17211767    if (GpiQueryDeviceBitmapFormats(hpsMem, 2, alData))
    17221768    {
    1723         // set up the BITMAPINFOHEADER2 and BITMAPINFO2 structures
    1724         bih2.cbFix = (ULONG)sizeof(BITMAPINFOHEADER2);
     1769        // copy values from global template V1.0.1 (2002-11-30) [umoeller]
     1770        memcpy(&bih2, &G_bih2Template, sizeof(bih2));
     1771
     1772        // fix variable fields V1.0.1 (2002-11-30) [umoeller]
    17251773        bih2.cx = cx;
    17261774        bih2.cy = cy;
    17271775        bih2.cPlanes = (cPlanes) ? cPlanes : alData[0];
    17281776        bih2.cBitCount = (cBitCount) ? cBitCount : alData[1];
    1729         bih2.ulCompression = BCA_UNCOMP;
    17301777        bih2.cbImage = (    (   (bih2.cx
    17311778                                    * (1 << bih2.cPlanes)
     
    17341781                            ) / 32
    17351782                       ) * bih2.cy;
    1736         bih2.cxResolution = 70;
    1737         bih2.cyResolution = 70;
    1738         bih2.cclrUsed = 2;
    1739         bih2.cclrImportant = 0;
    1740         bih2.usUnits = BRU_METRIC;  // measure units for cxResolution/cyResolution: pels per meter
    1741         bih2.usReserved = 0;
    1742         bih2.usRecording = BRA_BOTTOMUP;        // scan lines are bottom to top (default)
    1743         bih2.usRendering = BRH_NOTHALFTONED;    // other algorithms aren't documented anyway
    1744         bih2.cSize1 = 0;            // parameter for halftoning (undocumented anyway)
    1745         bih2.cSize2 = 0;            // parameter for halftoning (undocumented anyway)
    1746         bih2.ulColorEncoding = BCE_RGB;     // only possible value
    1747         bih2.ulIdentifier = 0;              // application-specific data
    17481783
    17491784        // create a bit map that is compatible with the display
    1750         hbm = GpiCreateBitmap(hpsMem,
    1751                               &bih2,
    1752                               0,            // do not initialize
    1753                               NULL,         // init data
    1754                               NULL);
     1785        return GpiCreateBitmap(hpsMem,
     1786                               &bih2,
     1787                               0,            // do not initialize
     1788                               NULL,         // init data
     1789                               NULL);
    17551790    }
    17561791
    1757     return hbm;
     1792    return NULLHANDLE;
     1793}
     1794
     1795/*
     1796 *@@ gpihQueryBitmapSize:
     1797 *      returns the width and height of the given bitmap.
     1798 *
     1799 *@@added V1.0.1 (2002-11-30) [umoeller]
     1800 */
     1801
     1802BOOL gpihQueryBitmapSize(HBITMAP hbm,       // in: bitmap handle for query
     1803                         PSIZEL pszl)       // out: size (cx, cy) of bitmap
     1804{
     1805    BITMAPINFOHEADER2 bmi2;
     1806    // query bitmap info
     1807    bmi2.cbFix = sizeof(bmi2);
     1808    if (    (hbm)
     1809         && (GpiQueryBitmapInfoHeader(hbm, &bmi2))
     1810       )
     1811    {
     1812        pszl->cx = bmi2.cx;
     1813        pszl->cy = bmi2.cy;
     1814        return TRUE;
     1815    }
     1816
     1817    return FALSE;
    17581818}
    17591819
     
    17761836 *
    17771837 *@added V0.9.0
     1838 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    17781839 */
    17791840
     
    17861847    HDC     hdcMem;
    17871848    HPS     hpsMem;
    1788     BITMAPINFOHEADER2 bmi;
    1789 
    1790     if (hbmSource)
     1849    SIZEL   szlPage;
     1850
     1851    if (gpihQueryBitmapSize(hbmSource, &szlPage))       // V1.0.1 (2002-11-30) [umoeller]
    17911852    {
    1792         SIZEL szlPage;
    1793         // query bitmap info
    1794         bmi.cbFix = sizeof(bmi);
    1795         GpiQueryBitmapInfoHeader(hbmSource, &bmi);
    1796 
    1797         szlPage.cx = bmi.cx;
    1798         szlPage.cy = bmi.cy;
    17991853        if (gpihCreateMemPS(hab, &szlPage, &hdcMem, &hpsMem))
    18001854        {
    18011855            if ((hbmReturn = gpihCreateBitmap(hpsMem,
    1802                                               bmi.cx,
    1803                                               bmi.cy)))
     1856                                              szlPage.cx,
     1857                                              szlPage.cy)))
    18041858            {
    18051859                if (GpiSetBitmap(hpsMem, hbmReturn) != HBM_ERROR)
     
    18111865                    // aptl[0]: target bottom-left, is all 0
    18121866                    // aptl[1]: target top-right (inclusive!)
    1813                     aptl[1].x = bmi.cx - 1;
    1814                     aptl[1].y = bmi.cy - 1;
     1867                    aptl[1].x = szlPage.cx - 1;
     1868                    aptl[1].y = szlPage.cy - 1;
    18151869                    // aptl[2]: source bottom-left, is all 0
    18161870
    18171871                    // aptl[3]: source top-right (exclusive!)
    1818                     aptl[3].x = bmi.cx;
    1819                     aptl[3].y = bmi.cy;
     1872                    aptl[3].x = szlPage.cx;
     1873                    aptl[3].y = szlPage.cy;
    18201874                    GpiWCBitBlt(hpsMem,     // target HPS (bmp selected)
    18211875                                hbmSource,
     
    18321886
    18331887                    GpiMove(hpsMem, &aptl[0]);  // still 0, 0
    1834                     aptl[0].x = bmi.cx - 1;
    1835                     aptl[0].y = bmi.cy - 1;
     1888                    aptl[0].x = szlPage.cx - 1;
     1889                    aptl[0].y = szlPage.cy - 1;
    18361890                    GpiSetColor(hpsMem, lColorGray);
    18371891                    GpiSetPattern(hpsMem, PATSYM_HALFTONE);
     
    23262380 *
    23272381 *@added V0.9.0
     2382 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    23282383 */
    23292384
     
    23342389                       BOOL fProportional)  // in: preserve proportions when stretching?
    23352390{
    2336     BITMAPINFOHEADER2   bih2;
     2391    SIZEL               szlBmp;
    23372392    POINTL              aptl[4];
    23382393    BOOL                fCalculated = FALSE;
    23392394
     2395    if (!gpihQueryBitmapSize(hbmSource, &szlBmp))       // V1.0.1 (2002-11-30) [umoeller]
     2396        return GPI_ERROR;
     2397
    23402398    memset(aptl, 0, sizeof(POINTL) * 4);
    2341 
    2342     bih2.cbFix = sizeof(bih2);
    2343     GpiQueryBitmapInfoHeader(hbmSource,
    2344                              &bih2);
    23452399
    23462400    // aptl[2]: source bottom-left, is all 0
    23472401    // aptl[3]: source top-right (exclusive!)
    2348     aptl[3].x = bih2.cx;
    2349     aptl[3].y = bih2.cy;
     2402    aptl[3].x = szlBmp.cx;
     2403    aptl[3].y = szlBmp.cy;
    23502404
    23512405    if (fProportional)
     
    23562410        // large
    23572411
    2358         ULONG ulPropSource = (bih2.cx * 1000)
    2359                                     / bih2.cy;
     2412        ULONG ulPropSource = (szlBmp.cx * 1000)
     2413                                    / szlBmp.cy;
    23602414                // e.g. if the bmp is 200 x 100, we now have 2000
    23612415        ULONG ulPropTarget = ((prclTarget->xRight - prclTarget->xLeft) * 1000)
     
    24302484
    24312485/*
    2432  * gpihIcon2Bitmap:
    2433  *      this paints the given icon/pointer into
    2434  *      a bitmap. Note that if the bitmap is
    2435  *      larget than the system icon size, only
    2436  *      the rectangle of the icon will be filled
    2437  *      with lBkgndColor.
    2438  *
    2439  *      Returns FALSE upon errors.
    2440  *
    2441  *added V0.9.0 [umoeller]
    2442  *changed V0.9.16 (2001-10-15) [umoeller]: added pptlLowerLeft
    2443  *changed V0.9.16 (2001-10-15) [umoeller]: fixed inclusive/exclusive confusion (sigh...)
    2444  *changed V0.9.19 (2002-06-13) [umoeller]: fixed funny colors when scaling
    2445  *removed V0.9.19 (2002-06-18) [umoeller]
    2446  */
    2447 
    2448 #if 0
    2449 
    2450 BOOL gpihIcon2Bitmap(HPS hpsMem,         // in: target memory PS with bitmap selected into it
    2451                      HPOINTER hptr,      // in: source icon
    2452                      LONG lBkgndColor,   // in: background color for transparent areas
    2453                      PPOINTL pptlLowerLeft, // in: lower left corner of where to paint (ptr can be NULL)
    2454                      ULONG ulIconSize)   // in: icon size (should be the value of WinQuerySysValue(HWND_DESKTOP, SV_CXICON))
    2455 {
    2456     BOOL        brc = FALSE;
    2457     POINTERINFO pi;
    2458 
    2459     // Each icon consists of two (really three)
    2460     // bitmaps, which are stored in the POINTERINFO
    2461     // structure:
    2462     //   pi.hbmColor    is the actual bitmap to be
    2463     //                  drawn. The parts that are
    2464     //                  to be transparent or inverted
    2465     //                  are black in this image.
    2466     //   pi.hbmPointer  has twice the height of
    2467     //                  hbmColor. The upper bitmap
    2468     //                  contains an XOR mask (for
    2469     //                  inverting parts), the lower
    2470     //                  bitmap an AND mask (for
    2471     //                  transparent parts).
    2472     if (WinQueryPointerInfo(hptr, &pi))
    2473     {
    2474         POINTL  ptlLowerLeft = {0, 0};
    2475         POINTL  aptl[4];
    2476         memset(aptl, 0, sizeof(POINTL) * 4);
    2477 
    2478         if (pptlLowerLeft)
    2479             // lower left specified: V0.9.16 (2001-10-15) [umoeller]
    2480             memcpy(&ptlLowerLeft, pptlLowerLeft, sizeof(POINTL));
    2481 
    2482         // aptl[0]: target bottom-left, is all 0
    2483         aptl[0].x = ptlLowerLeft.x;
    2484         aptl[0].y = ptlLowerLeft.y;
    2485 
    2486         // aptl[1]: target top-right (inclusive!)
    2487         // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion
    2488         aptl[1].x = ptlLowerLeft.x + ulIconSize - 1;
    2489         aptl[1].y = ptlLowerLeft.y + ulIconSize - 1;
    2490 
    2491         // aptl[2]: source bottom-left, is all 0
    2492 
    2493         // aptl[3]: source top-right (exclusive!)
    2494         // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion
    2495         aptl[3].x = ulIconSize; //  + 1;
    2496         aptl[3].y = ulIconSize; //  + 1;
    2497 
    2498         GpiSetColor(hpsMem, CLR_WHITE);
    2499         GpiSetBackColor(hpsMem, CLR_BLACK);
    2500 
    2501         // GpiErase(hpsMem);
    2502 
    2503         // V0.9.19 (2002-06-13) [umoeller]:
    2504         // use BBO_IGNORE instead of BBO_OR or we get funny colors
    2505         // when scaling down
    2506 
    2507         // work on the AND image
    2508         GpiWCBitBlt(hpsMem,     // target
    2509                     pi.hbmPointer,  // src bmp
    2510                     4L,         // must always be 4
    2511                     &aptl[0],   // point array
    2512                     ROP_SRCAND,   // source AND target
    2513                     BBO_IGNORE);        // V0.9.19 (2002-06-13) [umoeller]
    2514 
    2515         // paint the real image
    2516         if (pi.hbmColor)
    2517             GpiWCBitBlt(hpsMem,
    2518                         pi.hbmColor,
    2519                         4L,         // must always be 4
    2520                         &aptl[0],   // point array
    2521                         ROP_SRCPAINT,    // source OR target
    2522                         BBO_IGNORE);        // V0.9.19 (2002-06-13) [umoeller]
    2523 
    2524         GpiSetColor(hpsMem, lBkgndColor);
    2525         // work on the XOR image
    2526         aptl[2].y = ulIconSize;                 // exclusive
    2527         aptl[3].y = (ulIconSize * 2); //  /* + 1; */       // exclusive
    2528         // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion
    2529         GpiWCBitBlt(hpsMem,
    2530                     pi.hbmPointer,
    2531                     4L,         // must always be 4
    2532                     &aptl[0],   // point array
    2533                     ROP_SRCINVERT,
    2534                     BBO_IGNORE);        // V0.9.19 (2002-06-13) [umoeller]
    2535 
    2536         brc = TRUE;
    2537     }
    2538 
    2539     return brc;
    2540 }
    2541 
    2542 #endif
    2543 
    2544 /*
    25452486 *@@ gpihDrawPointer:
    25462487 *      replacement for WinDrawPointer that can do clipping.
     
    25852526 *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader
    25862527 *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED
     2528 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    25872529 */
    25882530
     
    26042546        POINTL  aptl[4];
    26052547        HBITMAP hbmThis;
    2606         BITMAPINFOHEADER2 bmiAndXor,
    2607                           bmiColor;
     2548        SIZEL   szlAndXor,      // V1.0.1 (2002-11-30) [umoeller]
     2549                szlColor;
    26082550
    26092551        // A HPOINTER really consists of two bitmaps,
     
    27162658               )
    27172659            {
    2718                 bmiAndXor.cbFix = sizeof(bmiAndXor);
    2719                 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
     2660                gpihQueryBitmapSize(hbmThis, &szlAndXor);   // V1.0.1 (2002-11-30) [umoeller]
    27202661
    27212662                // use only half the bitmap height
    2722                 cySrc = bmiAndXor.cy / 2;
     2663                cySrc = szlAndXor.cy / 2;
    27232664
    27242665                // aptl[2]: source bottom-left
    27252666                aptl[2].x =   0
    2726                             + lClipLeft   * bmiAndXor.cx / cxIcon;
     2667                            + lClipLeft   * szlAndXor.cx / cxIcon;
    27272668                aptl[2].y =   cySrc
    27282669                            + lClipBottom * cySrc / cyIcon;
    27292670
    27302671                // aptl[3]: source top-right (exclusive!)
    2731                 aptl[3].x =   bmiAndXor.cx
    2732                             - lClipRight  * bmiAndXor.cx / cxIcon;
    2733                 aptl[3].y =   bmiAndXor.cy
     2672                aptl[3].x =   szlAndXor.cx
     2673                            - lClipRight  * szlAndXor.cx / cxIcon;
     2674                aptl[3].y =   szlAndXor.cy
    27342675                            - lClipTop    * cySrc / cyIcon;
    27352676
     
    27532694               )
    27542695            {
    2755                 bmiColor.cbFix = sizeof(bmiColor);
    2756                 GpiQueryBitmapInfoHeader(hbmThis, &bmiColor);
     2696                gpihQueryBitmapSize(hbmThis, &szlColor);        // V1.0.1 (2002-11-30) [umoeller]
    27572697
    27582698                // aptl[2]: source bottom-left
    27592699                aptl[2].x =   0
    2760                             + lClipLeft   * bmiColor.cx / cxIcon;
     2700                            + lClipLeft   * szlColor.cx / cxIcon;
    27612701                aptl[2].y =   0
    2762                             + lClipBottom * bmiColor.cy / cyIcon;
     2702                            + lClipBottom * szlColor.cy / cyIcon;
    27632703
    27642704                // aptl[3]: source top-right (exclusive!)
    2765                 aptl[3].x =   bmiColor.cx
    2766                             - lClipRight  * bmiColor.cx / cxIcon;
    2767                 aptl[3].y =   bmiColor.cy
    2768                             - lClipTop    * bmiColor.cy / cyIcon;
     2705                aptl[3].x =   szlColor.cx
     2706                            - lClipRight  * szlColor.cx / cxIcon;
     2707                aptl[3].y =   szlColor.cy
     2708                            - lClipTop    * szlColor.cy / cyIcon;
    27692709
    27702710                GpiWCBitBlt(hps,        // target
     
    27872727               )
    27882728            {
    2789                 /*  we queried this one above V0.9.20 (2002-07-31) [umoeller]
    2790                 bmiAndXor.cbFix = sizeof(bmiAndXor);
    2791                 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
    2792                 */
     2729                // we queried the size of this one above V0.9.20 (2002-07-31) [umoeller]
    27932730
    27942731                // use only half the bitmap height
    2795                 cySrc = bmiAndXor.cy / 2;
     2732                cySrc = szlAndXor.cy / 2;
    27962733
    27972734                // aptl[2]: source bottom-left
    27982735                aptl[2].x =   0
    2799                             + lClipLeft   * bmiAndXor.cx / cxIcon;
     2736                            + lClipLeft   * szlAndXor.cx / cxIcon;
    28002737                aptl[2].y =   0
    28012738                            + lClipBottom * cySrc / cyIcon;
    28022739
    28032740                // aptl[3]: source top-right (exclusive!)
    2804                 aptl[3].x =   bmiAndXor.cx
    2805                             - lClipRight  * bmiAndXor.cx / cxIcon;
     2741                aptl[3].x =   szlAndXor.cx
     2742                            - lClipRight  * szlAndXor.cx / cxIcon;
    28062743                aptl[3].y =   cySrc
    28072744                            - lClipTop    * cySrc / cyIcon;
  • trunk/src/helpers/helpers_pre.in

    r220 r232  
    8989$(OUTPUTDIR)\cctl_progbar.obj\
    9090$(OUTPUTDIR)\cctl_splitwin.obj\
     91$(OUTPUTDIR)\cctl_toolbar.obj\
    9192$(OUTPUTDIR)\cctl_tooltip.obj\
     93$(OUTPUTDIR)\cctl_xframe.obj\
    9294$(OUTPUTDIR)\comctl.obj\
    9395$(OUTPUTDIR)\configsys.obj\
  • trunk/src/helpers/linklist.c

    r229 r232  
    732732        {
    733733            // insert at a later position:
    734             PLISTNODE pNodeInsertAfter = lstNodeFromIndex(
    735                                     pList,
    736                                     (ulIndex-1));
    737 
    738             if (pNodeInsertAfter)
     734            PLISTNODE pNodeInsertAfter;
     735
     736            if (pNodeInsertAfter = lstNodeFromIndex(pList,
     737                                                    (ulIndex - 1)))
    739738            {
    740739                // 1) set pointers for new node
  • trunk/src/helpers/makefile

    r227 r232  
    263263# fdlg.exe
    264264FDLG_TEST_OBJS = \
     265    $(TESTCASE_DIR)\comctl.obj \
     266    $(TESTCASE_DIR)\cctl_toolbar.obj \
     267    $(TESTCASE_DIR)\cctl_tooltip.obj \
     268    $(TESTCASE_DIR)\cctl_xframe.obj \
    265269    $(TESTCASE_DIR)\dosh.obj \
    266270    $(TESTCASE_DIR)\gpih.obj \
     271    $(TESTCASE_DIR)\linklist.obj \
    267272    $(TESTCASE_DIR)\winh.obj \
    268273    $(TESTCASE_DIR)\stringh.obj \
     
    271276
    272277fdlg.exe: $(FDLG_TEST_OBJS)
    273     ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) /o:$@
     278    ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) pmprintf.lib /o:$@
    274279
    275280# xmap.exe
  • trunk/src/helpers/winh.c

    r229 r232  
    271271/* ******************************************************************
    272272 *
     273 *   Global variables
     274 *
     275 ********************************************************************/
     276
     277extern LONG G_cxScreen = 0,
     278            G_cyScreen = 0,
     279            G_cxIcon = 0,
     280            G_cyIcon = 0,
     281            G_lcol3DDark = 0,         // lo-3D color
     282            G_lcol3DLight = 0;        // hi-3D color
     283
     284/* ******************************************************************
     285 *
    273286 *   Generics
    274287 *
    275288 ********************************************************************/
     289
     290/*
     291 *@@ winhInitGlobals:
     292 *      initializes a few global variables that are usually
     293 *      used all the time in many applications and also
     294 *      internally by many helper routines. You must call
     295 *      this at the start of your application if you want
     296 *      to use these.
     297 *
     298 *@@added V1.0.1 (2002-11-30) [umoeller]
     299 */
     300
     301VOID winhInitGlobals(VOID)
     302{
     303    G_cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
     304    G_cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
     305    G_cxIcon = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
     306    G_cyIcon = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
     307    G_lcol3DDark = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0);
     308    G_lcol3DLight = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0);
     309}
    276310
    277311/*
     
    28052839        // if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
    28062840                // not cy, but cx V1.0.0 (2002-08-26) [umoeller]
    2807         if (xNew + swpThis.cx > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
     2841        if (xNew + swpThis.cx > G_cxScreen)
    28082842        {
    28092843            // place left then
     
    29022936
    29032937/*
     2938 *@@ winhQueryDefaultFont:
     2939 *
     2940 *@@added V1.0.1 (2002-11-30) [umoeller]
     2941 */
     2942
     2943PCSZ winhQueryDefaultFont(VOID)
     2944{
     2945    if (doshIsWarp4())
     2946        return "9.WarpSans";
     2947
     2948    return "8.Helv";
     2949}
     2950
     2951/*
    29042952 *@@ winhSetWindowFont:
    29052953 *      this sets a window's font by invoking
     
    29142962 *
    29152963 *@@added V0.9.0 [umoeller]
     2964 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized
    29162965 */
    29172966
     
    29192968                       const char *pcszFont)
    29202969{
    2921     CHAR    szFont[256];
    2922 
    2923     if (pcszFont == NULL)
    2924     {
    2925         if (doshIsWarp4())
    2926             strhncpy0(szFont, "9.WarpSans", sizeof(szFont));
    2927         else
    2928             strhncpy0(szFont, "8.Helv", sizeof(szFont));
    2929     }
    2930     else
    2931         strhncpy0(szFont, pcszFont, sizeof(szFont));
     2970    if (!pcszFont)
     2971        pcszFont = winhQueryDefaultFont();
    29322972
    29332973    return WinSetPresParam(hwnd,
    29342974                           PP_FONTNAMESIZE,
    2935                            strlen(szFont)+1,
    2936                            szFont);
     2975                           strlen(pcszFont) + 1,
     2976                           (PSZ)pcszFont);
    29372977}
    29382978
     
    30823122        }
    30833123    }
     3124
    30843125    return brc;
     3126}
     3127
     3128/*
     3129 *@@ winhCreateDefaultPresparams:
     3130 *
     3131 *      Caller must free() the return value.
     3132 *
     3133 *@@added V1.0.1 (2002-11-30) [umoeller]
     3134 */
     3135
     3136PPRESPARAMS winhCreateDefaultPresparams(VOID)
     3137{
     3138    PPRESPARAMS ppp = NULL;
     3139
     3140    PCSZ    pcszFont = winhQueryDefaultFont();
     3141    LONG    lColor;
     3142
     3143    winhStorePresParam(&ppp,
     3144                       PP_FONTNAMESIZE,
     3145                       strlen(pcszFont) + 1,
     3146                       (PVOID)pcszFont);
     3147
     3148    lColor = WinQuerySysColor(HWND_DESKTOP,
     3149                              SYSCLR_DIALOGBACKGROUND,
     3150                              0);
     3151    winhStorePresParam(&ppp,
     3152                       PP_BACKGROUNDCOLOR,
     3153                       sizeof(lColor),
     3154                       &lColor);
     3155
     3156    lColor = RGBCOL_BLACK;
     3157    winhStorePresParam(&ppp,
     3158                       PP_FOREGROUNDCOLOR,
     3159                       sizeof(lColor),
     3160                       &lColor);
     3161
     3162    return ppp;
    30853163}
    30863164
     
    34973575
    34983576/*
    3499  *@@ winhMyAnchorBlock:
    3500  *      returns the proper anchor block (HAB)
    3501  *      for the calling thread.
    3502  *
    3503  *      Many Win* functions require an HAB to be
    3504  *      passed in. While many of them will work
    3505  *      when passing in NULLHANDLE, some (such as
    3506  *      WinGetMsg) won't. If you don't know the
    3507  *      anchor block of the calling thread, use
    3508  *      this function.
    3509  *
    3510  *      This creates a temporary object window to
    3511  *      find out the anchor block. This is quite
    3512  *      expensive so only use this if there's no
    3513  *      other way to find out.
    3514  *
    3515  *@@added V0.9.11 (2001-04-20) [umoeller]
    3516  */
    3517 
    3518 HAB winhMyAnchorBlock(VOID)
    3519 {
    3520     HAB hab = NULLHANDLE;
    3521     HWND hwnd;
    3522     if (hwnd = winhCreateObjectWindow(WC_BUTTON, NULL))
    3523     {
    3524         hab = WinQueryAnchorBlock(hwnd);
    3525         WinDestroyWindow(hwnd);
    3526     }
    3527 
    3528     return hab;
    3529 }
    3530 
    3531 /*
    35323577 *@@ winhFree:
    35333578 *      frees a block of memory allocated by the
     
    37283773
    37293774/*
     3775 *@@ winhQueryWaitPointer:
     3776 *      shortcut for getting the system "wait" pointer.
     3777 *
     3778 *@@added V1.0.1 (2002-11-30) [umoeller]
     3779 */
     3780
     3781HPOINTER winhQueryWaitPointer(VOID)
     3782{
     3783    return WinQuerySysPointer(HWND_DESKTOP,
     3784                              SPTR_WAIT,
     3785                              FALSE);   // no copy
     3786}
     3787
     3788/*
    37303789 *@@ winhSetWaitPointer:
    37313790 *      this sets the mouse pointer to "Wait".
     
    37423801    HPOINTER hptr = WinQueryPointer(HWND_DESKTOP);
    37433802    WinSetPointer(HWND_DESKTOP,
    3744                   WinQuerySysPointer(HWND_DESKTOP,
    3745                                      SPTR_WAIT,
    3746                                      FALSE));   // no copy
     3803                  winhQueryWaitPointer());
    37473804    return hptr;
    37483805}
     
    37603817{
    37613818    PSZ     pszText = NULL;
    3762     ULONG   cbText = WinQueryWindowTextLength(hwnd);
    3763                                     // additional null character
    3764     if (cbText)
    3765     {
    3766         if (pszText = (PSZ)malloc(cbText + 1))
     3819    ULONG   cbText;
     3820    if (cbText = WinQueryWindowTextLength(hwnd))
     3821    {
     3822        if (pszText = (PSZ)malloc(cbText + 1))  // additional null character
    37673823            WinQueryWindowText(hwnd,
    37683824                               cbText + 1,
    37693825                               pszText);
    37703826    }
     3827
    37713828    return pszText;
    37723829}
     
    38213878{
    38223879    BOOL    brc = FALSE;
    3823     PSZ     pszText = winhQueryWindowText(hwnd);
    3824     if (pszText)
     3880    PSZ     pszText;
     3881
     3882    if (pszText = winhQueryWindowText(hwnd))
    38253883    {
    38263884        ULONG ulOfs = 0;
     
    38303888            brc = TRUE;
    38313889        }
     3890
    38323891        free(pszText);
    38333892    }
     3893
    38343894    return brc;
    38353895}
     
    39393999 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed
    39404000 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window
     4001 *@@changed V1.0.1 (2002-11-30) [umoeller]: added support for NULL pcszClassClient
    39414002 */
    39424003
     
    39474008                         const char *pcszFrameTitle, // in: frame title (title bar)
    39484009                         ULONG ulResourcesID,       // in: according to FCF_* flags
    3949                          const char *pcszClassClient, // in: client class name
     4010                         const char *pcszClassClient, // in: client class name (can be NULL for no client)
    39504011                         ULONG flStyleClient,       // in: client style
    39514012                         ULONG ulID,                // in: frame window ID
    39524013                         PVOID pClientCtlData,      // in: pCtlData structure pointer for client
    3953                          PHWND phwndClient)         // out: created client wnd
     4014                         PHWND phwndClient)         // out: created client wnd (required)
    39544015{
    39554016    FRAMECDATA  fcdata;
     
    39624023    fcdata.idResources   = ulResourcesID;
    39634024
    3964     /* Create the frame and client windows.  */
    3965     hwndFrame = WinCreateWindow(hwndFrameParent,
    3966                                 WC_FRAME,
    3967                                 (PSZ)pcszFrameTitle,
    3968                                 ulFrameStyle,
    3969                                 0,0,0,0,         // size and position = 0
    3970                                 NULLHANDLE,      // no owner
    3971                                 HWND_TOP,        // z-order
    3972                                 ulID,            // frame window ID
    3973                                 &fcdata,         // frame class data
    3974                                 NULL);           // no presparams
    3975 
    3976     if (hwndFrame)
    3977     {
    3978         if (*phwndClient = WinCreateWindow(hwndFrame,      // parent
    3979                                            (PSZ)pcszClassClient, // class
    3980                                            NULL,           // no title
    3981                                            flStyleClient,  // style
    3982                                            0,0,0,0,        // size and position = 0
    3983                                            hwndFrame,      // owner
    3984                                            HWND_BOTTOM,    // bottom z-order
    3985                                            FID_CLIENT,     // frame window ID
    3986                                            pClientCtlData, // class data
    3987                                            NULL))          // no presparams
     4025    // create the frame and client windows
     4026    if (hwndFrame = WinCreateWindow(hwndFrameParent,
     4027                                    WC_FRAME,
     4028                                    (PSZ)pcszFrameTitle,
     4029                                    ulFrameStyle,
     4030                                    0,0,0,0,
     4031                                    NULLHANDLE,
     4032                                    HWND_TOP,
     4033                                    ulID,
     4034                                    &fcdata,
     4035                                    NULL))
     4036    {
     4037        if (    (!pcszClassClient)          // V1.0.1 (2002-11-30) [umoeller]
     4038             || (*phwndClient = WinCreateWindow(hwndFrame,      // parent
     4039                                                (PSZ)pcszClassClient, // class
     4040                                                NULL,           // no title
     4041                                                flStyleClient,  // style
     4042                                                0,0,0,0,        // size and position = 0
     4043                                                hwndFrame,      // owner
     4044                                                HWND_BOTTOM,    // bottom z-order
     4045                                                FID_CLIENT,     // frame window ID
     4046                                                pClientCtlData, // class data
     4047                                                NULL))          // no presparams
     4048           )
    39884049        {
    39894050            if (pswpFrame)
     
    39984059                                pswpFrame->fl);
    39994060
    4000                 // position client
    4001                 // WinQueryWindowRect(hwndFrame, &rclClient);
    4002                 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
    4003                 rclClient.xLeft = 0;
    4004                 rclClient.yBottom = 0;
    4005                 rclClient.xRight = pswpFrame->cx;
    4006                 rclClient.yTop = pswpFrame->cy;
    4007                 WinCalcFrameRect(hwndFrame,
    4008                                  &rclClient,
    4009                                  TRUE);     // calc client from frame
    4010                 WinSetWindowPos(*phwndClient,
    4011                                 HWND_TOP,
    4012                                 rclClient.xLeft,
    4013                                 rclClient.yBottom,
    4014                                 rclClient.xRight - rclClient.xLeft,
    4015                                 rclClient.yTop - rclClient.yBottom,
    4016                                 SWP_MOVE | SWP_SIZE | SWP_SHOW);
     4061                if (!pcszClassClient)
     4062                    *phwndClient = NULLHANDLE;
     4063                else
     4064                {
     4065                    // position client
     4066                    // WinQueryWindowRect(hwndFrame, &rclClient);
     4067                    // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
     4068                    rclClient.xLeft = 0;
     4069                    rclClient.yBottom = 0;
     4070                    rclClient.xRight = pswpFrame->cx;
     4071                    rclClient.yTop = pswpFrame->cy;
     4072                    WinCalcFrameRect(hwndFrame,
     4073                                     &rclClient,
     4074                                     TRUE);     // calc client from frame
     4075                    WinSetWindowPos(*phwndClient,
     4076                                    HWND_TOP,
     4077                                    rclClient.xLeft,
     4078                                    rclClient.yBottom,
     4079                                    rclClient.xRight - rclClient.xLeft,
     4080                                    rclClient.yTop - rclClient.yBottom,
     4081                                    SWP_MOVE | SWP_SIZE | SWP_SHOW);
     4082                }
    40174083            }
    40184084        }
     
    41194185        if (WinQueryClassName(hwndThis, sizeof(szClass), szClass))
    41204186        {
    4121             if (strcmp(szClass, "#32767") == 0)
     4187            if (!strcmp(szClass, "#32767"))
    41224188            {
    41234189                // message queue window:
     
    41324198                {
    41334199                    // get HMQ from window words
    4134                     rc = WinQueryWindowULong(hwndThis, QWL_HMQ);
    4135                     if (rc)
     4200                    if (rc = WinQueryWindowULong(hwndThis, QWL_HMQ))
    41364201                        if (phab)
    41374202                            *phab = WinQueryAnchorBlock(hwndThis);
     4203
    41384204                    break;
    41394205                }
     
    41784244    // enumerate all child windows of HWND_OBJECT
    41794245    henumObject = WinBeginEnumWindows(HWND_OBJECT);
    4180     while ((hwndObjectChild = WinGetNextWindow(henumObject)) != NULLHANDLE)
     4246    while ((hwndObjectChild = WinGetNextWindow(henumObject)))
    41814247    {
    41824248        // see if the current HWND_OBJECT child window runs in the
     
    42724338                           WS_VISIBLE,    // window style
    42734339                           0, 0,          // position and size
    4274                            WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),
    4275                            WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),
     4340                           G_cxScreen,
     4341                           G_cyScreen,
    42764342                           NULLHANDLE,    // owner window
    42774343                           hwndSibling,   // sibling window
     
    44264492 *         was encountered.
    44274493 *
    4428  *      You can specify DT_QUERYEXTENT with flDraw to only have
    4429  *      these text boundaries calculated without actually drawing.
     4494 *      The following DT_* flags are supported:
     4495 *
     4496 *      --  DT_LEFT, DT_CENTER, DT_RIGHT all work.
     4497 *
     4498 *      --  Vertically however only DT_TOP is supported.
     4499 *
     4500 *      --  You can specify DT_QUERYEXTENT to only have
     4501 *          these text boundaries calculated without actually
     4502 *          drawing.
     4503 *
     4504 *      Note that DT_TEXTATTRS will always be added, so you
     4505 *      will want to call GpiSetColor before this.
    44304506 *
    44314507 *      This returns the number of lines drawn.
    4432  *
    4433  *      Note that this calls WinDrawText with DT_TEXTATTRS set,
    4434  *      that is, the current text primitive attributes will be
    4435  *      used (fonts and colors).
    44364508 *
    44374509 *@@changed V0.9.0 [umoeller]: prcl.xLeft and xRight are now updated too upon return
     
    44434515                                         // (modified)
    44444516                            const char *pcszText, // in: text to draw (zero-terminated)
    4445                             ULONG flCmd) // in: flags like in WinDrawText; I have
    4446                                          // only tested DT_TOP and DT_LEFT though.
    4447                                          // DT_WORDBREAK | DT_TEXTATTRS are always
    4448                                          // set.
    4449                                          // You can specify DT_QUERYEXTENT to only
    4450                                          // have prcl calculated without drawing.
     4517                            ULONG flCmd) // in: DT_* flags like in WinDrawText; see remarks
    44514518{
    44524519    PSZ     p = (PSZ)pcszText;
     
    44724539        memcpy(&rcl2, prcl, sizeof(rcl2));
    44734540        lDrawn = WinDrawText(hps,
    4474                              ulTextLen-lTotalDrawn,
     4541                             ulTextLen - lTotalDrawn,
    44754542                             p,
    44764543                             &rcl2,
    4477                              0, 0,                       // colors
     4544                             0,
     4545                             0,                       // colors
    44784546                             flCmd2);
    44794547
     
    44944562        lLineCount++;
    44954563    }
     4564
    44964565    prcl->xLeft = xLeftmost;
    44974566    prcl->xRight = xRightmost;
     
    45214590PSWBLOCK winhQuerySwitchList(HAB hab)
    45224591{
    4523     ULONG   cItems = WinQuerySwitchList(hab, NULL, 0);
    4524     ULONG   ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
    4525     PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize);
    4526     if (pSwBlock)
    4527     {
    4528         cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize);
    4529         if (!cItems)
     4592    ULONG       cItems = WinQuerySwitchList(hab, NULL, 0);
     4593    ULONG       ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
     4594    PSWBLOCK    pSwBlock;
     4595    if (pSwBlock = (PSWBLOCK)malloc(ulBufSize))
     4596    {
     4597        if (!(cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize)))
    45304598        {
    45314599            free(pSwBlock);
     
    47474815                    &ShiftState, DataLen, &DataLen,
    47484816                    NULL, 0L, NULL);
     4817
    47494818        // now close OS/2 keyboard driver
    47504819        DosClose(hKbd);
    47514820    }
    4752     return;
    47534821}
    47544822
     
    47984866
    47994867/*
    4800  *@@category: Helpers\PM helpers\Extended frame windows
    4801  */
    4802 
    4803 /* ******************************************************************
    4804  *
    4805  *   Extended frame
    4806  *
    4807  ********************************************************************/
    4808 
    4809 /*
    4810  *@@ winhCalcExtFrameRect:
    4811  *      implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame.
    4812  *      This is exported so it can be used independently
    4813  *      (XWorkplace status bars).
    4814  *
    4815  *@@added V1.0.0 (2002-08-28) [umoeller]
    4816  */
    4817 
    4818 VOID winhCalcExtFrameRect(MPARAM mp1,
    4819                           MPARAM mp2,
    4820                           LONG lStatusBarHeight)
    4821 {
    4822     PRECTL prclPassed = (PRECTL)mp1;
    4823 
    4824     // mp2 == TRUE:  Frame rectangle provided, calculate client
    4825     // mp2 == FALSE: Client area rectangle provided, calculate frame
    4826     if (mp2)
    4827     {
    4828         //  TRUE: calculate the rectl of the client;
    4829         //  call default window procedure to subtract child frame
    4830         //  controls from the rectangle's height
    4831         LONG lClientHeight;
    4832 
    4833         //  position the static text frame extension below the client
    4834         lClientHeight = prclPassed->yTop - prclPassed->yBottom;
    4835         if (lStatusBarHeight > lClientHeight)
    4836             // extension is taller than client, so set client height to 0
    4837             prclPassed->yTop = prclPassed->yBottom;
    4838         else
    4839         {
    4840             //  set the origin of the client and shrink it based upon the
    4841             //  static text control's height
    4842             prclPassed->yBottom += lStatusBarHeight;
    4843             prclPassed->yTop -= lStatusBarHeight;
    4844         }
    4845     }
    4846     else
    4847     {
    4848         //  FALSE: calculate the rectl of the frame;
    4849         //  call default window procedure to subtract child frame
    4850         //  controls from the rectangle's height;
    4851         //  set the origin of the frame and increase it based upon the
    4852         //  static text control's height
    4853         prclPassed->yBottom -= lStatusBarHeight;
    4854         prclPassed->yTop += lStatusBarHeight;
    4855     }
    4856 }
    4857 
    4858 #define STATUS_BAR_HEIGHT       20
    4859 
    4860 /*
    4861  *@@ fnwpSubclExtFrame:
    4862  *      subclassed frame window proc.
    4863  *
    4864  *@@added V0.9.16 (2001-09-29) [umoeller]
    4865  */
    4866 
    4867 MRESULT EXPENTRY fnwpSubclExtFrame(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)
    4868 {
    4869     MRESULT mrc = 0;
    4870 
    4871     PEXTFRAMEDATA pData = (PEXTFRAMEDATA)WinQueryWindowPtr(hwndFrame, QWL_USER);
    4872 
    4873     switch (msg)
    4874     {
    4875         case WM_QUERYFRAMECTLCOUNT:
    4876         {
    4877             // query the standard frame controls count
    4878             ULONG ulrc = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4879 
    4880             // if we have a status bar, increment the count
    4881             ulrc++;
    4882 
    4883             mrc = (MPARAM)ulrc;
    4884         }
    4885         break;
    4886 
    4887         case WM_FORMATFRAME:
    4888         {
    4889             // query the number of standard frame controls
    4890             ULONG ulCount = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4891 
    4892             // we have a status bar:
    4893             // format the frame
    4894             ULONG       ul;
    4895             PSWP        swpArr = (PSWP)mp1;
    4896 
    4897             for (ul = 0; ul < ulCount; ul++)
    4898             {
    4899                 if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008)
    4900                                                                  // FID_CLIENT
    4901                 {
    4902                     POINTL      ptlBorderSizes;
    4903                     WinSendMsg(hwndFrame,
    4904                                WM_QUERYBORDERSIZE,
    4905                                (MPARAM)&ptlBorderSizes,
    4906                                0);
    4907 
    4908                     // first initialize the _new_ SWP for the status bar.
    4909                     // Since the SWP array for the std frame controls is
    4910                     // zero-based, and the standard frame controls occupy
    4911                     // indices 0 thru ulCount-1 (where ulCount is the total
    4912                     // count), we use ulCount for our static text control.
    4913                     swpArr[ulCount].fl = SWP_MOVE | SWP_SIZE | SWP_NOADJUST | SWP_ZORDER;
    4914                     swpArr[ulCount].x  = ptlBorderSizes.x;
    4915                     swpArr[ulCount].y  = ptlBorderSizes.y;
    4916                     swpArr[ulCount].cx = swpArr[ul].cx;  // same as cnr's width
    4917                     swpArr[ulCount].cy = STATUS_BAR_HEIGHT;
    4918                     swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP;
    4919                     swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR);
    4920 
    4921                     // adjust the origin and height of the container to
    4922                     // accomodate our static text control
    4923                     swpArr[ul].y  += swpArr[ulCount].cy;
    4924                     swpArr[ul].cy -= swpArr[ulCount].cy;
    4925                 }
    4926             }
    4927 
    4928             // increment the number of frame controls
    4929             // to include our status bar
    4930             mrc = (MRESULT)(ulCount + 1);
    4931         }
    4932         break;
    4933 
    4934         case WM_CALCFRAMERECT:
    4935             mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4936 
    4937             // we have a status bar: calculate its rectangle
    4938             winhCalcExtFrameRect(mp1,
    4939                                  mp2,
    4940                                  STATUS_BAR_HEIGHT);
    4941         break;
    4942 
    4943         case WM_DESTROY:
    4944             WinSubclassWindow(hwndFrame, pData->pfnwpOrig);
    4945             free(pData);
    4946             WinSetWindowPtr(hwndFrame, QWL_USER, NULL);
    4947         break;
    4948 
    4949         default:
    4950             mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    4951     }
    4952 
    4953     return mrc;
    4954 }
    4955 
    4956 /*
    4957  *@@ winhCreateStatusBar:
    4958  *      creates a status bar for a frame window.
    4959  *
    4960  *      Normally there's no need to call this manually,
    4961  *      this gets called by winhCreateExtStdWindow
    4962  *      automatically.
    4963  *
    4964  *@@added V0.9.16 (2001-09-29) [umoeller]
    4965  */
    4966 
    4967 HWND winhCreateStatusBar(HWND hwndFrame,
    4968                          HWND hwndOwner,
    4969                          const char *pcszText,      // in: initial status bar text
    4970                          const char *pcszFont,      // in: font to use for status bar
    4971                          LONG lColor)               // in: foreground color for status bar
    4972 {
    4973     // create status bar
    4974     HWND        hwndReturn = NULLHANDLE;
    4975     PPRESPARAMS ppp = NULL;
    4976 
    4977     winhStorePresParam(&ppp,
    4978                        PP_FONTNAMESIZE,
    4979                        strlen(pcszFont) + 1,
    4980                        (PVOID)pcszFont);
    4981 
    4982     lColor = WinQuerySysColor(HWND_DESKTOP,
    4983                               SYSCLR_DIALOGBACKGROUND,
    4984                               0);
    4985     winhStorePresParam(&ppp,
    4986                        PP_BACKGROUNDCOLOR,
    4987                        sizeof(lColor),
    4988                        &lColor);
    4989 
    4990     lColor = CLR_BLACK;
    4991     winhStorePresParam(&ppp,
    4992                        PP_FOREGROUNDCOLOR,
    4993                        sizeof(lColor),
    4994                        &lColor);
    4995 
    4996     hwndReturn = WinCreateWindow(hwndFrame,
    4997                                  WC_STATIC,
    4998                                  (PSZ)pcszText,
    4999                                  SS_TEXT | DT_VCENTER | WS_VISIBLE,
    5000                                  0, 0, 0, 0,
    5001                                  hwndOwner,
    5002                                  HWND_TOP,
    5003                                  FID_STATUSBAR,
    5004                                  NULL,
    5005                                  ppp);
    5006     free(ppp);
    5007 
    5008     return hwndReturn;
    5009 }
    5010 
    5011 /*
    5012  *@@ winhCreateExtStdWindow:
    5013  *      creates an extended frame window.
    5014  *
    5015  *      pData must point to an EXTFRAMECDATA structure
    5016  *      which contains a copy of the parameters to be
    5017  *      passed to winhCreateStdWindow. In addition,
    5018  *      this contains the flExtFlags field, which allows
    5019  *      you to automatically create a status bar for
    5020  *      the window.
    5021  *
    5022  *      Note that we subclass the frame here and require
    5023  *      QWL_USER for that. The frame's QWL_USER points
    5024  *      to an EXTFRAMEDATA structure whose pUser parameter
    5025  *      you may use for additional data, if you want to
    5026  *      do further subclassing.
    5027  *
    5028  *@@added V0.9.16 (2001-09-29) [umoeller]
    5029  */
    5030 
    5031 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData,        // in: extended frame data
    5032                             PHWND phwndClient)          // out: created client wnd
    5033 {
    5034     HWND hwndFrame;
    5035 
    5036     if (hwndFrame = winhCreateStdWindow(HWND_DESKTOP,
    5037                                         pData->pswpFrame,
    5038                                         pData->flFrameCreateFlags,
    5039                                         pData->ulFrameStyle,
    5040                                         pData->pcszFrameTitle,
    5041                                         pData->ulResourcesID,
    5042                                         pData->pcszClassClient,
    5043                                         pData->flStyleClient,
    5044                                         pData->ulID,
    5045                                         pData->pClientCtlData,
    5046                                         phwndClient))
    5047     {
    5048         if (pData->flExtFlags & XFCF_STATUSBAR)
    5049         {
    5050             // create status bar as child of the frame
    5051             HWND hwndStatusBar = winhCreateStatusBar(hwndFrame,
    5052                                                      hwndFrame,
    5053                                                      "",
    5054                                                      "9.WarpSans",
    5055                                                      CLR_BLACK);
    5056 
    5057             // subclass frame for supporting status bar and msgs
    5058             PEXTFRAMEDATA pFrameData;
    5059             if (pFrameData = NEW(EXTFRAMEDATA))
    5060             {
    5061                 ZERO(pFrameData),
    5062                 memcpy(&pFrameData->CData, pData, sizeof(pFrameData->CData));
    5063                 if (pFrameData->pfnwpOrig = WinSubclassWindow(hwndFrame,
    5064                                                               fnwpSubclExtFrame))
    5065                 {
    5066                     WinSetWindowPtr(hwndFrame, QWL_USER, pFrameData);
    5067                 }
    5068                 else
    5069                     free(pFrameData);
    5070             }
    5071         }
    5072     }
    5073 
    5074     return hwndFrame;
    5075 }
    5076 
    5077 /*
    50784868 *@@category: Helpers\PM helpers\Workplace Shell\WPS class list
    50794869 */
     
    51564946    while (pocThis)
    51574947    {
    5158         if (strcmp(pocThis->pszClassName, pszClass) == 0)
     4948        if (!strcmp(pocThis->pszClassName, pszClass))
    51594949        {
    51604950            pbReturn = (PBYTE)pocThis;
    51614951            break;
    51624952        }
     4953
    51634954        // next class
    51644955        pocThis = pocThis->pNext;
     
    52375028        // failed: do more error checking then, try DosLoadModule
    52385029        HMODULE hmod = NULLHANDLE;
    5239         arc = DosLoadModule(pszBuf, cbBuf,
    5240                             (PSZ)pcszModule,
    5241                             &hmod);
    5242         if (arc == NO_ERROR)
     5030        if (!(arc = DosLoadModule(pszBuf, cbBuf,
     5031                                  (PSZ)pcszModule,
     5032                                  &hmod)))
    52435033        {
    52445034            // DosLoadModule succeeded:
     
    52665056{
    52675057    BOOL    brc = FALSE;
    5268     PBYTE   pClassList = winhQueryWPSClassList();
    5269     if (pClassList)
     5058    PBYTE   pClassList;
     5059
     5060    if (pClassList = winhQueryWPSClassList())
    52705061    {
    52715062        if (winhQueryWPSClass(pClassList, pcszClass))
    52725063            brc = TRUE;
     5064
    52735065        free(pClassList);
    52745066    }
     
    53315123    return ulrc;
    53325124}
     5125
Note: See TracChangeset for help on using the changeset viewer.