Beispiel #1
0
    Button::Button()
        : mHasMouse(false),
          mKeyPressed(false),
          mMousePressed(false),
          mAlignment(Graphics::CENTER),
          mSpacing(4)
    {
        setFocusable(true);
        adjustSize();
        setBorderSize(1);

        addMouseListener(this);
        addKeyListener(this);
        addFocusListener(this);
    }
Beispiel #2
0
    TextBox::TextBox(const std::string& text)
    {
        mCaretColumn = 0;
        mCaretRow = 0;
        mEditable = true;
        mOpaque = true;

        setText(text);

        setFocusable(true);

        addMouseListener(this);
        addKeyListener(this);
        adjustSize();
        setBorderSize(1);
    }
Beispiel #3
0
    Slider::Slider(double scaleStart, double scaleEnd)
    {
        mMouseDrag = false;

        mScaleStart = scaleStart;
        mScaleEnd = scaleEnd;

        setFocusable(true);
        setBorderSize(1);
        setOrientation(HORIZONTAL);
        setValue(scaleStart);
        setStepLength((scaleEnd  - scaleStart)/ 10);
        setMarkerLength(10);

        addMouseListener(this);
        addKeyListener(this);
    }
ZenLabelDisplay::ZenLabelDisplay(const String& componentName /* = String::empty */, const String& labelText /* = String::empty */)
	:Label(componentName, labelText)
{
	setEditable(false, false, false);
	//labelImage = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_png, ZenBinaryData::zenLabelDisplay_pngSize);	
	
	labelTLCornerImage = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_topLeftCorner_png, ZenBinaryData::zenLabelDisplay_topLeftCorner_pngSize);
	labelTRCornerImage = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_topRightCorner_png, ZenBinaryData::zenLabelDisplay_topRightCorner_pngSize);
	labelBRCornerImage = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_bottomRightCorner_png, ZenBinaryData::zenLabelDisplay_bottomRightCorner_pngSize);
	labelBLCornerImage = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_bottomLeftCorner_png, ZenBinaryData::zenLabelDisplay_bottomLeftCorner_pngSize);

	labelTopLineImg = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_topLine_png, ZenBinaryData::zenLabelDisplay_topLine_pngSize);
	labelBottomLineImg = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_bottomLine_png, ZenBinaryData::zenLabelDisplay_bottomLine_pngSize);
	labelLeftLineImg = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_leftLine_png, ZenBinaryData::zenLabelDisplay_leftLine_pngSize);
	labelRightLineImg = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_rightLine_png, ZenBinaryData::zenLabelDisplay_rightLine_pngSize);

	//labelInteriorImg = ImageCache::getFromMemory(ZenBinaryData::zenLabelDisplay_interior_png, ZenBinaryData::zenLabelDisplay_interior_pngSize);
	
	this->setColour(textColourId, Colours::lightgrey);
	setJustificationType(Justification::centred);
	setBorderSize(BorderSize<int>(0));
	setBoundsInset(BorderSize<int>(0));
}
FFContainer::FFContainer()
{
    if (mInstances == 0)
    {
        mCornerUL = gcn::Image::load("images/cornerul.png");
        mCornerUR = gcn::Image::load("images/cornerur.png");
        mCornerDL = gcn::Image::load("images/cornerdl.png");
        mCornerDR = gcn::Image::load("images/cornerdr.png");
        mHorizontal = gcn::Image::load("images/horizontal.png");
        mVertical = gcn::Image::load("images/vertical.png");
    }

    mInstances++;

    mRealWidth = 0;
    mRealHeight = 0;
    mTime = -1;
    mShow = true;
    Container::setWidth(0);
    Container::setHeight(0);
    mSlideTarget = 0;
    mCurrentSlide = 0;
    setBorderSize(0);
}
Beispiel #6
0
bool QtCurveHandler::readConfig(bool compositingToggled)
{
    QtCurveConfig      oldConfig=m_config;
    KConfig            configFile("kwinqtcurverc");
    const KConfigGroup config(&configFile, "General");
    QFontMetrics       fm(m_titleFont);  // active font = inactive font
    int                oldSize=m_titleHeight,
                       oldToolSize=m_titleHeightTool;
    bool               changedBorder=false;

    // The title should stretch with bigger font sizes!
    m_titleHeight = qMax(16, fm.height() + 4); // 4 px for the shadow etc.
    // have an even title/button size so the button icons are fully centered...
    if (m_titleHeight%2 == 0)
        m_titleHeight++;

    fm = QFontMetrics(m_titleFontTool);  // active font = inactive font
    // The title should stretch with bigger font sizes!
    m_titleHeightTool = qMax(13, fm.height()); // don't care about the shadow etc.
    // have an even title/button size so the button icons are fully centered...
    if (m_titleHeightTool%2 == 0)
        m_titleHeightTool++;

    m_config.load(&configFile);

#if KDE_IS_VERSION(4, 3, 85)
    static bool borderHack=false;
    if(borderHack)
    {
    m_config.setOuterBorder(KWindowSystem::compositingActive() ? QtCurveConfig::SHADE_NONE :
                             (m_config.customShadows() ? QtCurveConfig::SHADE_SHADOW : QtCurveConfig::SHADE_DARK));
        changedBorder=true;
        borderHack=false;
    }
    else if(compositingToggled && !m_config.outerBorder() &&
           (m_config.borderSize()<QtCurveConfig::BORDER_TINY ||
            (wStyle()->pixelMetric((QStyle::PixelMetric)QtC_WindowBorder, 0L, 0L)&WINDOW_BORDER_COLOR_TITLEBAR_ONLY)))
    {
        QDBusConnection::sessionBus().send(QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"));
        borderHack=true;
    }
#endif

    m_titleHeight+=2*titleBarPad();

    QFile in(xdgConfigFolder() + "/qtcurve/" BORDER_SIZE_FILE);
    int   prevSize(-1), prevToolSize(-1), prevSide(-1), prevBot(-1);

    if(in.open(QIODevice::ReadOnly))
    {
        QTextStream stream(&in);
        prevSize=in.readLine().toInt();
        prevToolSize=in.readLine().toInt();
        prevBot=in.readLine().toInt();
        prevSide=in.readLine().toInt();
        in.close();
    }

    setBorderSize();

    int borderEdge=borderEdgeSize()*2;
    bool borderSizesChanged=prevSize!=(m_titleHeight+borderEdge) || prevToolSize!=(m_titleHeightTool+borderEdge) ||
                            prevBot!=borderSize(true) || prevSide!=borderSize(false);
    if(borderSizesChanged)
    {
        KSaveFile sizeFile(xdgConfigFolder() + "/qtcurve/" BORDER_SIZE_FILE);

        if (sizeFile.open())
        {
            QTextStream stream(&sizeFile);
            stream << m_titleHeight+borderEdge << endl
                   << m_titleHeightTool+borderEdge << endl
                   << borderSize(true) << endl
                   << borderSize(false) << endl;
            stream.flush();
            sizeFile.finalize();
            sizeFile.close();
        }
    }
#if KDE_IS_VERSION(4, 3, 0)
    bool shadowChanged(false);

    if(customShadows())
    {
        QtCurveShadowConfiguration actShadow(QPalette::Active),
                                   inactShadow(QPalette::Inactive);

        actShadow.load(&configFile);
        inactShadow.load(&configFile);

        shadowChanged=m_shadowCache.shadowConfigurationChanged(actShadow) ||
                      m_shadowCache.shadowConfigurationChanged(inactShadow);

        m_shadowCache.setShadowConfiguration(actShadow);
        m_shadowCache.setShadowConfiguration(inactShadow);

        if(shadowChanged || oldConfig.roundBottom()!=roundBottom())
            m_shadowCache.reset();
    }
#endif

    if(m_dBus && (borderSizesChanged || changedBorder))
    {
        m_dBus->emitBorderSizes(); // KDE4 apps...
        borderSizeChanged(); // Gtk2 apps...
    }

    return changedBorder ||
           oldSize!=m_titleHeight ||
           oldToolSize!=m_titleHeightTool ||
#if KDE_IS_VERSION(4, 3, 0)
           shadowChanged ||
#endif
           m_config!=oldConfig;
}
Beispiel #7
0
DBSH07TextField::DBSH07TextField(const std::string& text)
:TextField(text),
mFrameCounter(0)
{
    setBorderSize(0);
}
Beispiel #8
0
/*
 * resize
 */
void Volume::resize(void) {
    int w = 0;
    int h = 0;
    int d = 0;
    int start_width = 0;
    int start_height = 0;
    int start_depth = 0;
    if (!isPowerOfTwo(getWidth())) {
        w = nextPowerOfTwo(getWidth());
        start_width = (w - getWidth()) / 2;
    }
    if (!isPowerOfTwo(getHeight())) {
        h = nextPowerOfTwo(getHeight());
        start_height = (h - getHeight()) / 2;
    }
    if (!isPowerOfTwo(getDepth())) {
        d = nextPowerOfTwo(getDepth());
        start_depth = (d - getDepth()) / 2;
    }
    if ((w != 0) || (h != 0) || (d != 0)) {
        if (w == 0) {
            w = getWidth();
        }
        if (h == 0) {
            h = getHeight();
        }
        if (d == 0) {
            d = getDepth();
        }
        int _size[3];
        _size[0] = w;
        _size[1] = h;
        _size[2] = d;
        int _borderSize = 0;
        int _numberOfVoxels = (_size[0] + 2 * _borderSize) * (_size[1] + 2 * _borderSize) * (_size[2] + 2 * _borderSize);
        unsigned char* _voxelsBase = new unsigned char[_numberOfVoxels];
        for (int k = 0; k < getDepth(); k++) {
            for (int j = 0; j < getHeight(); j++) {
                for (int i = 0; i < getWidth(); i++) {
                    _voxelsBase[((start_depth + k) * (w * h)) + ((start_height + j) * w) + (start_width + i)] = voxels[(k
                            * (getWidth() * getHeight())) + (j * getWidth()) + i];
                }
            }
        }
        Point _origin = Point::origin;
        Size _extent;
        Point _center;
        for (int i = 0; i < 3; ++i) {
            _extent[i] = Scalar(_size[i]) * scale[i];
            _center[i] = _origin[i] + _extent[i] * Scalar(0.5);
        }
        unsigned char* _voxels = _voxelsBase + borderSize;
        int _increments[3];
        _increments[2] = 1;
        for (int i = 2; i > 0; --i) {
            _increments[i - 1] = _increments[i] * (_size[i] + 2 * _borderSize);
            _voxels += _borderSize * _increments[i - 1];
        }
        setNumberOfVoxels(_numberOfVoxels);
        setSize(_size);
        setOrigin(_origin);
        setExtent(_extent);
        setCenter(_center);
        delete byteVoxelsBase;
        setByteVoxelsBase(_voxelsBase);
        setBorderSize(_borderSize);
        setIncrements(_increments);
        setVoxels(_voxels);
    }
} // end resize()
Beispiel #9
0
void controlUC::setAttribute(PCWSTR pstrName, PCWSTR pstrValue)
{
	if( _tcscmp(pstrName, L"pos") == 0 ) {
		RECT rcPos = { 0 };
		PWSTR pstr = NULL;
		rcPos.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPos.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPos.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom};
		setFixedXY(szXY);
		setFixedWidth(rcPos.right - rcPos.left);
		setFixedHeight(rcPos.bottom - rcPos.top);
	}
	else if( _tcscmp(pstrName, L"relativepos") == 0 ) {
		SIZE szMove,szZoom;
		PWSTR pstr = NULL;
		szMove.cx = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		szMove.cy = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		szZoom.cx = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		szZoom.cy = _tcstol(pstr + 1, &pstr, 10); assert(pstr); 
		setRelativePos(szMove,szZoom);
	}
	else if( _tcscmp(pstrName, L"padding") == 0 ) {
		RECT rcPadding = { 0 };
		PWSTR pstr = NULL;
		rcPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setPadding(rcPadding);
	}
	else if( _tcscmp(pstrName, L"bkcolor") == 0 || _tcscmp(pstrName, L"bkcolor1") == 0 ) {
		while( *pstrValue > L'\0' && *pstrValue <= L' ')  pstrValue = ::CharNext(pstrValue);
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"bordercolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setBorderColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"focusbordercolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setFocusBorderColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"bordersize") == 0 ) setBorderSize(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"borderround") == 0 ) {
		SIZE cxyRound = { 0 };
		PWSTR pstr = NULL;
		cxyRound.cx = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		cxyRound.cy = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);     
		setBorderRound(cxyRound);
	}
	else if( _tcscmp(pstrName, L"width") == 0 ) setFixedWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"height") == 0 ) setFixedHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"minwidth") == 0 ) setMinWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"minheight") == 0 ) setMinHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"maxwidth") == 0 ) setMaxWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"maxheight") == 0 ) setMaxHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"name") == 0 ) setName(pstrValue);
	else if( _tcscmp(pstrName, L"text") == 0 ) setText(pstrValue);
	else if( _tcscmp(pstrName, L"tooltip") == 0 ) setToolTip(pstrValue);
	else if( _tcscmp(pstrName, L"userdata") == 0 ) setUserData(pstrValue);
	else if( _tcscmp(pstrName, L"enabled") == 0 ) setEnabled(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"mouse") == 0 ) setMouseEnabled(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"visible") == 0 ) setVisible(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"float") == 0 ) setFloat(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"shortcut") == 0 ) setShortcut(pstrValue[0]);
	else if( _tcscmp(pstrName, L"menu") == 0 ) setContextMenuUsed(_tcscmp(pstrValue, L"true") == 0);
}
Beispiel #10
0
DirectoryMenu :: DirectoryMenu() : internal::ComplexObject(), menuPage(), menuPageWindow(0), CancelButton(), FileButton()
{
    GuiFactory & factory = GuiFactory::GetFactoryInstance();

    menuPage.setFillColor(COL_GRAY_14);

    menuPage.setBorderSize(5);
    menuPage.setBorderColor(COL_GREEN);
    menuPage.setPosition(100,100);
    menuPage.setTextFontSize(15);
    menuPage.setTileThickness(30);

    menuPageWindow = new GUI::ScrollableWindow<GUI::DirectoryMenuPage>(&menuPage);
    //menuPageWindow->AttachDisplay(&menuPage);
    menuPageWindow->setBorderSize(2);

    menuPageWindow->setPosition(300,100);
    menuPageWindow->setScrollBarColor(COL_GRAY_4);
    menuPageWindow->setVerticalDisplaySize(15);

    menuPageWindow->Configure();
    icon = IconBuilder::getIcon<UpIcon>();

    CancelButton.setScale(0.4,0.4);
    FileButton.setScale(0.4,0.4);

    sf::Font * font = GUI::ResourceManager::getResource<GUI::Font>("Font_2");

    TileMap["DirectoryNameLabel"] = MenuTiles
            (font,
             DefaultWidth,  //Width
             40,//TileThickness
             0, //BorderSize
             "Open",
             10, //Font Size
             0.4, //Margin
             COL_BLACK,  //LabelColor
             COL_BLACK,
             internal::Center
             );

    TileMap["DirectoryNameArea"] =  MenuTiles
            (font,
             200,  //Width
             30,//TileThickness
             0, //BorderSize
             "Directory Name Area",
             15, //Font Size
             0.4, //Margin
             COL_BLACK,  //LabelColor
             COL_BLUE
             ); //Font Color

    TileMap["Title"] =  MenuTiles
            (font,
             200,  //Width
             30,//TileThickness
             0, //BorderSize
             "Title",
             15, //Font Size
             0.4, //Margin
             COL_BLACK,  //LabelColor
             COL_BLUE
             ); //Font Color


    setMarginSize(0);
    setBorderSize(5);
    setBorderColor(COL_GRAY_3);

    Register<GUI::EnclosingBox>("EnclosingBox", *static_cast<EnclosingBox*>(this) );
    Register<GUI::ScrollableWindow<DirectoryMenuPage>>("DirectoryMenuPage",*menuPageWindow );
    Register<GUI::MenuTiles>("Title", TileMap["Title"]);
    Register<GUI::MenuTiles>("Label", TileMap["DirectoryNameLabel"] );
    Register<GUI::MenuTiles>("TextBox", TileMap["DirectoryNameArea"]);
    Register<GUI::Button<GUI::CancelTexture>>("CancelButton", CancelButton);
    Register<GUI::Button<GUI::FileTexture>>("FileButton", FileButton);
    Register<GUI::Icon>("UpIcon", *icon);

    icon->iconEvents.AddEvent<DirectoryMenu>(this, &DirectoryMenu::MoveUpDirectory );


}