libyui-mga  1.1.0
YMGAMenuBar.cc
1 /*
2  Copyright 2020 by Angelo Naselli <anaselli at linux dot it>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 
17 
18 /*-/
19 
20  File: YMGAMenuBar.cc
21 
22  Author: Angelo Naselli <anaselli@linux.it>
23 
24 /-*/
25 
26 #define YUILogComponent "mga-ui"
27 #include "YUILog.h"
28 
29 #include "YUISymbols.h"
30 #include "YMGAMenuBar.h"
31 #include "YMGAMenuItem.h"
32 
33 
34 YMGAMenuBar::YMGAMenuBar ( YWidget* parent )
35  :YSelectionWidget ( parent,
36  "", // label
37  true ) // enforceSingleSelection
38 {
39  setDefaultStretchable ( YD_HORIZ, true );
40  setDefaultStretchable ( YD_VERT, true );
41 }
42 
43 
45 {
46 }
47 
48 void YMGAMenuBar::enableItem(YItem* menu_item, bool enable)
49 {
50  YMGAMenuItem * item = dynamic_cast<YMGAMenuItem *>(menu_item);
51  YUI_CHECK_NEW ( item );
52 
53  item->enable(enable);
54 }
55 
56 void YMGAMenuBar::hideItem(YItem* menu_item, bool invisible)
57 {
58  YMGAMenuItem * item = dynamic_cast<YMGAMenuItem *>(menu_item);
59  YUI_CHECK_NEW ( item );
60 
61  item->hide(invisible);
62 }
virtual void hideItem(YItem *menu_item, bool invisible=true)
Hide YMGAMenuItem (menu name or menu entry) to hide/show it into menubar or menu.
Definition: YMGAMenuBar.cc:56
virtual void enableItem(YItem *menu_item, bool enable=true)
Enable YMGAMenuItem (menu name or menu entry) to enable/disable it into menubar or menu.
Definition: YMGAMenuBar.cc:48
YMGAMenuBar(YWidget *parent)
Constructor.
Definition: YMGAMenuBar.cc:34
virtual ~YMGAMenuBar()
Destructor.
Definition: YMGAMenuBar.cc:44
New Menu Item class for menu items.
Definition: YMGAMenuItem.h:36
virtual void hide(bool invisibile=true)
hide/show Menu Item
Definition: YMGAMenuItem.h:106
virtual void enable(bool en=true)
enable/disable Menu Item
Definition: YMGAMenuItem.h:92