Library requirements definitions
File : API\core\tools\toolTypes.h
Namespace : core::tools
//
// Tool's requirements. Each tool might require variouse user input.
//
#define TOOL_REQUIRES_MOUSEL 0x00000001
#define TOOL_REQUIRES_MOUSER 0x00000002
#define TOOL_REQUIRES_MOUSEM 0x00000004
#define TOOL_REQUIRES_MOUSEW 0x00000008
#define TOOL_ALTERNATIVE_BIT 0x10000000
#define TOOL_REQUIRES_LEV_NODE 0x20000000
#define TOOL_REQUIRES_LEV_MANIPULATOR 0x40000000
#define TOOL_ALTERNATIVE(_code) ((_code) | TOOL_ALTERNATIVE_BIT)
#define TOOL_CODEMASK(_code) ((_code) & 0xFFFFFF)
#define IS_ALTERNATE(_code) (TOOL_ALTERNATIVE_BIT == ((_code) & TOOL_ALTERNATIVE_BIT))
#define IS_TOOL_OVERLAP(_c1, _c2) \
((IS_ALTERNATE(_c1) == IS_ALTERNATE(_c2)) && \
(0!=(TOOL_CODEMASK(_c1) & TOOL_CODEMASK(_c2))))
Description
Tool requirements for user input. Or, literally, what tool uses to be applied. Among
mouse button requirements tool can be marked as alternative and will be
applied only when Alt key is held down.
The values above are used as bitwise-or combination ret-val argument in
ITool::requires method to determine whether tool
can be active with other tools selected and to determine whether certain methods
have to be invoked when user interacts in a viewport. For example, tool that uses
only right mouse button (TOOL_REQUIRES_MOUSER) will not be invokedn when user
left-clicks.
Values are
- TOOL_REQUIRES_MOUSEL
- Tool requires interaction with left mouse button. Tool's
apply method is invoked when user left-clicks, or
interactive tool (mouseDown, mouseUp) methods are invoked when left moust button
is pressed or release.
- TOOL_REQUIRES_MOUSER
- Same as TOOL_REQUIRES_MOUSEL but relates to right mouse button.
- TOOL_REQUIRES_MOUSEM
- Same as TOOL_REQUIRES_MOUSEL but relates to middle mouse button.
- TOOL_REQUIRES_MOUSEW
- Tool requires interaction with mouse wheel. Tool have to support
core::tools::IInteractiveTool interface
and mouseWheel method is invoked when
user scrolls mouse wheel.
- TOOL_ALTERNATIVE_BIT
- This bit marks tool as alternative, so tool will act only when Alt key is
held down. Alternative and non-alternative tools do no overlap, so you can have
more tools selected at a time if you consider making some of them alternative wisely.
- TOOL_REQUIRES_LEV_NODE
- Tool requires nodes level to be applied.
When such a tool is selected, ZModeler switchs to nodes level and ZModeler will not
invoke apply method ZModeler is not currently on
nodes level.
- TOOL_REQUIRES_LEV_MANIPULATOR
- Same as TOOL_REQUIRES_LEV_NODE, but manipulators level
is in a subject.
- TOOL_ALTERNATIVE
- Macro is used to add TOOL_ALTERNATIVE_BIT to a tool's requirements value.
- TOOL_ALTERNATIVE_BIT
- Macro is used to determine whether tool is alternative or not.
- TOOL_CODEMASK
- Macro is used to get tool requirements bits and discard hint bits (alternativity
and level requirements).
- IS_TOOL_OVERLAP
- Macro is used to determine whether tool's requirements overlap and tools can't be
selected at the same time.
Example
//-------------------------------------------------------
// @name : CSelectQuadr::requires
// Tool requirements
// @param DWORD& dwRequires : ret-val
//
// @return ZRESULT :
//-------------------------------------------------------
ZRESULT CSelectQuadr::requires(DWORD& dwRequires) const
{
dwRequires = TOOL_REQUIRES_MOUSER;
return ZRESULT_OK;
}
See Also:
- overview of namespace core::tools
- core::tools::ITool interface
- ITool::apply method