gcp::Tool Class Reference

#include <tool.h>

List of all members.

Public Member Functions

 Tool (gcp::Application *App, std::string Id)
virtual ~Tool ()
bool OnClicked (View *pView, gcu::Object *pObject, double x, double y, unsigned int state)
void OnDrag (double x, double y, unsigned int state)
void OnRelease (double x, double y, unsigned int state)
bool OnRightButtonClicked (View *pView, gcu::Object *pObject, double x, double y, GtkUIManager *UIManager)
virtual bool OnRightButtonClicked (GtkUIManager *UIManager)

Protected Attributes

bool m_bAllowed


Detailed Description

Base clas for GChemPaint tools.

Definition at line 43 of file tool.h.


Constructor & Destructor Documentation

gcp::Tool::Tool ( gcp::Application App,
std::string  Id 
)

Parameters:
App the GChemPaint application.
Id the name of the tool.
Constructs a new tool.

virtual gcp::Tool::~Tool (  )  [virtual]

The destructor.


Member Function Documentation

bool gcp::Tool::OnClicked ( View *  pView,
gcu::Object pObject,
double  x,
double  y,
unsigned int  state 
)

Parameters:
pView the view instance owning the event.
pObject the Object on which the click occured.
x the horizontal position of the mouse when the click occured.
y the vertical position of the mouse when the click occured.
state a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType in GDK documentation.
This method is called by the framework when the tool is active and a click occurs. It initialize some members and the calls the virtual OnClicked() method. It might be called to simulate a click in some instances (e.g. from a contextual menu handler).

Returns:
true if the mouse drag and button release evens are significative for this tool in the current context, false otherwise. If true, a mouse move will fire the OnDrag method, and a button release will result in an OnRelease call. If false, nothing happens for these events.

void gcp::Tool::OnDrag ( double  x,
double  y,
unsigned int  state 
)

Parameters:
x the horizontal position of the mouse when the event occured.
y the vertical position of the mouse when the event occured.
state a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType in GDK documentation.
This method is called by the framework when the tool is active, the first mouse button is pressed and the mouse is moved.

void gcp::Tool::OnRelease ( double  x,
double  y,
unsigned int  state 
)

Parameters:
x the horizontal position of the mouse when the event occured.
y the vertical position of the mouse when the event occured.
state a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType in GDK documentation.
This method is called by the framework when the tool is active and the first mouse button is released.

bool gcp::Tool::OnRightButtonClicked ( View *  pView,
gcu::Object pObject,
double  x,
double  y,
GtkUIManager *  UIManager 
)

Parameters:
pView the view where the event occured.
pObject the object on which the event occured.
x the horizontal position of the mouse when the event occured.
y the vertical position of the mouse when the event occured.
UIManager the GtkUIManager in use.
This method is called by the framework when the tool is active and the right mouse button is pressed. It is used to add tool specific menu items to the contextual menu. It calls OnRightButtonClicked(GtkUIManager*).

Returns:
true if at least one menu item was added, false otherwise.

virtual bool gcp::Tool::OnRightButtonClicked ( GtkUIManager *  UIManager  )  [virtual]

Parameters:
UIManager the GtkUIManager in use.
Adds menu items to the contextual menu. Default implementation do not add any menu item and returns false. Derived classes for which menu items exist must override this method.
Returns:
true if at least one menu item was added, false otherwise.


Member Data Documentation

bool gcp::Tool::m_bAllowed [protected]

if true, the intended operation is allowed. Default value is true, each tool must set this flag to false if necessary.

Definition at line 207 of file tool.h.


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

Generated on Sat Aug 23 23:10:07 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6