finalcut/src/fmenulist.h

111 lines
3.5 KiB
C
Raw Normal View History

// File: fmenulist.h
// Provides: class FMenuList
//
// Base class
// ══════════
//
// ▕▔▔▔▔▔▔▔▔▔▔▔▏1 *▕▔▔▔▔▔▔▔▔▔▔▔▏
// ▕ FMenuList ▏- - - -▕ FMenuItem ▏
// ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏
#ifndef _FMENULIST_H
#define _FMENULIST_H
#include "fmenuitem.h"
2015-08-16 20:05:39 +02:00
#include "fwidget.h"
/*
FWindow FMenuBar
FMenuList FMenu
2015-10-01 03:48:58 +02:00
:
----------------- FMenuItem
*/
//----------------------------------------------------------------------
// class FMenuList
//----------------------------------------------------------------------
#pragma pack(push)
#pragma pack(1)
class FMenuList
{
protected:
2015-11-07 23:16:09 +01:00
FMenuItem* selectedItem;
std::vector<FMenuItem*> itemlist;
private:
FMenuList (const FMenuList&);
FMenuList& operator = (const FMenuList&);
public:
explicit FMenuList();
virtual ~FMenuList();
virtual const char* getClassName() const;
2015-09-15 23:07:24 +02:00
uInt count() const;
FMenuItem* item (int) const;
2015-10-29 21:10:50 +01:00
void enableItem (int);
void disableItem (int);
2015-09-15 23:07:24 +02:00
bool isSelected (int) const;
2015-11-07 23:16:09 +01:00
void selectFirstItem();
void unselectItem();
2015-09-15 23:07:24 +02:00
bool hasSelectedItem();
2015-11-07 23:16:09 +01:00
FMenuItem* getSelectedItem() const;
void setSelectedItem (FMenuItem*);
bool hasSelectedItem() const;
2015-09-15 23:07:24 +02:00
virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
void remove (int);
void clear();
};
#pragma pack(pop)
// FMenuList inline functions
//----------------------------------------------------------------------
inline const char* FMenuList::getClassName() const
{ return "FMenuList"; }
//----------------------------------------------------------------------
inline uInt FMenuList::count() const
{ return uInt(itemlist.size()); }
//----------------------------------------------------------------------
inline FMenuItem* FMenuList::item(int index) const
{ return itemlist[uInt(index-1)]; }
//----------------------------------------------------------------------
2015-10-29 21:10:50 +01:00
inline void FMenuList::enableItem (int index)
{ itemlist[uInt(index-1)]->setEnable(); }
//----------------------------------------------------------------------
2015-10-29 21:10:50 +01:00
inline void FMenuList::disableItem (int index)
{ itemlist[uInt(index-1)]->unsetEnable(); }
//----------------------------------------------------------------------
inline bool FMenuList::isSelected(int index) const
{ return itemlist[uInt(index-1)]->isSelected(); }
2015-11-07 23:16:09 +01:00
//----------------------------------------------------------------------
inline FMenuItem* FMenuList::getSelectedItem() const
{ return selectedItem; }
//----------------------------------------------------------------------
inline void FMenuList::setSelectedItem (FMenuItem* item)
{ selectedItem = item; }
//----------------------------------------------------------------------
inline bool FMenuList::hasSelectedItem() const
{ return selectedItem; }
#endif // _FMENULIST_H