📄 qqbarctrl.h
字号:
#if !defined(AFX_QQBarCTRL_H__0C1F781A_8E5D_4F77_BF82_465E46F8019E__INCLUDED_)
#define AFX_QQBarCTRL_H__0C1F781A_8E5D_4F77_BF82_465E46F8019E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// QQBarCtrl.h : header file
//
//QQ界面风格特点:
//界面友好
//美观简洁
//使用方便
//易学易用
//直观明了
//具有向导功能
/////////////////////////////////////////////////////////////////////////////
// CQQBarCtrl window
#include <afxcoll.h>
#include <HPublic.h>
#define WM_OUTBAR_NOTIFY WM_USER + 1
#define NM_OB_ITEMCLICK 1
#define NM_OB_ITEM_DBLCLK 6
#define NM_OB_ONLABELENDEDIT 2
#define NM_OB_ONGROUPENDEDIT 3
#define NM_OB_DRAGITEM 4
#define NM_FOLDERCHANGE 5
#define ID_GFX_SMALLICON WM_USER+50000
#define ID_GFX_LARGEICON WM_USER+50001
#define ID_GFX_RENAMEITEM WM_USER+50002
#define ID_GFX_REMOVEITEM WM_USER+50003
#define ID_GFX_ADDITEM WM_USER+50004
#define UM_CHANGE_QQBAR_ITEM WM_USER+3005
#define UM_QQBAR_ITEM_CHANGED WM_USER+3006
#define UM_QQBAR_ITEM_DBLCLK WM_USER+3007
struct AFX_EXT_CLASS QQBAR_INFO
{
int index;
const char * cText;
int iDragFrom;
int iDragTo;
};
class AFX_EXT_CLASS CQQBarItem
{
public:
CQQBarItem(CQQBarItem &other){
*this=other;
};
CQQBarItem(CQQBarItem *other){
*this=*other;
};
CQQBarItem(const char * name, const int image, UINT64 exData){
cItem = NULL;
iImageIndex = image;
wwData = exData;
if (name)
{
cItem = new char[lstrlen(name)+1];
ASSERT(cItem);
lstrcpy(cItem, name);
}
};
virtual ~CQQBarItem();
CQQBarItem& operator=(CQQBarItem& other){
cItem = NULL;
iImageIndex=other.iImageIndex;
wwData=other.wwData;
if (other.cItem)
{
cItem = new char[lstrlen(other.cItem)+1];
ASSERT(other.cItem);
lstrcpy(cItem, other.cItem);
}
return other;
};
int iImageIndex;
char * cItem;
UINT64 wwData;
};
#define UM_QQBAR_ADD_FOLDER WM_USER+4001
#define UM_QQBAR_ADD_ITEM WM_USER+4002
#define UM_QQBAR_RMV_FOLDER WM_USER+4003
#define UM_QQBAR_RMV_ITEM WM_USER+4004
#define UM_QQBAR_UPT_FOLDER WM_USER+4005
#define UM_QQBAR_UPT_ITEM WM_USER+4006
#define QQ_FLAG_FOLDER 0
#define QQ_FLAG_ITEM 1
#define UM_CLICK_TREE_ITEM WM_USER+1101//DirectryTree.h
class AFX_EXT_CLASS CQQBarAddItemMsg
{
public:
CQQBarAddItemMsg(){
}
CQQBarAddItemMsg(CQQBarAddItemMsg &other){
*this=other;
}
CQQBarAddItemMsg(int nFolderIdx,
int nItemIdx,
int nIcon,
CString strLable,
UINT64 ddData,
int nFlag=QQ_FLAG_ITEM){
m_nFlag=nFlag;
m_nFolderIdx=nFolderIdx;
m_nItemIdx=nItemIdx;
m_nIcon=nIcon;
m_strLable=strLable;
m_ddData=ddData;
}
CQQBarAddItemMsg& operator=(CQQBarAddItemMsg& other){
this->m_nFolderIdx=other.m_nFolderIdx;
this->m_nItemIdx=other.m_nItemIdx;
this->m_nIcon=other.m_nIcon;
this->m_strLable=other.m_strLable;
this->m_ddData=other.m_ddData;
this->m_nFlag=other.m_nFlag;
return *this;
}
int m_nFlag;
int m_nFolderIdx;
int m_nItemIdx;
int m_nIcon;
CString m_strLable;
UINT64 m_ddData;
};
class AFX_EXT_CLASS CQQBarCtrl : public CWnd,public CHPublic
{
// Construction
DECLARE_DYNCREATE(CQQBarCtrl)
public:
CQQBarCtrl();
enum { fSmallIcon = 1 << 0, fLargeIcon = 1 << 1, fEditGroups = 1 << 2, fEditItems = 1 << 3,
fRemoveGroups = 1 << 4, fRemoveItems = 1 << 5, fAddGroups = 1 << 6,
fDragItems = 1 << 7, fAnimation = 1 << 8, fSelHighlight = 1 << 9 };
enum { ircIcon = 1, ircLabel = 2, ircAll = 3 };
// Attributes
public:
COLORREF crBackGroundColor, crBackGroundColor1;
COLORREF crTextColor;
COLORREF cr3dFace, crLightBorder, crHilightBorder, crShadowBorder, crDkShadowBorder;
int iFolderHeight;
int xSmallIconLabelOffset, yLargeIconLabelOffset;
int ySmallIconSpacing, yLargeIconSpacing;
int xLeftMargin, yTopMargin;
bool bUpArrow, bDownArrow, bUpPressed, bDownPressed;
CRect rcUpArrow, rcDownArrow;
bool bLooping;
int iHitInternal1, iHitInternal2;
long lAnimationTickCount;
int iLastSel, iSelAnimTiming;
int iSelAnimCount;
DWORD dwFlags;
CPtrArray arFolder;
int iLastFolderHighlighted;
int iLastSelectedFolder;
int iFirstItem;
int iLastItemHighlighted;
bool bPressedHighlight;
int iLastDragItemDraw, iLastDragItemDrawType;
class AFX_EXT_CLASS CBarFolder
{
public:
CBarFolder(const char * name, DWORD exData);
virtual ~CBarFolder();
int GetItemCount();
int InsertItem(int index, const char * text, const int image, const UINT64 exData);
char * cName;
DWORD dwData;
CImageList * pLargeImageList;
CImageList * pSmallImageList;
CPtrArray arItems;
CWnd * pChild;
};
int iSelFolder;
int nSelItem;
CImageList * pLargeImageList;
CImageList * pSmallImageList;
HCURSOR hHandCursor;
HCURSOR hDragCursor;
HCURSOR hNoDragCursor;
CPen * pBlackPen;
// Operations
public:
enum { htNothing = -1, htFolder, htItem, htUpScroll, htDownScroll};
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CQQBarCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
DWORD SetFlag(DWORD dwFlag);
void DrawAnimItem(const int xoffset, const int yoffset, const int index);
void SetAnimSelHighlight(const int iTime);
CString GetFolderText(int iFolder = -1);
DWORD GetFolderData(int iFolder = -1);
CWnd * GetFolderChild(int iFolder = -1);
int AddFolderBar(const char * pFolder, CWnd * pSon, const DWORD exData = 0);
CString GetItemText(const int index);
CString GetItemText(const int idxFolder,const int idxItem);
void SetAnimationTickCount(const long value) { lAnimationTickCount = value; };
long GetAnimationTickCount() { return lAnimationTickCount; };
void AnimateFolderScroll(const int iFrom, const int iTo);
int GetDragItemRect(const int index, CRect &rect);
void DrawDragArrow(CDC * pDC, const int iFrom, const int iTo);
void SetItemImage(const int index, const int iImage);
void SetItemImage(const int idxFolder,const int idxItem, const int iImage);
void SetItemData(const int index, const UINT64 wwData);
void SetItemData(const int idxFolder,const int idxItem, const UINT64 wwData);
int GetItemImage(const int index) const;
int GetItemImage(const int idxFolder,const int idxItem) const;
UINT64 GetItemData(const int index) const;
UINT64 GetItemData(const int idxFolder,const int idxItem) const;
bool IsValidItem(const int index) const;
void RemoveAllItem();
void RemoveItem(const int index);
void RemoveItem(const int nFolder,const int index);
void SetItemText(const int index, const char * text);
void SetItemText(const int idxFolder,const int idxItem, const char * text);
void StartItemEdit(const int index);
void SetFolderText(const int index, const char * text);
void StartGroupEdit(const int index);
void GetLabelRect(const int iFolder, const int iIndex, CRect &rect);
void GetIconRect(const int iFolder, const int iIndex, CRect &rect);
void HighlightItem(const int index, const bool bPressed = false);
void GetVisibleRange(const int iFolder, int &first, int &last);
void DrawItem(CDC * pDC, const int iFolder, CRect rc, const int index, const bool bOnlyImage = false);
CImageList * GetFolderImageList(const int index, const bool bSmall) const;
CSize GetItemSize(const int iFolder, const int index, const int type);
void PaintItems(CDC * pDC, const int iFolder, CRect rc);
CImageList * GetImageList(CImageList * pImageList, int nImageList);
CImageList * SetFolderImageList(const int folder, CImageList * pImageList, int nImageList);
CImageList * SetImageList(CImageList * pImageList, int nImageList);
int GetCountPerPage() const;
void RemoveFolder(const int index);
int GetSelFolder() const;
int GetSelItem() const;
int GetFolderCount() const;
void SetSelFolder(const int index);
int GetItemCount() const;
int GetAllItemCount() const;
int GetItemCount(int nSelFolder) const;
int InsertItem(const int folder, const int index, const char * text, const int image = -1, const UINT64 exData = 0);
void HighlightFolder(const int index);
int HitTestEx(const CPoint &point, int &index);
void GetInsideRect(CRect &rect) const;
int AddFolder(const char * cFolderName, const DWORD exData=0);
int AddFolder(int nSelFolder,CString strLable="新档",DWORD exData=0);
void GetItemRect(const int iFolder, const int iIndex, CRect &rect);
bool GetFolderRect(const int iIndex, CRect &rect) const;
void ModifyFlag(const DWORD &dwRemove, const DWORD &dwAdd, const UINT redraw = 0);
DWORD GetFlag() const;
void SetSmallIconView(const bool bSet);
bool IsSmallIconView() const;
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd * pParentWnd, UINT nID, const DWORD dwFlag = fDragItems|fEditGroups|fEditItems|fRemoveGroups|fRemoveItems|fAddGroups|fAnimation|fSelHighlight);
virtual ~CQQBarCtrl();
// Generated message map functions
protected:
void DrawFolder(CDC * pDC, const int iIdx, CRect rect, const bool bSelected);
//{{AFX_MSG(CQQBarCtrl)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnQQLargeicon();
afx_msg void OnUpdateQQLargeicon(CCmdUI* pCmdUI);
afx_msg void OnUpdateQQSmallicon(CCmdUI* pCmdUI);
afx_msg void OnQQRemoveitem();
afx_msg void OnQQAdditem();
afx_msg void OnUpdateQQRemoveitem(CCmdUI* pCmdUI);
afx_msg void OnQQRenameitem();
afx_msg void OnUpdateQQRenameitem(CCmdUI* pCmdUI);
public:
afx_msg void OnQQSmallicon();
afx_msg long OnClickTreeItem(UINT wParm,LONG lParm);
//}}AFX_MSG
afx_msg long OnEndLabelEdit(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_QQBarCTRL_H__0C1F781A_8E5D_4F77_BF82_465E46F8019E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -