Example #1
0
KDecoration::Position Manager::mousePosition(const TQPoint& p) const
{
   Position m = PositionCenter;

   // Look out for off-by-one errors here.

   if (isResizable())
   {
      if (p.y() > (height() - (Static::instance()->resizeHeight() + 1)))
      {
        // Keep order !

         if (p.x() >= (width() - 30))
            m = PositionBottomRight;
         else if (p.x() <= 30)
            m = PositionBottomLeft;
         else
            m = PositionBottom;
      }
      else
      {
         m = PositionCenter;
         // Client::mousePosition(p);
      }
   }
   else
   {
      m = PositionCenter;
      // Client::mousePosition(p);
   }

   return m;
}
Example #2
0
bool NextClient::mustDrawHandle() const 
{ 
    bool drawSmallBorders = !options()->moveResizeMaximizedWindows();
    if (drawSmallBorders && (maximizeMode() & MaximizeVertical)) {
	return false;
    } else {
	return isResizable();
    }
}
Example #3
0
int ResizableWindow::getDesktopWindowStyleFlags() const
{
    int styleFlags = TopLevelWindow::getDesktopWindowStyleFlags();

    if (isResizable() && (styleFlags & ComponentPeer::windowHasTitleBar) != 0)
        styleFlags |= ComponentPeer::windowIsResizable;

    return styleFlags;
}
Example #4
0
void LLMultiFloater::setCanResize(BOOL can_resize)
{
	LLFloater::setCanResize(can_resize);
	if (!mTabContainer) return;
	if (isResizable() && mTabContainer->getTabPosition() == LLTabContainer::BOTTOM)
	{
		mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
	}
	else
	{
		mTabContainer->setRightTabBtnOffset(0);
	}
}
Example #5
0
void Manager::paintEvent(TQPaintEvent *e)
{
   TQPainter p(widget());

   TQRect r(e->rect());

   bool intersectsLeft = r.intersects(TQRect(0, 0, 1, height()));

   bool intersectsRight =
      r.intersects(TQRect(width() - 1, 0, width(), height()));

   if (intersectsLeft || intersectsRight)
   {
      p.setPen(TQt::black);

      if (intersectsLeft)
         p.drawLine(0, r.top(), 0, r.bottom());

      if (intersectsRight)
         p.drawLine(width() - 1, r.top(), width() - 1, r.bottom());
   }

   Static * s = Static::instance();

   bool active = isActive();

   // Title bar.

   TQRect tr = titleSpacer_->tqgeometry();
   bitBlt(widget(), tr.topLeft(), &titleBuf_);

   // Resize bar.

   if (isResizable())
   {
      int rbt = height() - Static::instance()->resizeHeight(); // Resize bar top

      bitBlt(widget(), 0, rbt, &(s->resize(active)));
      bitBlt(widget(), 30, rbt, &(s->resizeMidLeft(active)));

      p.drawTiledPixmap(32, rbt, width() - 34,
                        Static::instance()->resizeHeight(),
                        s->resizeMidMid(active));

      bitBlt(widget(), width() - 32, rbt, &(s->resizeMidRight(active)));
      bitBlt(widget(), width() - 30, rbt, &(s->resize(active)));
   }
   else
      p.drawLine(1, height() - 1, width() - 2, height() - 1);
}
Example #6
0
void Windowiki::mousePressed(gcn::MouseEvent &event)
{
    // Let Guichan move window to top and figure out title bar drag
    gcn::Window::mousePressed(event);

    const int x = event.getX();
    const int y = event.getY();
    mMouseResize = 0;

    // Activate resizing handles as appropriate
    if (event.getSource() == this && isResizable() &&
            event.getButton() == gcn::MouseEvent::LEFT &&
            !getChildrenArea().isPointInRect(x, y))
    {
        mMouseResize |= (x > getWidth() - resizeBorderWidthiki) ? RIGHT :
                        (x < resizeBorderWidthiki) ? LEFT : 0;
        mMouseResize |= (y > getHeight() - resizeBorderWidthiki) ? BOTTOM :
                        (y < resizeBorderWidthiki) ? TOP : 0;
    }
    else if (event.getSource() == mGrip)
    {
        mDragOffsetX = x + mGrip->getX();
        mDragOffsetY = y + mGrip->getY();
        mMouseResize |= BOTTOM | RIGHT;
        mIsMoving = false;
    }

    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        const int x = event.getX();
        const int y = event.getY();

        // Handle close button
        if (mCloseButton)
        {
            gcn::Rectangle closeButtonRect(
                getWidth() - closeImage->getWidth() - getPadding(),
                getPadding(),
                closeImage->getWidth(),
                closeImage->getHeight());

            if (closeButtonRect.isPointInRect(x, y))
            {
                setVisible(false);
            }
        }

        // Handle window resizing
    }
}
Example #7
0
void gMainWindow::setResizable(bool b)
{
  if (!isTopLevel()) 
  	return;
	
	if (b == isResizable())
		return;

	gtk_window_set_resizable(GTK_WINDOW(border), b);

	if (b)
		gtk_widget_set_size_request(border, 1, 1);
	else
		gtk_widget_set_size_request(border, bufW, bufH);
}
Example #8
0
void gTree::setColumnWidth(int ind, int w)
{
	GtkTreeViewColumn *col = gt_tree_view_find_column(GTK_TREE_VIEW(widget), ind);
	
	if (!col) 
		return;
		
	if (w > 0)
	{
		gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_FIXED);
		gtk_tree_view_column_set_fixed_width(col, w);
	}
	else
		gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
	
	setColumnResizable(ind, isResizable());
}
Example #9
0
void LLMultiFloater::buildTabContainer()
{
	const LLFloater::Params& default_params = LLFloater::getDefaultParams();
	S32 floater_header_size = default_params.header_height;
	
	LLTabContainer::Params p;
	p.name(std::string("Preview Tabs"));
	p.rect(LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - floater_header_size, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0));
	p.tab_position(mTabPos);
	p.follows.flags(FOLLOWS_ALL);
	p.commit_callback.function(boost::bind(&LLMultiFloater::onTabSelected, this));

	mTabContainer = LLUICtrlFactory::create<LLTabContainer>(p);
	addChild(mTabContainer);
	
	if (isResizable())
	{
		mTabContainer->setRightTabBtnOffset(RESIZE_HANDLE_WIDTH);
	}
}
Example #10
0
void
CQSplitterArea::
updateLayout()
{
  QMainWindow *mw = palette()->mgr()->window();

  if (mw)
    handle_->setParent(mw);

  handle_->setVisible(mw && palette_->isVisible() && isResizable() && ! isFloating());

  if (handle_->isVisible()) {
    QWidget *cw = mw->centralWidget();

//std::cerr << "CW: " << cw->x() << " " << cw->y() << " " << cw->width() << " " << cw->height() << std::endl;

    int hs = (isVerticalDockArea() ? handle_->width() : handle_->height());

    if      (dockArea() == Qt::LeftDockWidgetArea) {
      handle_->move  (cw->x() - hs, cw->y());
      handle_->resize(hs, height());
    }
    else if (dockArea() == Qt::RightDockWidgetArea) {
      handle_->move  (cw->x() + cw->width(), cw->y());
      handle_->resize(hs, height());
    }
    else if (dockArea() == Qt::TopDockWidgetArea) {
      handle_->move  (0, cw->y() - hs);
      handle_->resize(width(), hs);
    }
    else if (dockArea() == Qt::BottomDockWidgetArea) {
      handle_->move  (0, cw->y() + cw->height());
      handle_->resize(width(), hs);
    }

    handle_->raise();
  }

  splitter_->move(0, 0);
  splitter_->resize(width(), height());
}
Example #11
0
void gMainWindow::resize(int w, int h)
{
	if (w == bufW && h == bufH)
		return;
			
	_resized = true;
		
	if (isTopLevel())
	{
		//fprintf(stderr, "resize: %s: %d %d\n", name(), w, h);
	
		//gdk_window_enable_synchronized_configure (border->window);
		
		bufW = w < 0 ? 0 : w;
		bufH = h < 0 ? 0 : h;
		
		if (w < 1 || h < 1)
		{
			if (visible)
				gtk_widget_hide(border);			
		}
		else
		{
			if (isResizable())
				gtk_window_resize(GTK_WINDOW(border), w, h);
			else
				gtk_widget_set_size_request(border, w, h);

			if (visible)
				gtk_widget_show(border);
		}
	}
	else
	{
		//fprintf(stderr, "resize %p -> (%d %d) (%d %d)\n", this, bufW, bufH, w, h);
		gContainer::resize(w, h);
	}
}
Example #12
0
void Manager::borders(int &left, int &right, int &top, int &bottom) const
{
   left = right = 1;
   top = Static::instance()->titleHeight();
   bottom = isResizable() ? Static::instance()->resizeHeight() : 1;
}