home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CDividedPane 1.0 / CDividedPaneDemoDir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  3.1 KB  |  117 lines  |  [TEXT/KAHL]

  1. /*
  2.  *
  3.  *    File:        CDividedPaneDemoDir.c
  4.  *    Module:        CDividedPaneDemoDir method definitions
  5.  *    System:        Showcase Application
  6.  *    Evironment:    MacOS 7.0/THINK C 5.0/TCL 1.1.1
  7.  *    Author:        Mark Alldritt
  8.  *
  9.  *
  10.  *        Copyright © 1992    All Rights Reserved
  11.  *        Mark Alldritt
  12.  *        1571 Deep Cove Road
  13.  *        N. Vancouver, B.C. CANADA
  14.  *
  15.  *    
  16.  *    Description:
  17.  *
  18.  *    This class implements a demonstration of the CDividedPane class.  To build this demo
  19.  *    follow these steps:
  20.  *
  21.  *    1)    Add all source files to the CSApplication project
  22.  *
  23.  *            CDividedPane
  24.  *             CDividedPaneDemoDir          [only required for the demo]
  25.  *    
  26.  *    2)    Add all the resources in "CDividedPaneDemo.rsrc" to the Showcase Application
  27.  *        resource file "CSAApplication π.rsrc".
  28.  *
  29.  *    Edit History:
  30.  *
  31.  *    V01-01    Mark Alldritt    11-Oct-1992
  32.  *    - Initial version of module.
  33.  *
  34.  */
  35.  
  36.  
  37. #include "CDividedPaneDemoDir.h"
  38. #include "CDividedPane.h"
  39.  
  40. #include <CScrollPane.h>
  41. #include <CPicture.h>
  42. #include <CEditText.h>
  43. #include <CWindow.h>
  44. #include <CDesktop.h>
  45. #include <CDecorator.h>
  46.  
  47.  
  48. extern CDesktop        *gDesktop;
  49. extern CDecorator    *gDecorator;
  50.  
  51.  
  52. #define WIND_DividedPaneDemo    3000
  53. #define PICT_Demo                3000
  54. #define DIVIDER_SIZE            3
  55. #define MIN_TOP                    70
  56. #define MIN_BOTTOM                50
  57.  
  58. void CDividedPaneDemoDir::INewDemo( CDirectorOwner *aSupervisor)
  59. {
  60.     CDividedPane        *mainPane;
  61.     CScrollPane            *scrollPane;
  62.     CPicture            *pictPane;
  63.     CEditText            *textPane;
  64.     LongRect            frame;
  65.     
  66.     inherited::INewDemo( aSupervisor);
  67.     
  68.     /*    Build the window were going to display all this stuff in    */
  69.  
  70.     itsWindow = new(CWindow);
  71.     itsWindow->IWindow( WIND_DividedPaneDemo, false, gDesktop, this);
  72.     itsWindow->GetFrame(&frame);
  73.  
  74.     /*    Build the divided pane.  For this demo, the pane is divided horizontally, but to
  75.      *    divide it vertically change the TRUE to FALSE in the IDividedPane call.
  76.      */
  77.  
  78.     mainPane = new(CDividedPane);
  79.     mainPane->IDividedPane(itsWindow, this,
  80.                            frame.right, frame.bottom, 0, 0,
  81.                            sizELASTIC, sizELASTIC,
  82.                            TRUE, (frame.bottom - frame.top - DIVIDER_SIZE) / 2, DIVIDER_SIZE,
  83.                            MIN_TOP, MIN_BOTTOM);
  84.  
  85.     /*    Display a picture in the top pane, within a scroll pane.    */
  86.  
  87.     mainPane->Get1stPane()->GetFrame(&frame);
  88.     scrollPane = new(CScrollPane);
  89.     scrollPane->IScrollPane(mainPane->Get1stPane(), this, frame.right, frame.bottom, 0, 0,
  90.                             sizELASTIC, sizELASTIC, FALSE, TRUE, FALSE);
  91.     scrollPane->SetSteps(30, 30);
  92.  
  93.     pictPane = new(CPicture);
  94.     pictPane->IPicture(scrollPane, scrollPane, 0, 0, 0, 0, sizELASTIC, sizELASTIC);
  95.     pictPane->FitToEnclosure(TRUE, TRUE);
  96.     scrollPane->InstallPanorama(pictPane);
  97.     pictPane->UsePICT(PICT_Demo);
  98.  
  99.     /*    Display some descriptive text in the bottom pane.    */
  100.  
  101.     mainPane->Get2ndPane()->GetFrame(&frame);
  102.     scrollPane = new(CScrollPane);
  103.     scrollPane->IScrollPane(mainPane->Get2ndPane(), this, frame.right, frame.bottom, 0, 0,
  104.                             sizELASTIC, sizELASTIC, TRUE, TRUE, TRUE);
  105.     scrollPane->SetSteps(30, 30);
  106.  
  107.     pictPane = new(CPicture);
  108.     pictPane->IPicture(scrollPane, scrollPane, 0, 0, 0, 0, sizELASTIC, sizELASTIC);
  109.     pictPane->FitToEnclosure(TRUE, TRUE);
  110.     scrollPane->InstallPanorama(pictPane);
  111.     pictPane->UsePICT(PICT_Demo);
  112.  
  113.     /*    Display the whole works.    */
  114.  
  115.     gDecorator->CenterWindow(itsWindow);
  116.     itsWindow->Select();
  117. }