home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.2 KB | 139 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Part.cpp
- // Release Version: $ ODF 2 $
- //
- // Author: Henri Lamiraux
- // Modified by: M.Boetcher to accept Dropped and Pasted sounds
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef SELECT_H
- #include "Select.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef ACTIONS_H
- #include "Actions.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef FWCFMRES_H
- #include "FWCFMRes.h"
- #endif
-
- //========================================================================================
- // Runtime information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfbutton
- #endif
-
- //========================================================================================
- // class CButtonPart
- //========================================================================================
-
- FW_DEFINE_AUTO(CButtonPart)
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::CButtonPart
- //----------------------------------------------------------------------------------------
-
- CButtonPart::CButtonPart(ODPart* odPart) :
- FW_CPart(odPart, FW_gInstance, kPartInfoID)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::~CButtonPart
- //----------------------------------------------------------------------------------------
-
- CButtonPart::~CButtonPart()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::Initialize
- //----------------------------------------------------------------------------------------
-
- void CButtonPart::Initialize(Environment* ev, ODStorageUnit* storageUnit, FW_Boolean fromStorage)
- {
- FW_CPart::Initialize(ev, storageUnit, fromStorage);
-
- // ----- Register our Presentation
- CButtonSelection* selection = FW_NEW(CButtonSelection, (ev, fButtonContent));
- RegisterPresentation(ev, kODFButtonPresentation, TRUE, kButtonView, kButtonView, selection);
-
- // ----- Register our kinds -----
-
- // Sound
- fDataSoundKind = RegisterKind(ev, 'snd ', kODPlatformDataType, FW_kAllStorage, FW_kImport);
- RegisterKind(ev, 'sfil', kODPlatformFileType, FW_kAllStorage, FW_kImport);
-
- // Script
- fDataScriptKind = RegisterKind(ev, 'scpt', kODPlatformDataType, FW_kAllStorage, FW_kImport);
- RegisterKind(ev, 'osas', kODPlatformFileType, FW_kAllStorage, FW_kImport);
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::NewPartContent
- //----------------------------------------------------------------------------------------
-
- FW_CContent* CButtonPart::NewPartContent(Environment* ev)
- {
- fButtonContent = FW_NEW(CButtonContent, (ev, this));
- return fButtonContent;
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::DoSemanticEvent
- //----------------------------------------------------------------------------------------
- void CButtonPart::DoSemanticEvent(Environment* ev,
- FW_CPart* part,
- AEKeyword eventClass,
- AEKeyword eventID,
- const FW_CAppleEvent& event,
- FW_CAppleEvent& reply)
- {
- if (eventClass == kODFButtonSuiteID && eventID == kDoItEventID)
- {
- CAction* action = fButtonContent->GetAction();
- if (action)
- action->DoIt();
- }
- else
- FW_MPartScriptable::HandleSemanticEvent(ev, part, eventClass, eventID, event, reply);
- }
-
- //----------------------------------------------------------------------------------------
- // CButtonPart::NewFrame
- //----------------------------------------------------------------------------------------
-
- FW_CFrame* CButtonPart::NewFrame(Environment* ev,
- ODFrame* frame,
- FW_CPresentation* presentation,
- FW_Boolean storage)
- {
- FW_UNUSED(storage);
- return FW_NEW(CButtonFrame, (ev, frame, presentation, this, fButtonContent));
- }
-