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

#include <gcp/view.h>

Inheritance diagram for gcp::View:
gccv::Client

Public Member Functions

 View (Document *pDoc, bool Embedded)
virtual ~View ()
GtkWidget * GetWidget ()
DocumentGetDoc ()
void AddObject (gcu::Object *pObject)
void Update (gcu::Object *pObject)
GtkWidget * CreateNewWidget ()
void OnDestroy (GtkWidget *widget)
double GetZoomFactor ()
void UpdateFont ()
void Remove (gcu::Object *pObject)
double GetFontHeight ()
gchar * GetFontName ()
gchar * GetSmallFontName ()
PangoFontDescription * GetPangoFontDesc ()
PangoFontDescription * GetPangoSmallFontDesc ()
void OnDeleteSelection (GtkWidget *w)
void OnCopySelection (GtkWidget *w, GtkClipboard *clipboard)
void OnPasteSelection (GtkWidget *w, GtkClipboard *clipboard)
void OnCutSelection (GtkWidget *w, GtkClipboard *clipboard)
bool OnKeyPress (GtkWidget *w, GdkEventKey *event)
bool OnKeyRelease (GtkWidget *w, GdkEventKey *event)
void SetTextActive (gccv::Text *item)
bool PrepareUnselect ()
void OnReceive (GtkClipboard *clipboard, GtkSelectionData *selection_data)
void OnSelectAll ()
bool IsEmbedded ()
int GetNbWidgets ()
void ExportImage (std::string const &filename, const char *type, int resolution=-1)
char * BuildSVG ()
char * BuildEPS ()
GdkPixbuf * BuildPixbuf (int resolution)
void EnsureSize ()
void Zoom (double zoom)
void ShowCursor (bool show)
void UpdateTheme ()
void Render (cairo_t *cr)
void SetSelectionState (gcu::Object *object, int state)
bool OnButtonPressed (gccv::ItemClient *client, unsigned button, double x, double y, unsigned state)
bool OnButtonReleased (gccv::ItemClient *client, unsigned button, double x, double y, unsigned state)
bool OnDrag (gccv::ItemClient *client, double x, double y, unsigned state)
bool OnMotion (gccv::ItemClient *client, double x, double y, unsigned state)
bool OnLeaveNotify (unsigned state)
WidgetDataGetData ()
void GetVisibleArea (double &x0, double &y0, double &x1, double &y1)
double GetBaseLineOffset (void) const
gccv::TextGetActiveRichText (void) const
double GetCHeight (void) const
double GetHWidth (void) const
- Public Member Functions inherited from gccv::Client
 Client ()
virtual ~Client ()
CanvasGetCanvas (void)

Additional Inherited Members

- Protected Attributes inherited from gccv::Client
Canvasm_Canvas

Detailed Description

The GChempaint document view.

Definition at line 61 of file gcp/view.h.

Constructor & Destructor Documentation

gcp::View::View ( Document pDoc,
bool  Embedded 
)
Parameters
pDocthe GchemPaint document for the new view.
Embeddedwhether the document is embedded in another application or is standalone.

Constructs the document view.

virtual gcp::View::~View ( )
virtual

The destructor.

Member Function Documentation

void gcp::View::AddObject ( gcu::Object pObject)
Parameters
pObjectthe object to add.

Adds the object to the canvas.

char* gcp::View::BuildEPS ( )
Returns
the eps output as a newly allocated string. Call g_free when done with it.
GdkPixbuf* gcp::View::BuildPixbuf ( int  resolution)
Parameters
resolutionthe resolution for the new image.

Builds a new image with the given resolution in ppi. The size is evaluated using the guessed screen resolution.

Returns
the new pixbuf.
char* gcp::View::BuildSVG ( )
Returns
the svg output as a newly allocated string. Call g_free when done with it.
GtkWidget* gcp::View::CreateNewWidget ( )

Creates a new canvas widget for the view.

Returns
the new widget.
void gcp::View::EnsureSize ( )

Called by the framework to ensure that the view size is enough large to contain all objects.

void gcp::View::ExportImage ( std::string const &  filename,
const char *  type,
int  resolution = -1 
)
Parameters
filenamethe file name to use for the export.
typea string representing the image type as used by the GdkPixbuf library. Other types supported are "svg", "ps", "pdf", and "eps".
resolutionthe image resolution to use for bitmaps.

Exports the current document to an image. The resolution parameter is significative only for bitmap images; if it is not given, of if negative, 1 will be used which will result as a one to one pixel export.

gcp::View::GetActiveRichText ( void  ) const
inline
Returns
the currently edited text item if any, or NULL.

Definition at line 331 of file gcp/view.h.

gcp::View::GetBaseLineOffset ( void  ) const
inline
Returns
the vertical offset for algnment of an atomic symbol. This value is half the height of the "C" character.

Definition at line 327 of file gcp/view.h.

gcp::View::GetCHeight ( void  ) const
inline
Returns
the half height of a carbon atom symbol in the current theme.

Definition at line 335 of file gcp/view.h.

WidgetData* gcp::View::GetData ( )
inline
Returns
the WidgetData associated with the View widget.

Definition at line 294 of file gcp/view.h.

Document* gcp::View::GetDoc ( )
inline
Returns
the document associated with the view.

Definition at line 87 of file gcp/view.h.

double gcp::View::GetFontHeight ( )
inline
Returns
the height of the font used to display atomic symbols.

Definition at line 129 of file gcp/view.h.

gchar* gcp::View::GetFontName ( )
inline
Returns
the name of the font used to display atomic symbols.

Definition at line 133 of file gcp/view.h.

gcp::View::GetHWidth ( void  ) const
inline
Returns
the half width of a hydrogen atom symbol in the current theme.

Definition at line 339 of file gcp/view.h.

int gcp::View::GetNbWidgets ( )
inline
Returns
the number of existing canvases for this view.

Definition at line 221 of file gcp/view.h.

PangoFontDescription* gcp::View::GetPangoFontDesc ( )
inline
Returns
the description of the font used to display atomic symbols.

Definition at line 141 of file gcp/view.h.

PangoFontDescription* gcp::View::GetPangoSmallFontDesc ( )
inline
Returns
the description of the font used to display stoichiometry indices and charges.

Definition at line 145 of file gcp/view.h.

gchar* gcp::View::GetSmallFontName ( )
inline
Returns
the name of the font used to display stoichiometry indices and charges.

Definition at line 137 of file gcp/view.h.

void gcp::View::GetVisibleArea ( double &  x0,
double &  y0,
double &  x1,
double &  y1 
)
Parameters
x0where to store the left horizontal coordinate of the visible area.
y0where to store the top vertical coordinate of the visible area.
x1where to store the right horizontal coordinate of the visible area.
y1where to store the bottom vertical coordinate of the visible area.

Gets the visible area for the view.

GtkWidget* gcp::View::GetWidget ( void  )
inline
Returns
the canvas widget used for the view.

Definition at line 83 of file gcp/view.h.

double gcp::View::GetZoomFactor ( )
Returns
the current zoom factor.
bool gcp::View::IsEmbedded ( )
inline
Returns
true if the view is embedded in another document view.

Definition at line 217 of file gcp/view.h.

bool gcp::View::OnButtonPressed ( gccv::ItemClient client,
unsigned  button,
double  x,
double  y,
unsigned  state 
)
virtual
Parameters
clientthe ItemClient for the Item at the event position if any.
buttonthe mouse button.
xhorizontal event position.
yvertical event position.
statethe GdkModifierType value for the event.

Called when a mouse button is pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.

Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

Reimplemented from gccv::Client.

bool gcp::View::OnButtonReleased ( gccv::ItemClient client,
unsigned  button,
double  x,
double  y,
unsigned  state 
)
virtual
Parameters
clientthe ItemClient for the Item at the event position if any.
buttonthe mouse button.
xhorizontal event position.
yvertical event position.
statethe GdkModifierType value for the event.

Called when a mouse button is released. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.

Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

Reimplemented from gccv::Client.

void gcp::View::OnCopySelection ( GtkWidget *  w,
GtkClipboard *  clipboard 
)
Parameters
wthe active document widget.
clipboarda GtkClipboard.

Called by the framework to copy the selection.

void gcp::View::OnCutSelection ( GtkWidget *  w,
GtkClipboard *  clipboard 
)
Parameters
wthe active document widget.
clipboarda GtkClipboard.

Called by the framework to copy and delete the selection.

void gcp::View::OnDeleteSelection ( GtkWidget *  w)
Parameters
wthe active document widget.

Removes all objects in the widget.

void gcp::View::OnDestroy ( GtkWidget *  widget)
Parameters
widgetthe destroyed widget.

Called by the framework when a widget is destroyed.

bool gcp::View::OnDrag ( gccv::ItemClient client,
double  x,
double  y,
unsigned  state 
)
virtual
Parameters
clientthe ItemClient for the Item at the event position if any.
xhorizontal event position.
yvertical event position.
statethe GdkModifierType value for the event.

Called when the mouse moves over the canvas, with at least one button pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.

Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

Reimplemented from gccv::Client.

bool gcp::View::OnKeyPress ( GtkWidget *  w,
GdkEventKey *  event 
)
Parameters
wthe widget which received the event.
eventthe current event.

Called by the framework when a key has been pressed on the keyboard.

Returns
true if the key was significant, false otherwise.
bool gcp::View::OnKeyRelease ( GtkWidget *  w,
GdkEventKey *  event 
)
Parameters
wthe widget which received the event.
eventthe current event.

Called by the framework when a key has been released on the keyboard.

Returns
true if the key was significant, false otherwise.
bool gcp::View::OnLeaveNotify ( unsigned  state)
virtual
Parameters
statethe GdkModifierType value for the event.

Called when the mouse leaves the Canvas.

Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

Reimplemented from gccv::Client.

bool gcp::View::OnMotion ( gccv::ItemClient client,
double  x,
double  y,
unsigned  state 
)
virtual
Parameters
clientthe ItemClient for the Item at the event position if any.
xhorizontal event position.
yvertical event position.
statethe GdkModifierType value for the event.

Called when the mouse moves over the canvas, with no button pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient. @return true to stop other handlers from being invoked for the event. false to propagate the event further.

Reimplemented from gccv::Client.

void gcp::View::OnPasteSelection ( GtkWidget *  w,
GtkClipboard *  clipboard 
)
Parameters
wthe active document widget.
clipboarda GtkClipboard.

Called by the framework to paste clipboard contents.

void gcp::View::OnReceive ( GtkClipboard *  clipboard,
GtkSelectionData *  selection_data 
)
Parameters
clipboardthe clipboard used.
selection_datathe data to paste.

Called by the framework to effectively paste data in the document.

void gcp::View::OnSelectAll ( )

Called by the framework to select everything in the document.

bool gcp::View::PrepareUnselect ( )

Called by the framework when the active window changes to stop current edition and inhibit timer events.

Returns
true if the change is possible, false to abort it.
void gcp::View::Remove ( gcu::Object pObject)
Parameters
pObjectthe object to remove.

Removes the object from the view and destroys the items representing it.

void gcp::View::Render ( cairo_t *  cr)
Parameters
crthe cairo_t to which render.

Renders the document using cairo.

void gcp::View::SetSelectionState ( gcu::Object object,
int  state 
)
Parameters
objectthe object which seection state should be changed.
statethe new selection state.

Changes the selection state of object if it owns an item and of all its descendents.

void gcp::View::SetTextActive ( gccv::Text item)
Parameters
itema text item or NULL.

Sets the currently edited text item. item should be NULL to tell the view that no text edition is currently taking place.

void gcp::View::ShowCursor ( bool  show)
Parameters
showwhether to show the cursor or not.

Shows or hides the cursor in the currently edited text item if any.

void gcp::View::Update ( gcu::Object pObject)
Parameters
pObjectthe object to update.

Updates the object in the canvas.

void gcp::View::UpdateFont ( )

Updates fonts descriptions after a theme change.

void gcp::View::UpdateTheme ( )

Called by the framework to update the default font size after a theme change.

void gcp::View::Zoom ( double  zoom)
Parameters
zoomthe new zoom level.

Sets the zoom level.


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