casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends
casa::QtMouseToolState Class Reference

#include <QtMouseToolState.qo.h>

List of all members.

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

Casarcrc

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

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

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

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


Member Function Documentation

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.).

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::mouseBtnChg ( std::string  tool,
Int  mousebtn 
) [signal]

Notification of a tool's [new] mouse button.

void casa::QtMouseToolState::mouseBtnStateChg ( String  tool,
Int  state 
) [slot]

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().

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().


Friends And Related Function Documentation

friend class QtViewerBase [friend]

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


Member Data Documentation

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 135 of file QtMouseToolState.qo.h.

Referenced by buttonOf().

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.


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