179 lines
5.5 KiB
C++
179 lines
5.5 KiB
C++
/*=========================================================================
|
|
*
|
|
* CPAdLBox.hpp : class CPA_SortedListBox
|
|
*
|
|
*
|
|
* Version 1.0
|
|
* Creation date
|
|
* Revision date
|
|
*
|
|
* Shaitan
|
|
*=======================================================================*/
|
|
#ifdef ACTIVE_EDITOR
|
|
|
|
#ifndef __CPA_SORTEDLISTBOX_H__
|
|
#define __CPA_SORTEDLISTBOX_H__
|
|
|
|
/****************************************/
|
|
#ifndef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
#endif
|
|
/****************************************/
|
|
|
|
#include "CPAListB.hpp"
|
|
|
|
class CPA_EditorBase;
|
|
class CPA_DialogList;
|
|
|
|
/* sort criteria*/
|
|
typedef enum tdeSortCriteria_
|
|
{
|
|
E_sc_State,
|
|
E_sc_Icon,
|
|
E_sc_Name,
|
|
E_sc_Type,
|
|
E_sc_Owner,
|
|
E_sc_None
|
|
}
|
|
tdeSortCriteria;
|
|
|
|
/* style (columns of list control)*/
|
|
#define C_lDrawNothing 0
|
|
#define C_lDrawState 1
|
|
#define C_lDrawIcon 2
|
|
#define C_lDrawName 4
|
|
#define C_lDrawType 8
|
|
#define C_lDrawOwner 16
|
|
#define C_lDrawInfo 32
|
|
|
|
#define C_lDrawAllStandard (C_lDrawName + C_lDrawType + C_lDrawOwner)
|
|
#define C_lDrawAllCustom (C_lDrawAllStandard + C_lDrawInfo)
|
|
|
|
/*#################################################################################*/
|
|
/* Sorted ListBox*/
|
|
/*#################################################################################*/
|
|
/*===========================================================================
|
|
* Description: Class for Sorted ListBox
|
|
* Creation date:
|
|
* Author: Shaitan
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*=========================================================================*/
|
|
class CPA_EXPORT CPA_SortedListBox : public CListCtrl
|
|
{
|
|
protected:
|
|
CPA_EditorBase *m_pOwnerEditor;
|
|
CPA_DialogList *m_pParentDialog;
|
|
|
|
CPA_BaseObjectList *m_pSortedList;
|
|
CImageList *m_pIconList;
|
|
CImageList *m_pStateList;
|
|
|
|
tdeListOrder m_eCurrentOrder;
|
|
BOOL m_bDisplayGray;
|
|
BOOL m_bHeaders;
|
|
long m_lDrawStyle;
|
|
long m_lNbColumns;
|
|
|
|
int m_iSelectedItem;
|
|
int m_iDraggedItem;
|
|
int m_iTargetItem;
|
|
|
|
BOOL m_bCanChangeOrder;
|
|
BOOL m_bCanChangeDrawStyle;
|
|
BOOL m_bCanChangeDisplay;
|
|
BOOL m_bCanChangeHeaders;
|
|
|
|
BOOL m_bCanDragDrop;
|
|
BOOL m_bIsSelecting;
|
|
|
|
BOOL m_bAdjustSize;
|
|
|
|
public:
|
|
CPA_SortedListBox();
|
|
~CPA_SortedListBox() { }
|
|
|
|
void SetOwnerEditor (CPA_EditorBase *pEditor) { m_pOwnerEditor = pEditor; }
|
|
void SetParentDialog (CPA_DialogList *pParentDialog) { m_pParentDialog = pParentDialog; }
|
|
void SetSortedList (CPA_BaseObjectList *pSortedList);
|
|
void SetIconList (CImageList *pIconList, BOOL bUpdate = TRUE);
|
|
void SetStateList (CImageList *pStateList, BOOL bUpdate = TRUE);
|
|
|
|
tdeListOrder GetOrder (void) { return m_eCurrentOrder; }
|
|
void SetOrder (tdeListOrder eNewOrder, BOOL bCanChange = TRUE, BOOL bUpdateList = TRUE);
|
|
|
|
BOOL GetColumnHeaders (void) { return m_bHeaders; }
|
|
void SetColumnHeaders (BOOL bHeaders, BOOL bCanChange = TRUE, BOOL bUpdateList = TRUE) ;
|
|
|
|
long GetDrawStyle (void) { return m_lDrawStyle; }
|
|
void SetDrawStyle (long lNewStyle, BOOL bCanChange = TRUE, BOOL bUpdateList = TRUE) ;
|
|
|
|
BOOL GetDisplayGray (void) { return m_bDisplayGray; }
|
|
void SetDisplayGray (BOOL bDisplay, BOOL bCanChange = TRUE, BOOL bUpdateList = TRUE) ;
|
|
|
|
BOOL GetDragDropRight (void) { return m_bCanDragDrop; }
|
|
void SetDragDropRight (BOOL bCanDragDrop) { m_bCanDragDrop = bCanDragDrop; }
|
|
|
|
void SetOwnerDrawStyle (BOOL bOwnerDraw);
|
|
|
|
void SetAdjustSize (BOOL bAdjust);
|
|
|
|
void fn_vReinitListObjects (void);
|
|
void fn_vReinitColumnWidth (void);
|
|
|
|
BOOL fn_bIsSelecting (void) { return m_bIsSelecting; }
|
|
|
|
void SetSelectedItem (int iNumItem);
|
|
int GetSelectedItem (void);
|
|
|
|
int InsertNewItem (int iNumItem, CPA_BaseObject *pElem);
|
|
|
|
void fn_vDisableIcon (CDC *pDC, POINT pt, COLORREF cRectColor);
|
|
|
|
int GetCorrespondingIndex (DWORD pData);
|
|
int GetCorrespondingIcon (CPA_BaseObject *pObject);
|
|
int GetCorrespondingState (CPA_BaseObject *pObject);
|
|
BOOL GetCorrespondingColors (CPA_BaseObject *pObject, COLORREF *pRectColor, COLORREF *pTextColor);
|
|
CString GetCorrespondingInfo (CPA_BaseObject *pObject);
|
|
|
|
int GetIndexByStateToDraw (CPA_BaseObject *pObject);
|
|
int GetIndexByIconToDraw (CPA_BaseObject *pObject);
|
|
int GetIndexByNameToDraw (CPA_BaseObject *pObject);
|
|
int GetIndexByTypeToDraw (CPA_BaseObject *pObject);
|
|
int GetIndexByOwnerToDraw (CPA_BaseObject *pObject);
|
|
int GetIndexByInfoToDraw (CPA_BaseObject *pObject);
|
|
|
|
tdeSortCriteria GetColumnType (int iNumColumn);
|
|
|
|
void fn_vSortListByCriteria (tdeSortCriteria eCriteria);
|
|
|
|
afx_msg void OnRButtonDown (UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonDblClk (UINT nFlags, CPoint point);
|
|
afx_msg void OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
afx_msg void OnKeyUp (UINT nChar, UINT nRepCnt, UINT nFlags);
|
|
|
|
afx_msg void OnBeginDrag (NMHDR* pNMHDR, LRESULT* pResult);
|
|
afx_msg void OnMouseMove (UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonUp (UINT nFlags, CPoint point);
|
|
|
|
afx_msg void OnColumnClicked (NMHDR* pNMHDR, LRESULT* pResult);
|
|
|
|
virtual void DrawItem (LPDRAWITEMSTRUCT lpDIS);
|
|
virtual void fn_vOnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags) { };
|
|
|
|
afx_msg void OnSize (UINT nType, int cx, int cy);
|
|
|
|
BOOL OnCommand( WPARAM wParam, LPARAM lParam );
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
#endif /*__CPA_SORTEDLISTBOX_H__*/
|
|
#endif /* ACTIVE_EDITOR*/
|