casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
casa::QtMouseToolState Class Reference

#include <QtMouseToolState.qo.h>

Inheritance diagram for casa::QtMouseToolState:

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::Casarcrc
 

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
 

Detailed Description

Synopsis

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.

Constructor & Destructor Documentation

casa::QtMouseToolState::QtMouseToolState ( )
protected

Only QtviewerBase is intended to create/destroy a [single] instance of this class.

casa::QtMouseToolState::~QtMouseToolState ( )
inlineprotected

Definition at line 121 of file QtMouseToolState.qo.h.

Member Function Documentation

int casa::QtMouseToolState::buttonOf ( casacore::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 ( casacore::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 ( casacore::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().

casacore::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 88 of file QtMouseToolState.qo.h.

References toolIndexOnButton_(), and casa::QtMouseToolNames::toolName().

Friends And Related Function Documentation

friend class QtViewerBase
friend

Definition at line 122 of file QtMouseToolState.qo.h.

Member Data Documentation

int casa::QtMouseToolState::mousebtns_[QtMouseToolNames::nTools+1]
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().

casacore::Casarc& casa::QtMouseToolState::rc
protected

Definition at line 116 of file QtMouseToolState.qo.h.

std::map<std::string,int> casa::QtMouseToolState::tool_state
private

Definition at line 143 of file QtMouseToolState.qo.h.


The documentation for this class was generated from the following file: