SPTK Home Page
sptk5
gui
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
32
namespace
sptk {
33
45
class
SP_EXPORT
CMenuBar
46
:
public
Fl_Menu_Bar
47
,
public
CLayoutClient
48
{
49
public
:
53
CMenuBar
()
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
sptk::CLayoutClient
Definition:
CLayoutClient.h:82
sptk::CLayoutClient::load
virtual void load(const xdoc::SNode &node, CLayoutXMLmode xmlMode)
sptk::CMenuBar
Menu bar.
Definition:
CMenuBar.h:48
sptk::CMenuBar::creator
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
Definition:
CMenuBar.h:75
sptk::CMenuBar::preferredSize
bool preferredSize(int &w, int &h) override
Definition:
CMenuBar.h:65
sptk::CMenuBar::className
String className() const override
Returns widget class name (internal SPTK RTTI).
Definition:
CMenuBar.h:85
sptk::CMenuBar::CMenuBar
CMenuBar()
Definition:
CMenuBar.h:53
sptk::String
Definition:
String.h:49
sptk::CLayoutAlign
CLayoutAlign
Definition:
CLayoutClient.h:44
sptk::CLayoutAlign::TOP
@ TOP
Align to the right.
sptk::CLayoutXMLmode::LAYOUTDATA
@ LAYOUTDATA
Fri Oct 14 2022 09:58:31: SPTK 5.4.1