home *** CD-ROM | disk | FTP | other *** search
-
- #include <classes/intuition/window.h>
- #include <classes/intuition/screen.h>
- #include <classes/libraries/gadtools.h>
- #include <classes/exec/libraries.h>
-
- class ProjectMenuC : public MenuTitleC {
- public:
- ProjectMenuC();
- protected:
- MenuItemC pNew;
- MenuItemC pOpen;
- MenuSeperatorC pSep1;
- MenuItemC pSave;
- MenuItemC pSaveAs;
- MenuSeperatorC pSep2;
- MenuItemC pAbout;
- MenuSeperatorC pSep3;
- MenuItemC pQuit;
- };
-
- ProjectMenuC::ProjectMenuC()
- : MenuTitleC("Projekt"),
- pNew("Neu",NULL,"N"),
- pOpen("Öffnen...",NULL,"O"),
- pSep1(),
- pSave("Sichern",NULL,"S"),
- pSaveAs("Sichern Als...",NULL,"A"),
- pSep2(),
- pAbout("Über...",NULL,"?"),
- pSep3(),
- pQuit("Beenden...",NULL,"Q")
- {
- add(pNew);
- add(pOpen);
- add(pSep1);
- add(pSave);
- add(pSaveAs);
- add(pSep2);
- add(pAbout);
- add(pSep3);
- add(pQuit);
- }
-
- class TestWindowC : public WindowC {
- public:
- TestWindowC(IDCMPortC &);
- ~TestWindowC();
- private:
- WindowCloseHandlerC wch;
- };
-
- TestWindowC::TestWindowC(IDCMPortC &p)
- : WindowC(p,
- WA_DragBar,TRUE,
- WA_Width,300,
- WA_Height,150,
- WA_CloseGadget,TRUE,
- WA_DepthGadget,TRUE,
- WA_Title,"Fenster mit Menü",
- WA_IDCMP,IDCMP_GADGETUP,
- WA_NewLookMenus,TRUE,
- TAG_END),
- wch(*this)
- {
- addIDCMP(IDCMP_DISKINSERTED|IDCMP_DISKREMOVED);
- }
-
- TestWindowC::~TestWindowC()
- {
- close();
- }
-
- LibraryBaseErrC GadToolsBase("gadtools.library",37);
- LibraryBaseErrC UtilityBase("utility.library",37);
- LibraryBaseErrC CxBase("commodities.library",37);
- LibraryBaseErrC LayersBase("layers.library",37);
- LibraryBaseErrC WorkbenchBase("workbench.library",37);
-
- int main()
- {
- if (!LibraryBaseC::areAllOpen())
- return 20;
-
- // diese Klasse empfängt und verarbeitet alle Signale
- SignalsC sc;
-
- // der IDCMPort für die Fenster
- IDCMPortC port;
- sc.add(port);
-
- // Das Fenster
- TestWindowC window(port);
-
- // noch einen Ctrl C HandlerC zur Sicherheit einhängen
- CtrlCHandlerC ctrlchandler;
- sc.add(ctrlchandler);
-
- // den öffentlichen Standardbildschirm sperren
- PublicScreenC screen(NULL);
- screen.open();
-
- // VisualInfo alloziieren
- VisualInfoC vi(screen);
-
- // Menüleiste alloziieren und ins Fenster einhängen
- MenuC menu(vi);
- ProjectMenuC projectMenu();
- menu.add(projectMenu);
- menu.layout(GTMN_NewLookMenus,TRUE,TAG_END);
- window.setMenuStrip(menu);
-
- // Fenster öffnen
- window.open(
- WA_Left, 20,
- WA_Top, 50,
- WA_AutoAdjust, TRUE,
- WA_PubScreen, screen.screen(),
- TAG_END);
-
- // THE BIG AND EASY ONE!
- sc.loop();
-
- return 0;
- }
-