bool RenderThemeSymbian::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { if (!m_radioButtonOn) { m_radioButtonOn = Image::loadPlatformResource("radioButtonOn"); m_radioButtonOff = Image::loadPlatformResource("radioButtonOff"); } paintButtonDecorations(o, i, r); MScrollView* wv = scrollView(i); // don't scale the checkbox if scalingFactor is 100% or we are in the process of scaling another image if (wv->scalingFactor() <= 100 || m_bitmapScaler) { i.context->drawImage(isChecked(o)?m_radioButtonOn:m_radioButtonOff,r); } // use the cached scaled image if it has the same scaling factor else if (wv->scalingFactor() == (isChecked(o) ? m_scalingForRadioOn : m_scalingForRadioOff)) { i.context->drawImage(isChecked(o) ? m_scaledRadioOn : m_scaledRadioOff, r); } // scale else { scaleImage(isChecked(o) ? ERadioOn : ERadioOff, wv->scalingFactor()); if (wv->scalingFactor() == (isChecked(o) ? m_scalingForRadioOn : m_scalingForRadioOff)) { i.context->drawImage(isChecked(o) ? m_scaledRadioOn : m_scaledRadioOff, r); } else { i.context->drawImage(isChecked(o)?m_radioButtonOn:m_radioButtonOff,r); } } return false; }
bool_t CC_CALL UIList::draw(Draw2D &_draw2d, const float _delta) { if (!isVisible()) return TRUE; delta = _delta; scrollView(); cc_double_iterator_t *curr = first; if (curr == NULL) { return FALSE; } /**/ _draw2d.beginScissor(viewRect); beginDrawList(_draw2d, _delta); for (int32_t i = offsetStart; i < offsetEnd; i++) { if (drawListIndexItem(_draw2d, _delta, curr, ((i * lineHeight) - offset), i) == FALSE) { break; } curr = curr->next; if (curr== NULL) break; } endDrawList(_draw2d, _delta); _draw2d.endScissor(); return TRUE; }
void LCDConsole::incrementRow() { if (++_row >= getConsoleRows()) { _row = getConsoleRows() - 1; scrollView(); } }
void DolphinView::createView() { assert(m_iconsView == 0); assert(m_detailsView == 0); switch (m_mode) { case IconsView: case PreviewsView: { const DolphinIconsView::LayoutMode layoutMode = (m_mode == IconsView) ? DolphinIconsView::Icons : DolphinIconsView::Previews; m_iconsView = new DolphinIconsView(this, layoutMode); m_topLayout->insertWidget(1, m_iconsView); setFocusProxy(m_iconsView); connect(m_iconsView, SIGNAL(executed(QIconViewItem*)), this, SLOT(triggerIconsViewItem(QIconViewItem*))); connect(m_iconsView, SIGNAL(returnPressed(QIconViewItem*)), this, SLOT(triggerIconsViewItem(QIconViewItem*))); connect(m_iconsView, SIGNAL(signalRequestActivation()), this, SLOT(slotGrabActivation())); m_iconsView->endItemUpdates(); m_iconsView->show(); m_iconsView->setFocus(); break; } case DetailsView: { m_detailsView = new DolphinDetailsView(this); m_topLayout->insertWidget(1, m_detailsView); setFocusProxy(m_detailsView); connect(m_detailsView, SIGNAL(executed(QListViewItem*, const QPoint&, int)), this, SLOT(triggerDetailsViewItem(QListViewItem*, const QPoint&, int))); connect(m_detailsView, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(triggerDetailsViewItem(QListViewItem*))); connect(m_detailsView, SIGNAL(signalRequestActivation()), this, SLOT(slotGrabActivation())); m_detailsView->show(); m_detailsView->setFocus(); break; } default: break; } connect(scrollView(), SIGNAL(contentsMoving(int, int)), this, SLOT(slotContentsMoving(int, int))); startDirLister(m_urlNavigator->url()); }
bool RenderThemeSymbian::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { if (!m_selectArrow) { m_selectArrow = Image::loadPlatformResource("selectArrow"); } IntSize s = m_selectArrow->size(); // draw the bounding area i.context->save(); //i.context->setPen(Pen(Color::black,1)); i.context->setFillColor(Color::lightGray); IntRect brect(r.x() + r.width() - s.width(), r.y(), s.width(), r.height() - 3 ); i.context->drawRect(r); paintButtonDecorations(o, i, r); // draw the arrow int y = (r.height() - s.height())/2 + r.y(); IntRect arrowRect(IntPoint(r.x() + r.width() - s.width(), y), s); MScrollView* wv = scrollView(i); // don't scale the checkbox if scalingFactor is 100% or we are in the process of scaling another image if (wv->scalingFactor() <= 100 || m_bitmapScaler) { i.context->drawImage(m_selectArrow, arrowRect); } // use the cached scaled image if it has the same scaling factor else if (wv->scalingFactor() == (m_scalingForSelectArrow)) { i.context->drawImage(m_scaledSelectArrow, arrowRect); } // scale else { scaleImage(ESelectArrow, wv->scalingFactor()); if (wv->scalingFactor() == m_scalingForSelectArrow) { i.context->drawImage(m_scaledSelectArrow, arrowRect); } else { i.context->drawImage(m_selectArrow, arrowRect); } } i.context->restore(); return false; }
bool RenderThemeSymbian::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { EAppearance appearance = o->style()->appearance(); i.context->save(); i.context->setStrokeColor(Color::black); i.context->setStrokeThickness(1.0f); i.context->setFillColor(Color::lightGray); i.context->drawRect(r); if (!m_selectArrow) { m_selectArrow = Image::loadPlatformResource("selectArrow"); } MScrollView* wv = scrollView(i); IntSize s = m_selectArrow->size(); int y = (r.height() - s.height())/2 + r.y(); IntRect imrect(IntPoint(r.x()+r.width()-s.width(), y), s); // don't scale the checkbox if scalingFactor is 100% or we are in the process of scaling another image if (wv->scalingFactor() <= 100 || m_bitmapScaler) { i.context->drawImage(m_selectArrow, imrect); } // use the cached scaled image if it has the same scaling factor else if (wv->scalingFactor() == (m_scalingForSelectArrow)) { i.context->drawImage(m_scaledSelectArrow, imrect); } // scale else { scaleImage(ESelectArrow, wv->scalingFactor()); if (wv->scalingFactor() == m_scalingForSelectArrow) { i.context->drawImage(m_scaledSelectArrow, imrect); } else { i.context->drawImage(m_selectArrow, imrect); } } i.context->restore(); return false; }
bool RenderThemeSymbian::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { paintButtonDecorations(o, i, r); MScrollView* wv = scrollView(i); // don't scale the checkbox if scalingFactor is 100% or we are in the process of scaling another image if (wv->scalingFactor() <= 100 || m_bitmapScaler) { i.context->drawImage(isChecked(o)?m_checkBoxOn:m_checkBoxOff,r); } // use the cached scaled image if it has the same scaling factor else if (wv->scalingFactor() == (isChecked(o) ? m_scalingForCheckBoxOn : m_scalingForCheckBoxOff)) { i.context->drawImage(isChecked(o) ? m_scaledCheckBoxOn : m_scaledCheckBoxOff, r); } // scale else { scaleImage(isChecked(o) ? ECheckBoxOn : ECheckBoxOff, wv->scalingFactor()); if (wv->scalingFactor() == (isChecked(o) ? m_scalingForCheckBoxOn : m_scalingForCheckBoxOff)) { i.context->drawImage(isChecked(o) ? m_scaledCheckBoxOn : m_scaledCheckBoxOff, r); } else { i.context->drawImage(isChecked(o)?m_checkBoxOn:m_checkBoxOff,r); } } return false; }
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : QFrame(parent), m_iconProvider(m_resIconSize), m_itemIconSize(24, 24), m_resIconSize(24, 24), m_itemsView(new QDeclarativeView(this)), m_resourcesView(new Internal::ItemLibraryTreeView(this)), m_filterFlag(QtBasic) { setWindowTitle(tr("Library", "Title of library view")); /* create Items view and its model */ m_itemsView->setAttribute(Qt::WA_OpaquePaintEvent); m_itemsView->setAttribute(Qt::WA_NoSystemBackground); m_itemsView->setAcceptDrops(false); m_itemsView->setFocusPolicy(Qt::ClickFocus); m_itemsView->setResizeMode(QDeclarativeView::SizeRootObjectToView); m_itemLibraryModel = new Internal::ItemLibraryModel(QDeclarativeEnginePrivate::getScriptEngine(m_itemsView->engine()), this); m_itemLibraryModel->setItemIconSize(m_itemIconSize); QDeclarativeContext *rootContext = m_itemsView->rootContext(); rootContext->setContextProperty(QLatin1String("itemLibraryModel"), m_itemLibraryModel.data()); rootContext->setContextProperty(QLatin1String("itemLibraryIconWidth"), m_itemIconSize.width()); rootContext->setContextProperty(QLatin1String("itemLibraryIconHeight"), m_itemIconSize.height()); QColor highlightColor = palette().highlight().color(); if (0.5*highlightColor.saturationF()+0.75-highlightColor.valueF() < 0) highlightColor.setHsvF(highlightColor.hsvHueF(),0.1 + highlightColor.saturationF()*2.0, highlightColor.valueF()); m_itemsView->rootContext()->setContextProperty(QLatin1String("highlightColor"), highlightColor); // loading the qml has to come after all needed context properties are set m_itemsView->setSource(QUrl("qrc:/ItemLibrary/qml/ItemsView.qml")); QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_itemsView->rootObject()); connect(rootItem, SIGNAL(itemSelected(int)), this, SLOT(showItemInfo(int))); connect(rootItem, SIGNAL(itemDragged(int)), this, SLOT(startDragAndDrop(int))); connect(this, SIGNAL(scrollItemsView(QVariant)), rootItem, SLOT(scrollView(QVariant))); connect(this, SIGNAL(resetItemsView()), rootItem, SLOT(resetView())); /* create Resources view and its model */ m_resourcesFileSystemModel = new QFileSystemModel(this); m_resourcesFileSystemModel->setIconProvider(&m_iconProvider); m_resourcesView->setModel(m_resourcesFileSystemModel.data()); m_resourcesView->setIconSize(m_resIconSize); /* create image provider for loading item icons */ m_itemsView->engine()->addImageProvider(QLatin1String("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider); /* other widgets */ QTabBar *tabBar = new QTabBar(this); tabBar->addTab(tr("Items", "Title of library items view")); tabBar->addTab(tr("Resources", "Title of library resources view")); tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_lineEdit = new Utils::FilterLineEdit(this); m_lineEdit->setObjectName(QLatin1String("itemLibrarySearchInput")); m_lineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text")); m_lineEdit->setDragEnabled(false); m_lineEdit->setMinimumWidth(75); m_lineEdit->setTextMargins(0, 0, 20, 0); QWidget *lineEditFrame = new QWidget(this); lineEditFrame->setObjectName(QLatin1String("itemLibrarySearchInputFrame")); QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame); lineEditLayout->setMargin(2); lineEditLayout->setSpacing(0); lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3); lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0); lineEditLayout->addWidget(m_lineEdit.data(), 1, 1, 1, 1); lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 2); connect(m_lineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString))); m_stackedWidget = new QStackedWidget(this); m_stackedWidget->addWidget(m_itemsView.data()); m_stackedWidget->addWidget(m_resourcesView.data()); connect(tabBar, SIGNAL(currentChanged(int)), m_stackedWidget.data(), SLOT(setCurrentIndex(int))); connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(updateSearch())); QWidget *spacer = new QWidget(this); spacer->setObjectName(QLatin1String("itemLibrarySearchInputSpacer")); spacer->setFixedHeight(4); QGridLayout *layout = new QGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(tabBar, 0, 0, 1, 1); layout->addWidget(spacer, 1, 0); layout->addWidget(lineEditFrame, 2, 0, 1, 1); layout->addWidget(m_stackedWidget.data(), 3, 0, 1, 1); setResourcePath(QDir::currentPath()); setSearchFilter(QString()); /* style sheets */ setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"))); m_resourcesView->setStyleSheet( QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"))); }
int DolphinView::contentsY() const { return scrollView()->contentsY(); }