2015-08-09 23:47:08 +02:00
|
|
|
// fmenulist.h
|
|
|
|
// class FMenuList
|
|
|
|
|
|
|
|
#ifndef _FMENULIST_H
|
|
|
|
#define _FMENULIST_H
|
|
|
|
|
|
|
|
#include "fmenuitem.h"
|
2015-08-16 20:05:39 +02:00
|
|
|
#include "fwidget.h"
|
2015-08-09 23:47:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
┌─────────┐ ┌──────────┐
|
|
|
|
│ FWindow │◄───┬──┤ FMenuBar │
|
|
|
|
└─────────┘ │ └──────────┘
|
2015-08-11 00:11:07 +02:00
|
|
|
┌───────────┐◄───┘ ┌───────────┐
|
2015-08-09 23:47:08 +02:00
|
|
|
│ FMenuList ├-------┤ FMenuItem │
|
2015-08-16 20:05:39 +02:00
|
|
|
└───────────┘◄───┐ └───┬───────┘
|
|
|
|
┌─────────┐ │ ┌───┴───┐
|
2015-08-30 13:11:49 +02:00
|
|
|
│ FWindow │◄───┴──┤ FMenu │
|
2015-08-16 20:05:39 +02:00
|
|
|
└─────────┘ └───────┘
|
2015-08-09 23:47:08 +02:00
|
|
|
*/
|
|
|
|
|
2015-08-16 20:05:39 +02:00
|
|
|
|
2015-08-09 23:47:08 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMenuList
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMenuList
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
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;
|
|
|
|
void activateItem (int);
|
|
|
|
void deactivateItem (int);
|
|
|
|
bool isSelected (int) const;
|
|
|
|
bool hasSelectedItem();
|
|
|
|
|
|
|
|
virtual void insert (FMenuItem*);
|
|
|
|
virtual void remove (FMenuItem*);
|
|
|
|
void remove (int);
|
|
|
|
void clear();
|
2015-08-09 23:47:08 +02:00
|
|
|
};
|
|
|
|
#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)]; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FMenuList::activateItem (int index)
|
|
|
|
{ itemlist[uInt(index-1)]->setActive(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline void FMenuList::deactivateItem (int index)
|
|
|
|
{ itemlist[uInt(index-1)]->unsetActive(); }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FMenuList::isSelected(int index) const
|
|
|
|
{ return itemlist[uInt(index-1)]->isSelected(); }
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _FMENULIST_H
|