home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / acdf6 / acdfbd6.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.6 KB  |  111 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //                                              SAMPLE CODE
  3. //
  4. // FileName: ACDFBd6.cpp
  5. //
  6. // ClassName: ACompDocFwkMyBundle
  7. //
  8. // Description: This is the bundle class. The reason a user version of the 
  9. //              IGUIbundle class is to try and get the help to work by setting
  10. //              the default style before the view is created
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #include "ACDFBd6.hpp"
  13. #include <ireslib.hpp>
  14. #include <imsgbox.hpp>   
  15. #include "aCDFres6.h"
  16. #include <ifont.hpp>
  17. #include <iframe.hpp> 
  18.  
  19. ACompDocFwkMyBundle::ACompDocFwkMyBundle() 
  20. // Constructor
  21. {       IFUNCTRACE_DEVELOP();}
  22.  
  23. ACompDocFwkMyBundle::~ACompDocFwkMyBundle()
  24. // Destructor
  25. {       IFUNCTRACE_DEVELOP();
  26.     delete fHelpWindow;
  27.     delete fStatusLine; 
  28.     delete fButtons;
  29.     delete fLeftButton;
  30.     delete fCenterButton;
  31.     delete fRightButton;
  32.     delete fHelpButton;
  33.     delete fInfoArea;
  34. }
  35.  
  36. Boolean ACompDocFwkMyBundle::adoptFrameWindow( IComponentFrameWindow* componentFrameWindow)
  37. {       IFUNCTRACE_DEVELOP();
  38.  
  39.     IGUIBundle::adoptFrameWindow( componentFrameWindow);
  40.     IHelpWindow::setDefaultStyle(IHelpWindow::defaultStyle() |
  41.                 IHelpWindow::ipfCompatible ); 
  42.  
  43.     fHelpWindow = new IHelpWindow (HELP_TABLE,&frameWindow());
  44.     fHelpWindow->setActiveWindow(&frameWindow());
  45.  
  46.     try
  47.     {
  48.         fHelpWindow->addLibraries("aCDFhlp6.hlp");  
  49.         fHelpWindow->setTitle(STR_HTITLE);        
  50.     }
  51.     catch (...)
  52.     {
  53.         IMessageBox msgBox (IWindow::desktopWindow());
  54.         msgBox.show(STR_HELP_NOT_FOUND, IMessageBox::warning );
  55.     }
  56.  
  57.     fStatusLine = new IStaticText (WND_STATUS,&frameWindow(),&frameWindow());
  58.  
  59.     frameWindow().addExtension(fStatusLine, 
  60.                 IFrameWindow::aboveClient,
  61.                 IFont(fStatusLine).maxCharHeight());
  62.  
  63.     fInfoArea = new IInfoArea(&frameWindow());
  64.     
  65.     fButtons = new ISetCanvas(WND_BUTTONS,&frameWindow(),&frameWindow());
  66.  
  67.     fLeftButton = new IPushButton(MI_LEFT,fButtons,fButtons );
  68.     fCenterButton = new IPushButton(MI_CENTER,fButtons,fButtons );
  69.     fRightButton = new IPushButton(MI_RIGHT,fButtons,fButtons);
  70.     fHelpButton = new IPushButton(MI_HELP,fButtons,
  71.                                   fButtons,
  72.                                   IRectangle(),
  73.                                   IPushButton::defaultStyle() | 
  74.                                   IPushButton::help |
  75.                                   IButton::noPointerFocus);
  76.  
  77.     fLeftButton->setText(STR_LEFTB);
  78.     fCenterButton->setText(STR_CENTERB);
  79.     fRightButton->setText(STR_RIGHTB);
  80.     fHelpButton->setText(STR_HELPB);
  81.     fInfoArea->setInactiveText(STR_INFO);
  82.  
  83.     fLeftButton->enableTabStop();
  84.     fButtons->setMargin(ISize());
  85.     fButtons->setPad(ISize());
  86.     frameWindow().addExtension(fButtons,
  87.                                 IFrameWindow::belowClient,
  88.                                 (unsigned long)fButtons->minimumSize().height());
  89.  
  90.     frameWindow().setExtensionSize(fInfoArea, IFont(fInfoArea).maxCharHeight());
  91.     return true;
  92.  
  93. }
  94. IHelpWindow* ACompDocFwkMyBundle::helpWindow()
  95. // Return a pointer to the help window
  96. {       IFUNCTRACE_DEVELOP();
  97.     return fHelpWindow;
  98. }
  99.  
  100. IInfoArea* ACompDocFwkMyBundle::infoArea()
  101. // Return a pointer to the info area
  102. {       IFUNCTRACE_DEVELOP();
  103.     return fInfoArea;
  104. }
  105. IStaticText* ACompDocFwkMyBundle::statusLine()
  106. // Return a pointer to the status line
  107. {       IFUNCTRACE_DEVELOP();
  108.     return fStatusLine;
  109. }
  110.  
  111.