home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWDialog.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.9 KB  |  145 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                DlogFrm.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWDIALOG_H
  11. #define FWDIALOG_H
  12.  
  13. // ----- Framework Includes -----
  14.  
  15. #ifndef FWFRAME_H
  16. #include "FWFrame.h"
  17. #endif
  18.  
  19. #ifndef FWEVENT_H
  20. #include "FWEvent.h"
  21. #endif
  22.  
  23. #ifndef FWBUTTON_H
  24. #include "FWButton.h"
  25. #endif
  26.  
  27. #ifndef FWWINDOW_K
  28. #include "FWWindow.k"
  29. #endif
  30.  
  31. // ----- Foundation Layer -----
  32.  
  33. #ifndef FWRECEVR_H
  34. #include "FWRecevr.h"
  35. #endif
  36.  
  37. //==============================================================================
  38. // Forward Declarations
  39. //==============================================================================
  40.  
  41. class FW_CNotification;
  42. class FW_CIdler;
  43. class FW_CView;
  44. class FW_CViewTabber;
  45. class FW_CButton;
  46. class FW_CVirtualKeyEvent;
  47.  
  48. //==============================================================================
  49. // class FW_CDialogFrame 
  50. //==============================================================================
  51.  
  52. class FW_CDialogFrame : public FW_CFrame, public FW_MReceiver
  53. {
  54.  
  55. //----------------------------------------------------------------------------------------
  56. //    Initialization/Destruction
  57. //
  58.   public:
  59.     FW_DECLARE_CLASS
  60.     FW_DECLARE_AUTO(FW_CDialogFrame)
  61.  
  62.     FW_CDialogFrame(Environment* ev, 
  63.                     ODFrame* odFrame, 
  64.                     FW_CPresentation* presentation, 
  65.                     FW_CPart* part);
  66.  
  67.     virtual ~FW_CDialogFrame();
  68.     
  69. //----------------------------------------------------------------------------------------
  70. //    Inherited API
  71. //
  72.     virtual void                 HandleNotification(Environment* ev, const FW_CNotification& notification);
  73.  
  74.     virtual void                 FrameRemoved(Environment* ev, FW_Boolean toStorage);
  75.     virtual FW_Handled            DoVirtualKey (Environment* ev, const FW_CVirtualKeyEvent & event);
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    New API
  79. //
  80.   public:
  81.       // ---- Dialog creation
  82.     static FW_CDialogFrame*     NewModalDialog(Environment* ev, 
  83.                                     FW_CPart* part, 
  84.                                     FW_CPresentation* presentation,
  85.                                     const FW_CPoint& size, 
  86.                                     const FW_CPoint& position, 
  87.                                     FW_WindowStyle style, 
  88.                                     const FW_CString& windowTitle);
  89.       
  90.     static FW_CDialogFrame*     NewAndShowModalDialog(Environment* ev, 
  91.                                     FW_CPart* part, 
  92.                                     FW_CPresentation* presentation,
  93.                                     const FW_CPoint& size, 
  94.                                     const FW_CPoint& position, 
  95.                                     FW_WindowStyle style, 
  96.                                     const FW_CString& windowTitle);
  97.   public:
  98.      // ---- OK/Cancel buttons
  99.     FW_CButton*                    GetDefaultButton(Environment* ev) const;
  100.     FW_CButton*                    GetCancelButton(Environment* ev) const;
  101.     void                        SetDefaultButton(Environment* ev, ODID id);
  102.     void                        SetCancelButton(Environment* ev, ODID id);
  103.     
  104.   private:
  105.     FW_Boolean                     TryModalFocus(Environment* ev, ODFrame* odFrame, FW_Boolean isMoveable);
  106.  
  107. //----------------------------------------------------------------------------------------
  108. //    Private Implementation
  109. //
  110. public:
  111.     virtual void                PrivButtonAttached(Environment* ev, FW_CButton* button);
  112.  
  113.     FW_CButton*                    PrivSetDismissButton(Environment* ev, 
  114.                                         FW_CButton* newButton, 
  115.                                         FW_Message message, 
  116.                                         FW_CButton* prevButton);
  117.  
  118. //----------------------------------------------------------------------------------------
  119. //    Data Members
  120. //
  121.   private:
  122.     FW_Boolean            fIsModal;
  123.     FW_CIdler*            fIdler;
  124.     FW_CViewTabber*        fViewTabber;
  125.     FW_CButton*            fDefaultButton;
  126.     FW_CButton*            fCancelButton;
  127. };
  128.  
  129. //==============================================================================
  130. // FW_CDialogFrame Inlines
  131. //==============================================================================
  132.  
  133. inline FW_CButton* FW_CDialogFrame::GetDefaultButton(Environment*) const
  134. {
  135.     return fDefaultButton;
  136. }
  137.  
  138. inline FW_CButton* FW_CDialogFrame::GetCancelButton(Environment*) const
  139. {
  140.     return fCancelButton;
  141. }
  142.  
  143.  
  144. #endif
  145.