home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CGATabBox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.2 KB  |  132 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __H_CGATabBox
  20. #define __H_CGATabBox
  21. #pragma once
  22.  
  23. /*======================================================================================
  24.     AUTHOR:            Ted Morris - 18 NOV 96
  25.  
  26.     DESCRIPTION:    Implements a view displaying tabbed panes.
  27.     
  28.                     The user con is used to specify the initial tab in Constructor.
  29.                     The GetTextTraitsID() specifies the font for a selected tab, 
  30.                     GetTextTraitsID() + 1 for an unselected tab.
  31.                     
  32.                     The message value of the tabs (CGATabBoxTab) in this view are
  33.                     used to specified the PaneIDT for the pane that is displayed
  34.                     when the tab is clicked, or 0 if no pane is to be displayed.
  35.                     
  36.     MODIFICATIONS:
  37.  
  38.     Date            Person            Description
  39.     ----            ------            -----------
  40. ======================================================================================*/
  41.  
  42.  
  43. /*====================================================================================*/
  44.     #pragma mark INCLUDE FILES
  45. /*====================================================================================*/
  46.  
  47. #include "LGABox_fixes.h"
  48.  
  49. class CGATabBoxTab;
  50. class CGATabBox;
  51. class LTabGroup;
  52.  
  53.  
  54. /*====================================================================================*/
  55.     #pragma mark TYPEDEFS
  56. /*====================================================================================*/
  57.  
  58. // Message structures
  59.  
  60. typedef struct {
  61.     CGATabBox        *box;        // The view
  62.     Boolean            canChange;    // Initially set to true, set to false if cannot change
  63. } TabBoxCanChangeT;
  64.  
  65.  
  66. /*====================================================================================*/
  67.     #pragma mark CONSTANTS
  68. /*====================================================================================*/
  69.  
  70.  
  71. /*====================================================================================*/
  72.     #pragma mark CLASS DECLARATIONS
  73. /*====================================================================================*/
  74.  
  75. #pragma mark -
  76.  
  77. class CGATabBox : public LGABox_fixes,
  78.                   protected LListener,
  79.                   protected LBroadcaster {
  80.                   
  81. public:
  82.                         // Broadcast messages
  83.  
  84.                         enum { 
  85.                             msg_TabViewCanChange = 'CnCh'        // TabBoxCanChangeT *, tab view is about 
  86.                                                                 // to change, return true if this is 
  87.                                                                 // alright
  88.                         ,    msg_TabViewChanged = 'TvCh'            // this, the current view was just
  89.                                                                 // changed but is not yet visibly updated, 
  90.                                                                 // react as necessary
  91.                         };
  92.  
  93.                         enum { class_ID = 'TbOx' };
  94.  
  95.     static void            RegisterTabBoxClasses(void);
  96.  
  97.                         CGATabBox(LStream *inStream);
  98.                         
  99.     PaneIDT                GetCurrentTabID(void) {
  100.                             return mCurrentTabID;
  101.                         }
  102.     PaneIDT                GetCurrentViewID(void) {
  103.                             return mCurrentPaneID;
  104.                         }
  105.     void                SetCurrentTabID(PaneIDT inTabID);
  106.  
  107.     virtual void        CalcBorderRect(Rect &outRect);
  108.  
  109. protected:
  110.     
  111.     virtual void        FinishCreateSelf(void);
  112.     virtual void        DrawBoxBorder(void);
  113.     virtual void        ListenToMessage(MessageT inMessage, void *ioParam);
  114.     
  115.     void                SetupTabs(void);
  116.     Boolean                StoreLatentTabCommander(LView *inTabView);
  117.     Boolean                RestoreLatentTabCommander(LView *inTabView);
  118.     void                CalcCurrentTabRect(Rect &outRect);
  119.     CGATabBoxTab        *GetTab(PaneIDT inID);
  120.     LTabGroup            *FindTabGroup(void);
  121.     
  122.     // Instance variables
  123.     
  124.     PaneIDT                mCurrentTabID;            // Currently selected tab
  125.     PaneIDT                mCurrentPaneID;            // Currently displayed pane
  126.     LArray                mTabLatentCommanders;    // Latent commanders for each tab    
  127. };
  128.  
  129.  
  130. #endif // __H_CGATabBox
  131.  
  132.