2015-09-25 21:37:19 +02:00
|
|
|
// File: fmenubar.h
|
|
|
|
// Provides: class FMenuBar
|
|
|
|
//
|
|
|
|
// Inheritance diagram
|
|
|
|
// ═══════════════════
|
|
|
|
//
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FObject ▏ ▕ FTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
2016-10-11 04:57:36 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FVTerm ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
2015-09-25 21:37:19 +02:00
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWidget ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▏ ▕▔▔▔▔▔▔▔▔▔▔▔▏1 *▕▔▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FWindow ▏ ▕ FMenuList ▏- - - -▕ FMenuItem ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏ ▕▁▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
// ▲ ▲
|
|
|
|
// │ │
|
|
|
|
// └─────┬─────┘
|
|
|
|
// │
|
|
|
|
// ▕▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
// ▕ FMenuBar ▏
|
|
|
|
// ▕▁▁▁▁▁▁▁▁▁▁▏
|
2015-08-09 23:47:08 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FMENUBAR_H
|
|
|
|
#define FMENUBAR_H
|
2015-08-09 23:47:08 +02:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
public:
|
2016-09-30 04:55:28 +02:00
|
|
|
// Constructor
|
|
|
|
explicit FMenuBar (FWidget* = 0);
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2016-09-30 04:55:28 +02:00
|
|
|
// Destructor
|
|
|
|
virtual ~FMenuBar();
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Accessors
|
2015-08-09 23:47:08 +02:00
|
|
|
virtual const char* getClassName() const;
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Methods
|
|
|
|
void hide();
|
|
|
|
void resetMenu();
|
|
|
|
void adjustSize();
|
2016-09-30 04:55:28 +02:00
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
// Event handlers
|
|
|
|
void onKeyPress (FKeyEvent*);
|
|
|
|
void onMouseDown (FMouseEvent*);
|
|
|
|
void onMouseUp (FMouseEvent*);
|
|
|
|
void onMouseMove (FMouseEvent*);
|
|
|
|
void onAccel (FAccelEvent*);
|
2016-09-30 04:55:28 +02:00
|
|
|
|
|
|
|
// Callback methods
|
2017-02-24 00:30:07 +01:00
|
|
|
void cb_item_deactivated (FWidget*, data_ptr);
|
2015-09-28 04:31:29 +02:00
|
|
|
|
|
|
|
private:
|
2016-11-02 00:37:58 +01:00
|
|
|
// Disable copy constructor
|
|
|
|
FMenuBar (const FMenuBar&);
|
|
|
|
|
|
|
|
// Disable assignment operator (=)
|
|
|
|
FMenuBar& operator = (const FMenuBar&);
|
|
|
|
|
|
|
|
// Inquiry
|
|
|
|
bool isMenu (FMenuItem*) const;
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
void init();
|
|
|
|
void calculateDimensions();
|
|
|
|
bool selectNextItem();
|
|
|
|
bool selectPrevItem();
|
|
|
|
bool hotkeyMenu (FKeyEvent*&);
|
|
|
|
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
|
|
|
void draw();
|
|
|
|
void drawItems();
|
|
|
|
void adjustItems();
|
|
|
|
void leaveMenuBar();
|
|
|
|
|
|
|
|
// Friend classes
|
2015-10-19 00:07:07 +02:00
|
|
|
friend class FMenu;
|
2015-09-28 04:31:29 +02:00
|
|
|
friend class FMenuItem;
|
2016-11-02 00:37:58 +01:00
|
|
|
|
|
|
|
// Data Members
|
|
|
|
bool mouse_down;
|
|
|
|
bool drop_down;
|
2015-08-09 23:47:08 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
|
|
|
|
// FMenuBar inline functions
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FMenuBar::getClassName() const
|
|
|
|
{ return "FMenuBar"; }
|
|
|
|
|
2016-11-02 00:37:58 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline bool FMenuBar::isMenu (FMenuItem* mi) const
|
|
|
|
{ return mi->hasMenu(); }
|
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FMENUBAR_H
|