1 |
26 |
unneback |
//####COPYRIGHTBEGIN####
|
2 |
|
|
//
|
3 |
|
|
// ----------------------------------------------------------------------------
|
4 |
|
|
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
5 |
|
|
//
|
6 |
|
|
// This program is part of the eCos host tools.
|
7 |
|
|
//
|
8 |
|
|
// This program is free software; you can redistribute it and/or modify it
|
9 |
|
|
// under the terms of the GNU General Public License as published by the Free
|
10 |
|
|
// Software Foundation; either version 2 of the License, or (at your option)
|
11 |
|
|
// any later version.
|
12 |
|
|
//
|
13 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
14 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
16 |
|
|
// more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU General Public License along with
|
19 |
|
|
// this program; if not, write to the Free Software Foundation, Inc.,
|
20 |
|
|
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
21 |
|
|
//
|
22 |
|
|
// ----------------------------------------------------------------------------
|
23 |
|
|
//
|
24 |
|
|
//####COPYRIGHTEND####
|
25 |
|
|
//===========================================================================
|
26 |
|
|
//#####DESCRIPTIONBEGIN####
|
27 |
|
|
//
|
28 |
|
|
// Author(s): sdf
|
29 |
|
|
// Contact(s): sdf
|
30 |
|
|
// Date: 1998/08/11
|
31 |
|
|
// Version: 0.01
|
32 |
|
|
// Purpose:
|
33 |
|
|
// Description: The Configuration item class
|
34 |
|
|
// Requires:
|
35 |
|
|
// Provides:
|
36 |
|
|
// See also:
|
37 |
|
|
// Known bugs:
|
38 |
|
|
// Usage:
|
39 |
|
|
//
|
40 |
|
|
//####DESCRIPTIONEND####
|
41 |
|
|
//
|
42 |
|
|
//===========================================================================
|
43 |
|
|
|
44 |
|
|
#ifndef _TREEITEM_H
|
45 |
|
|
#define _TREEITEM_H
|
46 |
|
|
#include "stdafx.h"
|
47 |
|
|
#include "FileName.h"
|
48 |
|
|
|
49 |
|
|
#define INCLUDEFILE <cdl.hxx>
|
50 |
|
|
#include "IncludeSTL.h"
|
51 |
|
|
|
52 |
|
|
class CCdlInterface;
|
53 |
|
|
class CdlGoalExpressionBody;
|
54 |
|
|
class CdlTransactionBody;
|
55 |
|
|
|
56 |
|
|
class CConfigItem {
|
57 |
|
|
friend class CConfigToolDoc;
|
58 |
|
|
friend class CCdlInterface;
|
59 |
|
|
public:
|
60 |
|
|
CConfigItem(CConfigItem *pParent, CdlUserVisible CdlItem);
|
61 |
|
|
virtual ~CConfigItem();
|
62 |
|
|
|
63 |
|
|
bool ChangeVersion (const CString &strVersion);
|
64 |
|
|
bool Unload();
|
65 |
|
|
CdlPackage GetOwnerPackage() const { return GetCdlItem()?(dynamic_cast<CdlPackage> (GetCdlItem()->get_owner ())):NULL; }
|
66 |
|
|
CdlValuable GetCdlValuable() const { return dynamic_cast<CdlValuable> (GetCdlItem()); }
|
67 |
|
|
bool ViewURL();
|
68 |
|
|
bool ViewHeader();
|
69 |
|
|
bool HasRadio () const;
|
70 |
|
|
bool HasBool () const;
|
71 |
|
|
int EvalEnumStrings (CStringArray &arEnumStrings) const;
|
72 |
|
|
bool IsDescendantOf (CConfigItem *pAncestor);
|
73 |
|
|
void SetHItem (HTREEITEM hItem) { m_hItem=hItem; };
|
74 |
|
|
CString ItemNameOrMacro() const;
|
75 |
|
|
CConfigItem * NextRadio() const;
|
76 |
|
|
bool CanSetValue (ItemIntegerType nValue) const;
|
77 |
|
|
enum TreeItemType { None, Integer, Enum, String, Double, MaxTreeItemType };
|
78 |
|
|
|
79 |
|
|
static LPCTSTR TreeItemTypeImage[MaxTreeItemType + 1];
|
80 |
|
|
|
81 |
|
|
ItemIntegerType Value() const;
|
82 |
|
|
bool HasModifiedChildren() const;
|
83 |
|
|
bool IsEnabled() const;
|
84 |
|
|
CConfigItem *FirstRadio() const;
|
85 |
|
|
CString GetURL () const;
|
86 |
|
|
const CFileName FileName () const;
|
87 |
|
|
const CString StringValue (CdlValueSource source = CdlValueSource_Current) const;
|
88 |
|
|
const CString StringValue(WhereType where) const;
|
89 |
|
|
const double DoubleValue (CdlValueSource source = CdlValueSource_Current) const;
|
90 |
|
|
void DumpItem();
|
91 |
|
|
|
92 |
|
|
// Access functions
|
93 |
|
|
ItemIntegerType DefaultValue() const;
|
94 |
|
|
const CString StringDefaultValue() const { return StringValue (CdlValueSource_Default); }
|
95 |
|
|
const double DoubleDefaultValue () const { return DoubleValue (CdlValueSource_Default); }
|
96 |
|
|
const CString Name() const { return GetCdlItem()?GetCdlItem()->get_display ().c_str ():CString(_T("Configuration")); }
|
97 |
|
|
TreeItemType Type() const { return m_Type; }
|
98 |
|
|
CConfigItem *Parent() const;
|
99 |
|
|
CConfigItem *FirstChild() const;
|
100 |
|
|
CConfigItem *NextSibling() const;
|
101 |
|
|
bool Modified() const;
|
102 |
|
|
const CString Desc() const { return m_strDesc; }
|
103 |
|
|
const CString Macro() const { return GetCdlItem()?GetCdlItem()->get_name().c_str():CString(); }
|
104 |
|
|
CdlUserVisible GetCdlItem () const { return m_CdlItem; }
|
105 |
|
|
HTREEITEM HItem() const { return m_hItem; }
|
106 |
|
|
bool IsPackage () const { return NULL!=dynamic_cast<CdlPackage> (GetCdlItem()); }
|
107 |
|
|
|
108 |
|
|
protected:
|
109 |
|
|
bool SetValue (LPCTSTR pszValue, CdlTransaction transaction=NULL);
|
110 |
|
|
bool SetValue (ItemIntegerType nValue, CdlTransaction transaction=NULL);
|
111 |
|
|
bool SetValue (double dValue, CdlTransaction transaction=NULL);
|
112 |
|
|
bool SetEnabled (bool bEnabled, CdlTransaction transaction=NULL);
|
113 |
|
|
|
114 |
|
|
HTREEITEM m_hItem;
|
115 |
|
|
CString m_strDesc; // Short description
|
116 |
|
|
TreeItemType m_Type;
|
117 |
|
|
CdlUserVisible m_CdlItem;
|
118 |
|
|
};
|
119 |
|
|
#endif
|