finalcut/src/fmenubar.cpp

974 lines
21 KiB
C++
Raw Normal View History

// File: fmenubar.cpp
// Provides: class FMenuBar
#include "fapp.h"
#include "fmenubar.h"
#include "fstatusbar.h"
2015-09-30 22:39:02 +02:00
//----------------------------------------------------------------------
// class FMenuBar
//----------------------------------------------------------------------
// constructor and destructor
//----------------------------------------------------------------------
2015-09-22 04:18:20 +02:00
FMenuBar::FMenuBar(FWidget* parent)
: FWindow(parent)
, mouse_down(false)
, drop_down(false)
{
2015-09-22 04:18:20 +02:00
init();
}
//----------------------------------------------------------------------
FMenuBar::~FMenuBar()
{
if ( vmenubar != 0 )
{
if ( vmenubar->changes != 0 )
delete[] vmenubar->changes;
if ( vmenubar->text != 0 )
delete[] vmenubar->text;
delete vmenubar;
}
vmenubar = 0;
}
// private methods of FMenuBar
//----------------------------------------------------------------------
void FMenuBar::init()
{
xmin = ymin = 1;
xpos = 1;
ypos = 1;
createArea (vmenubar);
vmenubar->visible = true;
2016-05-16 21:11:32 +02:00
ignore_padding = true;
// initialize geometry values
setGeometry (1, 1, getColumnNumber(), 1, false);
setMenuBar(this);
if ( getRootWidget() )
getRootWidget()->setTopPadding(1, true);
2015-11-12 01:33:16 +01:00
addAccelerator (fc::Fkey_f10);
2015-12-21 18:48:38 +01:00
addAccelerator (fc::Fckey_space);
2015-09-15 23:07:24 +02:00
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
unsetFocusable();
}
2015-09-28 04:31:29 +02:00
//----------------------------------------------------------------------
void FMenuBar::menu_dimension()
{
int item_X = 1;
int item_Y = 1;
std::vector<FMenuItem*>::const_iterator end, iter;
2015-09-28 04:31:29 +02:00
iter = itemlist.begin();
end = itemlist.end();
// find the maximum item width
2015-09-28 04:31:29 +02:00
while ( iter != end )
{
uInt len = (*iter)->getTextLength();
int item_width = int(len + 2);
// set item geometry
(*iter)->setGeometry (item_X, item_Y, item_width, 1, false);
// set menu position
if ( (*iter)->hasMenu() )
(*iter)->getMenu()->setPos (item_X, item_Y, false);
item_X += item_width;
++iter;
}
}
2015-08-16 20:05:39 +02:00
//----------------------------------------------------------------------
bool FMenuBar::isMenu (FMenuItem* mi) const
{
return mi->hasMenu();
}
//----------------------------------------------------------------------
bool FMenuBar::selectNextItem()
{
std::vector<FMenuItem*>::const_iterator iter, end;
iter = itemlist.begin();
end = itemlist.end();
while ( iter != end )
{
if ( (*iter)->isSelected() )
{
FMenuItem* next;
std::vector<FMenuItem*>::const_iterator next_element;
next_element = iter;
do
{
++next_element;
if ( next_element == itemlist.end() )
next_element = itemlist.begin();
next = static_cast<FMenuItem*>(*next_element);
} while ( ! next->isEnabled()
|| ! next->acceptFocus()
|| ! next->isVisible()
|| next->isSeparator() );
if ( next == *iter )
return false;
2015-11-07 23:16:09 +01:00
unselectItem();
next->setSelected();
2015-11-07 23:16:09 +01:00
setSelectedItem(next);
next->setFocus();
if ( drop_down && next->hasMenu() )
{
FMenuItem* first_item;
FMenu* menu = next->getMenu();
next->openMenu();
menu->selectFirstItem();
first_item = menu->getSelectedItem();
if ( first_item )
first_item->setFocus();
menu->redraw();
}
if ( statusBar() )
statusBar()->drawMessage();
redraw();
break;
}
++iter;
}
return true;
}
//----------------------------------------------------------------------
bool FMenuBar::selectPrevItem()
{
std::vector<FMenuItem*>::const_iterator iter, begin;
iter = itemlist.end();
begin = itemlist.begin();
do
{
--iter;
if ( (*iter)->isSelected() )
{
FMenuItem* prev;
std::vector<FMenuItem*>::const_iterator prev_element;
prev_element = iter;
do
{
if ( prev_element == itemlist.begin() )
prev_element = itemlist.end();
--prev_element;
prev = static_cast<FMenuItem*>(*prev_element);
}
while ( ! prev->isEnabled()
|| ! prev->acceptFocus()
|| ! prev->isVisible()
|| prev->isSeparator() );
if ( prev == *iter )
return false;
2015-11-07 23:16:09 +01:00
unselectItem();
prev->setSelected();
prev->setFocus();
if ( drop_down && prev->hasMenu() )
{
2015-11-07 23:16:09 +01:00
FMenuItem* first_item;
FMenu* menu = prev->getMenu();
prev->openMenu();
menu->selectFirstItem();
first_item = menu->getSelectedItem();
2015-11-07 23:16:09 +01:00
if ( first_item )
first_item->setFocus();
2015-11-07 23:16:09 +01:00
menu->redraw();
}
if ( statusBar() )
statusBar()->drawMessage();
2015-11-07 23:16:09 +01:00
setSelectedItem(prev);
redraw();
break;
}
}
while ( iter != begin );
return true;
}
//----------------------------------------------------------------------
bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
{
std::vector<FMenuItem*>::const_iterator iter, end;
iter = itemlist.begin();
end = itemlist.end();
while ( iter != end )
{
if ( (*iter)->isEnabled() )
{
int hotkey = (*iter)->getHotkey();
int key = ev->key();
2015-11-12 01:33:16 +01:00
if ( fc::Fmkey_meta + tolower(hotkey) == key )
{
2015-11-07 23:16:09 +01:00
FMenuItem* sel_item = getSelectedItem();
if ( sel_item && sel_item->hasMenu() )
2015-11-07 23:16:09 +01:00
sel_item->getMenu()->unselectItem();
2015-11-07 23:16:09 +01:00
unselectItem();
if ( (*iter)->hasMenu() )
{
FMenuItem* first_item;
FMenu* menu = (*iter)->getMenu();
(*iter)->setSelected();
2015-11-07 23:16:09 +01:00
setSelectedItem(*iter);
(*iter)->setFocus();
(*iter)->openMenu();
2015-11-07 23:16:09 +01:00
menu->selectFirstItem();
first_item = menu->getSelectedItem();
if ( first_item )
first_item->setFocus();
menu->redraw();
if ( statusBar() )
statusBar()->drawMessage();
redraw();
drop_down = true;
}
else
{
2015-11-07 23:16:09 +01:00
setSelectedItem(0);
redraw();
drop_down = false;
(*iter)->processClicked();
}
ev->accept();
return true;
}
}
++iter;
}
return false;
}
//----------------------------------------------------------------------
int FMenuBar::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length)
{
// find hotkey position in string
// + generate a new string without the '&'-sign
int hotkeypos = -1;
wchar_t* txt = src;
for (uInt i=0; i < length; i++)
{
if ( (i < length) && (txt[i] == L'&') && (hotkeypos == -1) )
{
hotkeypos = int(i);
i++;
src++;
}
*dest++ = *src++;
}
return hotkeypos;
}
//----------------------------------------------------------------------
void FMenuBar::draw()
{
xmin = ymin = 1;
height = 1;
xpos = 1;
drawItems();
}
//----------------------------------------------------------------------
void FMenuBar::drawItems()
{
std::vector<FMenuItem*>::const_iterator iter, end;
int screenWidth;
2015-09-30 22:39:02 +02:00
int x = 1;
screenWidth = getColumnNumber();
width = screenWidth;
ypos = 1;
if ( itemlist.empty() )
return;
updateVTerm(false);
gotoxy (1,1);
2015-10-11 21:56:16 +02:00
if ( isMonochron() )
setReverse(true);
iter = itemlist.begin();
end = itemlist.end();
while ( iter != end )
{
wchar_t* src;
wchar_t* dest;
wchar_t* item_text;
FString txt;
uInt txt_length;
int hotkeypos, startpos, to_char;
bool is_active, is_selected, is_noUnderline;
2015-09-28 04:31:29 +02:00
startpos = x + 1;
is_active = (*iter)->isEnabled();
is_selected = (*iter)->isSelected();
2016-01-24 14:53:09 +01:00
is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
if ( is_active )
{
if ( is_selected )
{
if ( isMonochron() )
setReverse(false);
2015-10-11 21:56:16 +02:00
foregroundColor = wc.menu_active_focus_fg;
backgroundColor = wc.menu_active_focus_bg;
}
else
{
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
}
}
else
{
foregroundColor = wc.menu_inactive_fg;
backgroundColor = wc.menu_inactive_bg;
}
setColor (foregroundColor, backgroundColor);
if ( x < screenWidth )
{
x++;
print (vmenubar, ' ');
}
txt = (*iter)->getText();
2015-09-20 05:44:50 +02:00
txt_length = uInt(txt.getLength());
2015-10-17 19:40:43 +02:00
item_text = new wchar_t[txt_length+1]();
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(item_text);
if ( x-1 <= screenWidth )
to_char = int(txt_length);
else
2015-09-20 05:44:50 +02:00
to_char = int(txt_length) - (screenWidth-x-1);
hotkeypos = getHotkeyPos (src, dest, txt_length);
if ( hotkeypos != -1 )
{
txt_length--;
to_char--;
}
2015-09-20 05:44:50 +02:00
x += int(txt_length);
for (int z=0; z < to_char; z++)
{
if ( startpos > screenWidth-z )
break;
if ( ! iswprint(wint_t(item_text[z])) )
{
if ( ! isNewFont() && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark ) )
{
item_text[z] = L' ';
}
}
if ( (z == hotkeypos) && is_active && ! is_selected )
{
setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg);
if ( ! is_noUnderline )
setUnderline();
print (vmenubar, item_text[z]);
if ( ! is_noUnderline )
unsetUnderline();
setColor (foregroundColor, backgroundColor);
}
else
print (vmenubar, item_text[z]);
}
if ( x > screenWidth+1 )
{
if ( startpos < screenWidth )
{
gotoxy(screenWidth-1,1);
print (vmenubar, "..");
}
2016-01-10 10:42:55 +01:00
else if ( startpos-1 <= screenWidth )
{
gotoxy(screenWidth,1);
print (vmenubar, ' ');
}
}
if ( x < screenWidth )
{
x++;
print (vmenubar, ' ');
}
2015-10-01 03:48:58 +02:00
2015-09-30 22:39:02 +02:00
setColor (wc.menu_active_fg, wc.menu_active_bg);
if ( isMonochron() && is_active && is_selected )
2015-10-11 21:56:16 +02:00
setReverse(true);
delete[] item_text;
++iter;
}
for (; x <= screenWidth; x++)
print (vmenubar, ' ');
2015-10-11 21:56:16 +02:00
if ( isMonochron() )
setReverse(false);
updateVTerm(true);
}
//----------------------------------------------------------------------
void FMenuBar::adjustItems()
{
int item_X = 1;
int item_Y = 1;
std::vector<FMenuItem*>::const_iterator end, iter;
iter = itemlist.begin();
end = itemlist.end();
while ( iter != end )
{
// get item width
int item_width = (*iter)->getWidth();
if ( (*iter)->hasMenu() )
{
FMenu* menu = (*iter)->getMenu();
// set menu position
menu->move (menu->adjustX(item_X), item_Y);
// call menu adjustItems()
menu->adjustItems();
}
item_X += item_width;
++iter;
}
}
//----------------------------------------------------------------------
void FMenuBar::leaveMenuBar()
{
resetMenu();
redraw();
if ( statusBar() )
statusBar()->clearMessage();
switchToPrevWindow();
if ( statusBar() )
statusBar()->drawMessage();
updateTerminal();
flush_out();
mouse_down = false;
}
// public methods of FMenuBar
2015-10-29 21:10:50 +01:00
//----------------------------------------------------------------------
void FMenuBar::onKeyPress (FKeyEvent* ev)
{
switch ( ev->key() )
{
case fc::Fkey_return:
case fc::Fkey_enter:
case fc::Fkey_up:
case fc::Fkey_down:
2015-11-07 23:16:09 +01:00
if ( hasSelectedItem() )
{
2015-11-07 23:16:09 +01:00
FMenuItem* sel_item = getSelectedItem();
if ( sel_item->hasMenu() )
{
FMenuItem* first_item;
FMenu* menu = sel_item->getMenu();
sel_item->openMenu();
2015-11-07 23:16:09 +01:00
menu->selectFirstItem();
first_item = menu->getSelectedItem();
if ( first_item )
first_item->setFocus();
menu->redraw();
if ( statusBar() )
statusBar()->drawMessage();
redraw();
drop_down = true;
}
else if ( ev->key() == fc::Fkey_return
|| ev->key() == fc::Fkey_enter )
{
2015-11-07 23:16:09 +01:00
unselectItem();
redraw();
sel_item->processClicked();
}
}
ev->accept();
break;
2015-10-29 21:10:50 +01:00
case fc::Fkey_left:
selectPrevItem();
2015-10-29 21:10:50 +01:00
ev->accept();
break;
case fc::Fkey_right:
selectNextItem();
2015-10-29 21:10:50 +01:00
ev->accept();
break;
case fc::Fkey_escape:
case fc::Fkey_escape_mintty:
leaveMenuBar();
ev->accept();
break;
2015-10-29 21:10:50 +01:00
default:
break;
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FMenuBar::onMouseDown (FMouseEvent* ev)
{
2016-01-17 02:57:08 +01:00
if ( ev->getButton() != fc::LeftButton )
{
mouse_down = false;
2015-12-20 23:27:33 +01:00
if ( ! itemlist.empty() && hasSelectedItem() )
leaveMenuBar();
2015-12-20 23:27:33 +01:00
else
return;
2015-12-19 20:49:01 +01:00
if ( statusBar() )
statusBar()->clearMessage();
return;
}
if ( mouse_down )
return;
mouse_down = true;
if ( ! isActiveWindow() )
setActiveWindow(this);
if ( ! itemlist.empty() )
{
std::vector<FMenuItem*>::const_iterator iter, end;
int mouse_x, mouse_y;
2015-09-30 22:39:02 +02:00
bool focus_changed = false;
iter = itemlist.begin();
end = itemlist.end();
mouse_x = ev->getX();
mouse_y = ev->getY();
while ( iter != end )
{
int x1, x2;
2015-09-30 22:39:02 +02:00
x1 = (*iter)->getX();
2016-01-10 10:42:55 +01:00
x2 = (*iter)->getX() + (*iter)->getWidth();
if ( mouse_y == 1 )
{
2016-07-03 20:16:43 +02:00
if ( mouse_x >= x1 && mouse_x < x2 )
2015-09-30 22:39:02 +02:00
{
// Mouse pointer over item
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
2015-12-08 21:05:00 +01:00
{
FWidget* focused_widget = getFocusWidget();
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected();
(*iter)->setFocus();
if ( focused_widget && ! focused_widget->isWindow() )
focused_widget->redraw();
(*iter)->openMenu();
setSelectedItem(*iter);
focus_changed = true;
if ( (*iter)->hasMenu() )
2015-12-08 21:05:00 +01:00
{
FMenu* menu = (*iter)->getMenu();
if ( menu->hasSelectedItem() )
{
menu->unselectItem();
menu->redraw();
drop_down = true;
}
2015-12-08 21:05:00 +01:00
}
}
2015-09-30 22:39:02 +02:00
}
else if ( (*iter)->isEnabled() && (*iter)->isSelected() )
2015-09-30 22:39:02 +02:00
{
(*iter)->unsetSelected();
2015-11-07 23:16:09 +01:00
if ( getSelectedItem() == *iter )
setSelectedItem(0);
2015-09-30 22:39:02 +02:00
focus_changed = true;
}
2015-08-16 20:05:39 +02:00
}
++iter;
}
if ( statusBar() )
statusBar()->drawMessage();
2015-09-30 22:39:02 +02:00
if ( focus_changed )
{
2015-09-30 22:39:02 +02:00
redraw();
updateTerminal();
}
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FMenuBar::onMouseUp (FMouseEvent* ev)
{
2016-01-17 02:57:08 +01:00
if ( ev->getButton() != fc::LeftButton )
return;
if ( mouse_down )
{
mouse_down = false;
if ( ! itemlist.empty() )
{
int mouse_x, mouse_y;
std::vector<FMenuItem*>::const_iterator iter, end;
iter = itemlist.begin();
end = itemlist.end();
mouse_x = ev->getX();
mouse_y = ev->getY();
while ( iter != end )
{
int x1, x2;
2015-09-30 22:39:02 +02:00
x1 = (*iter)->getX();
2016-01-10 10:42:55 +01:00
x2 = (*iter)->getX() + (*iter)->getWidth();
if ( mouse_y == 1 )
{
2016-07-03 20:16:43 +02:00
if ( (*iter)->isEnabled() && (*iter)->isSelected() )
2015-09-30 22:39:02 +02:00
{
2016-07-03 20:16:43 +02:00
if ( mouse_x >= x1 && mouse_x < x2 )
2015-09-30 22:39:02 +02:00
{
2016-07-03 20:16:43 +02:00
// Mouse pointer over item
if ( (*iter)->hasMenu() )
{
2016-07-03 20:16:43 +02:00
FMenu* menu = (*iter)->getMenu();
2016-07-03 20:16:43 +02:00
if ( ! menu->hasSelectedItem() )
{
FMenuItem* first_item;
menu->selectFirstItem();
first_item = menu->getSelectedItem();
2016-07-03 20:16:43 +02:00
if ( first_item )
first_item->setFocus();
2016-07-03 20:16:43 +02:00
menu->redraw();
2016-07-03 20:16:43 +02:00
if ( statusBar() )
statusBar()->drawMessage();
2016-07-03 20:16:43 +02:00
redraw();
drop_down = true;
}
}
else
{
(*iter)->unsetSelected();
2016-07-03 20:16:43 +02:00
if ( getSelectedItem() == *iter )
{
setSelectedItem(0);
leaveMenuBar();
drop_down = false;
(*iter)->processClicked();
return;
}
}
2015-09-30 22:39:02 +02:00
}
else
2015-12-20 23:27:33 +01:00
{
(*iter)->unsetSelected();
if ( getSelectedItem() == *iter )
setSelectedItem(0);
2016-07-03 20:16:43 +02:00
redraw();
2015-12-20 23:27:33 +01:00
}
2015-08-22 18:53:52 +02:00
}
2015-11-07 23:16:09 +01:00
}
2016-07-10 03:51:20 +02:00
++iter;
}
if ( ! hasSelectedItem() )
leaveMenuBar();
}
}
}
//----------------------------------------------------------------------
2015-09-20 05:44:50 +02:00
void FMenuBar::onMouseMove (FMouseEvent* ev)
{
2016-01-17 02:57:08 +01:00
if ( ev->getButton() != fc::LeftButton )
return;
if ( ! isActiveWindow() )
setActiveWindow(this);
if ( mouse_down && ! itemlist.empty() )
{
std::vector<FMenuItem*>::const_iterator iter, end;
int mouse_x, mouse_y;
2015-11-22 23:54:05 +01:00
bool mouse_over_menubar = false;
bool focus_changed = false;
iter = itemlist.begin();
end = itemlist.end();
mouse_x = ev->getX();
mouse_y = ev->getY();
2015-11-22 23:54:05 +01:00
if ( getGeometryGlobal().contains(ev->getGlobalPos()) )
mouse_over_menubar = true;
while ( iter != end )
{
int x1, x2;
2015-09-30 22:39:02 +02:00
x1 = (*iter)->getX();
2016-01-10 10:42:55 +01:00
x2 = (*iter)->getX() + (*iter)->getWidth();
2015-09-28 04:31:29 +02:00
if ( mouse_x >= x1
2016-01-10 10:42:55 +01:00
&& mouse_x < x2
&& mouse_y == 1 )
{
2015-11-22 21:41:18 +01:00
// Mouse pointer over item
2015-10-29 21:10:50 +01:00
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
{
FWidget* focused_widget = getFocusWidget();
2016-01-17 02:57:08 +01:00
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
(*iter)->setSelected();
2015-10-29 21:10:50 +01:00
(*iter)->setFocus();
if ( focused_widget && ! focused_widget->isWindow() )
2015-12-08 21:05:00 +01:00
focused_widget->redraw();
(*iter)->openMenu();
2015-11-07 23:16:09 +01:00
setSelectedItem(*iter);
focus_changed = true;
if ( (*iter)->hasMenu() )
{
FMenu* menu = (*iter)->getMenu();
if ( menu->hasSelectedItem() )
{
menu->unselectItem();
menu->redraw();
drop_down = true;
}
}
}
else if ( statusBar() )
statusBar()->clearMessage();
}
else
{
2015-11-22 23:54:05 +01:00
if ( mouse_over_menubar
2015-10-29 21:10:50 +01:00
&& (*iter)->isEnabled()
&& (*iter)->isSelected() )
{
2015-11-22 21:41:18 +01:00
// Unselect selected item without mouse focus
(*iter)->unsetSelected();
2015-11-07 23:16:09 +01:00
if ( getSelectedItem() == *iter )
setSelectedItem(0);
focus_changed = true;
drop_down = false;
}
2015-11-07 23:16:09 +01:00
else if ( hasSelectedItem() && getSelectedItem()->hasMenu() )
{
// Mouse event handover to the menu
2015-11-07 23:16:09 +01:00
FMenu* menu = getSelectedItem()->getMenu();
const FRect& menu_geometry = menu->getGeometryGlobal();
if ( menu->count() > 0
&& menu_geometry.contains(ev->getGlobalPos()) )
{
FMouseEvent* _ev;
const FPoint& g = ev->getGlobalPos();
const FPoint& p = menu->globalToLocalPos(g);
int b = ev->getButton();
_ev = new FMouseEvent (fc::MouseMove_Event, p, g, b);
2015-11-07 23:16:09 +01:00
menu->mouse_down = true;
setClickedWidget(menu);
2015-11-25 22:10:23 +01:00
menu->onMouseMove(_ev);
delete _ev;
}
}
}
++iter;
}
if ( statusBar() )
statusBar()->drawMessage();
if ( focus_changed )
{
2015-09-22 04:18:20 +02:00
redraw();
updateTerminal();
}
}
}
//----------------------------------------------------------------------
void FMenuBar::onAccel (FAccelEvent* ev)
{
2015-11-07 23:16:09 +01:00
unselectItem();
selectFirstItem();
getSelectedItem()->setFocus();
2015-11-07 23:16:09 +01:00
if ( statusBar() )
statusBar()->drawMessage();
2015-11-07 23:16:09 +01:00
redraw();
ev->accept();
}
//----------------------------------------------------------------------
void FMenuBar::hide()
{
int screenWidth;
short fg, bg;
char* blank;
FWindow::hide();
fg = wc.term_fg;
bg = wc.term_bg;
setColor (fg, bg);
screenWidth = getColumnNumber();
blank = new char[screenWidth+1];
memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
2015-09-30 22:39:02 +02:00
gotoxy (1,1);
print (vmenubar, blank);
delete[] blank;
}
//----------------------------------------------------------------------
void FMenuBar::resetMenu()
{
2015-11-07 23:16:09 +01:00
unselectItem();
drop_down = false;
}
//----------------------------------------------------------------------
void FMenuBar::adjustSize()
{
xmin = ymin = 1;
height = 1;
xpos = 1;
width = getColumnNumber();
ypos = 1;
adjustItems();
}
//----------------------------------------------------------------------
void FMenuBar::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
{
int old_width = width;
int old_height = height;
FWidget::setGeometry (xx, yy, ww, hh, adjust);
if ( vmenubar && (width != old_width || height != old_height) )
resizeArea (vmenubar);
}
2015-09-30 22:39:02 +02:00
//----------------------------------------------------------------------
void FMenuBar::cb_item_deactivated (FWidget* widget, void*)
{
FMenuItem* menuitem = static_cast<FMenuItem*>(widget);
if ( menuitem->hasMenu() )
{
FMenu* menu = menuitem->getMenu();
2015-10-19 00:07:07 +02:00
menu->hide();
menu->hideSubMenus();
}
}