00001 #pragma once
00002
00003 #include "stdafx.h"
00004 #include "VariantC.h"
00005 #include "PropertyC.h"
00006 #include "SubscriberC.h"
00007 #include "UserToolBarC.h"
00008 #include "..\ViewIntf.h"
00009
00010 extern "C" void SetPar(TLInfo &TLInfo, char *szTypes, ... );
00011
00012 extern UINT AFX_WM_TREELISTPANE;
00013 extern UINT AFX_WM_VIEW_POOL;
00014 extern UINT AFX_WM_SET_CALLBACK;
00015
00016 #define TREEFILTER 0x7FFF //upper bound of WM_USER
00017
00018 class CProperty;
00019 class CSubscriber;
00020 class CUserToolBar;
00021
00022 #define TLITEM CProperty*
00023
00024 typedef CMap<LRESULT, LRESULT, TLITEM, TLITEM> CRemoteToProp;
00025 typedef CMap<CVarData *, CVarData *, CVariant *, CVariant *> CRemoteToVariant;
00026
00027
00028 class CTreeListPane : public CObject
00029 {
00030 public:
00031
00032
00035 CTreeListPane(void);
00036
00038 ~CTreeListPane(void);
00039
00040 virtual void WindowIsClosing();
00041
00044 void UpdateContent();
00045
00046
00052 bool Create(LPCTSTR PaneTitle, CWnd *parentWnd, int id);
00053
00054
00056 void EnableHeader(bool enable = true);
00057
00059 void SetDrawTreeLine(bool treeline);
00060
00066 void AddItem(TLITEM item);
00067
00072 void AddSubItem (TLITEM parent, TLITEM subItem);
00073
00081 TLITEM CreateGroup(LPCTSTR name, const CVariant &value = NULL, DWORD_PTR data = NULL, bool Editable = false);
00082
00084 void SetValueBgColor(TLITEM item, COLORREF color);
00085
00088 void SetValueHiliteColor(TLITEM item, COLORREF color, bool redraw = false);
00089
00091 void ResetValueBgColor(TLITEM item);
00092
00096 void SetValueFontItalic(TLITEM item, bool italic);
00097
00101 void SetValueFontBold(TLITEM item, bool bold);
00102
00104 void SetValueFontColor(TLITEM item, COLORREF color);
00105
00107 void SetNameBgColor(TLITEM item, COLORREF color);
00108
00110 void SetNameFontColor(TLITEM item, COLORREF color);
00111
00113 void ResetNameBgColor(TLITEM item);
00114
00118 void SetNameFontItalic(TLITEM item, bool italic);
00119
00123 void SetNameFontBold(TLITEM item, bool bold);
00124
00129 void Subscribe(CSubscriber *pSubscr);
00130
00135 void UnSubscribe(CSubscriber *pSubscr);
00136
00139 void EnableItem(TLITEM item, bool enable);
00140
00142 void SetItemStatic(TLITEM item, bool stat);
00143
00147 void SetImageList(UINT ResourceId);
00148
00150 void SetItemImage(TLITEM ItemId, int ImageIndex);
00151
00153 DWORD_PTR GetItemData(TLITEM item);
00154
00156 void SetItemData(TLITEM item, DWORD_PTR data);
00157
00159 void SetName(TLITEM item, LPCTSTR name);
00160
00162 const CVariant& GetValue(TLITEM item);
00163
00165 void SetValue(TLITEM item, const CVariant& varValue);
00166
00168 TLITEM GetHeaderItem(TLITEM table, UINT colInd);
00169
00171 void SetFullGroupName (TLITEM item, bool fullName = true);
00172
00180 TLITEM CreateEditField(
00181 LPCTSTR name,
00182 const CVariant &value,
00183 LPCTSTR descr = NULL,
00184 DWORD_PTR data = NULL,
00185 LPCTSTR editMask = NULL,
00186 LPCTSTR validChars = NULL
00187 );
00188
00196 TLITEM CreateCheckBox(LPCTSTR name, bool checked, LPCTSTR descr = NULL, DWORD_PTR data = NULL);
00197
00205 TLITEM CreateButton(LPCTSTR name, bool pressed, LPCTSTR descr = NULL, DWORD_PTR data = NULL);
00206
00214 TLITEM CreateStaticText(LPCTSTR name, LPCTSTR value = NULL, LPCTSTR descr = NULL, DWORD_PTR data = NULL);
00215
00223 TLITEM CreateSpin(LPCTSTR name, long selectedVal, long min, long max, LPCTSTR descr = NULL, DWORD_PTR data = NULL, int AccelBaseStep = 5);
00224
00237 void SetAccelBaseStep(TLITEM item, int AccelBaseStep);
00238
00246 TLITEM CreateCB(LPCTSTR name, LPCTSTR selectedVal = NULL, LPCTSTR descr = NULL, DWORD_PTR data = NULL);
00247
00253 BOOL AddOptionCB(TLITEM cb, LPCTSTR lpszOption, BOOL bInsertUnique = TRUE);
00254
00258 void RemoveAllOptionsCB(TLITEM cb);
00259
00262 int GetOptionCountCB(TLITEM cb);
00263
00266 LPCTSTR GetOptionCB(TLITEM cb, int nIndex);
00267
00270 int GetCurSelIndexCB(TLITEM cb);
00271
00274 void SetCurSelIndexCB (TLITEM cb, int sel);
00275
00277 DWORD_PTR GetOptionData(TLITEM item, int index);
00278
00280 void SetOptionData(TLITEM item, int index, DWORD_PTR data);
00281
00288 void AppendRow (TLITEM table, UINT RowCount, bool redraw = false);
00289
00298 TLITEM CreateTable(LPCTSTR name, UINT RowCount, UINT ColCount, DWORD_PTR Data = NULL);
00299
00304 void SetHeaderTitle (TLITEM table, UINT colInd, LPCTSTR title);
00305
00312 bool SetItemAt(TLITEM table, TLITEM item, UINT rowInd, UINT colInd);
00313
00315 void SetColumnWid(TLITEM table, UINT colInd, UINT wid);
00316
00319 void ShowToolbar(bool visible = true);
00320
00321
00324 void RemoveItem(TLITEM item);
00325
00327 void RemoveRow(TLITEM table, UINT rowInd);
00328
00330 void RemoveAll();
00331
00333 void AdjustLayout(bool redraw =1);
00334
00336 void ShowDescription(bool visible = true);
00337
00339 void SetFilter(bool enabled = true);
00340
00343 void SetOwnerDrawWnd(CWnd *pWnd);
00344
00345 virtual void OnHideWindow();
00346
00348 void SetPlainTable();
00349
00350 void SetImageFile(const char *pFile);
00351
00353 void SetUserButtons(CButtonInfo Buttons[], int count);
00354
00356 const CMFCToolBar *GetToolBar();
00357
00359 CUserToolBar *GetUserToolBar();
00360
00367 virtual BOOL CreateClient(CDockablePane *pane, CSubscriber *pSubscr = NULL, CWnd *pOwnerDraw = NULL);
00368
00373 virtual void DeleteClient(CSubscriber *pSubscr);
00374
00375 void SetAssociatedPane(CDockablePane *pane) {
00376 m_TLInfo.pObject = (void *)pane;
00377 }
00378
00386 virtual BOOL CreateClient(CDockablePane *pane, int NumOfCols, int NumOfVirtualRows, CSubscriber *pSubscr = NULL);
00387
00392 void SetRequestedVirtualPage(const CTableEntry **vec);
00393
00398 void SetTotalVirtualRows (int Lines);
00399
00404 void SelectVirtualRow(int row);
00405
00410 void SetVirtualPage(UINT StartRow);
00411
00415 CVariant *GetScrollInfo();
00416
00420 TLITEM GetVirtualTable();
00421
00425 void EnableDescriptionArea(bool f = true);
00426
00433 void Get32BitVals(const CVariant *p64BitVal, UINT &Lower32BitVal, UINT &Higher32BitVal);
00434
00435 void MakeColumnVisible(int index);
00436
00437
00438 TLITEM CreateProgressBar(LPCTSTR name, int min, int max, LPCTSTR descr = NULL, DWORD_PTR data = NULL);
00439 protected:
00440 TLINFO m_TLInfo;
00441
00442 private:
00443 CRemoteToProp m_RemoteToProp;
00444 CRemoteToVariant m_RemoteToVariant;
00445 CVariant &GetLocalVariant(CVarData *res);
00446 TLITEM GetLocalTLItem(LRESULT res);
00447 CUserToolBar m_UserToolBar;
00448 void Init();
00449
00450
00451 TLITEM m_pTable;
00452 CVariant m_ScrollInfo;
00453 };