Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame^] | 1 | /* vi:set ts=8 sts=4 sw=4: |
| 2 | * |
| 3 | * VIM - Vi IMproved by Bram Moolenaar |
| 4 | * Win16 Toolbar by Vince Negri - External Header |
| 5 | * (Based on MS Sample Code) |
| 6 | * |
| 7 | * Do ":help uganda" in Vim to read copying and usage conditions. |
| 8 | * Do ":help credits" in Vim to see a list of people who contributed. |
| 9 | */ |
| 10 | // |
| 11 | // Button Structure |
| 12 | // |
| 13 | typedef struct tagTBBUTTON |
| 14 | { |
| 15 | int iBitmap; // index into bitmap of this button's picture |
| 16 | int idCommand; // WM_COMMAND menu ID that this button sends |
| 17 | BYTE fsState; // button's state |
| 18 | BYTE fsStyle; // button's style |
| 19 | } TBBUTTON; |
| 20 | |
| 21 | typedef TBBUTTON NEAR* PTBBUTTON; |
| 22 | typedef TBBUTTON FAR* LPTBBUTTON; |
| 23 | typedef const TBBUTTON FAR* LPCTBBUTTON; |
| 24 | |
| 25 | |
| 26 | // |
| 27 | // Styles |
| 28 | // |
| 29 | #define TBSTYLE_BUTTON 0x00 // this entry is button |
| 30 | #define TBSTYLE_SEP 0x01 // this entry is a separator |
| 31 | #define TBSTYLE_CHECK 0x02 // this is a check button (it stays down) |
| 32 | #define TBSTYLE_GROUP 0x04 // this is a check button (it stays down) |
| 33 | #define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) // this group is a member of a group radio group |
| 34 | |
| 35 | // |
| 36 | // States |
| 37 | // |
| 38 | #define TBSTATE_CHECKED 0x01 // radio button is checked |
| 39 | #define TBSTATE_PRESSED 0x02 // button is being depressed (any style) |
| 40 | #define TBSTATE_ENABLED 0x04 // button is enabled |
| 41 | #define TBSTATE_HIDDEN 0x08 // button is hidden |
| 42 | #define TBSTATE_INDETERMINATE 0x10 // button is indeterminate |
| 43 | #define TBSTATE_SELECTED 0x20 // mouse hovering over button (for coolbar look) |
| 44 | |
| 45 | |
| 46 | |
| 47 | typedef struct tagADJUSTINFO |
| 48 | { |
| 49 | TBBUTTON tbButton; |
| 50 | char szDescription[1]; |
| 51 | } ADJUSTINFO; |
| 52 | |
| 53 | typedef ADJUSTINFO NEAR* PADJUSTINFO; |
| 54 | typedef ADJUSTINFO FAR* LPADJUSTINFO; |
| 55 | |
| 56 | |
| 57 | HWND WINAPI CreateToolbar(HWND hwnd, DWORD ws, WORD wID, int nBitmaps, |
| 58 | HINSTANCE hBMInst, WORD wBMID, |
| 59 | LPCTBBUTTON lpButtons, int iNumButtons); |
| 60 | |
| 61 | #define CMB_DISCARDABLE 0x01 // create bitmap as discardable |
| 62 | #define CMB_MASKED 0x02 // create image/mask pair in bitmap |
| 63 | |
| 64 | |
| 65 | #define TB_ENABLEBUTTON (WM_USER + 1) |
| 66 | // wParam: UINT, button ID |
| 67 | // lParam: BOOL LOWORD, enable if nonzero; HIWORD not used, 0 |
| 68 | // return: not used |
| 69 | // |
| 70 | |
| 71 | #define TB_CHECKBUTTON (WM_USER + 2) |
| 72 | // wParam: UINT, button ID |
| 73 | // lParam: BOOL LOWORD, check if nonzero; HIWORD not used, 0 |
| 74 | // return: not used |
| 75 | // |
| 76 | |
| 77 | #define TB_PRESSBUTTON (WM_USER + 3) |
| 78 | // wParam: UINT, button ID |
| 79 | // lParam: BOOL LOWORD, press if nonzero; HIWORD not used, 0 |
| 80 | // return: not used |
| 81 | // |
| 82 | |
| 83 | #define TB_HIDEBUTTON (WM_USER + 4) |
| 84 | // wParam: UINT, button ID |
| 85 | // lParam: BOOL LOWORD, hide if nonzero; HIWORD not used, 0 |
| 86 | // return: not used |
| 87 | // |
| 88 | #define TB_INDETERMINATE (WM_USER + 5) |
| 89 | // wParam: UINT, button ID |
| 90 | // lParam: BOOL LOWORD, make indeterminate if nonzero; HIWORD not used, 0 |
| 91 | // return: not used |
| 92 | // |
| 93 | |
| 94 | #define TB_ISBUTTONENABLED (WM_USER + 9) |
| 95 | // wParam: UINT, button ID |
| 96 | // lParam: not used, 0 |
| 97 | // return: BOOL LOWORD, enabled if nonzero; HIWORD not used |
| 98 | // |
| 99 | |
| 100 | #define TB_ISBUTTONCHECKED (WM_USER + 10) |
| 101 | // wParam: UINT, button ID |
| 102 | // lParam: not used, 0 |
| 103 | // return: BOOL LOWORD, checked if nonzero; HIWORD not used |
| 104 | // |
| 105 | |
| 106 | #define TB_ISBUTTONPRESSED (WM_USER + 11) |
| 107 | // wParam: UINT, button ID |
| 108 | // lParam: not used, 0 |
| 109 | // return: BOOL LOWORD, pressed if nonzero; HIWORD not used |
| 110 | // |
| 111 | |
| 112 | #define TB_ISBUTTONHIDDEN (WM_USER + 12) |
| 113 | // wParam: UINT, button ID |
| 114 | // lParam: not used, 0 |
| 115 | // return: BOOL LOWORD, hidden if nonzero; HIWORD not used |
| 116 | // |
| 117 | |
| 118 | #define TB_ISBUTTONINDETERMINATE (WM_USER + 13) |
| 119 | // wParam: UINT, button ID |
| 120 | // lParam: not used, 0 |
| 121 | // return: BOOL LOWORD, indeterminate if nonzero; HIWORD not used |
| 122 | // |
| 123 | |
| 124 | #define TB_SETSTATE (WM_USER + 17) |
| 125 | // wParam: UINT, button ID |
| 126 | // lParam: UINT LOWORD, state bits; HIWORD not used, 0 |
| 127 | // return: not used |
| 128 | // |
| 129 | |
| 130 | #define TB_GETSTATE (WM_USER + 18) |
| 131 | // wParam: UINT, button ID |
| 132 | // lParam: not used, 0 |
| 133 | // return: UINT LOWORD, state bits; HIWORD not used |
| 134 | // |
| 135 | |
| 136 | #define TB_ADDBITMAP (WM_USER + 19) |
| 137 | // wParam: UINT, number of button graphics in bitmap |
| 138 | // lParam: one of: |
| 139 | // HINSTANCE LOWORD, module handle; UINT HIWORD, resource id |
| 140 | // HINSTANCE LOWORD, NULL; HBITMAP HIWORD, bitmap handle |
| 141 | // return: one of: |
| 142 | // int LOWORD, index for first new button; HIWORD not used |
| 143 | // int LOWORD, -1 indicating error; HIWORD not used |
| 144 | // |
| 145 | |
| 146 | #define TB_ADDBUTTONS (WM_USER + 20) |
| 147 | // wParam: UINT, number of buttons to add |
| 148 | // lParam: LPTBBUTTON, pointer to array of TBBUTTON structures |
| 149 | // return: not used |
| 150 | // |
| 151 | |
| 152 | #define TB_INSERTBUTTON (WM_USER + 21) |
| 153 | // wParam: UINT, index for insertion (appended if index doesn't exist) |
| 154 | // lParam: LPTBBUTTON, pointer to one TBBUTTON structure |
| 155 | // return: not used |
| 156 | // |
| 157 | |
| 158 | #define TB_DELETEBUTTON (WM_USER + 22) |
| 159 | // wParam: UINT, index of button to delete |
| 160 | // lParam: not used, 0 |
| 161 | // return: not used |
| 162 | // |
| 163 | |
| 164 | #define TB_GETBUTTON (WM_USER + 23) |
| 165 | // wParam: UINT, index of button to get |
| 166 | // lParam: LPTBBUTTON, pointer to TBBUTTON buffer to receive button |
| 167 | // return: not used |
| 168 | // |
| 169 | |
| 170 | #define TB_BUTTONCOUNT (WM_USER + 24) |
| 171 | // wParam: not used, 0 |
| 172 | // lParam: not used, 0 |
| 173 | // return: UINT LOWORD, number of buttons; HIWORD not used |
| 174 | // |
| 175 | |
| 176 | #define TB_COMMANDTOINDEX (WM_USER + 25) |
| 177 | // wParam: UINT, command id |
| 178 | // lParam: not used, 0 |
| 179 | // return: UINT LOWORD, index of button (-1 if command not found); |
| 180 | // HIWORD not used |
| 181 | // |
| 182 | |
| 183 | |
| 184 | #define TBN_BEGINDRAG 0x0201 |
| 185 | #define TBN_ENDDRAG 0x0203 |