FDOSTUI
FreeDOS Text User Interface
menubar.hpp
Go to the documentation of this file.
1 /*
2  MENUBAR.HPP
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __menubar_hpp__
11 
12 #include "widget.hpp"
13 #include "menuitem.h"
14 
15 class menubar : public widget
16 {
17 
18 public:
19 
20  menubar(
21  int const i_pos_x,
22  int const i_pos_y,
23  unsigned int const i_len_x,
24  unsigned int const i_len_y);
25 
26  virtual
27  ~menubar();
28 
29  virtual void
30  draw() const;
31 
32  enum event_response
34  enum scancodes const i_scan);
35 
36  virtual enum event_response
37  event_key(
38  struct event_key const& i_event);
39 
40  virtual enum event_response
42  struct event_mouse const& i_event);
43 
44  void
45  set_menu(
46  struct menuitembar const* i_menu);
47 
48 protected:
49 
50  struct item
51  {
52  struct menuitembar const* m_menu;
53  int m_pos_x;
54  unsigned int m_len_x;
55  };
56 
57  unsigned m_selected;
58  struct item* m_item;
59  size_t m_item_count;
60 
61 private:
62 
63  menubar();
64 
65  menubar(
66  const menubar&);
67 
68  menubar&
69  operator=(menubar const&);
70 
71  void
72  draw_item(
73  struct item const& i_item) const;
74 
75  void
76  popup(
77  struct item& i_item);
78 
79 };
80 
81 #define __menubarbar_hpp__
82 #endif
scancodes
ASCII Scan Codes.
Definition: keyboard.h:26
contains widget class
void set_menu(struct menuitembar const *i_menu)
sets the menu
Definition: menubar.cpp:46
base class for all derived widgets
Definition: widget.hpp:19
virtual enum event_response event_mouse(struct event_mouse const &i_event)
handle mouse event
Definition: menubar.cpp:305
enum event_response event_key_default(enum scancodes const i_scan)
default scan code event handler
Definition: menubar.cpp:147
struct item * m_item
Definition: menubar.hpp:58
a menu bar item
Definition: menuitem.h:44
virtual void draw() const
draws the widget
Definition: menubar.cpp:125
convenience container to hold a menu item
Definition: menubar.hpp:50
int m_pos_x
Definition: menubar.hpp:53
event_response
response
Definition: event.h:14
Allows a user to choose a menu item from a horizontal list.
Definition: menubar.hpp:15
size_t m_item_count
Definition: menubar.hpp:59
void draw_item(struct item const &i_item) const
draw a menu item to the display
Definition: menubar.cpp:77
struct menuitembar const * m_menu
Definition: menubar.hpp:52
virtual enum event_response event_key(struct event_key const &i_event)
handle key event
Definition: menubar.cpp:210
unsigned int m_len_x
Definition: menubar.hpp:54
virtual ~menubar()
destructor
Definition: menubar.cpp:39
container for a mouse event
Definition: event.h:37
unsigned m_selected
Definition: menubar.hpp:57
container for a keyboard event
Definition: event.h:23