home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / ToolboxItem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  113 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. /* Name:        ToolboxItem.h                                            */
  21. /* Description:    XFE_ToolboxItem component header.                        */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27.  
  28. #ifndef _xfe_toolbox_item_h_
  29. #define _xfe_toolbox_item_h_
  30.  
  31. #include "Component.h"
  32. #include "Chrome.h"
  33. #include "IconGroup.h"
  34. #include "Menu.h"
  35.  
  36. class XFE_Toolbox;
  37. class XFE_Logo;
  38.  
  39. // Toolbar delay is ms
  40. typedef enum
  41. {
  42.     XFE_TOOLBAR_DELAY_SHORT = 0,
  43.     XFE_TOOLBAR_DELAY_LONG = 350
  44. } EToolbarPopupDelay;
  45.  
  46.  
  47. typedef struct ToolbarSpec 
  48. {
  49.     const char *toolbarButtonName;
  50.     EChromeTag tag;
  51.     
  52.     IconGroup *iconGroup;
  53.     IconGroup *iconGroup2;
  54.     IconGroup *iconGroup3;
  55.     IconGroup *iconGroup4;
  56.  
  57.     struct MenuSpec *submenu;
  58.  
  59.     dynamenuCreateProc generateProc;
  60.     void* generateArg;
  61.  
  62.     EToolbarPopupDelay popupDelay;
  63. } ToolbarSpec;
  64.  
  65. /* nice shortcut */
  66. #define TOOLBAR_SEPARATOR    { " ", SEPARATOR }
  67.  
  68. //
  69. // An abstract toolbar is something that goes in a toolbox
  70. //
  71. class XFE_ToolboxItem : public XFE_Component
  72. {
  73. public:
  74.  
  75.     XFE_ToolboxItem(XFE_Component *,XFE_Toolbox *);
  76.  
  77.     virtual void        update() = 0;
  78.     virtual void        setToolbarSpec(ToolbarSpec *) {};
  79.     virtual void        hideButton(const char*, EChromeTag) {};
  80.     virtual void        showButton(const char*, EChromeTag) {};
  81.     virtual void        toggle();
  82.  
  83.     // Position index methods
  84.     virtual int            getPosition        ();
  85.     virtual void        setPosition        (int);
  86.  
  87.     // Open methods
  88.     virtual XP_Bool        isOpen            ();
  89.     virtual void        setOpen            (XP_Bool open);
  90.  
  91.     // Showing methods
  92.     virtual void        setShowing        (XP_Bool showing);
  93.  
  94.     // Logo methods
  95.     virtual void            showLogo            ();
  96.     virtual void            hideLogo            ();
  97.  
  98.     virtual XP_Bool            isLogoShown            ();
  99.     virtual XFE_Logo *        getLogo                ();
  100.     virtual XFE_Toolbox *    getParentToolbox    ();
  101.  
  102. protected:
  103.  
  104.     virtual void        addDragWidget        (Widget);
  105.     virtual void        configureLogo        ();
  106.  
  107.     XFE_Logo *            m_logo;                // the logo
  108.     XP_Bool                m_showLogo;            // is that logo shown ?
  109.     XFE_Toolbox *        m_parentToolbox;    // Parent must be a toolbox
  110. };
  111.  
  112. #endif /* _xfe_toolbox_item_h_ */
  113.