home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iframe.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  13.5 KB  |  439 lines

  1. #ifndef _IFRAME_
  2. #define _IFRAME_
  3. /*******************************************************************************
  4. * FILE NAME: iframe.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declarations of the classes:                        *
  8. *     IFrameWindow                                                             *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #include <iwindow.hpp>
  19. #include <icconst.h>
  20. #include <icmdevt.hpp>
  21. #include <ihandle.hpp>
  22. #include <irect.hpp>
  23. #include <ireslib.hpp>
  24.  
  25. class IColor;
  26. class IFont;
  27. class IFrameExtension;
  28. class IFrameExtensions;
  29. class IFrameHandler;
  30. class IFrameWindowData;
  31. class IFrameWindowNotifyHandler;
  32. class IToolBarList;
  33.  
  34. #pragma pack(4)
  35.  
  36. class IFrameWindow : public IWindow {
  37. typedef IWindow
  38.   Inherited;
  39. public:
  40. class Style;
  41. enum FrameSource {
  42.   dialogResource,
  43.   noDialogResource,
  44.   tryDialogResource
  45.   };
  46. /*------------------------------- Constructors -------------------------------*/
  47.   IFrameWindow ( unsigned long id = IC_DEFAULT_FRAME_ID,
  48.                  FrameSource   source = tryDialogResource );
  49.  
  50.   IFrameWindow ( const IResourceId& resId,
  51.                  IWindow*           owner = 0,
  52.                  FrameSource        source = tryDialogResource );
  53.  
  54.   IFrameWindow ( const IResourceId& resId,
  55.                  IWindow*           parent,
  56.                  IWindow*           owner,
  57.                  FrameSource        source = tryDialogResource );
  58.  
  59.   IFrameWindow ( const IWindowHandle& hwnd );
  60.  
  61.   IFrameWindow ( const IResourceId&         resId,
  62.                  const IFrameWindow::Style& style );
  63.  
  64.   IFrameWindow ( const IFrameWindow::Style& style,
  65.                  const IResourceId&         resId = IC_DEFAULT_FRAME_ID );
  66.  
  67.   IFrameWindow ( const char*                title,
  68.                  const IResourceId&         resId = IC_DEFAULT_FRAME_ID,
  69.                  const IFrameWindow::Style& style = defaultStyle() );
  70.  
  71.   IFrameWindow ( const IResourceId&         resId,
  72.                  IWindow*                   parent,
  73.                  IWindow*                   owner ,
  74.                  const IRectangle&          initRect,
  75.                  const IFrameWindow::Style& style = defaultStyle(),
  76.                  const char*                title = 0 );
  77.  
  78. virtual
  79.  ~IFrameWindow ( );
  80.  
  81. /*---------------------------------- Styles ----------------------------------*/
  82. INESTEDBITFLAGCLASSDEF1( Style, IFrameWindow, IWindow );
  83.  
  84. static const Style
  85.   IC_IMPORTU classDefaultStyle,
  86.   IC_IMPORTU accelerator,
  87.   IC_IMPORTU alignNoAdjust,
  88. #ifndef IC_WIN_FLAGNOP
  89.   IC_IMPORTU animated,
  90.   IC_IMPORTU appDBCSStatus,
  91. #endif
  92.   IC_IMPORTU border,
  93.   IC_IMPORTU dialogBackground,
  94.   IC_IMPORTU dialogBorder,
  95. #ifndef IC_WIN_FLAGNOP
  96.   IC_IMPORTU hideButton,
  97. #endif
  98.   IC_IMPORTU horizontalScroll,
  99.   IC_IMPORTU maximizeButton,
  100.   IC_IMPORTU maximized,
  101.   IC_IMPORTU menuBar,
  102.   IC_IMPORTU minimizeButton,
  103.   IC_IMPORTU minimized,
  104.   IC_IMPORTU minimizedIcon,
  105. #ifndef IC_WIN_FLAGNOP
  106.   IC_IMPORTU noMoveWithOwner,
  107. #endif
  108.   IC_IMPORTU shellPosition,
  109.   IC_IMPORTU sizingBorder,
  110.   IC_IMPORTU systemMenu,
  111. #ifndef IC_WIN_FLAGNOP
  112.   IC_IMPORTU systemModal,
  113. #endif
  114.   IC_IMPORTU titleBar,
  115.   IC_IMPORTU verticalScroll,
  116.   IC_IMPORTU windowList;
  117.  
  118. static Style
  119.   defaultStyle      ( );
  120.  
  121. static void
  122.   setDefaultStyle   ( const Style&    style );
  123.  
  124. virtual unsigned long
  125.   convertToGUIStyle ( const IBitFlag& style,
  126.                       Boolean         extendedOnly = false ) const;
  127.  
  128. /*----------------------- System-Menu-Related Actions ------------------------*/
  129. virtual IFrameWindow
  130.  &close          ( ),
  131.  &maximize       ( ),
  132.  &restore        ( ),
  133.  &setRestoreRect ( const IRectangle& rect ),
  134.  &minimize       ( );
  135.  
  136. virtual IRectangle
  137.   maximizeRect  ( ) const,
  138.   minimizeRect  ( ) const,
  139.   restoreRect   ( ) const;
  140.  
  141. static IRectangle
  142.   nextShellRect ( );
  143.  
  144. /*---------------------------- Moving and Sizing -----------------------------*/
  145. virtual IFrameWindow
  146.  &moveSizeToClient ( const IRectangle& clientRect );
  147.  
  148. virtual IRectangle
  149.   clientRectFor    ( const IRectangle& frameRect ) const,
  150.   frameRectFor     ( const IRectangle& clientRect ) const;
  151.  
  152. /*------------------------------- Border Size --------------------------------*/
  153. unsigned long
  154.   borderWidth     ( ) const,
  155.   borderHeight    ( ) const;
  156.  
  157. ISize
  158.   borderSize      ( ) const;
  159.  
  160. #ifndef IC_MOTIFWIN_FLAGNOP
  161. IFrameWindow
  162.  &setBorderWidth  ( unsigned long cx ),
  163.  &setBorderHeight ( unsigned long cy ),
  164.  &setBorderSize   ( const ISize&  size ),
  165.  &setBorderSize   ( unsigned long cxcy ),
  166.  &setBorderSize   ( unsigned long cx,
  167.                     unsigned long cy );
  168. #endif
  169.  
  170. /*------------------------------ Modal Display -------------------------------*/
  171. virtual unsigned long
  172.   showModally ( ),
  173.   result      ( ) const;
  174.  
  175. virtual IFrameWindow
  176.  &dismiss     ( unsigned long result = 0 ),
  177.  &setResult   ( unsigned long result ),
  178.  
  179.  ¬ifyOwner ( unsigned long         id,
  180.                 ICommandEvent::Source source = ICommandEvent::unknown,
  181.                 Boolean               pointerDevice = false );
  182.  
  183. /*----------------------------- Application Icon -----------------------------*/
  184. virtual IPointerHandle
  185.   icon    ( ) const;
  186.  
  187. virtual IFrameWindow
  188.  &setIcon ( const IPointerHandle& icon ),
  189.  &setIcon ( const IResourceId&    iconResId ),
  190.  &setIcon ( unsigned long         iconResId );
  191.  
  192. /*------------------------------ Mouse Pointer -------------------------------*/
  193. virtual IPointerHandle
  194.   mousePointer    ( ) const;
  195.  
  196. virtual IFrameWindow
  197.  &setMousePointer ( const IPointerHandle& mousePointer );
  198.  
  199. /*--------------------------------- Colors -----------------------------------*/
  200. #ifndef IC_WIN_FLAGNOP
  201. virtual IColor
  202.   backgroundColor              ( ) const;
  203. #endif //!IC_WIN_FLAGNOP
  204.  
  205. #ifndef IC_MOTIFWIN_FLAGNOP
  206. virtual IColor
  207.   disabledBackgroundColor      ( ) const;
  208. #endif //!IC_MOTIFWIN_FLAGNOP
  209.  
  210. #ifndef IC_WIN_FLAGNOP
  211. virtual IFrameWindow
  212.  &resetBackgroundColor         ( ),
  213.  &resetDisabledBackgroundColor ( );
  214. #endif //!IC_WIN_FLAGNOP
  215.  
  216. Boolean
  217.   usesDialogBackground         ( ) const;
  218.  
  219. /*------------------------------ Font Functions ------------------------------*/
  220. virtual IWindow
  221.  &setFont       ( const IFont& font );
  222.  
  223. /*------------------------------ Client Window -------------------------------*/
  224. virtual IWindowHandle
  225.   clientHandle ( ) const;
  226.  
  227. virtual IWindow
  228.  *client       ( ) const;
  229.  
  230. virtual IFrameWindow
  231.  &setClient    ( IWindow* newClient );
  232.  
  233. /*----------------------------- Frame Extensions -----------------------------*/
  234. enum Location {
  235. #ifndef IC_MOTIFWIN_FLAGNOP
  236.   leftOfTitleBar,
  237.   rightOfTitleBar,
  238.   leftOfMenuBar,
  239.   rightOfMenuBar,
  240. #endif
  241.   leftOfClient,
  242.   rightOfClient,
  243.   aboveClient,
  244.   belowClient
  245.   };
  246.  
  247. enum SeparatorType {
  248.   none,
  249.   thinLine,
  250.   thickLine
  251.   };
  252.  
  253. virtual IFrameWindow
  254.  &addExtension     ( IWindow*      newExtension,
  255.                      Location      location,
  256.                      unsigned long widthOrHeight,
  257.                      SeparatorType separator = thinLine ),
  258.  &addExtension     ( IWindow*      newExtension,
  259.                      Location      location,
  260.                      int           widthOrHeight,
  261.                      SeparatorType separator = thinLine ),
  262.  &addExtension     ( IWindow*      newExtension,
  263.                      Location      location,
  264.                      double        percentage,
  265.                      SeparatorType separator = thinLine ),
  266.  &addExtension     ( IWindow*      newExtension,
  267.                      Location      location,
  268.                      SeparatorType separator = thinLine ),
  269.  
  270.  &removeExtension  ( IWindow*      extension,
  271.                      Boolean       updateDisplay = true ),
  272.  
  273.  &setExtensionSize ( IWindow*      extension,
  274.                      unsigned long widthOrHeight ),
  275.  &setExtensionSize ( IWindow*      extension,
  276.                      int           widthOrHeight ),
  277.  &setExtensionSize ( IWindow*      extension,
  278.                      double        widthOrHeight ),
  279.  &useExtensionMinimumSize ( IWindow* extension ),
  280.  
  281.  &update           ( );
  282.  
  283. virtual Boolean
  284.   isAnExtension    ( const IWindow* window ) const;
  285.  
  286. /*------------------------------ Window Display ------------------------------*/
  287. virtual IFrameWindow
  288.  &show ( Boolean showWindow = true );
  289.  
  290. /*---------------------------- Window Destruction ----------------------------*/
  291. virtual IFrameWindow
  292.  &setDestroyOnClose  ( Boolean destroy = true );
  293.  
  294. Boolean
  295.   willDestroyOnClose ( ) const;
  296.  
  297. /*--------------------------------- Testing ----------------------------------*/
  298. Boolean
  299.   isFlashing  ( ) const,
  300.   isMaximized ( ) const,
  301.   isMinimized ( ) const,
  302.   isModal     ( ) const;
  303.  
  304. /*------------------------------- Window List --------------------------------*/
  305. virtual IFrameWindow
  306.  &addToWindowList      ( ),
  307.  &removeFromWindowList ( );
  308.  
  309. /*------------------------- Standard Control Access --------------------------*/
  310. virtual IWindowHandle
  311.   handleFor ( const Style& standardControl ) const;
  312.  
  313. /*----------------------------- Window Flashing ------------------------------*/
  314. virtual IFrameWindow
  315.  &beginFlashing ( ),
  316.  &endFlashing   ( );
  317.  
  318.  
  319. /*------------------------------ Sibling Order -------------------------------*/
  320. static void
  321.   setDefaultOrdering ( IWindow::SiblingOrder ordering );
  322. static IWindow::SiblingOrder
  323.   defaultOrdering    ( );
  324.  
  325. /*------------------------------ Window Layout -------------------------------*/
  326. IFrameWindow
  327.  &setLayoutDistorted ( unsigned long layoutAttributesOn,
  328.                        unsigned long layoutAttributesOff );
  329.  
  330. /*------------------------- Dialog Behavior Support --------------------------*/
  331. virtual IWindowHandle
  332.   defaultPushButton  ( ) const,
  333.   matchForMnemonic   ( unsigned short character ) const;
  334.  
  335. /*--------------------- Notification Event Descriptions ----------------------*/
  336. static INotificationId const
  337.   IC_IMPORTU closeId,
  338.   IC_IMPORTU activateId,
  339.   IC_IMPORTU deactivateId;
  340.  
  341. /*-------------------------- Observer Notification ---------------------------*/
  342. virtual IFrameWindow
  343.  &enableNotification ( Boolean enable = true );
  344.  
  345.  
  346. /*----------------------------- Tool Bar Support -----------------------------*/
  347. IFrameWindow
  348.  &setToolBarList ( IToolBarList* toolBarList );
  349. IToolBarList
  350.  *toolBarList    ( ) const;
  351.  
  352. protected:
  353. /*----------------------- Frame Extensions Management ------------------------*/
  354. IFrameExtensions
  355.  *extensions    ( ) const;
  356.  
  357. unsigned
  358.   findExtension ( IWindow* window );
  359.  
  360. IFrameWindow
  361.  &setExtensions ( IFrameExtensions* extensions );
  362.  
  363. /*------------------------------ Implementation ------------------------------*/
  364. static const Style
  365.   IC_IMPORTU deferCreation;
  366.  
  367. IFrameWindow
  368.  &tryToLoadDialog ( const IResourceId& resId,
  369.                     IWindow*           parent = 0,
  370.                     IWindow*           owner  = 0,
  371.                     FrameSource        source = tryDialogResource );
  372.  
  373. IFrameWindow
  374.  &initialize      ( const IResourceId& resId,
  375.                     const Style&       style,
  376.                     IWindow*           parent   = 0,
  377.                     IWindow*           owner    = 0,
  378.                     const IRectangle&  initRect = nextShellRect(),
  379.                     const char*        title    = 0 );
  380.  
  381. unsigned long
  382.   registerFrameClass ( const Style& style,
  383.                        const IResourceId& resId );
  384.  
  385. IWindowHandle
  386.   create ( unsigned long         id,
  387.            const char*           title,
  388.            unsigned long         style,
  389.            const char*           windowClass,
  390.            const IWindowHandle&  parent,
  391.            const IWindowHandle&  owner,
  392.            const IRectangle&     initRect,
  393.            const void*           ctlData,
  394.            const void*           presParams,
  395.            IWindow::SiblingOrder ordering = defaultOrdering(),
  396.            unsigned long         extendedStyle = 0 );
  397.  
  398. IFrameWindow
  399.  &start  ( const IWindowHandle& hwnd );
  400.  
  401. IFrameWindow
  402.  &addDefaultHandler    ( ),
  403.  &removeDefaultHandler ( );
  404.  
  405.  
  406. private:
  407. /*------------------------------ Hidden Members ------------------------------*/
  408.   IFrameWindow ( const IFrameWindow& frame );
  409. IFrameWindow
  410.  &operator=    ( const IFrameWindow& frame );
  411.  
  412. /*--------------------------------- Private ----------------------------------*/
  413. friend class IFrameHandler;
  414. friend class IFrameWindowNotifyHandler;
  415. friend class IMenuBar;
  416. friend class IMenuPrivate;
  417.  
  418. IFrameWindow
  419.  &addExtension ( IFrameExtension* extension );
  420.  
  421. static const Style
  422.   IC_IMPORTU styleBits;
  423. static Style
  424.   currentDefault;
  425.  
  426. static IWindow::SiblingOrder
  427.   siblingCreateOrder;
  428.  
  429. IFrameWindowData
  430.  *fFrameWindowData;
  431.  
  432. }; // class IFrame
  433.  
  434. INESTEDBITFLAGCLASSFUNCS(Style, IFrameWindow);
  435.  
  436. #pragma pack()
  437.  
  438. #endif // _IFRAME_
  439.