Пример #1
0
void eListbox::setItemHeight(int h)
{
	if (h)
		m_itemheight = h;
	else
		m_itemheight = 20;
	recalcSize();
}
Пример #2
0
void Panel::OnPaint()
{
	// refresh tab names, just in case
	for( TabItr i = tabList_.begin(); i != tabList_.end(); ++i )
		tabBar_->updateItemData( (*i).getObject(), (*i)->getTabDisplayString(), (*i)->getIcon() );
	recalcSize();
	CWnd::OnPaint();
}
Пример #3
0
void Panel::insertTempTab( TabPtr tab )
{
	if ( activeTab_ && isExpanded_ )
		activeTab_->getCWnd()->ShowWindow( SW_HIDE );
	tempTab_ = tab;
	tabBar_->insertItem( tab->getTabDisplayString(), tab->getIcon(), tab.getObject() );
	updateTabBar();
	recalcSize();
	UpdateWindow();
}
Пример #4
0
void Panel::removeTempTab()
{
	if ( !tempTab_ )
		return;
	if ( activeTab_ && isExpanded_ )
		activeTab_->getCWnd()->ShowWindow( SW_SHOW );
	tabBar_->removeItem( tempTab_.getObject() );
	if ( activeTab_ )
		tabBar_->setCurItem( activeTab_.getObject() );
	updateTabBar();
	recalcSize();
	UpdateWindow();
	tempTab_ = 0;
}
Пример #5
0
void Panel::setActiveTab( TabPtr tab )
{
	if ( activeTab_ ) 
		activeTab_->getCWnd()->ShowWindow( SW_HIDE );

	activeTab_ = tab;

	updateTabBar();

	if ( tab )
	{
		if ( isExpanded_ )
			tab->getCWnd()->ShowWindow( SW_SHOW );
		tabBar_->setCurItem( activeTab_.getObject() );
		tab->getCWnd()->SetFocus();
	}

	recalcSize();

	paintCaptionBar();
}
Пример #6
0
EquipmentWindow::EquipmentWindow(Equipment *const equipment,
                                 Being *const being,
                                 const bool foring):
    // TRANSLATORS: equipment window name
    Window(_("Equipment"), false, nullptr, "equipment.xml"),
    gcn::ActionListener(),
    mEquipment(equipment),
    mItemPopup(new ItemPopup),
    mPlayerBox(new PlayerBox("equipment_playerbox.xml",
        "equipment_selectedplayerbox.xml")),
    // TRANSLATORS: equipment window button
    mUnequip(new Button(this, _("Unequip"), "unequip", this)),
    mSelected(-1),
    mForing(foring),
    mImageSet(nullptr),
    mBeing(being),
    mBoxes(),
    mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
    mBorderColor(getThemeColor(Theme::BORDER)),
    mLabelsColor(getThemeColor(Theme::LABEL)),
    mLabelsColor2(getThemeColor(Theme::LABEL_OUTLINE)),
    mSlotBackground(),
    mSlotHighlightedBackground(),
    mVertexes(new ImageCollection),
    mItemPadding(getOption("itemPadding")),
    mBoxSize(getOption("boxSize")),
    mButtonPadding(getOption("buttonPadding", 5)),
    mMinX(180),
    mMinY(345),
    mMaxX(0),
    mMaxY(0)
{
    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    if (!mBoxSize)
        mBoxSize = 36;

    // Control that shows the Player
    mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168));
    mPlayerBox->setPlayer(being);

    if (foring)
        setWindowName("Being equipment");
    else
        setWindowName("Equipment");

    setCloseButton(true);
    setSaveVisible(true);
    setStickyButtonLock(true);

    mBoxes.reserve(BOX_COUNT);
    for (int f = 0; f < BOX_COUNT; f ++)
        mBoxes.push_back(nullptr);

    fillBoxes();
    recalcSize();

    loadWindowState();

    const gcn::Rectangle &area = getChildrenArea();
    mUnequip->setPosition(area.width  - mUnequip->getWidth() - mButtonPadding,
        area.height - mUnequip->getHeight() - mButtonPadding);
    mUnequip->setEnabled(false);

    ImageRect rect;
    Theme::instance()->loadRect(rect, "equipment_background.xml", "", 0, 1);
    mSlotBackground = rect.grid[0];
    mSlotHighlightedBackground = rect.grid[1];
    add(mPlayerBox);
    add(mUnequip);
    enableVisibleSound(true);
}
Пример #7
0
int eListbox::event(int event, void *data, void *data2)
{
	switch (event)
	{
	case evtPaint:
	{
		ePtr<eWindowStyle> style;
		
		if (!m_content)
			return eWidget::event(event, data, data2);
		ASSERT(m_content);
		
		getStyle(style);
		
		if (!m_content)
			return 0;
		
		gPainter &painter = *(gPainter*)data2;
		
		m_content->cursorSave();
		m_content->cursorMove(m_top - m_selected);
		
		gRegion entryrect = eRect(0, 0, size().width(), m_itemheight);
		const gRegion &paint_region = *(gRegion*)data;

		for (int y = 0, i = 0; i <= m_items_per_page; y += m_itemheight, ++i)
		{
			gRegion entry_clip_rect = paint_region & entryrect;

			if (!entry_clip_rect.empty())
				m_content->paint(painter, *style, ePoint(0, y), m_selected == m_content->cursorGet() && m_content->size() && m_selection_enabled);

				/* (we could clip with entry_clip_rect, but 
				   this shouldn't change the behavior of any
				   well behaving content, so it would just
				   degrade performance without any gain.) */

			m_content->cursorMove(+1);
			entryrect.moveBy(ePoint(0, m_itemheight));
		}

		// clear/repaint empty/unused space between scrollbar and listboxentrys
		if (m_scrollbar && m_scrollbar->isVisible())
		{
			style->setStyle(painter, eWindowStyle::styleListboxNormal);
			painter.clip(eRect(m_scrollbar->position() - ePoint(5,0), eSize(5,m_scrollbar->size().height())));
			painter.clear();
			painter.clippop();
		}

		m_content->cursorRestore();

		return 0;
	}

	case evtChangedSize:
		recalcSize();
		return eWidget::event(event, data, data2);
		
	case evtAction:
		if (isVisible())
		{
			moveSelection((long)data2);
			return 1;
		}
		return 0;
	default:
		return eWidget::event(event, data, data2);
	}
}
Пример #8
0
void Panel::recalcSize()
{
	CRect rect;
	GetClientRect( &rect );
	recalcSize( rect.Width(), rect.Height() );
}
Пример #9
0
void Panel::OnSize( UINT nType, int cx, int cy )
{
	CWnd::OnSize( nType, cx, cy );
	recalcSize( cx, cy );
}
Пример #10
0
void TabButtonWidget::setPixmap(QPixmap p)
{
    m_pixmap = p;
    recalcSize();
}
Пример #11
0
void TabButtonWidget::setText(const QString &text)
{
    QPushButton::setText(text);
    recalcSize();
}