Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TNZ_MENUBAR_INCLUDED
Toshihiro Shimizu 890ddd
#define TNZ_MENUBAR_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/tw.h"
Toshihiro Shimizu 890ddd
#include "tw/popupmenu.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TWIN_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//--------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TMenubar : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TMenubar(TWidget *parent, string name = "menubar");
Toshihiro Shimizu 890ddd
	void configureNotify(const TDimension &);
Toshihiro Shimizu 890ddd
	void draw();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int getMinWidth();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//--------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TMenubarItem : public TWidget, public TPopupMenuListener
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	bool m_highlighted, m_pressed;
Toshihiro Shimizu 890ddd
	TPopupMenu *m_popupMenu;
Toshihiro Shimizu 890ddd
	wstring m_title;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	/*virtual*/ void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TMenubarItem(
Toshihiro Shimizu 890ddd
		TMenubar *menubar,
Toshihiro Shimizu 890ddd
		string name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void draw();
Toshihiro Shimizu 890ddd
	void enter(const TPoint &p);
Toshihiro Shimizu 890ddd
	void leave(const TPoint &p);
Toshihiro Shimizu 890ddd
	void leftButtonDown(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
	void leftButtonUp(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPopupMenu *getMenu() const { return m_popupMenu; }
Toshihiro Shimizu 890ddd
	TPopupMenuItem *addItem(string cmdname);
Toshihiro Shimizu 890ddd
	// TPopupMenuItem *addItem(string cmdname, string title, string help);
Toshihiro Shimizu 890ddd
	void addSeparator();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void onMenuSelect(TPopupMenuItem *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDimension getPreferredSize() const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif