casa
$Rev:20696$
|
#include <QtMouseToolState.qo.h>
Public Slots | |
void | chgMouseBtn (String tool, Int mousebtn) |
Request reassignment of a given mouse button to a tool. | |
void | mouseBtnStateChg (String tool, Int state) |
void | emitBtns () |
Request signalling of the current mouse button setting for every type of tool. | |
Signals | |
void | mouseBtnChg (std::string tool, Int mousebtn) |
Notification of a tool's [new] mouse button. | |
Public Member Functions | |
Int | buttonOf (String tool) |
Returns button currently assigned to a tool (0 = no button assigned). | |
String | toolOnButton (Int mousebtn) |
Returns name of tool currently assigned to a mouse button (1, 2, or 3). | |
int | getButtonState (const std::string &tool) const |
Protected Member Functions | |
QtMouseToolState () | |
Only QtviewerBase is intended to create/destroy a [single] instance of this class. | |
~QtMouseToolState () | |
Int | toolIndexOnButton_ (Int mousebtn) |
Returns index of tool currently assigned to a mouse button (1, 2, or 3). | |
Protected Attributes | |
Casarc & | rc |
Static Protected Attributes | |
static Int | mousebtns_ [QtMouseToolNames::nTools+1] |
The button currently assigned to the various types of mouse tool. | |
Private Member Functions | |
void | initButtonState (std::string, int) |
void | initToolState () |
Private Attributes | |
std::map< std::string, int > | tool_state |
Friends | |
class | QtViewerBase |
QtMouseToolState records the currently-active mouse button (if any) of each type of Qt mouse tool. There may be a QtMouseToolBar for each QtDisplayPanel (and in principle each may display a different subset of all the possible tools, though this is not implemented yet (7/06)). However, each mouse button (Left, Middle, Right) may be assigned to at most one type of tool type, and that assignment should be the same on each QtMouseToolBar.
To accomplish that, this class signals current button assignments whenever such assignments change. All display panels and/or their mouse tool bars may connect to this signal to keep Toolbar button icons and the actual core library mouse tools (such as MWCZoomer) in sync.
This button state is therefore also essentially global or static, but this class cannot be purely static because it must be a real QObject to send out such a signal. Instead, there should be only one QtMouseToolState object (managed by the [one] QtViewer[Base] object), and all listeners should use that object for setting and responding to current mouse tool button state.
Definition at line 71 of file QtMouseToolState.qo.h.
casa::QtMouseToolState::QtMouseToolState | ( | ) | [protected] |
Only QtviewerBase is intended to create/destroy a [single] instance of this class.
casa::QtMouseToolState::~QtMouseToolState | ( | ) | [inline, protected] |
Definition at line 119 of file QtMouseToolState.qo.h.
Int casa::QtMouseToolState::buttonOf | ( | String | tool | ) | [inline] |
Returns button currently assigned to a tool (0 = no button assigned).
Definition at line 82 of file QtMouseToolState.qo.h.
References mousebtns_, and casa::QtMouseToolNames::toolIndex().
void casa::QtMouseToolState::chgMouseBtn | ( | String | tool, |
Int | mousebtn | ||
) | [slot] |
Request reassignment of a given mouse button to a tool.
NB: This is where guis, etc. should request a button change, so that all stay on the same page (not directly to tool or displaypanel, e.g.).
void casa::QtMouseToolState::emitBtns | ( | ) | [slot] |
Request signalling of the current mouse button setting for every type of tool.
Call this if you want to assure that everyone's up-to-date on mouse button settings.
int casa::QtMouseToolState::getButtonState | ( | const std::string & | tool | ) | const |
void casa::QtMouseToolState::initButtonState | ( | std::string | , |
int | |||
) | [private] |
void casa::QtMouseToolState::initToolState | ( | ) | [private] |
void casa::QtMouseToolState::mouseBtnChg | ( | std::string | tool, |
Int | mousebtn | ||
) | [signal] |
Notification of a tool's [new] mouse button.
void casa::QtMouseToolState::mouseBtnStateChg | ( | String | tool, |
Int | state | ||
) | [slot] |
Int casa::QtMouseToolState::toolIndexOnButton_ | ( | Int | mousebtn | ) | [protected] |
Returns index of tool currently assigned to a mouse button (1, 2, or 3).
(Returns nTools if passed mousebtn is 0 or no tool is assigned to it).
Referenced by toolOnButton().
String casa::QtMouseToolState::toolOnButton | ( | Int | mousebtn | ) | [inline] |
Returns name of tool currently assigned to a mouse button (1, 2, or 3).
(Returns NONE if passed mousebtn is 0 or no tool is assigned to it).
Definition at line 87 of file QtMouseToolState.qo.h.
References toolIndexOnButton_(), and casa::QtMouseToolNames::toolName().
friend class QtViewerBase [friend] |
Definition at line 120 of file QtMouseToolState.qo.h.
Int casa::QtMouseToolState::mousebtns_[QtMouseToolNames::nTools+1] [static, protected] |
The button currently assigned to the various types of mouse tool.
mousebtns_ value Corresp. internal library value
Definition at line 135 of file QtMouseToolState.qo.h.
Referenced by buttonOf().
Casarc& casa::QtMouseToolState::rc [protected] |
Definition at line 114 of file QtMouseToolState.qo.h.
std::map<std::string,int> casa::QtMouseToolState::tool_state [private] |
Definition at line 141 of file QtMouseToolState.qo.h.