Removed osgWX and wxsgv from the repositry as it is intend to keep the core

distribution clean from GUI examples, these instead should live in the bazaar.
This can better accomodate the many different types of viewer that users are
developming.
This commit is contained in:
Robert Osfield
2002-02-08 23:04:59 +00:00
parent 2075eb0100
commit 2fb698f4ca
36 changed files with 0 additions and 1654 deletions

View File

@@ -1,27 +0,0 @@
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Ben Discoe
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
// The following symbol has a underscore suffix for compatibility.
#ifndef OSGWX_EXPORT_
#define OSGWX_EXPORT_ 1
#ifdef WIN32
#pragma warning( disable : 4244 )
#pragma warning( disable : 4251 )
#pragma warning( disable : 4275 )
#pragma warning( disable : 4786 )
#endif
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__)
# ifdef OSGWX_LIBRARY
# define OSGWX_EXPORT __declspec(dllexport)
# else
# define OSGWX_EXPORT __declspec(dllimport)
#endif /* OSGWX_LIBRARY */
#else
#define OSGWX_EXPORT
#endif
#endif

View File

@@ -1,39 +0,0 @@
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Ben Discoe
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
#ifndef OSGWX_VERSION
#define OSGWX_VERSION 1
#include <osgWX/Export>
extern "C" {
/**
* osgWXGetVersion() returns the library version number.
* Numbering convention : osg_src-0.8.31 will return 0.8.31.
*
* This C function can be also used to check for the existence of the OpenSceneGraph
* library using autoconf and its m4 macro AC_CHECK_LIB.
*
* Here is the code to add to your configure.in:
\verbatim
#
# Check for the OpenSceneGraph (OSG) WX library
#
AC_CHECK_LIB(osg, osgWXGetVersion, ,
[AC_MSG_ERROR(OpenSceneGraph WX library not found. See http://www.openscenegraph.org)],)
\endverbatim
*/
extern OSGWX_EXPORT const char* osgWXGetVersion();
/**
* getLibraryName_osgWX() returns the library name in human friendly form.
*/
extern OSGWX_EXPORT const char* osgWXGetLibraryName();
}
#endif

View File

@@ -1,109 +0,0 @@
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Ben Discoe
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
#ifndef OSGWX_WXEVENTADAPTER
#define OSGWX_WXEVENTADAPTER 1
#include <osgUtil/GUIEventAdapter>
#include <osgWX/Export>
namespace osgWX {
/** Class for adapting WX events so that they can be used as input to
osgUtil::CameraManipulators.*/
class OSGWX_EXPORT WXEventAdapter : public osgUtil::GUIEventAdapter
{
public:
WXEventAdapter();
virtual ~WXEventAdapter() {}
/** Get the EventType of the GUI event.*/
virtual EventType getEventType() const { return _eventType; }
/** key pressed, return -1 if inappropriate for this event. */
virtual int getKey() const { return _key; }
/** button pressed/released, return -1 if inappropriate for this event.*/
virtual int getButton() const { return _button; }
/** window minimum x. */
virtual int getXmin() const { return _Xmin; }
/** window maximum x. */
virtual int getXmax() const { return _Xmax; }
/** window minimum y. */
virtual int getYmin() const { return _Ymin; }
/** window maximum y. */
virtual int getYmax() const { return _Ymax; }
/** current mouse x position.*/
virtual int getX() const { return _mx; }
/** current mouse y position.*/
virtual int getY() const { return _my; }
/** current mouse button state */
virtual unsigned int getButtonMask() const { return _buttonMask; }
/** time in seconds of event. */
virtual float time() const { return _time; }
/** static method for setting window dimensions.*/
static void setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax);
/** static method for setting button state.*/
static void setButtonMask(unsigned int buttonMask);
/** method for adapting resize events. */
void adaptResize(float t, int Xmin, int Ymin, int Xmax, int Ymax);
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
void adaptMouseMotion(float t, int x, int y);
/** method for adapting mouse motion events whilst no mouse button are pressed.*/
void adaptMousePassiveMotion(float t,int x, int y);
/** method for adapting mouse button pressed/released events.*/
void adaptMouse(float t, class wxMouseEvent *event);
/** method for adapting keyboard events.*/
void adaptKeyboard(float t,unsigned char key, int x, int y );
/** method for adapting frame events, i.e. iddle/display callback.*/
void adaptFrame(float t);
void copyStaticVariables();
protected:
EventType _eventType;
int _key;
int _button;
int _Xmin,_Xmax;
int _Ymin,_Ymax;
int _mx;
int _my;
unsigned int _buttonMask;
float _time;
// used to accumulate the button mask state, it represents
// the current button mask state, which is modified by the
// adaptMouse() method which then copies it to value _buttonMask
// which required the mouse buttons state at the time of the event.
static unsigned int _s_accumulatedButtonMask;
// used to store window min and max values.
static int _s_Xmin;
static int _s_Xmax;
static int _s_Ymin;
static int _s_Ymax;
static int _s_mx;
static int _s_my;
};
} // namespace osgWX
#endif

View File

@@ -1,27 +0,0 @@
#!smake
include $(OSGHOME)/Make/makedefs
C++FILES = \
$(wildcard *.cpp)
TARGET = $(OSGHOME)/bin/wxsgv
TARGET_BIN_FILES = wxsgv
C++FLAGS += -I$(OSGHOME)/include `wx-config --cflags`
#note, use this library list when using the Performer osgPlugin.
#LIBS = ${PFLIBS} -losgWX -losgUtil -losgDB -losg \
# `wx-config --libs` -lwx_gtk_gl \
# -lGLU -lGL -lm -lXmu -lX11 -lXi
#note, standard library list.
LIBS = -losgWX -losgUtil -losgDB -losg \
`wx-config --libs` -lwx_gtk_gl \
$(GL_LIBS) $(X_LIBS)
C++FLAGS += -I$(OSGHOME)/include -I./icons
LDFLAGS += -L$(OSGHOME)/lib
include $(OSGHOME)/Make/makerules

View File

@@ -1,314 +0,0 @@
//
// Name: SceneGraphDlg.cpp
// Author: Ben Discoe, ben@washedashore.com
//
#ifdef __GNUG__
#pragma implementation "SceneGraphDlg.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
#include "wx/treectrl.h"
#include <typeinfo>
#include <osg/Group>
#include <osg/LightSource>
#include <osg/LOD>
#include <osg/Geode>
#include <osg/Transform>
#include <osg/GeoSet>
#include <osg/ImpostorSprite>
using namespace osg;
#include "app.h"
DECLARE_APP(wxosgApp)
//#include <string>
#include "SceneGraphDlg.h"
#if defined(__WXGTK__) || defined(__WXMOTIF__)
# include "wxsgv.xpm"
# include "icon1.xpm"
# include "icon2.xpm"
# include "icon3.xpm"
# include "icon4.xpm"
# include "icon5.xpm"
# include "icon6.xpm"
# include "icon7.xpm"
# include "icon8.xpm"
# include "icon9.xpm"
# include "icon10.xpm"
#endif
/////////////////////////////
class MyTreeItemData : public wxTreeItemData
{
public:
MyTreeItemData(Node *pNode)
{
m_pNode = pNode;
}
Node *m_pNode;
};
// WDR: class implementations
//----------------------------------------------------------------------------
// SceneGraphDlg
//----------------------------------------------------------------------------
// WDR: event table for SceneGraphDlg
BEGIN_EVENT_TABLE(SceneGraphDlg,wxDialog)
EVT_INIT_DIALOG (SceneGraphDlg::OnInitDialog)
EVT_TREE_SEL_CHANGED( ID_SCENETREE, SceneGraphDlg::OnTreeSelChanged )
EVT_BUTTON( ID_ZOOMTO, SceneGraphDlg::OnZoomTo )
EVT_BUTTON( ID_REFRESH, SceneGraphDlg::OnRefresh )
END_EVENT_TABLE()
SceneGraphDlg::SceneGraphDlg( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxDialog( parent, id, title, position, size, style )
{
SceneGraphFunc( this, TRUE );
m_pZoomTo = GetZoomto();
m_pTree = GetScenetree();
m_pZoomTo->Enable(false);
m_imageListNormal = NULL;
CreateImageList(16);
}
SceneGraphDlg::~SceneGraphDlg()
{
}
///////////
void SceneGraphDlg::CreateImageList(int size)
{
delete m_imageListNormal;
if ( size == -1 )
{
m_imageListNormal = NULL;
return;
}
// Make an image list containing small icons
m_imageListNormal = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
wxIcon icons[10];
icons[0] = wxICON(icon1);
icons[1] = wxICON(icon2);
icons[2] = wxICON(icon3);
icons[3] = wxICON(icon4);
icons[4] = wxICON(icon5);
icons[5] = wxICON(icon6);
icons[6] = wxICON(icon7);
icons[7] = wxICON(icon8);
icons[8] = wxICON(icon9);
icons[9] = wxICON(icon10);
int sizeOrig = icons[0].GetWidth();
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
{
if ( size == sizeOrig )
m_imageListNormal->Add(icons[i]);
else
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
ConvertToBitmap());
}
m_pTree->SetImageList(m_imageListNormal);
}
void SceneGraphDlg::RefreshTreeContents()
{
// start with a blank slate
m_pTree->DeleteAllItems();
Node *pRoot = wxGetApp().Root();
if (!pRoot)
return;
// Fill in the tree with nodes
wxTreeItemId hRootItem = m_pTree->AddRoot("Root");
AddNodeItemsRecursively(hRootItem, pRoot, 0);
m_pTree->Expand(hRootItem);
m_pSelectedNode = NULL;
}
void SceneGraphDlg::AddNodeItemsRecursively(wxTreeItemId hParentItem,
Node *pNode, int depth)
{
wxString str;
int nImage;
wxTreeItemId hNewItem;
if (!pNode) return;
else if (dynamic_cast<LightSource*>(pNode))
{
str = "Light";
nImage = 4;
}
else if (dynamic_cast<Geode*>(pNode))
{
str = "Geode";
nImage = 2;
}
else if (dynamic_cast<LOD*>(pNode))
{
str = "LOD";
nImage = 5;
}
else if (dynamic_cast<Transform*>(pNode))
{
str = "XForm";
nImage = 9;
}
else if (dynamic_cast<Group*>(pNode))
{
// must be just a group for grouping's sake
str = "Group";
nImage = 3;
}
else
{
// must be something else
str = "Other";
nImage = 8;
}
std::string name = pNode->getName();
if (!name.empty())
{
const char *name2 = name.c_str();
str += " \"";
str += name2;
str += "\"";
}
hNewItem = m_pTree->AppendItem(hParentItem, str, nImage, nImage);
Geode *pGeode = dynamic_cast<Geode*>(pNode);
if (pGeode)
{
int num_mesh = pGeode->getNumDrawables();
wxTreeItemId hDItem;
for (int i = 0; i < num_mesh; i++)
{
Drawable *pDraw = pGeode->getDrawable(i);
GeoSet *pGeoSet = dynamic_cast<GeoSet*>(pDraw);
if (pGeoSet)
{
int iNumPrim = pGeoSet->getNumPrims();
GeoSet::PrimitiveType pt = pGeoSet->getPrimType();
const char *mtype;
switch (pt)
{
case (GeoSet::POINTS) : mtype = "Points"; break;
case (GeoSet::LINES) : mtype = "Lines"; break;
case (GeoSet::LINE_LOOP) : mtype = "LineLoop"; break;
case (GeoSet::LINE_STRIP): mtype = "LineStrip"; break;
case (GeoSet::FLAT_LINE_STRIP) : mtype = "FlatLineStrip"; break;
case (GeoSet::TRIANGLES) : mtype = "Triangles"; break;
case (GeoSet::TRIANGLE_STRIP) : mtype = "TriStrip"; break;
case (GeoSet::FLAT_TRIANGLE_STRIP) : mtype = "FlatTriStrip"; break;
case (GeoSet::TRIANGLE_FAN) : mtype = "TriFan"; break;
case (GeoSet::FLAT_TRIANGLE_FAN) : mtype = "FlatTriFan"; break;
case (GeoSet::QUADS) : mtype = "Quads"; break;
case (GeoSet::QUAD_STRIP) : mtype = "QuadStrip"; break;
case (GeoSet::POLYGON) : mtype = "Polygon"; break;
}
str.Printf("GeoSet %d, %s, %d prims", i, mtype, iNumPrim);
hDItem = m_pTree->AppendItem(hNewItem, str, 6, 6);
}
ImpostorSprite *pImpostorSprite = dynamic_cast<ImpostorSprite*>(pDraw);
if (pImpostorSprite)
{
str.Printf("ImposterSprite");
hDItem = m_pTree->AppendItem(hNewItem, str, 9, 9);
}
}
}
m_pTree->SetItemData(hNewItem, new MyTreeItemData(pNode));
Group *pGroup = dynamic_cast<Group*>(pNode);
if (pGroup)
{
int num_children = pGroup->getNumChildren();
if (num_children > 200)
{
wxTreeItemId hSubItem;
str.Format("(%d children)", num_children);
hSubItem = m_pTree->AppendItem(hNewItem, str, 8, 8);
}
else
{
for (int i = 0; i < num_children; i++)
{
Node *pChild = pGroup->getChild(i);
if (!pChild) continue;
AddNodeItemsRecursively(hNewItem, pChild, depth+1);
}
}
}
// expand a bit so that the tree is initially partially exposed
if (depth < 2)
m_pTree->Expand(hNewItem);
}
// WDR: handler implementations for SceneGraphDlg
void SceneGraphDlg::OnRefresh( wxCommandEvent &event )
{
RefreshTreeContents();
}
void SceneGraphDlg::OnZoomTo( wxCommandEvent &event )
{
if (m_pSelectedNode)
wxGetApp().ZoomTo(m_pSelectedNode);
}
void SceneGraphDlg::OnTreeSelChanged( wxTreeEvent &event )
{
wxTreeItemId item = event.GetItem();
MyTreeItemData *data = (MyTreeItemData *)m_pTree->GetItemData(item);
m_pSelectedNode = NULL;
if (data && data->m_pNode)
{
m_pSelectedNode = data->m_pNode;
m_pZoomTo->Enable(true);
}
else
m_pZoomTo->Enable(false);
}
void SceneGraphDlg::OnInitDialog(wxInitDialogEvent& event)
{
RefreshTreeContents();
wxWindow::OnInitDialog(event);
}

View File

@@ -1,65 +0,0 @@
//
// Name: SceneGraphDlg.h
// Author: Ben Discoe, ben@washedashore.com
//
#ifndef __SceneGraphDlg_H__
#define __SceneGraphDlg_H__
#ifdef __GNUG__
#pragma interface "SceneGraphDlg.cpp"
#endif
#include "wx/imaglist.h"
#include "wxsgv_wdr.h"
// WDR: class declarations
//----------------------------------------------------------------------------
// SceneGraphDlg
//----------------------------------------------------------------------------
class SceneGraphDlg: public wxDialog
{
public:
// constructors and destructors
SceneGraphDlg( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE );
~SceneGraphDlg();
void OnInitDialog(wxInitDialogEvent& event);
wxButton *m_pZoomTo;
wxCheckBox *m_pEnabled;
wxTreeCtrl *m_pTree;
osg::Node *m_pSelectedNode;
void CreateImageList(int size = 16);
void RefreshTreeContents();
void AddNodeItemsRecursively(wxTreeItemId hParentItem,
osg::Node *pNode, int depth);
// WDR: method declarations for SceneGraphDlg
wxButton* GetZoomto() { return (wxButton*) FindWindow( ID_ZOOMTO ); }
wxTreeCtrl* GetScenetree() { return (wxTreeCtrl*) FindWindow( ID_SCENETREE ); }
private:
// WDR: member variable declarations for SceneGraphDlg
wxImageList *m_imageListNormal;
private:
// WDR: handler declarations for SceneGraphDlg
void OnRefresh( wxCommandEvent &event );
void OnZoomTo( wxCommandEvent &event );
void OnTreeSelChanged( wxTreeEvent &event );
private:
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -1,110 +0,0 @@
//
// Name: app.cpp
// Purpose: The application class for a wxWindows application.
// Author: Ben Discoe, ben@washedashore.com
//
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <osgUtil/SceneView>
#include <osgUtil/TrackballManipulator>
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgWX/WXEventAdapter>
using namespace osg;
using namespace osgWX;
#include "app.h"
#include "frame.h"
IMPLEMENT_APP(wxosgApp)
wxosgApp::wxosgApp()
{
m_bInitialized = false;
}
//
// Initialize the app object
//
bool wxosgApp::OnInit()
{
// Create the main frame window
wxString title = "wxsgv Demo Viewer";
wxosgFrame *frame = new wxosgFrame(NULL, title,
wxPoint(50, 50), wxSize(800, 600));
//
// Create the 3d scene
//
m_pSceneView = new osgUtil::SceneView();
m_pSceneView->setDefaults();
Camera *pCam = new Camera();
m_pSceneView->setCamera(pCam);
m_pCameraManipulator = new osgUtil::TrackballManipulator();
m_pCameraManipulator->setCamera(pCam);
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
m_pCameraManipulator->init(*ea, *this);
m_bInitialized = true;
return true;
}
void wxosgApp::DoUpdate()
{
if (!m_bInitialized)
return;
m_pSceneView->setViewport(0, 0, m_winx, m_winy);
m_pSceneView->cull();
m_pSceneView->draw();
}
void wxosgApp::SetWindowSize(int x, int y)
{
m_winx = x;
m_winy = y;
}
void wxosgApp::LoadFile(const char *filename)
{
Node *node = osgDB::readNodeFile(filename);
if (!node)
return;
m_pSceneView->setSceneData(node);
m_pCameraManipulator->setNode(node);
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
m_pCameraManipulator->home(*ea, *this);
}
osg::Node *wxosgApp::Root()
{
return m_pSceneView->getSceneData();
}
void wxosgApp::ZoomTo(Node *node)
{
m_pCameraManipulator->setNode(node);
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
m_pCameraManipulator->home(*ea, *this);
}

View File

@@ -1,41 +0,0 @@
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//
// forward declaration
namespace osgUtil {
class SceneView;
class CameraManipulator;
}
#include <wx/app.h>
#include <osg/Node>
#include <osgUtil/GUIActionAdapter>
// Define a new application type
class wxosgApp: public wxApp, public osgUtil::GUIActionAdapter
{
public:
wxosgApp();
bool OnInit();
void DoUpdate();
void SetWindowSize(int x, int y);
void LoadFile(const char *filename);
void ZoomTo(osg::Node *node);
osgUtil::CameraManipulator *Manip() { return m_pCameraManipulator.get(); }
osg::Node *Root();
virtual void requestRedraw() {}
virtual void requestContinuousUpdate(bool needed=true) {}
virtual void requestWarpPointer(int x,int y) {}
protected:
osg::ref_ptr<osgUtil::SceneView> m_pSceneView;
osg::ref_ptr<osgUtil::CameraManipulator> m_pCameraManipulator;
int m_winx, m_winy; // Window size
bool m_bInitialized;
};

View File

@@ -1,188 +0,0 @@
//
// Name: canvas.cpp
// Purpose: Implements the canvas class for a wxWindows application.
// Author: Ben Discoe, ben@washedashore.com
//
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <osgWX/WXEventAdapter>
#include <osgUtil/CameraManipulator>
using namespace osg;
using namespace osgWX;
#include "canvas.h"
#include "frame.h"
#include "app.h"
DECLARE_APP(wxosgApp)
/*
* wxosgGLCanvas implementation
*/
BEGIN_EVENT_TABLE(wxosgGLCanvas, wxGLCanvas)
EVT_CLOSE(wxosgGLCanvas::OnClose)
EVT_SIZE(wxosgGLCanvas::OnSize)
EVT_PAINT(wxosgGLCanvas::OnPaint)
EVT_CHAR(wxosgGLCanvas::OnChar)
EVT_MOUSE_EVENTS(wxosgGLCanvas::OnMouseEvent)
EVT_ERASE_BACKGROUND(wxosgGLCanvas::OnEraseBackground)
END_EVENT_TABLE()
wxosgGLCanvas::wxosgGLCanvas(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name, int* gl_attrib):
wxGLCanvas(parent, id, pos, size, style, name, gl_attrib)
{
parent->Show(TRUE);
SetCurrent();
m_bPainting = false;
m_bRunning = true;
QueueRefresh(FALSE);
m_initialTick = m_timer.tick();
}
wxosgGLCanvas::~wxosgGLCanvas(void)
{
}
void wxosgGLCanvas::QueueRefresh(bool eraseBackground)
// A Refresh routine we can call from inside OnPaint.
// (queues the events rather than dispatching them immediately).
{
// With wxGTK, you can't do a Refresh() in OnPaint because it doesn't
// queue (post) a Refresh event for later. Rather it dispatches
// (processes) the underlying events immediately via ProcessEvent
// (read, recursive call). See the wxPostEvent docs and Refresh code
// for more details.
if ( eraseBackground )
{
wxEraseEvent eevent( GetId() );
eevent.SetEventObject( this );
wxPostEvent( GetEventHandler(), eevent );
}
wxPaintEvent event( GetId() );
event.SetEventObject( this );
wxPostEvent( GetEventHandler(), event );
}
void wxosgGLCanvas::OnPaint( wxPaintEvent& event )
{
// place the dc inside a scope, to delete it before the end of function
if (1)
{
// This is a dummy, to avoid an endless succession of paint messages.
// OnPaint handlers must always create a wxPaintDC.
wxPaintDC dc(this);
#ifdef __WXMSW__
if (!GetContext()) return;
#endif
if (m_bPainting || !m_bRunning) return;
m_bPainting = true;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// update the camera manipulator.
if (wxGetApp().Manip())
{
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
ea->adaptFrame(clockSeconds());
wxGetApp().Manip()->handle(*ea, wxGetApp());
}
// Render the OSG scene
wxGetApp().DoUpdate();
SwapBuffers();
#ifdef WIN32
// Call Refresh again for continuous rendering,
if (m_bRunning)
Refresh(FALSE);
#else
// Queue another refresh for continuous rendering.
// (Yield first so we don't starve out keyboard & mouse events.)
//
// FIXME: We may want to use a frame timer instead of immediate-
// redraw so we don't eat so much CPU on machines that can
// easily handle the frame rate.
wxYield();
QueueRefresh(FALSE);
#endif
m_bPainting = false;
}
// Must allow some idle processing to occur - or the toolbars will not
// update, and the close box will not respond!
wxGetApp().ProcessIdle();
}
static void Reshape(int width, int height)
{
glViewport(0, 0, (GLint)width, (GLint)height);
}
void wxosgGLCanvas::OnClose(wxCloseEvent& event)
{
m_bRunning = false;
}
void wxosgGLCanvas::OnSize(wxSizeEvent& event)
{
// Presumably this is a wxMSWism.
// For wxGTK & wxMotif, all canvas resize events occur before the context
// is set. So ignore this context check and grab the window width/height
// when we get it so it (and derived values such as aspect ratio and
// viewport parms) are computed correctly.
#ifdef __WXMSW__
if (!GetContext()) return;
#endif
SetCurrent();
int width, height;
GetClientSize(& width, & height);
Reshape(width, height);
if (wxGetApp().Manip())
{
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
ea->adaptResize(clockSeconds(), 0, 0, width, height);
wxGetApp().Manip()->handle(*ea, wxGetApp());
}
wxGetApp().SetWindowSize(width, height);
}
void wxosgGLCanvas::OnChar(wxKeyEvent& event)
{
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
ea->adaptKeyboard(clockSeconds(), event.KeyCode(), event.GetX(), event.GetY());
wxGetApp().Manip()->handle(*ea, wxGetApp());
}
void wxosgGLCanvas::OnMouseEvent(wxMouseEvent& event)
{
// turn WX mouse event into a OSG mouse event
ref_ptr<WXEventAdapter> ea = new WXEventAdapter;
ea->adaptMouse(clockSeconds(), &event);
wxGetApp().Manip()->handle(*ea, wxGetApp());
}
void wxosgGLCanvas::OnEraseBackground(wxEraseEvent& event)
{
// Do nothing, to avoid flashing.
}

View File

@@ -1,50 +0,0 @@
//
// Name: canvas.h
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//
#ifndef CANVASH
#define CANVASH
#if !wxUSE_GLCANVAS
#error Please set wxUSE_GLCANVAS to 1 in setup.h.
#endif
#include "wx/glcanvas.h"
#include <osg/Timer>
//
// A Canvas for the main view area.
//
class wxosgGLCanvas: public wxGLCanvas
{
public:
wxosgGLCanvas(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "wxosgGLCanvas",
int* gl_attrib = NULL);
~wxosgGLCanvas(void);
void OnPaint(wxPaintEvent& event);
void OnSize(wxSizeEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnClose(wxCloseEvent& event);
void QueueRefresh(bool eraseBackground);
bool m_bPainting;
bool m_bRunning;
// time since initClock() in seconds.
float clockSeconds() { return m_timer.delta_s(m_initialTick, m_timer.tick()); }
osg::Timer m_timer;
osg::Timer_t clockTick() { return m_timer.tick(); }
osg::Timer_t m_initialTick;
protected:
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -1,111 +0,0 @@
//
// Name: frame.cpp
// Purpose: The frame class for a wxWindows application.
// Author: Ben Discoe, ben@washedashore.com
//
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "app.h"
#include "frame.h"
#include "canvas.h"
// IDs for the menu commands
enum
{
ID_FILE_OPEN,
ID_SCENE_BROWSE
};
DECLARE_APP(wxosgApp)
BEGIN_EVENT_TABLE(wxosgFrame, wxFrame)
EVT_MENU(wxID_EXIT, wxosgFrame::OnExit)
EVT_MENU(ID_FILE_OPEN, wxosgFrame::OnOpen)
EVT_MENU(ID_SCENE_BROWSE, wxosgFrame::OnSceneBrowse)
END_EVENT_TABLE()
// My frame constructor
wxosgFrame::wxosgFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
const wxSize& size, long style):
wxFrame(parent, -1, title, pos, size, style)
{
// Make a wxosgGLCanvas
// FIXME: Can remove this special case once wxMotif 2.3 is released
#ifdef __WXMOTIF__
int gl_attrib[20] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 1,
GLX_DOUBLEBUFFER, None };
#else
int *gl_attrib = NULL;
#endif
m_canvas = new wxosgGLCanvas(this, -1, wxPoint(0, 0), wxSize(-1, -1), 0,
"wxosgGLCanvas", gl_attrib);
// File (project) menu
wxMenu *fileMenu = new wxMenu;
fileMenu->Append(ID_FILE_OPEN, "&Open\tCtrl+O", "Open OSG File");
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, "&Exit\tEsc", "Exit Viewer");
// Scene menu
wxMenu *sceneMenu = new wxMenu;
sceneMenu->Append(ID_SCENE_BROWSE, "&Browse Scene Graph\tCtrl+G", "Browse Scene Graph");
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(fileMenu, "&Project");
menuBar->Append(sceneMenu, "&Scene");
SetMenuBar(menuBar);
// Show the frame
Show(TRUE);
#if 1
m_pSceneGraphDlg = new SceneGraphDlg(this, -1, "Scene Graph",
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
m_pSceneGraphDlg->SetSize(250, 350);
#endif
m_canvas->SetCurrent();
}
wxosgFrame::~wxosgFrame()
{
delete m_canvas;
}
//
// Handle menu commands
//
void wxosgFrame::OnExit(wxCommandEvent& event)
{
m_canvas->m_bRunning = false;
Destroy();
}
void wxosgFrame::OnOpen(wxCommandEvent& event)
{
wxFileDialog loadFile(NULL, "Load Project", "", "",
"OSG Files (*.osg)|*.osg|", wxOPEN);
if (loadFile.ShowModal() == wxID_OK)
wxGetApp().LoadFile(loadFile.GetPath());
}
void wxosgFrame::OnSceneBrowse(wxCommandEvent& event)
{
m_pSceneGraphDlg->Show(TRUE);
}

View File

@@ -1,35 +0,0 @@
//
// Name: frame.h
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//
#ifndef FRAMEH
#define FRAMEH
#include "SceneGraphDlg.h"
class wxosgFrame: public wxFrame
{
public:
wxosgFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
~wxosgFrame();
// command handlers
void OnExit(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event);
void OnSceneBrowse(wxCommandEvent& event);
public:
class wxosgGLCanvas *m_canvas;
SceneGraphDlg *m_pSceneGraphDlg;
protected:
DECLARE_EVENT_TABLE()
};
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

View File

@@ -1,29 +0,0 @@
/* XPM */
static char *icon1_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 6 1",
/* colors */
"` c #000000",
"a c #C0C0C0",
"b c #FF0000",
"c c #FFFFFF",
"d c #FFFF00",
"e c #808000",
/* pixels */
"cccccccccccccccc",
"cccccccccceddecc",
"ccccccccceddddec",
"ccbbbcccceddddec",
"cc```cccceddddec",
"a`````````edde`a",
"``````accca`````",
"``aaa`ccccc`````",
"`````ccccccc````",
"``````ccccc`````",
"``````accca`````",
"a``````````````a",
"ca````````````ac",
"cccccccccccccccc",
"cccccccccccccccc",
"cccccccccccccccc"
};

View File

@@ -1,28 +0,0 @@
/* XPM */
static char *icon10_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 5 1",
/* colors */
"` c #00FF00",
"a c #FF0000",
"b c #FFFFFF",
"c c #808000",
"d c #0000FF",
/* pixels */
"bbbbbbbbbbbbbbbb",
"bbbbbbbbbbbbbbbb",
"bbb``bbbbbbbbbbb",
"bb````bbbbdddbbb",
"bbb``bbbbbdddbbb",
"bbb``bbbbddddbbb",
"bbb``bbbdddbbbbb",
"bbb``bbdddbbbbbb",
"bbb``bdddbbbbbbb",
"bbb``dddbbbbbbbb",
"bbb``ddbbbbbabbb",
"bbb`caaaaaaaaabb",
"bbbcaaaaaaaaaabb",
"bbbbbbbbbbbbabbb",
"bbbbbbbbbbbbbbbb",
"bbbbbbbbbbbbbbbb"
};

View File

@@ -1,27 +0,0 @@
/* XPM */
static char *icon2_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 4 1",
/* colors */
"` c #000000",
"a c #C0C0C0",
"b c #808080",
"c c #FFFFFF",
/* pixels */
"cccccccccccccccc",
"ccccb`bccb`bcccc",
"cccca``cc``acccc",
"ccccc``bb``ccccc",
"ca`ccb````bcc`ac",
"c```b``````b```c",
"ca`````bb`````ac",
"cccb``bccb``bccc",
"cccb``bccb``bccc",
"ca`````bb`````ac",
"c```b``````b```c",
"ca`ccb````bcc`ac",
"ccccc``bb``ccccc",
"cccca``cc``acccc",
"ccccb`bccb`bcccc",
"cccccccccccccccc"
};

View File

@@ -1,30 +0,0 @@
/* XPM */
static char *icon3_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 7 1",
/* colors */
"` c #000000",
"a c #00FF00",
"b c #C0C0C0",
"c c #000080",
"d c #FFFFFF",
"e c #008000",
"f c #0000FF",
/* pixels */
"ddddddd`dddddddd",
"dddddd```ddddddd",
"ddddd`a``bdddddd",
"dddd`aa`f`dddddd",
"ddd`aaa`ff`ddddd",
"dd`aaaa`fff`dddd",
"d`aaaaacfff`bddd",
"`aaaaaecffff`ddd",
"b`aaaaecfffff`dd",
"d`aaaa`fffffff`d",
"dd`aaa`fffffff`b",
"ddd`aa`fffffff``",
"dddb`a`fff````bd",
"dddd`a````bddddd",
"ddddd``bdddddddd",
"dddddddddddddddd"
};

View File

@@ -1,27 +0,0 @@
/* XPM */
static char *icon4_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 4 1",
/* colors */
"` c #000000",
"a c #FFFFFF",
"b c #FFFF00",
"c c #808000",
/* pixels */
"aaaaaaaaaaaaaaaa",
"aaaaac````caaaaa",
"aaac`bbbbbb`caaa",
"aac`bbbbbbbb`caa",
"aa`bbbc``cbbb`aa",
"accbb`caac`bbcca",
"a`bbccaaaaccbbca",
"a`bb`aaaaaa`bb`a",
"a`bb`aaaaaa`bb`a",
"a`bbccaaaaccbbca",
"accbb`caac`bbcca",
"aa`bbbc``cbbb`aa",
"aaa`bbbbbbbb`aaa",
"aaaa`bbbbbb`aaaa",
"aaaaac````caaaaa",
"aaaaaaaaaaaaaaaa"
};

View File

@@ -1,28 +0,0 @@
/* XPM */
static char *icon5_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 5 1",
/* colors */
"` c #000000",
"a c #C0C0C0",
"b c #FFFFFF",
"c c #FFFF00",
"d c #808000",
/* pixels */
"bbbbbbbbbbbbbbbb",
"bbbbdbbbbbbbdbbb",
"dbbbbd````bdbbbb",
"bdbbb`bbcb`bbbbb",
"bbdd`bbcccb`bbbb",
"bbbb`bcbcbc`dddd",
"bbbb`cccbcb`bbbb",
"bbdd`ccccbc`dbbb",
"ddbb`bccccc`bddb",
"bbbbb`bccb`bbbbd",
"bbbbdb````bbdbbb",
"bbbdbb````bbbdbb",
"bbbdbb````bbbdbb",
"bbdbbb````bbbbdb",
"bbbbbba``abbbbbb",
"bbbbbbbbbbbbbbbb"
};

View File

@@ -1,29 +0,0 @@
/* XPM */
static char *icon6_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 6 1",
/* colors */
"` c #000000",
"a c #C0C0C0",
"b c #808080",
"c c #FFFFFF",
"d c #FFFF00",
"e c #808000",
/* pixels */
"cccccccccccccccc",
"cabbbbbbbbaccccc",
"cb````````bccccc",
"cb`dddddd`bccccc",
"cb`dddddd`bbaccc",
"cb`dddddd```bacc",
"cb`dddddd`dd`bcc",
"cb`dddddd`dd`bac",
"cb`dddddd`ddd`bc",
"cb````````ddd`bc",
"cabbb`ddddddebac",
"cccab`dddddd`bcc",
"ccccab``dde`bacc",
"cccccabb``bbaccc",
"cccccccabbaccccc",
"cccccccccccccccc"
};

View File

@@ -1,29 +0,0 @@
/* XPM */
static char *icon7_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 6 1",
/* colors */
"` c #000000",
"a c #00FF00",
"b c #C0C0C0",
"c c #808080",
"d c #FFFFFF",
"e c #008000",
/* pixels */
"dddddddddddddddd",
"dddddddddddddddd",
"ddddddd`dddddddd",
"ddddddbe`ddddddd",
"dddddd`aebdddddd",
"dddddbeaa`dddddd",
"ddddd`aaaebddddd",
"ddddbeaaaa`ddddd",
"dddd`aaaaaaedddd",
"ddddeaaaaaa`dddd",
"dddeaaaaaaaa`ddd",
"ddd`aaaaaaaaebdd",
"ddbeaaaaaaaaa`dd",
"dd`aaaaaaaaaaacd",
"dd`````````````d",
"dddddddddddddddd"
};

View File

@@ -1,26 +0,0 @@
/* XPM */
static char *icon8_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 3 1",
/* colors */
"` c #000000",
"a c #FFFFFF",
"b c #0000FF",
/* pixels */
"aaaaaaaaaaaaaaaa",
"aaaaaaaa`aaaaaaa",
"aaaaaaaa``aaaaaa",
"aaaaaaaa`b`aaaaa",
"aaaaaaaa`bb`aaaa",
"aaaaaaaa`bbb`aaa",
"a````````bbbb`aa",
"a`bbbbbbbbbbbb`a",
"a`bbbbbbbbbbbb`a",
"a````````bbbb`aa",
"aaaaaaaa`bbb`aaa",
"aaaaaaaa`bb`aaaa",
"aaaaaaaa`b`aaaaa",
"aaaaaaaa``aaaaaa",
"aaaaaaaa`aaaaaaa",
"aaaaaaaaaaaaaaaa"
};

View File

@@ -1,28 +0,0 @@
/* XPM */
static char *icon9_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 5 1",
/* colors */
"` c #000000",
"a c #C0C0C0",
"b c #808080",
"c c #000080",
"d c #FFFFFF",
/* pixels */
"dddddddddddddddd",
"dddddacccccadddd",
"ddddacccccccaddd",
"dddacccbdacccddd",
"dddacccddacccddd",
"dddabcbddacccddd",
"ddddddddacccaddd",
"dddddddacccaaddd",
"ddddddaacccadddd",
"ddddddacccaddddd",
"ddddddabcbaddddd",
"dddddddddddddddd",
"dddddddb`bdddddd",
"ddddddacccaddddd",
"dddddddbcbdddddd",
"dddddddddddddddd"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@@ -1,48 +0,0 @@
/* XPM */
static char *wxsgv[] = {
/* width height num_colors chars_per_pixel */
" 32 32 9 1",
/* colors */
". c #000000",
"# c #000080",
"a c #0000ff",
"b c #008000",
"c c #00ff00",
"d c #808000",
"e c #808080",
"f c #ffff00",
"g c #ffffff",
/* pixels */
"gggggggggggggggggggggggggggggggg",
"ggggd....dgggggggggggggggggggggg",
"ggd.ffffffddgggggggggggggggggggg",
"gd.ffffffffddggggggggggggggggggg",
"g.fffd..dfffdggggggggggggggggggg",
"ddffddggdddfddgggggggggggggggggg",
".ffddggggddffdgggggggggggggggggg",
".ff.gggggg.dfdgggggggggggggggggg",
".ff.gggggg.dfdgggggggggggggggggg",
".ffddgggg.ddfdgggggggggggggggggg",
"ddffddgg..dffdgggggggggggggggggg",
"g.ffdd..ddffdggggggggggggggggggg",
"ggdfffdddffdgggggggggggggggggggg",
"gggdffffffdggggggggggggggggggggg",
"ggggddddddgggggggggggggggggggggg",
"gggggggggggggggggggggggggggggggg",
"gggggggeggggggggggggggg.gggggggg",
"gggggggggggggggggggggg...ggggggg",
"gggggggeggggggggggggg.b..egggggg",
"gggggggggggggggggggg.cc.##gggggg",
"gggeeeeeeeeeggggggg.ccc.#a#ggggg",
"gggegggggggegggggg.cccc.#aa#gggg",
"gggeggg.gggeggggg.ccccc#aaa#eggg",
"gggeggg.gggegggg.bccccb#aaaa#ggg",
"gggeg.....gegegeebccccb#aaaaa#gg",
"gggeggg.gggeggggg.ccccb#aaaaaa#g",
"gggeggg.gggeggggggbccc.aaaaaaa#e",
"gggegggggggegggggggbcc.aaaaaaa#.",
"gggeeeeeeeeegggggggebc.aaa#####g",
"gggggggggggggggggggg.c.###eggggg",
"gggggggggggggggggggggb.egggggggg",
"gggggggggggggggggggggggggggggggg"
};

View File

@@ -1,24 +0,0 @@
#!smake
include $(OSGHOME)/Make/makedefs
C++FILES = \
WXEventAdapter.cpp\
Version.cpp\
TARGET_BASENAME = osgWX
LIBS = -L$(OSGHOME)/lib -losgDB -losgUtil -losg $(WXLIB) $(GL_LIBS)
LIB = $(OSGHOME)/lib/lib$(TARGET_BASENAME).$(SO_EXT)
#LIB = $(OSGHOME)/lib/lib$(TARGET_BASENAME).a
TARGET_LIB_FILES = lib$(TARGET_BASENAME).$(SO_EXT)
TARGET_INCLUDE_FILES = \
osgWX/Export\
osgWX/WXEventAdapter\
osgWX/Version\
C++FLAGS += -I $(OSGHOME)/include `wx-config --cflags`
include $(OSGHOME)/Make/makerules

View File

@@ -1,12 +0,0 @@
#include <osgWX/Version>
const char* osgWXGetVersion()
{
return "0.8.44";
}
const char* osgWXGetLibraryName()
{
return "Open Scene Graph WX Library";
}

View File

@@ -1,173 +0,0 @@
//
// class WXEventAdapter
//
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <osgWX/WXEventAdapter>
using namespace osgWX;
// default to no mouse buttons being pressed.
unsigned int WXEventAdapter::_s_accumulatedButtonMask = 0;
int WXEventAdapter::_s_Xmin = 0;
int WXEventAdapter::_s_Xmax = 1280;
int WXEventAdapter::_s_Ymin = 0;
int WXEventAdapter::_s_Ymax = 1024;
int WXEventAdapter::_s_mx = 0;
int WXEventAdapter::_s_my = 0;
WXEventAdapter::WXEventAdapter()
{
_eventType = NONE; // adaptor does not encapsulate any events.
_key = -1; // set to 'invalid' key value.
_button = -1; // set to 'invalid' button value.
_mx = -1; // set to 'invalid' position value.
_my = -1; // set to 'invalid' position value.
_buttonMask = 0; // default to no mouse buttons being pressed.
_time = 0.0f; // default to no time has been set.
copyStaticVariables();
}
void WXEventAdapter::copyStaticVariables()
{
_buttonMask = _s_accumulatedButtonMask;
_Xmin = _s_Xmin;
_Xmax = _s_Xmax;
_Ymin = _s_Ymin;
_Ymax = _s_Ymax;
_mx = _s_mx;
_my = _s_my;
}
void WXEventAdapter::setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax)
{
_s_Xmin = Xmin;
_s_Xmax = Xmax;
_s_Ymin = Ymin;
_s_Ymax = Ymax;
}
void WXEventAdapter::setButtonMask(unsigned int buttonMask)
{
_s_accumulatedButtonMask = buttonMask;
}
void WXEventAdapter::adaptResize(float time, int Xmin, int Ymin, int Xmax, int Ymax)
{
setWindowSize(Xmin,Ymin,Xmax,Ymax);
_eventType = RESIZE;
_time = time;
copyStaticVariables();
}
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
void WXEventAdapter::adaptMouseMotion(float time, int x, int y)
{
_eventType = DRAG;
_time = time;
_s_mx = x;
_s_my = y;
copyStaticVariables();
}
/** method for adapting mouse motion events whilst no mouse button are pressed.*/
void WXEventAdapter::adaptMousePassiveMotion(float time, int x, int y)
{
_eventType = MOVE;
_time = time;
_s_mx = x;
_s_my = y;
copyStaticVariables();
}
/** method for adapting mouse button pressed/released events.*/
void WXEventAdapter::adaptMouse(float time, wxMouseEvent *event)
{
_time = time;
wxEventType type = event->GetEventType();
if ( type == wxEVT_LEFT_DOWN ) {
_eventType = PUSH;
_s_accumulatedButtonMask = _s_accumulatedButtonMask | LEFT_MOUSE_BUTTON;
}
else if ( type == wxEVT_LEFT_UP ) {
_eventType = RELEASE;
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~LEFT_MOUSE_BUTTON;
}
else if ( type == wxEVT_MIDDLE_DOWN ) {
_eventType = PUSH;
_s_accumulatedButtonMask = _s_accumulatedButtonMask | MIDDLE_MOUSE_BUTTON;
}
else if ( type == wxEVT_MIDDLE_UP ) {
_eventType = RELEASE;
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~MIDDLE_MOUSE_BUTTON;
}
else if ( type == wxEVT_RIGHT_DOWN ) {
_eventType = PUSH;
_s_accumulatedButtonMask = _s_accumulatedButtonMask | RIGHT_MOUSE_BUTTON;
}
else if ( type == wxEVT_RIGHT_UP ) {
_eventType = RELEASE;
_s_accumulatedButtonMask = _s_accumulatedButtonMask & ~RIGHT_MOUSE_BUTTON;
}
else if ( type == wxEVT_MOTION ) {
if (event->ButtonIsDown(-1))
_eventType = DRAG;
else
_eventType = MOVE;
}
else {
// ignored mouse events, such as wxEVT_LEAVE_WINDOW
return;
}
#if 0
// not yet handled: modifiers
if (event.ControlDown()) ...;
if (event.ShiftDown()) ...;
#endif
_s_mx = event->GetX();
_s_my = event->GetY();
copyStaticVariables();
}
/** method for adapting keyboard events.*/
void WXEventAdapter::adaptKeyboard(float time, unsigned char key, int x, int y )
{
_eventType = KEYBOARD;
_time = time;
_key = key;
_s_mx = x;
_s_my = y;
copyStaticVariables();
}
/** method for adapting frame events, i.e. iddle/display callback.*/
void WXEventAdapter::adaptFrame(float time)
{
_eventType = FRAME;
_time = time;
copyStaticVariables();
}