rtclick.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *<
00003     FILE: rtclick.h
00004 
00005     DESCRIPTION: Right-click menu functionality
00006 
00007     CREATED BY: Tom Hudson
00008 
00009     HISTORY: Created 14 June 1995
00010 
00011  *> Copyright (c) 1995, All Rights Reserved.
00012  **********************************************************************/
00013 
00014 #pragma once
00015 #include "maxheap.h"
00016 #include "ipoint2.h"
00017 #include "tab.h"
00018 #include "stack.h"
00019 #include "coreexp.h"
00020 #include "strbasic.h"
00021 
00022 const int kMaxMenuEntries = 1000;
00023 
00024 class RightClickMenuManager;
00025 
00034 class RightClickMenu: public MaxHeapOperators {
00035     public:
00037         virtual ~RightClickMenu() {}
00049         virtual void Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m)=0;
00056         virtual void Selected(UINT id)=0;
00057     };
00058 
00059 typedef RightClickMenu* PRightClickMenu;
00060 typedef Tab<PRightClickMenu> PRightClickMenuTab;
00061 
00062 class RCMData: public MaxHeapOperators {
00063     public:
00064         RightClickMenu *menu;
00065         UINT menuId;
00066         UINT managerId;
00067         RCMData() { menu = NULL; menuId = managerId = 0; };
00068         RCMData(RightClickMenu *menu, UINT menuId, UINT managerID);
00069     };
00070 
00071 typedef Tab<RCMData> RCMDataTab;
00072 
00078 class RightClickMenuManager: public MaxHeapOperators {
00079     private:
00080         Stack<HMENU> menuStack;
00081         Tab<HMENU>   allSubMenus;
00082         HMENU theMenu;
00083         PRightClickMenuTab menuTab;
00084         RCMDataTab dataTab;
00085         int index;
00086         int limit;
00087         int startId;
00088     public:
00095         CoreExport void Register(RightClickMenu *menu);
00101         CoreExport void Unregister(RightClickMenu *menu);
00103         CoreExport void Init(HMENU menu, int startId, int limit, HWND hWnd, IPoint2 m);
00107         CoreExport void CleanUp();
00108 
00131         CoreExport int AddMenu(RightClickMenu *menu, UINT flags, UINT id, const MCHAR* data);
00140         CoreExport int BeginSubMenu(const MCHAR* name);
00146         CoreExport int EndSubMenu();
00147 
00149         CoreExport void Process(UINT id);
00150     };
00151