coloringSettingsDialog.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: coloringSettingsDialog.h,v 1.22.16.1 2007/03/25 21:25:45 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_VIEW_DIALOGS_COLORINGSETTINGSDIALOG_H
00008 #define BALL_VIEW_DIALOGS_COLORINGSETTINGSDIALOG_H
00009 
00010 #ifndef BALL_COMMON_GLOBAL_H
00011 # include <BALL/COMMON/global.h>
00012 #endif
00013 
00014 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY
00015 # include <BALL/VIEW/KERNEL/preferencesEntry.h>
00016 #endif
00017 
00018 #ifndef BALL_VIEW_KERNEL_COMMON_H
00019 # include <BALL/VIEW/KERNEL/common.h>
00020 #endif
00021 
00022 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00023 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00024 #endif 
00025 
00026 #include <BALL/VIEW/UIC/ui_coloringSettingsDialog.h>
00027 
00028 #include <QtGui/QTableWidget>
00029 #include <vector>
00030       
00031 namespace BALL
00032 {
00033   class PTE;
00034 
00035   namespace VIEW
00036   {
00037     class ColorProcessor;
00038 
00042     class BALL_VIEW_EXPORT QColorTable
00043       : public QTableWidget,
00044         public PreferencesEntry::ExtendedPreferencesObject
00045     {
00046         Q_OBJECT
00047 
00048       public:
00049         QColorTable(QWidget* parent = 0, const char* name = 0);
00050         
00051         void setNamesTitle(const String& string);
00052 
00053         String getNamesTitle() const;
00054         
00055         void setContent(const vector<String>& names, const vector<ColorRGBA>& colors);
00056 
00057         void setColors(const vector<ColorRGBA>& colors);
00058 
00059         const vector<ColorRGBA>& getColors() const
00060           { return colors_;}
00061 
00062         const vector<String>& getNames() const
00063           { return names_;}
00064 
00066         virtual bool getValue(String&) const;
00067 
00069         virtual bool setValue(const String& value);
00070 
00071       private slots:
00072         
00073         void beginEdit(int row, int col);
00074 
00075         virtual void mousePressEvent(QMouseEvent* event);
00076         
00077       private:
00078         vector<ColorRGBA> colors_;
00079         vector<String>    names_;
00080         bool              setting_content_;
00081     };
00082 
00083 
00088     class BALL_VIEW_EXPORT ColoringSettingsDialog 
00089       : public QWidget,
00090         public Ui_ColoringSettingsDialogData,
00091         public PreferencesEntry
00092     { 
00093       Q_OBJECT
00094 
00095       public:
00096 
00098       ColoringSettingsDialog( QWidget* parent = 0, const char* name = "ColoringSettings", Qt::WFlags fl = 0 );
00099 
00101       virtual ~ColoringSettingsDialog() {}
00102 
00104       virtual void applySettingsTo(ColorProcessor& cp) const;
00105 
00107       virtual ColorProcessor* createColorProcessor(ColoringMethod method) const
00108         throw(Exception::InvalidOption);
00109 
00111       virtual void getSettings(const ColorProcessor& cp);
00112 
00114       virtual QWidget* getEntryFor(ColoringMethod method);
00115 
00117       virtual vector<ColorRGBA> getColors(ColoringMethod method) const;
00118 
00119       protected slots:
00120 
00121       void middleResidueColorPressed()  { chooseColor(middle_residue_label); }
00122       void lastResidueColorPressed()    { chooseColor(last_residue_label); }
00123       void firstResidueColorPressed()   { chooseColor(first_residue_label); }
00124 
00125       void negativeChargeColorPressed() { chooseColor(negative_charge_label); }
00126       void neutralChargeColorPressed()  { chooseColor(neutral_charge_label); }
00127       void positiveChargeColorPressed() { chooseColor(positive_charge_label);}
00128       
00129       void nullDistanceColorPressed()   { chooseColor(null_distance_label); }
00130       void maxDistanceColorPressed()    { chooseColor(max_distance_label); }
00131       
00132       void minimumTFColorPressed()      { chooseColor(minimum_tf_label); }
00133       void maximumTFColorPressed()      { chooseColor(maximum_tf_label); }
00134       void unassignedTFColorPressed()   { chooseColor(unassigned_tf_label); }
00135       
00136       void minimumOccupancyColorPressed()     { chooseColor(minimum_o_label); }
00137       void maximumOccupancyColorPressed()     { chooseColor(maximum_o_label); }
00138       void unassignedOccupancyColorPressed()  { chooseColor(unassigned_o_label); }
00139       
00140       void helixColorPressed()    { chooseColor(helix_color_label); }
00141       void turnColorPressed()     { chooseColor(turn_color_label); }
00142       void strandColorPressed()   { chooseColor(strand_color_label);}
00143       void coilColorPressed()     { chooseColor(coil_color_label); }
00144       
00145       void forceMaxColorPressed() { chooseColor(force_max_color_label); }
00146       void forceMinColorPressed() { chooseColor(force_min_color_label); }
00147       
00148       // residue types ===============================
00149       void acidicColorPressed()       { chooseColor(acidic_color_label); }
00150       void aromaticColorPressed()     { chooseColor(aromatic_color_label); }
00151       void basicColorPressed()        { chooseColor(basic_color_label); }
00152       void otherColorPressed()        { chooseColor(other_color_label); }
00153       void polarColorPressed()        { chooseColor(polar_color_label); }
00154       void hydrophobicColorPressed()  { chooseColor(hydrophobic_color_label); }
00155       // ---------------------------------------------
00156 
00157       virtual void maxDistanceChanged();
00158       virtual void maxTFChanged();
00159       virtual void forceMaxValueChanged();
00160       virtual void forceMinValueChanged();
00161 
00162       protected:
00163 
00164       virtual void setDefaultValues_();
00165 
00166       QColorTable* element_table_;
00167       QColorTable* residue_table_;
00168       QColorTable* chain_table_;
00169       QColorTable* molecule_table_;
00170     };
00171 
00172 } }
00173 
00174 #endif