sptk2 logo
SPTK Home Page
CMenuBar.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <FL/Fl_Menu_Bar.H>
30#include <sptk5/gui/CLayoutClient.h>
31
32namespace sptk {
33
45class SP_EXPORT CMenuBar
46 : public Fl_Menu_Bar
47 , public CLayoutClient
48{
49public:
54 : Fl_Menu_Bar(0, 0, 10, 10)
55 , CLayoutClient(this, 10, CLayoutAlign::TOP)
56 {
57 box(FL_THIN_UP_BOX);
58 }
59
65 bool preferredSize(int& w, int& h) override
66 {
67 h = textsize() + 10;
68 return false;
69 }
70
75 static CLayoutClient* creator(const xdoc::SNode& node)
76 {
77 CMenuBar* widget = new CMenuBar;
78 widget->load(node, CLayoutXMLmode::LAYOUTDATA);
79 return widget;
80 }
81
85 String className() const override
86 {
87 return "menu";
88 }
89};
93} // namespace sptk
Definition: CLayoutClient.h:82
virtual void load(const xdoc::SNode &node, CLayoutXMLmode xmlMode)
Menu bar.
Definition: CMenuBar.h:48
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
Definition: CMenuBar.h:75
bool preferredSize(int &w, int &h) override
Definition: CMenuBar.h:65
String className() const override
Returns widget class name (internal SPTK RTTI).
Definition: CMenuBar.h:85
CMenuBar()
Definition: CMenuBar.h:53
Definition: String.h:49
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

Fri Oct 14 2022 09:58:31: SPTK 5.4.1