Setting Up MarsPresenter

This code describes the intial setup for menus, and creates the main view.

Initializing submenus

Sets the submenus to Nil.

      // Copyright (C) 1995 Taligent, Inc. All rights reserved.
      TSubMenuItem    *TMarsPresenter::gToolSubMenuItem = NIL;
      TSubMenuItem    *TMarsPresenter::gColorSubMenuItem = NIL;
      TSubMenuItem    *TMarsPresenter::gPenSubMenuItem = NIL;
      TSubMenuItem    *TMarsPresenter::gTextSubMenuItem = NIL;

Version information

      VersionDefinitionsMacro (TMarsPresenter, kOriginalVersion);
      DynamicCastDefinitionsMacroOne (TMarsPresenter,TGUIPresenter);

Constructor

      TMarsPresenter::TMarsPresenter (const TGUIBundle& bundle)
          : TGUIPresenter(bundle), fCanvasView(NIL)
      {
      }

Destructor

      TMarsPresenter::~TMarsPresenter()
      { 
          // don't delete fCanvasView (just hanging onto a reference)
      }

SetCanvasView

      void
      TMarsPresenter::SetCanvasView(TCanvasView* canvasView)
      {
          fCanvasView = canvasView;
      }

Creating the main view

Controls the creation of the main view.
TStandardCanvasView is constructed from a TGUIBundle pointer. The bundle is aliased, not owned.

      TView* TMarsPresenter::HandleCreateMainView (TGUIBundle* theBundleToAlias) const
      {

          // Create and return a TStandardCanvasView on top of a TScrollingView
          TCanvasView *contentView = new TStandardCanvasView (theBundleToAlias);
          contentView->SetAllocatedArea (TGArea(TGRect(0.,0.,500.,400.)));
          ::NonConst((TMarsPresenter*)this)->SetCanvasView(contentView);

          // put everything into a scrolling view
          TScrollingView* scrollingView = new TScrollingView(TScrollingView::kBothScrollbars);
          scrollingView->AdoptViewToScroll(contentView);
          scrollingView->SetAllocatedArea (TGArea(TGRect(0.,0.,350.,300.)));
          
          return scrollingView;
      }

Activating the menu

      void TMarsPresenter::HandleMenuActivate (TMenu& theMainMenu)
      {
          TGUIPresenter::HandleMenuActivate(theMainMenu);
          TMomentaryMenuItem* popup;
          TDeleterFor<TArchive>theArchive = TArchive::CopyArchiveForSharedLibrary();
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker