1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 //===========================================================================
26 //#####DESCRIPTIONBEGIN####
33 // Description: The Configuration item class
40 //####DESCRIPTIONEND####
42 //===========================================================================
49 #define INCLUDEFILE <cdl.hxx>
50 #include "IncludeSTL.h"
53 class CdlGoalExpressionBody;
54 class CdlTransactionBody;
57 friend class CConfigToolDoc;
58 friend class CCdlInterface;
60 CConfigItem(CConfigItem *pParent, CdlUserVisible CdlItem);
61 virtual ~CConfigItem();
63 bool ChangeVersion (const CString &strVersion);
65 CdlPackage GetOwnerPackage() const { return GetCdlItem()?(dynamic_cast<CdlPackage> (GetCdlItem()->get_owner ())):NULL; }
66 CdlValuable GetCdlValuable() const { return dynamic_cast<CdlValuable> (GetCdlItem()); }
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 };
79 static LPCTSTR TreeItemTypeImage[MaxTreeItemType + 1];
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;
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()); }
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);
115 CString m_strDesc; // Short description
117 CdlUserVisible m_CdlItem;