STK++ 1.0
STK_Category.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------*/
00002 /*     Copyright (C) 2004-2007  Serge Iovleff
00003 
00004  This program is free software; you can redistribute it and/or modify
00005  it under the terms of the GNU Lesser General Public License as
00006  published by the Free Software Foundation; either version 2 of the
00007  License, or (at your option) any later version.
00008 
00009  This program is distributed in the hope that it will be useful,
00010  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  GNU Lesser General Public License for more details.
00013 
00014  You should have received a copy of the GNU Lesser General Public
00015  License along with this program; if not, write to the
00016  Free Software Foundation, Inc.,
00017  59 Temple Place,
00018  Suite 330,
00019  Boston, MA 02111-1307
00020  USA
00021 
00022  Contact : Serge.Iovleff@stkpp.org
00023  */
00024 
00025 /*
00026  * Project:  stkpp::gui::model
00027  * created on: 7 nov. 2009
00028  * Purpose:  .
00029  * Author:   iovleff, serge.iovleff@stkpp.org
00030  **/
00031 
00036 #ifndef CATEGORY_H
00037 #define CATEGORY_H
00038 
00039 #include "../../../projects/STKernel/include/STK_String.h"
00040 #include "../../../projects/STKernel/include/STK_List1D.h"
00041 
00042 #include "STK_Tool.h"
00043 
00044 namespace STK
00045 {
00046 
00052 class Category
00053 {
00054   public:
00058     enum Type
00059     {
00060       Default,  
00061       Scratchpad
00062     };
00063 
00064   public:
00070     Category( String const& aname = String(), Type atype = Default);
00074    virtual ~Category();
00079     inline String const& name() const
00080     { return name_;}
00085     inline void setName( String const& aname)
00086     { name_ = aname;}
00091     inline int toolCount() const
00092     { return tool_list_.size();}
00098     inline Tool tool( int idx) const
00099     { return tool_list_.elt(idx);}
00104     inline void removeTool( int idx)
00105     { tool_list_.erase(idx);}
00110     inline void addTool( const Tool &atool)
00111     { tool_list_.push_back(atool);}
00116     inline Type type() const
00117     { return type_;}
00122     inline void setType( Type atype)
00123     { type_ = atype;}
00127     inline bool isNull() const
00128     { return name_.empty();}
00129 
00130   private:
00134     String name_;
00138     Type type_;
00142     List1D<Tool> tool_list_;
00143 
00144 };
00145 
00146 } // namespace STK
00147 
00148 #endif /* CATEGORY_H */