home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.5 KB | 136 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
- #endif
-
- #ifndef FWCONTXT_H
- #include "FWContxt.h" // FW_CViewContext
- #endif
-
- #ifndef FWEVEDEF_H
- #include "FWEveDef.h" // FW_RIGHT
- #endif
-
- // ----- Graphic Includes -----
- #ifndef FWRECT_H
- #include <FWRect.h> // FW_CRect
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h" // FW_CRectShape
- #endif
-
- // -------
- #ifndef SLMIXCOS_H
- #include "SLMixOS.h" // FW_Beep
- #endif
-
- //========================================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Events
- #endif
-
- //========================================================================================
- FW_DEFINE_AUTO(CEventsFrame)
-
- //========================================================================================
- CEventsFrame::CEventsFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, CEventsPart* eventsPart)
- : FW_CFrame(ev, odFrame, presentation, eventsPart)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- CEventsFrame::~CEventsFrame()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- void
- CEventsFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape) // Override
- {
- FW_CViewContext context(ev, this, odFacet, invalidShape);
- FW_CRect frameRect = this->GetBounds(ev);
-
- // fill frame with green
- FW_CRectShape rectShape(frameRect, FW_kFill);
- rectShape.GetInk().SetForeColor(FW_kRGBGreen);
- rectShape.Render(context);
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CEventsFrame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
- {
- FW_UNUSED(ev);
- FW_Boolean handledEvent = FALSE;
-
- // get position of mouse click in case you need it
- FW_CPoint position = theMouseEvent.GetMousePosition(ev, FW_CMouseEvent::kFrame);
- this->GetContentView(ev)->FrameToViewContent(ev, position);
- // use mouse position here if you need it
-
- // check for triple-clicks
- if (theMouseEvent.GetNumberOfClicks(ev) == 3) {
- FW_Beep();
- handledEvent = TRUE;
- }
- return handledEvent;
- }
-
- //----------------------------------------------------------------------------------------
- FW_Boolean
- CEventsFrame::DoCharKey(Environment* ev, const FW_CCharKeyEvent& event)
- {
- FW_Boolean handledEvent = FALSE;
- char c = event.GetChar(ev);
- if (c == 'b') {
- FW_Beep(); // do something with the character
- handledEvent = TRUE;
- }
- return handledEvent;
- }
-
- //--------------------------------------------------------------------------------------
- FW_Boolean
- CEventsFrame::DoVirtualKey(Environment* ev,
- const FW_CVirtualKeyEvent& theVirtualKeyEvent)
- {
- FW_Boolean handledKey = TRUE;
- if (theVirtualKeyEvent.GetKeyboardState(ev) == FW_CVirtualKeyEvent::kKeyDown)
- ; // do something if any key down
-
- short keyCode = theVirtualKeyEvent.GetKeyCode(ev);
- switch (keyCode) {
- case FW_kVKBackspace: // Mac delete
- FW_Beep();
- break;
-
- case FW_kVKRight: // right-arrow
- FW_Beep();
- break;
-
- case FW_kVKEnter: // enter key
- FW_Beep(); FW_Beep();
- break;
-
- default:
- handledKey = FALSE;
- } // switch
- return handledKey;
- }
-