Reference Manual

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

# box.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 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
    00025
    00026 #ifndef INTI_GTK_BOX_H
    00027 #define INTI_GTK_BOX_H
    00028
    00029 #ifndef INTI_GTK_CONTAINER_H
    00030 #include <inti/gtk/container.h>
    00031 #endif
    00032
    00033 #ifndef __GTK_HBOX_H__
    00034 #include <gtk/gtkhbox.h>
    00035 #endif
    00036
    00037 #ifndef __GTK_VBOX_H__
    00038 #include <gtk/gtkvbox.h>
    00039 #endif
    00040
    00041 namespace Inti {
    00042
    00043 namespace Gtk {
    00044
    00045 class BoxClass;
    00046 class HBoxClass;
    00047 class VBoxClass;
    00048
    00055
    00056 class BoxChild
    00057 {
    00058         friend class none;
    00059
    00060         BoxChild();
    00061         BoxChild(const BoxChild&);
    00062         BoxChild& operator=(const BoxChild&);
    00063
    00064         GtkBoxChild child_;
    00065
    00066 public:
    00069
    00070         GtkBoxChild* gtk_box_child() const { return const_cast<GtkBoxChild*>(&child_); }
    00072
    00073         Widget* widget() const;
    00077
    00078         bool expand() const { return child_.expand; }
    00085
    00086         bool fill() const { return child_.fill; }
    00093
    00094         unsigned int padding() const { return child_.padding; }
    00100
    00101         PackType pack() const { return (PackType)child_.pack; }
    00107
    00109 };
    00110
    00139
    00140 class Box : public Container
    00141 {
    00142         friend class G::Object;
    00143         friend class BoxClass;
    00144
    00145         Box(const Box&);
    00146         Box& operator=(const Box&);
    00147
    00148 protected:
    00151
    00152         Box();
    00154
    00155         explicit Box(GtkBox *box, bool reference = false);
    00162
    00163         virtual ~Box() = 0;
    00165
    00167 //  Properties
    00168
    00169         typedef G::Property<int> SpacingPropertyType;
    00170         typedef G::PropertyProxy<G::Object, SpacingPropertyType> SpacingPropertyProxy;
    00171         static const SpacingPropertyType spacing_property;
    00172
    00173         typedef G::Property<bool> HomogeneousPropertyType;
    00174         typedef G::PropertyProxy<G::Object, HomogeneousPropertyType> HomogeneousPropertyProxy;
    00175         static const HomogeneousPropertyType homogeneous_property;
    00176
    00177         typedef Gtk::ChildProperty<bool> ExpandPropertyType;
    00178         typedef Gtk::ChildPropertyProxy<Container, ExpandPropertyType> ExpandPropertyProxy;
    00179         static const ExpandPropertyType expand_property;
    00180
    00181         typedef Gtk::ChildProperty<bool> FillPropertyType;
    00182         typedef Gtk::ChildPropertyProxy<Container, FillPropertyType> FillPropertyProxy;
    00183         static const FillPropertyType fill_property;
    00184
    00185         typedef Gtk::ChildProperty<unsigned int> PaddingPropertyType;
    00186         typedef Gtk::ChildPropertyProxy<Container, PaddingPropertyType> PaddingPropertyProxy;
    00187         static const PaddingPropertyType padding_property;
    00188
    00189         typedef Gtk::ChildProperty<PackType, int> PackTypePropertyType;
    00190         typedef Gtk::ChildPropertyProxy<Container, PackTypePropertyType> PackTypePropertyProxy;
    00191         static const PackTypePropertyType pack_type_property;
    00192
    00193         typedef Gtk::ChildProperty<int> PositionPropertyType;
    00194         typedef Gtk::ChildPropertyProxy<Container, PositionPropertyType> PositionPropertyProxy;
    00195         static const PositionPropertyType position_property;
    00196
    00197 public:
    00200
    00201         GtkBox* gtk_box() const { return (GtkBox*)instance; }
    00203
    00204         GtkBoxClass* gtk_box_class() const;
    00206
    00207         operator GtkBox* () const;
    00209
    00210         bool children(std::vector<BoxChild*>& child_list) const;
    00217
    00218         bool get_homogeneous() const;
    00221
    00222         int get_spacing() const;
    00225
    00229
    00230         void pack_start(Widget& child, bool expand = true, bool fill = true, unsigned int padding = 0);
    00246
    00247         void pack_end(Widget& child, bool expand = true, bool fill = true, unsigned int padding = 0);
    00263
    00264         void insert_start(Widget& child, int position, bool expand = true, bool fill = true, unsigned int padding = 0);
    00282
    00283         void insert_end(Widget& child, int position, bool expand = true, bool fill = true, unsigned int padding = 0);
    00301
    00302         void set_homogeneous(bool homogeneous);
    00307
    00308         void set_spacing(int spacing);
    00311
    00312         void reorder_child(Widget& child, int position);
    00324
    00325         void query_child_packing(Widget& child, bool *expand, bool *fill, unsigned int *padding, PackType *pack_type) const;
    00332
    00333         void set_child_packing(Widget& child, bool expand, bool fill, unsigned int padding, PackType pack_type);
    00340
    00344
    00345         const SpacingPropertyProxy prop_spacing()
    00346         {
    00347                 return SpacingPropertyProxy(this, &spacing_property);
    00348         }
    00350
    00351         const HomogeneousPropertyProxy prop_homogeneous()
    00352         {
    00353                 return HomogeneousPropertyProxy(this, &homogeneous_property);
    00354         }
    00356
    00360
    00361         const ExpandPropertyProxy prop_expand()
    00362         {
    00363                 return ExpandPropertyProxy(this, &expand_property);
    00364         }
    00366
    00367
    00368         const FillPropertyProxy prop_fill()
    00369         {
    00370                 return FillPropertyProxy(this, &fill_property);
    00371         }
    00373
    00374         const PaddingPropertyProxy prop_padding()
    00375         {
    00376
    00377                 return PaddingPropertyProxy(this, &padding_property);
    00378         }
    00380
    00381         const PackTypePropertyProxy prop_pack_type()
    00382         {
    00383                 return PackTypePropertyProxy(this, &pack_type_property);
    00384         }
    00386
    00387         const PositionPropertyProxy prop_position()
    00388         {
    00389                 return PositionPropertyProxy(this, &position_property);
    00390         }
    00392
    00394
    00395 };
    00396
    00403
    00404 class HBox : public Box
    00405 {
    00406         friend class G::Object;
    00407         friend class HBoxClass;
    00408
    00409         HBox(const HBox&);
    00410         HBox& operator=(const HBox&);
    00411
    00412 protected:
    00415
    00416         explicit HBox(GtkHBox *hbox, bool reference = false);
    00423
    00425
    00426 public:
    00429
    00430         explicit HBox(bool homogeneous = false, int spacing = 0);
    00434
    00435         virtual ~HBox();
    00436
    00438
    00442
    00443         GtkHBox* gtk_hbox() const { return (GtkHBox*)instance; }
    00445
    00446         GtkHBoxClass* gtk_hbox_class() const;
    00448
    00449         operator GtkHBox* () const;
    00451
    00453 };
    00454
    00461
    00462 class VBox : public Box
    00463 {
    00464         friend class G::Object;
    00465         friend class VBoxClass;
    00466
    00467         VBox(const VBox&);
    00468         VBox& operator=(const VBox&);
    00469
    00470 protected:
    00473
    00474         explicit VBox(GtkVBox *vbox, bool reference = false);
    00481
    00483
    00484 public:
    00487
    00488         explicit VBox(bool homogeneous = false, int spacing = 0);
    00492
    00493         virtual ~VBox();
    00495
    00499
    00500         GtkVBox* gtk_vbox() const { return (GtkVBox*)instance; }
    00502
    00503         GtkVBoxClass* gtk_vbox_class() const;
    00505
    00506         operator GtkVBox* () const;
    00508
    00510 };
    00511
    00512 } // namespace Gtk
    00513
    00514 } // namespace Inti
    00515
    00516 #endif // INTI_GTK_BOX_H
    00517
    00518

Main Page - Footer