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
Shinya Kitaoka 120a6e
class DVAPI TMenubar : public TWidget {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TMenubar(TWidget *parent, string name = "menubar");
Shinya Kitaoka 120a6e
  void configureNotify(const TDimension &);
Shinya Kitaoka 120a6e
  void draw();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int getMinWidth();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//--------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TMenubarItem : public TWidget, public TPopupMenuListener {
Shinya Kitaoka 120a6e
  bool m_highlighted, m_pressed;
Shinya Kitaoka 120a6e
  TPopupMenu *m_popupMenu;
Shinya Kitaoka 120a6e
  wstring m_title;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  /*virtual*/ void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TMenubarItem(TMenubar *menubar, string name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void draw();
Shinya Kitaoka 120a6e
  void enter(const TPoint &p);
Shinya Kitaoka 120a6e
  void leave(const TPoint &p);
Shinya Kitaoka 120a6e
  void leftButtonDown(const TMouseEvent &e);
Shinya Kitaoka 120a6e
  void leftButtonUp(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPopupMenu *getMenu() const { return m_popupMenu; }
Shinya Kitaoka 120a6e
  TPopupMenuItem *addItem(string cmdname);
Shinya Kitaoka 120a6e
  // TPopupMenuItem *addItem(string cmdname, string title, string help);
Shinya Kitaoka 120a6e
  void addSeparator();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onMenuSelect(TPopupMenuItem *);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDimension getPreferredSize() const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif