/*
 ============================================================================
 xoblite -> an alternative shell based on Blackbox for Windows
 Copyright © 2002-2005 Karl-Henrik Henriksson [qwilk]
 Copyright © 2001-2004 The Blackbox for Windows Development Team
 http://xoblite.net/ - #bb4win on irc.freenode.net
 ============================================================================

  Blackbox for Windows is free software, released under the
  GNU General Public License (GPL version 2 or later), with an extension
  that allows linking of proprietary modules under a controlled interface.
  What this means is that plugins etc. are allowed to be released
  under any license the author wishes. Please note, however, that the
  original Blackbox gradient math code used in Blackbox for Windows
  is available under the BSD license.

  http://www.fsf.org/licenses/gpl.html
  http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
  http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  For additional license information, please read the included license.html

 ============================================================================
*/

#ifndef __FOLDERITEM_H 
#define __FOLDERITEM_H 

#include "TitleItem.h" 

#define BS_EMPTY 0 
#define BS_DIAMOND 1 
#define BS_SQUARE 2 
#define BS_TRIANGLE 3 
#define BS_CIRCLE 4 
#define BS_TRIPLE 5 
#define BS_COMMENT 6 
#define BS_GRID 7 

#define FOLDER_LEFT 0 
#define FOLDER_RIGHT 1 

class Menu;

//===========================================================================

// An menuitem that is a pointer to a sub menu, theese folder items
// typically contain a |> icon at their right side.
class FolderItem : public TitleItem
{
public:
        FolderItem(Menu* pSubMenu, char* pszTitle);
        virtual ~FolderItem();

        // Paints the folder item, the parent class will paint first
        // the will we add the |> icon
        // @param hDC the devicecontec that is used for painting
        void Paint(HDC hDC);

        void PaintDiamondBullet(HDC hDC, int nTop);
        void PaintTriangleBullet(HDC hDC, int nTop);
        void PaintSquareBullet(HDC hDC, int nTop);
        void PaintCircleBullet(HDC hDC, int nTop);
        void PaintEmptyBullet(HDC hDC, int nTop);
        void PaintExtendedBullets(HDC hDC, int nTop, int type);

        static void SetBulletStyle(int bulletStyle){m_nBulletStyle = bulletStyle;};
        static void SetBulletPosition(int position){m_nBulletPosition = position;};

        // Notifies this object that is has been attached to a Menu
        // @param pMenu pointer to the popupmenu object
        void Attached(Menu* pMenu);

        // Activate or deactivate this object
        // @param bActivate is this item active
        // @return returns the activation state of this item (not all items accept
        // to be activated)
        bool Active(bool bActivate);

        // Activates this folderitem
        void Invoke();

        // Handles timer messages, the folder uses timers to wait before the submenues are opened
        // @param nTimer the identity of the timer
        void Timer(int nTimer);

        // Returns whether the item is a leaf or a node
        virtual inline bool IsLeaf(){return false;};

protected:

        /// The current timer id, this is 0 if the folder is not currently waiting
        UINT m_nTimerId;

        /// Displays the submenu at some reasonable position
        void ShowSubMenu();     

        /// Returns a rect containing the title
        void GetTitleRect(RECT* r);

        /// Pointer at submenu
        Menu* m_pSubMenu;

        static int m_nBulletStyle;
        static int m_nBulletPosition;
};

//===========================================================================

#endif /* __FOLDERITEM_H */ 





syntax highlighting by

w e b c p p
web c plus plus