2015-09-25 21:37:19 +02:00
|
|
|
// File: fmenubar.h
|
|
|
|
// Provides: class FMenuBar
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▔▔▏1 *▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWindow ▏ ▕ FMenuList ▏- - - -▕ FMenuItem ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FMenuBar ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▏
|
2015-08-09 23:47:08 +02:00
|
|
|
|
|
|
|
#ifndef _FMENUBAR_H
|
|
|
|
#define _FMENUBAR_H
|
|
|
|
|
2015-09-28 04:31:29 +02:00
|
|
|
#include "fmenu.h"
|
2015-10-10 03:14:14 +02:00
|
|
|
#include "fmenulist.h"
|
2015-09-28 04:31:29 +02:00
|
|
|
#include "fwindow.h"
|
2015-08-09 23:47:08 +02:00
|
|
|
|
2015-09-25 21:37:19 +02:00
|
|
|
|
2015-08-09 23:47:08 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FMenuBar
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FMenuBar : public FWindow, public FMenuList
|
|
|
|
{
|
|
|
|
private:
|
2015-09-30 22:39:02 +02:00
|
|
|
bool mouse_down;
|
2015-11-05 23:25:21 +01:00
|
|
|
bool drop_down;
|
2015-08-09 23:47:08 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
FMenuBar (const FMenuBar&);
|
|
|
|
FMenuBar& operator = (const FMenuBar&);
|
2015-11-05 23:25:21 +01:00
|
|
|
void init();
|
|
|
|
void menu_dimension();
|
|
|
|
bool isMenu (FMenuItem*) const;
|
|
|
|
bool selectNextItem();
|
|
|
|
bool selectPrevItem();
|
|
|
|
bool hotkeyMenu (FKeyEvent*&);
|
|
|
|
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
|
|
|
void draw();
|
|
|
|
void drawItems();
|
2015-12-16 23:57:14 +01:00
|
|
|
void adjustItems();
|
2015-11-15 19:46:33 +01:00
|
|
|
void leaveMenuBar();
|
2015-08-09 23:47:08 +02:00
|
|
|
|
|
|
|
public:
|
2015-09-27 16:45:28 +02:00
|
|
|
explicit FMenuBar (FWidget* = 0); // constructor
|
2015-08-09 23:47:08 +02:00
|
|
|
virtual ~FMenuBar(); // destructor
|
|
|
|
virtual const char* getClassName() const;
|
|
|
|
|
2015-11-01 22:45:23 +01:00
|
|
|
void onKeyPress (FKeyEvent*);
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
|
|
|
void onMouseMove (FMouseEvent*);
|
2015-11-04 00:14:23 +01:00
|
|
|
void onAccel (FAccelEvent*);
|
2015-11-01 22:45:23 +01:00
|
|
|
void hide();
|
2015-11-05 23:25:21 +01:00
|
|
|
void resetMenu();
|
2015-12-16 23:57:14 +01:00
|
|
|
void adjustSize();
|
2015-09-22 04:18:20 +02:00
|
|
|
// make every setGeometry from FWidget available
|
|
|
|
using FWidget::setGeometry;
|
2015-11-01 22:45:23 +01:00
|
|
|
void setGeometry (int, int, int, int, bool = true);
|
|
|
|
void cb_item_deactivated (FWidget*, void*);
|
2015-09-28 04:31:29 +02:00
|
|
|
|
|
|
|
private:
|
2015-10-19 00:07:07 +02:00
|
|
|
friend class FMenu;
|
2015-09-28 04:31:29 +02:00
|
|
|
friend class FMenuItem;
|
2015-08-09 23:47:08 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FMenuBar inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FMenuBar::getClassName() const
|
|
|
|
{ return "FMenuBar"; }
|
|
|
|
|
|
|
|
#endif // _FMENUBAR_H
|