* Renamed private BMenu::SelectItem() to _SelectItem(), and made its arguments a bit more sane.
* Fixed two GCC 4 warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -219,9 +219,8 @@ virtual void _ReservedMenu6();
|
|||||||
void ItemMarked(BMenuItem *item);
|
void ItemMarked(BMenuItem *item);
|
||||||
void Install(BWindow *target);
|
void Install(BWindow *target);
|
||||||
void Uninstall();
|
void Uninstall();
|
||||||
void SelectItem( BMenuItem *m,
|
void _SelectItem(BMenuItem* item, bool showSubmenu = true,
|
||||||
uint32 showSubmenu = 0,
|
bool selectFirstItem = false);
|
||||||
bool selectFirstItem = false);
|
|
||||||
BMenuItem *CurrentSelection() const;
|
BMenuItem *CurrentSelection() const;
|
||||||
bool SelectNextItem(BMenuItem *item, bool forward);
|
bool SelectNextItem(BMenuItem *item, bool forward);
|
||||||
BMenuItem *NextItem(BMenuItem *item, bool forward) const;
|
BMenuItem *NextItem(BMenuItem *item, bool forward) const;
|
||||||
|
|||||||
+12
-12
@@ -1206,7 +1206,7 @@ BMenu::_show(bool selectFirstItem)
|
|||||||
window->Show();
|
window->Show();
|
||||||
|
|
||||||
if (selectFirstItem)
|
if (selectFirstItem)
|
||||||
SelectItem(ItemAt(0));
|
_SelectItem(ItemAt(0));
|
||||||
|
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1223,7 @@ BMenu::_hide()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (fSelected != NULL)
|
if (fSelected != NULL)
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
|
|
||||||
window->Hide();
|
window->Hide();
|
||||||
window->DetachMenu();
|
window->DetachMenu();
|
||||||
@@ -1275,14 +1275,14 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
|||||||
item = HitTestItems(location, B_ORIGIN);
|
item = HitTestItems(location, B_ORIGIN);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
if (item != fSelected && system_time() > closeTime + kHysteresis) {
|
if (item != fSelected && system_time() > closeTime + kHysteresis) {
|
||||||
SelectItem(item, -1);
|
_SelectItem(item, false);
|
||||||
openTime = system_time();
|
openTime = system_time();
|
||||||
} else if (system_time() > kHysteresis + openTime && item->Submenu() != NULL
|
} else if (system_time() > kHysteresis + openTime && item->Submenu() != NULL
|
||||||
&& item->Submenu()->Window() == NULL) {
|
&& item->Submenu()->Window() == NULL) {
|
||||||
// Open the submenu if it's not opened yet, but only if
|
// Open the submenu if it's not opened yet, but only if
|
||||||
// the mouse pointer stayed over there for some time
|
// the mouse pointer stayed over there for some time
|
||||||
// (hysteresis)
|
// (hysteresis)
|
||||||
SelectItem(item);
|
_SelectItem(item);
|
||||||
closeTime = system_time();
|
closeTime = system_time();
|
||||||
}
|
}
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
@@ -1319,7 +1319,7 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
|||||||
if (fSelected != NULL && !OverSubmenu(fSelected, screenLocation)
|
if (fSelected != NULL && !OverSubmenu(fSelected, screenLocation)
|
||||||
&& system_time() > closeTime + kHysteresis
|
&& system_time() > closeTime + kHysteresis
|
||||||
&& fState != MENU_STATE_TRACKING_SUBMENU) {
|
&& fState != MENU_STATE_TRACKING_SUBMENU) {
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,7 +1354,7 @@ BMenu::_track(int *action, bigtime_t trackTime, long start)
|
|||||||
*action = fState;
|
*action = fState;
|
||||||
|
|
||||||
if (fSelected != NULL && LockLooper()) {
|
if (fSelected != NULL && LockLooper()) {
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1408,7 +1408,7 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
|||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
if (fItems.RemoveItem(item)) {
|
if (fItems.RemoveItem(item)) {
|
||||||
if (item == fSelected && window != NULL)
|
if (item == fSelected && window != NULL)
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
item->Uninstall();
|
item->Uninstall();
|
||||||
item->SetSuper(NULL);
|
item->SetSuper(NULL);
|
||||||
if (deleteItems)
|
if (deleteItems)
|
||||||
@@ -1427,7 +1427,7 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
|||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
if (fItems.RemoveItem(item)) {
|
if (fItems.RemoveItem(item)) {
|
||||||
if (item == fSelected && window != NULL)
|
if (item == fSelected && window != NULL)
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
item->Uninstall();
|
item->Uninstall();
|
||||||
item->SetSuper(NULL);
|
item->SetSuper(NULL);
|
||||||
if (deleteItems)
|
if (deleteItems)
|
||||||
@@ -1880,7 +1880,7 @@ BMenu::Uninstall()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMenu::SelectItem(BMenuItem *menuItem, uint32 showSubmenu, bool selectFirstItem)
|
BMenu::_SelectItem(BMenuItem* menuItem, bool showSubmenu, bool selectFirstItem)
|
||||||
{
|
{
|
||||||
// Avoid deselecting and then reselecting the same item
|
// Avoid deselecting and then reselecting the same item
|
||||||
// which would cause flickering
|
// which would cause flickering
|
||||||
@@ -1897,7 +1897,7 @@ BMenu::SelectItem(BMenuItem *menuItem, uint32 showSubmenu, bool selectFirstItem)
|
|||||||
fSelected->Select(true);
|
fSelected->Select(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fSelected != NULL && showSubmenu == 0) {
|
if (fSelected != NULL && showSubmenu) {
|
||||||
BMenu *subMenu = fSelected->Submenu();
|
BMenu *subMenu = fSelected->Submenu();
|
||||||
if (subMenu != NULL && subMenu->Window() == NULL) {
|
if (subMenu != NULL && subMenu->Window() == NULL) {
|
||||||
if (!subMenu->_show(selectFirstItem)) {
|
if (!subMenu->_show(selectFirstItem)) {
|
||||||
@@ -1925,7 +1925,7 @@ BMenu::SelectNextItem(BMenuItem *item, bool forward)
|
|||||||
if (nextItem == NULL)
|
if (nextItem == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SelectItem(nextItem);
|
_SelectItem(nextItem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2111,7 +2111,7 @@ BMenu::OkToProceed(BMenuItem* item)
|
|||||||
void
|
void
|
||||||
BMenu::QuitTracking()
|
BMenu::QuitTracking()
|
||||||
{
|
{
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
|
if (BMenuBar *menuBar = dynamic_cast<BMenuBar *>(this))
|
||||||
menuBar->RestoreFocus();
|
menuBar->RestoreFocus();
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
if (startIndex != -1) {
|
if (startIndex != -1) {
|
||||||
be_app->ObscureCursor();
|
be_app->ObscureCursor();
|
||||||
window->Lock();
|
window->Lock();
|
||||||
SelectItem(ItemAt(startIndex), 0, true);
|
_SelectItem(ItemAt(startIndex), true, true);
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -442,18 +442,18 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
if (menuItem->Submenu() != NULL) {
|
if (menuItem->Submenu() != NULL) {
|
||||||
if (menuItem->Submenu()->Window() == NULL) {
|
if (menuItem->Submenu()->Window() == NULL) {
|
||||||
// open the menu if it's not opened yet
|
// open the menu if it's not opened yet
|
||||||
SelectItem(menuItem);
|
_SelectItem(menuItem);
|
||||||
if (IsStickyMode())
|
if (IsStickyMode())
|
||||||
SetStickyMode(false);
|
SetStickyMode(false);
|
||||||
} else {
|
} else {
|
||||||
// Menu was already opened, close it and bail
|
// Menu was already opened, close it and bail
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
fState = MENU_STATE_CLOSED;
|
fState = MENU_STATE_CLOSED;
|
||||||
fChosenItem = NULL;
|
fChosenItem = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No submenu, just select the item
|
// No submenu, just select the item
|
||||||
SelectItem(menuItem);
|
_SelectItem(menuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
}
|
}
|
||||||
} else if (menuItem == NULL && !IsStickyMode()
|
} else if (menuItem == NULL && !IsStickyMode()
|
||||||
&& fState != MENU_STATE_TRACKING_SUBMENU) {
|
&& fState != MENU_STATE_TRACKING_SUBMENU) {
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
fState = MENU_STATE_TRACKING;
|
fState = MENU_STATE_TRACKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ BMenuBar::Track(int32 *action, int32 startIndex, bool showMenu)
|
|||||||
|
|
||||||
if (window->Lock()) {
|
if (window->Lock()) {
|
||||||
if (fSelected != NULL)
|
if (fSelected != NULL)
|
||||||
SelectItem(NULL);
|
_SelectItem(NULL);
|
||||||
if (fChosenItem != NULL)
|
if (fChosenItem != NULL)
|
||||||
fChosenItem->Invoke();
|
fChosenItem->Invoke();
|
||||||
RestoreFocus();
|
RestoreFocus();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static const uint32 kFlattenedTextRunArrayVersion = 0;
|
|||||||
enum {
|
enum {
|
||||||
B_SEPARATOR_CHARACTER,
|
B_SEPARATOR_CHARACTER,
|
||||||
B_OTHER_CHARACTER
|
B_OTHER_CHARACTER
|
||||||
} separatorCharacters;
|
};
|
||||||
|
|
||||||
|
|
||||||
class _BTextTrackState_ {
|
class _BTextTrackState_ {
|
||||||
|
|||||||
Reference in New Issue
Block a user