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

# container.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program 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
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00025
    00026 #ifndef INTI_GTK_CONTAINER_H
    00027 #define INTI_GTK_CONTAINER_H
    00028
    00029 #ifndef INTI_GTK_WIDGET_H
    00030 #include <inti/gtk/widget.h>
    00031 #endif
    00032
    00033 #ifndef __GTK_CONTAINER_H__
    00034 #include <gtk/gtkcontainer.h>
    00035 #endif
    00036
    00037 #ifndef INTI_SLOT_H
    00038 #include <inti/slot.h>
    00039 #endif
    00040
    00041 #ifndef INTI_GTK_CHILD_PROPERTY_H
    00042 #include <inti/gtk/childproperty.h>
    00043 #endif
    00044
    00045 namespace Inti {
    00046
    00047 namespace Gtk {
    00048
    00049 class ContainerClass;
    00050
    00061
    00062 class Container : public Widget
    00063 {
    00064         friend class G::Object;
    00065         friend class ContainerClass;
    00066
    00067         Container(const Container&);
    00068         Container& operator=(const Container&);
    00069
    00070 protected:
    00073
    00074         Container();
    00076
    00077         explicit Container(GtkContainer *container, bool reference = false);
    00084
    00086 //  Override these do_ methods when you want to change the default behaviour of the GtkContainer.
    00087
    00088         virtual void do_forall(bool include_internals, GtkCallback callback, void *callback_data);
    00089
    00090         virtual GType do_child_type();
    00091
    00092         virtual char* do_composite_name(GtkWidget *child);
    00093
    00094         virtual void do_set_child_property(GtkWidget *child, unsigned int property_id, const GValue *value, GParamSpec *pspec);
    00095
    00096         virtual void do_get_child_property(GtkWidget *child, unsigned int property_id, GValue *value, GParamSpec *pspec);
    00097
    00100
    00101         virtual void on_add(Widget& widget);
    00104
    00105         virtual void on_remove(Widget& widget);
    00108
    00109         virtual void on_check_resize();
    00113
    00114         virtual void on_set_focus_child(Widget *widget);
    00118
    00120 //  Properties
    00121
    00122         typedef G::Property<ResizeMode, int> ResizeModePropertyType;
    00123         typedef G::PropertyProxy<G::Object, ResizeModePropertyType> ResizeModePropertyProxy;
    00124         static const ResizeModePropertyType resize_mode_property;
    00125
    00126         typedef G::Property<unsigned int> BorderWidthPropertyType;
    00127         typedef G::PropertyProxy<G::Object, BorderWidthPropertyType> BorderWidthPropertyProxy;
    00128         static const BorderWidthPropertyType border_width_property;
    00129
    00130         typedef G::WritableProperty<Widget*, G::Object*> ChildPropertyType;
    00131         typedef G::PropertyProxy<G::Object, ChildPropertyType> ChildPropertyProxy;
    00132         static const ChildPropertyType child_property;
    00133
    00134 //  Signals
    00135
    00136         typedef G::Signal1<void, GtkWidget*> AddSignalType;
    00137         typedef G::SignalProxy<TypeInstance, AddSignalType> AddSignalProxy;
    00138         static const AddSignalType add_signal;
    00139
    00140         typedef G::Signal1<void, GtkWidget*> RemoveSignalType;
    00141         typedef G::SignalProxy<TypeInstance, RemoveSignalType> RemoveSignalProxy;
    00142         static const RemoveSignalType remove_signal;
    00143
    00144         typedef G::Signal0<void> CheckResizeSignalType;
    00145         typedef G::SignalProxy<TypeInstance, CheckResizeSignalType> CheckResizeSignalProxy;
    00146         static const CheckResizeSignalType check_resize_signal;
    00147
    00148         typedef G::Signal1<void, GtkWidget*> SetFocusChildSignalType;
    00149         typedef G::SignalProxy<TypeInstance, SetFocusChildSignalType> SetFocusChildSignalProxy;
    00150         static const SetFocusChildSignalType set_focus_child_signal;
    00151
    00152 public:
    00153         typedef Slot1<void, Widget&> ForeachSlot;
    00162
    00165
    00166         virtual ~Container();
    00168
    00172
    00173         GtkContainer* gtk_container() const { return (GtkContainer*)instance; }
    00175
    00176         GtkContainerClass* gtk_container_class() const;
    00178
    00179         operator GtkContainer* () const;
    00181
    00182         bool is_resize_container() const;
    00185
    00186         GType child_type() const;
    00192
    00193         Widget* focus_child() const;
    00195
    00196         bool get_children(std::vector<Widget*>& child_list) const;
    00201
    00202         unsigned int get_border_width() const;
    00204
    00205         ResizeMode get_resize_mode() const;
    00207
    00208         bool get_focus_chain(std::vector<Widget*>& focusable_widgets) const;
    00217
    00218         Adjustment* get_focus_vadjustment() const;
    00221
    00222         Adjustment* get_focus_hadjustment() const;
    00225
    00229
    00230         void add(Widget& widget);
    00241
    00242         void remove(Widget& widget);
    00250
    00251         void check_resize();
    00254
    00255         void set_focus_child(Widget& widget);
    00259
    00260         void set_border_width(unsigned int border_width);
    00271
    00272         void set_resize_mode(ResizeMode resize_mode);
    00278
    00279         void foreach(const ForeachSlot *each);
    00285
    00286         void set_reallocate_redraws(bool needs_redraws);
    00290
    00291         void set_focus_vadjustment(Adjustment *adjustment);
    00297
    00298         void set_focus_hadjustment(Adjustment *adjustment);
    00304
    00305         void resize_children();
    00310
    00311         void propagate_expose(Widget& child, const Gdk::EventExpose& event);
    00323
    00324         void set_focus_chain(const std::vector<Widget*>& focusable_widgets);
    00332
    00333         void unset_focus_chain();
    00335
    00339
    00340         const ResizeModePropertyProxy prop_resize_mode()
    00341         {
    00342                 return ResizeModePropertyProxy(this, &resize_mode_property);
    00343         }
    00345
    00346         const BorderWidthPropertyProxy prop_border_width()
    00347         {
    00348                 return BorderWidthPropertyProxy(this, &border_width_property);
    00349         }
    00351
    00352         const ChildPropertyProxy prop_child()
    00353         {
    00354                 return ChildPropertyProxy(this, &child_property);
    00355         }
    00357
    00361
    00362         const AddSignalProxy sig_add()
    00363         {
    00364                 return AddSignalProxy(this, &add_signal);
    00365         }
    00367
    00368         const RemoveSignalProxy sig_remove()
    00369         {
    00370                 return RemoveSignalProxy(this, &remove_signal);
    00371         }
    00373
    00374         const CheckResizeSignalProxy sig_check_resize()
    00375         {
    00376                 return CheckResizeSignalProxy(this, &check_resize_signal);
    00377         }
    00380
    00381         const SetFocusChildSignalProxy sig_set_focus_child()
    00382         {
    00383                 return SetFocusChildSignalProxy(this, &set_focus_child_signal);
    00384         }
    00386
    00388 };
    00389
    00390 } // namespace Gtk
    00391
    00392 } // namespace Inti
    00393
    00394 #endif // INTI_GTK_CONTAINER_H
    00395

Main Page - Footer