|
|
1.1 ! root 1: /*****************************************************************************\ ! 2: * * ! 3: * commctrl.h - Windows common control definitions (Win32 variant) * ! 4: * * ! 5: * Version 3.10 * ! 6: * * ! 7: * Copyright (c) 1991-1992, Microsoft Corp. All rights reserved. * ! 8: * * ! 9: * FILE HISTORY: * ! 10: * * ! 11: * AlbertT 27-Oct-1992 Addfiled; ported from winball * ! 12: * * ! 13: *******************************************************************************/ ! 14: ! 15: #ifndef _INC_COMMCTRL ! 16: #define _INC_COMMCTRL ! 17: ! 18: #ifdef __cplusplus /* Assume C declaration for C++ */ ! 19: extern "C" { ! 20: #endif /* __cplusplus */ ! 21: ! 22: #ifndef NOTOOLBAR ! 23: ! 24: #ifndef _INC_TOOLBAR ! 25: #define _INC_TOOLBAR ! 26: ! 27: typedef struct { ! 28: INT iBitmap; /* index into mondo bitmap of this button's picture */ ! 29: INT idCommand; /* WM_COMMAND menu ID that this button sends */ ! 30: BYTE fsState; /* button's state, see TBSTATE_XXXX below */ ! 31: BYTE fsStyle; /* button's style, see TBSTYLE_XXXX below */ ! 32: INT idsHelp; /* string ID for button's status bar help */ ! 33: } TBBUTTON, NEAR *PTBBUTTON, FAR *LPTBBUTTON; ! 34: ! 35: #define TBSTATE_CHECKED 0x01 /* radio button is checked */ ! 36: #define TBSTATE_PRESSED 0x02 /* button is being depressed (any style) */ ! 37: #define TBSTATE_ENABLED 0x04 /* button is enabled */ ! 38: #define TBSTATE_HIDDEN 0x08 /* button is hidden */ ! 39: ! 40: #define TBSTYLE_BUTTON 0x00 /* this entry is button */ ! 41: #define TBSTYLE_SEP 0x01 /* this entry is a separator */ ! 42: #define TBSTYLE_CHECK 0x02 /* this is a check button (it stays down) */ ! 43: #define TBSTYLE_GROUP 0x04 /* this is a check button (it stays down) */ ! 44: #define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) /* this group is a member of a group radio group */ ! 45: ! 46: typedef struct { ! 47: TBBUTTON tbButton; ! 48: CHAR szDescription[1]; ! 49: } ADJUSTINFO, FAR *LPADJUSTINFO; ! 50: ! 51: HWND WINAPI ! 52: CreateToolbar(HWND hwnd, DWORD ws, WORD wID, INT nBitmaps, HINSTANCE hBMInst, WORD wBMID, LPTBBUTTON lpButtons, INT iNumButtons); ! 53: ! 54: typedef struct { ! 55: COLORREF from; ! 56: COLORREF to; ! 57: } COLORMAP, FAR *LPCOLORMAP; ! 58: ! 59: HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, INT idBitmap, BOOL bDiscardable, LPCOLORMAP lpColorMap, INT iNumMaps); ! 60: ! 61: // wParam button ID, LOWORD(lParam) == TRUE -> enable FALSE -> disable ! 62: #define TB_ENABLEBUTTON (WM_USER + 1) ! 63: ! 64: // wParam button ID, LOWORD(lParam) == TRUE -> check FALSE -> uncheck ! 65: #define TB_CHECKBUTTON (WM_USER + 2) ! 66: ! 67: // wParam button ID, LOWORD(lParam) == TRUE -> press FALSE -> unpress ! 68: #define TB_PRESSBUTTON (WM_USER + 3) ! 69: ! 70: // wParam button ID, LOWORD(lParam) == TRUE -> hide FALSE -> show ! 71: #define TB_HIDEBUTTON (WM_USER + 4) ! 72: ! 73: // Messages up to WM_USER+8 are reserved until we defin more state bits ! 74: ! 75: // wParam button ID, LOWORD(lResult) != 0 enabled ! 76: #define TB_ISBUTTONENABLED (WM_USER + 9) ! 77: ! 78: // wParam button ID, LOWORD(lResult) != 0 checked ! 79: #define TB_ISBUTTONCHECKED (WM_USER + 10) ! 80: ! 81: // wParam button ID, LOWORD(lResult) != 0 pressed ! 82: #define TB_ISBUTTONPRESSED (WM_USER + 11) ! 83: ! 84: // wParam button ID, LOWORD(lResult) != 0 pressed ! 85: #define TB_ISBUTTONHIDDEN (WM_USER + 12) ! 86: ! 87: // Messages up to WM_USER+16 are reserved until we defin more state bits ! 88: ! 89: // wParam is the button ID to set the TBSTATE_ state bits from LOWORD(lParam) ! 90: #define TB_SETSTATE (WM_USER + 17) ! 91: ! 92: // wParam is the button ID to return the TBSTATE_ state bits for ! 93: #define TB_GETSTATE (WM_USER + 18) ! 94: ! 95: // wParam is the number of buttons in the bitmap, and lParam has hInst in the ! 96: // LOWORD and wID in the HIWORD for a bitmap. If hInst is NULL, then wID must ! 97: // be a HBITMAP. Returns the index for the first button in the bitmap, or ! 98: // -1 if there is an error. ! 99: ! 100: #define TB_ADDBITMAP (WM_USER + 19) ! 101: ! 102: // wParam is the number of buttons, and lParam is a LPTBBUTTON. ! 103: #define TB_ADDBUTTONS (WM_USER + 20) ! 104: ! 105: // wParam is the index to insert in front of, and lParam is a LPTBBUTTON; ! 106: // only one button can be inserted at a time. If wParam > iNumButtons, the ! 107: // button is added to the end. ! 108: ! 109: #define TB_INSERTBUTTON (WM_USER + 21) ! 110: ! 111: // wParam is the index of the button to delete. ! 112: ! 113: #define TB_DELETEBUTTON (WM_USER + 22) ! 114: ! 115: // wParam is the index of the button to retrieve, and lParam is a valid ! 116: // LPTBBUTTON. ! 117: ! 118: #define TB_GETBUTTON (WM_USER + 23) ! 119: ! 120: // wParam is the index of the button to modify, and lParam is a valid ! 121: // LPTBBUTTON. ! 122: ! 123: #define TB_SETBUTTON (WM_USER + 24) ! 124: ! 125: // Returns the number of buttons in the toolbar. ! 126: ! 127: #define TB_BUTTONCOUNT (WM_USER + 25) ! 128: ! 129: // wParam is the Command ID. Returns the index of the button. ! 130: ! 131: #define TB_COMMANDTOINDEX (WM_USER + 26) ! 132: ! 133: // wParam is the index of the button to retrieve, and lParam is a valid ! 134: // PRECT. ! 135: ! 136: #define TB_GETBUTTONRECT (WM_USER + 27) ! 137: ! 138: // Specifies to save/restore the state of the toolbar. wParam == FALSE means ! 139: // to restore the state. lParam is a pointer to an array of two LPSTR's: ! 140: // the first is the section to write to, and the second is the file (if the ! 141: // second is NULL, it will write to win.ini). ! 142: ! 143: #define TB_SAVERESTORE (WM_USER + 28) ! 144: ! 145: // bring up the toolbar customize dialog ! 146: ! 147: #define TB_CUSTOMIZE (WM_USER + 29) ! 148: ! 149: #endif /* _INC_TOOLBAR */ ! 150: #endif ! 151: ! 152: #ifndef NOSTATUSBAR ! 153: ! 154: /* Here exists the only known documentation for status.c and header.c ! 155: */ ! 156: ! 157: #ifndef _INC_STATUSBAR ! 158: #define _INC_STATUSBAR ! 159: VOID WINAPI DrawStatusText(HDC hDC, LPRECT lprc, LPSTR szText, UINT uFlags); ! 160: /* This is used if the app wants to draw status in its client rect, ! 161: * instead of just creating a window. Note that this same function is ! 162: * used internally in the status bar window's WM_PAINT message. ! 163: * hDC is the DC to draw to. The font that is selected into hDC will ! 164: * be used. The RECT lprc is the only portion of hDC that will be drawn ! 165: * to: the outer edge of lprc will have the highlights (the area outside ! 166: * of the highlights will not be drawn in the BUTTONFACE color: the app ! 167: * must handle that). The area inside the highlights will be erased ! 168: * properly when drawing the text. ! 169: */ ! 170: ! 171: HWND WINAPI CreateStatusWindow(LONG style, LPSTR lpszText, ! 172: HWND hwndParent, WORD wID); ! 173: HWND WINAPI CreateHeaderWindow(LONG style, LPSTR lpszText, ! 174: HWND hwndParent, WORD wID); ! 175: /* This creates a "default" status/header window. This window will have the ! 176: * default borders around the text, the default font, and only one pane. ! 177: * It may also automatically resize and move itself (depending on the SBS_* ! 178: * flags). ! 179: * style should contain WS_CHILD, and can contain WS_BORDER and WS_VISIBLE, ! 180: * plus any of the SBS_* styles described below. I don't know about other ! 181: * WS_* styles. ! 182: * lpszText is the initial text for the first pane. ! 183: * hwndParent is the window the status bar exists in, and should not be NULL. ! 184: * wID is the child window ID of the window. ! 185: * hInstance is the instance handle of the application using this. ! 186: * Note that the app can also just call CreateWindow with ! 187: * STATUSCLASSNAME/HEADERCLASSNAME to create a window of a specific size. ! 188: */ ! 189: ! 190: ! 191: #define STATUSCLASSNAME "msctls_statusbar" ! 192: /* This is the name of the status bar class (it will probably change later ! 193: * so use the #define here). ! 194: */ ! 195: #define HEADERCLASSNAME "msctls_headerbar" ! 196: /* This is the name of the status bar class (it will probably change later ! 197: * so use the #define here). ! 198: */ ! 199: ! 200: ! 201: #define SB_SETTEXT WM_USER+1 ! 202: #define SB_GETTEXT WM_USER+2 ! 203: #define SB_GETTEXTLENGTH WM_USER+3 ! 204: /* Just like WM_?ETTEXT*, with wParam specifying the pane that is referenced ! 205: * (at most 255). ! 206: * Note that you can use the WM_* versions to reference the 0th pane (this ! 207: * is useful if you want to treat a "default" status bar like a static text ! 208: * control). ! 209: * For SETTEXT, wParam is the pane or'ed with SBT_* style bits (defined below). ! 210: * If the text is "normal" (not OWNERDRAW), then a single pane may have left, ! 211: * center, and right justified text by separating the parts with a single tab, ! 212: * plus if lParam is NULL, then the pane has no text. The pane will be ! 213: * invalidated, but not draw until the next PAINT message. ! 214: * For GETTEXT and GETTEXTLENGTH, the LOWORD of the return will be the length, ! 215: * and the HIWORD will be the SBT_* style bits. ! 216: */ ! 217: #define SB_SETPARTS WM_USER+4 ! 218: /* wParam is the number of panes, and lParam points to an array of points ! 219: * specifying the right hand side of each pane. A right hand side of -1 means ! 220: * it goes all the way to the right side of the control minus the X border ! 221: */ ! 222: #define SB_SETBORDERS WM_USER+5 ! 223: /* lParam points to an array of 3 integers: X border, Y border, between pane ! 224: * border. If any is less than 0, the default will be used for that one. ! 225: */ ! 226: #define SB_GETPARTS WM_USER+6 ! 227: /* lParam is a pointer to an array of integers that will get filled in with ! 228: * the right hand side of each pane and wParam is the size (in integers) ! 229: * of the lParam array (so we do not go off the end of it). ! 230: * Returns the number of panes. ! 231: */ ! 232: #define SB_GETBORDERS WM_USER+7 ! 233: /* lParam is a pointer to an array of 3 integers that will get filled in with ! 234: * the X border, the Y border, and the between pane border. ! 235: */ ! 236: #define SB_SETMINHEIGHT WM_USER+8 ! 237: /* wParam is the minimum height of the status bar "drawing" area. This is ! 238: * the area inside the highlights. This is most useful if a pane is used ! 239: * for an OWNERDRAW item, and is ignored if the SBS_NORESIZE flag is set. ! 240: * Note that WM_SIZE must be sent to the control for any size changes to ! 241: * take effect. ! 242: */ ! 243: #define SB_SIMPLE WM_USER+9 ! 244: /* wParam specifies whether to set (non-zero) or unset (zero) the "simple" ! 245: * mode of the status bar. In simple mode, only one pane is displayed, and ! 246: * its text is set with LOWORD(wParam)==255 in the SETTEXT message. ! 247: * OWNERDRAW is not allowed, but other styles are. ! 248: * The pane gets invalidated, but not painted until the next PAINT message, ! 249: * so you can set new text without flicker (I hope). ! 250: * This can be used with the WM_INITMENU and WM_MENUSELECT messages to ! 251: * implement help text when scrolling through a menu. ! 252: */ ! 253: ! 254: ! 255: #define HB_SAVERESTORE WM_USER+0x100 ! 256: /* This gets a header bar to read or write its state to or from an ini file. ! 257: * wParam is 0 for reading, non-zero for writing. lParam is a pointer to ! 258: * an array of two LPSTR's: the section and file respectively. ! 259: * Note that the correct number of partitions must be set before calling this. ! 260: */ ! 261: #define HB_ADJUST WM_USER+0x101 ! 262: /* This puts the header bar into "adjust" mode, for changing column widths ! 263: * with the keyboard. ! 264: */ ! 265: #define HB_SETWIDTHS SB_SETPARTS ! 266: /* Set the widths of the header columns. Note that "springy" columns only ! 267: * have a minumum width, and negative width are assumed to be hidden columns. ! 268: * This works just like SB_SETPARTS. ! 269: */ ! 270: #define HB_GETWIDTHS SB_GETPARTS ! 271: /* Get the widths of the header columns. Note that "springy" columns only ! 272: * have a minumum width. This works just like SB_GETPARTS. ! 273: */ ! 274: #define HB_GETPARTS WM_USER+0x102 ! 275: /* Get a list of the right-hand sides of the columns, for use when drawing the ! 276: * actual columns for which this is a header. ! 277: * lParam is a pointer to an array of integers that will get filled in with ! 278: * the right hand side of each pane and wParam is the size (in integers) ! 279: * of the lParam array (so we do not go off the end of it). ! 280: * Returns the number of panes. ! 281: */ ! 282: #define HB_SHOWTOGGLE WM_USER+0x103 ! 283: /* Toggle the hidden state of a column. wParam is the 0-based index of the ! 284: * column to toggle. ! 285: */ ! 286: ! 287: ! 288: #define SBT_OWNERDRAW 0x1000 ! 289: /* The lParam of the SB_SETTEXT message will be returned in the DRAWITEMSTRUCT ! 290: * of the WM_DRAWITEM message. Note that the fields CtlType, itemAction, and ! 291: * itemState of the DRAWITEMSTRUCT are undefined for a status bar. ! 292: * The return value for GETTEXT will be the itemData. ! 293: */ ! 294: #define SBT_NOBORDERS 0x0100 ! 295: /* No borders will be drawn for the pane. ! 296: */ ! 297: #define SBT_POPOUT 0x0200 ! 298: /* The text pops out instead of in ! 299: */ ! 300: #define HBT_SPRING 0x0400 ! 301: /* this means that the item is "springy", meaning that it has a minimum ! 302: * width, but will grow if there is extra room in the window. Note that ! 303: * multiple springs are allowed, and the extra room will be distributed ! 304: * among them. ! 305: */ ! 306: ! 307: /* Here's a simple dialog function that uses a default status bar to display ! 308: * the mouse position in the given window. ! 309: * ! 310: * extern HINSTANCE hInst; ! 311: * ! 312: * BOOL CALLBACK MyWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) ! 313: * { ! 314: * switch (msg) ! 315: * { ! 316: * case WM_INITDIALOG: ! 317: * CreateStatusWindow(WS_CHILD|WS_BORDER|WS_VISIBLE, "", hDlg, ! 318: * IDC_STATUS, hInst); ! 319: * break; ! 320: * ! 321: * case WM_SIZE: ! 322: * SendDlgItemMessage(hDlg, IDC_STATUS, WM_SIZE, 0, 0L); ! 323: * break; ! 324: * ! 325: * case WM_MOUSEMOVE: ! 326: * wsprintf(szBuf, "%d,%d", LOWORD(lParam), HIWORD(lParam)); ! 327: * SendDlgItemMessage(hDlg, IDC_STATUS, SB_SETTEXT, 0, ! 328: * (LPARAM)(LPSTR)szBuf); ! 329: * break; ! 330: * ! 331: * default: ! 332: * break; ! 333: * } ! 334: * return(FALSE); ! 335: * } ! 336: */ ! 337: ! 338: #endif /* _INC_STATUSBAR */ ! 339: ! 340: #endif ! 341: ! 342: #ifndef NOMENUHELP ! 343: #ifndef _INC_MENUHELP ! 344: #define _INC_MENUHELP ! 345: ! 346: // for winball only, these are in the Chicago kernel ! 347: ! 348: BOOL WINAPI WritePrivateProfileStruct(LPSTR szSection, LPSTR szKey, ! 349: LPBYTE lpStruct, UINT uSizeStruct, LPSTR szFile); ! 350: BOOL WINAPI GetPrivateProfileStruct(LPSTR szSection, LPSTR szKey, ! 351: LPBYTE lpStruct, UINT uSizeStruct, LPSTR szFile); ! 352: ! 353: ! 354: VOID WINAPI MenuHelp(WORD iMessage, WPARAM wParam, LPARAM lParam, ! 355: HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, LPDWORD lpdwIDs); ! 356: ! 357: BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo); ! 358: ! 359: VOID WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo); ! 360: ! 361: #define MINSYSCOMMAND SC_SIZE ! 362: ! 363: #endif /* _INC_MENUHELP */ ! 364: ! 365: #endif ! 366: ! 367: #ifndef NOBTNLIST ! 368: /* ! 369: * BUTTON LISTBOX CONTROL ! 370: * ! 371: * The Button Listbox control creates an array of buttons that behaves ! 372: * similar to both a button and a listbox: the array may be scrollable ! 373: * like a listbox and each listbox item is behaves like a pushbutton ! 374: * control ! 375: * ! 376: * ! 377: * SPECIFYING A BUTTONLISTBOX IN THE DIALOG TEMPLATE ! 378: * ! 379: * The CONTROL statement in the dialog template specifies the ! 380: * dimensions of each individual button in the x, y, width and height ! 381: * parameters. The low order byte in the style field specifies the ! 382: * number of buttons that will be displayed; the actual size of the ! 383: * displayed control is determined by the number of buttons specified. ! 384: * ! 385: * For a standard control--no other style bits set--the width of the ! 386: * control in dialog base units will be ! 387: * CX = cx * (n + 2/3) + 2 ! 388: * where cx is the width of the button and n is number of buttons ! 389: * specified. (The 2/3 is for displaying partially visible buttons for ! 390: * scrolling plus 2 for the control borders.) The control will also be ! 391: * augmented in the cy direction by the height of the horizontal scroll ! 392: * bar. ! 393: * ! 394: * If the BLS_NOSCROLL style is set, no scroll bar will appear and the ! 395: * button listbox will be limited to displaying the number of buttons ! 396: * specified and no more. In this case, the width of the control will ! 397: * be ! 398: * CX = cx * n + 2 ! 399: * ! 400: * If the BLS_VERTICAL style is set, the entire control goes vertical ! 401: * and cy should be substituted in the above calculations to determine ! 402: * CY, the actual height of the displayed control. ! 403: * ! 404: * The statement ! 405: * ! 406: * CONTROL "", IDD_BUTTONLIST, "buttonlistbox", 0x0005 | WS_TABSTOP, ! 407: * 4, 128, 34, 24 ! 408: * ! 409: * creates a scrollable horizontal list of 5 buttons at the position ! 410: * (4,128) with each button having dimensions (34,24). The entire control ! 411: * has the tabstop style. ! 412: * ! 413: * ! 414: * ADDING BUTTONS TO A BUTTONLISTBOX CONTROL ! 415: * ! 416: * Buttons are added to the listbox in the same manner that items are ! 417: * added to a standard listbox; however, the messages BL_ADDBUTTON and ! 418: * BL_INSERTBUTTON must be passed a pointer to a CREATELISTBUTTON ! 419: * structure in the lParam. ! 420: * ! 421: * Example: ! 422: * ! 423: * { ! 424: * CREATELISTBUTTON clb; ! 425: * const int numColors = 1; ! 426: * COLORMAP colorMap; ! 427: * ! 428: * colorMap.from = BUTTON_MAP_COLOR; // your background color ! 429: * colorMap.to = GetSysColor(COLOR_BTNFACE); ! 430: * ! 431: * clb.cbSize = sizeof(clb); ! 432: * clb.dwItemData = BUTTON_1; ! 433: * clb.hBitmap = CreateMappedBitmap(hInst,BMP_BUTTON,FALSE, ! 434: &colorMap,numColors); ! 435: * clb.lpszText = "Button 1"; ! 436: * SendMessage(GetDlgItem(hDlg,IDD_BUTTONLIST), ! 437: * BL_ADDBUTTON, 0, ! 438: * (LPARAM)(CREATELISTBUTTON FAR*)&clb); ! 439: * DeleteObject(clb.hBitmap); ! 440: * } ! 441: * ! 442: * Note that the caller must delete any memory for objects passed in ! 443: * the CREATELISTBUTTON structure. Also, the CreateMappedBitmap API is ! 444: * useful for mapping the background color of the button bitmap to the ! 445: * system color COLOR_BTNFACE for a cleaner visual appearance. ! 446: * ! 447: * The BL_ADDBUTTON message causes the listbox to be sorted by the ! 448: * button text whereas the BL_INSERTBUTTON does not cause the list to ! 449: * be sorted. ! 450: * ! 451: * The button listbox sends a WM_DELETEITEM message to the control parent ! 452: * when a button is deleted so that any item data can be cleaned up. ! 453: * ! 454: \**********************************************************************/ ! 455: #ifndef _INC_BTNLIST ! 456: #define _INC_BTNLIST ! 457: ! 458: /* Class name */ ! 459: #define BUTTONLISTBOX "ButtonListBox" ! 460: ! 461: /* Button List Box Styles */ ! 462: #define BLS_NUMBUTTONS 0x00FFL ! 463: #define BLS_VERTICAL 0x0100L ! 464: #define BLS_NOSCROLL 0x0200L ! 465: ! 466: /* Button List Box Messages */ ! 467: // ANSI messages ! 468: #define BL_ADDBUTTONA (WM_USER+1) ! 469: #define BL_DELETEBUTTONA (WM_USER+2) ! 470: #define BL_GETCARETINDEX (WM_USER+3) ! 471: #define BL_GETCOUNT (WM_USER+4) ! 472: #define BL_GETCURSEL (WM_USER+5) ! 473: #define BL_GETITEMDATA (WM_USER+6) ! 474: #define BL_GETITEMRECT (WM_USER+7) ! 475: #define BL_GETTEXTA (WM_USER+8) ! 476: #define BL_GETTEXTLEN (WM_USER+9) ! 477: #define BL_GETTOPINDEX (WM_USER+10) ! 478: #define BL_INSERTBUTTONA (WM_USER+11) ! 479: #define BL_RESETCONTENT (WM_USER+12) ! 480: #define BL_SETCARETINDEX (WM_USER+13) ! 481: #define BL_SETCURSEL (WM_USER+14) ! 482: #define BL_SETITEMDATA (WM_USER+15) ! 483: #define BL_SETTOPINDEX (WM_USER+16) ! 484: // UNICODE messages ! 485: #define BL_ADDBUTTONW (WM_USER+17) ! 486: #define BL_DELETEBUTTONW (WM_USER+18) ! 487: #define BL_GETTEXTW (WM_USER+19) ! 488: #define BL_INSERTBUTTONW (WM_USER+20) ! 489: #define BL_MSGMAX (WM_USER+21) /* ;Internal */ ! 490: ! 491: ! 492: #ifdef UNICODE ! 493: #define BL_ADDBUTTON BL_ADDBUTTONW ! 494: #define BL_DELETEBUTTON BL_DELETEBUTTONW ! 495: #define BL_GETTEXT BL_GETTEXTW ! 496: #define BL_INSERTBUTTON BL_INSERTBUTTONW ! 497: #else ! 498: #define BL_ADDBUTTON BL_ADDBUTTONA ! 499: #define BL_DELETEBUTTON BL_DELETEBUTTONA ! 500: #define BL_GETTEXT BL_GETTEXTA ! 501: #define BL_INSERTBUTTON BL_INSERTBUTTONA ! 502: #endif //UNICODE ! 503: ! 504: // Just in case the user thinks they exist... ! 505: #define BL_GETCARETINDEXA BL_GETCARETINDEX ! 506: #define BL_GETCARETINDEXW BL_GETCARETINDEX ! 507: #define BL_GETCOUNTA BL_GETCOUNT ! 508: #define BL_GETCOUNTW BL_GETCOUNT ! 509: #define BL_GETCURSELA BL_GETCURSEL ! 510: #define BL_GETCURSELW BL_GETCURSEL ! 511: #define BL_GETITEMDATAA BL_GETITEMDATA ! 512: #define BL_GETITEMDATAW BL_GETITEMDATA ! 513: #define BL_GETITEMRECTA BL_GETITEMRECT ! 514: #define BL_GETITEMRECTW BL_GETITEMRECT ! 515: #define BL_GETTEXTLENA BL_GETTEXTLEN ! 516: #define BL_GETTEXTLENW BL_GETTEXTLEN ! 517: #define BL_GETTOPINDEXA BL_GETTOPINDEX ! 518: #define BL_GETTOPINDEXW BL_GETTOPINDEX ! 519: #define BL_RESETCONTENTA BL_RESETCONTENT ! 520: #define BL_RESETCONTENTW BL_RESETCONTENT ! 521: #define BL_SETCARETINDEXA BL_SETCARETINDEX ! 522: #define BL_SETCARETINDEXW BL_SETCARETINDEX ! 523: #define BL_SETCURSELA BL_SETCURSEL ! 524: #define BL_SETCURSELW BL_SETCURSEL ! 525: #define BL_SETITEMDATAA BL_SETITEMDATA ! 526: #define BL_SETITEMDATAW BL_SETITEMDATA ! 527: #define BL_SETTOPINDEXA BL_SETTOPINDEX ! 528: #define BL_SETTOPINDEXW BL_SETTOPINDEX ! 529: ! 530: /* Button listbox notification codes send in WM_COMMAND */ ! 531: #define BLN_ERRSPACE (-2) ! 532: #define BLN_SELCHANGE 1 ! 533: #define BLN_CLICKED 2 ! 534: #define BLN_SELCANCEL 3 ! 535: #define BLN_SETFOCUS 4 ! 536: #define BLN_KILLFOCUS 5 ! 537: ! 538: /* Message return values */ ! 539: #define BL_OKAY 0 ! 540: #define BL_ERR (-1) ! 541: #define BL_ERRSPACE (-2) ! 542: ! 543: /* Create structure for ! 544: * BL_ADDBUTTON and ! 545: * BL_INSERTBUTTON ! 546: * lpCLB = (LPCREATELISTBUTTON)lParam ! 547: */ ! 548: typedef struct tagCLBA ! 549: { ! 550: UINT cbSize; /* size of structure */ ! 551: DWORD dwItemData; /* user defined item data */ ! 552: /* for LB_GETITEMDATA and LB_SETITEMDATA */ ! 553: HBITMAP hBitmap; /* button bitmap */ ! 554: LPCSTR lpszText; // compatibility ! 555: ! 556: } CREATELISTBUTTONA; ! 557: typedef CREATELISTBUTTONA * LPCREATELISTBUTTONA; ! 558: ! 559: typedef struct tagCLBW ! 560: { ! 561: UINT cbSize; /* size of structure */ ! 562: DWORD dwItemData; /* user defined item data */ ! 563: /* for LB_GETITEMDATA and LB_SETITEMDATA */ ! 564: HBITMAP hBitmap; /* button bitmap */ ! 565: LPCWSTR lpszText; // button text - in UNICODE ! 566: } CREATELISTBUTTONW; ! 567: typedef CREATELISTBUTTONW * LPCREATELISTBUTTONW; ! 568: ! 569: #ifdef UNICODE ! 570: #define CREATELISTBUTTON CREATELISTBUTTONW ! 571: #else ! 572: #define CREATELISTBUTTON CREATELISTBUTTONA ! 573: #endif ! 574: ! 575: typedef CREATELISTBUTTON * LPCREATELISTBUTTON; ! 576: ! 577: ! 578: #endif /* _INC_BTNLIST */ ! 579: #endif ! 580: ! 581: #ifndef NOTRACKBAR ! 582: /* ! 583: This control keeps its ranges in LONGs. but for ! 584: convienence and symetry with scrollbars ! 585: WORD parameters are are used for some messages. ! 586: if you need a range in LONGs don't use any messages ! 587: that pack values into loword/hiword pairs ! 588: ! 589: The trackbar messages: ! 590: message wParam lParam return ! 591: ! 592: TBM_GETPOS ------ ------ Current logical position of trackbar. ! 593: TBM_GETRANGEMIN ------ ------ Current logical minimum position allowed. ! 594: TBM_GETRANGEMAX ------ ------ Current logical maximum position allowed. ! 595: TBM_SETTIC ! 596: TBM_SETPOS ! 597: TBM_SETRANGEMIN ! 598: TBM_SETRANGEMAX ! 599: */ ! 600: ! 601: #define TRACKBAR_CLASS "msctls_trackbar" ! 602: ! 603: /* Trackbar styles */ ! 604: ! 605: /* add ticks automatically on TBM_SETRANGE message */ ! 606: #define TBS_AUTOTICKS 0x0001L ! 607: ! 608: ! 609: /* Trackbar messages */ ! 610: ! 611: /* returns current position (LONG) */ ! 612: #define TBM_GETPOS (WM_USER) ! 613: ! 614: /* set the min of the range to LPARAM */ ! 615: #define TBM_GETRANGEMIN (WM_USER+1) ! 616: ! 617: /* set the max of the range to LPARAM */ ! 618: #define TBM_GETRANGEMAX (WM_USER+2) ! 619: ! 620: /* wParam is index of tick to get (ticks are in the range of min - max) */ ! 621: #define TBM_GETTIC (WM_USER+3) ! 622: ! 623: /* wParam is index of tick to set */ ! 624: #define TBM_SETTIC (WM_USER+4) ! 625: ! 626: /* set the position to the value of lParam (wParam is the redraw flag) */ ! 627: #define TBM_SETPOS (WM_USER+5) ! 628: ! 629: /* LOWORD(lParam) = min, HIWORD(lParam) = max, wParam == fRepaint */ ! 630: #define TBM_SETRANGE (WM_USER+6) ! 631: ! 632: /* lParam is range min (use this to keep LONG precision on range) */ ! 633: #define TBM_SETRANGEMIN (WM_USER+7) ! 634: ! 635: /* lParam is range max (use this to keep LONG precision on range) */ ! 636: #define TBM_SETRANGEMAX (WM_USER+8) ! 637: ! 638: /* remove the ticks */ ! 639: #define TBM_CLEARTICS (WM_USER+9) ! 640: ! 641: /* select a range LOWORD(lParam) min, HIWORD(lParam) max */ ! 642: #define TBM_SETSEL (WM_USER+10) ! 643: ! 644: /* set selection rang (LONG form) */ ! 645: #define TBM_SETSELSTART (WM_USER+11) ! 646: #define TBM_SETSELEND (WM_USER+12) ! 647: ! 648: // #define TBM_SETTICTOK (WM_USER+13) ! 649: ! 650: /* return a pointer to the list of tics (DWORDS) */ ! 651: #define TBM_GETPTICS (WM_USER+14) ! 652: ! 653: /* get the pixel position of a given tick */ ! 654: #define TBM_GETTICPOS (WM_USER+15) ! 655: /* get the number of tics */ ! 656: #define TBM_GETNUMTICS (WM_USER+16) ! 657: ! 658: /* get the selection range */ ! 659: #define TBM_GETSELSTART (WM_USER+17) ! 660: #define TBM_GETSELEND (WM_USER+18) ! 661: ! 662: /* clear the selection */ ! 663: #define TBM_CLEARSEL (WM_USER+19) ! 664: ! 665: /* these match the SB_ (scroll bar messages) */ ! 666: ! 667: #define TB_LINEUP 0 ! 668: #define TB_LINEDOWN 1 ! 669: #define TB_PAGEUP 2 ! 670: #define TB_PAGEDOWN 3 ! 671: #define TB_THUMBPOSITION 4 ! 672: #define TB_THUMBTRACK 5 ! 673: #define TB_TOP 6 ! 674: #define TB_BOTTOM 7 ! 675: #define TB_ENDTRACK 8 ! 676: #endif ! 677: ! 678: #ifndef NODRAGLIST ! 679: #ifndef _INC_DRAGLIST ! 680: #define _INC_DRAGLIST ! 681: ! 682: typedef struct ! 683: { ! 684: UINT uNotification; ! 685: HWND hWnd; ! 686: POINT ptCursor; ! 687: } DRAGLISTINFO, FAR *LPDRAGLISTINFO; ! 688: ! 689: #define DL_BEGINDRAG (LB_MSGMAX+100) ! 690: #define DL_DRAGGING (LB_MSGMAX+101) ! 691: #define DL_DROPPED (LB_MSGMAX+102) ! 692: #define DL_CANCELDRAG (LB_MSGMAX+103) ! 693: ! 694: #define DL_CURSORSET 0 ! 695: #define DL_STOPCURSOR 1 ! 696: #define DL_COPYCURSOR 2 ! 697: #define DL_MOVECURSOR 3 ! 698: ! 699: #define DRAGLISTMSGSTRING "commctrl_DragListMsg" ! 700: ! 701: /* Exported functions and variables ! 702: */ ! 703: extern BOOL WINAPI MakeDragList(HWND hLB); ! 704: extern INT WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll); ! 705: extern VOID WINAPI DrawInsert(HWND handParent, HWND hLB, INT nItem); ! 706: ! 707: #endif /* _INC_DRAGLIST */ ! 708: ! 709: #endif ! 710: ! 711: #ifndef NOUPDOWN ! 712: /* updown.h : Public interface to the Up/Down control. ! 713: // ! 714: */ ! 715: ! 716: #ifndef __INC_UPDOWN__ ! 717: #define __INC_UPDOWN__ ! 718: ! 719: /* ! 720: // OVERVIEW: ! 721: // ! 722: // The UpDown control is a simple pair of buttons which increment or ! 723: // decrement an integer value. The operation is similar to a vertical ! 724: // scrollbar; except that the control only has line-up and line-down ! 725: // functionality, and changes the current position automatically. ! 726: // ! 727: // The control also can be linked with a companion control, usually an ! 728: // "edit" control, to simplify dialog-box management. This companion is ! 729: // termed a "buddy" in this documentation. Any sibling HWND may be ! 730: // assigned as the control's buddy, or the control may be allowed to ! 731: // choose one automatically. Once chosen, the UpDown can size itself to ! 732: // match the buddy's right or left border, and/or automatically set the ! 733: // text of the buddy control to make the current position visible. ! 734: // ! 735: // ADDITIONAL NOTES: ! 736: // ! 737: // The "upper" and "lower" limits must not cover a range larger than 32,767 ! 738: // positions. It is acceptable to have the range inverted, i.e., to have ! 739: // (lower > upper). The upper button always moves the current position ! 740: // towards the "upper" number, and the lower button always moves towards the ! 741: // "lower" number. If the range is zero (lower == upper), or the control ! 742: // is disabled (EnableWindow(hCtrl, FALSE)), the control draws grayed ! 743: // arrows in both buttons. ! 744: // ! 745: // The buddy window must have the same parent as the UpDown control. ! 746: // ! 747: // If the buddy window resizes, and the UDS_ALIGN* styles are used, it ! 748: // is necessary to send the UDM_SETBUDDY message to re-anchor the UpDown ! 749: // control on the appropriate border of the buddy window. ! 750: // ! 751: // The UDS_AUTOBUDDY style uses GetWindow(hCtrl, GW_HWNDPREV) to pick ! 752: // the best buddy window. In the case of a DIALOG resource, this will ! 753: // choose the previous control listed in the resource script. If the ! 754: // windows will change in Z-order, sending UDM_SETBUDDY with a NULL handle ! 755: // will pick a new buddy; otherwise the original auto-buddy choice is ! 756: // maintained. ! 757: // ! 758: // The UDS_SETBUDDYINT style uses its own SetDlgItemInt-style ! 759: // functionality to set the caption text of the buddy. All WIN.INI [Intl] ! 760: // values are honored by this routine. ! 761: */ ! 762: ! 763: /*/////////////////////////////////////////////////////////////////////////*/ ! 764: ! 765: /* Structures */ ! 766: ! 767: typedef struct tagUDACCEL ! 768: { ! 769: UINT nSec; ! 770: UINT nInc; ! 771: } UDACCEL, FAR *LPUDACCEL; ! 772: ! 773: ! 774: /* STYLE BITS */ ! 775: ! 776: #define UDS_WRAP 0x0001 ! 777: /* numbers cycle past range limits */ ! 778: ! 779: #define UDS_SETBUDDYINT 0x0002 ! 780: /* does a SetDlgItemInt on the "buddy" on each number change */ ! 781: ! 782: #define UDS_ALIGNRIGHT 0x0004 ! 783: #define UDS_ALIGNLEFT 0x0008 ! 784: /* aligns the control on the right or left edge of the "buddy" */ ! 785: ! 786: #define UDS_AUTOBUDDY 0x0010 ! 787: /* picks the previous window control as the "buddy" automatically */ ! 788: ! 789: #define UDS_ARROWKEYS 0x0020 ! 790: /* subclasses the buddy to steal the up and down arrow keys */ ! 791: ! 792: ! 793: /* MESSAGES */ ! 794: ! 795: #define UDM_SETRANGE (WM_USER+101) ! 796: /* wParam: not used ! 797: // lParam: short LOWORD is new max, short HIWORD is new min ! 798: // return: not used ! 799: */ ! 800: ! 801: #define UDM_GETRANGE (WM_USER+102) ! 802: /* wParam: not used ! 803: // lParam: not used ! 804: // return: short LOWORD is max, short HIWORD is min ! 805: */ ! 806: ! 807: #define UDM_SETPOS (WM_USER+103) ! 808: /* wParam: not used ! 809: // lParam: short LOWORD is new pos ! 810: // return: short is old pos ! 811: */ ! 812: ! 813: #define UDM_GETPOS (WM_USER+104) ! 814: /* wParam: not used ! 815: // lParam: not used ! 816: // return: short is current pos ! 817: */ ! 818: ! 819: #define UDM_SETBUDDY (WM_USER+105) ! 820: /* wParam: HWND is new buddy ! 821: // lParam: not used ! 822: // return: HWND is old buddy ! 823: */ ! 824: ! 825: #define UDM_GETBUDDY (WM_USER+106) ! 826: /* wParam: not used ! 827: // lParam: not used ! 828: // return: HWND is current buddy ! 829: */ ! 830: ! 831: #define UDM_SETACCEL (WM_USER+107) ! 832: /* wParam: number of acceleration steps ! 833: // lParam: LPUDACCEL ! 834: // return: non-zero if set, 0 otherwise ! 835: // The elements in the UDACCEL array should be in decreasing order ! 836: // according to nSec. nSec is the number of seconds until starting ! 837: // the new jump rate, and nInc is the increment once hitting that ! 838: // number of seconds. If there is no match, the increment is 1. ! 839: */ ! 840: ! 841: #define UDM_GETACCEL (WM_USER+108) ! 842: /* wParam: number of elements in the UDACCEL array ! 843: // lParam: LPUDACCEL ! 844: // return: actual number of acceleration steps ! 845: */ ! 846: ! 847: #define UDM_SETBASE (WM_USER + 109) ! 848: // wParam: new base ! 849: // lParam: not used ! 850: // return: 0 if invalid base is specified, previous base otherwise ! 851: ! 852: #define UDM_GETBASE (WM_USER + 110) ! 853: // wParam: not used ! 854: // lParam: not used ! 855: // return: current base in LOWORD ! 856: ! 857: ! 858: /* NOTIFICATIONS */ ! 859: ! 860: /* WM_VSCROLL ! 861: // Note that unlike a scrollbar, the position is automatically changed by ! 862: // the control, and the LOWORD(lParam) is always the new position. Only ! 863: // SB_LINEUP and SB_LINEDOWN scroll codes are sent in the wParam. ! 864: */ ! 865: ! 866: ! 867: /* HELPER APIs */ ! 868: ! 869: #define UPDOWN_CLASS "msctls_updown" ! 870: /* For dialog-box resource creation or manual CreateWindow use. ! 871: */ ! 872: HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy, ! 873: HWND hParent, int nID, HINSTANCE hInst, ! 874: HWND hBuddy, ! 875: int nUpper, int nLower, int nPos); ! 876: /* Does the CreateWindow call followed by setting the various ! 877: // state information: ! 878: // hBuddy The companion control (usually an "edit"). ! 879: // nUpper The range limit corresponding to the upper button. ! 880: // nLower The range limit corresponding to the lower button. ! 881: // nPos The initial position. ! 882: // Returns the handle to the control or NULL on failure. ! 883: */ ! 884: ! 885: /*/////////////////////////////////////////////////////////////////////////*/ ! 886: ! 887: #endif /* __INC_UPDOWN__ */ ! 888: ! 889: #endif ! 890: ! 891: /* Note that the set of HBN_* and TBN_* defines must be a disjoint set so ! 892: * that MenuHelp can tell them apart. ! 893: */ ! 894: ! 895: /* These are in the GET_WM_COMMAND_CMD in WM_COMMAND messages sent from a ! 896: * header bar when the user adjusts the headers with the mouse or keyboard. ! 897: */ ! 898: #define HBN_BEGINDRAG 0x0101 ! 899: #define HBN_DRAGGING 0x0102 ! 900: #define HBN_ENDDRAG 0x0103 ! 901: ! 902: /* These are in the GET_WM_COMMAND_CMD in WM_COMMAND messages sent from a ! 903: * header bar when the user adjusts the headers with the keyboard. ! 904: */ ! 905: #define HBN_BEGINADJUST 0x0111 ! 906: #define HBN_ENDADJUST 0x0112 ! 907: ! 908: /* These are in the GET_WM_COMMAND_CMD in WM_COMMAND messages sent from a ! 909: * tool bar. If the left button is pressed and then released in a single ! 910: * "button" of a tool bar, then a WM_COMMAND message will be sent with wParam ! 911: * being the id of the button. ! 912: */ ! 913: #define TBN_BEGINDRAG 0x0201 ! 914: #define TBN_ENDDRAG 0x0203 ! 915: ! 916: /* These are in the GET_WM_COMMAND_CMD in WM_COMMAND messages sent from a ! 917: * tool bar. The TBN_BEGINADJUST message is sent before the "insert" ! 918: * dialog appears. The app must return a handle (which will ! 919: * NOT be freed by the toolbar) to an ADJUSTINFO struct for the TBN_ADJUSTINFO ! 920: * message; the LOWORD of lParam is the index of the button whose info should ! 921: * be retrieved. The app can clean up in the TBN_ENDADJUST message. ! 922: * The app should reset the toolbar on the TBN_RESET message. ! 923: */ ! 924: #define TBN_BEGINADJUST 0x0204 ! 925: #define TBN_ADJUSTINFO 0x0205 ! 926: #define TBN_ENDADJUST 0x0206 ! 927: #define TBN_RESET 0x0207 ! 928: ! 929: /* These are in the GET_WM_COMMAND_CMD in WM_COMMAND messages sent from a ! 930: * tool bar. The LOWORD is the index where the button is or will be. ! 931: * If the app returns FALSE from either of these during a button move, then ! 932: * the button will not be moved. If the app returns FALSE to the INSERT ! 933: * when the toolbar tries to add buttons, then the insert dialog will not ! 934: * come up. TBN_TOOLBARCHANGE is sent whenever any button is added, moved, ! 935: * or deleted from the toolbar by the user, so the app can do stuff. ! 936: */ ! 937: #define TBN_QUERYINSERT 0x0208 ! 938: #define TBN_QUERYDELETE 0x0209 ! 939: #define TBN_TOOLBARCHANGE 0x020a ! 940: ! 941: ! 942: /* This is the help message sent by the customize toolbar dialog ! 943: * when the user clicks the help button. It is sent back to the ! 944: * owner of the customize window. ! 945: * GET_WM_COMMAND_HWND(wParam,lParam) will return the window handle. ! 946: */ ! 947: #define TBN_CUSTHELP 0x20b ! 948: ! 949: /* Note that the following flags are checked every time the window gets a ! 950: * WM_SIZE message, so the style of the window can be changed "on-the-fly". ! 951: * If NORESIZE is set, then the app is responsible for all control placement ! 952: * and sizing. If NOPARENTALIGN is set, then the app is responsible for ! 953: * placement. If neither is set, the app just needs to send a WM_SIZE ! 954: * message for the window to be positioned and sized correctly whenever the ! 955: * parent window size changes. ! 956: * Note that for STATUS bars, CCS_BOTTOM is the default, for HEADER bars, ! 957: * CCS_NOMOVEY is the default, and for TOOL bars, CCS_TOP is the default. ! 958: */ ! 959: #define CCS_TOP 0x00000001L ! 960: /* This flag means the status bar should be "top" aligned. If the ! 961: * NOPARENTALIGN flag is set, then the control keeps the same top, left, and ! 962: * width measurements, but the height is adjusted to the default, otherwise ! 963: * the status bar is positioned at the top of the parent window such that ! 964: * its client area is as wide as the parent window and its client origin is ! 965: * the same as its parent. ! 966: * Similarly, if this flag is not set, the control is bottom-aligned, either ! 967: * with its original rect or its parent rect, depending on the NOPARENTALIGN ! 968: * flag. ! 969: */ ! 970: #define CCS_NOMOVEY 0x00000002L ! 971: /* This flag means the control may be resized and moved horizontally (if the ! 972: * CCS_NORESIZE flag is not set), but it will not move vertically when a ! 973: * WM_SIZE message comes through. ! 974: */ ! 975: #define CCS_BOTTOM 0x00000003L ! 976: /* Same as CCS_TOP, only on the bottom. ! 977: */ ! 978: #define CCS_NORESIZE 0x00000004L ! 979: /* This flag means that the size given when creating or resizing is exact, ! 980: * and the control should not resize itself to the default height or width ! 981: */ ! 982: #define CCS_NOPARENTALIGN 0x00000008L ! 983: /* This flag means that the control should not "snap" to the top or bottom ! 984: * or the parent window, but should keep the same placement it was given ! 985: */ ! 986: #define CCS_NOHILITE 0x00000010L ! 987: /* Don't draw the one pixel highlight at the top of the control ! 988: */ ! 989: #define CCS_ADJUSTABLE 0x00000020L ! 990: /* This allows a toolbar (header bar?) to be configured by the user. ! 991: */ ! 992: ! 993: /* Stub function to call if all you want to do is make sure this DLL is loaded ! 994: */ ! 995: VOID WINAPI InitCommonControls(VOID); ! 996: ! 997: // albertt 13 2.8 ! 998: #define SST_RESOURCE 0x1 ! 999: #define SST_FORMAT 0x2 ! 1000: ! 1001: #ifdef __cplusplus ! 1002: } /* End of extern "C" { */ ! 1003: #endif /* __cplusplus */ ! 1004: ! 1005: #endif /* _INC_COMMCTRL */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.