The Gnome Chemistry Utils  0.14.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
gcp::WidgetData Class Reference

#include <widgetdata.h>

Public Member Functions

bool IsSelected (gcu::Object const *obj) const
bool ChildrenSelected (gcu::Object const *obj) const
gcu::ObjectGetSelectedAncestor (gcu::Object *obj)
void SetSelected (gcu::Object *obj, int state=gcp::SelStateSelected)
void Unselect (gcu::Object *obj)
void UnselectAll ()
void MoveSelectedItems (double dx, double dy)
void MoveSelection (double dx, double dy)
void RotateSelection (double x, double y, double angle)
void ClearSelection ()
void Copy (GtkClipboard *clipboard)
void GetSelectionBounds (gccv::Rect &rect) const
bool HasSelection ()
void SelectAll ()
void ShowSelection (bool state)
void GetObjectBounds (gcu::Object const *obj, gccv::Rect *rect) const
void GetObjectsBounds (std::set< gcu::Object const * > const &objects, gccv::Rect *rect) const
void GetObjectBounds (gcu::Object const *obj, gccv::Rect &rect) const
void SimplifySelection ()

Static Public Member Functions

static xmlDocPtr GetXmlDoc (GtkClipboard *clipboard)

Public Attributes

Viewm_View
GtkWidget * Canvas
double Zoom
std::set< gcu::Object * > SelectedObjects

Detailed Description

This class contains all data associated with a widget displaying a document. It might be deprecated in future versions since it was mostly useful for the Bonobo version which is not anymore supported.

Definition at line 99 of file widgetdata.h.

Member Function Documentation

bool gcp::WidgetData::ChildrenSelected ( gcu::Object const *  obj) const
Parameters
objan object.
Returns
true if all the object children are selected, false otherwise or if obj has no children.
void gcp::WidgetData::ClearSelection ( )
inline

Empties the set of selected objects. Called after objects have been deleted.

Definition at line 189 of file widgetdata.h.

References SelectedObjects.

void gcp::WidgetData::Copy ( GtkClipboard *  clipboard)
Parameters
clipboarda GtkClipboard.

Copies the current selection to the clipboard.

void gcp::WidgetData::GetObjectBounds ( gcu::Object const *  obj,
gccv::Rect rect 
) const
Parameters
obja gcu::Object.
recta gccv::Rect which will receive the object bounds.

Gets the object bounds in canvas coordinates.

void gcp::WidgetData::GetObjectBounds ( gcu::Object const *  obj,
gccv::Rect rect 
) const
Parameters
obja gcu::Object.
recta gccv::Rect which will receive the object bounds.

Gets the object bounds in canvas coordinates.

void gcp::WidgetData::GetObjectsBounds ( std::set< gcu::Object const * > const &  objects,
gccv::Rect rect 
) const
Parameters
objectsa set of gcu::Object.
recta gccv::Rect which will receive the object bounds.

Gets the objects bounds in canvas coordinates.

gcu::Object* gcp::WidgetData::GetSelectedAncestor ( gcu::Object obj)
Parameters
objan object.
Returns
the topmost ancestor whose all children are selected, NULL if none or if the ancestor is the document.
void gcp::WidgetData::GetSelectionBounds ( gccv::Rect rect) const
Parameters
rectan ArtDRect which will receive the selection bounds.

Gets the selection bounds in canvas coordinates.

static xmlDocPtr gcp::WidgetData::GetXmlDoc ( GtkClipboard *  clipboard)
static
Parameters
clipboarda GtkClipboard.
Returns
the xmlDocPtr associtated with the clipboard.
bool gcp::WidgetData::HasSelection ( )
inline
Returns
true if at least one object is selected, false otherwise.

Definition at line 205 of file widgetdata.h.

References SelectedObjects.

bool gcp::WidgetData::IsSelected ( gcu::Object const *  obj) const
Parameters
objan object.
Returns
true if the object is selected, false otherwise.
void gcp::WidgetData::MoveSelectedItems ( double  dx,
double  dy 
)
Parameters
dxthe x coordinate of the translation vector.
dythe y coordinate of the translation vector.

Moves the items representing the selection, but don't move the objects themselves and don't modify the document. This is used by the selection tool but might be deprecated in the future.

void gcp::WidgetData::MoveSelection ( double  dx,
double  dy 
)
Parameters
dxthe x coordinate of the translation vector.
dythe y coordinate of the translation vector.

Moves the selection. This method creates an Operation instance for the Undo/Redo framework.

void gcp::WidgetData::RotateSelection ( double  x,
double  y,
double  angle 
)
Parameters
xthe x coordinate of the rotation center.
ythe y coordinate of the rotation center.
anglethe rotation angle.

Rotates the selection. This method does not create an Operation instance.

void gcp::WidgetData::SelectAll ( )

Selects the whole document.

void gcp::WidgetData::SetSelected ( gcu::Object obj,
int  state = gcp::SelStateSelected 
)
Parameters
objthe object to select.
statethe new selection state.

Selects the specified object.

void gcp::WidgetData::ShowSelection ( bool  state)
Parameters
statewhether to show or not the selection.

If state is true, the selection is highlighted, otherwise, it is displayed normally. This is used when printing or exporting an image.

void gcp::WidgetData::SimplifySelection ( )

Replace the selected objects by their parents if all parents children are selected.

void gcp::WidgetData::Unselect ( gcu::Object obj)
Parameters
objthe object to unselect.

Unselects a specified object.

void gcp::WidgetData::UnselectAll ( )

Unselects everything.

Member Data Documentation

GtkWidget* gcp::WidgetData::Canvas

The canvas widget to which this instance is associated.

Definition at line 109 of file widgetdata.h.

View* gcp::WidgetData::m_View

The document view.

Definition at line 105 of file widgetdata.h.

std::set< gcu::Object * > gcp::WidgetData::SelectedObjects

Maps the document objects to the canvas items which represent them.

The set of selected objects.

Definition at line 121 of file widgetdata.h.

Referenced by ClearSelection(), and HasSelection().

double gcp::WidgetData::Zoom

The current zoom factor.

Definition at line 113 of file widgetdata.h.


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