Refactoring of some functions
This commit is contained in:
parent
1435d9d362
commit
e0f4872d6e
|
@ -25,7 +25,8 @@
|
||||||
|
|
||||||
// function prototypes
|
// function prototypes
|
||||||
void cb_quit (FWidget*, FWidget::data_ptr);
|
void cb_quit (FWidget*, FWidget::data_ptr);
|
||||||
|
void populateChoice (std::vector<FRadioButton*>&, FButtonGroup*);
|
||||||
|
void preset (std::vector<FRadioButton*>&);
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// callback functions
|
// callback functions
|
||||||
|
@ -36,6 +37,52 @@ void cb_quit (FWidget*, FWidget::data_ptr data)
|
||||||
dlg->close();
|
dlg->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void populateChoice (std::vector<FRadioButton*>& os, FButtonGroup* group)
|
||||||
|
{
|
||||||
|
os[0] = new FRadioButton("AIX", group);
|
||||||
|
os[1] = new FRadioButton("Cygwin", group);
|
||||||
|
os[2] = new FRadioButton("FreeBSD", group);
|
||||||
|
os[3] = new FRadioButton("HP-UX", group);
|
||||||
|
os[4] = new FRadioButton("Linux", group);
|
||||||
|
os[5] = new FRadioButton("Mac OS X", group);
|
||||||
|
os[6] = new FRadioButton("NetBSD", group);
|
||||||
|
os[7] = new FRadioButton("OpenBSD", group);
|
||||||
|
os[8] = new FRadioButton("Solaris", group);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void preset (std::vector<FRadioButton*>& os)
|
||||||
|
{
|
||||||
|
#if defined(_AIX)
|
||||||
|
os[0]->setChecked();
|
||||||
|
os[0]->setFocus();
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
os[1]->setChecked();
|
||||||
|
os[1]->setFocus();
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
os[2]->setChecked();
|
||||||
|
os[2]->setFocus();
|
||||||
|
#elif defined(__hpux)
|
||||||
|
os[3]->setChecked();
|
||||||
|
os[3]->setFocus();
|
||||||
|
#elif defined(__linux__)
|
||||||
|
os[4]->setChecked();
|
||||||
|
os[4]->setFocus();
|
||||||
|
#elif defined(__APPLE__) && defined(__MACH__)
|
||||||
|
os[5]->setChecked();
|
||||||
|
os[5]->setFocus();
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
os[6]->setChecked();
|
||||||
|
os[6]->setFocus();
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
os[7]->setChecked();
|
||||||
|
os[7]->setFocus();
|
||||||
|
#elif defined(__sun) && defined(__SVR4)
|
||||||
|
os[8]->setChecked();
|
||||||
|
os[8]->setFocus();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// main part
|
// main part
|
||||||
|
@ -63,57 +110,16 @@ int main (int argc, char* argv[])
|
||||||
checkButtonGroup->setGeometry (2, 1, 16, 7);
|
checkButtonGroup->setGeometry (2, 1, 16, 7);
|
||||||
|
|
||||||
// Create radio buttons
|
// Create radio buttons
|
||||||
FRadioButton* os1 = new FRadioButton("AIX", checkButtonGroup);
|
std::vector<FRadioButton*> os (9);
|
||||||
FRadioButton* os2 = new FRadioButton("Cygwin", checkButtonGroup);
|
populateChoice (os, checkButtonGroup);
|
||||||
FRadioButton* os3 = new FRadioButton("FreeBSD", checkButtonGroup);
|
|
||||||
FRadioButton* os4 = new FRadioButton("HP-UX", checkButtonGroup);
|
|
||||||
FRadioButton* os5 = new FRadioButton("Linux", checkButtonGroup);
|
|
||||||
FRadioButton* os6 = new FRadioButton("Mac OS X", checkButtonGroup);
|
|
||||||
FRadioButton* os7 = new FRadioButton("NetBSD", checkButtonGroup);
|
|
||||||
FRadioButton* os8 = new FRadioButton("OpenBSD", checkButtonGroup);
|
|
||||||
FRadioButton* os9 = new FRadioButton("Solaris", checkButtonGroup);
|
|
||||||
|
|
||||||
// Set the radio button geometry
|
// Set the radio button geometry
|
||||||
// => checkButtonGroup->setScrollSize(...) is not required
|
// => checkButtonGroup->setScrollSize(...) is not required
|
||||||
// because a FButtonGroup is self-adjusting
|
// because a FButtonGroup is self-adjusting
|
||||||
os1->setGeometry(1, 1, 12, 1);
|
for (uInt i = 0; i < os.size(); i++)
|
||||||
os2->setGeometry(1, 2, 12, 1);
|
os[i]->setGeometry(1, int(1 + i), 12, 1);
|
||||||
os3->setGeometry(1, 3, 12, 1);
|
|
||||||
os4->setGeometry(1, 4, 12, 1);
|
|
||||||
os5->setGeometry(1, 5, 12, 1);
|
|
||||||
os6->setGeometry(1, 6, 12, 1);
|
|
||||||
os7->setGeometry(1, 7, 12, 1);
|
|
||||||
os8->setGeometry(1, 8, 12, 1);
|
|
||||||
os9->setGeometry(1, 9, 12, 1);
|
|
||||||
|
|
||||||
#if defined(_AIX)
|
preset(os);
|
||||||
os1->setChecked();
|
|
||||||
os1->setFocus();
|
|
||||||
#elif defined(__CYGWIN__)
|
|
||||||
os2->setChecked();
|
|
||||||
os2->setFocus();
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
os3->setChecked();
|
|
||||||
os3->setFocus();
|
|
||||||
#elif defined(__hpux)
|
|
||||||
os4->setChecked();
|
|
||||||
os4->setFocus();
|
|
||||||
#elif defined(__linux__)
|
|
||||||
os5->setChecked();
|
|
||||||
os5->setFocus();
|
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
|
||||||
os6->setChecked();
|
|
||||||
os6->setFocus();
|
|
||||||
#elif defined(__NetBSD__)
|
|
||||||
os7->setChecked();
|
|
||||||
os7->setFocus();
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
os8->setChecked();
|
|
||||||
os8->setFocus();
|
|
||||||
#elif defined(__sun) && defined(__SVR4)
|
|
||||||
os9->setChecked();
|
|
||||||
os9->setFocus();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Scroll to the focused child element
|
// Scroll to the focused child element
|
||||||
FFocusEvent cfi (fc::ChildFocusIn_Event);
|
FFocusEvent cfi (fc::ChildFocusIn_Event);
|
||||||
|
|
|
@ -274,6 +274,10 @@ class MyDialog : public FDialog
|
||||||
// Method
|
// Method
|
||||||
void initMenu();
|
void initMenu();
|
||||||
void initMenuCallbacks();
|
void initMenuCallbacks();
|
||||||
|
void initFileMenuCallbacks();
|
||||||
|
void initEditMenuCallbacks();
|
||||||
|
void initViewMenuCallbacks();
|
||||||
|
void initHelpMenuCallback();
|
||||||
void initStatusBar();
|
void initStatusBar();
|
||||||
void initStatusBarCallbacks();
|
void initStatusBarCallbacks();
|
||||||
void initWidgets();
|
void initWidgets();
|
||||||
|
@ -443,7 +447,16 @@ void MyDialog::initMenu()
|
||||||
void MyDialog::initMenuCallbacks()
|
void MyDialog::initMenuCallbacks()
|
||||||
{
|
{
|
||||||
// Menu function callbacks
|
// Menu function callbacks
|
||||||
|
initFileMenuCallbacks();
|
||||||
|
initEditMenuCallbacks();
|
||||||
|
initViewMenuCallbacks();
|
||||||
|
initHelpMenuCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void MyDialog::initFileMenuCallbacks()
|
||||||
|
{
|
||||||
|
// File menu
|
||||||
Open->addCallback
|
Open->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
|
@ -456,6 +469,33 @@ void MyDialog::initMenuCallbacks()
|
||||||
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// System files submenu
|
||||||
|
File1->addCallback
|
||||||
|
(
|
||||||
|
"clicked",
|
||||||
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
|
static_cast<FWidget::data_ptr>(File1)
|
||||||
|
);
|
||||||
|
|
||||||
|
File2->addCallback
|
||||||
|
(
|
||||||
|
"clicked",
|
||||||
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
|
static_cast<FWidget::data_ptr>(File2)
|
||||||
|
);
|
||||||
|
|
||||||
|
File3->addCallback
|
||||||
|
(
|
||||||
|
"clicked",
|
||||||
|
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
||||||
|
static_cast<FWidget::data_ptr>(File3)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void MyDialog::initEditMenuCallbacks()
|
||||||
|
{
|
||||||
|
// Edit menu
|
||||||
Cut->addCallback
|
Cut->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
|
@ -479,7 +519,12 @@ void MyDialog::initMenuCallbacks()
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_clearInput)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_clearInput)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void MyDialog::initViewMenuCallbacks()
|
||||||
|
{
|
||||||
|
// View menu
|
||||||
Env->addCallback
|
Env->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
|
@ -491,33 +536,16 @@ void MyDialog::initMenuCallbacks()
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_drives)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void MyDialog::initHelpMenuCallback()
|
||||||
|
{
|
||||||
Help->addCallback
|
Help->addCallback
|
||||||
(
|
(
|
||||||
"clicked",
|
"clicked",
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
F_METHOD_CALLBACK (this, &MyDialog::cb_about)
|
||||||
);
|
);
|
||||||
|
|
||||||
File1->addCallback
|
|
||||||
(
|
|
||||||
"clicked",
|
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
||||||
static_cast<FWidget::data_ptr>(File1)
|
|
||||||
);
|
|
||||||
|
|
||||||
File2->addCallback
|
|
||||||
(
|
|
||||||
"clicked",
|
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
||||||
static_cast<FWidget::data_ptr>(File2)
|
|
||||||
);
|
|
||||||
|
|
||||||
File3->addCallback
|
|
||||||
(
|
|
||||||
"clicked",
|
|
||||||
F_METHOD_CALLBACK (this, &MyDialog::cb_view),
|
|
||||||
static_cast<FWidget::data_ptr>(File3)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -178,13 +178,17 @@ class FMenu : public FWindow, public FMenuList
|
||||||
void hideSubMenus();
|
void hideSubMenus();
|
||||||
void hideSuperMenus();
|
void hideSuperMenus();
|
||||||
bool mouseDownOverList (FPoint);
|
bool mouseDownOverList (FPoint);
|
||||||
|
void mouseDownSubmenu (FMenuItem*);
|
||||||
|
void mouseDownSelection (FMenuItem*, bool&);
|
||||||
bool mouseUpOverList (FPoint);
|
bool mouseUpOverList (FPoint);
|
||||||
bool mouseMoveOverList (FPoint, mouseStates&);
|
void mouseMoveOverList (FPoint, mouseStates&);
|
||||||
|
void mouseMoveSelection (FMenuItem*, mouseStates&);
|
||||||
|
void mouseMoveDeselection (FMenuItem*, mouseStates&);
|
||||||
void mouseUpOverBorder();
|
void mouseUpOverBorder();
|
||||||
void mouseMoveOverBorder (mouseStates&);
|
void mouseMoveOverBorder (mouseStates&);
|
||||||
void passEventToSubMenu (FMouseEvent*& ev);
|
void passEventToSubMenu (FMouseEvent*&);
|
||||||
void passEventToSuperMenu (FMouseEvent*& ev);
|
void passEventToSuperMenu (FMouseEvent*&);
|
||||||
void passEventToMenuBar (FMouseEvent*& ev);
|
void passEventToMenuBar (FMouseEvent*&);
|
||||||
bool containsMenuStructure (const FPoint&);
|
bool containsMenuStructure (const FPoint&);
|
||||||
bool containsMenuStructure (int, int);
|
bool containsMenuStructure (int, int);
|
||||||
FMenu* superMenuAt (const FPoint&);
|
FMenu* superMenuAt (const FPoint&);
|
||||||
|
|
129
src/fmenu.cpp
129
src/fmenu.cpp
|
@ -667,8 +667,9 @@ void FMenu::hideSuperMenus()
|
||||||
// hide all menus to the top
|
// hide all menus to the top
|
||||||
FWidget* super = getSuperMenu();
|
FWidget* super = getSuperMenu();
|
||||||
|
|
||||||
if ( super )
|
if ( ! super )
|
||||||
{
|
return;
|
||||||
|
|
||||||
if ( isMenuBar(super) )
|
if ( isMenuBar(super) )
|
||||||
{
|
{
|
||||||
FMenuBar* mbar = static_cast<FMenuBar*>(super);
|
FMenuBar* mbar = static_cast<FMenuBar*>(super);
|
||||||
|
@ -688,7 +689,6 @@ void FMenu::hideSuperMenus()
|
||||||
dgl->leaveMenu();
|
dgl->leaveMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
|
@ -712,15 +712,30 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
&& mouse_y == y )
|
&& mouse_y == y )
|
||||||
{
|
{
|
||||||
// Mouse pointer over item
|
// Mouse pointer over item
|
||||||
if ( hasSelectedItem() )
|
mouseDownSubmenu (*iter);
|
||||||
|
mouseDownSelection (*iter, focus_changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return focus_changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMenu::mouseDownSubmenu (FMenuItem* m_item)
|
||||||
{
|
{
|
||||||
|
if ( ! hasSelectedItem() )
|
||||||
|
return;
|
||||||
|
|
||||||
FMenuItem* sel_item = getSelectedItem();
|
FMenuItem* sel_item = getSelectedItem();
|
||||||
|
|
||||||
if ( sel_item
|
if ( ! sel_item
|
||||||
&& sel_item->hasMenu()
|
|| ! sel_item->hasMenu()
|
||||||
&& sel_item->getMenu() == opened_sub_menu )
|
|| sel_item->getMenu() != opened_sub_menu )
|
||||||
{
|
return;
|
||||||
if ( sel_item != *iter )
|
|
||||||
|
if ( sel_item != m_item )
|
||||||
hideSubMenus();
|
hideSubMenus();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -737,17 +752,21 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
flush_out();
|
flush_out();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! (*iter)->isSelected() )
|
//----------------------------------------------------------------------
|
||||||
|
void FMenu::mouseDownSelection (FMenuItem* m_item, bool& focus_changed)
|
||||||
{
|
{
|
||||||
|
if ( m_item->isSelected() )
|
||||||
|
return;
|
||||||
|
|
||||||
unselectItem();
|
unselectItem();
|
||||||
FWidget* focused_widget = getFocusWidget();
|
FWidget* focused_widget = getFocusWidget();
|
||||||
FFocusEvent out (fc::FocusOut_Event);
|
FFocusEvent out (fc::FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
(*iter)->setSelected();
|
m_item->setSelected();
|
||||||
setSelectedItem(*iter);
|
setSelectedItem(m_item);
|
||||||
(*iter)->setFocus();
|
m_item->setFocus();
|
||||||
|
focus_changed = true;
|
||||||
|
|
||||||
if ( focused_widget )
|
if ( focused_widget )
|
||||||
focused_widget->redraw();
|
focused_widget->redraw();
|
||||||
|
@ -755,21 +774,12 @@ bool FMenu::mouseDownOverList (FPoint mouse_pos)
|
||||||
if ( getStatusBar() )
|
if ( getStatusBar() )
|
||||||
getStatusBar()->drawMessage();
|
getStatusBar()->drawMessage();
|
||||||
|
|
||||||
if ( (*iter)->hasMenu() )
|
if ( m_item->hasMenu() )
|
||||||
{
|
{
|
||||||
FMenu* sub_menu = (*iter)->getMenu();
|
FMenu* sub_menu = m_item->getMenu();
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isVisible() )
|
||||||
shown_sub_menu = sub_menu;
|
shown_sub_menu = sub_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
focus_changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return focus_changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -833,10 +843,9 @@ bool FMenu::mouseUpOverList (FPoint mouse_pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
void FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||||
{
|
{
|
||||||
std::vector<FMenuItem*>::const_iterator iter, last;
|
std::vector<FMenuItem*>::const_iterator iter, last;
|
||||||
bool isOverList = false;
|
|
||||||
iter = item_list.begin();
|
iter = item_list.begin();
|
||||||
last = item_list.end();
|
last = item_list.end();
|
||||||
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
mouse_pos -= FPoint(getRightPadding(), getTopPadding());
|
||||||
|
@ -849,21 +858,31 @@ bool FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||||
, mouse_x = mouse_pos.getX()
|
, mouse_x = mouse_pos.getX()
|
||||||
, mouse_y = mouse_pos.getY();
|
, mouse_y = mouse_pos.getY();
|
||||||
|
|
||||||
if ( mouse_x >= x1
|
if ( mouse_x >= x1 && mouse_x < x2 && mouse_y == y )
|
||||||
&& mouse_x < x2
|
mouseMoveSelection (*iter, ms);
|
||||||
&& mouse_y == y )
|
else
|
||||||
{
|
mouseMoveDeselection (*iter, ms);
|
||||||
if ( (*iter)->isEnabled()
|
|
||||||
&& ! (*iter)->isSelected()
|
++iter;
|
||||||
&& ! (*iter)->isSeparator() )
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FMenu::mouseMoveSelection (FMenuItem* m_item, mouseStates& ms)
|
||||||
{
|
{
|
||||||
|
if ( ! m_item->isEnabled()
|
||||||
|
|| m_item->isSelected()
|
||||||
|
|| m_item->isSeparator() )
|
||||||
|
return;
|
||||||
|
|
||||||
// Mouse pointer over item
|
// Mouse pointer over item
|
||||||
FWidget* focused_widget = getFocusWidget();
|
FWidget* focused_widget = getFocusWidget();
|
||||||
FFocusEvent out (fc::FocusOut_Event);
|
FFocusEvent out (fc::FocusOut_Event);
|
||||||
FApplication::queueEvent(focused_widget, &out);
|
FApplication::queueEvent(focused_widget, &out);
|
||||||
(*iter)->setSelected();
|
m_item->setSelected();
|
||||||
setSelectedItem(*iter);
|
setSelectedItem(m_item);
|
||||||
(*iter)->setFocus();
|
m_item->setFocus();
|
||||||
|
ms.focus_changed = true;
|
||||||
|
|
||||||
if ( focused_widget )
|
if ( focused_widget )
|
||||||
focused_widget->redraw();
|
focused_widget->redraw();
|
||||||
|
@ -872,45 +891,35 @@ bool FMenu::mouseMoveOverList (FPoint mouse_pos, mouseStates& ms)
|
||||||
getStatusBar()->drawMessage();
|
getStatusBar()->drawMessage();
|
||||||
|
|
||||||
// Sub menu handling
|
// Sub menu handling
|
||||||
if ( (*iter)->hasMenu() )
|
if ( m_item->hasMenu() )
|
||||||
{
|
{
|
||||||
FMenu* sub_menu = (*iter)->getMenu();
|
FMenu* sub_menu = m_item->getMenu();
|
||||||
|
|
||||||
if ( ! sub_menu->isVisible() )
|
if ( ! sub_menu->isVisible() )
|
||||||
shown_sub_menu = sub_menu;
|
shown_sub_menu = sub_menu;
|
||||||
}
|
}
|
||||||
else if ( opened_sub_menu )
|
else if ( opened_sub_menu )
|
||||||
ms.hide_sub_menu = true;
|
ms.hide_sub_menu = true;
|
||||||
|
|
||||||
ms.focus_changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! (*iter)->isSeparator() )
|
//----------------------------------------------------------------------
|
||||||
isOverList = true;
|
void FMenu::mouseMoveDeselection (FMenuItem* m_item, mouseStates& ms)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( ms.mouse_over_menu
|
|
||||||
&& (*iter)->isEnabled()
|
|
||||||
&& (*iter)->isSelected()
|
|
||||||
&& ! ms.mouse_over_submenu )
|
|
||||||
{
|
{
|
||||||
|
if ( ! ms.mouse_over_menu
|
||||||
|
|| ! m_item->isEnabled()
|
||||||
|
|| ! m_item->isSelected()
|
||||||
|
|| ms.mouse_over_submenu )
|
||||||
|
return;
|
||||||
|
|
||||||
// Unselect selected item without mouse focus
|
// Unselect selected item without mouse focus
|
||||||
(*iter)->unsetSelected();
|
m_item->unsetSelected();
|
||||||
(*iter)->unsetFocus();
|
m_item->unsetFocus();
|
||||||
|
|
||||||
if ( getSelectedItem() == *iter )
|
if ( getSelectedItem() == m_item )
|
||||||
setSelectedItem(0);
|
setSelectedItem(0);
|
||||||
|
|
||||||
ms.focus_changed = true;
|
ms.focus_changed = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
++iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isOverList;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::mouseUpOverBorder()
|
void FMenu::mouseUpOverBorder()
|
||||||
|
|
|
@ -117,7 +117,9 @@ FObject* FObject::getChild (int index) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FObject::isChild (FObject* obj) const
|
bool FObject::isChild (FObject* obj) const
|
||||||
{
|
{
|
||||||
while ( FObject* p_obj = obj->getParent() )
|
FObject* p_obj = 0;
|
||||||
|
|
||||||
|
while ( obj && (p_obj = obj->getParent()) )
|
||||||
{
|
{
|
||||||
obj = p_obj;
|
obj = p_obj;
|
||||||
|
|
||||||
|
|
|
@ -295,10 +295,10 @@ void FTextView::insert (const FString& str, int pos)
|
||||||
vbar->setPageSize (int(getRows()), getTextHeight());
|
vbar->setPageSize (int(getRows()), getTextHeight());
|
||||||
vbar->calculateSliderValues();
|
vbar->calculateSliderValues();
|
||||||
|
|
||||||
if ( ! vbar->isVisible() && int(getRows()) >= getTextHeight() + 1 )
|
if ( ! vbar->isVisible() && int(getRows()) > getTextHeight() )
|
||||||
vbar->setVisible();
|
vbar->setVisible();
|
||||||
|
|
||||||
if ( vbar->isVisible() && int(getRows()) < getTextHeight() + 1 )
|
if ( vbar->isVisible() && int(getRows()) <= getTextHeight() )
|
||||||
vbar->hide();
|
vbar->hide();
|
||||||
|
|
||||||
processChanged();
|
processChanged();
|
||||||
|
|
Loading…
Reference in New Issue