home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Text / Digest-Browser-1.6 Folder / Views / CBrowserScrollPane.c next >
Encoding:
C/C++ Source or Header  |  1992-08-29  |  2.2 KB  |  82 lines  |  [TEXT/KAHL]

  1. #include "CBrowserScrollPane.h"
  2.  
  3. /******************************************************************************
  4.  CBrowserScrollPane.c
  5.  
  6.     Methods to support resizeable scroll panes within a single window
  7.     
  8.       Copyright © 1992 J. Robert Boonstra, II.  All rights reserved.
  9.  ******************************************************************************/
  10.  
  11. #include "CScrollBar.h"
  12. #include "CBrowserSizeBox.h"    
  13. #include "CPanorama.h"
  14.  
  15. /******************************************************************************
  16.  IBrowserScrollPane
  17.  
  18.      differs from IScrollPane only in that it accepts the hasSICN argument
  19.      and uses a CBrowserSizeBox instead of a CSizeBox
  20.  ******************************************************************************/
  21.  
  22. void    CBrowserScrollPane::IBrowserScrollPane(
  23.     CView            *anEnclosure,
  24.     CBureaucrat        *aSupervisor,
  25.     short            aWidth,
  26.     short            aHeight,
  27.     short            aHEncl,
  28.     short            aVEncl,
  29.     SizingOption    aHSizing,
  30.     SizingOption    aVSizing,
  31.     Boolean            hasHoriz,
  32.     Boolean            hasVert,
  33.     Boolean            hasSizeBox,
  34.     Boolean            hasSICN)
  35. {    
  36.     inherited::IScrollPane(anEnclosure, aSupervisor, aWidth, aHeight, aHEncl, aVEncl,
  37.                                 aHSizing, aVSizing,
  38.                                 hasHoriz, hasVert, hasSizeBox);     // no size box, set up our own
  39.  
  40.  
  41.     // If we want a size box, and want a SICN, then use our own size box
  42.     // class.
  43.     if (hasSizeBox && hasSICN) {
  44.         if (itsSizeBox)                // release the old one
  45.             itsSizeBox->Dispose();
  46.  
  47.         itsSizeBox = new(CBrowserSizeBox);
  48.         itsSizeBox->ISizeBox(this, this);
  49.     }
  50.  
  51. }
  52.  
  53.  
  54. void    CBrowserScrollPane::Calibrate()
  55. /******************************************************************************
  56.  Calibrate
  57.  
  58.      differs from CScrollPane::Calibrate only in that it adjusts the frame
  59.      position if necessary when the partition has been adjusted
  60.  ******************************************************************************/
  61. {
  62.     long    hPos;
  63.     long    vPos;
  64.     if (itsPanorama == NULL)            /* Take a quick exit if no            */
  65.         return;                            /*   Panorama is installed            */
  66.  
  67.     itsPanorama->GetFramePosition(&hPos, &vPos);
  68.  
  69.     if (vPos < 0) {
  70.         itsPanorama->Scroll( 0, -vPos, false);    // avoid redundant redraw
  71.         vPos=0;
  72.     }
  73.         
  74.     if (itsHorizSBar != NULL) {
  75.         itsHorizSBar->SetValue((short) (hPos / hUnit));
  76.     }
  77.     
  78.     if (itsVertSBar != NULL) {
  79.         itsVertSBar->SetValue((short) (vPos / vUnit));
  80.     }
  81. }
  82.