📄 commandbar.cpp
字号:
// CommandBar.cpp: implementation of the CCommandBar class.
//
//////////////////////////////////////////////////////////////////////
#include "../stdafx.h"
#include "../resource.h"
#include "CommandBar.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
// { 位图项, 命令id 状态 样式 保留 保留 }
static TBBUTTON tbSTDButton[] = //标准命令小图标
{
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{STD_FILENEW, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILEOPEN, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILESAVE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{STD_CUT, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0},
{STD_COPY, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_PASTE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0},
{STD_UNDO, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0}
};
static TBBUTTON tbVIEWButton[] = //视图小图标
{
{VIEW_SORTNAME , IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTSIZE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTDATE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTTYPE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0},
{VIEW_DETAILS, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_LIST, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SMALLICONS, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0}
};
static TBBUTTON tbMIXButton[] = //标准+视图
{
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{STD_FILENEW, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILEOPEN, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILESAVE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{VIEW_SORTNAME + 15,IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTSIZE + 15,IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTDATE + 15,IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{VIEW_SORTTYPE + 15,IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0},
};
static TBBUTTON tbStdUserButton[] = //标准+user
{
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{STD_FILENEW, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILEOPEN, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{STD_FILESAVE, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{0 + 27, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{1 + 27, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{2 + 27, IDC_NONE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
};
static TBBUTTON tbUsersButton[] = //user
{
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{0 + 27, IDM_VIEW_TREE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{1 + 27, IDM_VIEW_BOTH, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{2 + 27, IDM_VIEW_LIST, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
{3 + 27, IDM_VIEW_DISK, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{4 + 27, IDM_VIEW_REG, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
{5 + 27, IDM_VIEW_PROG, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
};
CCommandBar::CCommandBar()
{
}
CCommandBar::~CCommandBar()
{
}
int CCommandBar::AddButtons(int num)
{
switch(num)
{
case 0: //第一工具栏
CommandBar_AddButtons(m_hWndCB,sizeof(tbSTDButton)/sizeof(TBBUTTON),tbSTDButton);
break;
case 1: //第二工具栏
CommandBar_AddButtons(m_hWndCB,sizeof(tbVIEWButton)/sizeof(TBBUTTON),tbVIEWButton);
break;
case 2: //第三工具栏
CommandBar_AddButtons(m_hWndCB,sizeof(tbMIXButton)/sizeof(TBBUTTON),tbMIXButton);
break;
case 3: //第四工具栏
CommandBar_AddButtons(m_hWndCB,sizeof(tbStdUserButton)/sizeof(TBBUTTON),tbStdUserButton);
break;
case 4: //第五工具栏
CommandBar_AddButtons(m_hWndCB,sizeof(tbUsersButton)/sizeof(TBBUTTON),tbUsersButton);
break;
default: //缺省
CommandBar_AddButtons(m_hWndCB,sizeof(tbSTDButton)/sizeof(TBBUTTON),tbSTDButton);
break;
}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -