Notation used in Ruby API documentation
Module: lay
Description: The plugin object
This class provides the actual plugin implementation. Each view gets its 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.
new Plugin ptr | new | Creates a new object of this class |
[const] | Plugin ptr | _const_cast | Returns a non-const reference to self. | |
void | _create | Ensures the C++ object is created | ||
void | _destroy | Explicitly destroys the object | ||
[const] | bool | _destroyed? | Returns a value indicating whether the object was already destroyed | |
[const] | bool | _is_const_object? | Returns a value indicating whether the reference is a const reference | |
void | _manage | Marks the object as managed by the script side. | ||
void | _unmanage | Marks the object as no longer owned by the script side. | ||
[virtual] | void | activated | Gets called when the plugin is activated (selected in the tool bar) | |
[virtual] | void | config_finalize | Sends the post-configuration request to the plugin | |
[virtual] | bool | configure | (string name, string value) | Sends configuration requests to the plugin |
[virtual] | void | deactivated | Gets called when the plugin is deactivated and another plugin is activated | |
[virtual] | void | drag_cancel | Gets called on various occasions when a drag operation should be canceled | |
[virtual] | bool | enter_event | (bool prio) | Handles the enter event (mouse enters canvas area of view) |
void | grab_mouse | Redirects mouse events to this plugin, even if the plugin is not active. | ||
[virtual,const] | bool | has_tracking_position | Gets a value indicating whether the plugin provides a tracking position | |
[virtual] | bool | key_event | (unsigned int key, unsigned int buttons) | Handles the key pressed event |
[virtual] | bool | leave_event | (bool prio) | Handles the leave event (mouse leaves canvas area of view) |
[virtual] | void | menu_activated | (string symbol) | Gets called when a custom menu item is selected |
[virtual] | bool | mouse_button_pressed_event | (DPoint p, unsigned int buttons, bool prio) | Handles the mouse button pressed event |
[virtual] | bool | mouse_button_released_event | (DPoint p, unsigned int buttons, bool prio) | Handles the mouse button release event |
[virtual] | bool | mouse_click_event | (DPoint p, unsigned int buttons, bool prio) | Handles the mouse button click event (after the button has been released) |
[virtual] | bool | mouse_double_click_event | (DPoint p, unsigned int buttons, bool prio) | Handles the mouse button double-click event |
[virtual] | bool | mouse_moved_event | (DPoint p, unsigned int buttons, bool prio) | Handles the mouse move event |
void | set_cursor | (int cursor_type) | Sets the cursor in the view area to the given type | |
[virtual,const] | DPoint | tracking_position | Gets the tracking position | |
void | ungrab_mouse | Removes a mouse grab registered with grab_mouse. | ||
[virtual] | void | update | Gets called when the view has changed | |
[virtual] | bool | wheel_event | (int delta, bool horizontal, DPoint p, unsigned int buttons, bool prio) |
void | create | Use of this method is deprecated. Use _create instead | ||
void | destroy | Use of this method is deprecated. Use _destroy instead | ||
[const] | bool | destroyed? | Use of this method is deprecated. Use _destroyed? instead | |
[const] | bool | is_const_object? | Use of this method is deprecated. Use _is_const_object? instead |
_const_cast | Signature: [const] Plugin ptr _const_cast Description: Returns a non-const reference to self. Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects. This method has been introduced in version 0.29.6. | ||||||
_create | Signature: void _create Description: 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. | ||||||
_destroy | Signature: void _destroy Description: Explicitly destroys the object Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing. | ||||||
_destroyed? | Signature: [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. | ||||||
_is_const_object? | Signature: [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. | ||||||
_manage | Signature: void _manage Description: Marks the object as managed by the script side. After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required. Usually it's not required to call this method. It has been introduced in version 0.24. | ||||||
_unmanage | Signature: void _unmanage Description: Marks the object as no longer owned by the script side. Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur. Usually it's not required to call this method. It has been introduced in version 0.24. | ||||||
activated | Signature: [virtual] void activated Description: Gets called when the plugin is activated (selected in the tool bar) | ||||||
config_finalize | Signature: [virtual] void config_finalize Description: 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 its internal state according to the new configuration. | ||||||
configure | Signature: [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. | ||||||
create | Signature: void create Description: Ensures the C++ object is created Use of this method is deprecated. Use _create instead 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. | ||||||
deactivated | Signature: [virtual] void deactivated Description: Gets called when the plugin is deactivated and another plugin is activated | ||||||
destroy | Signature: void destroy Description: Explicitly destroys the object Use of this method is deprecated. Use _destroy instead Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing. | ||||||
destroyed? | Signature: [const] bool destroyed? Description: Returns a value indicating whether the object was already destroyed Use of this method is deprecated. Use _destroyed? instead 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. | ||||||
drag_cancel | Signature: [virtual] void drag_cancel Description: 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. | ||||||
enter_event | Signature: [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. | ||||||
grab_mouse | Signature: void grab_mouse Description: Redirects mouse events to this plugin, even if the plugin is not active. | ||||||
has_tracking_position | Signature: [virtual,const] bool has_tracking_position Description: Gets a value indicating whether the plugin provides a tracking position The tracking position is shown in the lower-left corner of the layout window to indicate the current position. If this method returns true for the active service, the application will fetch the position by calling tracking_position rather than displaying the original mouse position. This method has been added in version 0.27.6. | ||||||
is_const_object? | Signature: [const] bool is_const_object? Description: Returns a value indicating whether the reference is a const reference Use of this method is deprecated. Use _is_const_object? instead This method returns true, if self is a const reference. In that case, only const methods may be called on self. | ||||||
key_event | Signature: [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. | ||||||
leave_event | Signature: [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. | ||||||
menu_activated | Signature: [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. | ||||||
mouse_button_pressed_event | Signature: [virtual] bool mouse_button_pressed_event (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. | ||||||
mouse_button_released_event | Signature: [virtual] bool mouse_button_released_event (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. | ||||||
mouse_click_event | Signature: [virtual] bool mouse_click_event (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. | ||||||
mouse_double_click_event | Signature: [virtual] bool mouse_double_click_event (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. | ||||||
mouse_moved_event | Signature: [virtual] bool mouse_moved_event (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. | ||||||
new | Signature: [static] new Plugin ptr new Description: Creates a new object of this class Python specific notes: | ||||||
set_cursor | Signature: 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. | ||||||
tracking_position | Signature: [virtual,const] DPoint tracking_position Description: Gets the tracking position See has_tracking_position for details. This method has been added in version 0.27.6. | ||||||
ungrab_mouse | Signature: void ungrab_mouse Description: Removes a mouse grab registered with grab_mouse. | ||||||
update | Signature: [virtual] void update Description: 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. | ||||||
wheel_event | Signature: [virtual] bool wheel_event (int delta, bool horizontal, 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. |