Something went wrong. Try again.
Bring Windows XP themes to your KDE Plasma environment! xplasma.hotsocket.fyi
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667// SPDX-License-Identifier: GPL-3.0-or-later#pragma once// XP's window frame: the sizes its border and title bar are laid out by,// from the look's NONCLIENTMETRICS. The window decoration draws by them, and// so does the style's title bar (MDI windows, Properties' sample).//// XP's own rules are the defaults. A visual style -- or xplasmarc's// overrides, which reach a running decoration without a relog -- can change// them through properties XP doesn't know (unknown ones are passed over, so// a later build can add more)://// [Window] XPlasmaButtonsLeft = menu// XPlasmaButtonsRight = help, min, max, close// XPlasmaButtonGap = 2// XPlasmaButtonInset = 2, 2 (from the frame's corner)// XPlasmaIconSize = 16// XPlasmaTitleGaps = 4, 2 (after the left buttons, before the right)// [Window.Caption] ContentAlignment = Left | Center | Right (XP's own)// [Window.CloseButton] XPlasmaSize = 46, 21 (and Min/Max/Restore/HelpButton)// XPlasmaClipGlyph = true (glyph cut at the button, not XP's)#include "core/classic.h"
#include <QHash>#include <QList>#include <QSize>
namespace xpl {
class Renderer;
enum class CaptionButton { Menu, Help, Minimize, Maximize, Restore, Close };
struct DecorationLayout{ int frame = 4; // SM_CXSIZEFRAME int caption = 26; // SM_CYCAPTION QSize button; // caption buttons, XP's size for all of them int buttonGap = 2; QPoint inset{2, 2}; // the outermost buttons from the frame's corners int iconSize = 16; int titleGap = 4; // the title from the left buttons (Classic: 2) int titleEnd = 2; // ... and short of the right ones Qt::Alignment titleAlign = Qt::AlignLeft; QList<CaptionButton> left{CaptionButton::Menu}; // each side left to right QList<CaptionButton> right{CaptionButton::Help, CaptionButton::Minimize, CaptionButton::Maximize, CaptionButton::Close}; QHash<int, QSize> sizes; // a button's own size, where it's given one QList<int> clipped; // buttons whose glyph is cut at the button
// (Menu: the window's icon, iconSize wide.) QSize size(CaptionButton b) const; bool clips(CaptionButton b) const { return clipped.contains(int(b)); }};
// A visual style's caption button: SM_CYSIZE - 4 tall, as wide as one frame// of its CLOSEBUTTON background is in proportion.QSize styleButtonSize(int captionHeight, QSize closeArt);
// The layout for a look: Windows Classic's without `style`, a visual// style's with it -- its rules applied, then its XPlasma properties.DecorationLayout decorationLayout(const NonClientMetrics &metrics, const Renderer *style);
// The window class's part for a button (WP_CLOSEBUTTON ...), 0 for the menu.int captionButtonPart(CaptionButton b);
} // namespace xpl