123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824 |
- #if !defined(__XTOUTBARCTRL_H__)
- #define __XTOUTBARCTRL_H__
- #if _MSC_VER >= 1000
- #pragma once
- #endif
- #include <afxtempl.h>
- #include "JPEG.h"
- class CXTBarItem;
- class CXTBarFolder;
- const UINT XTWM_OUTBAR_NOTIFY = (WM_USER+1018);
- #define XT_IDC_LARGEICON 52778
- #define XT_IDC_SMALLICON 52779
- #define XT_IDC_REMOVEGROUP 52784
- #define XT_IDC_RENAMEGROUP 52785
- #define XT_IDC_REMOVEITEM 52780
- #define XT_IDC_RENAMEITEM 52780
- const UINT OBN_XT_ITEMCLICK = 1;
- const UINT OBN_XT_ONLABELENDEDIT = 2;
- const UINT OBN_XT_ONGROUPENDEDIT = 3;
- const UINT OBN_XT_DRAGITEM = 4;
- const UINT OBN_XT_FOLDERCHANGE = 5;
- const UINT OBN_XT_ITEMHOVER = 6;
- const UINT OBN_XT_DELETEITEM = 7;
- const UINT OBN_XT_DELETEFOLDER = 8;
- const UINT OBN_XT_BEGINDRAG = 9;
- const UINT OBN_XT_ITEMRCLICK = 10;
- const UINT OBS_XT_SMALLICON = 0x0001;
- const UINT OBS_XT_LARGEICON = 0x0002;
- const UINT OBS_XT_EDITGROUPS = 0x0004;
- const UINT OBS_XT_EDITITEMS = 0x0008;
- const UINT OBS_XT_REMOVEGROUPS = 0x0010;
- const UINT OBS_XT_REMOVEITEMS = 0x0020;
- const UINT OBS_XT_ADDGROUPS = 0x0040;
- const UINT OBS_XT_DRAGITEMS = 0x0080;
- const UINT OBS_XT_ANIMATION = 0x0100;
- const UINT OBS_XT_SELHIGHLIGHT = 0x0200;
- const UINT OBS_XT_DEFAULT = 0x00FC;
- struct XT_OUTBAR_INFO
- {
- int nIndex;
- int nDragFrom;
- int nDragTo;
- LPCTSTR lpszText;
- bool bFolder;
- };
- class YLGL : public CWnd
- {
- DECLARE_DYNCREATE(YLGL)
- Image *m_pic;
- Image *m_pic2;
- Image *m_piconimg;
- Image *m_pic3;
- Image *m_pic4;
- public:
-
- YLGL();
-
- virtual ~YLGL();
- protected:
- int m_nFolderHeight;
- int m_nSelFolder;
- int m_nFolderHilighted;
- int m_nItemHilighted;
- int m_nLastFolderSelected;
- int m_nLastItemSelected;
- int m_nFirstItem;
- int m_nIconSpacingLarge;
- int m_nIconSpacingSmall;
- int m_nHitInternal1;
- int m_nHitInternal2;
- int m_nLastDragItemDraw;
- int m_nLastDragItemDrawType;
- int m_nSelAnimCount;
- int m_nSelAnimTiming;
- int m_nAnimationTickCount;
- BOOL m_bUpArrow;
- BOOL m_bDownArrow;
- BOOL m_bUpPressed;
- BOOL m_bDownPressed;
- BOOL m_bIconPressed;
- BOOL m_bLooping;
- BOOL m_bPressedHighlight;
- CFont m_font;
- CPen m_penBlack;
- CImageList* m_pLargeImageList;
- CImageList* m_pSmallImageList;
- DWORD m_dwFlags;
- CRect m_rcUpArrow;
- CRect m_rcDownArrow;
- CSize m_sizeOffset;
- CSize m_sizeMargin;
- CPtrArray m_arFolder;
- COLORREF m_clrBack;
- COLORREF m_clrText;
- BOOL m_bUserClrBack;
- BOOL m_bUserClrText;
- typedef enum { F_NORMAL, F_SELECT, F_HILIGHT } FOLDER_HILIGHT;
- public:
- void GetX(CString title, int &x, int &y);
-
-
- virtual void SetAnimSelHighlight(
-
- const int iTime);
-
-
- virtual DWORD GetFolderData(
-
-
- int iFolder = -1);
-
-
-
-
-
- virtual CWnd* GetFolderChild(
-
-
- int iFolder = -1);
-
-
- virtual int AddFolderBar(
-
- LPCTSTR lpszFolderName,
-
- CWnd* pWndChild,
-
- const DWORD dwData = 0);
-
-
- virtual CString GetItemText(
-
- const int iIndex);
-
-
-
-
-
- virtual void SetAnimationTickCount(
-
- const long lValue);
-
- virtual int GetAnimationTickCount();
-
-
-
- virtual void SetItemImage(
-
- const int iIndex,
-
- const int iImage);
-
-
- virtual void SetItemData(
-
- const int iIndex,
-
- const DWORD dwData);
-
-
- virtual int GetItemImage(
-
- const int iIndex) const;
-
-
- virtual DWORD GetItemData(
-
- const int iIndex) const;
-
-
- virtual void RemoveItem(
-
- const int iIndex);
-
-
- virtual void SetItemText(
-
- const int iIndex,
-
- LPCTSTR lpszItemName);
-
-
- virtual void StartItemEdit(
-
- const int iIndex);
-
- virtual void SetFolderText(
-
- const int iIndex,
-
- LPCTSTR lpszFolderName);
-
- virtual void StartGroupEdit(
-
- const int iIndex);
-
- virtual CImageList* GetFolderImageList(
-
- const int iIndex,
-
- const BOOL bSmall) const;
-
- virtual CImageList* GetImageList(
-
-
- DWORD dwImageList);
-
-
- virtual CImageList* SetFolderImageList(
-
- const int iFolder,
-
- CImageList* pImageList,
-
-
- DWORD dwImageList);
-
-
-
-
-
- virtual CImageList* SetImageList(
-
- CImageList* pImageList,
-
-
- DWORD dwImageList);
-
- virtual void RemoveFolder(
-
- const int iIndex);
-
- virtual int GetSelFolder() const;
-
- virtual int GetFolderCount() const;
-
- virtual void SetSelFolder(
-
- const int iIndex);
-
- virtual int GetItemCount() const;
-
-
- virtual int InsertItem(
-
- const int iFolder,
-
- const int iIndex,
-
- LPCTSTR lpszItemName,
-
- const int iImage = -1,
-
-
- const DWORD dwData = 0);
-
-
- virtual int AddFolder(
-
- LPCTSTR lpszFolderName,
-
- const DWORD dwData);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual void ModifyFlag(
-
-
- const DWORD& dwRemove,
-
-
- const DWORD& dwAdd,
-
- const UINT nRedraw = 0);
-
- virtual DWORD GetFlag() const;
-
-
- virtual void SetSmallIconView(
-
- const BOOL bSet,
-
-
- const int iFolder=-1);
-
-
-
- virtual BOOL IsSmallIconView(
-
- const int iFolder=-1) const;
-
-
- virtual BOOL Create(
-
- DWORD dwStyle,
-
- const RECT& rect,
-
- CWnd* pParentWnd,
-
- UINT nID,
-
-
- const DWORD dwFlag = OBS_XT_DEFAULT);
-
-
- virtual BOOL CreateEx(
-
- DWORD dwExStyle,
-
- DWORD dwStyle,
-
- const RECT& rect,
-
- CWnd* pParentWnd,
-
- UINT nID,
-
-
- const DWORD dwFlag = OBS_XT_DEFAULT);
-
- virtual void SetFontX(
-
- CFont* pFont);
-
-
- virtual CFont* GetFontX();
-
-
-
- virtual CXTBarFolder* GetBarFolder(
-
- const int iFolder);
-
-
-
- virtual CXTBarItem* GetBarFolderItem(
-
- const int iFolder,
-
- const int iIndex);
-
- virtual void SetBackColor(
-
- COLORREF clrBack);
-
-
- virtual void SetTextColor(
-
- COLORREF clrText);
-
-
- virtual void GetLabelRect(
-
- const int iFolder,
-
- const int iIndex,
-
- CRect& rect);
-
-
- virtual void GetIconRect(
-
- const int iFolder,
-
- const int iIndex,
-
- CRect& rect);
-
-
- virtual void GetInsideRect(
-
- CRect& rect) const;
-
-
- virtual void GetItemRect(
-
- const int iFolder,
-
- const int iIndex,
-
- CRect& rect);
-
- virtual BOOL GetFolderRect(
-
- const int iIndex,
-
- CRect& rect) const;
-
-
-
- inline int GetCurSel()
- {
- return m_nItemHilighted;
- }
-
-
- inline void SetCurSel(
-
- int iItem,
-
- const BOOL bPressed=false)
- {
- HighlightItem(iItem, bPressed);
- }
- protected:
-
- virtual void DrawItem(CDC* pDC, const int iFolder, CRect rc, const int iIndex, const BOOL bOnlyImage = false);
- virtual void DrawDragArrow(CDC* pDC, const int iFrom, const int iTo);
- virtual void DrawAnimItem(const int iOffsetX, const int iOffsetY, const int iIndex);
- virtual void DrawFolder(CDC* pDC, const int iIndex, CRect rect, const FOLDER_HILIGHT eHilight);
- virtual void DrawIcon(CDC* pDC, int iIcon, int iFolder, bool bHilight);
- virtual void PaintItems(CDC* pDC, const int iFolder, CRect rc);
- virtual void GetVisibleRange(const int iFolder, int& iFirst, int& iLast);
- virtual int GetDragItemRect(const int iIndex, CRect& rect);
- virtual CSize GetItemSize(const int iFolder, const int iIndex, const int iType);
- virtual void AnimateFolderScroll(const int iFrom, const int iTo);
- virtual void HighlightItem(const int iIndex, const BOOL bPressed = false);
- virtual void HighlightFolder(const int iIndex);
- virtual int HitTestEx(const CPoint& point, int& iIndex);
- virtual BOOL IsValidItem(const int iIndex) const;
-
-
-
-
-
-
-
- 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 BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnLargeIcon();
- afx_msg void OnUpdateLargeIcon(CCmdUI* pCmdUI);
- afx_msg void OnSmallIcon();
- afx_msg void OnUpdateSmallIcon(CCmdUI* pCmdUI);
- afx_msg void OnRemoveItem();
- afx_msg void OnUpdateRemoveItem(CCmdUI* pCmdUI);
- afx_msg void OnRenameItem();
- afx_msg void OnUpdateRenameItem(CCmdUI* pCmdUI);
- afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
- afx_msg void OnDestroy();
-
- afx_msg long OnEndLabelEdit(WPARAM wParam, LPARAM lParam);
-
-
- DECLARE_MESSAGE_MAP()
- };
- class CXTBarItem
- {
- public:
-
- CXTBarItem(
-
- LPCTSTR lpszName,
-
- const int nImageIndex,
-
- DWORD dwData);
-
- virtual ~CXTBarItem();
-
-
- int GetIndex();
-
-
- void SetIndex(
-
- int iIndex);
-
-
- DWORD GetData();
-
-
- void SetData(
-
- DWORD dwData);
-
-
- CString GetName();
-
- void SetName(
-
- CString strName);
- protected:
-
- int m_nIndex;
- DWORD m_dwData;
- CString m_strName;
-
- friend class YLGL;
- };
- class CXTBarFolder
- {
- public:
-
- CXTBarFolder(
-
- LPCTSTR lpszName,
-
- DWORD dwData);
-
- virtual ~CXTBarFolder();
-
-
- int GetItemCount();
-
-
- int InsertItem(
-
- int iIndex,
-
- LPCTSTR lpszName,
-
- const int nImage,
-
- const DWORD dwData);
-
-
- CXTBarItem* GetItemAt(
-
- int iIndex);
-
-
- void InsertItemAt(
-
- int iIndex,
-
- CXTBarItem* pBarItem);
-
-
- CXTBarItem* RemoveItemAt(
-
- int iIndex);
-
-
- CString GetName();
-
- void SetName(
-
- CString strName);
-
-
- DWORD GetData();
-
- void SetData(
-
- DWORD dwData);
-
-
- CImageList* GetLargeImageList();
-
- void SetLargeImageList(
-
- CImageList* pLargeList);
-
-
- CImageList* GetSmallImageList();
-
- void SetSmallImageList(
-
- CImageList* pSmallList);
-
-
-
- CWnd* GetChild();
-
-
- void SetChild(
-
- CWnd* pChild);
- protected:
-
- CString m_strName;
- DWORD m_dwData;
- CImageList* m_pLargeList;
- CImageList* m_pSmallList;
- CWnd* m_pChild;
- BOOL m_bSmallIcons;
- CList<CXTBarItem*, CXTBarItem*> m_barItems;
-
- friend class YLGL;
- };
- AFX_INLINE void YLGL::SetFontX(CFont* pFont) {
- ASSERT_VALID(pFont); LOGFONT lf; pFont->GetLogFont(&lf); m_font.DeleteObject(); m_font.CreateFontIndirect(&lf);
- }
- AFX_INLINE CFont* YLGL::GetFontX() {
- return &m_font;
- }
- AFX_INLINE void YLGL::SetAnimationTickCount(const long lValue) {
- m_nAnimationTickCount = lValue;
- }
- AFX_INLINE int YLGL::GetAnimationTickCount() {
- return m_nAnimationTickCount;
- }
- AFX_INLINE CXTBarFolder* YLGL::GetBarFolder(const int iFolder) {
- return (CXTBarFolder*)m_arFolder.GetAt(iFolder);
- }
- AFX_INLINE CXTBarItem* YLGL::GetBarFolderItem(const int iFolder, const int iIndex) {
- return GetBarFolder(iFolder)->GetItemAt(iIndex);
- }
- AFX_INLINE void YLGL::SetBackColor(COLORREF clrBack) {
- m_bUserClrBack = TRUE;
- m_clrBack = clrBack;
- }
- AFX_INLINE void YLGL::SetTextColor(COLORREF clrText) {
- m_bUserClrText = TRUE;
- m_clrText = clrText;
- }
- AFX_INLINE int CXTBarItem::GetIndex() {
- return m_nIndex;
- }
- AFX_INLINE void CXTBarItem::SetIndex(int iIndex) {
- m_nIndex = iIndex;
- }
- AFX_INLINE DWORD CXTBarItem::GetData() {
- return m_dwData;
- }
- AFX_INLINE void CXTBarItem::SetData(DWORD dwData) {
- m_dwData = dwData;
- }
- AFX_INLINE CString CXTBarItem::GetName() {
- return m_strName;
- }
- AFX_INLINE void CXTBarItem::SetName(CString strName) {
- m_strName = strName;
- }
- AFX_INLINE int CXTBarFolder::GetItemCount() {
- return (int)m_barItems.GetCount();
- }
- AFX_INLINE CString CXTBarFolder::GetName() {
- return m_strName;
- }
- AFX_INLINE void CXTBarFolder::SetName(CString strName) {
- m_strName = strName;
- }
- AFX_INLINE DWORD CXTBarFolder::GetData() {
- return m_dwData;
- }
- AFX_INLINE void CXTBarFolder::SetData(DWORD dwData) {
- m_dwData = dwData;
- }
- AFX_INLINE CImageList* CXTBarFolder::GetLargeImageList() {
- return m_pLargeList;
- }
- AFX_INLINE void CXTBarFolder::SetLargeImageList(CImageList* pLargeList) {
- m_pLargeList = pLargeList;
- }
- AFX_INLINE CImageList* CXTBarFolder::GetSmallImageList() {
- return m_pSmallList;
- }
- AFX_INLINE void CXTBarFolder::SetSmallImageList(CImageList* pSmallList) {
- m_pSmallList = pSmallList;
- }
- AFX_INLINE CWnd* CXTBarFolder::GetChild() {
- return m_pChild;
- }
- AFX_INLINE void CXTBarFolder::SetChild(CWnd* pChild) {
- m_pChild = pChild;
- }
- #endif
|