home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CToolbarModeManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.5 KB  |  88 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. // CToolbarModeManager.h
  20.  
  21. #pragma once
  22.  
  23. #include <LBroadcaster.h>
  24. #include <LListener.h>
  25.  
  26. //#include "resgui.h"    // for TOOLBAR_TEXT_AND_ICONS #define
  27.  
  28. enum {
  29.     eTOOLBAR_ICONS,                    // Toolbar display style possible values
  30.     eTOOLBAR_TEXT,
  31.     eTOOLBAR_TEXT_AND_ICONS
  32. };
  33.  
  34. class CToolbarPrefsProxy;
  35.  
  36. class CToolbarModeManager
  37. {
  38.     public:
  39.         enum {    msg_ToolbarModeChange = 'modC'    };
  40.  
  41.         // defaultToolbarMode is mode that PPob's are defined for
  42.         enum {    defaultToolbarMode = eTOOLBAR_TEXT_AND_ICONS };
  43.         
  44. //        static void            BroadcastToolbarModeChange();
  45.         static int            BroadcastToolbarModeChange(
  46.                                 const char* domain,
  47.                                 void* instance_data);
  48.         static void            AddToolbarModeListener(LListener* inListener);
  49.  
  50.         static void            SetPrefsProxy(CToolbarPrefsProxy* inPrefsProxy)
  51.                             {    sPrefsProxy = inPrefsProxy;    }
  52.  
  53.         static int            GetToolbarPref(Int32& ioPref);
  54.  
  55.     protected:
  56.         static LBroadcaster*        sBroadcaster;
  57.         static CToolbarPrefsProxy*    sPrefsProxy;
  58. };
  59.  
  60. // Mix-in classes to get toolbar mode change propagated to the
  61. // toolbar buttons
  62.  
  63. // This is the class that listens for changes in toolbar mode
  64. // and "handles" mode change
  65. class CToolbarModeChangeListener
  66.     :    public LListener
  67. {
  68.     public:
  69.                             CToolbarModeChangeListener();
  70.  
  71.         virtual void        ListenToMessage(MessageT inMessage, void* ioParam);
  72.     
  73.     protected:
  74.         // Pure virtual. Subclasses must implement
  75.         virtual void        HandleModeChange(Int8 inNewMode) = 0;
  76. };
  77.  
  78. // This is the class that has the toolbar buttons as shallow subpanes
  79. class CToolbarButtonContainer
  80. {
  81.     public:
  82.                             CToolbarButtonContainer() {}
  83.         virtual                ~CToolbarButtonContainer() {}
  84.  
  85.         // Pure virtual. Subclasses must implement
  86.         virtual void        HandleModeChange(Int8 inNewMode, SDimension16& outSizeChange) = 0;
  87. };
  88.