コード例 #1
0
void
NotificationWindow::ResizeAll()
{
    if (fAppViews.empty()) {
        if (!IsHidden())
            Hide();
        return;
    }

    appview_t::iterator aIt;
    bool shouldHide = true;

    for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
        AppGroupView* app = aIt->second;
        if (app->HasChildren()) {
            shouldHide = false;
            break;
        }
    }

    if (shouldHide) {
        if (!IsHidden())
            Hide();
        return;
    }

    if (IsHidden())
        Show();

    float width = 0;
    float height = 0;

    for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
        AppGroupView* view = aIt->second;
        float w = -1;
        float h = -1;

        if (!view->HasChildren()) {
            if (!view->IsHidden())
                view->Hide();
        } else {
            view->GetPreferredSize(&w, &h);
            width = max_c(width, h);

            view->ResizeToPreferred();
            view->MoveTo(0, height);

            height += h;

            if (view->IsHidden())
                view->Show();
        }
    }

    ResizeTo(ViewWidth(), height);
    PopupAnimation(Bounds().Width(), Bounds().Height());
}
コード例 #2
0
void
NotificationWindow::_ResizeAll()
{
	appview_t::iterator aIt;
	bool shouldHide = true;

	for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
		AppGroupView* app = aIt->second;
		if (app->HasChildren()) {
			shouldHide = false;
			break;
		}
	}

	if (shouldHide) {
		if (!IsHidden())
			Hide();
		return;
	}

	for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
		AppGroupView* view = aIt->second;

		if (!view->HasChildren()) {
			if (!view->IsHidden())
				view->Hide();
		} else {
			if (view->IsHidden())
				view->Show();
		}
	}

	SetPosition();

	if (IsHidden())
		Show();
}