contextmenu.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _CONTEXTMENU_H
  2. #define _CONTEXTMENU_H
  3. #include <api/wnd/popup.h>
  4. #include <bfc/common.h>
  5. class DragItem;
  6. class ContextMenuEntry;
  7. class ContextMenuEntryCompare;
  8. class svc_contextCmd;
  9. class ContextMenu : private PopupMenu, private PopupMenuCallback
  10. {
  11. public:
  12. ContextMenu(ifc_window *sourceWnd, DragItem *item, bool autopop=TRUE, const wchar_t *menu_path=NULL);
  13. ContextMenu(ifc_window *sourceWnd, int x, int y, DragItem *item, bool autopop=TRUE, const wchar_t *menu_path=NULL);
  14. virtual ~ContextMenu();
  15. void addDragItem(DragItem *item, const wchar_t *menu_path=NULL);
  16. using PopupMenu::popAtXY;
  17. using PopupMenu::popAtMouse;
  18. using PopupMenu::addCommand;
  19. using PopupMenu::addSeparator;
  20. using PopupMenu::getNumCommands;
  21. protected:
  22. ContextMenu(DragItem *item, const wchar_t *menu_path);
  23. private:
  24. virtual void onPostPop(intptr_t result);
  25. void populate();
  26. virtual PopupMenu *popupMenuCallback(PopupMenu *parent, intptr_t param);
  27. DragItem *item;
  28. StringW menu_path;
  29. PtrList<svc_contextCmd> svclist;
  30. PtrListQuickSorted<ContextMenuEntry, ContextMenuEntryCompare> entries;
  31. };
  32. #endif