コード例 #1
0
void RenderTheme::adjustButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
{
    // Most platforms will completely honor all CSS, and so we have no need to
    // adjust the style at all by default. We will still allow the theme a crack
    // at setting up a desired vertical size.
    setButtonSize(style);
}
コード例 #2
0
ファイル: RenderThemeQt.cpp プロジェクト: FilipBE/qtextended
void RenderThemeQt::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
{
    // Ditch the border.
    style->resetBorder();

    // Height is locked to auto.
    style->setHeight(Length(Auto));

    // White-space is locked to pre
    style->setWhiteSpace(PRE);

    // Use fixed font size and family
    FontDescription fontDescription = style->fontDescription();
    fontDescription.setIsAbsoluteSize(true);
    fontDescription.setSpecifiedSize(m_buttonFontPixelSize);
    fontDescription.setComputedSize(m_buttonFontPixelSize);
    FontFamily fontFamily;
    fontFamily.setFamily(m_buttonFontFamily);
    fontDescription.setFamily(fontFamily);
    style->setFontDescription(fontDescription);
    style->setLineHeight(RenderStyle::initialLineHeight());

    setButtonSize(style);
    setButtonPadding(style);
}
コード例 #3
0
void RenderThemeQtMobile::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element*) const
{
    // Ditch the border.
    style->resetBorder();

    FontDescription fontDescription = style->fontDescription();
    fontDescription.setIsAbsoluteSize(true);

    fontDescription.setSpecifiedSize(style->fontSize());
    fontDescription.setComputedSize(style->fontSize());

    style->setLineHeight(RenderStyle::initialLineHeight());
    setButtonSize(style);
    setButtonPadding(style);
}
コード例 #4
0
void RenderThemeQt::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
{
    // Ditch the border.
    style->resetBorder();

    // Height is locked to auto.
    style->setHeight(Length(Auto));

    // White-space is locked to pre
    style->setWhiteSpace(PRE);

    setButtonSize(style);

    setButtonPadding(style);
}
コード例 #5
0
ファイル: Button.cpp プロジェクト: eggtart93/LuckyDraw
    void Button::warp()
    {
        if(mIsFixedSize) return;

        if(p_mShape)
        {
            p_mShape->setSize(sf::Vector2f(p_mText->getGlobalBounds().width + 4.f,
                                       p_mText->getGlobalBounds().height + 2.f));
        }
        else if(p_mSprite)
        {
            setButtonSize(p_mText->getGlobalBounds().width + 4.f,
                    p_mText->getGlobalBounds().height + 2.f);
        }
    }
    //__________________________________________________
    Configuration::Configuration( KConfigGroup group )
    {

        // used to set default values when entries are not found in kconfig
        Configuration defaultConfiguration;

        // title alignment
        setTitleAlignment( titleAlignment(
            group.readEntry( OxygenConfig::TITLE_ALIGNMENT,
            defaultConfiguration.titleAlignmentName( false ) ), false ) );

        // center title on full width
        setCenterTitleOnFullWidth( group.readEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH,
            defaultConfiguration.centerTitleOnFullWidth() ) );

        // button size
        setButtonSize( buttonSize(
            group.readEntry( OxygenConfig::BUTTON_SIZE,
            defaultConfiguration.buttonSizeName( false ) ), false ) );

        // frame border
        setFrameBorder( frameBorder(
            group.readEntry( OxygenConfig::FRAME_BORDER,
            defaultConfiguration.frameBorderName( false ) ), false ) );

        // blend color
        setBlendColor( blendColor(
            group.readEntry( OxygenConfig::BLEND_COLOR,
            defaultConfiguration.blendColorName( false ) ), false ) );

        // size grip
        setSizeGripMode( sizeGripMode(
            group.readEntry( OxygenConfig::SIZE_GRIP_MODE,
            defaultConfiguration.sizeGripModeName( false ) ), false ) );

        // separator mode
        if( !group.readEntry( OxygenConfig::DRAW_SEPARATOR, defaultConfiguration.separatorMode() != SeparatorNever ) )
        {

            setSeparatorMode( SeparatorNever );

        } else if( group.readEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, defaultConfiguration.separatorMode() == SeparatorActive ) ) {

            setSeparatorMode( SeparatorActive );

        } else setSeparatorMode( SeparatorAlways );

        // title outline
        setDrawTitleOutline( group.readEntry(
            OxygenConfig::DRAW_TITLE_OUTLINE,
            defaultConfiguration.drawTitleOutline() ) );

        // hide title bar
        setHideTitleBar( group.readEntry(
            OxygenConfig::HIDE_TITLEBAR,
            defaultConfiguration.hideTitleBar() ) );

        // drop shadows
        setUseDropShadows( group.readEntry(
            OxygenConfig::USE_DROP_SHADOWS,
            defaultConfiguration.useDropShadows() ) );

        // oxygen shadows
        setUseOxygenShadows( group.readEntry(
            OxygenConfig::USE_OXYGEN_SHADOWS,
            defaultConfiguration.useOxygenShadows() ) );

        // transparency
        setTransparencyEnabled( group.readEntry(
            OxygenConfig::TRANSPARENCY_ENABLED,
            defaultConfiguration.transparencyEnabled() ) );

        // close from menu button
        setCloseFromMenuButton( group.readEntry(
            OxygenConfig::CLOSE_FROM_MENU_BUTTON,
            defaultConfiguration.closeFromMenuButton() ) );

        // buttonSpacing
        setUseNarrowButtonSpacing( group.readEntry(
            OxygenConfig::NARROW_BUTTON_SPACING,
            defaultConfiguration.useNarrowButtonSpacing() ) );

        // background opacity
        /*
        this is the decoration specific value
        it is overwritten by the style ("common") opacity, if opacityFromStyle is set to true
        */
        setBackgroundOpacity(
            group.readEntry( OxygenConfig::BACKGROUND_OPACITY,
            defaultConfiguration.backgroundOpacity() ) );

        setOpacityFromStyle(
            group.readEntry( OxygenConfig::OPACITY_FROM_STYLE,
            defaultConfiguration.opacityFromStyle() ) );

        // extended window border
        setUseExtendedWindowBorder( group.readEntry(
            OxygenConfig::EXTENDED_WINDOW_BORDERS,
            defaultConfiguration.useExtendedWindowBorder() ) );

        // animations
        setAnimationsEnabled( group.readEntry(
            OxygenConfig::ANIMATIONS_ENABLED,
            defaultConfiguration.animationsEnabled() ) );

        setButtonAnimationsEnabled( group.readEntry(
            OxygenConfig::BUTTON_ANIMATIONS_ENABLED,
            defaultConfiguration.buttonAnimationsEnabled() ) );

        setTitleAnimationsEnabled( group.readEntry(
            OxygenConfig::TITLE_ANIMATIONS_ENABLED,
            defaultConfiguration.titleAnimationsEnabled() ) );

        setShadowAnimationsEnabled( group.readEntry(
            OxygenConfig::SHADOW_ANIMATIONS_ENABLED,
            defaultConfiguration.shadowAnimationsEnabled() ) );

        setTabAnimationsEnabled( group.readEntry(
            OxygenConfig::TAB_ANIMATIONS_ENABLED,
            defaultConfiguration.tabAnimationsEnabled() ) );

        // animations duration
        setButtonAnimationsDuration( group.readEntry(
            OxygenConfig::BUTTON_ANIMATIONS_DURATION,
            defaultConfiguration.buttonAnimationsDuration() ) );

        setTitleAnimationsDuration( group.readEntry(
            OxygenConfig::TITLE_ANIMATIONS_DURATION,
            defaultConfiguration.titleAnimationsDuration() ) );

        setShadowAnimationsDuration( group.readEntry(
            OxygenConfig::SHADOW_ANIMATIONS_DURATION,
            defaultConfiguration.shadowAnimationsDuration() ) );

        setTabAnimationsDuration( group.readEntry(
            OxygenConfig::TAB_ANIMATIONS_DURATION,
            defaultConfiguration.tabAnimationsDuration() ) );

    }
コード例 #7
0
bool ToolBar::init(HINSTANCE hInst, HWND hPere, int iconSize, ToolBarButtonUnit *buttonUnitArray, int arraySize)
{
	Window::init(hInst, hPere);
	//_pToolBarIcons = pToolBarIcons;
	_toolBarIcons.init(buttonUnitArray, arraySize);
	_toolBarIcons.create(_hInst, iconSize);
	
	_state = (iconSize < 32)?REDUCED:ENLARGED;

	INITCOMMONCONTROLSEX icex;
	icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
	icex.dwICC  = ICC_BAR_CLASSES;
	InitCommonControlsEx(&icex);

	_hSelf = ::CreateWindowEx(
	               WS_EX_PALETTEWINDOW ,
	               TOOLBARCLASSNAME,
	               "",
	               WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
	               TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE | CCS_TOP | BTNS_AUTOSIZE ,
	               0, 0,
	               0, 0,
	               _hParent,
				   NULL,
	               _hInst,
	               0);

	if (!_hSelf)
	{
		systemMessage("System Err");
		throw int(9);
	}

//	long hCur = (long)::LoadCursor(hInst, MAKEINTRESOURCE(IDC_MY_CUR));
//	::SetClassLong(_hSelf, GCL_HCURSOR, hCur);

	// Send the TB_BUTTONSTRUCTSIZE message, which is required for 
	// backward compatibility.
	::SendMessage(_hSelf, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);

	setDefaultImageList();
	setHotImageList();
	setDisableImageList();

	int nbElement = _toolBarIcons.getNbCommand();
	
	_pTBB = new TBBUTTON[nbElement];
	
	for (int i = 0, j = 0; i < nbElement ; i++)
	{
		int cmd = 0;
		
		if ((cmd = _toolBarIcons.getCommandAt(i)) != 0)
		{
			_pTBB[i].iBitmap = j++;
			_pTBB[i].idCommand = cmd;
			_pTBB[i].fsState = TBSTATE_ENABLED;
			_pTBB[i].fsStyle = BTNS_BUTTON; 
			_pTBB[i].dwData = 0; 
			_pTBB[i].iString = 0;
		}
		else
		{
			_pTBB[i].iBitmap = 0;
			_pTBB[i].idCommand = cmd;
			_pTBB[i].fsState = TBSTATE_ENABLED;
			_pTBB[i].fsStyle = BTNS_SEP; 
			_pTBB[i].dwData = 0; 
			_pTBB[i].iString = 0;
		}
	}

	setButtonSize(iconSize, iconSize);

	::SendMessage(_hSelf, TB_ADDBUTTONS, (WPARAM)nbElement, (LPARAM)_pTBB); 
	//::SendMessage(_hSelf, TB_LOADIMAGES, IDB_VIEW_LARGE_COLOR, reinterpret_cast<LPARAM>(HINST_COMMCTRL));
	::SendMessage(_hSelf, TB_AUTOSIZE, 0, 0);
	return true;
}