The Gnome Chemistry Utils
0.13.7
|
#include <tool.h>
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 | OnMotion (View *pView, gcu::Object *pObject, double x, double y, unsigned int state) |
void | OnLeaveNotify (View *pView, unsigned int state) |
void | OnRelease (double x, double y, unsigned int state) |
bool | OnRightButtonClicked (View *pView, gcu::Object *pObject, double x, double y, gcu::UIManager *UIManager) |
bool | Activate (bool bState) |
std::string & | GetName () |
virtual bool | OnRightButtonClicked (gcu::UIManager *UIManager) |
virtual void | Activate () |
virtual bool | Deactivate () |
void | OnKeyPressed (unsigned int code) |
void | OnKeyReleased (unsigned int code) |
virtual bool | OnKeyPress (GdkEventKey *event) |
virtual bool | OnKeyRelease (GdkEventKey *event) |
virtual bool | NotifyViewChange () |
virtual bool | DeleteSelection () |
virtual bool | CopySelection (GtkClipboard *clipboard) |
virtual bool | CutSelection (GtkClipboard *clipboard) |
virtual bool | PasteSelection (GtkClipboard *clipboard) |
virtual void | AddSelection (WidgetData *data) |
virtual bool | OnReceive (GtkClipboard *clipboard, GtkSelectionData *data, int type) |
virtual bool | OnUndo () |
virtual bool | OnRedo () |
virtual void | PushNode (xmlNodePtr node) |
virtual GtkWidget * | GetPropertyPage () |
virtual char const * | GetHelpTag () |
Application * | GetApplication () |
virtual void | OnConfigChanged () |
bool | GetOwnStatus (void) |
Protected Member Functions | |
virtual bool | OnClicked () |
virtual void | OnDrag () |
virtual void | OnMotion () |
virtual void | OnLeaveNotify () |
virtual void | OnRelease () |
virtual void | OnChangeState () |
Protected Attributes | |
double | m_x0 |
double | m_y0 |
double | m_x1 |
double | m_y1 |
double | m_x |
double | m_y |
gcu::Object * | m_pObject |
gcu::Object * | m_pObjectGroup |
View * | m_pView |
WidgetData * | m_pData |
GtkWidget * | m_pWidget |
gccv::Item * | m_Item |
double | m_dZoomFactor |
bool | m_bChanged |
unsigned int | m_nState |
gcp::Application * | m_pApp |
std::set< std::string > | ModifiedObjects |
bool | m_bAllowed |
bool | m_OwnStatus |
gcp::Tool::Tool | ( | gcp::Application * | App, |
std::string | Id | ||
) |
App | the GChemPaint application. |
Id | the name of the tool. |
Constructs a new tool.
virtual gcp::Tool::~Tool | ( | ) | [virtual] |
The destructor.
bool gcp::Tool::Activate | ( | bool | bState | ) |
bState | whether to activate or deactivate the tool. |
When bState is true, the tool is activated, otherwise it is deactivated. Activate() or Deactivate() is called for this instance.
virtual void gcp::Tool::Activate | ( | ) | [virtual] |
Virtual method called when the tool is activated. This method should be overriden for all tools which need some initialization when activated. Default does nothing.
virtual void gcp::Tool::AddSelection | ( | WidgetData * | data | ) | [virtual] |
Called by the framework to paste data. Tools for which it is meaningful must have an overriden version of this method.
virtual bool gcp::Tool::CopySelection | ( | GtkClipboard * | clipboard | ) | [virtual] |
Called by the framework to delete the selection. Tools for which it is meaningful must have an overriden version of this method.
virtual bool gcp::Tool::CutSelection | ( | GtkClipboard * | clipboard | ) | [virtual] |
Called by the framework to copy the selection. Tools for which it is meaningful must have an oveeriden version of this method.
virtual bool gcp::Tool::Deactivate | ( | ) | [virtual] |
Virtual method called when the tool is deactivated. This method should be overriden for all tools which need some cleaning when deactivated. Default does nothing.
virtual bool gcp::Tool::DeleteSelection | ( | ) | [virtual] |
Called by the framework to delete the selection. Tools for which it is meaningful must have an overriden version of this method.
Application* gcp::Tool::GetApplication | ( | void | ) | [inline] |
Gets the Application instance owning the tool.
Definition at line 280 of file tool.h.
References m_pApp.
virtual char const* gcp::Tool::GetHelpTag | ( | ) | [inline, virtual] |
Gets the tag used to display the appropriate help topic when the user presses the help button in the tools box. The framework will prefix the result with the application name. The text tool in GChemPaint returns "text" which becomes "gchempaint-text".
std::string& gcp::Tool::GetName | ( | void | ) | [inline] |
gcp::Tool::GetOwnStatus | ( | void | ) | [inline] |
virtual GtkWidget* gcp::Tool::GetPropertyPage | ( | ) | [virtual] |
Gets the property page for the tool. Called the first time the tool becomes active.
virtual bool gcp::Tool::NotifyViewChange | ( | ) | [virtual] |
Virtual method called by the framework whenthe active view, and hence the active document has changed, so that the tool can finish its current operation in the previously active document and update its options box according to the new active document settings.
virtual void gcp::Tool::OnChangeState | ( | ) | [protected, virtual] |
Called when a modifier key has been pressed or released, and fires a drag event so that the tool can update things if necessary.
Referenced by OnKeyPressed(), and OnKeyReleased().
bool gcp::Tool::OnClicked | ( | View * | pView, |
gcu::Object * | pObject, | ||
double | x, | ||
double | y, | ||
unsigned int | state | ||
) |
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 then calls the virtual OnClicked() method. It might be called to simulate a click in some instances (e.g. from a contextual menu handler).
virtual bool gcp::Tool::OnClicked | ( | ) | [protected, virtual] |
Called from OnClicked(View*,gcu::Object*,double,doubl,unsigned int) when a click occured. This method must be overriden in derived classes, and return true if the drag and release events are meaningful for the tool in the current context. Default implementation does nothing and returns false.
virtual void gcp::Tool::OnConfigChanged | ( | ) | [inline, virtual] |
void gcp::Tool::OnDrag | ( | double | x, |
double | y, | ||
unsigned int | state | ||
) |
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.
virtual void gcp::Tool::OnDrag | ( | ) | [protected, virtual] |
Called from OnDrag(double,double,unsigned int) when a drag event occured occured. This method must be overriden in derived classes if drag events are meaningful for the tool. Default implementation does nothing.
virtual bool gcp::Tool::OnKeyPress | ( | GdkEventKey * | event | ) | [virtual] |
Called by the framework for the active tool when a key press event occurs. Default just returns false.
void gcp::Tool::OnKeyPressed | ( | unsigned int | code | ) | [inline] |
code | the state of the mofifier keys as given inthe state field or some GdkEvent derived structures. |
Called by the framework when a modifier key has been pressed, updates m_nState, and calls Tool::OnChangeState ().
Definition at line 181 of file tool.h.
References m_nState, and OnChangeState().
virtual bool gcp::Tool::OnKeyRelease | ( | GdkEventKey * | event | ) | [virtual] |
Called by the framework for the active tool when a key release event occurs. Default just returns false.
void gcp::Tool::OnKeyReleased | ( | unsigned int | code | ) | [inline] |
code | the state of the mofifier keys as given inthe state field or some GdkEvent derived structures. |
Called by the framework when a modifier key has been released, updates m_nState, and calls Tool::OnChangeState ().
Definition at line 189 of file tool.h.
References m_nState, and OnChangeState().
void gcp::Tool::OnLeaveNotify | ( | View * | pView, |
unsigned int | state | ||
) |
pView | the view instance owning the event. |
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 mouse is moved outside the current view.
virtual void gcp::Tool::OnLeaveNotify | ( | ) | [protected, virtual] |
Called from OnLeaveNotify(gcp::View,unsigned int) when a leave notify event occured. This method must be overriden in derived classes if leave notify events are meaningful for the tool. Default implementation does nothing.
void gcp::Tool::OnMotion | ( | View * | pView, |
gcu::Object * | pObject, | ||
double | x, | ||
double | y, | ||
unsigned int | state | ||
) |
pView | the view instance owning the event. |
pObject | the Object on which the click occured. |
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 not pressed and the mouse is moved.
virtual void gcp::Tool::OnMotion | ( | ) | [protected, virtual] |
Called from OnMotion(gcp::View,double,double,unsigned int) when a motion event occured. This method must be overriden in derived classes if motion events are meaningful for the tool. Default implementation does nothing.
virtual bool gcp::Tool::OnReceive | ( | GtkClipboard * | clipboard, |
GtkSelectionData * | data, | ||
int | type | ||
) | [virtual] |
Called by the framework when clipboard data are available. Tools for which this is meaningful must have an overriden version of this method.
virtual bool gcp::Tool::OnRedo | ( | ) | [virtual] |
Called by the framework when the user requests to redo the last undone change. Tools such as text editing tools for which this is meaningful must have an overriden version of this method.
void gcp::Tool::OnRelease | ( | double | x, |
double | y, | ||
unsigned int | state | ||
) |
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.
virtual void gcp::Tool::OnRelease | ( | ) | [protected, virtual] |
Called from OnRelease(double,double,unsigned int) when a button release event occured. This method must be overriden in derived classes if button release events are meaningful for the tool. Default implementation does nothing.
bool gcp::Tool::OnRightButtonClicked | ( | View * | pView, |
gcu::Object * | pObject, | ||
double | x, | ||
double | y, | ||
gcu::UIManager * | UIManager | ||
) |
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 gcu::UIManager 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(gcu::UIManager*).
virtual bool gcp::Tool::OnRightButtonClicked | ( | gcu::UIManager * | UIManager | ) | [virtual] |
UIManager | the gcu::UIManager 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.
virtual bool gcp::Tool::OnUndo | ( | ) | [virtual] |
Called by the framework when the user requests to undo the last change. Tools such as text editing tools for which this is meaningful must have an overriden version of this method.
virtual bool gcp::Tool::PasteSelection | ( | GtkClipboard * | clipboard | ) | [virtual] |
Called by the framework to cut the selection. Tools for which it is meaningful must have an overriden version of this method.
virtual void gcp::Tool::PushNode | ( | xmlNodePtr | node | ) | [virtual] |
node | an xml node to push on the tools private undo stack. |
Used to store a node after a change while editing a text object by text tools.
bool gcp::Tool::m_bAllowed [protected] |
bool gcp::Tool::m_bChanged [protected] |
double gcp::Tool::m_dZoomFactor [protected] |
gccv::Item* gcp::Tool::m_Item [protected] |
unsigned int gcp::Tool::m_nState [protected] |
The state of modifier keys as a GdkModifierType values combination.
Definition at line 395 of file tool.h.
Referenced by OnKeyPressed(), and OnKeyReleased().
gcp::Tool::m_OwnStatus [protected] |
gcp::Application* gcp::Tool::m_pApp [protected] |
The application owning the tool.
Definition at line 399 of file tool.h.
Referenced by GetApplication().
WidgetData* gcp::Tool::m_pData [protected] |
gcu::Object* gcp::Tool::m_pObject [protected] |
gcu::Object* gcp::Tool::m_pObjectGroup [protected] |
View* gcp::Tool::m_pView [protected] |
GtkWidget* gcp::Tool::m_pWidget [protected] |
double gcp::Tool::m_x [protected] |
double gcp::Tool::m_x0 [protected] |
double gcp::Tool::m_x1 [protected] |
double gcp::Tool::m_y [protected] |
double gcp::Tool::m_y0 [protected] |
double gcp::Tool::m_y1 [protected] |
std::set<std::string> gcp::Tool::ModifiedObjects [protected] |