home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CToolbarDragBar.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  2.3 KB  |  81 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. // CToolbarDragBar.cp
  20.  
  21. #include <LArrayIterator.h>
  22. #include <LControl.h>
  23.  
  24. #include "CToolbarDragBar.h"
  25. #include "CToolbarModeManager.h"
  26. #include "CButton.h"
  27.  
  28. CToolbarDragBar::CToolbarDragBar(LStream* inStream)
  29.     : CDragBar(inStream)
  30. {
  31. }
  32.  
  33. CToolbarDragBar::~CToolbarDragBar()
  34. {
  35. }
  36.  
  37. void CToolbarDragBar::FinishCreateSelf()
  38. {
  39.     // if current toolbar mode is different that defaultToolbarMode
  40.     // then we need to change mode of this drag bar
  41.     Int32 toolbarStyle;
  42.     int result = CToolbarModeManager::GetToolbarPref(toolbarStyle);
  43.     if (result == noErr)
  44.     {
  45.     //    97-10-07 pchen -- Don't check against default toolbar mode; we still
  46.     //    need to call HandleModeChange because cobrand large icon might
  47.     //    make "spinning N" button bigger than size in PPob.
  48.     //    if (toolbarStyle != CToolbarModeManager::defaultToolbarMode)
  49.             HandleModeChange(toolbarStyle);
  50.     }
  51. }
  52.  
  53. void CToolbarDragBar::HandleModeChange(Int8 inNewMode)
  54. {
  55.     SDimension16 sizeChange;
  56.     LArrayIterator    iter(mSubPanes);
  57.     LPane*            pane = NULL;
  58.  
  59.     while (iter.Next(&pane))
  60.     {
  61.         CToolbarButtonContainer* container =
  62.             dynamic_cast<CToolbarButtonContainer*>(pane);
  63.         if (container)
  64.         {
  65.             container->HandleModeChange(inNewMode, sizeChange);
  66.         }
  67.     }
  68.     
  69.     // check to see if we need to change our height
  70.     if (sizeChange.height)
  71.     {
  72.         // Now resize drag bar based on heightChange
  73.         ResizeFrameBy(0, sizeChange.height, false);
  74.         
  75.         // broadcast msg_DragBarCollapse with a null ioParam
  76.         // to force container to readjust itself because we've changed
  77.         // out size
  78.         BroadcastMessage(msg_DragBarCollapse);
  79.     }
  80. }
  81.