BALL::VIEW::MolecularControl Class Reference
[Modular Widgets]

#include <BALL/VIEW/WIDGETS/molecularControl.h>

Inheritance diagram for BALL::VIEW::MolecularControl:
BALL::VIEW::GenericControl BALL::VIEW::DockWidget QDockWidget BALL::VIEW::ModularWidget BALL::Embeddable BALL::VIEW::ConnectionObject

List of all members.


Classes

class  MyTreeWidgetItem

Public Slots

Public slots
void createRepresentation ()
 

Create a Representation with the DisplayProperties Dialog.


void compositeProperties ()
 

Composite properties dialog requested.


void bondProperties ()
 

Bond properties dialog requested.


void checkResidue ()
void buildBonds ()
void centerCamera ()
void countItems ()
 

Count the molecular items and print the info.


void showFilename ()
 

Show the filename from which the composite was loaded.


virtual void updateSelection ()
void highlightSelection ()
void highlight (const List< Composite * > &composite)
void cut ()
void copy ()
void paste ()
void clearClipboard ()
void select ()
void deselect ()
void moveItems ()
 

Move a composite.


void collapseAll ()
 

Collapse all QListViewItem.


void expandAll ()
 

Expand all QListViewItem.


Size applySelector ()
void showSelectorHelp ()
 

Show a help dialog for the Selector.


virtual void deleteCurrentItems ()
 

Overloaded from GenericControl, calls cut.


virtual void clearSelector ()
 

Connected to the clear selection button.


void switchShowSecondaryStructure ()
void showAtomOverview ()
void showAtomOverviewForSelection ()
void showDistance ()
void showAngle ()

Public Member Functions

Constructors and Destructor
 MolecularControl (QWidget *parent=0, const char *name=0)
virtual ~MolecularControl ()
Accessors: inspectors and mutators
virtual void checkMenu (VIEW::MainControl &main_control)
void addComposite (Composite &composite, String given_name="")
Size removeComposite (Composite &composite)
const List< Composite * > & getSelection () const
virtual void onNotify (Message *message)
virtual void updateContextMenu (Composite &composite)
virtual void initializeWidget (MainControl &main_control)
Size applySelector (const String &expression)
void writePreferences (INIFile &inifile)
void fetchPreferences (INIFile &inifile)
void showDistance (Atom *a1, Atom *a2)
void showAngle (Atom *a1, Atom *a2, Atom *a3, Atom *a4=0)

Protected Attributes

List< Composite * > selected_
List< Composite * > copy_list_
MolecularInformation information_
QComboBox * selector_edit_
QComboBox * smarts_edit_
QMenu context_menu_
QMenu model_menu_
QMenu edit_menu_
QMenu color_menu_ [MODEL_LABEL-MODEL_LINES]
Compositecontext_composite_
QTreeWidgetItemcontext_item_
ModelType selected_model_
ColoringMethod selected_coloring_method_
std::map< Composite
*, MyTreeWidgetItem * > 
composite_to_item_
bool was_delete_
Size nr_items_removed_
bool show_ss_
QAction * center_camera_action_
QAction * composite_properties_action_
QAction * bond_propertes_action_
QAction * select_action_
QAction * deselect_action_
QAction * count_items_action_
QAction * atom_overview_
QAction * atom_overview_selection_
QAction * angle_action_
QAction * distance_action_
bool ignore_messages_
Menu entries ids
QAction * cut_id_
QAction * copy_id_
QAction * paste_id_
QAction * delete_id_
QAction * clipboard_id_
QAction * select_id_
QAction * deselect_id_
QAction * show_ss_id_

Private Types

enum  MolecularMenuEntries {
  CREATE_REPRESENTATION, OBJECT__MOVE, SELECT, DESELECT,
  EDIT_MENU, CUT, COPY, DELETE_ENTRY,
  PASTE, CAMERA__CENTER, COMPOSITE__PROPERTIES, COUNT__ITEMS,
  BOND__PROPERTIES, COLLAPSE_ALL, EXPAND_ALL
}

Friends

class BondProperties

Protected members

void showGuestContextMenu (const QPoint &pos)
void activatedItem_ (QAction *action)
void createRepresentation_ ()
void onItemClicked (QTreeWidgetItem *item, int)
void buildContextMenu_ ()
void setSelection_ (bool open, bool force=false)
virtual MolecularInformationgetInformationVisitor_ ()
virtual void recurseGeneration_ (QTreeWidgetItem *item, Composite &composite)
virtual bool reactToMessages_ (Message *message)
QTreeWidgetItemgenerateListViewItem_ (QTreeWidgetItem *parent, Composite &composite, QString *default_name=0)
bool pasteAllowedFor_ (Composite &composite)
void removeRecursive_ (QTreeWidgetItem *item)
 MolecularControl (const MolecularControl &mc)
List< QTreeWidgetItem * > getAllItems_ ()
void enableUpdates_ (bool state)
void newSelection_ (List< Composite * > &sel, bool selected)

Detailed Description

MolecularControl is a widget to display the molecular structure of Composite objects. This class is derived from the class GenericControl and extends it for showing and modifiying molecular structures. The methods checkMenu() and buildContextMenu() are overridden for performing special molecular tasks. MolecularControl has also a QLineEdit to select Composites by BALL expressions. For further informations on this topic have a look at the class Selector.


Member Enumeration Documentation

Enumerator:
CREATE_REPRESENTATION 

create a new Representation

OBJECT__MOVE 
SELECT 
DESELECT 
EDIT_MENU 
CUT 
COPY 
DELETE_ENTRY 
PASTE 
CAMERA__CENTER 

Center camera on one Composite (done in MolecularProperites).

COMPOSITE__PROPERTIES 

Show a dialog with the atom properties.

COUNT__ITEMS 
BOND__PROPERTIES 

Show a dialog with the bond properties.

COLLAPSE_ALL 

Collapse all QListViewItem.

EXPAND_ALL 

Expand all QListViewItem.


Constructor & Destructor Documentation

BALL::VIEW::MolecularControl::MolecularControl ( QWidget parent = 0,
const char *  name = 0 
)

Default Constructor.

Parameters:
parent the parent widget
name the name of this widget
virtual BALL::VIEW::MolecularControl::~MolecularControl (  )  [virtual]

Destructor.

BALL::VIEW::MolecularControl::MolecularControl ( const MolecularControl mc  )  [protected]

Member Function Documentation

void BALL::VIEW::MolecularControl::activatedItem_ ( QAction *  action  )  [protected, slot]
void BALL::VIEW::MolecularControl::addComposite ( Composite composite,
String  given_name = "" 
)

Insert a Composite object into this Control. If name == "" than the Information visitor is used for determining a name for the Composite.

Calls generateListViewItem_() for the Composite.
Parameters:
composite a pointer to the Composite to be inserted into the Control
Size BALL::VIEW::MolecularControl::applySelector (  )  [slot]

Apply the BALL expression from the QLineEdit

Returns:
Size number of selected atoms
Size BALL::VIEW::MolecularControl::applySelector ( const String expression  ) 

Apply a given BALL expression

Returns:
Size number of selected atoms
void BALL::VIEW::MolecularControl::bondProperties (  )  [slot]

Bond properties dialog requested.

void BALL::VIEW::MolecularControl::buildBonds (  )  [slot]

Build bonds

void BALL::VIEW::MolecularControl::buildContextMenu_ (  )  [protected]
void BALL::VIEW::MolecularControl::centerCamera (  )  [slot]

Center the camera on a composite.

virtual void BALL::VIEW::MolecularControl::checkMenu ( VIEW::MainControl main_control  )  [virtual]

Menu checking method. This method is called by MainControl::checkMenus before a popup menu is shown. The copy menu entry is only enabled for selected System objects.

Parameters:
main_control the MainControl object whose menus should be checked
See also:
Control::checkMenu

Reimplemented from BALL::VIEW::ModularWidget.

void BALL::VIEW::MolecularControl::checkResidue (  )  [slot]

Check residues

void BALL::VIEW::MolecularControl::clearClipboard (  )  [slot]

Clear the copied Composite objects from the internal copy list.

virtual void BALL::VIEW::MolecularControl::clearSelector (  )  [virtual, slot]

Connected to the clear selection button.

void BALL::VIEW::MolecularControl::collapseAll (  )  [slot]

Collapse all QListViewItem.

void BALL::VIEW::MolecularControl::compositeProperties (  )  [slot]

Composite properties dialog requested.

void BALL::VIEW::MolecularControl::copy (  )  [slot]

Copy the selected Composite objects into an internal copy list. If there are already Composite objects in the copy list they will be deleted.

void BALL::VIEW::MolecularControl::countItems (  )  [slot]

Count the molecular items and print the info.

void BALL::VIEW::MolecularControl::createRepresentation (  )  [slot]

Create a Representation with the DisplayProperties Dialog.

void BALL::VIEW::MolecularControl::createRepresentation_ (  )  [protected, slot]
void BALL::VIEW::MolecularControl::cut (  )  [slot]

Cut the selected Composite objects and copy them into an internal copy list. If there are already Composite objects in the copy list they will be deleted. All Composite objects that are cutted are removed from the Control. Cuted systems are moved to the copy list. A RemovedCompositeMessage will be sent for each cutted object. After all selected objects are removed a SceneMessage will be sent to update the Scene.

virtual void BALL::VIEW::MolecularControl::deleteCurrentItems (  )  [virtual, slot]

Overloaded from GenericControl, calls cut.

Reimplemented from BALL::VIEW::GenericControl.

void BALL::VIEW::MolecularControl::deselect (  )  [slot]

Deselect

void BALL::VIEW::MolecularControl::enableUpdates_ ( bool  state  )  [protected]
void BALL::VIEW::MolecularControl::expandAll (  )  [slot]

Expand all QListViewItem.

void BALL::VIEW::MolecularControl::fetchPreferences ( INIFile inifile  )  [virtual]

Load settings from an INIFile

See also:
ModularWidget::fetchPreferences

Reimplemented from BALL::VIEW::DockWidget.

QTreeWidgetItem* BALL::VIEW::MolecularControl::generateListViewItem_ ( QTreeWidgetItem parent,
Composite composite,
QString *  default_name = 0 
) [protected]

Generate a new QTreeWidgetItem for the given Composite. If default_name == 0 than a new name is created using the Information visitor accessed with the method getInformationVisitor_(). If parent == 0 than the new QTreeWidgetItem is a root item. Otherwise a new QTreeWidgetItem for is created that will be inserted into given parent. All children of composite will be inserted recursivly into the newly created item by the method recurseGeneration_().

Parameters:
parent a QTreeWidgetItem into which a subtree of items will be inserted, or 0 if a new root item should be created
composite the Composite object whose subtree will be inserted into parent
default_name the name of the item
List<QTreeWidgetItem*> BALL::VIEW::MolecularControl::getAllItems_ (  )  [protected]
virtual MolecularInformation& BALL::VIEW::MolecularControl::getInformationVisitor_ (  )  [protected, virtual]

Access the MolecularInformation visitor. With the MolecularInformation, the names and type entries for the Items are generated. Override this method if another information visitor is needed. This method is used in the method generateListViewItem_() to retrieve certain information of the given Composite.

const List<Composite*>& BALL::VIEW::MolecularControl::getSelection (  )  const

Non-mutable inspection of the selection.

void BALL::VIEW::MolecularControl::highlight ( const List< Composite * > &  composite  )  [slot]
void BALL::VIEW::MolecularControl::highlightSelection (  )  [slot]
virtual void BALL::VIEW::MolecularControl::initializeWidget ( MainControl main_control  )  [virtual]

Initialize the menu entries:

  • cut
  • copy
  • paste
  • delete
  • clear clipboard
    This method is called automatically immediately before the main application is started by MainControl::show.
    Parameters:
    main_control the MainControl object to be initialized with this ModularWidget

Reimplemented from BALL::VIEW::GenericControl.

void BALL::VIEW::MolecularControl::moveItems (  )  [slot]

Move a composite.

void BALL::VIEW::MolecularControl::newSelection_ ( List< Composite * > &  sel,
bool  selected 
) [protected]
void BALL::VIEW::MolecularControl::onItemClicked ( QTreeWidgetItem item,
int   
) [protected, virtual, slot]

Reimplemented from BALL::VIEW::GenericControl.

virtual void BALL::VIEW::MolecularControl::onNotify ( Message message  )  [virtual]

Message handling. Overridden method from ConnectionObject to handle incoming messages.

Calls reactToMessages_().
Parameters:
message a pointer to a Message object

Reimplemented from BALL::VIEW::GenericControl.

void BALL::VIEW::MolecularControl::paste (  )  [slot]

Paste the copied Composite objects from the internal copy list into the Control. For each Composite in the copy list a NewCompositeMessage will be sent.

bool BALL::VIEW::MolecularControl::pasteAllowedFor_ ( Composite composite  )  [protected]
virtual bool BALL::VIEW::MolecularControl::reactToMessages_ ( Message message  )  [protected, virtual]

Message handling. Catch the Message objects and react accordingly to the different messages. Override this method if new messages should be catched.

Note: If this method is overriden, call this method at the end of the new implementation to make sure the old messages are still catched properly.
Messages to be catched and the resulting reaction:
  • NewCompositeMessage - update always necessary
  • RemovedCompositeMessage - update necessary if already inserted
  • ChangedCompositeMessage - update necessary if Composite object has changed
Parameters:
message a pointer to the Message object
Returns:
bool true if an update of the Control is necessary, false otherwise
See also:
onNotify
virtual void BALL::VIEW::MolecularControl::recurseGeneration_ ( QTreeWidgetItem item,
Composite composite 
) [protected, virtual]

Iterate over the children of the Composite and call for each the method generateListViewItem_().

Parameters:
item a pointer to a QTreeWidgetItem to which all children of the Composite will be inserted
composite whose children will be inserted into item
Size BALL::VIEW::MolecularControl::removeComposite ( Composite composite  ) 

Recursive removal of a Composite from the Control.

void BALL::VIEW::MolecularControl::removeRecursive_ ( QTreeWidgetItem item  )  [inline, protected]
void BALL::VIEW::MolecularControl::select (  )  [slot]

Select

void BALL::VIEW::MolecularControl::setSelection_ ( bool  open,
bool  force = false 
) [protected]

Set the selection of the checkboxes and the opening of the tree according to the selection in the MainControl.

Parameters:
open true means, that the item tree is opend and closed according to the changes
force true means, that the item tree is opend and closed also if more than 50 items are selected.
void BALL::VIEW::MolecularControl::showAngle (  )  [slot]
void BALL::VIEW::MolecularControl::showAngle ( Atom a1,
Atom a2,
Atom a3,
Atom a4 = 0 
)
void BALL::VIEW::MolecularControl::showAtomOverview (  )  [slot]
void BALL::VIEW::MolecularControl::showAtomOverviewForSelection (  )  [slot]
void BALL::VIEW::MolecularControl::showDistance (  )  [slot]
void BALL::VIEW::MolecularControl::showDistance ( Atom a1,
Atom a2 
)
void BALL::VIEW::MolecularControl::showFilename (  )  [slot]

Show the filename from which the composite was loaded.

void BALL::VIEW::MolecularControl::showGuestContextMenu ( const QPoint &  pos  )  [protected, virtual, slot]

Reimplemented from BALL::VIEW::DockWidget.

void BALL::VIEW::MolecularControl::showSelectorHelp (  )  [slot]

Show a help dialog for the Selector.

void BALL::VIEW::MolecularControl::switchShowSecondaryStructure (  )  [slot]
virtual void BALL::VIEW::MolecularControl::updateContextMenu ( Composite composite  )  [virtual]

Build a context menu for a Composite. If the Composite has certain properties a context menu is created. This method only creates the necessary interface for derived classes. Override this method for creating other context menu entries, but call Control::buildContextMenu at the end of your method to create the standard entries. Calls insertContextMenuEntry() for each context menu entry that will be created.

Parameters:
composite the Composite object for that a context menu should be created
See also:
onContextMenu
virtual void BALL::VIEW::MolecularControl::updateSelection (  )  [virtual, slot]

Prints the filename from which a Systems was loaded, after its selection.

Calls showFilename()

Reimplemented from BALL::VIEW::GenericControl.

void BALL::VIEW::MolecularControl::writePreferences ( INIFile inifile  )  [virtual]

Write settings to an INIFile

See also:
ModularWidget::writePreferences

Reimplemented from BALL::VIEW::DockWidget.


Friends And Related Function Documentation

friend class BondProperties [friend]

Member Data Documentation

QMenu BALL::VIEW::MolecularControl::color_menu_[MODEL_LABEL-MODEL_LINES] [protected]