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

New toolbar control.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/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    /* ******************************************************************
Note: See TracChangeset for help on using the changeset viewer.