Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Inti::Gtk::SelectionData Class Reference

A GtkSelectionData C++ wrapper class. More...

#include <inti/gtk/selection.h>

Inheritance diagram for Inti::Gtk::SelectionData:

Inti::G::Boxed Inti::ReferencedObject Inti::ReferencedBase List of all members.

Public Member Functions

Constructors
Accessors
Methods
Drag-and-Drop Methods

Detailed Description

A GtkSelectionData C++ wrapper class.

The selection mechanism provides the basis for different types of communication between processes. In particular, drag-and-drop and Clipboard work via selections. You will very seldom or never need to use most of the functions in this section directly; Clipboard provides a nicer interface to the same functionality. Some of the datatypes defined in this section are used in the Clipboard and drag-and-drop API's as well.

The SelectionData object is used to store a chunk of data along with the data type and other associated information.


Constructor & Destructor Documentation

Inti::Gtk::SelectionData::SelectionData GtkSelectionData *  data  )  [explicit]
 

Construct a new SelectionData from an existing GtkSelectionData.

Parameters:
data A pointer to a GtkSelectionData.

The data can be a newly created GtkSelectionData or an existing GtkSelectionData. The SelectionData object created is a temporary object. It doesn't take over the ownership of GtkSelectionData and GtkSelectionData is not freed by the destructor.

Inti::Gtk::SelectionData::SelectionData GtkSelectionData *  data,
bool  copy
 

Construct a new SelectionData from an existing GtkSelectionData.

Parameters:
data A pointer to a GtkSelectionData.
copy Whether the SelectionData object should make a copy of GtkSelectionData or not.

The data can be a newly created GtkSelectionData or an existing GtkSelectionData. If copy is true SelectionData will make a copy of GtkSelectionData. If copy is false SelectionData wont make a copy but instead takes over the ownership of GtkSelectionData. Either way, the destructor will free GtkSelectionData when the SelectionData object is destroyed. This constructor is used by G::Boxed::wrap() to wrap GtkSelectionData objects in a C++ wrapper.


Member Function Documentation

bool Inti::Gtk::SelectionData::get_row_drag_data TreeModel **  model,
Pointer< TreePath > *  path
const
 

Obtains a model and path from selection data of target type GTK_TREE_MODEL_ROW.

Parameters:
model A pointer to a TreeModel pointer.
path A pointer to a smart TreePath pointer to hold the path to a row in tree_model.
Returns:
true if SelectionData had target type GTK_TREE_MODEL_ROW and is otherwise valid.

Normally called from a drag_data_received handler. This method can only be used if SelectionData originates from the same process that's calling this method, because a pointer to the tree model is being passed around. If you aren't in the same process, then you'll get memory corruption. In the TreeDragDest drag_data_received handler, you can assume that SelectionData of type GTK_TREE_MODEL_ROW is from the current process. If the target type is wrong this method returns false.

bool Inti::Gtk::SelectionData::get_targets std::vector< String > &  targets  )  const
 

Gets the contents of the selection data as a vector of String corresponding to the atoms that define the targets available.

Parameters:
targets A reference to a vector of String to store the names of targets.
Returns:
true if selection data contains a valid targets, otherwise false.

This can be used to interpret the results of getting the standard TARGETS target that is always supplied for any selection.

bool Inti::Gtk::SelectionData::get_targets std::vector< Gdk::Atom > &  targets  )  const
 

Gets the contents of the selection data as a vector of Gdk::Atom that defines the targets available.

Parameters:
targets A reference to a vector of Gdk::Atom to store the list of targets.
Returns:
true if selection data contains a valid targets, otherwise false.

This can be used to interpret the results of getting the standard TARGETS target that is always supplied for any selection.

String Inti::Gtk::SelectionData::get_text  )  const
 

Gets the contents of the selection data as a UTF-8 string.

Returns:
If the selection data contained a recognized text type and it could be converted to UTF-8, a String containing the converted text, otherwise a null String.

void Inti::Gtk::SelectionData::set Gdk::Atom  type,
int  format,
const void *  data,
int  length
 

Stores new data in this SelectionData object.

Parameters:
type The type of selection data.
format The format (number of bits in a unit).
data The pointer to the data (will be copied).
length The length of the data.

Should only be called from a selection handler callback. Zero-terminates the stored data.

bool Inti::Gtk::SelectionData::set_row_drag_data TreeModel tree_model,
const TreePath path
 

Sets selection data of target type GTK_TREE_MODEL_ROW.

Parameters:
tree_model A reference to a TreeModel.
path A row in tree_model.
Returns:
true if the SelectionData had the proper target type to allow us to set a tree row.

Normally used in a drag_data_get handler. If the target type is wrong this method returns false.

bool Inti::Gtk::SelectionData::set_text const String str  ) 
 

Sets the contents of the selection from a UTF-8 encoded string.

The string is converted to the form determined by target().

Parameters:
str A UTF-8 string.
Returns:
true if the selection was successfully set, otherwise false.


The documentation for this class was generated from the following file: Main Page - Footer


Generated on Sun Sep 14 20:08:18 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002