00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef INSTIGATE_TOOLKIT_QT_EVENT_HANDLERS
00011 #define INSTIGATE_TOOLKIT_QT_EVENT_HANDLERS
00012
00022
00023 #include "window.hpp"
00024
00025
00026
00027
00028 #include <QObject>
00029
00030
00031
00032 namespace instigate {
00033 namespace toolkit {
00034 class qt_event_handler;
00035 }
00036 }
00037
00041 class instigate::toolkit::qt_event_handler
00042 : public QObject
00043 {
00044 Q_OBJECT
00045
00046 window::callback* m_callback;
00047 window::qt_tree_view* m_tree_view;
00048
00050 public slots:
00051
00052 void call() throw()
00053 {
00054 m_callback->call();
00055 }
00056
00057 void on_expanded(const QModelIndex& m) throw()
00058 {
00059 QStandardItem* i = m_tree_view->m_tree_model->
00060 itemFromIndex(m);
00061 assert(0 != i);
00062 window::qt_tree_view::tree_row_paths::const_iterator j =
00063 m_tree_view->m_tree_row_paths.find(i);
00064 assert(m_tree_view->m_tree_row_paths.end() != j);
00065 m_tree_view->m_last_expanded_row = j->second;
00066 }
00067
00068 void on_collapsed(const QModelIndex& m) throw()
00069 {
00070 QStandardItem* i = m_tree_view->m_tree_model->
00071 itemFromIndex(m);
00072 assert(0 != i);
00073 window::qt_tree_view::tree_row_paths::const_iterator j =
00074 m_tree_view->m_tree_row_paths.find(i);
00075 assert(m_tree_view->m_tree_row_paths.end() != j);
00076 m_tree_view->m_last_collapsed_row = j->second;
00077 }
00078
00080 public:
00081 qt_event_handler(window::callback* c) throw()
00082 : m_callback(c)
00083 , m_tree_view(0)
00084 {}
00085
00086 qt_event_handler(window::qt_tree_view* t) throw()
00087 : m_callback(0)
00088 , m_tree_view(t)
00089 {}
00090
00091 };
00092
00093
00094
00095 #endif // INSTIGATE_TOOLKIT_QT_EVENT_HANDLERS
00096