gcu::GLView Class Reference

#include <gcu/glview.h>

Inheritance diagram for gcu::GLView:
gcu::Printable gcu::DialogOwner gcu::CrystalView

List of all members.

Public Member Functions

 GLView (GLDocument *pDoc) throw (std::runtime_error)
 Constructor.
virtual ~GLView ()
 Destructor.
GtkWidget * GetWidget ()
void Init ()
void Reshape ()
void Draw ()
bool OnPressed (GdkEventButton *event)
bool OnMotion (GdkEventMotion *event)
void Update ()
void SetRotation (double psi, double theta, double phi)
void SaveAsImage (std::string const &filename, char const *type, std::map< std::string, std::string > &options, unsigned width, unsigned height) const
GdkPixbuf * BuildPixbuf (unsigned width, unsigned height) const
void DoPrint (GtkPrintOperation *print, GtkPrintContext *context) const
GtkWindow * GetGtkWindow ()
void RenderToCairo (cairo_t *cr, unsigned width, unsigned height) const

Protected Attributes

GtkWidget * m_pWidget

Detailed Description

View class based on OpenGL for rendering. Used to display 3d chemical structures such as molecules or crystals cells.

Definition at line 57 of file glview.h.


Constructor & Destructor Documentation

gcu::GLView::GLView ( GLDocument pDoc  )  throw (std::runtime_error)

Constructor.

Parameters:
pDoc,: a pointer to the GLDocument instance.

Creates a view for the document.

virtual gcu::GLView::~GLView (  )  [virtual]

Destructor.

The destructor of GLView.


Member Function Documentation

GdkPixbuf* gcu::GLView::BuildPixbuf ( unsigned  width,
unsigned  height 
) const
Parameters:
width the width of the generated image.
height the height of the generated image.

Generates a pixbuf from the current view.

Returns:
the pixbuf containing the generated image
void gcu::GLView::DoPrint ( GtkPrintOperation *  print,
GtkPrintContext *  context 
) const [virtual]
Parameters:
print a GtkPrintOperation.
context a GtkPrintContext.

Prints the current view at 300 dpi.

Implements gcu::Printable.

void gcu::GLView::Draw (  ) 

Draws the contents of the associated widget. Automatically called by the framework.

GtkWindow* gcu::GLView::GetGtkWindow (  )  [inline, virtual]
Returns:
the top level GtkWindow containing the view.

Implements gcu::Printable.

Definition at line 148 of file glview.h.

References m_pWidget.

GtkWidget* gcu::GLView::GetWidget (  )  [inline]
Returns:
the associated GtkWidget.

Definition at line 76 of file glview.h.

References m_pWidget.

void gcu::GLView::Init (  ) 

Initialize the associated widget. Automatically called by the framework.

bool gcu::GLView::OnMotion ( GdkEventMotion *  event  ) 
Parameters:
event,: a pointer to a GdkEvent.

Automatically called by the framework when the mouse cursor moves over the associated widget drawing area.

Returns:
true if a motion really occured, false otherwise.
bool gcu::GLView::OnPressed ( GdkEventButton *  event  ) 
Parameters:
event,: a pointer to a GdkEvent.

Automatically called by the framework when a left button click occurs in the associated widget drawing area.

void gcu::GLView::RenderToCairo ( cairo_t *  cr,
unsigned  width,
unsigned  height 
) const
Parameters:
cr a cairo_t.
width the width used for rendering.
height the height used for rendering.

Outputs a bitmap to cairo. Used internally for printing and various image formats exports.

void gcu::GLView::Reshape (  ) 

Automatically called by the framework when the associated widget size changes.

void gcu::GLView::SaveAsImage ( std::string const &  filename,
char const *  type,
std::map< std::string, std::string > &  options,
unsigned  width,
unsigned  height 
) const
Parameters:
filename the name of the file.
type the type as supported by GdkPixbuf (e.g. "png" or "jpeg").
options the pairs of keys/values to pass GdkPixbuf.
width the width of the generated image.
height the height of the generated image.

Export the view contents as an image. The size of the new image is defined by the width and height parameters.

void gcu::GLView::SetRotation ( double  psi,
double  theta,
double  phi 
)
Parameters:
psi the first Euler's angle.
theta the second Euler's angle.
phi the third Euler's angle.

Sets the orientation of the model, using the Euler's angles.

void gcu::GLView::Update (  ) 

Update the contents of the associated widget. This method must be called each time the document or the view are modified.


Member Data Documentation

GtkWidget* gcu::GLView::m_pWidget [protected]

The associated widget.

Definition at line 171 of file glview.h.

Referenced by GetGtkWindow(), and GetWidget().


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

Generated on Wed Feb 3 12:55:27 2010 for The Gnome Chemistry Utils by  doxygen 1.6.1