/**** * * Class FileMenu is the companion view to the File model class. The FileMenu * window is an InterViews PullDownMenu. * * Classes NewMenuItem, OpenMenuItem, SaveMenuItem, SaveAsMenuItem, * PrintMenuItem, and QuitMenuItem specialize InterViews MenuItem to define the * items on the FileMenu window. * */ #ifndef filemenuIncluded #define filemenuIncluded #include "file.h" #include "view.h" #include class FileMenu : public View { public: FileMenu(Name* n, File* f); /* * Construct this with the given name as the pulldown label. The given * File is the companion model. */ ~FileMenu(); /* * Deep destruct this by deleting all of its items. */ virtual void Compose(); /* * Compose this by inserting each of its six menu items -- New, Open, Save, * SaveAs, Print, and Quit -- into the pulldown menu window. */ protected: File* f; // Companion model (downcast version of this->m) PulldownMenu* pm; // For convenience, downcast version of this->w }; class NewMenuItem : public MenuItem { public: NewMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the New model * function. */ File* f; // The compnion model }; class OpenMenuItem : public MenuItem { public: OpenMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the Open model * function. */ File* f; // The compnion model }; class SaveMenuItem : public MenuItem { public: SaveMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the Save model * function. */ File* f; // The compnion model }; class SaveAsMenuItem : public MenuItem { public: SaveAsMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the SaveAs model * function. */ File* f; // The compnion model }; class PrintMenuItem : public MenuItem { public: PrintMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the Print model * function. */ File* f; // The compnion model }; class QuitMenuItem : public MenuItem { public: QuitMenuItem(File* f); /* * Construct this with the given File model. */ protected: virtual void Do(); /* * Respond to the selection of this menu item by calling the Quit model * function. */ /** * Data members. */ File* f; // The compnion model (downcast copy of this->m) PulldownMenu* pm; // The window (Downcast copy of this->w) }; #endif