⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toolbar.h

📁 也是关于VB的,不知道对你们有没有用处.是我下的.
💻 H
📖 第 1 页 / 共 2 页
字号:
*                   the button was re-drawn as if it was pushed again.       *
*                                                                            *
*                   For any of the above activities.......                   *
*                                                                            *
*   HIWORD & BTN_SHIFT     is set if this activity involves the right mouse  *
*                          button, or else it is clear.                      *
*   HIWORD & BTN_DBLCLICK  is set means that this mouse button down activity *
*                          is really a double click (if you care).           *
*                                                                            *
*           If you are a custom button, you can also receive this message... *
*                                                                            *
*   HIWORD & BTN_REPEAT    is set means that the button or key is being held *
*                          down, and you are being sent many down messages   *
*                          in a row.  The first such message is sent with    *
*                          this flag clear, all others have this flag set.   *
*                          If you are a custom button, you will have to      *
*                          ignore messages that are repeats if you don't     *
*                          want to get many down messages in a row.          *
*                                                                            *
*                                                                            *
*                    toolbarStringFromIndex(hwnd, index)                     *
*                                                                            *
*                    will return you the string resource ID you gave when    *
*                    you registered this button.                             *
*                                                                            *
*                                                                            *
*  IMPORTANT !!!!!!!!!!!!!!!!!!!                                             *
*  =============================                                             *
*                                                                            *
*  When you get the state of a button, it's already been changed by the      *
*  activity so it's the NEW STATE!!!!!!!!!                                   *
*                                                                            *
*   EXCEPT!!!   for a custom button!  For a custom button, NOTHING WILL      *
*   happen, you have to do it all yourself!!!! So the state is going to be   *
*   the state BEFORE the activity and you have to call                       *
*   toolbarModifyState(hwnd, buttonID, newState) to change the state         *
*   yourself!!!!                                                             *
*                                                                            *
*   You also have toolbarGetNumButtons(hwnd) to tell you how many are on the *
*   the toolbar.                                                             *
*   And... you have other routines you can use if you really want.           *
*                                                                            *
*   ENJOY!!                                                                  *
*                                                                            *
*  P.S.  Don't forget to pass on WM_SYSCOLORCHANGE msgs to each toolbar.     *
*                                                                            *
*****************************************************************************/

#define TOOLGROW	8		// power of 2

#define IDC_TOOLBAR	189		// wParam sent to Parent

/* We keep an array of these around (one for each button on the toolbar) */

typedef struct {
	RECT	rc;		// draw it at this postion in the toolbar
	int	iButton;	// it's this button
	int	iState;		// in this state
	int	iPrevState;	// for non-push buttons - last state
	int	iType;		// type of button
	int	iActivity;	// what just happened to button
	int	iString;	// string resource associated with button
} TOOLBUTTON, FAR *LPTOOLBUTTON;

BOOL FAR PASCAL toolbarInit(HANDLE hInst, HANDLE hPrev);
BOOL FAR PASCAL toolbarSetBitmap(HWND hwnd, HANDLE hInst, int ibmp,
								POINT ptSize);
BOOL FAR PASCAL toolbarAddTool(HWND hwnd, TOOLBUTTON tb);
BOOL FAR PASCAL toolbarRetrieveTool(HWND hwnd, int iButton, LPTOOLBUTTON tb);
BOOL FAR PASCAL toolbarRemoveTool(HWND hwnd, int iButton);
int FAR PASCAL toolbarGetNumButtons(HWND hwnd);
int FAR PASCAL toolbarButtonFromIndex(HWND hwnd, int iBtnPos);
int FAR PASCAL toolbarIndexFromButton(HWND hwnd, int iButton);
int FAR PASCAL toolbarPrevStateFromButton(HWND hwnd, int iButton);
int FAR PASCAL toolbarActivityFromButton(HWND hwnd, int iButton);
int FAR PASCAL toolbarIndexFromPoint(HWND hwnd, POINT pt);
BOOL FAR PASCAL toolbarRectFromIndex(HWND hwnd, int iBtnPos, LPRECT lprc);
int FAR PASCAL toolbarStringFromIndex(HWND hwnd, int iBtnPos);
int FAR PASCAL toolbarStateFromButton(HWND hwnd, int iButton);
int FAR PASCAL toolbarFullStateFromButton(HWND hwnd, int iButton);
int FAR PASCAL toolbarTypeFromIndex(HWND hwnd, int iBtnPos);
BOOL FAR PASCAL toolbarModifyState(HWND hwnd, int iButton, int iState);
BOOL FAR PASCAL toolbarModifyString(HWND hwnd, int iButton, int iString);
BOOL FAR PASCAL toolbarModifyPrevState(HWND hwnd, int iButton, int iPrevState);
BOOL FAR PASCAL toolbarModifyActivity(HWND hwnd, int iButton, int iActivity);
BOOL FAR PASCAL toolbarExclusiveRadio(HWND hwnd, int iType, int iButton);
BOOL FAR PASCAL toolbarMoveFocus(HWND hwnd, BOOL fBackward);
BOOL FAR PASCAL toolbarSetFocus(HWND hwnd, int iButton);
HBITMAP FAR PASCAL  LoadUIBitmap(
    HANDLE      hInstance,          // EXE file to load resource from
    LPCSTR      szName,             // name of bitmap resource
    COLORREF    rgbText,            // color to use for "Button Text"
    COLORREF    rgbFace,            // color to use for "Button Face"
    COLORREF    rgbShadow,          // color to use for "Button Shadow"
    COLORREF    rgbHighlight,       // color to use for "Button Hilight"
    COLORREF    rgbWindow,          // color to use for "Window Color"
    COLORREF    rgbFrame);          // color to use for "Window Frame"


/* In a bitmap file, each button is the same size, and contains
 * the picture of a button.  Each column contains the picture of a distinct
 * button (e.g. BTN_REWIND, BTN_REVERSE, etc.) and each row contains
 * a specific button state (BTNST_UP, BTNST_DOWN,
 * BTNBAR_GRAYED, etc. just as an example).
 *
 */

#define TB_FIRST	-1
#define TB_LAST		-2



#define BTNST_GRAYED		0	//
#define BTNST_UP		1	//
#define BTNST_DOWN		2	//
#define BTNST_FOCUSUP		3	//
#define BTNST_FOCUSDOWN		4	//
#define BTNST_FULLDOWN		5	//

#define BTN_REPEAT		0x100	// add this to button index
#define BTN_SHIFT		0x200
#define BTN_DBLCLICK		0x400


/* Types of buttons */

#define BTNTYPE_PUSH		0
#define BTNTYPE_CHECKBOX	1
#define BTNTYPE_CUSTOM		2
#define BTNTYPE_RADIO		3	// MUST BE LAST to reserve room for more
					// radio groups.  (3 == one group,
					// 4 == another group, etc.)


/* tells parent recent activity on button */
#define BTNACT_MOUSEDOWN	0	// clicked mouse button down on tool
#define BTNACT_MOUSEUP		1	// let go of mouse button while on tool
#define BTNACT_MOUSEMOVEOFF	2	// moved mouse off tool while btn down
#define BTNACT_MOUSEMOVEON	3	// moved back on tool (btn still down)
#define BTNACT_MOUSEDBLCLK	4	// dbl clicked on tool
#define BTNACT_KEYDOWN		5	// key down on tool
#define BTNACT_KEYUP		6	// key up from tool


/* constants */
#define MSEC_BUTTONREPEAT	200	// milliseconds for auto-repeat

/* timers */
#define TIMER_BUTTONREPEAT	1	// timer for button auto-repeat





// Window words for Toolbar
#ifdef _WIN32
#define GWL_ARRAYBUTT	0		/* Pointer to array of buttons  */
#define GWL_NUMBUTTONS	4		/* Number of buttons in array   */
#define GWL_PRESSED	8		/* Is a button currently pressed*/
#define GWL_KEYPRESSED	12      	/* Is a key currently pressed?  */
#define GWL_WHICH	16  	        /* Which button has the focus?  */
#define GWL_SHIFTED	20		/* Is it rt-click or shift-left?*/
#define GWL_BMPHANDLE	24		/* handle to bmp of the buttons */
#define GWL_BMPINT	28		/* resource int of button bmp	*/
#define GWL_BUTTONSIZE	32		/* a point (x=hi y=lo)		*/
#define GWL_HINST	36		/* hinst of the app   		*/
#define TOOLBAR_EXTRABYTES	40
#else
#define GWW_ARRAYBUTT	0		/* Pointer to array of buttons  */
#define GWW_NUMBUTTONS	2		/* Number of buttons in array   */
#define GWW_PRESSED	4		/* Is a button currently pressed*/
#define GWW_KEYPRESSED	6		/* Is a key currently pressed?  */
#define GWW_WHICH	8		/* Which button has the focus?  */
#define GWW_SHIFTED	10		/* Is it rt-click or shift-left?*/
#define GWW_BMPHANDLE	12		/* handle to bmp of the buttons */
#define GWW_BMPINT	14		/* resource int of button bmp	*/
#define GWL_BUTTONSIZE	16		/* a point (x=hi y=lo)		*/
#define GWW_HINST	20		/* hinst of the app   		*/
#define TOOLBAR_EXTRABYTES	22
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -