Class: ModraUp::Tools
- Inherits:
-
Object
- Object
- ModraUp::Tools
Overview
Model tool manager. Obtain it from ModraUp::Model#tools. Ruby custom tool protocol see ModraUp::Tool.
Instance Method Summary # collapse
-
#add_observer(observer) ⇒ Boolean
Register ModraUp::ToolsObserver. Adding the same object a second time returns false.
-
#remove_observer(observer) ⇒ Boolean
Remove tool observers.
-
#active_tool ⇒ Object, nil
The current Ruby tool activated by ModraUp::Model#select_tool (protocol see ModraUp::Tool). Built-in C tools are nil.
-
#push_tool(tool) ⇒ true
Push the Ruby tool to the top of the stack, saving the current Ruby or built-in tool. If the Ruby tool implements suspend(view), it will be suspended.
-
#pop_tool ⇒ Object, nil
Pop the current Ruby tool, restoring the stack to the previous Ruby or built-in tool; the Ruby tool will receive resume. Returns the popped Ruby tool. Returns nil if the current tool is built-in, and nil if the stack is empty, reverting to the select tool.
-
#active_tool_id ⇒ Integer
Current tool ID. The Ruby tool ID is 0. Built-in tools use SketchUp common IDs (select 21022, move 21048, scale 21236, etc.).
-
#active_tool_name ⇒ String
The current tool name. Ruby tools are named after their class names, while built-in tools are named in English.
-
#model ⇒ ModraUp::Model
This tool manager belongs to the model.
Instance Method Details
tools.add_observer(observer) ⇒ Boolean
Register ModraUp::ToolsObserver. Adding the same object a second time returns false. The cut tool dispatches onActiveToolChanged(tools, tool_name, tool_id); for a start state of 1 and end state of 0, the move/scale gesture dispatches onToolStateChanged.
tools.remove_observer(observer) ⇒ Boolean
Remove tool observers.
tools.active_tool ⇒ Object, nil
The current Ruby tool activated by ModraUp::Model#select_tool (protocol see ModraUp::Tool). Built-in C tools are nil.
tools.push_tool(tool) ⇒ true
Push the Ruby tool to the top of the stack, saving the current Ruby or built-in tool. If the Ruby tool implements suspend(view), it will be suspended.
tools.pop_tool ⇒ Object or nil
Pop the current Ruby tool, restoring the stack to the previous Ruby or built-in tool; the Ruby tool will receive resume. Returns the popped Ruby tool. Returns nil if the current tool is built-in, and nil if the stack is empty, reverting to the select tool.
tools.active_tool_id ⇒ Integer
Current tool ID. The Ruby tool ID is 0. Built-in tools use SketchUp common IDs (select 21022, move 21048, scale 21236, etc.).
tools.active_tool_name ⇒ String
The current tool name. Ruby tools are named after their class names, while built-in tools are named in English.
tools.model ⇒ ModraUp::Model
This tool manager belongs to the model.