Skip to content

Adding custom tabs

tobiaskunz edited this page Feb 18, 2011 · 1 revision

Creating an EmptyTab

To get started extend a EmptyTab class from RSTTab. The RSTTab class is extended from the wxPanel class. Create EmptyTab.h and include the RSTTab class.

#include <Tabs/RSTTab.h>

All RST related include files like in '/librst/'. Include other class files from RST which will give access to the robot, links and other objects in our scene.

#include <Tools/World.h>
#include <Tools/Robot.h>
#include <Tools/Link.h>
#include <Tools/Object.h>
#include <Tools/Constants.h>

Declare the EmptyTab class. This also includes the wxWidgets declaration primitives for your class.

class EmptyTab : public RSTTab
{
public:
	EmptyTab(){};
	EmptyTab(wxWindow * parent, wxWindowID id = -1,
			 const wxPoint & pos = wxDefaultPosition,
			 const wxSize & size = wxDefaultSize,
			 long style = wxTAB_TRAVERSAL);
	virtual ~EmptyTab(){}

	void RSTStateChange();

	DECLARE_DYNAMIC_CLASS(EmptyTab)
	DECLARE_EVENT_TABLE()
};

Create the EmptyTab.cpp file for defining your class. Define your constructor and rest of your class.

BEGIN_EVENT_TABLE(EmptyTab, wxPanel)
END_EVENT_TABLE ()
IMPLEMENT_DYNAMIC_CLASS(EmptyTab, RSTTab)

EmptyTab::EmptyTab(wxWindow *parent, const wxWindowID id,
		const wxPoint& pos, const wxSize& size, long style) : RSTTab(parent, id, pos, size, style) {
}

// All tabs get a message for certain changes in RST (in case they want to do something)
void EmptyTab::RSTStateChange() {
}
Clone this wiki locally