casa
5.7.0-16
|
#include <QtMouseToolState.qo.h>
Public Slots | |
void | chgMouseBtn (casacore::String tool, int mousebtn) |
Request reassignment of a given mouse button to a tool. More... | |
void | mouseBtnStateChg (casacore::String tool, int state) |
void | emitBtns () |
Request signalling of the current mouse button setting for every type of tool. More... | |
Signals | |
void | mouseBtnChg (std::string tool, int mousebtn) |
Notification of a tool's [new] mouse button. More... | |
Public Member Functions | |
int | buttonOf (casacore::String tool) |
Returns button currently assigned to a tool (0 = no button assigned). More... | |
casacore::String | toolOnButton (int mousebtn) |
Returns name of tool currently assigned to a mouse button (1, 2, or 3). More... | |
int | getButtonState (const std::string &tool) const |
Protected Member Functions | |
QtMouseToolState () | |
Only QtviewerBase is intended to create/destroy a [single] instance of this class. More... | |
~QtMouseToolState () | |
int | toolIndexOnButton_ (int mousebtn) |
Returns index of tool currently assigned to a mouse button (1, 2, or 3). More... | |
Protected Attributes | |
casacore::Casarc & | rc |
Static Protected Attributes | |
static int | mousebtns_ [QtMouseToolNames::nTools+1] |
The button currently assigned to the various types of mouse tool. More... | |
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.
|
protected |
Only QtviewerBase is intended to create/destroy a [single] instance of this class.
|
inlineprotected |
Definition at line 121 of file QtMouseToolState.qo.h.
|
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().
|
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.).
|
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 |
|
private |
|
private |
|
signal |
Notification of a tool's [new] mouse button.
|
slot |
|
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().
|
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 88 of file QtMouseToolState.qo.h.
References toolIndexOnButton_(), and casa::QtMouseToolNames::toolName().
|
friend |
Definition at line 122 of file QtMouseToolState.qo.h.
|
staticprotected |
The button currently assigned to the various types of mouse tool.
mousebtns_ value Corresp. internal library value
0: <no button>=""> Display::K_None 1: LeftButton Display::K_Pointer_Button1 2: MidButton Display::K_Pointer_Button2 3: RightButton Display::K_Pointer_Button3
Definition at line 137 of file QtMouseToolState.qo.h.
Referenced by buttonOf().
|
protected |
Definition at line 116 of file QtMouseToolState.qo.h.
|
private |
Definition at line 143 of file QtMouseToolState.qo.h.