<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>The Gnome Chemistry Utils: glview.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_3f1a4fbcec42af7c381c8030b930461d.html">libs</a> » <a class="el" href="dir_4dc46c636cfd3997b28f6cceab9d70bd.html">gcu</a> </div> </div> <div class="contents"> <h1>glview.h</h1><a href="glview_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- C++ -*-</span> <a name="l00002"></a>00002 <a name="l00003"></a>00003 <span class="comment">/* </span> <a name="l00004"></a>00004 <span class="comment"> * Gnome Chemistry Utils</span> <a name="l00005"></a>00005 <span class="comment"> * gcu/glview.h </span> <a name="l00006"></a>00006 <span class="comment"> *</span> <a name="l00007"></a>00007 <span class="comment"> * Copyright (C) 2006-2008 Jean Bréfort <jean.brefort@normalesup.org></span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * This program is free software; you can redistribute it and/or </span> <a name="l00010"></a>00010 <span class="comment"> * modify it under the terms of the GNU General Public License as </span> <a name="l00011"></a>00011 <span class="comment"> * published by the Free Software Foundation; either version 2 of the</span> <a name="l00012"></a>00012 <span class="comment"> * License, or (at your option) any later version.</span> <a name="l00013"></a>00013 <span class="comment"> *</span> <a name="l00014"></a>00014 <span class="comment"> * This program is distributed in the hope that it will be useful,</span> <a name="l00015"></a>00015 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00016"></a>00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00017"></a>00017 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00018"></a>00018 <span class="comment"> *</span> <a name="l00019"></a>00019 <span class="comment"> * You should have received a copy of the GNU General Public License</span> <a name="l00020"></a>00020 <span class="comment"> * along with this program; if not, write to the Free Software</span> <a name="l00021"></a>00021 <span class="comment"> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301</span> <a name="l00022"></a>00022 <span class="comment"> * USA</span> <a name="l00023"></a>00023 <span class="comment"> */</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#ifndef GCU_GL_VIEW_H</span> <a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define GCU_GL_VIEW_H</span> <a name="l00027"></a>00027 <span class="preprocessor"></span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="macros_8h.html">macros.h</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="matrix_8h.html">matrix.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="printable_8h.html">printable.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#ifdef HAVE_GO_CONF_SYNC</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor"># ifdef GOFFICE_HAS_GLOBAL_HEADER</span> <a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor"># include <goffice/goffice.h></span> <a name="l00034"></a>00034 <span class="preprocessor"># else</span> <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor"># include <goffice/app/go-conf.h></span> <a name="l00036"></a>00036 <span class="preprocessor"># endif</span> <a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#else</span> <a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor"># include <gconf/gconf-client.h></span> <a name="l00039"></a>00039 <span class="preprocessor">#endif</span> <a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#include <gtk/gtkwidget.h></span> <a name="l00041"></a>00041 <span class="preprocessor">#include <map></span> <a name="l00042"></a>00042 <span class="preprocessor">#include <string></span> <a name="l00043"></a>00043 <span class="preprocessor">#include <stdexcept></span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="keyword">extern</span> <span class="keywordtype">double</span> DefaultPsi, DefaultTheta, DefaultPhi; <a name="l00046"></a>00046 <a name="l00048"></a>00048 <span class="keyword">namespace </span>gcu { <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="keyword">class </span>GLDocument; <a name="l00051"></a>00051 <a name="l00057"></a><a class="code" href="classgcu_1_1GLView.html">00057</a> <span class="keyword">class </span><a class="code" href="classgcu_1_1GLView.html">GLView</a>: <span class="keyword">public</span> <a class="code" href="classgcu_1_1Printable.html">Printable</a> <a name="l00058"></a>00058 { <a name="l00059"></a>00059 <span class="keyword">public</span>: <a name="l00061"></a>00061 <a name="l00066"></a>00066 <a class="code" href="classgcu_1_1GLView.html#a12773d88a79619d6e70159d3ede8215d" title="Constructor.">GLView</a> (<a class="code" href="classgcu_1_1GLDocument.html">GLDocument</a>* pDoc) <span class="keywordflow">throw</span> (std::runtime_error); <a name="l00068"></a>00068 <a name="l00071"></a>00071 <span class="keyword">virtual</span> <a class="code" href="classgcu_1_1GLView.html#a3f3491edcef778660323ee26e83e924b" title="Destructor.">~GLView</a> (); <a name="l00072"></a>00072 <a name="l00076"></a><a class="code" href="classgcu_1_1GLView.html#a7acc40e4f6f0b70576db32f9e7ef5255">00076</a> GtkWidget *<a class="code" href="classgcu_1_1GLView.html#a7acc40e4f6f0b70576db32f9e7ef5255">GetWidget</a> () {<span class="keywordflow">return</span> <a class="code" href="classgcu_1_1GLView.html#a47d9d0e364139f5315ca30115e7db961">m_pWidget</a>;} <a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a7ba0f069c9b4f0d382707f0fdd5ccc62">Init</a> (); <a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a5aa541f4f2b17872b0ea72afc625b337">Reshape</a> (); <a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a0ff0fe26dbf553f3522ca07f6bc239ea">Draw</a> (); <a name="l00095"></a>00095 <span class="keywordtype">bool</span> <a class="code" href="classgcu_1_1GLView.html#a6c4ebe056f7ccfb385ce321fb7f3021e">OnPressed</a> (GdkEventButton *event); <a name="l00104"></a>00104 <span class="keywordtype">bool</span> <a class="code" href="classgcu_1_1GLView.html#a4fbe86f687c69307d002db75f1e8d63e">OnMotion</a> (GdkEventMotion *event); <a name="l00109"></a>00109 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a72670ec6651e59723ece3cb6762f1acb">Update</a> (); <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a74a290d10b91dc4cb411715abc61eec8">SetRotation</a> (<span class="keywordtype">double</span> psi, <span class="keywordtype">double</span> theta, <span class="keywordtype">double</span> phi); <a name="l00128"></a>00128 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a241ed8f364c7a5b7cc175d64dce7b208">SaveAsImage</a> (std::string <span class="keyword">const</span> &filename, <span class="keywordtype">char</span> <span class="keyword">const</span> *type, std::map<std::string, std::string>& options, <span class="keywordtype">unsigned</span> width, <span class="keywordtype">unsigned</span> height) <span class="keyword">const</span>; <a name="l00137"></a>00137 GdkPixbuf *<a class="code" href="classgcu_1_1GLView.html#ae77e5b48ebbbabe9dd64c2d3a3f666bd">BuildPixbuf</a> (<span class="keywordtype">unsigned</span> width, <span class="keywordtype">unsigned</span> height) <span class="keyword">const</span>; <a name="l00144"></a>00144 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#a52259a455ccf8aef6dbf9dfd9f636912">DoPrint</a> (GtkPrintOperation *print, GtkPrintContext *context) <span class="keyword">const</span>; <a name="l00148"></a><a class="code" href="classgcu_1_1GLView.html#a7c489c47badd3ad28f1243774f7d507a">00148</a> GtkWindow *<a class="code" href="classgcu_1_1GLView.html#a7c489c47badd3ad28f1243774f7d507a">GetGtkWindow</a> () {<span class="keywordflow">return</span> GTK_WINDOW (gtk_widget_get_toplevel (<a class="code" href="classgcu_1_1GLView.html#a47d9d0e364139f5315ca30115e7db961">m_pWidget</a>));} <a name="l00156"></a>00156 <span class="keywordtype">void</span> <a class="code" href="classgcu_1_1GLView.html#ac620d8acb5b734652615a0c304224528">RenderToCairo</a> (cairo_t *cr, <span class="keywordtype">unsigned</span> width, <span class="keywordtype">unsigned</span> height) <span class="keyword">const</span>; <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keyword">private</span>: <a name="l00165"></a>00165 <span class="keywordtype">void</span> Rotate (gdouble x, gdouble y); <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="keyword">protected</span>: <a name="l00171"></a><a class="code" href="classgcu_1_1GLView.html#a47d9d0e364139f5315ca30115e7db961">00171</a> GtkWidget *<a class="code" href="classgcu_1_1GLView.html#a47d9d0e364139f5315ca30115e7db961">m_pWidget</a>; <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="keyword">private</span>: <a name="l00174"></a>00174 <span class="keywordtype">bool</span> m_bInit; <a name="l00175"></a>00175 <a class="code" href="classgcu_1_1Matrix.html">Matrix</a> m_Euler; <a name="l00176"></a>00176 <span class="keywordtype">double</span> m_Height, m_Width, m_Near, m_Far; <a name="l00177"></a>00177 <span class="keywordtype">double</span> m_Lastx, m_Lasty; <a name="l00178"></a>00178 <span class="preprocessor">#ifdef HAVE_GO_CONF_SYNC</span> <a name="l00179"></a>00179 <span class="preprocessor"></span> <span class="keyword">static</span> GOConfNode *m_ConfNode; <a name="l00180"></a>00180 <span class="preprocessor">#else</span> <a name="l00181"></a>00181 <span class="preprocessor"></span> <span class="keyword">static</span> GConfClient *m_ConfClient; <a name="l00182"></a>00182 <span class="preprocessor">#endif</span> <a name="l00183"></a>00183 <span class="preprocessor"></span> <span class="keyword">static</span> guint m_NotificationId; <a name="l00184"></a>00184 <span class="keyword">static</span> <span class="keywordtype">int</span> nbViews; <a name="l00185"></a>00185 <a name="l00186"></a>00186 <span class="comment">// Properties</span> <a name="l00196"></a>00196 <span class="comment"></span><a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">double</span>, Angle) <a name="l00206"></a>00206 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">double</span>, Psi) <a name="l00216"></a>00216 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">double</span>, Phi) <a name="l00226"></a>00226 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">double</span>, Theta) <a name="l00236"></a>00236 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">float</span>, Red) <a name="l00246"></a>00246 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">float</span>, Green) <a name="l00256"></a>00256 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">float</span>, Blue) <a name="l00273"></a>00273 <a class="code" href="macros_8h.html#a2e6e8322502a538f4583d41206cea297">GCU_PROP</a> (<span class="keywordtype">float</span>, Alpha) <a name="l00277"></a>00277 <a class="code" href="macros_8h.html#ad52419f8ee19ed3a6e49ca7db37e6a47">GCU_PROT_POINTER_PROP</a> (<a class="code" href="classgcu_1_1GLDocument.html">GLDocument</a>, Doc) <a name="l00284"></a>00284 <a class="code" href="macros_8h.html#ac63298328b07e40af4fe4a5e8d1b8b7c">GCU_PROT_PROP</a> (<span class="keywordtype">double</span>, Radius); <a name="l00285"></a>00285 }; <a name="l00286"></a>00286 <a name="l00287"></a>00287 } <span class="comment">// namespace gcu</span> <a name="l00288"></a>00288 <a name="l00289"></a>00289 <span class="preprocessor">#endif // GCU_GL_VIEW_H</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Sep 6 18:33:53 2009 for The Gnome Chemistry Utils by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>