00001 // $Id: ui-items-icon.h,v 1.5 2003/03/08 14:13:40 cactus Exp $ -*- c++ -*- 00002 /* 00003 * Copyright 2000-2002 The libgnomeuimm development team 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free 00017 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * 00019 */ 00020 00021 00022 #ifndef LIBGNOMEUIMM_ICON_H 00023 #define LIBGNOMEUIMM_ICON_H 00024 00025 #include <gtkmm/stockid.h> 00026 #include <libgnomeui/gnome-app-helper.h> 00027 00028 namespace Gnome 00029 { 00030 00031 namespace UI 00032 { 00033 00034 namespace Items 00035 { 00036 00038 class Icon 00039 { 00040 public: 00041 enum Type 00042 { 00043 NONE = GNOME_APP_PIXMAP_NONE, 00044 STOCK = GNOME_APP_PIXMAP_STOCK, 00045 DATA = GNOME_APP_PIXMAP_DATA, 00046 FILENAME = GNOME_APP_PIXMAP_FILENAME 00047 }; 00048 00049 explicit Icon(const Gtk::StockID& stock_id); 00050 Icon(Type type = NONE); 00051 ~Icon(); 00052 00053 Type get_type() const; 00054 gconstpointer get_pixmap_info() const; //This Icon must live as long as you need to use this data. 00055 00056 protected: 00057 00058 Type pixmap_type_; 00059 typedef const char * const * const xpmdata_t; 00060 00061 //Only one of these will have a value: 00062 gconstpointer xpm_data_; 00063 Glib::ustring stock_id_; //There's no Gtk::StockID default constructor. 00064 std::string filename_; 00065 }; 00066 00067 class IconXpm : public Icon 00068 { 00069 public: 00070 IconXpm(xpmdata_t xpm); 00071 ~IconXpm(); 00072 }; 00073 00074 class IconFile : public Icon 00075 { 00076 public: 00077 IconFile(const std::string& file); 00078 ~IconFile(); 00079 }; 00080 00081 } // namespace Items 00082 } // namespace UI 00083 } // namespace Gnome 00084 00085 00086 00087 #endif //LIBGNOMEUIMM_ICON_H