Main Page - Header
Author: The Inti Development Team

Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# iconfactory.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 The Inti Development Team.
    00003  *
    00004  *  This program is free software; you can redistribute it and/or modify
    00005  *  it under the terms of the GNU General Public License as published by
    00006  *  the Free Software Foundation; either version 2 of the License, or
    00007  *  (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 Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this program; if not, write to the Free Software
    00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00017  */
    00018
    00027
    00028 #ifndef INTI_GTK_ICON_FACTORY_H
    00029 #define INTI_GTK_ICON_FACTORY_H
    00030
    00031 #ifndef INTI_G_BOXED_H
    00032 #include <inti/glib/boxed.h>
    00033 #endif
    00034
    00035 #ifndef INTI_G_OBJECT_H
    00036 #include <inti/glib/object.h>
    00037 #endif
    00038
    00039 #ifndef INTI_GTK_ENUMS_H
    00040 #include <inti/gtk/enums.h>
    00041 #endif
    00042
    00043 #ifndef __GTK_ICON_FACTORY_H__
    00044 #include <gtk/gtkiconfactory.h>
    00045 #endif
    00046
    00047 #ifndef _CPP_VECTOR
    00048 #include <vector>
    00049 #endif
    00050
    00051 namespace Inti {
    00052
    00053 namespace Gdk {
    00054 class Pixbuf;
    00055 }
    00056
    00057 namespace Gtk {
    00058
    00059 class IconFactoryClass;
    00060 class Settings;
    00061 class Style;
    00062 class Widget;
    00063
    00066
    00067 bool icon_size_lookup(IconSize size, int *width, int *height, Settings *settings = 0);
    00084
    00085 IconSize icon_size_register(const char *name, int width, int height);
    00091
    00092 void icon_size_register_alias(const char *alias, IconSize target);
    00098
    00099 IconSize icon_size_from_name(const char *name);
    00103
    00104 String icon_size_get_name(IconSize size);
    00108
    00110
    00133
    00134 class IconSource : public G::Boxed
    00135 {
    00136 public:
    00139
    00140         IconSource();
    00142
    00143         explicit IconSource(GtkIconSource *source);
    00149
    00150         IconSource(GtkIconSource *source, bool copy);
    00157
    00158         IconSource(const IconSource& src);
    00160
    00161         ~IconSource();
    00163
    00164         IconSource& operator=(const IconSource& src);
    00166
    00170
    00171         GtkIconSource* gtk_icon_source() const { return (GtkIconSource*)boxed_; }
    00173
    00174         operator GtkIconSource* () const;
    00176
    00177         String get_filename() const;
    00180
    00181         Gdk::Pixbuf* get_pixbuf() const;
    00184
    00185         bool get_size_wildcarded() const;
    00188
    00189         bool get_state_wildcarded() const;
    00192
    00193         bool get_direction_wildcarded() const;
    00196
    00197         TextDirection get_direction() const;
    00202
    00203         StateType get_state() const;
    00208
    00209         IconSize get_size() const;
    00214
    00218
    00219         void set_filename(const String& filename);
    00225
    00226         void set_pixbuf(Gdk::Pixbuf *pixbuf);
    00231
    00232         void set_direction_wildcarded(bool setting);
    00241
    00242         void set_state_wildcarded(bool setting);
    00253
    00254         void set_size_wildcarded(bool setting);
    00265
    00266         void set_direction(TextDirection direction);
    00273
    00274         void set_state(StateType state);
    00281
    00282         void set_size(IconSize size);
    00289
    00291 };
    00292
    00302
    00303 class IconSet : public G::Boxed
    00304 {
    00305 public:
    00308
    00309         IconSet();
    00311
    00312         explicit IconSet(Gdk::Pixbuf& pixbuf);
    00319
    00320         explicit IconSet(GtkIconSet *icon_set);
    00326
    00327         IconSet(GtkIconSet *icon_set, bool copy);
    00335
    00336         IconSet(const IconSet& src);
    00338
    00339         ~IconSet();
    00341
    00342         IconSet& operator=(const IconSet& src);
    00344
    00348
    00349         GtkIconSet* gtk_icon_set() const { return (GtkIconSet*)boxed_; }
    00351
    00352         operator GtkIconSet* () const;
    00354
    00355         bool get_sizes(std::vector<IconSize>& sizes) const;
    00359
    00363
    00364         Pointer<Gdk::Pixbuf> render_icon(Style& style, StateType state, IconSize size,
    00365                                          Widget* widget = 0, const char *detail = 0,
    00366                                          TextDirection direction = TEXT_DIR_LTR);
    00382
    00383         void add_source(const IconSource& source);
    00404
    00406 };
    00407
    00421
    00422 class IconFactory : public G::Object
    00423 {
    00424         friend class G::Object;
    00425         friend class IconFactoryClass;
    00426
    00427         IconFactory(const IconFactory&);
    00428         IconFactory& operator=(const IconFactory&);
    00429
    00430 protected:
    00433
    00434         explicit IconFactory(GtkIconFactory *icon_factory, bool reference = true);
    00441
    00443
    00444 public:
    00447
    00448         IconFactory();
    00450
    00451         virtual ~IconFactory();
    00453
    00457
    00458         GtkIconFactory* gtk_icon_factory() const { return (GtkIconFactory*)instance; }
    00460
    00461         GtkIconFactoryClass* gtk_icon_factory_class() const;
    00463
    00464         operator GtkIconFactory* () const;
    00466
    00470
    00471         void add(const char *stock_id, IconSet& icon_set);
    00483
    00484         Pointer<IconSet> lookup(const char *stock_id);
    00493
    00494         void add_default();
    00499
    00500         void remove_default();
    00502
    00504
    00505         static Pointer<IconSet> lookup_default(const char *stock_id);
    00513 };
    00514
    00515 } // namespace Gtk
    00516
    00517 } // namespace Inti
    00518
    00519 #endif // INTI_GTK_ICON_FACTORY_H
    00520

Main Page - Footer