BasicItem:
[simple-launcher] / misc / BasicItem.h
index 13ba34f..d38a5fa 100644 (file)
@@ -1,3 +1,20 @@
+// This file is a part of Simple Launcher
+//
+// Copyright (C) 2006, 2007, Mikhail Sobolev
+//
+// Simple Launcher is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, write to the Free Software Foundation, Inc., 51
+// Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 #ifndef __BASICITEM_H__
 #define __BASICITEM_H__
 
@@ -14,6 +31,8 @@ public:
        const std::string& getType() const { return myType; }
        const std::string& getID() const { return myID; }
 
+  virtual bool load() = 0;
+
   virtual std::string getName() const = 0;
   virtual std::string getComment() const = 0;
   virtual GdkPixbuf *getIcon(int iconSize) const = 0;
@@ -45,19 +64,25 @@ class BasicItemFactory {
 private:
        BasicItemFactory();
 
+       virtual ~BasicItemFactory();
+
+public:
+       static BasicItem *create(const std::string& factoryName, const std::string& itemID);
+
 public:
        virtual const string::std& factoryName() const = 0;
 
+protected:
        virtual BasicItem *createItem(const std::string&) const = 0;
 
-protected:
        static void registerFactory(const std::string&, BasicItemFactory *);
+       static void deRegisterFactory(const std::string&, BasicItemFactory *);
 
 protected:
-       std::map<std::string, BasicItemFactory *> ourFactories;
+       static std::map<std::string, BasicItemFactory *> ourFactories;
 };
 
-typedef struct BasicItemCollection {
+struct BasicItemCollection {
   typedef std::vector<std::string> Names;
   typedef std::map<std::string, BasicItem *> Items;