00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
00020 #define OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
00021
00022
00023
00024
00025
00026
00027 #include <ost/gui/module_config.hh>
00028 #include <ost/gui/scene_win/scene_win_model.hh>
00029
00030 #include <QFlags>
00031 #include <QVector>
00032 #include <QAbstractItemModel>
00033 #include <QTreeView>
00034 namespace ost { namespace gui {
00035
00036 enum ContextActionType
00037 {
00038 GFX_NODE=0x1,
00039 GFX_OBJECT=0x2,
00040 ENTITY=0x4,
00041 ENTITY_VIEW=0x8,
00042 CUSTOM_VIEW=0x10,
00043 NOT_VISIBLE=0x20,
00044 NOT_HIDDEN=0x40,
00045 NOT_SCENE=0x80,
00046 SINGLE=0x100,
00047 MULTI=0x200,
00048 VIEWS_SAME_OBJECT=0x400
00049 #if OST_IMG_ENABLED
00050 ,MAP=0x800,
00051 MAP_ORIGINAL=0x1000,
00052 MAP_DOWNSAMPLED=0x2000,
00053 MAP_DSAMPLED_AVAIL=0x4000
00054 #endif
00055 };
00056
00057 Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType)
00058
00059
00060 class DLLEXPORT_OST_GUI ContextMenu : public QObject {
00061 Q_OBJECT
00062 public:
00063 ContextMenu(QTreeView* view, SceneWinModel* model);
00064 ~ContextMenu(){};
00065
00066 void ShowMenu(const QPoint& pos);
00067 void Rename(QModelIndex index);
00068
00069 void AddAction(QAction* action,ContextActionTypes type);
00070
00071 private slots:
00072 void AddView();
00073 void Rename();
00074 void DeleteView();
00075
00076 private:
00077 QVector<std::pair<QAction*, ContextActionTypes> > actions_;
00078
00079 QTreeView* view_;
00080 SceneWinModel* model_;
00081 };
00082
00083 }}
00084
00085 Q_DECLARE_OPERATORS_FOR_FLAGS(ost::gui::ContextActionTypes)
00086
00087 #endif