home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.4 KB | 129 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 1 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //=======================================================================
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef COMMANDS_H
- #include "Commands.h" // CPizzaCommand
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k" // command numbers
- #endif
-
- // ----- Framework Layer -----
- #ifndef FWCONTXT_H
- #include "FWContxt.h" // FW_CViewContext
- #endif
-
- #ifndef FWEVENTU_H
- #include "FWEventU.h" // FW_IsCommandKeyPressed
- #endif
-
- // ----- OS Layer -----
- #ifndef FWCFMRES_H
- #include "FWCFMRes.h" // FW_CSharedLibraryResourceFile, FW_gInstance
- #endif
-
- #ifndef FWMENU_H
- #include "FWMenu.h" // FW_CMenuBar, etc.
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h" // FW_CMenuEvent, FW_CMouseEvent
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h" // FW_CRectShape
- #endif
-
- #ifndef FWPICSHP_H
- #include "FWPicShp.h" // FW_PPicture, FW_CPictureShape
- #endif
-
- #ifndef FWRRCSHP_H
- #include "FWRRcShp.h" // FW_CRoundRectShape
- #endif
-
- #ifndef FWCMD_H
- #include "FWCmd.h" // FW_CCommand
- #endif
-
- #include "ShapeB.xh"
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment DataSave
- #endif
-
- FW_DEFINE_AUTO(CDataSaveFrame)
-
- //========================================================================================
- CDataSaveFrame::CDataSaveFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, CDataSaveContent* content)
- : FW_CFrame(ev, odFrame, presentation, content->GetPart(ev)),
- fDataSaveContent(content)
- {
- }
-
- //----------------------------------------------------------------------------------------
- CDataSaveFrame::~CDataSaveFrame()
- {
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CDataSaveFrame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
- {
- FW_UNUSED(ev);
- FW_CPoint where = theMouseEvent.GetMousePosition(ev, FW_CMouseEvent::kFrame);
- this->GetContentView(ev)->FrameToViewContent(ev, where);
- if (::FW_IsShiftKeyPressed()) {
- fDataSaveContent->MyIncrement(ev, where); // no Undo
- }
- else {
- CPizzaCommand* cmd = FW_NEW(CPizzaCommand, (ev, cMakePizzaCmd, this,
- fDataSaveContent, where) );
- cmd->Execute(ev);
- }
- return true;
- }
-
- //----------------------------------------------------------------------------------------
- void
- CDataSaveFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape) // Override
- {
- FW_CViewContext context(ev, this, odFacet, invalidShape);
- FW_CRect invalidRect = FW_GetShapeBoundingBox(ev, invalidShape);
- FW_CRectShape::RenderRect(context, invalidRect, FW_kFill, FW_kRGBLightGray);
- // FW_CRectShape::RenderRect(context, invalidRect, FW_kFill, FW_kWhiteEraseInk);
-
- // draw pizzas
- CPizzaCollection* list = fDataSaveContent->MyGetPizzaList();
- CPizzaCollectionIterator iter(list);
- CPizza* pizza = NULL;
- ODShape* shape = NULL;
- for (pizza = (CPizza*) iter.First(); iter.IsNotComplete(); pizza = (CPizza*) iter.Next()) {
- if (::FW_IsCommandKeyPressed()) {
- FW_CAcquiredODShape rectShape = ::FW_NewODShape(ev, pizza->GetBounds());
- shape = rectShape->Intersect(ev, invalidShape);
- if ( ! shape->IsEmpty(ev) )
- pizza->Draw(context);
- }
- else
- if (invalidRect.IsIntersecting( pizza->GetBounds() ) )
- pizza->Draw(context);
- }
- }
-