# gcu::GLView Class Reference

`#include <gcu/glview.h>`

Inheritance diagram for gcu::GLView:

List of all members.

## Public Member Functions

| GLView (GLDocument *pDoc)
| 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 | Print (GnomePrintContext *pc, gdouble width, gdouble height)
void | SaveAsImage (string const &filename, char const *type, map< string, string > &options, unsigned width, unsigned height)
void | SetAngle (double val)
double | GetAngle (void)
double & | GetRefAngle (void)
void | SetPsi (double val)
double | GetPsi (void)
double & | GetRefPsi (void)
void | SetPhi (double val)
double | GetPhi (void)
double & | GetRefPhi (void)
void | SetTheta (double val)
double | GetTheta (void)
double & | GetRefTheta (void)
void | SetRed (float val)
float | GetRed (void)
float & | GetRefRed (void)
void | SetGreen (float val)
float | GetGreen (void)
float & | GetRefGreen (void)
void | SetBlue (float val)
float | GetBlue (void)
float & | GetRefBlue (void)
void | SetAlpha (float val)
float | GetAlpha (void)
float & | GetRefAlpha (void)
GLDocument * | GetDoc (void)
double | GetRadius (void)

## Protected Attributes

GtkWidget * | m_pWidget
unsigned | m_nGLList
double | m_Radius

## Detailed Description

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

Definition at line 48 of file glview.h.

## Constructor & Destructor Documentation

gcu::GLView::GLView | ( | GLDocument * | pDoc | ) |

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

GtkWidget* gcu::GLView::GetWidget | ( |  | ) | `[inline]`

Returns:
  the associated GtkWidget.

Definition at line 67 of file glview.h.

References m_pWidget.

void gcu::GLView::Init | ( |  | ) |

Initialize the associated widget. Automatically called by the framework.

void gcu::GLView::Reshape | ( |  | ) |

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

void gcu::GLView::Draw | ( |  | ) |

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

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.

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.

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.

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::Print | ( | GnomePrintContext * | pc,
|  | gdouble | width,
|  | gdouble | height |
| ) |  |  |

Parameters:

  | pc | the GnomePrintContext used for printing.
  | width | the width of the printed view.
  | height | th height of the printed view.

Prints the current view to a printing context inside a rectangle with predefined size.

void gcu::GLView::SaveAsImage | ( | string const & | filename,
|  | char const * | type,
|  | map< string, string > & | options,
|  | unsigned | width,
|  | unsigned | height |
| ) |  |  |

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 enerated image.

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

gcu::GLView::SetAngle | ( | double | angle | ) | `[inline]`

Parameters:

  | angle | the new half field of view.

Definition at line 174 of file glview.h.

gcu::GLView::GetAngle | ( | void |  | ) | `[inline]`

Returns:
  the current half field of view.

Definition at line 174 of file glview.h.

gcu::GLView::GetRefAngle | ( | void |  | ) | `[inline]`

Returns:
  the current half field of view as a reference.

Definition at line 174 of file glview.h.

gcu::GLView::SetPsi | ( | double | psi | ) | `[inline]`

Parameters:

  | psi | the new psi Euler's angle.

Definition at line 184 of file glview.h.

gcu::GLView::GetPsi | ( | void |  | ) | `[inline]`

Returns:
  the current psi Euler's angle.

Definition at line 184 of file glview.h.

gcu::GLView::GetRefPsi | ( | void |  | ) | `[inline]`

Returns:
  the current psi Euler's angle as a reference.

Definition at line 184 of file glview.h.

gcu::GLView::SetPhi | ( | double | phi | ) | `[inline]`

Parameters:

  | phi | the new phi Euler's angle.

Definition at line 194 of file glview.h.

gcu::GLView::GetPhi | ( | void |  | ) | `[inline]`

Returns:
  the current phi Euler's angle.

Definition at line 194 of file glview.h.

gcu::GLView::GetRefPhi | ( | void |  | ) | `[inline]`

Returns:
  the current psh Euler's angle as a reference.

Definition at line 194 of file glview.h.

gcu::GLView::SetTheta | ( | double | theta | ) | `[inline]`

Parameters:

  | theta | the new theta Euler's angle.

Definition at line 204 of file glview.h.

gcu::GLView::GetTheta | ( | void |  | ) | `[inline]`

Returns:
  the current theta Euler's angle.

Definition at line 204 of file glview.h.

gcu::GLView::GetRefTheta | ( | void |  | ) | `[inline]`

Returns:
  the current theta Euler's angle as a reference.

Definition at line 204 of file glview.h.

gcu::GLView::SetRed | ( | float | red | ) | `[inline]`

Parameters:

  | red | the new red component for the background color.

Definition at line 214 of file glview.h.

gcu::GLView::GetRed | ( | void |  | ) | `[inline]`

Returns:
  the current red component of the background color.

Definition at line 214 of file glview.h.

gcu::GLView::GetRefRed | ( | void |  | ) | `[inline]`

Returns:
  the current red component of the background color as a reference.

Definition at line 214 of file glview.h.

gcu::GLView::SetGreen | ( | float | green | ) | `[inline]`

Parameters:

  | green | the new green component for the background color.

Definition at line 224 of file glview.h.

gcu::GLView::GetGreen | ( | void |  | ) | `[inline]`

Returns:
  the current green component of the background color.

Definition at line 224 of file glview.h.

gcu::GLView::GetRefGreen | ( | void |  | ) | `[inline]`

Returns:
  the current green component of the background color as a reference.

Definition at line 224 of file glview.h.

gcu::GLView::SetBlue | ( | float | blue | ) | `[inline]`

Parameters:

  | blue | the new blue component for the background color.

Definition at line 234 of file glview.h.

gcu::GLView::GetBlue | ( | void |  | ) | `[inline]`

Returns:
  the current blue component of the background color.

Definition at line 234 of file glview.h.

gcu::GLView::GetRefBlue | ( | void |  | ) | `[inline]`

Returns:
  the current blue component of the background color as a reference.

Definition at line 234 of file glview.h.

gcu::GLView::SetAlpha | ( | float | alpha | ) | `[inline]`

Parameters:

  | alpha | the new alpha value for the background.

The alpha value for the background is not supported in this version and this is only a place holder.

Definition at line 251 of file glview.h.

gcu::GLView::GetAlpha | ( | void |  | ) | `[inline]`

The alpha value for the background is not supported in this version and this is only a place holder.

Returns:
  the current alpha value of the background color.

Definition at line 251 of file glview.h.

gcu::GLView::GetRefAlpha | ( | void |  | ) | `[inline]`

The alpha value for the background is not supported in this version and this is only a place holder.

Returns:
  the current alpha value of the background color as a reference.

Definition at line 251 of file glview.h.

gcu::GLView::GetDoc | ( | void |  | ) | `[inline]`

Returns:
  the associated document.

Definition at line 255 of file glview.h.

gcu::GLView::GetRadius | ( | void |  | ) | `[inline]`

Returns:
  the distance between the center of the model and the point of view.

Definition at line 262 of file glview.h.

## Member Data Documentation

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

The associated widget.

Definition at line 152 of file glview.h.

Referenced by GetWidget().

unsigned gcu::GLView::m_nGLList`[protected]`

The current GLList.

Definition at line 156 of file glview.h.

gcu::GLView::m_Radius`[protected]`

The distance between the center of the model and the point of view.

Definition at line 262 of file glview.h.

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

- glview.h