00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SOQT_POPUPMENU_H
00027 #define SOQT_POPUPMENU_H
00028
00029 #include <Inventor/SbBasic.h>
00030
00031 #include <Inventor/Qt/SoQtComponent.h>
00032
00033
00034
00035 typedef void SoQtMenuSelectionCallback(int itemid, void * user);
00036
00037 class SOQT_DLL_API SoQtPopupMenu {
00038 public:
00039 static SoQtPopupMenu * createInstance(void);
00040 virtual ~SoQtPopupMenu();
00041
00042 virtual int newMenu(const char * name, int menuid = -1) = 0;
00043 virtual int getMenu(const char * name) = 0;
00044 virtual void setMenuTitle(int id, const char * title) = 0;
00045 virtual const char * getMenuTitle(int id) = 0;
00046
00047 virtual int newMenuItem(const char * name, int itemid = -1) = 0;
00048 virtual int getMenuItem(const char * name) = 0;
00049 virtual void setMenuItemTitle(int itemid, const char * title) = 0;
00050 virtual const char * getMenuItemTitle(int itemid) = 0;
00051 virtual void setMenuItemEnabled(int itemid, SbBool enabled) = 0;
00052 virtual SbBool getMenuItemEnabled(int itemid) = 0;
00053 void setMenuItemMarked(int itemid, SbBool marked);
00054 virtual SbBool getMenuItemMarked(int itemid) = 0;
00055
00056 virtual void addMenu(int menuid, int submenuid, int pos = -1) = 0;
00057 virtual void addMenuItem(int menuid, int itemid, int pos = -1) = 0;
00058 virtual void addSeparator(int menuid, int pos = -1) = 0;
00059 virtual void removeMenu(int menuid) = 0;
00060 virtual void removeMenuItem(int itemid) = 0;
00061
00062 virtual void popUp(QWidget * inside, int x, int y) = 0;
00063
00064 int newRadioGroup(int groupid = -1);
00065 int getRadioGroup(int itemid);
00066 int getRadioGroupSize(int groupid);
00067 void addRadioGroupItem(int groupid, int itemid);
00068 void removeRadioGroupItem(int itemid);
00069
00070
00071
00072
00073 void setRadioGroupMarkedItem(int itemid);
00074 #if SOQT_MAJOR_VERSION == 2
00075 #error fix API above
00076 #endif // SOQT_MAJOR_VERSION
00077
00078 int getRadioGroupMarkedItem(int groupid);
00079
00080 void addMenuSelectionCallback(SoQtMenuSelectionCallback * callback,
00081 void * data);
00082 void removeMenuSelectionCallback(SoQtMenuSelectionCallback * callback,
00083 void * data);
00084
00085 protected:
00086 SoQtPopupMenu(void);
00087
00088 virtual void _setMenuItemMarked(int itemid, SbBool marked) = 0;
00089
00090 void invokeMenuSelection(int itemid);
00091
00092 private:
00093 class SoQtPopupMenuP * pimpl;
00094
00095 };
00096
00097
00098
00099 #endif // ! SOQT_POPUPMENU_H