• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-workspace API Reference
  • KDE Home
  • Contact Us
 

KWinDecorationLibrary

  • kde-4.x
  • kde-workspace
  • kwin
  • libkdecorations
kdecorationfactory.cpp
Go to the documentation of this file.
1 /*****************************************************************
2 This file is part of the KDE project.
3 
4 Copyright (C) 2003 Lubos Lunak <[email protected]>
5 
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 ******************************************************************/
24 
25 #include "kdecorationfactory.h"
26 
27 #include <assert.h>
28 
29 #include "kdecorationbridge.h"
30 
31 class KDecorationFactoryPrivate {
32 public:
33  KDecorationFactoryPrivate() {
34  closeButtonCorner = (Qt::Corner)0;
35  }
36  Qt::Corner closeButtonCorner;
37  QList< KDecoration* > decorations;
38 };
39 
40 KDecorationFactory::KDecorationFactory(QObject *parent)
41  : QObject(parent)
42  , d(new KDecorationFactoryPrivate)
43 {
44 }
45 
46 KDecorationFactory::~KDecorationFactory()
47 {
48  assert(d->decorations.count() == 0);
49  delete d;
50 }
51 
52 void KDecorationFactory::checkRequirements(KDecorationProvides*)
53 {
54 }
55 
56 QList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const
57 {
58  return QList< BorderSize >() << BorderNormal;
59 }
60 
61 bool KDecorationFactory::exists(const KDecoration* deco) const
62 {
63  return d->decorations.contains(const_cast< KDecoration* >(deco));
64 }
65 
66 Qt::Corner KDecorationFactory::closeButtonCorner()
67 {
68  if (d->closeButtonCorner)
69  return d->closeButtonCorner;
70  return options()->titleButtonsLeft().contains(DecorationButtonClose) ? Qt::TopLeftCorner : Qt::TopRightCorner;
71 }
72 
73 void KDecorationFactory::setCloseButtonCorner(Qt::Corner cnr)
74 {
75  d->closeButtonCorner = cnr;
76 }
77 
78 void KDecorationFactory::addDecoration(KDecoration* deco)
79 {
80  d->decorations.append(deco);
81 }
82 
83 void KDecorationFactory::removeDecoration(KDecoration* deco)
84 {
85  d->decorations.removeAll(deco);
86 }
87 
88 NET::WindowType KDecorationFactory::windowType(unsigned long supported_types, KDecorationBridge* bridge) const
89 {
90  return bridge->windowType(supported_types);
91 }
92 
93 const KDecorationOptions* KDecorationFactory::options()
94 {
95  return KDecorationOptions::self();
96 }
KDecorationFactory::exists
bool exists(const KDecoration *deco) const
Returns true if the given decoration object still exists.
Definition: kdecorationfactory.cpp:61
KDecorationFactory::borderSizes
virtual QList< BorderSize > borderSizes() const
Reimplement this function if your decoration supports more border sizes than the default one (BorderN...
Definition: kdecorationfactory.cpp:56
KDecoration
This is the base class for a decoration object.
Definition: kdecoration.h:544
KDecorationBridge
Bridge class for communicating between decorations and KWin core.
Definition: kdecorationbridge.h:37
KDecorationFactory::checkRequirements
virtual void checkRequirements(KDecorationProvides *provides)
Definition: kdecorationfactory.cpp:52
KDecorationFactory::options
const KDecorationOptions * options()
Returns the KDecorationOptions object, which is used to access configuration settings for the decorat...
Definition: kdecorationfactory.cpp:93
KDecorationFactory::removeDecoration
void removeDecoration(KDecoration *)
Definition: kdecorationfactory.cpp:83
kdecorationfactory.h
QObject
kdecorationbridge.h
KDecorationFactory::windowType
NET::WindowType windowType(unsigned long supported_types, KDecorationBridge *bridge) const
This function has the same functionality like KDecoration::windowType().
Definition: kdecorationfactory.cpp:88
KDecorationProvides
Definition: kdecoration.h:296
QList< KDecoration * >
KDecorationOptions::self
static KDecorationOptions * self()
Definition: kdecoration.cpp:657
KDecorationFactory::closeButtonCorner
Qt::Corner closeButtonCorner()
Set & get the position of the close button - most decorations don't have to call this ever...
Definition: kdecorationfactory.cpp:66
KDecorationFactory::setCloseButtonCorner
void setCloseButtonCorner(Qt::Corner cnr)
Definition: kdecorationfactory.cpp:73
QList::contains
bool contains(const T &value) const
KDecorationDefines::BorderNormal
Standard size borders, the default setting.
Definition: kdecoration.h:187
KDecorationFactory::KDecorationFactory
KDecorationFactory(QObject *parent=nullptr)
Constructor.
Definition: kdecorationfactory.cpp:40
KDecorationFactory::addDecoration
void addDecoration(KDecoration *)
Definition: kdecorationfactory.cpp:78
KDecorationFactory::~KDecorationFactory
virtual ~KDecorationFactory()
Destructor.
Definition: kdecorationfactory.cpp:46
KDecorationBridge::windowType
virtual NET::WindowType windowType(unsigned long supported_types) const =0
KDecorationOptions
This class holds various configuration settings for the decoration.
Definition: kdecoration.h:309
KDecorationDefines::DecorationButtonClose
Definition: kdecoration.h:277
KDecorationOptions::titleButtonsLeft
QList< DecorationButton > titleButtonsLeft() const
If customButtonPositions() returns true, titleButtonsLeft returns which buttons should be on the left...
Definition: kdecoration.cpp:699
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 01:34:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KWinDecorationLibrary

Skip menu "KWinDecorationLibrary"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kde-workspace API Reference

Skip menu "kde-workspace API Reference"
  • KWin
  •   KWin Decoration Library
  •   KWin Effects Library
  • Plasma
  • Plasma
  •   Applets
  •   Engines
  •   libkworkspace
  •   libtaskmanager
  • System Settings
  •   SystemSettingsView

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal