Privacy
An open-source, flexible 3D physical simulation framework
mars::graphics::QtOsgMixGraphicsWidget Class Reference

A GraphicsWidget using QWidget. More...

#include <QtOsgMixGraphicsWidget.h>

Public Member Functions

 QtOsgMixGraphicsWidget (void *parent, osg::Group *scene, unsigned long id, bool rtt_widget=0, Qt::WindowFlags f=0, GraphicsManager *gm=0)
 
QPaintEngine * paintEngine () const
 
virtual void initialize ()
 
virtual osg::ref_ptr< osg::GraphicsContext > createWidgetContext (void *parent, osg::ref_ptr< osg::GraphicsContext::Traits > traits)
 
virtual void setWGeometry (int top, int left, int width, int height)
 
virtual void getWGeometry (int *top, int *left, int *width, int *height) const
 
virtual void setWidgetFullscreen (bool val)
 
virtual void * getWidget ()
 
virtual void showWidget ()
 
virtual void updateView ()
 
virtual void hideEvent (QHideEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
virtual void showEvent (QShowEvent *event)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual bool eventFilter (QObject *obj, QEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
- Public Member Functions inherited from mars::graphics::GraphicsWidget
 GraphicsWidget (void *parent, osg::Group *scene, unsigned long id, bool hasRTTWidget=0, int f=0, GraphicsManager *gm=0)
 
 ~GraphicsWidget ()
 
void initializeOSG (void *data=0, GraphicsWidget *shared=0, int width=0, int height=0)
 
unsigned long getID (void)
 
mars::utils::Vector getMousePos ()
 returns actual mouse position More...
 
void setFullscreen (bool val, int display=1)
 
osgViewer::View * getView (void)
 
interfaces::GraphicsCameraInterfacegetCameraInterface (void) const
 
osg::ref_ptr< osg::Camera > getMainCamera ()
 
osgViewer::GraphicsWindow * getGraphicsWindow ()
 
const osgViewer::GraphicsWindow * getGraphicsWindow () const
 
osg::Texture2D * getRTTTexture (void)
 
osg::Texture2D * getRTTDepthTexture (void)
 
osg::Image * getRTTImage (void)
 
osg::Image * getRTTDepthImage (void)
 
std::vector< osg::Node * > getPickedObjects ()
 
void clearSelectionVectors (void)
 
void setGraphicsEventHandler (interfaces::GraphicsEventInterface *graphicsEventHandler)
 
void addGraphicsEventHandler (interfaces::GraphicsEventInterface *graphicsEventHandler)
 
virtual osgWidget::WindowManager * getOrCreateWindowManager ()
 if you want to create your own gui without this interface, feel free to do so More...
 
void setHUD (HUD *theHUD)
 
void addHUDElement (HUDElement *elem)
 
void removeHUDElement (HUDElement *elem)
 
void switchHudElemtVis (int num_element)
 
void setClearColor (mars::utils::Color color)
 sets the clear color More...
 
const mars::utils::ColorgetClearColor () const
 
void setGrabFrames (bool grab)
 
void setSaveFrames (bool grab)
 
virtual int createBox (const std::string &name, int type=0)
 Creates an osgWidget::Box. More...
 
virtual int createCanvas (const std::string &name)
 Creates an osgWidget::Canvas. More...
 
virtual int createFrame (const std::string &name, float x1, float y1, float x2, float y2)
 creates a Frame that basically holds on window. More...
 
virtual bool showWindow (int wndId)
 add the window with the id to the windowmanager More...
 
virtual bool hideWindow (int wndId)
 removes the window from the windowmanager More...
 
virtual bool deleteWindow (int wndId)
 deletes your window and all containing widgets More...
 
virtual bool deleteWidget (int wdgId)
 deletes one widget and his callbacks More...
 
virtual void setName (const std::string &name)
 
virtual const std::string getName () const
 
virtual bool windowSetPosition (int wndId, float x, float y)
 sets the position of a window on the screen More...
 
virtual int createWidget (const std::string &name, float sizex, float sizey)
 creates a basic widget, within the size you want it to be More...
 
virtual bool setColor (int id, float r, float g, float b, float a)
 sets the color of a widget or a window More...
 
virtual bool addWidgetToWindow (int window, int widget)
 adds window to a widget. More...
 
virtual bool addWidgetToWindow (int window, int widget, float x, float y)
 
virtual bool addWidgetToWindow (int window, int widget, int x, int y)
 
virtual int createLabel (const std::string &name, const std::string &text)
 creates a label,a widget with text in it. More...
 
virtual int createInput (const std::string &name, const std::string &text, int count)
 nearly like label, but you are able to input thinks into it More...
 
virtual bool setLabel (int id, const std::string &text)
 sets the text of a lable More...
 
virtual bool setFont (int id, const std::string &fontname)
 should be clear what does this mean. More...
 
virtual bool setFontColor (int id, float r, float g, float b, float a)
 
virtual bool setFontSize (int id, int size)
 
virtual bool createStyle (const std::string &name, const std::string &style)
 creates style, that you can apply to a widget or window, in order to set a lot of attributes, that are maybe not supported in this api More...
 
virtual bool setStyle (int id, const std::string &styleName)
 sets a style to a window or widget, that you created before with createStyle More...
 
virtual bool setSize (int id, float x, float y)
 sets the size of a widget More...
 
virtual bool addMousePushEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 used to add callback to a a widget. More...
 
virtual bool addMouseReleaseEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
virtual bool addMouseEnterEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
virtual bool addMouseLeaveEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
bool addEventToWidget (int id, guiClickCallBack function, guiClickCallBackBind *bindptr, osgWidget::EventType type)
 
virtual bool setImage (int id, const std::string &path)
 sets the image of a widget More...
 
virtual int createTable (const std::string &name, int row, int colums)
 An osgWidget::Table provides a basic grid layout. More...
 
virtual bool setLayer (int id, int layer, int offset=0)
 sets the layer of a widget, please use the Layer enum for this More...
 
virtual bool getLayer (int id, int &layer)
 returns you the current layer More...
 
virtual bool setAlignHorizontal (int id, int h)
 sets the alignment for a widget, use the enums for this More...
 
virtual bool setAlignVertical (int id, int v)
 
virtual bool getAlignHorizontal (int id, int &h)
 
virtual bool getAlignVertical (int id, int &v)
 
virtual bool setAnchorVertical (int id, int va)
 like alignment but for windows, use also the same enums for this More...
 
virtual bool setAnchorHorizontal (int id, int ha)
 
virtual bool setCanFill (int id, bool state)
 
virtual bool setShadow (int id, float intensity)
 
virtual bool addSize (int id, float x, float y)
 add bogus size to your widget More...
 
virtual bool addColor (int id, float r, float g, float b, float a)
 add color to setColor. More...
 
virtual void getImageData (char *buffer, int &width, int &height)
 This function copies the image data in the given buffer. More...
 
virtual void getImageData (void **data, int &width, int &height)
 
virtual void getRTTDepthData (float *buffer, int &width, int &height)
 This function copies the depth image in the given buffer. More...
 
virtual void getRTTDepthData (float **data, int &width, int &height)
 
virtual osg::Group * getScene ()
 
virtual void setScene (osg::Group *s)
 
virtual void setHUDViewOffsets (double x1, double y1, double x2, double y2)
 
virtual void setupDistortion (double factor)
 
void grabFocus ()
 
void unsetFocus ()
 
- Public Member Functions inherited from mars::interfaces::GraphicsWindowInterface
virtual ~GraphicsWindowInterface ()
 
- Public Member Functions inherited from mars::interfaces::GraphicsGuiInterface
 GraphicsGuiInterface ()
 
virtual ~GraphicsGuiInterface ()
 

Static Public Member Functions

static QtOsgMixGraphicsWidgetcreateInstance (void *parent, osg::Group *scene, unsigned long id, bool rtt_widget=0, Qt::WindowFlags f=0, GraphicsManager *gm=0)
 

Protected Member Functions

virtual ~QtOsgMixGraphicsWidget ()
 
- Protected Member Functions inherited from mars::graphics::GraphicsWidget
bool manageClickEvent (osgWidget::Event &event)
 
osgWidget::Window * getWindowById (int wndId)
 
osgWidget::Widget * getWidgetById (int wdId)
 
int addOsgWidget (osgWidget::Widget *wid)
 
int addOsgWindow (osgWidget::Window *wnd)
 
void applyResize ()
 

Private Attributes

QWidget * childWidget
 
QObject * eventChild
 
double retinaScale
 

Static Private Attributes

static QtOsgMixGraphicsWidgetactiveWindow = NULL
 
static QtOsgMixGraphicsWidgeteventInWindow = NULL
 

Additional Inherited Members

- Public Types inherited from mars::interfaces::GraphicsGuiInterface
enum  Layer {
  LAYER_TOP = 100, LAYER_HIGH = 75, LAYER_MIDDLE = 50, LAYER_LOW = 25,
  LAYER_BG = 0
}
 use this to define the layer, if you set it More...
 
enum  VerticalAlignment { VA_CENTER, VA_TOP, VA_BOTTOM }
 used for setAlignVertical and and setAnchorVertical More...
 
enum  HorizontalAlignment { HA_CENTER, HA_LEFT, HA_RIGHT }
 use this for setAnchorHorizontal and setAlignHorizontal More...
 
typedef void(* guiClickCallBack) (double, double)
 callback declaration for simple callback More...
 
typedef std::tr1::function< void(double, double)> guiClickCallBackBind
 declaration for the binding for more sophisticated callback More...
 
- Protected Types inherited from mars::graphics::GraphicsWidget
typedef std::map< int, osg::ref_ptr< osgWidget::Window > > WindowIdMapType
 
typedef std::map< int, osg::ref_ptr< osgWidget::Widget > > WidgetIdMapType
 
typedef std::pair< guiClickCallBack, std::tr1::shared_ptr< guiClickCallBackBind > > WidgetCallBackPairType
 
typedef std::list< WidgetCallBackPairTypeWidgetCallBackList
 
typedef std::map< int, WidgetCallBackListWidgetCallBackMapType
 
- Protected Attributes inherited from mars::graphics::GraphicsWidget
int widgetWidth
 
int widgetHeight
 
int widgetX
 
int widgetY
 
std::string name
 
osgWidget::WindowManager * _osgWidgetWindowManager
 
WindowIdMapType _osgWindowIdMap
 
WidgetIdMapType _osgWidgetIdMap
 
WidgetCallBackMapType _widgetCallBackMap
 
unsigned int _osgWidgetWindowCnt
 
osg::ref_ptr< osgViewer::View > view
 
osg::Group * scene
 
bool isRTTWidget
 
osg::ref_ptr< osgViewer::GraphicsWindow > graphicsWindow
 
GraphicsCameragraphicsCamera
 
std::vector< interfaces::GraphicsEventInterface * > graphicsEventHandler
 
HUDmyHUD
 
osg::ref_ptr< osg::Camera > hudCamera
 
PostDrawCallbackpostDrawCallback
 
GraphicsManagergm
 
unsigned long widgetID
 
bool hasFocus
 

Detailed Description

A GraphicsWidget using QWidget.

Definition at line 43 of file QtOsgMixGraphicsWidget.h.

Constructor & Destructor Documentation

◆ QtOsgMixGraphicsWidget()

mars::graphics::QtOsgMixGraphicsWidget::QtOsgMixGraphicsWidget ( void *  parent,
osg::Group *  scene,
unsigned long  id,
bool  rtt_widget = 0,
Qt::WindowFlags  f = 0,
GraphicsManager gm = 0 
)
inline

Definition at line 47 of file QtOsgMixGraphicsWidget.h.

◆ ~QtOsgMixGraphicsWidget()

virtual mars::graphics::QtOsgMixGraphicsWidget::~QtOsgMixGraphicsWidget ( )
inlineprotectedvirtual

Definition at line 82 of file QtOsgMixGraphicsWidget.h.

Member Function Documentation

◆ closeEvent()

void mars::graphics::QtOsgMixGraphicsWidget::closeEvent ( QCloseEvent *  event)
virtual

Definition at line 174 of file QtOsgMixGraphicsWidget.cpp.

◆ createInstance()

QtOsgMixGraphicsWidget * mars::graphics::QtOsgMixGraphicsWidget::createInstance ( void *  parent,
osg::Group *  scene,
unsigned long  id,
bool  rtt_widget = 0,
Qt::WindowFlags  f = 0,
GraphicsManager gm = 0 
)
static

Definition at line 60 of file QtOsgMixGraphicsWidget.cpp.

◆ createWidgetContext()

osg::ref_ptr< osg::GraphicsContext > mars::graphics::QtOsgMixGraphicsWidget::createWidgetContext ( void *  parent,
osg::ref_ptr< osg::GraphicsContext::Traits >  traits 
)
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 71 of file QtOsgMixGraphicsWidget.cpp.

◆ eventFilter()

bool mars::graphics::QtOsgMixGraphicsWidget::eventFilter ( QObject *  obj,
QEvent *  event 
)
virtual

Definition at line 195 of file QtOsgMixGraphicsWidget.cpp.

◆ focusInEvent()

void mars::graphics::QtOsgMixGraphicsWidget::focusInEvent ( QFocusEvent *  event)
virtual

Definition at line 161 of file QtOsgMixGraphicsWidget.cpp.

◆ getWGeometry()

void mars::graphics::QtOsgMixGraphicsWidget::getWGeometry ( int *  top,
int *  left,
int *  width,
int *  height 
) const
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 132 of file QtOsgMixGraphicsWidget.cpp.

◆ getWidget()

void * mars::graphics::QtOsgMixGraphicsWidget::getWidget ( )
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 149 of file QtOsgMixGraphicsWidget.cpp.

◆ hideEvent()

void mars::graphics::QtOsgMixGraphicsWidget::hideEvent ( QHideEvent *  event)
virtual

Definition at line 165 of file QtOsgMixGraphicsWidget.cpp.

◆ initialize()

void mars::graphics::QtOsgMixGraphicsWidget::initialize ( )
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 68 of file QtOsgMixGraphicsWidget.cpp.

◆ mousePressEvent()

void mars::graphics::QtOsgMixGraphicsWidget::mousePressEvent ( QMouseEvent *  e)
virtual

Definition at line 183 of file QtOsgMixGraphicsWidget.cpp.

◆ paintEngine()

QPaintEngine* mars::graphics::QtOsgMixGraphicsWidget::paintEngine ( ) const
inline

Definition at line 53 of file QtOsgMixGraphicsWidget.h.

◆ setWGeometry()

void mars::graphics::QtOsgMixGraphicsWidget::setWGeometry ( int  top,
int  left,
int  width,
int  height 
)
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 119 of file QtOsgMixGraphicsWidget.cpp.

◆ setWidgetFullscreen()

void mars::graphics::QtOsgMixGraphicsWidget::setWidgetFullscreen ( bool  val)
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 139 of file QtOsgMixGraphicsWidget.cpp.

◆ showEvent()

void mars::graphics::QtOsgMixGraphicsWidget::showEvent ( QShowEvent *  event)
virtual

Definition at line 170 of file QtOsgMixGraphicsWidget.cpp.

◆ showWidget()

void mars::graphics::QtOsgMixGraphicsWidget::showWidget ( )
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 153 of file QtOsgMixGraphicsWidget.cpp.

◆ updateView()

void mars::graphics::QtOsgMixGraphicsWidget::updateView ( void  )
virtual

Reimplemented from mars::graphics::GraphicsWidget.

Definition at line 157 of file QtOsgMixGraphicsWidget.cpp.

Member Data Documentation

◆ activeWindow

QtOsgMixGraphicsWidget * mars::graphics::QtOsgMixGraphicsWidget::activeWindow = NULL
staticprivate

Definition at line 82 of file QtOsgMixGraphicsWidget.h.

◆ childWidget

QWidget* mars::graphics::QtOsgMixGraphicsWidget::childWidget
private

Definition at line 86 of file QtOsgMixGraphicsWidget.h.

◆ eventChild

QObject* mars::graphics::QtOsgMixGraphicsWidget::eventChild
private

Definition at line 87 of file QtOsgMixGraphicsWidget.h.

◆ eventInWindow

QtOsgMixGraphicsWidget * mars::graphics::QtOsgMixGraphicsWidget::eventInWindow = NULL
staticprivate

Definition at line 82 of file QtOsgMixGraphicsWidget.h.

◆ retinaScale

double mars::graphics::QtOsgMixGraphicsWidget::retinaScale
private

Definition at line 88 of file QtOsgMixGraphicsWidget.h.


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