libyui
3.0.10
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
Friends
YMenuItem.h
1
/*
2
Copyright (C) 2000-2012 Novell, Inc
3
This library is free software; you can redistribute it and/or modify
4
it under the terms of the GNU Lesser General Public License as
5
published by the Free Software Foundation; either version 2.1 of the
6
License, or (at your option) version 3.0 of the License. This library
7
is distributed in the hope that it will be useful, but WITHOUT ANY
8
WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
License for more details. You should have received a copy of the GNU
11
Lesser General Public License along with this library; if not, write
12
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13
Floor, Boston, MA 02110-1301 USA
14
*/
15
16
17
/*-/
18
19
File: YMenuItem.h
20
21
Author: Stefan Hundhammer <sh@suse.de>
22
23
/-*/
24
25
#ifndef YMenuItem_h
26
#define YMenuItem_h
27
28
#include "YTreeItem.h"
29
30
31
32
/**
33
* Item class for menu items.
34
**/
35
class
YMenuItem
:
public
YTreeItem
36
{
37
public
:
38
/**
39
* Constructors for toplevel items.
40
**/
41
YMenuItem
(
const
std::string &
label
)
42
:
YTreeItem
( label )
43
{}
44
45
YMenuItem
(
const
std::string &
label
,
46
const
std::string &
iconName
)
47
:
YTreeItem
( label, iconName )
48
{}
49
50
/**
51
* Constructors for items that have a parent item.
52
*
53
* They will automatically register this item with the parent item. The
54
* parent assumes ownership of this item and will delete it in its (the
55
* parent's) destructor.
56
**/
57
YMenuItem
(
YMenuItem
*
parent
,
58
const
std::string &
label
)
59
:
YTreeItem
( parent, label )
60
{}
61
62
YMenuItem
(
YMenuItem
*
parent
,
63
const
std::string &
label
,
64
const
std::string &
iconName
)
65
:
YTreeItem
( parent, label, iconName )
66
{}
67
68
/**
69
* Destructor.
70
*
71
* This will delete all children.
72
**/
73
virtual
~YMenuItem
() {}
74
75
76
/**
77
* Returns this item's parent item or 0 if it is a toplevel item.
78
**/
79
YMenuItem
*
parent
()
const
80
{
return
dynamic_cast<
YMenuItem
*
>
(
YTreeItem::parent
() ); }
81
82
83
private
:
84
85
// Disable unwanted base class methods
86
87
bool
isOpen()
const
{
return
false
; }
88
void
setOpen(
bool
) {}
89
};
90
91
92
#endif // YMenuItem_h
YMenuItem::YMenuItem
YMenuItem(YMenuItem *parent, const std::string &label)
Definition:
YMenuItem.h:57
YMenuItem
Definition:
YMenuItem.h:35
YMenuItem::~YMenuItem
virtual ~YMenuItem()
Definition:
YMenuItem.h:73
YTreeItem::parent
virtual YTreeItem * parent() const
Definition:
YTreeItem.h:129
YItem::iconName
std::string iconName() const
Definition:
YItem.h:86
YMenuItem::parent
YMenuItem * parent() const
Definition:
YMenuItem.h:79
YMenuItem::YMenuItem
YMenuItem(const std::string &label)
Definition:
YMenuItem.h:41
YItem::label
std::string label() const
Definition:
YItem.h:76
YTreeItem
Definition:
YTreeItem.h:37
src
YMenuItem.h
Generated by
1.8.5