00001 #pragma once
00002
00003 #include "stdafx.h"
00004 #include "VariantC.h"
00005 #include "TreeListPaneC.h"
00006
00007 #include <string>
00008 #include <list>
00009 #include <map>
00010 #include <vector>
00011
00012 #ifdef _AFX_PACKING
00013 #pragma pack(push, _AFX_PACKING)
00014 #endif
00015
00016 #ifdef _AFX_MINREBUILD
00017 #pragma component(minrebuild, off)
00018 #endif
00019
00020 class CProperty;
00021
00022 #define TLITEM CProperty*
00023 typedef CMap<LRESULT, LRESULT, TLITEM, TLITEM> CRemoteToProp;
00024 typedef CMap<CVarData *, CVarData *, CVariant *, CVariant *> CRemoteToVariant;
00025
00026
00027
00028
00029
00030
00031
00032 typedef enum {
00033
00034 FONT_WEIGHT,
00035 FONT_ITALIC,
00036 FONT_COLOR,
00037 BG_COLOR,
00038 HILITE_COLOR,
00039 } UV_PROPERTY_ATTR;
00040
00041 class CProperty : public CObject
00042 {
00043
00044
00045 friend class CTreeListPane;
00046
00047
00048 public:
00052 CProperty(LRESULT remoteProp) {
00053 m_RemoteProp = remoteProp;
00054 m_TLInfo.pObject = (CObject *)remoteProp;
00055 }
00056
00057 virtual ~CProperty();
00058
00059 void Expand(BOOL bExpand = TRUE);
00060 int GetExpandedSubItems(BOOL bIncludeHidden = TRUE);
00061 virtual BOOL AddSubItem(CProperty* pProp);
00062 BOOL RemoveSubItem(CProperty*& pProp, BOOL bDelete = TRUE);
00063
00064 BOOL AddOption(LPCTSTR lpszOption, BOOL bInsertUnique = TRUE);
00065 void RemoveAllOptions();
00066
00067 int GetOptionCount() const;
00068 LPCTSTR GetOption(int nIndex);
00069 int GetCurSelIndex(void);
00070 void SetCurSelIndex(int sel);
00071
00072 void EnableSpinControl(BOOL bEnable = TRUE, int nMin = 0, int nMax = 0);
00073
00074 virtual void ResetOriginalValue();
00075
00076 void Show(BOOL bShow = TRUE, BOOL bAdjustLayout = TRUE);
00077 bool IsSuppressed();
00078 void SetAccelBaseStep(int step);
00079 DWORD_PTR GetOptionData(int index);
00080 void SetOptionData(int index, DWORD_PTR data);
00081 void ToggleCheck();
00082
00083 virtual bool GetChecked();
00084 virtual void SetChecked(BOOL f = true);
00085 void setHeader(void);
00086 void SetItemImage(int nImage);
00087 void setValueLook(UV_PROPERTY_ATTR which, void *value, bool redraw = false);
00088 void setNameLook(UV_PROPERTY_ATTR which, void *value);
00089 void setStatic(bool f);
00090 bool getStatic(void);
00091 LPCTSTR GetName() const;
00092 void SetName(LPCTSTR lpszName, BOOL bRedraw = TRUE);
00093 bool isNotifyExpand(void);
00094 void SetFullGroupName(bool f);
00095
00096 virtual const CVariant& GetValue();
00097 virtual void SetValue(const CVariant& varValue, bool redraw = true);
00098
00099 const CVariant& GetOriginalValue();
00100 void SetOriginalValue(const CVariant& varValue);
00101
00102
00103 void SetDescription(const CString& strDescr);
00104
00105 DWORD_PTR GetData() const;
00106 void SetData(DWORD_PTR dwData);
00107
00108 BOOL IsGroup() const;
00109 BOOL IsExpanded() const;
00110
00111 BOOL IsParentExpanded() const;
00112
00113 virtual BOOL IsSelected();
00114 int GetHierarchyLevel() const;
00115
00116 void Enable(BOOL bEnable = TRUE);
00117 BOOL IsEnabled() const;
00118
00119 void AllowEdit(BOOL bAllow = TRUE);
00120 BOOL IsAllowEdit() const;
00121
00122 int GetSubItemsCount() const;
00123
00124 CProperty* GetSubItem(int nIndex);
00125
00126 CProperty* GetParent() const;
00127 BOOL IsModified() const;
00128 BOOL IsVisible() const;
00129
00130 LRESULT m_RemoteProp;
00131 void SetAssociation(LRESULT rem)
00132 {
00133 m_RemoteProp = rem;
00134 m_TLInfo.pObject = (CObject *)rem;
00135 }
00136
00137 void Init();
00138
00139 private:
00140 TLINFO m_TLInfo;
00141 CRemoteToProp m_RemoteToProp;
00142 CRemoteToVariant m_RemoteToVariant;
00143 CVariant &GetLocalVariant(CVarData *res);
00144 CProperty *GetLocalTLItem(LRESULT rem);
00145 };