|
Packit |
8e9c33 |
#ifndef adwaita_helper_h
|
|
Packit |
8e9c33 |
#define adwaita_helper_h
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
/*************************************************************************
|
|
Packit |
8e9c33 |
* Copyright (C) 2014 by Hugo Pereira Da Costa <hugo.pereira@free.fr> *
|
|
Packit |
8e9c33 |
* *
|
|
Packit |
8e9c33 |
* This program is free software; you can redistribute it and/or modify *
|
|
Packit |
8e9c33 |
* it under the terms of the GNU General Public License as published by *
|
|
Packit |
8e9c33 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
Packit |
8e9c33 |
* (at your option) any later version. *
|
|
Packit |
8e9c33 |
* *
|
|
Packit |
8e9c33 |
* This program is distributed in the hope that it will be useful, *
|
|
Packit |
8e9c33 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
Packit |
8e9c33 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
Packit |
8e9c33 |
* GNU General Public License for more details. *
|
|
Packit |
8e9c33 |
* *
|
|
Packit |
8e9c33 |
* You should have received a copy of the GNU General Public License *
|
|
Packit |
8e9c33 |
* along with this program; if not, write to the *
|
|
Packit |
8e9c33 |
* Free Software Foundation, Inc., *
|
|
Packit |
8e9c33 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
Packit |
8e9c33 |
*************************************************************************/
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#include "adwaita.h"
|
|
Packit |
8e9c33 |
#include "adwaitaanimationdata.h"
|
|
Packit |
8e9c33 |
#include "config-adwaita.h"
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#include <QPainterPath>
|
|
Packit |
8e9c33 |
#include <QWidget>
|
|
Packit |
8e9c33 |
#include <QStyle>
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#if ADWAITA_HAVE_X11
|
|
Packit |
8e9c33 |
#include <QX11Info>
|
|
Packit |
8e9c33 |
#include <xcb/xcb.h>
|
|
Packit |
8e9c33 |
#endif
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#include <cmath>
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
namespace Adwaita
|
|
Packit |
8e9c33 |
{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* adwaita style helper class.
|
|
Packit |
8e9c33 |
/** contains utility functions used at multiple places in both adwaita style and adwaita window decoration */
|
|
Packit |
8e9c33 |
class Helper
|
|
Packit |
8e9c33 |
{
|
|
Packit |
8e9c33 |
public:
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* constructor
|
|
Packit |
8e9c33 |
explicit Helper( );
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#if ADWAITA_USE_KDE4
|
|
Packit |
8e9c33 |
//* constructor
|
|
Packit |
8e9c33 |
explicit Helper( const QByteArray& );
|
|
Packit |
8e9c33 |
#endif
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* destructor
|
|
Packit |
8e9c33 |
virtual ~Helper()
|
|
Packit |
8e9c33 |
{}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//*@name color utilities
|
|
Packit |
8e9c33 |
//@{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
// Borrowed from the KColorUtils code
|
|
Packit |
8e9c33 |
static QColor mix(const QColor &c1, const QColor &c2, qreal bias = 0.5)
|
|
Packit |
8e9c33 |
{
|
|
Packit |
8e9c33 |
auto mixQreal = [](qreal a, qreal b, qreal bias) { return a + (b - a) * bias; };
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
if (bias <= 0.0) return c1;
|
|
Packit |
8e9c33 |
if (bias >= 1.0) return c2;
|
|
Packit |
8e9c33 |
if (std::isnan(bias)) return c1;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
qreal r = mixQreal(c1.redF(), c2.redF(), bias);
|
|
Packit |
8e9c33 |
qreal g = mixQreal(c1.greenF(), c2.greenF(), bias);
|
|
Packit |
8e9c33 |
qreal b = mixQreal(c1.blueF(), c2.blueF(), bias);
|
|
Packit |
8e9c33 |
qreal a = mixQreal(c1.alphaF(), c2.alphaF(), bias);
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
return QColor::fromRgbF(r, g, b, a);
|
|
Packit |
8e9c33 |
}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* add alpha channel multiplier to color
|
|
Packit |
8e9c33 |
QColor alphaColor( QColor color, qreal alpha ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
// ADWAITA TODO
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* mouse over color
|
|
Packit |
8e9c33 |
QColor hoverColor( const QPalette& palette ) const
|
|
Packit |
8e9c33 |
{ return palette.highlight().color(); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* focus color
|
|
Packit |
8e9c33 |
QColor focusColor( const QPalette& palette ) const
|
|
Packit |
8e9c33 |
{ return palette.highlight().color(); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* negative text color (used for close button)
|
|
Packit |
8e9c33 |
QColor negativeText( const QPalette& palette ) const
|
|
Packit |
8e9c33 |
// { return _viewNegativeTextBrush.brush( palette ).color(); }
|
|
Packit |
8e9c33 |
{ Q_UNUSED(palette); return Qt::red; }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* shadow
|
|
Packit |
8e9c33 |
QColor shadowColor( const QPalette& palette ) const
|
|
Packit |
8e9c33 |
{ return alphaColor( palette.color( QPalette::Shadow ), 0.15 ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* titlebar color
|
|
Packit |
8e9c33 |
QColor titleBarColor( const QPalette& palette, bool active ) const
|
|
Packit |
8e9c33 |
{ return palette.color(active ? QPalette::Active : QPalette::Inactive, QPalette::Window); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* titlebar text color
|
|
Packit |
8e9c33 |
QColor titleBarTextColor( const QPalette& palette, bool active ) const
|
|
Packit |
8e9c33 |
{ return palette.color(active ? QPalette::Active : QPalette::Inactive, QPalette::WindowText); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* frame outline color, using animations
|
|
Packit |
8e9c33 |
QColor frameOutlineColor( const QPalette&, bool mouseOver = false, bool hasFocus = false, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* input outline color, using animations
|
|
Packit |
8e9c33 |
QColor inputOutlineColor( const QPalette& palette, bool mouseOver = false, bool hasFocus = false, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* focus outline color, using animations
|
|
Packit |
8e9c33 |
QColor focusOutlineColor( const QPalette& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* hover outline color, using animations
|
|
Packit |
8e9c33 |
QColor hoverOutlineColor( const QPalette& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* focus outline color, using animations
|
|
Packit |
8e9c33 |
QColor buttonFocusOutlineColor( const QPalette& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* hover outline color, using animations
|
|
Packit |
8e9c33 |
QColor buttonHoverOutlineColor( const QPalette& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* side panel outline color, using animations
|
|
Packit |
8e9c33 |
QColor sidePanelOutlineColor( const QPalette&, bool hasFocus = false, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* frame background color
|
|
Packit |
8e9c33 |
QColor frameBackgroundColor( const QPalette& palette ) const
|
|
Packit |
8e9c33 |
{ return frameBackgroundColor( palette, palette.currentColorGroup() ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* frame background color
|
|
Packit |
8e9c33 |
QColor frameBackgroundColor( const QPalette&, QPalette::ColorGroup ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* arrow outline color
|
|
Packit |
8e9c33 |
QColor arrowColor( const QPalette&, QPalette::ColorGroup, QPalette::ColorRole ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* arrow outline color
|
|
Packit |
8e9c33 |
QColor arrowColor( const QPalette& palette, QPalette::ColorRole role ) const
|
|
Packit |
8e9c33 |
{ return arrowColor( palette, palette.currentColorGroup(), role ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* arrow outline color, using animations
|
|
Packit |
8e9c33 |
QColor arrowColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* button outline color, using animations
|
|
Packit |
8e9c33 |
QColor buttonOutlineColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* button panel color, using animations
|
|
Packit |
8e9c33 |
QColor buttonBackgroundColor( const QPalette&, bool mouseOver, bool hasFocus, bool sunken, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* tool button color
|
|
Packit |
8e9c33 |
QColor toolButtonColor( const QPalette&, bool mouseOver, bool hasFocus, bool sunken, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* slider outline color, using animations
|
|
Packit |
8e9c33 |
QColor sliderOutlineColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* scrollbar handle color, using animations
|
|
Packit |
8e9c33 |
QColor scrollBarHandleColor( const QPalette&, bool mouseOver, bool hasFocus, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* checkbox indicator, using animations
|
|
Packit |
8e9c33 |
QColor checkBoxIndicatorColor( const QPalette&, bool mouseOver, bool active, qreal opacity = AnimationData::OpacityInvalid, AnimationMode = AnimationNone ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* separator color
|
|
Packit |
8e9c33 |
QColor separatorColor( const QPalette& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* TreeView header text color
|
|
Packit |
8e9c33 |
QColor headerTextColor( const QPalette& palette, const QStyle::State state ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* TabBar background color
|
|
Packit |
8e9c33 |
QColor tabBarColor( const QPalette& palette, const QStyle::State state ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* merge active and inactive palettes based on ratio, for smooth enable state change transition
|
|
Packit |
8e9c33 |
QPalette disabledPalette( const QPalette&, qreal ratio ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//*@name rendering utilities
|
|
Packit |
8e9c33 |
//@{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* debug frame
|
|
Packit |
8e9c33 |
void renderDebugFrame( QPainter*, const QRect& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* focus rect
|
|
Packit |
8e9c33 |
void renderFocusRect( QPainter*, const QRect&, const QColor&, const QColor& outline = QColor(), Sides = 0 ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* focus line
|
|
Packit |
8e9c33 |
void renderFocusLine( QPainter*, const QRect&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* generic frame
|
|
Packit |
8e9c33 |
void renderFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline = QColor(), bool hasFocus = false ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* square frame
|
|
Packit |
8e9c33 |
void renderSquareFrame( QPainter* painter, const QRect& rect, QColor color, bool hasFocus ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* generic frame flat on right side
|
|
Packit |
8e9c33 |
void renderFlatFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline = QColor(), bool hasFocus = false ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* side panel frame
|
|
Packit |
8e9c33 |
void renderSidePanelFrame( QPainter*, const QRect&, const QColor& outline, Side ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* menu frame
|
|
Packit |
8e9c33 |
void renderMenuFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline, bool roundCorners = true ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* button frame
|
|
Packit |
8e9c33 |
void renderButtonFrame(QPainter*, const QRect&, const QColor& color, const QColor& outline, const QColor& shadow, bool focus, bool sunken, bool mouseOver , bool active) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* button frame
|
|
Packit |
8e9c33 |
void renderFlatButtonFrame(QPainter*, const QRect&, const QColor& color, const QColor& outline, const QColor& shadow, bool focus, bool sunken, bool mouseOver , bool active) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* toolbutton frame
|
|
Packit |
8e9c33 |
void renderToolButtonFrame( QPainter*, const QRect&, const QColor& color, bool sunken ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* toolbutton frame
|
|
Packit |
8e9c33 |
void renderToolBoxFrame( QPainter*, const QRect&, int tabWidth, const QColor& color ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* tab widget frame
|
|
Packit |
8e9c33 |
void renderTabWidgetFrame( QPainter*, const QRect&, const QColor& color, const QColor& outline, Corners ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* selection frame
|
|
Packit |
8e9c33 |
void renderSelection( QPainter*, const QRect&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* separator
|
|
Packit |
8e9c33 |
void renderSeparator( QPainter*, const QRect&, const QColor&, bool vertical = false ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* checkbox
|
|
Packit |
8e9c33 |
void renderCheckBoxBackground( QPainter*, const QRect&, const QColor& color, const QColor& outline, bool sunken ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* checkbox
|
|
Packit |
8e9c33 |
void renderCheckBox( QPainter*, const QRect&, const QColor& background, const QColor& outline, const QColor& tickColor, bool sunken, CheckBoxState state, qreal animation = AnimationData::OpacityInvalid, bool active = true ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* radio button
|
|
Packit |
8e9c33 |
void renderRadioButtonBackground( QPainter*, const QRect&, const QColor& color, const QColor& outline, bool sunken ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* radio button
|
|
Packit |
8e9c33 |
void renderRadioButton(QPainter*, const QRect&, const QColor& background, const QColor& outline, const QColor& tickColor, bool sunken, bool enabled, RadioButtonState state, qreal animation = AnimationData::OpacityInvalid ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* slider groove
|
|
Packit |
8e9c33 |
void renderSliderGroove( QPainter*, const QRect&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* slider handle
|
|
Packit |
8e9c33 |
void renderSliderHandle( QPainter*, const QRect&, const QColor&, const QColor& outline, const QColor& shadow, bool sunken, bool enabled, Side ticks, qreal angle = 0.0 ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* dial groove
|
|
Packit |
8e9c33 |
void renderDialGroove( QPainter*, const QRect&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* dial groove
|
|
Packit |
8e9c33 |
void renderDialContents( QPainter*, const QRect&, const QColor&, qreal first, qreal second ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* progress bar groove
|
|
Packit |
8e9c33 |
void renderProgressBarGroove( QPainter*, const QRect&, const QColor&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* progress bar contents
|
|
Packit |
8e9c33 |
void renderProgressBarContents( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline ) const
|
|
Packit |
8e9c33 |
{ return renderProgressBarGroove( painter, rect, color, outline ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* progress bar contents (animated)
|
|
Packit |
8e9c33 |
void renderProgressBarBusyContents( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline, bool horizontal, bool reverse, int progress ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* scrollbar groove
|
|
Packit |
8e9c33 |
void renderScrollBarGroove( QPainter* painter, const QRect& rect, const QColor& color ) const
|
|
Packit |
8e9c33 |
{ return renderScrollBarHandle( painter, rect, color ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* scrollbar handle
|
|
Packit |
8e9c33 |
void renderScrollBarHandle( QPainter*, const QRect&, const QColor& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* toolbar handle
|
|
Packit |
8e9c33 |
void renderToolBarHandle( QPainter* painter, const QRect& rect, const QColor& color ) const
|
|
Packit |
8e9c33 |
{ return renderProgressBarGroove( painter, rect, color, Qt::transparent ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* tabbar tab
|
|
Packit |
8e9c33 |
void renderTabBarTab(QPainter*, const QRect&, const QColor &background, const QColor& color, const QColor& outline, Corners, bool renderFrame ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* generic arrow
|
|
Packit |
8e9c33 |
void renderArrow( QPainter*, const QRect&, const QColor&, ArrowOrientation ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* generic sign (+-)
|
|
Packit |
8e9c33 |
void renderSign(QPainter*painter, const QRect&rect, const QColor&color, bool orientation ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* generic button (for mdi decorations, tabs and dock widgets)
|
|
Packit |
8e9c33 |
void renderDecorationButton( QPainter*, const QRect&, const QColor&, ButtonType, bool inverted ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//*@name compositing utilities
|
|
Packit |
8e9c33 |
//@{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* true if style was compiled for and is running on X11
|
|
Packit |
8e9c33 |
static bool isX11( void );
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* true if running on platform Wayland
|
|
Packit |
8e9c33 |
static bool isWayland( void );
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* returns true if compositing is active
|
|
Packit |
8e9c33 |
bool compositingActive( void ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* returns true if a given widget supports alpha channel
|
|
Packit |
8e9c33 |
bool hasAlphaChannel( const QWidget* ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@name high dpi utility functions
|
|
Packit |
8e9c33 |
//@{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return dpi-aware pixmap of given size
|
|
Packit |
8e9c33 |
virtual QPixmap highDpiPixmap( const QSize& size ) const
|
|
Packit |
8e9c33 |
{ return highDpiPixmap( size.width(), size.height() ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return dpi-aware pixmap of given size
|
|
Packit |
8e9c33 |
virtual QPixmap highDpiPixmap( int width ) const
|
|
Packit |
8e9c33 |
{ return highDpiPixmap( width, width ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return dpi-aware pixmap of given size
|
|
Packit |
8e9c33 |
virtual QPixmap highDpiPixmap( int width, int height ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return device pixel ratio for a given pixmap
|
|
Packit |
8e9c33 |
virtual qreal devicePixelRatio( const QPixmap& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//*@name X11 utilities
|
|
Packit |
8e9c33 |
//@{
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#if ADWAITA_HAVE_X11
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* get xcb connection
|
|
Packit |
8e9c33 |
static xcb_connection_t* connection( void );
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* create xcb atom
|
|
Packit |
8e9c33 |
xcb_atom_t createAtom( const QString& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#endif
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//@}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* frame radius
|
|
Packit |
8e9c33 |
qreal frameRadius( qreal bias = 0 ) const
|
|
Packit |
8e9c33 |
{ return qMax( qreal( Metrics::Frame_FrameRadius ) - 0.5 + bias, 0.0 ); }
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
void setVariant(QWidget *widget, const QByteArray &variant);
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
protected:
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* initialize
|
|
Packit |
8e9c33 |
void init( void );
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return rectangle for widgets shadow, offset depending on light source
|
|
Packit |
8e9c33 |
QRectF shadowRect( const QRectF& ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* return rounded path in a given rect, with only selected corners rounded, and for a given radius
|
|
Packit |
8e9c33 |
QPainterPath roundedPath( const QRectF&, Corners, qreal ) const;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
private:
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#if ADWAITA_HAVE_X11
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
//* atom used for compositing manager
|
|
Packit |
8e9c33 |
xcb_atom_t _compositingManagerAtom;
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#endif
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
};
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
}
|
|
Packit |
8e9c33 |
|
|
Packit |
8e9c33 |
#endif
|