API reference - Class PluginNotation used in Ruby API documentation Description: The plugin object This class provides the actual plugin implementation. Each view gets it's own instance of the plugin class. The plugin factory PluginFactory class must be specialized to provide a factory for new objects of the Plugin class. See the documentation there for details about the plugin mechanism and the basic concepts. This class has been introduced in version 0.22. Public constructors
Public methods
Detailed description[virtual] void activatedDescription: Gets called when the plugin is activated (selected in the tool bar) [const] void assign(const Plugin other)Description: Assign the contents of another object to self This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content. [virtual] void config_finalizeDescription: Sends the post-configuration request to the plugin After all configuration parameters have been sent, 'config_finalize' is called to given the plugin a chance to update it's internal state according to the new configuration. [virtual] bool configure(string name,string value)Description: Sends configuration requests to the plugin
When a configuration variable is changed, the new value is reported to the plugin by calling the 'configure' method. void createDescription: Ensures the C++ object is created Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created. [virtual] void deactivatedDescription: Gets called when the plugin is deactivated and another plugin is activated void destroyDescription: Explicitly destroy the object Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing. [const] bool destroyed?Description: Returns a value indicating whether the object was already destroyed This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself. [virtual] void drag_cancelDescription: Gets called on various occasions when a drag operation should be canceled If the plugin implements some press-and-drag or a click-and-drag operation, this callback should cancel this operation and return in some state waiting for a new mouse event. [const] Plugin dupDescription: Creates a copy of self [virtual] bool enter_event(bool prio)Description: Handles the enter event (mouse enters canvas area of view) The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse enters the canvas area. This method does not have a position nor button flags. void grab_mouseDescription: Redirects mouse events to this plugin, even if the plugin is not active. [const] bool is_const_object?Description: Returns a value indicating whether the reference is a const reference This method returns true, if self is a const reference. In that case, only const methods may be called on self. [virtual] bool key_event(unsigned int key,unsigned int buttons)Description: Handles the key pressed event
This method will called by the view on the active plugin when a button is pressed on the mouse. If the plugin handles the event, it should return true to indicate that the event should not be processed further. [virtual] bool leave_event(bool prio)Description: Handles the leave event (mouse leaves canvas area of view) The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse leaves the canvas area. This method does not have a position nor button flags. [virtual] void menu_activated(string symbol)Description: Gets called when a custom menu item is selected When a menu item is clicked which was registered with the plugin factory, the plugin's 'menu_activated' method is called for the current view. The symbol registered for the menu item is passed in the 'symbol' argument. [virtual] bool mouse_button_pressed_event(const DPoint p,unsigned int buttons,bool prio)Description: Handles the mouse button pressed event
This method will called by the view when a button is pressed on the mouse. First, the plugins that grabbed the mouse with grab_mouse will receive this event with 'prio' set to true in the reverse order the plugins grabbed the mouse. The loop will terminate if one of the mouse event handlers returns true. If that is not the case or no plugin has grabbed the mouse, the active plugin receives the mouse event with 'prio' set to true. If no receiver accepted the mouse event by returning true, it is sent again to all plugins with 'prio' set to false. Again, the loop terminates if one of the receivers returns true. The second pass gives inactive plugins a chance to monitor the mouse and implement specific actions - i.e. displaying the current position. This event is not sent immediately when the mouse button is pressed but when a signification movement for the mouse cursor away from the original position is detected. If the mouse button is released before that, a mouse_clicked_event is sent rather than a press-move-release sequence. [virtual] bool mouse_button_released_event(const DPoint p,unsigned int buttons,bool prio)Description: Handles the mouse button release event The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse button is released. [virtual] bool mouse_click_event(const DPoint p,unsigned int buttons,bool prio)Description: Handles the mouse button click event (after the button has been released) The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse button has been released without moving it. [virtual] bool mouse_double_click_event(const DPoint p,unsigned int buttons,bool prio)Description: Handles the mouse button double-click event The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse button has been double-clicked. [virtual] bool mouse_moved_event(const DPoint p,unsigned int buttons,bool prio)Description: Handles the mouse move event The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse is moved in the canvas area. [static] Plugin newDescription: Creates a new object of this class void set_cursor(int cursor_type)Description: Sets the cursor in the view area to the given type Setting the cursor has an effect only inside event handlers, i.e. mouse_press_event. The cursor is not set permanently. Is is reset in the mouse move handler unless a button is pressed or the cursor is explicitly set again in the mouse_move_event. The cursor type is one of the cursor constants in the Cursor class, i.e. 'CursorArrow' for the normal cursor. void ungrab_mouseDescription: Removes a mouse grab registered with grab_mouse. [virtual] void updateDescription: Gets called when the view has changed This method is called in particular if the view has changed the visible rectangle, i.e. after zooming in or out or panning. This callback can be used to update any internal states that depend on the view's state. [virtual] bool wheel_event(int delta,bool horizontal,const DPoint p,unsigned int buttons,bool prio)Description: The behaviour of this callback is the same than for mouse_press_event, except that it is called when the mouse wheel is rotated. Additional parameters for this event are 'delta' (the rotation angle in units of 1/8th degree) and 'horizontal' which is true when the horizontal wheel was rotated and false if the vertical wheel was rotated. |