home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / notebook / addpages / addpages.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  2.4 KB  |  76 lines

  1. //************************************************************
  2. // Notebook Control - Adding Dialog Pages
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //************************************************************
  8. #include <inotebk.hpp>
  9. #include <iframe.hpp>
  10. #include <iapp.hpp>
  11. #include <ihandle.hpp>
  12. #include <ifont.hpp>
  13. #include <ipoint.hpp>
  14. #include <icconst.h>
  15. #include "addpages.h"
  16.  
  17. void main()
  18. {
  19.   IFrameWindow frame ("Adding Notebook Pages");
  20.   INotebook    notebook (IC_FRAME_CLIENT_ID, &frame, &frame);
  21.  
  22.   // Dialog1 & Dialog3
  23.   IFrameWindow
  24.     dialog1(ID_DIALOG1, ¬ebook, ¬ebook),
  25.     dialog3(ID_DIALOG3, ¬ebook, ¬ebook);
  26.  
  27.   // Use one of the system bitmaps for the tab.
  28.   ISystemBitmapHandle page1Bitmap(ISystemBitmapHandle::drive);
  29.  
  30.   // Declare a page settings.
  31.   INotebook::PageSettings pageData;
  32.  
  33.   // Add Page 1 to the notebook with a bitmap, major tab,
  34.   // and dialog1.
  35.   pageData = INotebook::PageSettings (
  36.                          page1Bitmap,
  37.                          "Page 1",
  38.                          INotebook::PageSettings::statusTextOn |
  39.                          INotebook::PageSettings::majorTab);
  40.   notebook.addLastPage( pageData, &dialog1);
  41.  
  42.   // Add Page 2 to the notebook with text and major tab,
  43.   // but no window.
  44.   pageData = INotebook::PageSettings (
  45.                          "no window",
  46.                          "Page 2",
  47.                          INotebook::PageSettings::statusTextOn |
  48.                          INotebook::PageSettings::majorTab);
  49.   notebook.addLastPage( pageData);
  50.  
  51.   // Add Page 3 to the notebook with text, minor tab,
  52.   // and dialog3.
  53.   pageData = INotebook::PageSettings (
  54.                          "dialog3",
  55.                          "Page 3",
  56.                          INotebook::PageSettings::statusTextOn |
  57.                          INotebook::PageSettings::minorTab);
  58.   notebook.addLastPage( pageData, &dialog3);
  59.  
  60.  
  61.   // Size the tabs to fit the text.
  62.   IFont noteFont(¬ebook);
  63.   ISize tabSize(ISize(noteFont.minTextWidth("no_window Page_3"),
  64.                 noteFont.maxCharHeight()) + ISize(6,6));
  65.   notebook
  66.     .setMajorTabSize(tabSize)
  67.     .setMinorTabSize(tabSize);
  68.  
  69.   // Show the application and process messages.
  70.   frame
  71.     .setClient(¬ebook)
  72.     .show();
  73.   IApplication::current().run();
  74. }
  75.  
  76.