Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::G::Boxed Class Reference

A generic base class for GTK+ boxed objects. More...

`#include <xfc/glib/boxed.hh>`

Inheritance diagram for Xfc::G::Boxed:

List of all members.

## Public Member Functions

- virtual ~Boxed ()
    Destructor.
- void * g_boxed () const
    Returns a generic pointer to the GTK+ boxed object.

## Static Public Member Functions

Templates

- template<typename T> T * wrap (GType boxed_type, void *boxed)
    Generic C++ wrapper function for GTK+ boxed objects.
- template<typename T> T * wrap (GType boxed_type, void *boxed, bool copy)
    Generic C++ wrapper function for GTK+ boxed objects.

## Protected Member Functions

Constructors

- Boxed (GType boxed_type)
    Construct a new boxed type.
- Boxed (GType boxed_type, void *boxed)
    Construct a new boxed type.
- Boxed (GType boxed_type, void *boxed, bool copy)
    Construct a new boxed type.

Methods

- void copy (const Boxed &src)
    Make a copy of the boxed object src.
- void copy (const void *boxed)
    Copy the GTK+ boxed object to this C++ wrapper.

## Protected Attributes

- void * boxed_
    Generic GTK+ boxed object pointer.

## Detailed Description

A generic base class for GTK+ boxed objects.

The Boxed class handles the GTK+ memory allocation for boxed objects, saving you the trouble and initializes the underlying GTK+ structure where appropriate. Boxed is derived from Object so its derived classes can be managed by the XFC smart pointer, Pointer<>. Boxed is an implementation class so you wont need to use it unless you are deriving a new boxed object type. Some examples of boxed objects are Gdk::Color, G::Value, Gtk::TreeIter and Gtk::TreePath.

A Boxed object is a small object that is frequently copied and freed by GTK+. What it means to copy a Boxed object depends on each individual object. Sometimes a copied object will be a deep copy (an exact duplicate) and at other times it will be a shallow copy (merely reference counted).

## Constructor & Destructor Documentation

Xfc::G::Boxed::Boxed | ( | GType | boxed_type | ) | `[explicit, protected]`

Construct a new boxed type.

Parameters:

  | boxed_type | The GType value for the boxed object.

Creates an empty wrapper for the boxed object type boxed_type. Objects calling this constructor must call copy() to copy a boxed object to the wrapper.

Xfc::G::Boxed::Boxed | ( | GType | boxed_type,
|  | void * | boxed
| ) | `[protected]`

Construct a new boxed type.

Parameters:

  | boxed_type | The GType value for the boxed object.
  | boxed | A generic pointer to a GTK+ boxed object.

This constructor is used by Boxed::wrap for wrapping boxed objects that must not be freed.

Xfc::G::Boxed::Boxed | ( | GType | boxed_type,
|  | void * | boxed,
|  | bool | copy
| ) | `[protected]`

Construct a new boxed type.

Parameters:

  | boxed_type | The GType value for the boxed object.
  | boxed | A generic pointer to a GTK+ boxed object.
  | copy | Set true if a copy of boxed should be used.

If copy is true boxed is copied. If false boxed is assumed to be a valid copy of a boxed object that must be freed.

## Member Function Documentation

void Xfc::G::Boxed::copy | ( | const void * | boxed | ) | `[protected]`

Copy the GTK+ boxed object to this C++ wrapper.

Parameters:

  | boxed | A generic pointer to the GTK+ boxed object to copy.

boxed must be a valid boxed objrect and have the same GType as the calling object. The previous object, if any, is freed appropriately.

void Xfc::G::Boxed::copy | ( | const Boxed & | src | ) | `[protected]`

Make a copy of the boxed object src.

Parameters:

  | src | The Boxed object.

template<typename T>
T* Xfc::G::Boxed::wrap | ( | GType | boxed_type,
|  | void * | boxed,
|  | bool | copy
| ) | `[static]`

Generic C++ wrapper function for GTK+ boxed objects.

Parameters:

  | boxed_type | The GType value of the boxed object.
  | boxed | A generic pointer to a GTK+ boxed object.
  | copy | Set true if a copy of boxed should be used.

This version wraps GTK+ boxed objects that must be freed. If copy is true a copy of the boxed object is made. If copy is false the C++ wrapper takes over ownership of the boxed object and frees it appropriately.

template<typename T>
T* Xfc::G::Boxed::wrap | ( | GType | boxed_type,
|  | void * | boxed
| ) | `[static]`

Generic C++ wrapper function for GTK+ boxed objects.

Parameters:

  | boxed_type | The GType value of the boxed object.
  | boxed | A generic pointer to a GTK+ boxed object.

This version wraps GTK+ boxed objects that must not be freed. This is a temporary C++ wrapper and doesn't take over ownership of the boxed object.

The documentation for this class was generated from the following file:

- boxed.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3