示例#1
0
//---------------------------------------------------------------------------------
void LLSysWellWindow::reshapeWindow()
{
	// save difference between floater height and the list height to take it into account while calculating new window height
	// it includes height from floater top to list top and from floater bottom and list bottom
	static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();

	if (isDocked()) // Don't reshape undocked Well window. See EXT-5715.
	{
		S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();

		LLRect curRect = getRect();

		S32 new_window_height = notif_list_height + parent_list_delta_height;

		if (new_window_height > MAX_WINDOW_HEIGHT)
		{
			new_window_height = MAX_WINDOW_HEIGHT;
		}
		S32 newY = curRect.mTop + new_window_height - curRect.getHeight();
		S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH
			: curRect.getWidth();
		curRect.setLeftTopAndSize(curRect.mLeft, newY, newWidth, new_window_height);
		reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
		setRect(curRect);
	}

	// update notification channel state
	// update on a window reshape is important only when a window is visible and docked
	if(mChannel && getVisible() && isDocked())
	{
		mChannel->updateShowToastsState();
	}
}
示例#2
0
void LLDockableFloater::setVisible(BOOL visible)
{
	// Force docking if requested
	if (visible && mForceDocking)
	{
		setCanDock(true);
		setDocked(true);
		mForceDocking = false;
	}

	if(visible && isDocked())
	{
		resetInstance();
	}

	if (visible && mDockControl.get() != NULL)
	{
		mDockControl.get()->repositionDockable();
	}

	if (visible)
	{
		LLFloater::setFrontmost(getAutoFocus());
	}
	LLFloater::setVisible(visible);
}
示例#3
0
void KviIOGraphWindow::paintEvent(QPaintEvent * e)
{
	QPainter p(this);

	QRect rect = e->rect();
#ifdef COMPILE_PSEUDO_TRANSPARENCY
	if(KVI_OPTION_BOOL(KviOption_boolUseCompositingForTransparency) && g_pApp->supportsCompositing())
	{
		p.save();
		p.setCompositionMode(QPainter::CompositionMode_Source);
		QColor col = KVI_OPTION_COLOR(KviOption_colorGlobalTransparencyFade);
		col.setAlphaF((float)((float)KVI_OPTION_UINT(KviOption_uintGlobalTransparencyChildFadeFactor) / (float)100));
		p.fillRect(rect, col);
		p.restore();
	}
	else if(g_pShadedChildGlobalDesktopBackground)
	{
		QPoint pnt = isDocked() ? mapTo(g_pMainWindow, rect.topLeft()) : rect.topLeft();
		p.drawTiledPixmap(rect, *(g_pShadedChildGlobalDesktopBackground), pnt);
	}
	else
	{
#endif
		//FIXME this is not the treewindowlist
		p.fillRect(rect, KVI_OPTION_COLOR(KviOption_colorTreeWindowListBackground));
#ifdef COMPILE_PSEUDO_TRANSPARENCY
	}
#endif
}
示例#4
0
bool KviWindow::hasAttention(AttentionLevel eLevel)
{
	if(isDocked())
	{
		switch(eLevel)
		{
			case VisibleAndActive:
				return (g_pMainWindow->isActiveWindow() && g_pActiveWindow == this);
				break;
			case MainWindowIsVisible:
				return g_pMainWindow->isActiveWindow();
				break;
			default:
				return false;
				break;
		}
	}
	else
	{
		// undocked window
		if(isActiveWindow())
			return true;
	}

	return false;
}
void SmartWindow::moveEvent (QMoveEvent* e)
{
    e->accept();

    if (!isDocked())
        {
            Settings::set ("x", x());
            Settings::set ("y", y());
        }
}
示例#6
0
void KviWindow::autoRaise()
{
	if(!isDocked())
		raise();

	g_pMainWindow->setActiveWindow(this);

	if(m_pFocusHandler)
		m_pFocusHandler->setFocus();
	else
		setFocus();
}
示例#7
0
void LLDockableFloater::draw()
{
	if (mDockControl.get() != NULL)
	{
		mDockControl.get()->repositionDockable();
		if (isDocked())
		{
			mDockControl.get()->drawToungue();
		}
	}
	LLFloater::draw();
}
示例#8
0
void
GtkAReViWidget::dock(void)
{
  if (isDocked())
    return;

  if (isDockable())
  {
    gtk_widget_reparent(_wndDockSrc, _dockDst->accessWidget(_dockDstWidget));
    hide();
    _docked=true;
  }
  else if (!GTK_IS_WIDGET(_wndDockSrc))
    _wndDockSrc=NULL;
}
示例#9
0
void KviWindow::demandAttention()
{
	WId windowId = isDocked() ? g_pMainWindow->winId() : winId();

#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
	FLASHWINFO fwi;
	fwi.cbSize = sizeof(fwi);
	fwi.hwnd = (HWND)windowId;
	fwi.dwFlags = FLASHW_TRAY | FLASHW_TIMERNOFG;
	fwi.uCount = 20;
	fwi.dwTimeout = 500;
	FlashWindowEx(&fwi);
#elif defined(COMPILE_KDE_SUPPORT)
	KWindowSystem::demandAttention(windowId, true);
#endif
}
示例#10
0
void
GtkAReViWidget::undock(void)
{
  if (!isDocked())
    return;

  if (isDockable())
  {
    gtk_widget_reparent(_wndDockSrc, _wndMain);
    _docked=false;
  }
  else if (!GTK_IS_WIDGET(_wndDockSrc))
    _wndDockSrc=NULL;

  show();
}
示例#11
0
void LLFloaterCamera::onClose(bool app_quitting)
{
	//We don't care of camera mode if app is quitting
	if(app_quitting)
		return;
	// When mCurrMode is in CAMERA_CTRL_MODE_PAN
	// switchMode won't modify mPrevMode, so force it here.
	// It is needed to correctly return to previous mode on open, see EXT-2727.
	if (mCurrMode == CAMERA_CTRL_MODE_PAN)
		mPrevMode = CAMERA_CTRL_MODE_PAN;

	// HACK: Should always close as docked to prevent toggleInstance without calling onOpen.
	if ( !isDocked() )
		setDocked(true);
	switchMode(CAMERA_CTRL_MODE_PAN);
	mClosed = TRUE;
}
示例#12
0
void LLDockableFloater::setVisible(BOOL visible)
{
	if(visible && isDocked())
	{
		resetInstance();
	}

	if (visible && mDockControl.get() != NULL)
	{
		mDockControl.get()->repositionDockable();
	}

	if (visible)
	{
		LLFloater::setFrontmost(getAutoFocus());
	}
	LLFloater::setVisible(visible);
}
示例#13
0
void SmartWindow::resizeToFit()
{
    /* 'Dock' the window at the bottom and extend it to the sides */
    if (isDocked())
        {
            QDesktopWidget w;
            setFixedHeight (size().height());
            setFixedWidth (w.availableGeometry().width());
            move (0, w.availableGeometry().height() - height());
            layout()->setSizeConstraint (QLayout::SetNoConstraint);
        }

    /* Show the window normally */
    else
        {
            resize (minimumSizeHint());
            setFixedSize (minimumSizeHint());
            layout()->setSizeConstraint (QLayout::SetMinimumSize);
        }
}
示例#14
0
bool AMWindowPaneModel::eventFilter(QObject *source, QEvent *event) {
	QWidget* pane = qobject_cast<QWidget*>(source);

	// not one of our widgets... never mind.
	if(!widget2item_.contains(pane))
		return AMDragDropItemModel::eventFilter(source, event);

	QModelIndex index = widget2item_.value(pane)->index();

	// if an undocked widget is being closed, we need to filter out that close event and dock it instead
	if(!isDocked(index) && event->type() == QEvent::Close) {
		dock(index);
		return true;
	}

	// if the window title or window icon is changing, we will need to emit dataChanged(), since the Qt::DisplayRole and Qt::DecorationRole data() will now be different.
	if(event->type() == QEvent::WindowTitleChange || event->type() == QEvent::WindowIconChange) {
		emit dataChanged(index, index);	/// \todo Have the new title/icon already been set, when these events go off? Might need to defer this.
	}

	return AMDragDropItemModel::eventFilter(source, event);
}
void LLTransientDockableFloater::setVisible(BOOL visible)
{
    LLView* dock = getDockWidget();
    if(visible && isDocked())
    {
        LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
        if (dock != NULL)
        {
            LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
        }
    }
    else
    {
        LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
        if (dock != NULL)
        {
            LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
        }
    }

    LLDockableFloater::setVisible(visible);
}
示例#16
0
void LLDockableFloater::setDockControl(LLDockControl* dockControl)
{
	mDockControl.reset(dockControl);
	setDocked(isDocked());
}
示例#17
0
void GUI::DockHolder::paint (Graphics & g)
{
    g.fillAll (Colours::black);

    const int button = BUTTONSIZE;
    const int padding = PADDINGSIZE;

    const int width = getWidth();
    const int height = getHeight();

    if (orientation == CENTER)
    {
        {
            const float left = 0.0f;
            const float right = left + width;
            const float top = 0.0f;
            const float bottom = top + height;
            const int x1 = juce::roundFloatToInt(left);
            const int x2 = juce::roundFloatToInt(right-1);
            const int y1 = juce::roundFloatToInt(top);
            const int y2 = juce::roundFloatToInt(bottom-1);

            g.setColour (Colour(0xff333333));
            g.drawHorizontalLine (y1, left, right);
            g.drawHorizontalLine (y2, left, right);
            if (!manager->isDocked (LEFT))
                g.drawVerticalLine (x1, top, bottom);
            if (!manager->isDocked (RIGHT))
                g.drawVerticalLine (x2, top, bottom);
        }
    }
    else
        if (orientation == TOP)
        {
            if (!isDocked())
            {
                const float left = 0.0f + button;
                const float right = left + (width-(button*2));
                const float top = 0.0f + height - padding;
                const float bottom = top + padding;
                const int y  = height - padding;
                const int x1 = button;
                const int x2 = width-(button+1);

                g.setColour (Colour(0xff333333));
                g.drawHorizontalLine (y, left, right);
                g.drawVerticalLine  (x1, top, bottom);
                g.drawVerticalLine  (x2, top, bottom);
            }
        }
        else
            if (orientation == LEFT)
            {
                {
                    const float left = 0.0f;
                    const float right = left + width;
                    const float top = 0.0f;
                    const float bottom = top + height;
                    const int x = 0;
                    const int y1 = 0;
                    const int y2 = height - 1;

                    g.setColour (Colour(0xff333333));
                    g.drawVerticalLine    (x, top, bottom);
                    g.drawHorizontalLine (y1, left, right);
                    g.drawHorizontalLine (y2, left, right);
                }
            }
            else
                if (orientation == RIGHT)
                {
                    {
                        const float left = 0.0f;
                        const float right = left + width;
                        const float top = 0.0f;
                        const float bottom = top + height;
                        const int x = width - 1;
                        const int y1 = 0;
                        const int y2 = height - 1;

                        g.setColour (Colour(0xff333333));
                        g.drawVerticalLine    (x, top, bottom);
                        g.drawHorizontalLine (y1, left, right);
                        g.drawHorizontalLine (y2, left, right);
                    }
                }
}
示例#18
0
/// setData() is re-implemented from QStandardItemModel to set the widget window title and icon for the Qt::DecorationRole and Qt::DisplayRole/Qt::EditRole
bool AMWindowPaneModel::setData(const QModelIndex &index, const QVariant &value, int role) {

	if(!index.isValid())
		return false;

	switch(role) {

	case Qt::DisplayRole:
	case Qt::EditRole:
		// alias items and heading items can have separate descriptions, but for normal items, the DisplayRole and EditRole should be the window title
		if(isAlias(index) || isHeading(index))
			return AMDragDropItemModel::setData(index, value, role);

		if(internalPane(index)) {
			internalPane(index)->setWindowTitle(value.toString());
			return true;
		}
		else
			return false;

		break;


	case Qt::DecorationRole:
		// alias items and heading items can have separate icons, but for normal items, the Decoration role should be the window icon
		if(isAlias(index) || isHeading(index))
			return AMDragDropItemModel::setData(index, value, role);

		if(internalPane(index)) {
			internalPane(index)->setWindowIcon(value.value<QIcon>());
			return true;
		}
		else
			return false;
		break;

	case AMWindowPaneModel::DockStateRole:
	{

		// docking an alias? dock the target instead.
		if(isAlias(index)) {
			QStandardItem* target = aliasTarget(index);
			if(target)
				return setData(target->index(), value, role);
			else
				return false;
		}

		bool nowDocked = value.toBool();
		bool wasDocked = isDocked(index);

		// set dock state like normal, but emit special signal dockStateChanged() if it's changing.
		if(AMDragDropItemModel::setData(index, value, role)) {

			QWidget* w = internalPane(index);

			if(wasDocked && !nowDocked)
				emit dockStateChanged(w, false, index.data(AMWindowPaneModel::UndockResizeRole).toBool());
			else if(!wasDocked && nowDocked)
				emit dockStateChanged(w, true, index.data(AMWindowPaneModel::UndockResizeRole).toBool());

			return true;
		}
		else
			return false;
		break;
	}
	case AMWindowPaneModel::UndockResizeRole:
		return AMDragDropItemModel::setData(index, value, role);
		break;

	default:
		return AMDragDropItemModel::setData(index, value, role);
	}
}