OpenWalnut 1.2.5
WItemSelectionItem.h
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WITEMSELECTIONITEM_H
00026 #define WITEMSELECTIONITEM_H
00027 
00028 #include <string>
00029 
00030 #include "WExportCommon.h"
00031 
00032 /**
00033  * Class for keeping a single named item in a WItemSelection.
00034  */
00035 class OWCOMMON_EXPORT WItemSelectionItem // NOLINT
00036 {
00037 public:
00038 
00039     /**
00040      * Constructs a new item with the specified values.
00041      *
00042      * \param name Name of item.
00043      * \param description Description, can be empty.
00044      * \param icon Icon, can be NULL.
00045      */
00046     WItemSelectionItem( std::string name, std::string description = "", const char** icon = NULL );
00047 
00048     /**
00049      * Destruction. Does NOT delete the icon!
00050      */
00051     virtual ~WItemSelectionItem();
00052 
00053     /**
00054      * Returns the name of the item.
00055      *
00056      * \return the name
00057      */
00058     std::string getName() const;
00059 
00060     /**
00061      * The description of the item.
00062      *
00063      * \return the description
00064      */
00065     std::string getDescription() const;
00066 
00067     /**
00068      * The icon associated with this item. Can be NULL.
00069      *
00070      * \return the icon, might be NULL.
00071      */
00072     const char** getIcon() const;
00073 
00074     /**
00075      * Compares this and another item using their names only.
00076      *
00077      * \param other the second to compare the this one with
00078      *
00079      * \return true if the names are equal.
00080      */
00081     bool operator==( const WItemSelectionItem& other ) const;
00082 
00083 protected:
00084 
00085     /**
00086      * Item name.
00087      */
00088     std::string m_name;
00089 
00090     /**
00091      * Item description.
00092      */
00093     std::string m_description;
00094 
00095     /**
00096      * Item icon.
00097      */
00098     const char** m_icon;
00099 
00100 private:
00101 };
00102 
00103 #endif  // WITEMSELECTIONITEM_H
00104 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends