libgnomeuimm  2.28.0
ui-items-icon.h
Go to the documentation of this file.
1 // $Id$ -*- c++ -*-
2 /*
3  * Copyright 2000-2002 The libgnomeuimm development team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  */
20 
21 
22 #ifndef LIBGNOMEUIMM_ICON_H
23 #define LIBGNOMEUIMM_ICON_H
24 
25 #include <gtkmm/stockid.h>
26 #include <libgnomeui/gnome-app-helper.h>
27 
28 namespace Gnome
29 {
30 
31 namespace UI
32 {
33 
34 namespace Items
35 {
36 
38 class Icon
39 {
40 public:
41  enum Type
42  {
43  NONE = GNOME_APP_PIXMAP_NONE,
44  STOCK = GNOME_APP_PIXMAP_STOCK,
45  DATA = GNOME_APP_PIXMAP_DATA,
46  FILENAME = GNOME_APP_PIXMAP_FILENAME
47  };
48 
49  explicit Icon(const Gtk::StockID& stock_id);
50  Icon(Type type = NONE);
51  ~Icon();
52 
53  Type get_type() const;
54  gconstpointer get_pixmap_info() const; //This Icon must live as long as you need to use this data.
55 
56 protected:
57 
59  typedef const char * const * const xpmdata_t;
60 
61  //Only one of these will have a value:
62  gconstpointer xpm_data_;
63  Glib::ustring stock_id_; //There's no Gtk::StockID default constructor.
64  std::string filename_;
65 };
66 
67 class IconXpm : public Icon
68 {
69 public:
72 };
73 
74 class IconFile : public Icon
75 {
76 public:
77  IconFile(const std::string& file);
79 };
80 
81 } // namespace Items
82 } // namespace UI
83 } // namespace Gnome
84 
85 
86 
87 #endif //LIBGNOMEUIMM_ICON_H
Gnome::UI::Items::Icon::FILENAME
@ FILENAME
Definition: ui-items-icon.h:46
Gnome::UI::Items::Icon::filename_
std::string filename_
Definition: ui-items-icon.h:64
Gnome::UI::Items::Icon
Icons represent a standard Pixmap with various states.
Definition: ui-items-icon.h:39
Gnome
Definition: about.h:46
Gnome::UI::Items::IconXpm::~IconXpm
~IconXpm()
Gnome::UI::Items::Icon::pixmap_type_
Type pixmap_type_
Definition: ui-items-icon.h:58
Gnome::UI::Items::IconXpm
Definition: ui-items-icon.h:68
Gnome::UI::Items::Icon::get_type
Type get_type() const
Gnome::UI::Items::Icon::Icon
Icon(Type type=NONE)
Gnome::UI::Items::Icon::xpmdata_t
const char *const *const xpmdata_t
Definition: ui-items-icon.h:59
Gnome::UI::Items::Icon::stock_id_
Glib::ustring stock_id_
Definition: ui-items-icon.h:63
Gnome::UI::Items::Icon::Type
Type
Definition: ui-items-icon.h:42
Gnome::UI::Items::Icon::get_pixmap_info
gconstpointer get_pixmap_info() const
Gnome::UI::Items::Icon::Icon
Icon(const Gtk::StockID &stock_id)
Gnome::UI::Items::Icon::DATA
@ DATA
Definition: ui-items-icon.h:45
Gnome::UI::Items::Icon::xpm_data_
gconstpointer xpm_data_
Definition: ui-items-icon.h:62
Gnome::UI::Items::IconFile::~IconFile
~IconFile()
Gnome::UI::Items::IconXpm::IconXpm
IconXpm(xpmdata_t xpm)
Gnome::UI::Items::IconFile
Definition: ui-items-icon.h:75
Gnome::UI::Items::Icon::STOCK
@ STOCK
Definition: ui-items-icon.h:44
Gnome::UI::Items::Icon::NONE
@ NONE
Definition: ui-items-icon.h:43
Gnome::UI::Items::Icon::~Icon
~Icon()
Gnome::UI::Items::IconFile::IconFile
IconFile(const std::string &file)