BALL
1.4.1
|
00001 #ifndef BALL_VIEW_WIDGETS_HOTKEY_TABLE_H 00002 #define BALL_VIEW_WIDGETS_HOTKEY_TABLE_H 00003 00004 #ifndef BALL_VIEW_KERNEL_COMMON_H 00005 # include <BALL/VIEW/KERNEL/common.h> 00006 #endif 00007 00008 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY 00009 # include <BALL/VIEW/KERNEL/preferencesEntry.h> 00010 #endif 00011 00012 #ifndef BALL_VIEW_WIDGETS_PYWIDGET_H 00013 # include <BALL/VIEW/WIDGETS/pyWidget.h> 00014 #endif 00015 00016 #include <QtGui/QTableWidget> 00017 #include <QtGui/QItemDelegate> 00018 00019 namespace BALL 00020 { 00021 namespace VIEW 00022 { 00023 class ComboBoxDelegate 00024 : public QItemDelegate 00025 { 00026 public: 00027 00028 ComboBoxDelegate(QObject* parent = 0); 00029 00030 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 00031 const QModelIndex &index) const; 00032 00033 void setEditorData(QWidget *editor, const QModelIndex &index) const; 00034 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; 00035 00036 void updateEditorGeometry(QWidget *editor, 00037 const QStyleOptionViewItem &option, const QModelIndex &index) const; 00038 private: 00039 00040 QStringList sl_keys_; 00041 QStringList sl_modifier_; 00042 }; 00043 00047 class HotkeyTable 00048 : public QTableWidget, 00049 public PreferencesEntry::ExtendedPreferencesObject 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 00056 enum Modifier 00057 { 00058 NONE = 0, 00059 SHIFT 00060 // ALT // currently not working! 00061 }; 00062 00064 HotkeyTable(QWidget* parent = 0, const char* name = "PythonSettings"); 00065 00067 virtual bool getValue(String& value) const; 00068 00070 virtual bool setValue(const String& value); 00071 00073 std::list<Hotkey> getContent() const; 00074 00076 void setContent(const std::list<Hotkey>& hotkeys); 00077 00078 public slots: 00079 00081 virtual void addEmptyRow(); 00082 00084 virtual void removeSelection(); 00085 00089 virtual void appendHotkey(const String& modif, const String& F_key, 00090 const String& command, String comment = ""); 00091 00092 private: 00093 QStringList modifier_, keys_; 00094 ComboBoxDelegate delegate_; 00095 }; 00096 } 00097 } 00098 00099 #endif //BALL_VIEW_WIDGETS_HOTKEY_TABLE_H