1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: FLTKPropertyList.cxx,v $
6 Date: $Date: 2007/08/21 20:21:09 $
7 Version: $Revision: 1.10 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 // FLTKPropertyList.cxx : implementation file
20 #include "FLTKPropertyList.h"
21 #include "../cmCacheManager.h"
22 #include "FLTKPropertyItemRow.h"
23 #include "FL/filename.H"
24 #include "FL/Fl_File_Chooser.H"
25 #include "FL/Fl_Color_Chooser.H"
26 #include "FL/fl_ask.H"
27 #include "FL/Fl_Button.H"
28 #include "CMakeSetupGUIImplementation.h"
33 /////////////////////////////////////////////////////////////////////////////
36 PropertyList::PropertyList( CMakeSetupGUIImplementation
* cmakeSetup
)
38 m_CMakeSetup
= cmakeSetup
;
39 PropertyItemRow::SetCMakeSetupGUI( cmakeSetup
);
45 PropertyList::~PropertyList()
47 for(std::set
<PropertyItem
*>::iterator i
= m_PropertyItems
.begin();
48 i
!= m_PropertyItems
.end(); ++i
)
57 int PropertyList::AddItem( std::string txt
)
65 int PropertyList::AddPropItem(PropertyItem
* pItem
, bool reverseOrder
)
75 nIndex
= m_PropertyItems
.size();
78 new PropertyItemRow( pItem
); // GUI of the new property row
80 m_PropertyItems
.insert(pItem
);
87 int PropertyList::AddProperty(const char* name
,
89 const char* helpString
,
91 const char* comboItems
,
95 PropertyItem
* pItem
= 0;
96 for(int i
=0; i
< this->GetCount(); ++i
)
98 PropertyItem
* item
= this->GetItem(i
);
99 if(item
->m_propName
== name
)
102 if(pItem
->m_curValue
!= value
)
104 pItem
->m_curValue
= value
;
105 pItem
->m_HelpString
= helpString
;
111 // if it is not found, then create a new one
114 pItem
= new PropertyItem(name
, value
, helpString
, type
, comboItems
);
116 return this->AddPropItem(pItem
,reverseOrder
);
120 void PropertyList::RemoveProperty(const char* name
)
122 for(int i
=0; i
< this->GetCount(); ++i
)
124 PropertyItem
* pItem
= (PropertyItem
*) GetItemDataPtr(i
);
125 if(pItem
->m_propName
== name
)
127 m_PropertyItems
.erase(pItem
);
136 void PropertyList::RemoveAll()
138 int c
= this->GetCount();
139 for(int i
=0; i
< c
; ++i
)
141 PropertyItem
* pItem
= (PropertyItem
*) GetItemDataPtr(0);
142 // cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str());
143 m_PropertyItems
.erase(pItem
);
151 PropertyItem
* PropertyList::GetItemDataPtr(int index
)
153 std::set
<PropertyItem
*>::iterator it
= m_PropertyItems
.begin();
154 for(int i
=0; it
!= m_PropertyItems
.end() && i
<index
; i
++)
162 PropertyItem
* PropertyList::GetItem(int index
)
164 std::set
<PropertyItem
*>::iterator it
= m_PropertyItems
.begin();
165 for(int i
=0; it
!= m_PropertyItems
.end() && i
<index
; i
++)
174 ::InvalidateList(void)
181 } // end fltk namespace