home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / rdfui / CNavCenterTitle.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  2.4 KB  |  91 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. //
  20. // Mike Pinkerton, Netscape Communications
  21. //
  22. // Class that draws the header area for the nav center which shows the title
  23. // of the currently selected view as well as harboring the closebox for
  24. // an easy way to close up the navCenter shelf.
  25. //
  26.  
  27. #include "CNavCenterTitle.h"
  28. #include "CNavCenterSelectorPane.h"        // for message id's
  29.  
  30.  
  31. CNavCenterTitle :: CNavCenterTitle ( LStream *inStream )
  32.     : CGrayBevelView (inStream),
  33.         mTitle(NULL)
  34. {
  35.  
  36. }
  37.  
  38.  
  39. CNavCenterTitle :: ~CNavCenterTitle()
  40. {
  41.     // nothing to do 
  42. }
  43.  
  44.  
  45. //
  46. // FinishCreateSelf
  47. //
  48. // Last minute setup stuff....
  49. //
  50. void
  51. CNavCenterTitle :: FinishCreateSelf ( )
  52. {
  53.     mTitle = dynamic_cast<LCaption*>(FindPaneByID(kTitlePaneID));
  54.     Assert_(mTitle != NULL);
  55.     
  56. } // FinishCreateSelf
  57.  
  58.  
  59. //
  60. // ListenToMessage
  61. //
  62. // We want to know when the selected workspace changes so that we can update the
  63. // title string. The RDFCoordinator sets us up as a listener to the selector pane
  64. // which will broadcast when things change.
  65. //
  66. void
  67. CNavCenterTitle :: ListenToMessage ( MessageT inMessage, void* ioParam ) 
  68. {
  69.     switch ( inMessage ) {
  70.     
  71.         case CNavCenterSelectorPane::msg_ActiveSelectorChanged:
  72.         {
  73.             HT_View newView = reinterpret_cast<HT_View>(ioParam);
  74.             if ( newView ) {
  75.                 // do not delete |buffer|
  76.                 const char* buffer = HT_GetViewName ( newView );
  77.                 TitleCaption().SetDescriptor(LStr255(buffer));
  78.                 
  79.                 // if we're in the middle of a drag and drop, draw NOW, not
  80.                 // when we get a refresh event.
  81.                 if ( ::StillDown() ) {
  82.                     FocusDraw();
  83.                     Draw(nil);
  84.                 }
  85.             }
  86.         }
  87.     
  88.     } // case of which message
  89.  
  90. } // ListenToMessage
  91.