Simple GUI Library
menu_bar.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)s
3 * @file menu_bar.h
4 * @date 2021-11-10
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "../controls/button.h"
12#include "context_menu.h"
13
14namespace Sgl
15{
16 class Menu
17 {
18 public:
19 Menu(Scene* scene, const char* title);
20 ~Menu();
21
22 const char* getTitle() const;
23 Button* getTitleButton();
24 ContextMenu* getContextMenu();
25
26 private:
27 Button* m_TitleButton = nullptr;
28 ContextMenu* m_ContextMenu = nullptr;
29 };
30
31 class MenuBar : public HBox
32 {
33 public:
34 static const Background DEFAULT_BACKGROUND;
35 static const Border DEFAULT_BORDER;
36
37 public:
38 MenuBar(Scene* scene);
39 virtual ~MenuBar() override;
40
41 Menu* addMenu(const char* title);
42 Menu* getMenu(const char* title);
43
44 void showMenu(Menu* menu);
45 void hideMenu(Menu* menu);
46
47 private:
48 std::list<Menu*> m_Menus;
49 };
50}