SoFCInteractiveElement.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2006 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00026 #include "SoFCInteractiveElement.h"
00027 
00028 using namespace Gui;
00029 
00030 SO_ELEMENT_SOURCE(SoFCInteractiveElement);
00031 
00032 void SoFCInteractiveElement::initClass(void)
00033 {
00034   SO_ELEMENT_INIT_CLASS(SoFCInteractiveElement, inherited);
00035   SO_ENABLE(SoGLRenderAction, SoFCInteractiveElement);
00036 }
00037 
00038 void SoFCInteractiveElement::init(SoState * state)
00039 {
00040   this->interactiveMode = false;
00041 }
00042 
00043 SoFCInteractiveElement::~SoFCInteractiveElement()
00044 {
00045 }
00046 
00047 void SoFCInteractiveElement::set(SoState * const state, SoNode * const node, SbBool mode)
00048 {
00049   SoFCInteractiveElement * elem = (SoFCInteractiveElement *)
00050     SoReplacedElement::getElement(state, classStackIndex, node);
00051   elem->setElt(mode);
00052 }
00053 
00054 SbBool SoFCInteractiveElement::get(SoState * const state)
00055 {
00056   return SoFCInteractiveElement::getInstance(state)->interactiveMode;
00057 }
00058 
00059 void SoFCInteractiveElement::setElt(SbBool mode)
00060 {
00061   this->interactiveMode = mode;
00062 }
00063 
00064 const SoFCInteractiveElement * SoFCInteractiveElement::getInstance(SoState * state)
00065 {
00066   return (const SoFCInteractiveElement *) SoElement::getConstElement(state, classStackIndex);
00067 }
00068 
00069 // ---------------------------------
00070 
00071 SO_ELEMENT_SOURCE(SoGLWidgetElement);
00072 
00073 void SoGLWidgetElement::initClass(void)
00074 {
00075   SO_ELEMENT_INIT_CLASS(SoGLWidgetElement, inherited);
00076   SO_ENABLE(SoGLRenderAction, SoGLWidgetElement);
00077   SO_ENABLE(SoHandleEventAction, SoGLWidgetElement);
00078 }
00079 
00080 void SoGLWidgetElement::init(SoState * state)
00081 {
00082   inherited::init(state);
00083   this->window = 0;
00084 }
00085 
00086 SoGLWidgetElement::~SoGLWidgetElement()
00087 {
00088 }
00089 
00090 void SoGLWidgetElement::set(SoState * state, QGLWidget * window)
00091 {
00092   SoGLWidgetElement * elem = static_cast<SoGLWidgetElement *>
00093         (SoElement::getElement(state, classStackIndex));
00094   elem->window = window;
00095 }
00096 
00097 void SoGLWidgetElement::get(SoState * state, QGLWidget *& window)
00098 {
00099     const SoGLWidgetElement* that =  static_cast<const SoGLWidgetElement *>
00100         (SoElement::getConstElement(state, classStackIndex));
00101     window = that->window;
00102 }
00103 
00104 void SoGLWidgetElement::push(SoState * state)
00105 {
00106     inherited::push(state);
00107 }
00108 
00109 void SoGLWidgetElement::pop(SoState * state, const SoElement * prevTopElement)
00110 {
00111     inherited::pop(state, prevTopElement);
00112 }
00113 
00114 SbBool SoGLWidgetElement::matches(const SoElement * element) const
00115 {
00116     return TRUE;
00117 }
00118 
00119 SoElement * SoGLWidgetElement::copyMatchInfo(void) const
00120 {
00121     return 0;
00122 }
00123 
00124 // ---------------------------------
00125 
00126 SO_ELEMENT_SOURCE(SoGLRenderActionElement);
00127 
00128 void SoGLRenderActionElement::initClass(void)
00129 {
00130   SO_ELEMENT_INIT_CLASS(SoGLRenderActionElement, inherited);
00131   SO_ENABLE(SoGLRenderAction, SoGLRenderActionElement);
00132   SO_ENABLE(SoHandleEventAction, SoGLRenderActionElement);
00133 }
00134 
00135 void SoGLRenderActionElement::init(SoState * state)
00136 {
00137   inherited::init(state);
00138   this->glRenderAction = 0;
00139 }
00140 
00141 SoGLRenderActionElement::~SoGLRenderActionElement()
00142 {
00143 }
00144 
00145 void SoGLRenderActionElement::set(SoState * state, SoGLRenderAction * action)
00146 {
00147   SoGLRenderActionElement * elem = static_cast<SoGLRenderActionElement *>
00148         (SoElement::getElement(state, classStackIndex));
00149   elem->glRenderAction = action;
00150 }
00151 
00152 void SoGLRenderActionElement::get(SoState * state, SoGLRenderAction * & action)
00153 {
00154     const SoGLRenderActionElement* that =  static_cast<const SoGLRenderActionElement *>
00155         (SoElement::getConstElement(state, classStackIndex));
00156     action = that->glRenderAction;
00157 }
00158 
00159 void SoGLRenderActionElement::push(SoState * state)
00160 {
00161     inherited::push(state);
00162 }
00163 
00164 void SoGLRenderActionElement::pop(SoState * state, const SoElement * prevTopElement)
00165 {
00166     inherited::pop(state, prevTopElement);
00167 }
00168 
00169 SbBool SoGLRenderActionElement::matches(const SoElement * element) const
00170 {
00171     return TRUE;
00172 }
00173 
00174 SoElement * SoGLRenderActionElement::copyMatchInfo(void) const
00175 {
00176     return 0;
00177 }
00178 
00179 // ---------------------------------
00180 
00181 SO_NODE_SOURCE(SoGLWidgetNode);
00182 
00186 SoGLWidgetNode::SoGLWidgetNode(void) : window(0)
00187 {
00188     SO_NODE_CONSTRUCTOR(SoGLWidgetNode);
00189 }
00190 
00194 SoGLWidgetNode::~SoGLWidgetNode()
00195 {
00196 }
00197 
00198 // Doc from superclass.
00199 void SoGLWidgetNode::initClass(void)
00200 {
00201     SO_NODE_INIT_CLASS(SoGLWidgetNode, SoNode, "Node");
00202 
00203     SO_ENABLE(SoGLRenderAction, SoGLWidgetElement);
00204 }
00205 
00206 // Doc from superclass.
00207 void SoGLWidgetNode::doAction(SoAction * action)
00208 {
00209     SoGLWidgetElement::set(action->getState(), this->window);
00210 }
00211 
00212 // Doc from superclass.
00213 void SoGLWidgetNode::GLRender(SoGLRenderAction * action)
00214 {
00215     SoGLWidgetNode::doAction(action);
00216 }

Generated on Wed Nov 23 19:00:39 2011 for FreeCAD by  doxygen 1.6.1