home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-26 | 3.6 KB | 132 lines | [TEXT/CWIE] |
- // Copyright © 1995 Apple Computer, Inc. All rights reserved.
- // Release Version: $ 1.0 d11 $
-
- //=======================================================================
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- // ----- Framework Layer -----
- #ifndef FWUTIL_H
- #include "FWUtil.h" // FW_CFacetContext, FW_Beep()
- #endif
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h" // FW_CViewContext
- #endif
-
- // ----- Graphic Includes -----
- #ifndef FWRECT_H
- #include <FWRect.h> // FW_CRect
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h" // FW_CRectShape
- #endif
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Idling
- #endif
-
- //========================================================================================
- FW_DEFINE_AUTO(CIdlingFrame)
-
- //========================================================================================
- CIdlingFrame::CIdlingFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, CIdlingPart* idlingPart)
- : FW_CFrame(ev, odFrame, presentation, idlingPart),
- fIdlingPart(idlingPart),
- fRegionShape(NULL),
- fDrawRed(TRUE)
- {
- fRegionShape = MyCreateRegionShape(ev);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- CIdlingFrame::~CIdlingFrame()
- {
- FW_START_DESTRUCTOR
- delete fRegionShape;
- }
-
- //------------------------------------------------------------------------------
- FW_CRegionShape*
- CIdlingFrame::MyCreateRegionShape(Environment* ev)
- {
- const FW_CPoint kBotRight( FW_IntToFixed(25), FW_IntToFixed(25) );
- const FW_CPoint kOffset( FW_IntToFixed(32), FW_IntToFixed(0) );
- const FW_Fixed kInset = FW_IntToFixed(4);
-
- FW_CRect fwR1(FW_kZeroPoint, kBotRight);
- FW_CAcquiredODShape odR1 = FW_NewODShape (ev, fwR1);
-
- FW_CRect fwR2(fwR1);
- fwR2.Offset(kOffset);
- fwR2.Inset(kInset);
- ODShape* odR2 = FW_NewODShape (ev, fwR2);
-
- odR2->Union(ev, odR1);
- FW_CRegionShape* shp = FW_NEW(FW_CRegionShape, (odR2, FW_kFill) );
- return shp;
- }
-
- //----------------------------------------------------------------------------------------
- void
- CIdlingFrame::MyToggleColor()
- {
- fDrawRed = !fDrawRed;
- if (fDrawRed)
- fRegionShape->GetInk().SetForeColor(FW_kRGBRed);
- else
- fRegionShape->GetInk().SetForeColor(FW_kRGBBlue);
- }
-
- //----------------------------------------------------------------------------------------
- void
- CIdlingFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape) // Override
- {
- FW_CViewContext context(ev, this, odFacet, invalidShape);
- fRegionShape->Render(context);
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CIdlingFrame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
- {
- FW_Boolean handledEvent = false;
- if (theMouseEvent.GetNumberOfClicks(ev) == 2) {
- fIdlingPart->MyToggleIdling(ev);
- handledEvent = true;
- }
- return handledEvent;
- }
-
- //----------------------------------------------------------------------------------------
- ODShape*
- CIdlingFrame::AdjustUsedShape(Environment* ev, ODShape* suggestedUsedShape)
- {
- ODShape* myUsedShape = fRegionShape->GetODShape()->Copy(ev);
- return myUsedShape;
- }
-
- //----------------------------------------------------------------------------------------
- // [HLX] Because OpenDoc uses the Frame shape as the default active shape I need to
- // adjust my active shape too.
- ODShape*
- CIdlingFrame::AdjustActiveShape(Environment* ev, ODFacet* facet, ODShape* suggestedActiveShape)
- {
- suggestedActiveShape->Acquire(ev);
- return suggestedActiveShape;
- }
-
-