Example #1
0
void Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
    // Early exit for right click
    if (evt.button() == RightButton)
        return;

    setPressedPart(theme()->hitTest(this, evt.position()));
    int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y();

    if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {
        setHoveredPart(ThumbPart);
        setPressedPart(ThumbPart);
        m_dragOrigin = m_currentPos;
        int thumbLen = theme()->thumbLength(this);
        int desiredPos = pressedPos;
        // Set the pressed position to the middle of the thumb so that when we do the move, the delta
        // will be from the current pixel position of the thumb to the new desired position for the thumb.
        m_pressedPos = theme()->trackPosition(this) + theme()->thumbPosition(this) + thumbLen / 2;
        moveThumb(desiredPos);
        return;
    } else if (m_pressedPart == ThumbPart)
        m_dragOrigin = m_currentPos;

    m_pressedPos = pressedPos;

    autoscrollPressedPart(theme()->initialAutoscrollTimerDelay());
}
Example #2
0
void Scrollbar::moveThumb(int pos, bool draggingDocument)
{
    if (!m_scrollableArea)
        return;

    int delta = pos - m_pressedPos;

    if (draggingDocument) {
        if (m_draggingDocument)
            delta = pos - m_documentDragPos;
        m_draggingDocument = true;
        FloatPoint currentPosition = m_scrollableArea->scrollAnimator()->currentPosition();
        float destinationPosition = (m_orientation == HorizontalScrollbar ? currentPosition.x() : currentPosition.y()) + delta;
        destinationPosition = m_scrollableArea->clampScrollPosition(m_orientation, destinationPosition);
        m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, destinationPosition);
        m_documentDragPos = pos;
        return;
    }

    if (m_draggingDocument) {
        delta += m_pressedPos - m_documentDragPos;
        m_draggingDocument = false;
    }

    // Drag the thumb.
    int thumbPos = theme()->thumbPosition(this);
    int thumbLen = theme()->thumbLength(this);
    int trackLen = theme()->trackLength(this);
    if (delta > 0)
        delta = std::min(trackLen - thumbLen - thumbPos, delta);
    else if (delta < 0)
        delta = std::max(-thumbPos, delta);

    float minPos = m_scrollableArea->minimumScrollPosition(m_orientation);
    float maxPos = m_scrollableArea->maximumScrollPosition(m_orientation);
    if (delta) {
        float newPosition = static_cast<float>(thumbPos + delta) * (maxPos - minPos) / (trackLen - thumbLen) + minPos;
        m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, newPosition);
    }
}
Example #3
0
int main(int argc, char ** argv)
{
    LTHEME::LoadCustomEnvSettings();
    QApplication a(argc, argv);
    LUtils::LoadTranslation(&a, "lumina-fileinfo");
    LuminaThemeEngine theme(&a);


    //Read the input variables
    QString path = "";
    QString flag = "";
    if (argc==2) {
        path = QString::fromLocal8Bit(argv[1]);
    } else if (argc==3) {
        flag = QString::fromLocal8Bit(argv[1]);
        path = QString::fromLocal8Bit(argv[2]);
    }
    //Check the input variables
    // - path
    if(!path.isEmpty()) {
        path = LUtils::PathToAbsolute(path);
    }
    // - flag
    if(!flag.isEmpty()) {
        if(flag=="-application") {
            flag = "APP"; //for internal use
        } else if(flag=="-link") {
            flag = "LINK"; //for internal use
        } else {
            //Invalid flag - clear the path as well
            path.clear();
        }
    }
    if(!path.isEmpty()) {
        //if(!QFile::exists(path)){ LUtils::writeFile(path,QStringList()); } //create an empty file
        MainUI w;
        QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
        w.LoadFile(path, flag);
        w.show();
        int retCode = a.exec();
        return retCode;
    } else {
        //Show an error text and exit
        QStringList msg;
        msg << "ERROR: Invalid input arguments";
        msg << "Usage: \"lumina-fileinfo [-application | -link] <file>";
        qDebug() << msg.join("\n");
        return 1;
    }


}
Example #4
0
void Scrollbar::setHoveredPart(ScrollbarPart part) {
  if (part == m_hoveredPart)
    return;

  if (((m_hoveredPart == NoPart || part == NoPart) &&
       theme().invalidateOnMouseEnterExit())
      // When there's a pressed part, we don't draw a hovered state, so there's
      // no reason to invalidate.
      || m_pressedPart == NoPart)
    setNeedsPaintInvalidation(static_cast<ScrollbarPart>(m_hoveredPart | part));

  m_hoveredPart = part;
}
Example #5
0
void RenderSliderThumb::updateAppearance(RenderStyle* parentStyle)
{
    if (parentStyle->appearance() == SliderVerticalPart)
        style()->setAppearance(SliderThumbVerticalPart);
    else if (parentStyle->appearance() == SliderHorizontalPart)
        style()->setAppearance(SliderThumbHorizontalPart);
    else if (parentStyle->appearance() == MediaSliderPart)
        style()->setAppearance(MediaSliderThumbPart);
    else if (parentStyle->appearance() == MediaVolumeSliderPart)
        style()->setAppearance(MediaVolumeSliderThumbPart);
    if (style()->hasAppearance())
        theme()->adjustSliderThumbSize(style());
}
Example #6
0
void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
    if (m_pressedPart == ThumbPart) {
        if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
            if (m_scrollableArea) {
                m_scrollableArea->setScrollPositionSingleAxis(m_orientation, m_dragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation), UserScroll);
            }
        } else {
            moveThumb(m_orientation == HorizontalScrollbar ?
                      convertFromContainingWindow(evt.position()).x() :
                      convertFromContainingWindow(evt.position()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
        }
        return;
    }

    if (m_pressedPart != NoPart)
        m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y();

    ScrollbarPart part = theme()->hitTest(this, evt.position());
    if (part != m_hoveredPart) {
        if (m_pressedPart != NoPart) {
            if (part == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(theme()->autoscrollTimerDelay());
                setNeedsPaintInvalidation();
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                setNeedsPaintInvalidation();
            }
        }

        setHoveredPart(part);
    }

    return;
}
void RenderSlider::layout()
{
    ASSERT(needsLayout());

    SliderThumbElement* thumbElement = shadowSliderThumb();
    RenderBox* thumb = thumbElement ? toRenderBox(thumbElement->renderer()) : 0;

    IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight());

    if (thumb) {
        // Allow the theme to set the size of the thumb.
        if (thumb->style()->hasAppearance()) {
            // FIXME: This should pass the style, not the renderer, to the theme.
            theme()->adjustSliderThumbSize(thumb);
        }

        baseSize.expand(thumb->style()->width().calcMinValue(0), thumb->style()->height().calcMinValue(0));
    }

    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());

    IntSize oldSize = size();

    setSize(baseSize);
    computeLogicalWidth();
    computeLogicalHeight();
    updateLayerTransform();

    if (thumb) {
        if (oldSize != size())
            thumb->setChildNeedsLayout(true, false);

        LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());

        IntRect oldThumbRect = thumb->frameRect();

        thumb->layoutIfNeeded();

        IntRect rect = thumbRect();
        thumb->setFrameRect(rect);
        if (thumb->checkForRepaintDuringLayout())
            thumb->repaintDuringLayoutIfMoved(oldThumbRect);

        statePusher.pop();
        addOverflowFromChild(thumb);
    }

    repainter.repaintAfterLayout();    

    setNeedsLayout(false);
}
    /////////////////////////////////////////////////////////////////////////////////////////
    // ThemedSkin::draw const
    //! Draws a standard button control
    //! 
    //! \param[in,out] &btn - Button to be drawn
    //! \param[in,out] &dc - Output device context
    //! \param[in] const &rc - Drawing rectangle
    /////////////////////////////////////////////////////////////////////////////////////////
    void draw(Button<ENC>& btn, DeviceContext& dc, const RectL& rc) const override
    {
      Theme theme(btn.handle(), L"Button");

      // Determine state
      ::PUSHBUTTONSTATES state = PBS_NORMAL;
      if (!btn.Enabled)
        state = PBS_DISABLED;
      else if (btn.State == ButtonState::Pushed) //else if (args.State && OwnerDrawState::Selected)
        state = PBS_PRESSED;
      else if (btn.isMouseOver())
        state = PBS_HOT;
      
      // Draw background 
      theme.fill(dc, BP_PUSHBUTTON, state, rc);

      // Query content rect
      RectL rcContent = theme.content(dc, BP_CHECKBOX, state, rc);

      // Pressed: Offset drawing rect
      if (state == PBS_PRESSED)
        rcContent += PointL(1,1);

      // Draw icon
      if (btn.Icon.exists()) 
      {
        RectL rcIcon = rcContent.arrange(Metrics::WindowIcon, {RectL::FromLeft,Metrics::WindowEdge.Width}, RectL::Centre);
        dc.draw(btn.Icon, rcIcon);
      }
      
      // Calculate text rectangle
      RectL rcText = rcContent;
      if (btn.Icon.exists()) 
        rcText.Left += Metrics::WindowIcon.Width + Metrics::WindowEdge.Width;

      // Draw text
      if (state != PBS_DISABLED)
        theme.write(dc, BP_PUSHBUTTON, state, btn.Text(), rcText, DrawTextFlags::Centre|DrawTextFlags::VCentre|DrawTextFlags::SingleLine);
      else
      {
        const auto grayString = choose<ENC>(::GrayStringA,::GrayStringW);
        grayString(dc.handle(), StockBrush::AppWorkspace, nullptr, (LPARAM)btn.Text().c_str(), btn.Text().size(), rcText.Left, rcText.Top, rcText.width(), rcText.height());
      }
      
      // [FOCUS] Draw focus rectangle
      if (btn.Focus)   
      {
        RectL rcFocus = rcContent.inflate(-Metrics::WindowEdge);
        dc.focus(rcFocus);
      }
    }
 void prepareSearchLine()
 {
     ui->searchLine->setDelayedSignals(true);
     QToolButton *left = new QToolButton(q);
     left->setIcon(theme()->icon(Core::Constants::ICONSEARCH));
     ui->searchLine->setLeftButton(left);
     QToolButton *right = new QToolButton(q);
     right->addAction(aSearchMolsAndClass);
     right->addAction(aSearchClassOnly);
     right->addAction(aSearchMolsOnly);
     right->setDefaultAction(aSearchMolsAndClass);
     ui->searchLine->setRightButton(right);
     QObject::connect(right, SIGNAL(triggered(QAction*)), q, SLOT(toggleClassMolsFilter(QAction*)));
 }
Example #10
0
void ThemeManager::newTheme()
{
	Theme theme(QString(), false);
	ThemeDialog dialog(theme, this);
	dialog.setWindowTitle(ThemeDialog::tr("New Theme"));
	if (dialog.exec() == QDialog::Rejected) {
		return;
	}

	QListWidgetItem* item = addItem(theme.id(), false, theme.name());
	m_themes->setCurrentItem(item);

	m_tabs->setCurrentIndex(1);
}
Example #11
0
	void IconManager::readSettings(QSettings *settings)
	{
		settings->beginGroup(appGroup);

		QString iconTheme = settings->value(iconThemeKey).toString();
		if(iconTheme.isEmpty()) {
			loadDefaults();
		} else {
			IconTheme theme(qApp->applicationDirPath() + "/themes/icons/" + iconTheme + "/theme.json");
			loadTheme(theme);
		}

		settings->endGroup();
	}
Example #12
0
bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
    if (m_pressedPart == ThumbPart) {
        if (theme()->shouldSnapBackToDragOrigin(this, evt))
            setCurrentPos(m_dragOrigin, NotFromScrollAnimator);
        else {
            moveThumb(m_orientation == HorizontalScrollbar ? 
                      convertFromContainingWindow(evt.pos()).x() :
                      convertFromContainingWindow(evt.pos()).y());
        }
        return true;
    }

    if (m_pressedPart != NoPart)
        m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());

    ScrollbarPart part = theme()->hitTest(this, evt);    
    if (part != m_hoveredPart) {
        if (m_pressedPart != NoPart) {
            if (part == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(theme()->autoscrollTimerDelay());
                theme()->invalidatePart(this, m_pressedPart);
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                theme()->invalidatePart(this, m_pressedPart);
            }
        } 
        
        setHoveredPart(part);
    } 

    return true;
}
Example #13
0
int main(int argc, char ** argv)
{
    if (argc > 1) {
      if (QString(argv[1]) == QString("--version")){
        qDebug() << LUtils::LuminaDesktopVersion();
        return 0;
      }
    }
    if(!QFile::exists(LOS::LuminaShare())){
      qDebug() << "Lumina does not appear to be installed correctly. Cannot find: " << LOS::LuminaShare();
      return 1;
    }
    //Setup any pre-QApplication initialization values
    LXDG::setEnvironmentVars();
    setenv("DESKTOP_SESSION","LUMINA",1);
    setenv("XDG_CURRENT_DESKTOP","LUMINA",1);
    //Setup the log file
    qDebug() << "Lumina Log File:" << logfile.fileName();
    if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); }
    if(logfile.exists()){ QFile::rename(logfile.fileName(), logfile.fileName()+".old"); }
      //Make sure the parent directory exists
      if(!QFile::exists(QDir::homePath()+"/.lumina/logs")){
        QDir dir;
        dir.mkpath(QDir::homePath()+"/.lumina/logs");
      }
    logfile.open(QIODevice::WriteOnly | QIODevice::Append);
    QTime *timer=0;
    if(DEBUG){ timer = new QTime(); timer->start(); }
    //Startup the Application
    if(DEBUG){ qDebug() << "Session Init:" << timer->elapsed(); }
    LSession a(argc, argv);
    if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); }
    LuminaThemeEngine theme(&a);
    //Setup Log File
    qInstallMessageHandler(MessageOutput);
    if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); }
    a.setupSession();
    if(DEBUG){ qDebug() << "Load Locale:" << timer->elapsed(); }
    LUtils::LoadTranslation(&a, "lumina-desktop");
    //a.LoadLocale(QLocale().name());
    //Start launching external applications
    QTimer::singleShot(3000, &a, SLOT(launchStartupApps()) ); //wait a couple seconds first
    if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;}
    int retCode = a.exec();
    //qDebug() << "Stopping the window manager";
    qDebug() << "Finished Closing Down Lumina";
    logfile.close();
    return retCode;
}
Example #14
0
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent)
{
    setPressedPart(NoPart);
    m_pressedPos = 0;
    m_draggingDocument = false;
    stopTimerIfNeeded();

    if (m_scrollableArea) {
        // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
        // to really know if the mouse has exited the scrollbar on a mouseUp.
        ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
        if (part == NoPart)
            m_scrollableArea->mouseExitedScrollbar(this);
    }
}
Example #15
0
void create_widget(const dictionary_t&  parameters, 
                   size_enum_t          size,
                   reveal_t*&           widget)
{
    std::string             name;
    std::string             alt_text;
    any_regular_t    show_value(true);
    theme_t          theme(implementation::size_to_theme(size));

    get_value(parameters, key_value_on, show_value);
    get_value(parameters, key_alt_text, alt_text);
    get_value(parameters, key_name, name);

    widget = new reveal_t(name, show_value, theme, alt_text);
}
Example #16
0
void Render::draw(int mode)
{
	switch(mode)
	{
		case 0:
			prelude();
			break;
		case 1:
			theme();
			break;
		case 2:
			finale();
			break;
	} // switch mode
} // draw()
Example #17
0
 uint PropertySheetIconValue::compare(const PropertySheetIconValue &other) const
 {
     uint diffMask = mask() | other.mask();
     for (int i = 0; i < 8; i++) {
         const uint flag = 1 << i;
         if (diffMask & flag) { // if state is set in both icons, compare the values
             const QPair<QIcon::Mode, QIcon::State> state = subPropertyFlagToIconModeState(flag);
             if (pixmap(state.first, state.second) == other.pixmap(state.first, state.second))
                 diffMask &= ~flag;
         }
     }
     if ((diffMask & ThemeIconMask) && theme() == other.theme())
         diffMask &= ~ThemeIconMask;
     return diffMask;
 }
Example #18
0
GuiRadioButton* GuiPane::addRadioButton(const GuiText& text, int myID, void* selection, 
                                        GuiTheme::RadioButtonStyle style) {

    GuiRadioButton* c = addControl
        (new GuiRadioButton(this, text, myID, Pointer<int>(reinterpret_cast<int*>(selection)), style));

    Vector2 size(0, (float)CONTROL_HEIGHT);

    if (style == GuiTheme::TOOL_RADIO_BUTTON_STYLE) {
        Vector2 bounds = theme()->minButtonSize(text, GuiTheme::TOOL_BUTTON_STYLE);
        size.x = max(float(TOOL_BUTTON_WIDTH), bounds.x);
    } else if (style == 1) { // Doesn't compile on gcc unless we put the integer in. GuiTheme::BUTTON_RADIO_BUTTON_STYLE) {
        size.x = BUTTON_WIDTH;
        Vector2 bounds = theme()->minButtonSize(text, GuiTheme::NORMAL_BUTTON_STYLE);
        size = size.max(bounds);
    } else { // NORMAL_RADIO_BUTTON_STYLE
        Vector2 bounds = theme()->minButtonSize(text, GuiTheme::NORMAL_BUTTON_STYLE);
        size.x = bounds.x;
    }

    c->setSize(size);

    return c;
}
Example #19
0
void GuiScrollPane::pack() {
    float scrollBarWidth = theme()->scrollBarWidth();
    m_viewPane->setPosition(0,0);
    m_viewPane->pack();
    Rect2D viewRect = m_viewPane->rect();
    if (verticalEnabled) {
        if (viewRect.width() > MIN_WINDOW_SIZE) {
            setWidth(viewRect.width() + scrollBarWidth);
        }
    }
    if (horizontalEnabled) {
        if(viewRect.height() < m_rect.height() && viewRect.height() > MIN_WINDOW_SIZE) {
            setHeight(viewRect.height() + scrollBarWidth);
        }
     }
}
Example #20
0
void RenderMediaVolumeSliderContainer::layout()
{
    RenderBlock::layout();

    if (style()->display() == NONE || !nextSibling() || !nextSibling()->isBox())
        return;

    RenderBox* buttonBox = toRenderBox(nextSibling());
    int absoluteOffsetTop = buttonBox->localToAbsolute(FloatPoint(0, -size().height())).y();

    LayoutStateDisabler layoutStateDisabler(&view());

    // If the slider would be rendered outside the page, it should be moved below the controls.
    if (UNLIKELY(absoluteOffsetTop < 0))
        setY(buttonBox->offsetTop() + theme()->volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
}
Example #21
0
void Game::update()
{

	switch(mode)
	{
		case PRELUDE:
			prelude();
			break;
		case THEME:
			theme();
			break;
		case FINALE:
			finale();
			break;
	}; // switch state
} // update()
Example #22
0
QIcon ConfigTabAppearance::createThemeIcon(const QString &fileName)
{
    QSettings settings(fileName, QSettings::IniFormat);
    Theme theme(settings);

    QPixmap pix(16, 16);
    pix.fill(Qt::black);

    QPainter p(&pix);

    QRect rect(1, 1, 14, 5);
    p.setPen(Qt::NoPen);
    p.setBrush( theme.color("sel_bg") );
    p.drawRect(rect);

    rect.translate(0, 5);
    p.setBrush( theme.color("bg") );
    p.drawRect(rect);

    rect.translate(0, 5);
    p.setBrush( theme.color("alt_bg") );
    p.drawRect(rect);

    QLine line;

    line = QLine(2, 3, 14, 3);
    QPen pen;
    p.setOpacity(0.6);

    pen.setColor( theme.color("sel_fg") );
    pen.setDashPattern(QVector<qreal>() << 2 << 1 << 1 << 1 << 3 << 1 << 2 << 10);
    p.setPen(pen);
    p.drawLine(line);

    line.translate(0, 5);
    pen.setColor( theme.color("fg") );
    pen.setDashPattern(QVector<qreal>() << 2 << 1 << 4 << 10);
    p.setPen(pen);
    p.drawLine(line);

    line.translate(0, 5);
    pen.setDashPattern(QVector<qreal>() << 3 << 1 << 2 << 1);
    p.setPen(pen);
    p.drawLine(line);

    return pix;
}
void RenderSliderThumb::updateAppearance(RenderStyle* parentStyle)
{
    if (parentStyle->appearance() == SliderVerticalPart)
        style().setAppearance(SliderThumbVerticalPart);
    else if (parentStyle->appearance() == SliderHorizontalPart)
        style().setAppearance(SliderThumbHorizontalPart);
    else if (parentStyle->appearance() == MediaSliderPart)
        style().setAppearance(MediaSliderThumbPart);
    else if (parentStyle->appearance() == MediaVolumeSliderPart)
        style().setAppearance(MediaVolumeSliderThumbPart);
    else if (parentStyle->appearance() == MediaFullScreenVolumeSliderPart)
        style().setAppearance(MediaFullScreenVolumeSliderThumbPart);
    if (style().hasAppearance()) {
        ASSERT(element());
        theme().adjustSliderThumbSize(style(), element());
    }
}
Example #24
0
wxImageList& Pcsx2App::GetImgList_Config()
{
	ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
	if( !images )
	{
		int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize;
		images = new wxImageList(image_size, image_size);
		wxFileName mess;
		bool useTheme = (g_Conf->DeskTheme != L"default");

		if( useTheme )
		{
			wxDirName theme( PathDefs::GetThemes() + g_Conf->DeskTheme );
			mess = theme.ToString();
		}

		wxImage img;

		// GCC Specific: wxT() macro is required when using string token pasting.  For some
		// reason L generates syntax errors. >_<
		// TODO: This can be fixed with something like
		// #define L_STR(x) L_STR2(x)
		// #define L_STR2(x) L ## x
		// but it's probably best to do it everywhere at once. wxWidgets
		// recommends not to use it since v2.9.0.

		#undef  FancyLoadMacro
		#define FancyLoadMacro( name ) \
		{ \
			EmbeddedImage<res_ConfigIcon_##name> temp; \
			LoadImageAny(img, useTheme, mess, L"ConfigIcon_" wxT(#name), temp); \
			img.Rescale(image_size, image_size, wxIMAGE_QUALITY_HIGH); \
			m_Resources->ImageId.Config.name = images->Add(img); \
		}

		FancyLoadMacro( Paths );
		FancyLoadMacro( Plugins );
		FancyLoadMacro( Gamefixes );
		FancyLoadMacro( Speedhacks );
		FancyLoadMacro( MemoryCard );
		FancyLoadMacro( Video );
		FancyLoadMacro( Cpu );
		FancyLoadMacro( Appearance );
	}
	return *images;
}
int main(int argc, char *argv[])
{
   ALLEGRO_DISPLAY *display;
   ALLEGRO_FONT *font;

   (void)argc;
   (void)argv;

   if (!al_init()) {
      abort_example("Could not init Allegro.\n");
      return 1;
   }

   al_init_primitives_addon();
   al_init_image_addon();
   al_init_font_addon();

   al_install_keyboard();
   al_install_mouse();

   al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS);
   display = al_create_display(640, 480);
   if (!display) {
      abort_example("Error creating display\n");
      return 1;
   }

   //printf("Display format = %d\n", al_get_display_format());

   font = al_load_font("data/fixed_font.tga", 0, 0);
   if (!font) {
      abort_example("Failed to load data/fixed_font.tga\n");
      return 1;
   }

   /* Don't remove these braces. */
   {
      Theme theme(font);
      Prog prog(theme, display);
      prog.run();
   }

   al_destroy_font(font);

   return 0;
}
Example #26
0
const QPixmap *QWindowsXPStylePrivate::tabBody( QWidget *widget )
{
    if ( !tabbody ) {
        tabbody = new QPixmap( 1, 1 );
        QPainter painter( tabbody );
        XPThemeData theme( widget, &painter, "TAB", TABP_BODY, 0 );
        SIZE sz;
        GetThemePartSize( theme.handle(), painter.handle(), TABP_BODY, 0, 0, TS_TRUE, &sz );
        painter.end();
        tabbody->resize( sz.cx, sz.cy );
        painter.begin( tabbody );
        theme.rec = QRect( 0, 0, sz.cx, sz.cy );
        theme.drawBackground();
        painter.end();
    }
    return tabbody;
}
Example #27
0
int main(int argc, char ** argv)
{
  LTHEME::LoadCustomEnvSettings();
  QApplication a(argc, argv);
  LUtils::LoadTranslation(&a, "lumina-fileinfo");
  LuminaThemeEngine theme(&a);


  //Read the input variables
  QString path = "";
  QString flag = "";
  for(int i=1; i<argc; i++){
    if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); }
    else{ path = QString(argv[i]); break; }
  }
  //Check the input variables
  // - path
  if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); }
  // - flag
  if(!flag.isEmpty()){
    if(flag=="-application"){
      flag = "APP"; //for internal use
    }else if(flag=="-link"){
      flag = "LINK"; //for internal use
    }else{
      //Invalid flag - clear the path as well
      flag.clear();
      path.clear();
    }
  }
  if(!path.isEmpty() || !flag.isEmpty()){ 
    MainUI w;
      QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
    w.LoadFile(path, flag);
    w.show();
    int retCode = a.exec();
    return retCode;
  }else{
    //Show an error text and exit
    qDebug() << "ERROR: Invalid input arguments";
    qDebug() << "Usage: \"lumina-fileinfo [-application | -link] [file]";
    return 1;
  }


}
Example #28
0
void ThemeManager::editTheme()
{
	QListWidgetItem* item = m_themes->currentItem();
	if (!item) {
		return;
	}

	Theme theme(item->data(Qt::UserRole).toString(), false);
	ThemeDialog dialog(theme, this);
	if (dialog.exec() == QDialog::Rejected) {
		return;
	}

	item->setText(theme.name());
	item->setIcon(QIcon(Theme::iconPath(theme.id(), false, devicePixelRatioF())));
	emit themeSelected(theme);
}
Example #29
0
void Scrollbar::autoscrollPressedPart(double delay)
{
    // Don't do anything for the thumb or if nothing was pressed.
    if (m_pressedPart == ThumbPart || m_pressedPart == NoPart)
        return;

    // Handle the track.
    if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && thumbUnderMouse(this)) {
        theme()->invalidatePart(this, m_pressedPart);
        setHoveredPart(ThumbPart);
        return;
    }

    // Handle the arrows and track.
    if (m_scrollableArea && m_scrollableArea->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity()))
        startTimerIfNeeded(delay);
}
void create_widget(const dictionary_t& parameters,
                   size_enum_t         size,
                   checkbox_t* &       checkbox)
{
    std::string    name;
    std::string    alt_text;
    any_regular_t true_value(true);
    any_regular_t false_value(false);
    theme_t theme(implementation::size_to_theme(size));

    get_value(parameters, key_name, name);
    get_value(parameters, key_alt_text, alt_text);
    get_value(parameters, key_value_on, true_value);
    get_value(parameters, key_value_off, false_value);

    checkbox = new checkbox_t(name, true_value, false_value, theme, alt_text);
}