[kwin] Remove b2 and laptop window decorations
They have been unmaintained for a long time and nobody stepped up to port them to the changes in the decoration API. If at some time someone wants to bring them back it's still in the git history.icc-effect-5.14.5
parent
04716ae5e3
commit
2a5a89a0e4
|
@ -3,5 +3,3 @@ add_subdirectory( aurorae )
|
|||
if(KWIN_BUILD_OXYGEN)
|
||||
add_subdirectory( oxygen )
|
||||
endif()
|
||||
# add_subdirectory( b2 )
|
||||
# add_subdirectory( laptop )
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
add_subdirectory( config )
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwin3_b2_PART_SRCS b2client.cpp)
|
||||
|
||||
|
||||
kde4_add_plugin(kwin3_b2 ${kwin3_b2_PART_SRCS})
|
||||
|
||||
target_link_libraries(kwin3_b2 kdecorations ${X11_LIBRARIES})
|
||||
|
||||
install(TARGETS kwin3_b2 DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES b2.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin/ )
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=B II
|
||||
Name[af]=B II
|
||||
Name[ar]=B II
|
||||
Name[ast]=B II
|
||||
Name[be]=B II
|
||||
Name[be@latin]=B II
|
||||
Name[bg]=B II
|
||||
Name[bn]=B II
|
||||
Name[bn_IN]=B II
|
||||
Name[br]=B II
|
||||
Name[bs]=B II
|
||||
Name[ca]=B II
|
||||
Name[ca@valencia]=B II
|
||||
Name[cs]=B II
|
||||
Name[csb]=B II
|
||||
Name[cy]=B II
|
||||
Name[da]=B II
|
||||
Name[de]=B II
|
||||
Name[el]=B II
|
||||
Name[en_GB]=B II
|
||||
Name[eo]=B II
|
||||
Name[es]=B II
|
||||
Name[et]=B II
|
||||
Name[eu]=B II
|
||||
Name[fi]=B II
|
||||
Name[fr]=B II
|
||||
Name[fy]=B II
|
||||
Name[ga]=B II
|
||||
Name[gl]=B II
|
||||
Name[gu]=બી ૨
|
||||
Name[he]=B II
|
||||
Name[hi]=बी II
|
||||
Name[hne]=बी II
|
||||
Name[hr]=B II
|
||||
Name[hsb]=B II
|
||||
Name[hu]=B II
|
||||
Name[ia]=B II
|
||||
Name[id]=B II
|
||||
Name[is]=B II
|
||||
Name[it]=B II
|
||||
Name[ja]=B II
|
||||
Name[ka]=B II
|
||||
Name[kk]=B II
|
||||
Name[km]=B II
|
||||
Name[kn]=ಬಿ II
|
||||
Name[ko]=B II
|
||||
Name[ku]=B II
|
||||
Name[lt]=B II
|
||||
Name[lv]=B II
|
||||
Name[mai]=बी II
|
||||
Name[mk]=B II
|
||||
Name[ml]=ബി II
|
||||
Name[mr]=B II
|
||||
Name[ms]=B II
|
||||
Name[nb]=B II
|
||||
Name[nds]=B II
|
||||
Name[ne]=B II
|
||||
Name[nl]=B II
|
||||
Name[nn]=B II
|
||||
Name[pa]=B II
|
||||
Name[pl]=B II
|
||||
Name[pt]=B II
|
||||
Name[pt_BR]=B II
|
||||
Name[ro]=B II
|
||||
Name[ru]=B II
|
||||
Name[se]=B II
|
||||
Name[si]=B II
|
||||
Name[sk]=B II
|
||||
Name[sl]=B II
|
||||
Name[sr]=Б II
|
||||
Name[sr@ijekavian]=Б II
|
||||
Name[sr@ijekavianlatin]=B II
|
||||
Name[sr@latin]=B II
|
||||
Name[sv]=B II
|
||||
Name[ta]=B II
|
||||
Name[te]=B II
|
||||
Name[tg]=B II
|
||||
Name[th]=รูปแบบ B II
|
||||
Name[tr]=B II
|
||||
Name[ug]=B II
|
||||
Name[uk]=B II
|
||||
Name[uz]=B II
|
||||
Name[uz@cyrillic]=B II
|
||||
Name[vi]=B II
|
||||
Name[wa]=B II
|
||||
Name[xh]=B II
|
||||
Name[x-test]=xxB IIxx
|
||||
Name[zh_CN]=B II
|
||||
Name[zh_TW]=B II
|
||||
X-KDE-Library=kwin3_b2
|
File diff suppressed because it is too large
Load Diff
|
@ -1,190 +0,0 @@
|
|||
/*********************************************************************
|
||||
B-II KWin Client
|
||||
|
||||
Changes:
|
||||
Customizable button positions by Karol Szwed <gallium@kde.org>
|
||||
Ported to the kde3.2 API by Luciano Montanaro <mikelima@cirulla.net>
|
||||
|
||||
Added option to turn off titlebar autorelocation
|
||||
Copyright (c) 2009 Jussi Kekkonen <tmt@ubuntu.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __B2CLIENT_H
|
||||
#define __B2CLIENT_H
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QAbstractButton>
|
||||
//Added by qt3to4:
|
||||
#include <QPaintEvent>
|
||||
#include <QGridLayout>
|
||||
#include <QEvent>
|
||||
#include <QBoxLayout>
|
||||
#include <QShowEvent>
|
||||
#include <QResizeEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QBitmap>
|
||||
#include <QPixmap>
|
||||
#include <kdecoration.h>
|
||||
#include <kdecorationfactory.h>
|
||||
|
||||
class QSpacerItem;
|
||||
class QBoxLayout;
|
||||
class QGridLayout;
|
||||
|
||||
namespace B2 {
|
||||
|
||||
class B2Client;
|
||||
|
||||
class B2Button : public QAbstractButton
|
||||
{
|
||||
public:
|
||||
explicit B2Button(B2Client *_client=0, QWidget *parent=0, const QString& tip=QString(), const int realizeBtns = Qt::LeftButton);
|
||||
~B2Button() {}
|
||||
|
||||
void setBg(const QColor &c){bg = c;}
|
||||
void setPixmaps(QPixmap *pix, QPixmap *pixDown, QPixmap *iPix,
|
||||
QPixmap *iPixDown);
|
||||
void setPixmaps(int button_id);
|
||||
void setToggle(){setCheckable(true);}
|
||||
void setActive(bool on){setChecked(on);}
|
||||
void setUseMiniIcon(){useMiniIcon = true;}
|
||||
QSize sizeHint() const;
|
||||
QSizePolicy sizePolicy() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *e);
|
||||
|
||||
void mousePressEvent( QMouseEvent* e );
|
||||
void mouseReleaseEvent( QMouseEvent* e );
|
||||
private:
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
|
||||
bool useMiniIcon;
|
||||
QPixmap *icon[6];
|
||||
QColor bg; //only use one color (the rest is pixmap) so forget QPalette ;)
|
||||
|
||||
public:
|
||||
B2Client* client;
|
||||
Qt::MouseButtons last_button;
|
||||
int realizeButtons;
|
||||
bool hover;
|
||||
};
|
||||
|
||||
class B2Titlebar : public QWidget
|
||||
{
|
||||
friend class B2Client;
|
||||
public:
|
||||
explicit B2Titlebar(B2Client *parent);
|
||||
~B2Titlebar(){;}
|
||||
bool isFullyObscured() const {return isfullyobscured;}
|
||||
void recalcBuffer();
|
||||
QSpacerItem *captionSpacer;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
bool x11Event(XEvent *e);
|
||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void wheelEvent(QWheelEvent *e);
|
||||
private:
|
||||
void drawTitlebar(QPainter &p, bool state);
|
||||
|
||||
B2Client *client;
|
||||
QString oldTitle;
|
||||
QPixmap titleBuffer;
|
||||
QPoint moveOffset;
|
||||
bool set_x11mask;
|
||||
bool isfullyobscured;
|
||||
bool shift_move;
|
||||
};
|
||||
|
||||
class B2Client : public KDecoration
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class B2Titlebar;
|
||||
public:
|
||||
B2Client(KDecorationBridge *b, KDecorationFactory *f);
|
||||
~B2Client(){;}
|
||||
void init();
|
||||
void unobscureTitlebar();
|
||||
void titleMoveAbs(int new_ofs);
|
||||
void titleMoveRel(int xdiff);
|
||||
// transparent stuff
|
||||
virtual bool drawbound(const QRect& geom, bool clear);
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* );
|
||||
void paintEvent( QPaintEvent* );
|
||||
void showEvent( QShowEvent* );
|
||||
void windowWrapperShowEvent( QShowEvent* );
|
||||
void captionChange();
|
||||
void desktopChange();
|
||||
void shadeChange();
|
||||
void activeChange();
|
||||
void maximizeChange();
|
||||
void iconChange();
|
||||
void doShape();
|
||||
Position mousePosition( const QPoint& p ) const;
|
||||
void resize(const QSize&);
|
||||
void borders(int &, int &, int &, int &) const;
|
||||
QSize minimumSize() const;
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
private slots:
|
||||
void menuButtonPressed();
|
||||
//void slotReset();
|
||||
void maxButtonClicked();
|
||||
void shadeButtonClicked();
|
||||
void resizeButtonPressed();
|
||||
private:
|
||||
void addButtons(const QString& s, const QString tips[],
|
||||
B2Titlebar* tb, QBoxLayout* titleLayout);
|
||||
void positionButtons();
|
||||
void calcHiddenButtons();
|
||||
bool mustDrawHandle() const;
|
||||
bool autoMoveTitlebar() const;
|
||||
|
||||
enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose,
|
||||
BtnHelp, BtnShade, BtnResize, BtnCount};
|
||||
B2Button* button[BtnCount];
|
||||
QGridLayout *g;
|
||||
// Border spacers
|
||||
QSpacerItem *topSpacer;
|
||||
QSpacerItem *bottomSpacer;
|
||||
QSpacerItem *leftSpacer;
|
||||
QSpacerItem *rightSpacer;
|
||||
B2Titlebar *titlebar;
|
||||
int bar_x_ofs;
|
||||
int in_unobs;
|
||||
QTime time;
|
||||
bool resizable;
|
||||
};
|
||||
|
||||
class B2ClientFactory : public QObject, public KDecorationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
B2ClientFactory();
|
||||
virtual ~B2ClientFactory();
|
||||
virtual KDecoration *createDecoration(KDecorationBridge *);
|
||||
virtual bool reset(unsigned long changed);
|
||||
virtual bool supports( Ability ability ) const;
|
||||
QList< B2ClientFactory::BorderSize > borderSizes() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
/********************************************************************
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __STDCLIENT_BITMAPS_H
|
||||
#define __STDCLIENT_BITMAPS_H
|
||||
|
||||
/**
|
||||
* The standard client has the capability to color it's titlebar buttons
|
||||
* according to the new color scheme. In order to do this it needs a bitmap
|
||||
* for each shade which it draws into a pixmap with the appropriate color.
|
||||
* These are all the bitmaps.
|
||||
*/
|
||||
|
||||
static const unsigned char menu_white_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0x3f, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char menu_dgray_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x20, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char menu_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0x3f, 0x04, 0x20, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pindown_white_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x1f, 0xa0, 0x03,
|
||||
0xb0, 0x01, 0x30, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pindown_gray_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
|
||||
0x00, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x80, 0x07, 0xc0, 0x03, 0xe0, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pindown_dgray_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x10, 0x70, 0x20, 0x50, 0x20,
|
||||
0x48, 0x30, 0xc8, 0x38, 0x08, 0x1f, 0x08, 0x18, 0x10, 0x1c, 0x10, 0x0e,
|
||||
0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pindown_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0xf0, 0x3f, 0xf0, 0x3f,
|
||||
0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf0, 0x1f, 0xf0, 0x0f,
|
||||
0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pinup_white_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x11,
|
||||
0x3f, 0x15, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pinup_gray_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x0a, 0xbf, 0x0a, 0x80, 0x15, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pinup_dgray_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x40, 0x31, 0x40, 0x2e,
|
||||
0x40, 0x20, 0x40, 0x20, 0x7f, 0x2a, 0x40, 0x3f, 0xc0, 0x31, 0xc0, 0x20,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const unsigned char pinup_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0xc0, 0x31, 0xc0, 0x3f,
|
||||
0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xc0, 0x3f, 0xc0, 0x31, 0xc0, 0x20,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
########### next target ###############
|
||||
|
||||
set(kwin_b2_config_PART_SRCS config.cpp )
|
||||
|
||||
|
||||
kde4_add_plugin(kwin_b2_config ${kwin_b2_config_PART_SRCS})
|
||||
|
||||
|
||||
|
||||
target_link_libraries(kwin_b2_config ${KDE4_KDEUI_LIBS} Qt5::Gui)
|
||||
|
||||
install(TARGETS kwin_b2_config DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
/********************************************************************
|
||||
This file contains the B2 configuration widget
|
||||
|
||||
Copyright (c) 2001
|
||||
Karol Szwed <gallium@kde.org>
|
||||
http://gallium.n3.net/
|
||||
Copyright (c) 2007
|
||||
Luciano Montanaro <mikelima@cirulla.net>
|
||||
Automove titlebar bits Copyright (c) 2009 Jussi Kekkonen <tmt@ubuntu.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <kglobal.h>
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
//Added by qt3to4:
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <klocale.h>
|
||||
#include <KDE/KLocalizedString>
|
||||
#include <kvbox.h>
|
||||
|
||||
|
||||
extern "C" KDE_EXPORT QObject *allocate_config(KConfig *conf, QWidget *parent)
|
||||
{
|
||||
return(new B2Config(conf, parent));
|
||||
}
|
||||
|
||||
/* NOTE:
|
||||
* 'conf' is a pointer to the kwindecoration modules open kwin config,
|
||||
* and is by default set to the "Style" group.
|
||||
*
|
||||
* 'parent' is the parent of the QObject, which is a VBox inside the
|
||||
* Configure tab in kwindecoration
|
||||
*/
|
||||
|
||||
B2Config::B2Config(KConfig *conf, QWidget *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
Q_UNUSED( conf );
|
||||
KGlobal::locale()->insertCatalog("kwin_b2_config");
|
||||
b2Config = new KConfig("kwinb2rc");
|
||||
gb = new KVBox(parent);
|
||||
|
||||
cbColorBorder = new QCheckBox(
|
||||
i18n("Draw window frames using &titlebar colors"), gb);
|
||||
cbColorBorder->setWhatsThis(
|
||||
i18n("When selected, the window borders "
|
||||
"are drawn using the titlebar colors; otherwise, they are "
|
||||
"drawn using normal border colors."));
|
||||
|
||||
// Grab Handle
|
||||
showGrabHandleCb = new QCheckBox(
|
||||
i18n("Draw &resize handle"), gb);
|
||||
showGrabHandleCb->setWhatsThis(
|
||||
i18n("When selected, decorations are drawn with a \"grab handle\" "
|
||||
"in the bottom right corner of the windows; "
|
||||
"otherwise, no grab handle is drawn."));
|
||||
|
||||
// Automove Titlebar
|
||||
autoMoveTitlebarCb = new QCheckBox(
|
||||
i18n("Auto-move titlebar"), gb);
|
||||
autoMoveTitlebarCb->setWhatsThis(
|
||||
i18n("When selected, titlebars are automatically relocated "
|
||||
"to visible positions; "
|
||||
"otherwise, they are only moved manually using shift+drag."));
|
||||
|
||||
// Double click menu option support
|
||||
actionsGB = new QGroupBox(i18n("Actions Settings"), gb);
|
||||
//actionsGB->setOrientation(Qt::Horizontal);
|
||||
QLabel *menuDblClickLabel = new QLabel(actionsGB);
|
||||
menuDblClickLabel->setText(i18n("Double click on menu button:"));
|
||||
menuDblClickOp = new KComboBox(actionsGB);
|
||||
menuDblClickOp->addItem(i18n("Do Nothing"));
|
||||
menuDblClickOp->addItem(i18n("Minimize Window"));
|
||||
menuDblClickOp->addItem(i18n("Shade Window"));
|
||||
menuDblClickOp->addItem(i18n("Close Window"));
|
||||
|
||||
menuDblClickOp->setWhatsThis(
|
||||
i18n("An action can be associated to a double click "
|
||||
"of the menu button. Leave it to none if in doubt."));
|
||||
|
||||
QGridLayout *actionsLayout = new QGridLayout();
|
||||
QSpacerItem *actionsSpacer = new QSpacerItem(8, 8,
|
||||
QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
actionsLayout->addWidget(menuDblClickLabel, 0, 0, Qt::AlignRight);
|
||||
actionsLayout->addWidget(menuDblClickOp, 0, 1);
|
||||
actionsLayout->addItem(actionsSpacer, 0, 2);
|
||||
actionsGB->setLayout(actionsLayout);
|
||||
// Load configuration options
|
||||
KConfigGroup cg(b2Config, "General");
|
||||
load(cg);
|
||||
|
||||
// Ensure we track user changes properly
|
||||
connect(cbColorBorder, SIGNAL(clicked()), SIGNAL(changed()));
|
||||
connect(showGrabHandleCb, SIGNAL(clicked()), SIGNAL(changed()));
|
||||
connect(autoMoveTitlebarCb, SIGNAL(clicked()), SIGNAL(changed()));
|
||||
connect(menuDblClickOp, SIGNAL(activated(int)), SIGNAL(changed()));
|
||||
// Make the widgets visible in kwindecoration
|
||||
gb->show();
|
||||
}
|
||||
|
||||
B2Config::~B2Config()
|
||||
{
|
||||
delete b2Config;
|
||||
delete gb;
|
||||
}
|
||||
|
||||
void B2Config::slotSelectionChanged()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
|
||||
// Loads the configurable options from the kwinrc config file
|
||||
// It is passed the open config from kwindecoration to improve efficiency
|
||||
void B2Config::load(const KConfigGroup & /*conf*/)
|
||||
{
|
||||
KConfigGroup cg(b2Config, "General");
|
||||
|
||||
bool override = cg.readEntry("UseTitleBarBorderColors", false);
|
||||
cbColorBorder->setChecked(override);
|
||||
|
||||
override = cg.readEntry("DrawGrabHandle", true);
|
||||
showGrabHandleCb->setChecked(override);
|
||||
|
||||
override = cg.readEntry( "AutoMoveTitleBar", true );
|
||||
autoMoveTitlebarCb->setChecked(override);
|
||||
|
||||
QString returnString = cg.readEntry(
|
||||
"MenuButtonDoubleClickOperation", "NoOp");
|
||||
|
||||
int op;
|
||||
if (returnString == "Close") {
|
||||
op = 3;
|
||||
} else if (returnString == "Shade") {
|
||||
op = 2;
|
||||
} else if (returnString == "Minimize") {
|
||||
op = 1;
|
||||
} else {
|
||||
op = 0;
|
||||
}
|
||||
|
||||
menuDblClickOp->setCurrentIndex(op);
|
||||
}
|
||||
|
||||
static QString opToString(int op)
|
||||
{
|
||||
switch (op) {
|
||||
case 1:
|
||||
return "Minimize";
|
||||
case 2:
|
||||
return "Shade";
|
||||
case 3:
|
||||
return "Close";
|
||||
case 0:
|
||||
default:
|
||||
return "NoOp";
|
||||
}
|
||||
}
|
||||
|
||||
// Saves the configurable options to the kwinrc config file
|
||||
void B2Config::save(KConfigGroup & /*conf*/)
|
||||
{
|
||||
KConfigGroup cg(b2Config, "General");
|
||||
cg.writeEntry("UseTitleBarBorderColors", cbColorBorder->isChecked());
|
||||
cg.writeEntry("DrawGrabHandle", showGrabHandleCb->isChecked());
|
||||
cg.writeEntry("AutoMoveTitleBar", autoMoveTitlebarCb->isChecked());
|
||||
cg.writeEntry("MenuButtonDoubleClickOperation",
|
||||
opToString(menuDblClickOp->currentIndex()));
|
||||
// Ensure others trying to read this config get updated
|
||||
b2Config->sync();
|
||||
}
|
||||
|
||||
// Sets UI widget defaults which must correspond to style defaults
|
||||
void B2Config::defaults()
|
||||
{
|
||||
cbColorBorder->setChecked(false);
|
||||
showGrabHandleCb->setChecked(true);
|
||||
autoMoveTitlebarCb->setChecked(true);
|
||||
menuDblClickOp->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
#include "config.moc"
|
||||
// vi: sw=4 ts=8
|
|
@ -1,66 +0,0 @@
|
|||
/********************************************************************
|
||||
This file contains the B2 configuration widget
|
||||
|
||||
Copyright (c) 2001
|
||||
Karol Szwed <gallium@kde.org>
|
||||
http://gallium.n3.net/
|
||||
Copyright (c) 2007
|
||||
Luciano Montanaro <mikelima@cirulla.net>
|
||||
Automove titlebar bits Copyright (c) 2009 Jussi Kekkonen <tmt@ubuntu.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef _KDE_B2CONFIG_H
|
||||
#define _KDE_B2CONFIG_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <KComboBox>
|
||||
#include <kconfig.h>
|
||||
|
||||
class B2Config: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
B2Config(KConfig *conf, QWidget *parent);
|
||||
~B2Config();
|
||||
|
||||
// These public signals/slots work similar to KCM modules
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
public slots:
|
||||
void load(const KConfigGroup &conf);
|
||||
void save(KConfigGroup &conf);
|
||||
void defaults();
|
||||
|
||||
protected slots:
|
||||
void slotSelectionChanged(); // Internal use
|
||||
|
||||
private:
|
||||
KConfig *b2Config;
|
||||
QCheckBox *cbColorBorder;
|
||||
QCheckBox *showGrabHandleCb;
|
||||
QCheckBox *autoMoveTitlebarCb;
|
||||
QGroupBox *actionsGB;
|
||||
KComboBox *menuDblClickOp;
|
||||
QWidget *gb;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// vi: sw=4 ts=8
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
########### next target ###############
|
||||
|
||||
set(kwin3_laptop_PART_SRCS laptopclient.cpp)
|
||||
|
||||
|
||||
kde4_add_plugin(kwin3_laptop ${kwin3_laptop_PART_SRCS})
|
||||
|
||||
target_link_libraries(kwin3_laptop kdecorations)
|
||||
|
||||
install(TARGETS kwin3_laptop DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES laptop.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin )
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Laptop
|
||||
Name[af]=Draagbare rekenaar
|
||||
Name[ar]=حاسوب محمول
|
||||
Name[ast]=Portátil
|
||||
Name[be]=Ноўтбук
|
||||
Name[be@latin]=Laptop
|
||||
Name[bg]=Лаптоп
|
||||
Name[bn]=ল্যাপটপ
|
||||
Name[bn_IN]=ল্যাপ-টপ
|
||||
Name[br]=Hezoug
|
||||
Name[bs]=Laptop
|
||||
Name[ca]=Portàtil
|
||||
Name[ca@valencia]=Portàtil
|
||||
Name[cs]=Notebook
|
||||
Name[csb]=Laptop
|
||||
Name[cy]=Gluniadur
|
||||
Name[da]=Bærbar
|
||||
Name[de]=Laptop
|
||||
Name[el]=Φορητό
|
||||
Name[en_GB]=Laptop
|
||||
Name[eo]=Tekokomputilo
|
||||
Name[es]=Portátil
|
||||
Name[et]=Laptop
|
||||
Name[eu]=Ordenagailu eramangarria
|
||||
Name[fa]=رایانه کیفی
|
||||
Name[fi]=Kannettava
|
||||
Name[fr]=Ordinateur portable
|
||||
Name[fy]=Skoatkompjûter
|
||||
Name[ga]=Ríomhaire Glúine
|
||||
Name[gl]=Portátil
|
||||
Name[gu]=લેપટોપ
|
||||
Name[he]=מחשב נייד
|
||||
Name[hi]=लैपटॉप
|
||||
Name[hne]=लैपटाप
|
||||
Name[hr]=Laptop
|
||||
Name[hsb]=Laptop
|
||||
Name[hu]=Noteszgép
|
||||
Name[ia]=Laptop
|
||||
Name[id]=Laptop
|
||||
Name[is]=Fartölva
|
||||
Name[it]=Portatile
|
||||
Name[ja]=ラップトップ
|
||||
Name[ka]=ლეპტოპი
|
||||
Name[kk]=Ноутбук
|
||||
Name[km]=កុំព្យូទ័រយួរដៃ
|
||||
Name[kn]=ಉಡಿಗಣಕ
|
||||
Name[ko]=랩탑
|
||||
Name[ku]=Laptop
|
||||
Name[lt]=Nešiojamas kompiuteris
|
||||
Name[lv]=Laptops
|
||||
Name[mai]=लैपटाप
|
||||
Name[mk]=Лаптоп
|
||||
Name[ml]=ലാപ്ടോപ്
|
||||
Name[mr]=लैपटॉप
|
||||
Name[ms]=Komputer riba
|
||||
Name[nb]=Bærbar
|
||||
Name[nds]=Klappreekner
|
||||
Name[ne]=ल्यापटप
|
||||
Name[nl]=Laptop
|
||||
Name[nn]=Berbar
|
||||
Name[pa]=ਲੈਪਟਾਪ
|
||||
Name[pl]=Laptop
|
||||
Name[pt]=Portátil
|
||||
Name[pt_BR]=Laptop
|
||||
Name[ro]=Laptop
|
||||
Name[ru]=Ноутбук
|
||||
Name[se]=Mátkedihtor
|
||||
Name[si]=ලැප්ටොප්
|
||||
Name[sk]=Laptop
|
||||
Name[sl]=Prenosnik
|
||||
Name[sr]=Лаптоп
|
||||
Name[sr@ijekavian]=Лаптоп
|
||||
Name[sr@ijekavianlatin]=Laptop
|
||||
Name[sr@latin]=Laptop
|
||||
Name[sv]=Bärbar dator
|
||||
Name[ta]=மடிக்கணினி
|
||||
Name[te]=లాప్ టాప్
|
||||
Name[tg]=Ноутбук (Лаптор)
|
||||
Name[th]=รูปแบบแล็ปท็อป
|
||||
Name[tr]=Dizüstü
|
||||
Name[ug]=يان كومپيۇتېر
|
||||
Name[uk]=Мобільний комп'ютер (лептоп)
|
||||
Name[uz]=Laptop
|
||||
Name[uz@cyrillic]=Лаптоп
|
||||
Name[vi]=Máy tính xách tay
|
||||
Name[wa]=Poirtåve
|
||||
Name[xh]=Umphezulu osongiweyo
|
||||
Name[x-test]=xxLaptopxx
|
||||
Name[zh_CN]=笔记本电脑
|
||||
Name[zh_TW]=筆記型電腦
|
||||
X-KDE-Library=kwin3_laptop
|
|
@ -1,808 +0,0 @@
|
|||
/********************************************************************
|
||||
Laptop KWin Decoration
|
||||
|
||||
Copyright (c) 2005 Sandro Giessl <sandro@giessl.com>
|
||||
Port of this decoration to KDE 3.2, accessibility enhancement are
|
||||
Copyright (c) 2003 Luciano Montanaro <mikelima@cirulla.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include <kconfig.h> // up here to avoid X11 header conflict :P
|
||||
#include "laptopclient.h"
|
||||
#include <QPixmap>
|
||||
#include <QPaintEvent>
|
||||
#include <QBitmap>
|
||||
#include <QPainter>
|
||||
#include <kglobal.h>
|
||||
#include <KDE/KLocalizedString>
|
||||
|
||||
namespace Laptop {
|
||||
|
||||
static const unsigned char iconify_bits[] = {
|
||||
0xff, 0xff, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18};
|
||||
|
||||
static const unsigned char close_bits[] = {
|
||||
0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42};
|
||||
|
||||
static const unsigned char appmenu_bits[] = {
|
||||
0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff};
|
||||
|
||||
static const unsigned char maximize_bits[] = {
|
||||
0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0xff, 0xff };
|
||||
|
||||
static const unsigned char r_minmax_bits[] = {
|
||||
0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
|
||||
|
||||
static const unsigned char l_minmax_bits[] = {
|
||||
0x30, 0x18, 0xcc, 0xe6, 0xf3, 0xf9, 0xfc, 0xfc};
|
||||
|
||||
static const unsigned char question_bits[] = {
|
||||
0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
|
||||
|
||||
static const unsigned char unsticky_bits[] = {
|
||||
0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c};
|
||||
|
||||
static const unsigned char sticky_bits[] = {
|
||||
0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c};
|
||||
|
||||
static QPixmap *titlePix;
|
||||
static QPixmap *aUpperGradient;
|
||||
static QPixmap *iUpperGradient;
|
||||
// buttons active, inactive, up, down, and 2 sizes :P
|
||||
static QPixmap *btnPix1;
|
||||
static QPixmap *iBtnPix1;
|
||||
static QPixmap *btnDownPix1;
|
||||
static QPixmap *iBtnDownPix1;
|
||||
static QPixmap *btnPix2;
|
||||
static QPixmap *btnDownPix2;
|
||||
static QPixmap *iBtnPix2;
|
||||
static QPixmap *iBtnDownPix2;
|
||||
static QColor btnForeground;
|
||||
|
||||
static int titleHeight = 14;
|
||||
static int btnWidth1 = 17;
|
||||
static int btnWidth2 = 27;
|
||||
|
||||
static int handleSize = 8; // the resize handle size in pixels
|
||||
|
||||
static bool pixmaps_created = false;
|
||||
|
||||
// =====================================
|
||||
|
||||
KWIN_DECORATION(Laptop::LaptopClientFactory)
|
||||
|
||||
|
||||
// =====================================
|
||||
|
||||
static inline const KDecorationOptions* options()
|
||||
{
|
||||
return KDecoration::options();
|
||||
}
|
||||
|
||||
static void gradientFill(QPixmap *pixmap, const QColor &color1, const QColor &color2, bool diagonal = false)
|
||||
{
|
||||
QPainter p(pixmap);
|
||||
QLinearGradient gradient(0, 0, diagonal ? pixmap->width() : 0, pixmap->height());
|
||||
gradient.setColorAt(0.0, color1);
|
||||
gradient.setColorAt(1.0, color2);
|
||||
QBrush brush(gradient);
|
||||
p.fillRect(pixmap->rect(), brush);
|
||||
}
|
||||
|
||||
static void drawButtonFrame(QPixmap *pix, const QPalette &g, bool sunken)
|
||||
{
|
||||
QPainter p;
|
||||
int w = pix->width();
|
||||
int h = pix->height();
|
||||
int x2 = w-1;
|
||||
int y2 = h-1;
|
||||
p.begin(pix);
|
||||
|
||||
if(sunken){
|
||||
qDrawShadePanel(&p, 0, 0, w, h, g, true, 2);
|
||||
}
|
||||
else{
|
||||
p.setPen(g.color(QPalette::Dark ));
|
||||
p.drawRect(0, 0, w-2, h-2);
|
||||
p.setPen(g.color(QPalette::Light));
|
||||
p.drawLine(x2, 0, x2, y2);
|
||||
p.drawLine(0, y2, x2, y2);
|
||||
p.drawLine(1, 1, x2-2, 1);
|
||||
p.drawLine(1, 1, 1, y2-2);
|
||||
p.end();
|
||||
}
|
||||
}
|
||||
|
||||
static void create_pixmaps()
|
||||
{
|
||||
if(pixmaps_created)
|
||||
return;
|
||||
pixmaps_created = true;
|
||||
|
||||
titleHeight = QFontMetrics(options()->font(true)).height();
|
||||
if (titleHeight < handleSize) titleHeight = handleSize;
|
||||
titleHeight &= ~1; // Make title height even
|
||||
if (titleHeight < 14) titleHeight = 14;
|
||||
|
||||
btnWidth1 = titleHeight + 3;
|
||||
btnWidth2 = 3*titleHeight/2 + 6;
|
||||
|
||||
// titlebar
|
||||
QPainter p;
|
||||
QPainter maskPainter;
|
||||
int i, x, y;
|
||||
titlePix = new QPixmap(33, 12);
|
||||
titlePix->fill( Qt::transparent );
|
||||
QBitmap mask(33, 12);
|
||||
mask.fill(Qt::color0);
|
||||
|
||||
p.begin(titlePix);
|
||||
maskPainter.begin(&mask);
|
||||
maskPainter.setPen(Qt::color1);
|
||||
for(i=0, y=2; i < 3; ++i, y+=4){
|
||||
for(x=1; x <= 33; x+=3){
|
||||
p.setPen(options()->color(KDecoration::ColorTitleBar, true).light(150));
|
||||
p.drawPoint(x, y);
|
||||
maskPainter.drawPoint(x, y);
|
||||
p.setPen(options()->color(KDecoration::ColorTitleBar, true).dark(150));
|
||||
p.drawPoint(x+1, y+1);
|
||||
maskPainter.drawPoint(x+1, y+1);
|
||||
}
|
||||
}
|
||||
p.end();
|
||||
maskPainter.end();
|
||||
titlePix->setMask(mask);
|
||||
|
||||
if(QPixmap::defaultDepth() > 8){
|
||||
aUpperGradient = new QPixmap(32, titleHeight+2);
|
||||
iUpperGradient = new QPixmap(32, titleHeight+2);
|
||||
QColor bgColor = options()->color(KDecoration::ColorTitleBar, true);
|
||||
gradientFill(aUpperGradient, bgColor.light(120), bgColor.dark(120));
|
||||
bgColor = options()->color(KDecoration::ColorTitleBar, false);
|
||||
gradientFill(iUpperGradient, bgColor.light(120), bgColor.dark(120));
|
||||
}
|
||||
// buttons (active/inactive, sunken/unsunken, 2 sizes each)
|
||||
QPalette g = options()->palette(KDecoration::ColorButtonBg, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
QColor c = g.color( QPalette::Background );
|
||||
btnPix1 = new QPixmap(btnWidth1, titleHeight);
|
||||
btnDownPix1 = new QPixmap(btnWidth1, titleHeight);
|
||||
btnPix2 = new QPixmap(btnWidth2, titleHeight);
|
||||
btnDownPix2 = new QPixmap(btnWidth2, titleHeight);
|
||||
iBtnPix1 = new QPixmap(btnWidth1, titleHeight);
|
||||
iBtnDownPix1 = new QPixmap(btnWidth1, titleHeight);
|
||||
iBtnPix2 = new QPixmap(btnWidth2, titleHeight);
|
||||
iBtnDownPix2 = new QPixmap(btnWidth2, titleHeight);
|
||||
if(QPixmap::defaultDepth() > 8){
|
||||
gradientFill(btnPix1, c.light(120), c.dark(130), true);
|
||||
gradientFill(btnPix2, c.light(120), c.dark(130), true);
|
||||
gradientFill(btnDownPix1, c.light(120), c.dark(130), true);
|
||||
gradientFill(btnDownPix2, c.light(120), c.dark(130), true);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.color(QPalette::Background);
|
||||
gradientFill(iBtnPix1, c.light(120), c.dark(130), true);
|
||||
gradientFill(iBtnPix2, c.light(120), c.dark(130), true);
|
||||
gradientFill(iBtnDownPix1, c.light(120), c.dark(130), true);
|
||||
gradientFill(iBtnDownPix2, c.light(120), c.dark(130), true);
|
||||
}
|
||||
else{
|
||||
btnPix1->fill(c.rgb());
|
||||
btnDownPix1->fill(c.rgb());
|
||||
btnPix2->fill(c.rgb());
|
||||
btnDownPix2->fill(c.rgb());
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background().color();
|
||||
iBtnPix1->fill(c.rgb());
|
||||
iBtnDownPix1->fill(c.rgb());
|
||||
iBtnPix2->fill(c.rgb());
|
||||
iBtnDownPix2->fill(c.rgb());
|
||||
}
|
||||
g = options()->palette(KDecoration::ColorButtonBg, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background().color();
|
||||
drawButtonFrame(btnPix1, g, false);
|
||||
drawButtonFrame(btnDownPix1, g, true);
|
||||
drawButtonFrame(btnPix2, g, false);
|
||||
drawButtonFrame(btnDownPix2, g, true);
|
||||
g = options()->palette(KDecoration::ColorButtonBg, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
c = g.background().color();
|
||||
drawButtonFrame(iBtnPix1, g, false);
|
||||
drawButtonFrame(iBtnDownPix1, g, true);
|
||||
drawButtonFrame(iBtnPix2, g, false);
|
||||
drawButtonFrame(iBtnDownPix2, g, true);
|
||||
|
||||
if(qGray(options()->color(KDecoration::ColorButtonBg, true).rgb()) > 128)
|
||||
btnForeground = Qt::black;
|
||||
else
|
||||
btnForeground = Qt::white;
|
||||
}
|
||||
|
||||
static void delete_pixmaps()
|
||||
{
|
||||
delete titlePix;
|
||||
if(aUpperGradient){
|
||||
delete aUpperGradient;
|
||||
delete iUpperGradient;
|
||||
delete btnPix1;
|
||||
delete btnDownPix1;
|
||||
delete iBtnPix1;
|
||||
delete iBtnDownPix1;
|
||||
delete btnPix2;
|
||||
delete btnDownPix2;
|
||||
delete iBtnPix2;
|
||||
delete iBtnDownPix2;
|
||||
}
|
||||
pixmaps_created = false;
|
||||
}
|
||||
|
||||
// =====================================
|
||||
|
||||
LaptopButton::LaptopButton(ButtonType type, LaptopClient *parent, const char *name)
|
||||
: KCommonDecorationButton(type, parent)
|
||||
{
|
||||
Q_UNUSED( name );
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
|
||||
void LaptopButton::reset(unsigned long changed)
|
||||
{
|
||||
if (changed&DecorationReset || changed&ManualReset || changed&SizeChange || changed&StateChange) {
|
||||
switch (type() ) {
|
||||
case CloseButton:
|
||||
setBitmap(close_bits);
|
||||
break;
|
||||
case AppMenuButton:
|
||||
setBitmap(appmenu_bits);
|
||||
break;
|
||||
case HelpButton:
|
||||
setBitmap(question_bits);
|
||||
break;
|
||||
case MinButton:
|
||||
setBitmap(iconify_bits);
|
||||
break;
|
||||
case MaxButton:
|
||||
if (isChecked() ) {
|
||||
setBitmap(isLeft() ? l_minmax_bits : r_minmax_bits);
|
||||
} else {
|
||||
setBitmap(maximize_bits);
|
||||
}
|
||||
break;
|
||||
case OnAllDesktopsButton:
|
||||
setBitmap( isChecked() ? unsticky_bits : sticky_bits );
|
||||
break;
|
||||
default:
|
||||
setBitmap(0);
|
||||
break;
|
||||
}
|
||||
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void LaptopButton::setBitmap(const unsigned char *bitmap)
|
||||
{
|
||||
if (bitmap)
|
||||
deco = QBitmap::fromData( QSize(8, 8), bitmap);
|
||||
else {
|
||||
deco = QBitmap(8,8);
|
||||
deco.fill(Qt::color0);
|
||||
}
|
||||
deco.setMask(deco);
|
||||
repaint();
|
||||
}
|
||||
|
||||
void LaptopButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
void LaptopButton::drawButton(QPainter *p)
|
||||
{
|
||||
bool smallBtn = width() == btnWidth1;
|
||||
if(btnPix1){
|
||||
if(decoration()->isActive()){
|
||||
if(isDown())
|
||||
p->drawPixmap(0, 0, smallBtn ? *btnDownPix1 : *btnDownPix2);
|
||||
else
|
||||
p->drawPixmap(0, 0, smallBtn ? *btnPix1 : *btnPix2);
|
||||
}
|
||||
else{
|
||||
if(isDown())
|
||||
p->drawPixmap(0, 0, smallBtn ? *iBtnDownPix1 : *iBtnDownPix2);
|
||||
else
|
||||
p->drawPixmap(0, 0, smallBtn ? *iBtnPix1 : *iBtnPix2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
QPalette g = options()->palette(KDecoration::ColorButtonBg, decoration()->isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
int w = width();
|
||||
int h = height();
|
||||
p->fillRect(1, 1, w-2, h-2, isDown() ? g.color(QPalette::Mid) : g.color(QPalette::Button) );
|
||||
p->setPen(isDown() ? g.color( QPalette::Dark ) : g.color( QPalette::Light ));
|
||||
p->drawLine(0, 0, w-1, 0);
|
||||
p->drawLine(0, 0, 0, w-1);
|
||||
p->setPen(isDown() ? g.color( QPalette::Light ) : g.color( QPalette::Dark ));
|
||||
p->drawLine(w-1, 0, w-1, h-1);
|
||||
p->drawLine(0, h-1, w-1, h-1);
|
||||
}
|
||||
|
||||
QPainterPath path;
|
||||
path.addRegion( deco );
|
||||
|
||||
QPoint offset( (width()-8)/2, (height()-8)/2 );
|
||||
if( isDown() ) offset += QPoint( 1, 1 );
|
||||
p->translate( offset );
|
||||
p->setPen( Qt::NoPen );
|
||||
p->setBrush( btnForeground );
|
||||
p->drawPath( path );
|
||||
|
||||
}
|
||||
|
||||
// =====================================
|
||||
|
||||
void LaptopClient::reset(unsigned long changed)
|
||||
{
|
||||
KCommonDecoration::reset(changed);
|
||||
}
|
||||
|
||||
LaptopClient::LaptopClient(KDecorationBridge *b, KDecorationFactory *f)
|
||||
: KCommonDecoration(b, f)
|
||||
{
|
||||
}
|
||||
|
||||
LaptopClient::~LaptopClient()
|
||||
{
|
||||
}
|
||||
|
||||
QString LaptopClient::visibleName() const
|
||||
{
|
||||
return i18n("Laptop");
|
||||
}
|
||||
|
||||
QString LaptopClient::defaultButtonsLeft() const
|
||||
{
|
||||
return "X";
|
||||
}
|
||||
|
||||
QString LaptopClient::defaultButtonsRight() const
|
||||
{
|
||||
return "HSIA";
|
||||
}
|
||||
|
||||
bool LaptopClient::decorationBehaviour(DecorationBehaviour behaviour) const
|
||||
{
|
||||
switch (behaviour) {
|
||||
case DB_MenuClose:
|
||||
return false;
|
||||
|
||||
case DB_WindowMask:
|
||||
return true;
|
||||
|
||||
case DB_ButtonHide:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return KCommonDecoration::decorationBehaviour(behaviour);
|
||||
}
|
||||
}
|
||||
|
||||
int LaptopClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
|
||||
{
|
||||
switch (lm) {
|
||||
case LM_TitleEdgeLeft:
|
||||
case LM_TitleEdgeRight:
|
||||
case LM_BorderLeft:
|
||||
case LM_BorderRight:
|
||||
return (maximizeMode() & MaximizeHorizontal) ? 0 : 4;
|
||||
|
||||
case LM_BorderBottom:
|
||||
return (maximizeMode() & MaximizeVertical) ? 0 : (isResizable() ? handleSize : 4);
|
||||
|
||||
case LM_TitleEdgeTop:
|
||||
return (maximizeMode() & MaximizeVertical) ? 0 : 3;
|
||||
|
||||
case LM_TitleEdgeBottom:
|
||||
return 1;
|
||||
|
||||
case LM_TitleBorderLeft:
|
||||
case LM_TitleBorderRight:
|
||||
return 0;
|
||||
|
||||
case LM_ButtonWidth:
|
||||
{
|
||||
if (btn && (btn->type()==HelpButton||btn->type()==OnAllDesktopsButton) ) {
|
||||
return btnWidth1;
|
||||
} else {
|
||||
return btnWidth2;
|
||||
}
|
||||
}
|
||||
|
||||
case LM_ButtonHeight:
|
||||
case LM_TitleHeight:
|
||||
if (isToolWindow() )
|
||||
return titleHeight-2;
|
||||
else
|
||||
return titleHeight;
|
||||
|
||||
case LM_ButtonSpacing:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
|
||||
}
|
||||
}
|
||||
|
||||
KCommonDecorationButton *LaptopClient::createButton(ButtonType type)
|
||||
{
|
||||
switch (type) {
|
||||
case OnAllDesktopsButton:
|
||||
return new LaptopButton(OnAllDesktopsButton, this, "on_all_desktops");
|
||||
|
||||
case HelpButton:
|
||||
return new LaptopButton(HelpButton, this, "help");
|
||||
|
||||
case MinButton:
|
||||
return new LaptopButton(MinButton, this, "minimize");
|
||||
|
||||
case MaxButton:
|
||||
return new LaptopButton(MaxButton, this, "maximize");
|
||||
|
||||
case CloseButton:
|
||||
return new LaptopButton(CloseButton, this, "close");
|
||||
|
||||
case AppMenuButton:
|
||||
return new LaptopButton(AppMenuButton, this, "Application Menu");
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LaptopClient::init()
|
||||
{
|
||||
bufferDirty = true;
|
||||
|
||||
KCommonDecoration::init();
|
||||
}
|
||||
|
||||
void LaptopClient::captionChange()
|
||||
{
|
||||
bufferDirty = true;
|
||||
|
||||
KCommonDecoration::captionChange();
|
||||
}
|
||||
|
||||
void LaptopClient::paintEvent( QPaintEvent* )
|
||||
{
|
||||
QPainter p(widget());
|
||||
QPalette g = options()->palette(KDecoration::ColorFrame, isActive());
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
|
||||
const int borderBottom = layoutMetric(LM_BorderBottom);
|
||||
const int borderLeft = layoutMetric(LM_BorderLeft);
|
||||
const int titleEdgeTop = layoutMetric(LM_TitleEdgeTop);
|
||||
|
||||
QRect r(widget()->rect());
|
||||
|
||||
// fill mid frame...
|
||||
p.setPen(g.background().color());
|
||||
p.drawRect(r.adjusted(0,0,-1,-1));
|
||||
p.drawLine(r.x()+2, r.y()+2, r.right()-2, r.y()+2);
|
||||
const int boff = borderBottom ? borderBottom - 1 : 1;
|
||||
p.drawLine(r.left()+2, r.y()+3, r.left()+2, r.bottom() - boff);
|
||||
p.drawLine(r.right()-2, r.y()+3, r.right()-2, r.bottom() - boff);
|
||||
p.drawLine(r.left()+3, r.y()+3, r.left()+3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
||||
p.drawLine(r.right()-3, r.y()+3, r.right()-3, r.y()+layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeTop) );
|
||||
if (borderBottom)
|
||||
p.drawLine(r.left()+1, r.bottom()-2, r.right()-1, r.bottom()-2);
|
||||
|
||||
// outer frame
|
||||
if (borderBottom)
|
||||
p.setPen(g.color(QPalette::Light));
|
||||
p.drawLine(r.x()+1, r.y()+1, r.right()-1, r.y()+1);
|
||||
p.drawLine(r.x()+1, r.y()+1, r.x()+1, r.bottom()-1);
|
||||
if (borderBottom)
|
||||
p.setPen(g.dark().color());
|
||||
p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1);
|
||||
p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1);
|
||||
|
||||
int th = titleHeight;
|
||||
int bb = handleSize + 2; // Bottom border
|
||||
int bs = handleSize - 2; // inner size of bottom border
|
||||
int tb = layoutMetric(LM_TitleEdgeTop, false, NULL); // top border
|
||||
int sb = layoutMetric(LM_BorderRight, false, NULL) - 1; // side border
|
||||
if (!mustDrawHandle()) {
|
||||
bb = borderBottom + 2;
|
||||
bs = 0;
|
||||
}
|
||||
if ( isToolWindow() )
|
||||
th -= 2;
|
||||
|
||||
// inner rect
|
||||
p.drawRect(r.x() + sb, r.y() + th + tb, r.width() - (2*sb + 1), r.height() - (th + bb + 1));
|
||||
|
||||
p.setPen(Qt::black);
|
||||
if (titleEdgeTop)
|
||||
p.drawLine(r.topLeft(), r.topRight());
|
||||
if (borderBottom)
|
||||
p.drawLine(r.bottomLeft(), r.bottomRight());
|
||||
if (borderLeft) {
|
||||
p.drawLine(r.topLeft(), r.bottomLeft());
|
||||
p.drawLine(r.topRight(), r.bottomRight());
|
||||
}
|
||||
|
||||
// handles
|
||||
if (mustDrawHandle()) {
|
||||
if (r.width() > 3*handleSize + 20) {
|
||||
int range = 8 + 3*handleSize/2;
|
||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs, range,
|
||||
handleSize - 2, g, false, 1, &g.brush(QPalette::Mid));
|
||||
qDrawShadePanel(&p, r.x() + range + 1, r.bottom() - bs,
|
||||
r.width() - 2*range - 2, handleSize - 2, g, false, 1,
|
||||
isActive() ? &g.brush(QPalette::Background) : &g.brush(QPalette::Mid));
|
||||
qDrawShadePanel(&p, r.right() - range, r.bottom() - bs,
|
||||
range, bs, g, false, 1, &g.brush(QPalette::Mid));
|
||||
} else {
|
||||
qDrawShadePanel(&p, r.x() + 1, r.bottom() - bs,
|
||||
r.width() - 2, bs, g, false, 1,
|
||||
isActive() ? &g.brush(QPalette::Background) : &g.brush(QPalette::Mid));
|
||||
}
|
||||
}
|
||||
|
||||
r = titleRect();
|
||||
|
||||
if(isActive()){
|
||||
updateActiveBuffer();
|
||||
p.drawPixmap(r.x(), r.y(), activeBuffer);
|
||||
p.setPen(g.background().color());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
p.drawLine(r.right()+1, r.y(), r.right()+1, r.bottom());
|
||||
}
|
||||
else{
|
||||
if(iUpperGradient)
|
||||
p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1,
|
||||
*iUpperGradient);
|
||||
else
|
||||
p.fillRect(r.x(), r.y(), r.width(), r.height()-1,
|
||||
options()->color(KDecoration::ColorTitleBar, false));
|
||||
|
||||
p.setFont(options()->font(false, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(false));
|
||||
g = options()->palette(KDecoration::ColorTitleBar, false);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
if(iUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
*iUpperGradient);
|
||||
else
|
||||
p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, r.y(),
|
||||
fm.width(caption())+8, r.height()-1,
|
||||
g.brush(QPalette::Background));
|
||||
p.setPen(g.mid().color());
|
||||
p.drawLine(r.x(), r.y(), r.right(), r.y());
|
||||
p.drawLine(r.x(), r.y(), r.x(), r.bottom());
|
||||
p.setPen(g.color(QPalette::Button));
|
||||
p.drawLine(r.right(), r.y(), r.right(), r.bottom());
|
||||
p.drawLine(r.x(), r.bottom(), r.right(), r.bottom());
|
||||
p.setPen(options()->color(KDecoration::ColorFont, false));
|
||||
p.drawText(r.x(), r.y()+1, r.width(), r.height()-1,
|
||||
Qt::AlignCenter, caption() );
|
||||
g = options()->palette(KDecoration::ColorFrame, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
p.setPen(g.background().color());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
p.drawLine(r.right()+1, r.y(), r.right()+1, r.bottom());
|
||||
}
|
||||
}
|
||||
|
||||
QRegion LaptopClient::cornerShape(WindowCorner corner)
|
||||
{
|
||||
switch (corner) {
|
||||
case WC_TopLeft:
|
||||
return QRect(0, 0, 1, 1);
|
||||
|
||||
case WC_TopRight:
|
||||
return QRect(width()-1, 0, 1, 1);
|
||||
|
||||
case WC_BottomLeft:
|
||||
return QRect(0, height()-1, 1, 1);
|
||||
|
||||
case WC_BottomRight:
|
||||
return QRect(width()-1, height()-1, 1, 1);
|
||||
|
||||
default:
|
||||
return QRegion();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool LaptopClient::mustDrawHandle() const
|
||||
{
|
||||
return isResizable() && !(maximizeMode() & MaximizeVertical);
|
||||
}
|
||||
|
||||
void LaptopClient::updateActiveBuffer( )
|
||||
{
|
||||
QRect rTitle = titleRect();
|
||||
if( !bufferDirty && (lastBufferWidth == rTitle.width()))
|
||||
return;
|
||||
if ( rTitle.width() <= 0 || rTitle.height() <= 0 )
|
||||
return;
|
||||
lastBufferWidth = rTitle.width();
|
||||
bufferDirty = false;
|
||||
|
||||
activeBuffer = QPixmap(rTitle.width(), rTitle.height());
|
||||
QPainter p;
|
||||
QRect r(0, 0, activeBuffer.width(), activeBuffer.height());
|
||||
p.begin(&activeBuffer);
|
||||
if(aUpperGradient){
|
||||
p.drawTiledPixmap(r, *aUpperGradient);
|
||||
}
|
||||
else{
|
||||
p.fillRect(r, options()->color(KDecoration::ColorTitleBar, true));
|
||||
}
|
||||
if(titlePix)
|
||||
p.drawTiledPixmap(r, *titlePix);
|
||||
|
||||
p.setFont(options()->font(true, isToolWindow() ));
|
||||
QFontMetrics fm(options()->font(true));
|
||||
QPalette g = options()->palette(KDecoration::ColorTitleBar, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
if(aUpperGradient)
|
||||
p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4,
|
||||
r.y(), fm.width(caption())+8, r.height()-1,
|
||||
*aUpperGradient);
|
||||
else
|
||||
p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, 0,
|
||||
fm.width(caption())+8, r.height(),
|
||||
g.brush(QPalette::Background));
|
||||
p.setPen(g.mid().color());
|
||||
p.drawLine(r.x(), r.y(), r.right(), r.y());
|
||||
p.drawLine(r.x(), r.y(), r.x(), r.bottom());
|
||||
p.setPen(g.color(QPalette::Button));
|
||||
p.drawLine(r.right(), r.y(), r.right(), r.bottom());
|
||||
p.drawLine(r.x(), r.bottom(), r.right(), r.bottom());
|
||||
p.setPen(options()->color(KDecoration::ColorFont, true));
|
||||
p.drawText(r.x(), r.y()+1, r.width(), r.height()-1,
|
||||
Qt::AlignCenter, caption() );
|
||||
g = options()->palette(KDecoration::ColorFrame, true);
|
||||
g.setCurrentColorGroup( QPalette::Active );
|
||||
p.setPen(g.background().color());
|
||||
p.drawPoint(r.x(), r.y());
|
||||
p.drawPoint(r.right(), r.y());
|
||||
p.drawLine(r.right()+1, r.y(), r.right()+1, r.bottom());
|
||||
p.end();
|
||||
}
|
||||
|
||||
static const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask |
|
||||
NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask |
|
||||
NET::DialogMask | /*NET::OverrideMask |*/ NET::TopMenuMask |
|
||||
NET::UtilityMask | NET::SplashMask;
|
||||
|
||||
bool LaptopClient::isTransient() const
|
||||
{
|
||||
NET::WindowType type = windowType(SUPPORTED_WINDOW_TYPES_MASK);
|
||||
return type == NET::Dialog;
|
||||
}
|
||||
|
||||
// =====================================
|
||||
|
||||
LaptopClientFactory::LaptopClientFactory()
|
||||
{
|
||||
create_pixmaps();
|
||||
}
|
||||
|
||||
LaptopClientFactory::~LaptopClientFactory()
|
||||
{
|
||||
delete_pixmaps();
|
||||
}
|
||||
|
||||
KDecoration *LaptopClientFactory::createDecoration(KDecorationBridge *b)
|
||||
{
|
||||
findPreferredHandleSize();
|
||||
return (new Laptop::LaptopClient(b, this))->decoration();
|
||||
}
|
||||
|
||||
bool LaptopClientFactory::reset(unsigned long changed)
|
||||
{
|
||||
findPreferredHandleSize();
|
||||
|
||||
// TODO Do not recreate decorations if it is not needed. Look at
|
||||
// ModernSystem for how to do that
|
||||
Laptop::delete_pixmaps();
|
||||
Laptop::create_pixmaps();
|
||||
|
||||
bool needHardReset = true;
|
||||
if ((changed & ~SettingButtons) == 0) {
|
||||
// handled by KCommonDecoration
|
||||
needHardReset = false;
|
||||
}
|
||||
|
||||
if (needHardReset) {
|
||||
return true;
|
||||
} else {
|
||||
resetDecorations(changed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool LaptopClientFactory::supports( Ability ability ) const
|
||||
{
|
||||
switch( ability )
|
||||
{
|
||||
// announce
|
||||
case AbilityAnnounceButtons:
|
||||
case AbilityAnnounceColors:
|
||||
// buttons
|
||||
case AbilityButtonOnAllDesktops:
|
||||
case AbilityButtonHelp:
|
||||
case AbilityButtonMinimize:
|
||||
case AbilityButtonMaximize:
|
||||
case AbilityButtonClose:
|
||||
case AbilityButtonSpacer:
|
||||
case AbilityButtonApplicationMenu:
|
||||
// colors
|
||||
case AbilityColorTitleBack:
|
||||
case AbilityColorTitleFore:
|
||||
case AbilityColorButtonBack:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
QList< LaptopClientFactory::BorderSize >
|
||||
LaptopClientFactory::borderSizes() const
|
||||
{
|
||||
// the list must be sorted
|
||||
return QList< BorderSize >() << BorderNormal << BorderLarge <<
|
||||
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
|
||||
}
|
||||
|
||||
void LaptopClientFactory::findPreferredHandleSize()
|
||||
{
|
||||
switch (options()->preferredBorderSize(this)) {
|
||||
case KDecoration::BorderLarge:
|
||||
handleSize = 11;
|
||||
break;
|
||||
case KDecoration::BorderVeryLarge:
|
||||
handleSize = 16;
|
||||
break;
|
||||
case KDecoration::BorderHuge:
|
||||
handleSize = 24;
|
||||
break;
|
||||
case KDecoration::BorderVeryHuge:
|
||||
handleSize = 32;
|
||||
break;
|
||||
case KDecoration::BorderOversized:
|
||||
handleSize = 40;
|
||||
break;
|
||||
case KDecoration::BorderTiny:
|
||||
case KDecoration::BorderNormal:
|
||||
default:
|
||||
handleSize = 8;
|
||||
}
|
||||
}
|
||||
|
||||
} // Laptop namespace
|
||||
|
||||
// vim: sw=4
|
|
@ -1,93 +0,0 @@
|
|||
/********************************************************************
|
||||
Laptop KWin Client
|
||||
|
||||
Copyright (c) 2005 Sandro Giessl <sandro@giessl.com>
|
||||
Ported to the kde3.2 API by Luciano Montanaro <mikelima@cirulla.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef LAPTOPCLIENT_H
|
||||
#define LAPTOPCLIENT_H
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QPixmap>
|
||||
#include <kcommondecoration.h>
|
||||
#include <kdecorationfactory.h>
|
||||
|
||||
namespace Laptop {
|
||||
|
||||
class LaptopClient;
|
||||
|
||||
class LaptopButton : public KCommonDecorationButton
|
||||
{
|
||||
public:
|
||||
LaptopButton(ButtonType type, LaptopClient *parent, const char *name);
|
||||
void setBitmap(const unsigned char *bitmap);
|
||||
virtual void reset(unsigned long changed);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
virtual void drawButton(QPainter *p);
|
||||
QBitmap deco;
|
||||
};
|
||||
|
||||
class LaptopClient : public KCommonDecoration
|
||||
{
|
||||
public:
|
||||
LaptopClient( KDecorationBridge* b, KDecorationFactory* f );
|
||||
~LaptopClient();
|
||||
|
||||
virtual QString visibleName() const;
|
||||
virtual QString defaultButtonsLeft() const;
|
||||
virtual QString defaultButtonsRight() const;
|
||||
virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
|
||||
virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
|
||||
virtual KCommonDecorationButton *createButton(ButtonType type);
|
||||
|
||||
virtual QRegion cornerShape(WindowCorner corner);
|
||||
|
||||
void init();
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* );
|
||||
void reset( unsigned long );
|
||||
void updateActiveBuffer();
|
||||
void captionChange();
|
||||
private:
|
||||
bool mustDrawHandle() const;
|
||||
bool isTransient() const;
|
||||
private:
|
||||
QPixmap activeBuffer;
|
||||
int lastBufferWidth;
|
||||
bool bufferDirty;
|
||||
};
|
||||
|
||||
class LaptopClientFactory : public QObject, public KDecorationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LaptopClientFactory();
|
||||
virtual ~LaptopClientFactory();
|
||||
virtual KDecoration* createDecoration( KDecorationBridge* );
|
||||
virtual bool reset( unsigned long changed );
|
||||
virtual bool supports( Ability ability ) const;
|
||||
virtual QList< BorderSize > borderSizes() const;
|
||||
private:
|
||||
void findPreferredHandleSize();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // LAPTOPCLIENT_H
|
Loading…
Reference in New Issue