- Ported to the new style API, hope everything is ok.
- Respect KWins' border size suggestion. svn path=/trunk/kdebase/kwin/; revision=252139icc-effect-5.14.5
parent
f8be2d6f8d
commit
d82cbed7c0
|
@ -1,7 +1,7 @@
|
|||
INCLUDES = -I$(top_srcdir) $(all_includes)
|
||||
kde_module_LTLIBRARIES = kwin_web.la
|
||||
kde_module_LTLIBRARIES = kwin3_web.la
|
||||
|
||||
kwin_web_la_SOURCES = \
|
||||
kwin3_web_la_SOURCES = \
|
||||
Web.cpp \
|
||||
WebButton.cpp \
|
||||
WebButtonClose.cpp \
|
||||
|
@ -21,8 +21,8 @@ noinst_HEADERS = \
|
|||
WebButtonMaximize.h \
|
||||
WebButtonSticky.h
|
||||
|
||||
#kwin_web_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
|
||||
kwin_web_la_LDFLAGS = $(all_libraries) -avoid-version -module $(KDE_RPATH) $(KDE_MT_LDFLAGS)
|
||||
kwin3_web_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
|
||||
kwin3_web_la_LIBADD = $(LIB_KDEUI) ../../lib/libkdecorations.la
|
||||
METASOURCES = AUTO
|
||||
|
||||
linkdir = $(kde_datadir)/kwin/
|
||||
|
|
|
@ -19,73 +19,37 @@
|
|||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h> // for usleep
|
||||
#include <math.h>
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpainter.h>
|
||||
|
||||
#include <kwin/workspace.h>
|
||||
#include <netwm.h>
|
||||
#undef Bool
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kwin/options.h>
|
||||
|
||||
#include "Web.h"
|
||||
#include "WebButton.h"
|
||||
#include "WebButtonHelp.h"
|
||||
#include "WebButtonIconify.h"
|
||||
#include "WebButtonIconify.h" // minimize button
|
||||
#include "WebButtonClose.h"
|
||||
#include "WebButtonSticky.h"
|
||||
#include "WebButtonSticky.h" // onAllDesktops button
|
||||
#include "WebButtonMaximize.h"
|
||||
#include "WebButtonLower.h"
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
Client * allocate(Workspace * ws, WId w, int tool)
|
||||
KDecorationFactory *create_factory()
|
||||
{
|
||||
return new Web::WebClient(ws, w, tool != 0);
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
// Empty.
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
Workspace::self()->slotResetAllClientsDelayed();
|
||||
// Empty.
|
||||
}
|
||||
|
||||
void deinit()
|
||||
{
|
||||
// Empty.
|
||||
return new Web::WebFactory();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Web {
|
||||
|
||||
WebClient::WebClient(Workspace * ws, WId w, bool tool, QWidget * parent, const char * name)
|
||||
: Client (ws, w, parent, name, WResizeNoErase),
|
||||
tool_ (tool),
|
||||
|
||||
WebClient::WebClient(KDecorationBridge* bridge, KDecorationFactory* factory)
|
||||
: KDecoration(bridge, factory),
|
||||
mainLayout_ (0),
|
||||
titleSpacer_ (0)
|
||||
{
|
||||
setBackgroundMode(NoBackground);
|
||||
|
||||
_resetLayout();
|
||||
|
||||
leftButtonList_ .setAutoDelete(true);
|
||||
rightButtonList_ .setAutoDelete(true);
|
||||
|
||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||
// Empty.
|
||||
}
|
||||
|
||||
WebClient::~WebClient()
|
||||
|
@ -94,17 +58,88 @@ WebClient::~WebClient()
|
|||
}
|
||||
|
||||
void
|
||||
WebClient::resizeEvent(QResizeEvent * e)
|
||||
WebClient::init()
|
||||
{
|
||||
Client::resizeEvent(e);
|
||||
doShape();
|
||||
repaint();
|
||||
createMainWidget(WNoAutoErase);
|
||||
widget()->installEventFilter( this );
|
||||
widget()->setBackgroundMode(NoBackground);
|
||||
|
||||
// title height
|
||||
const uint textVMargin = 2;
|
||||
QFontMetrics fm(options()->font(isActive(), isTool()));
|
||||
titleHeight_ = QMAX(14, fm.height() + textVMargin * 2);
|
||||
|
||||
// border size
|
||||
switch(options()->preferredBorderSize()) {
|
||||
case BorderLarge:
|
||||
borderSize_ = 8;
|
||||
break;
|
||||
case BorderVeryLarge:
|
||||
borderSize_ = 12;
|
||||
break;
|
||||
case BorderHuge:
|
||||
borderSize_ = 16;
|
||||
break;
|
||||
case BorderTiny:
|
||||
case BorderNormal:
|
||||
default:
|
||||
borderSize_ = 4;
|
||||
}
|
||||
|
||||
_resetLayout();
|
||||
|
||||
leftButtonList_ .setAutoDelete(true);
|
||||
rightButtonList_ .setAutoDelete(true);
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::captionChange(const QString &)
|
||||
WebClient::reset( unsigned long changed )
|
||||
{
|
||||
repaint();
|
||||
if (changed & SettingColors)
|
||||
{
|
||||
// repaint the whole thing
|
||||
widget()->repaint(false);
|
||||
} else if (changed & SettingFont) {
|
||||
// font has changed -- update title height
|
||||
// title height
|
||||
const uint textVMargin = 2;
|
||||
QFontMetrics fm(options()->font(isActive(), isTool()));
|
||||
titleHeight_ = QMAX(14, fm.height() + textVMargin * 2);
|
||||
// update buttons
|
||||
for (QPtrListIterator<WebButton> it(leftButtonList_); it.current(); ++it)
|
||||
{
|
||||
it.current()->setFixedSize(titleHeight_, titleHeight_);
|
||||
}
|
||||
for (QPtrListIterator<WebButton> it(rightButtonList_); it.current(); ++it)
|
||||
{
|
||||
it.current()->setFixedSize(titleHeight_, titleHeight_);
|
||||
}
|
||||
// for (int n=0; n<NumButtons; n++) {
|
||||
// if (m_button[n]) m_button[n]->setSize(s_titleHeight-1);
|
||||
// }
|
||||
// update the spacer
|
||||
titleSpacer_->changeSize(0, titleHeight_, QSizePolicy::Expanding,
|
||||
QSizePolicy::Fixed);
|
||||
widget()->repaint(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
doShape();
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::captionChange()
|
||||
{
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
void WebClient::iconChange()
|
||||
{
|
||||
// Empty.
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -113,18 +148,18 @@ WebClient::paintEvent(QPaintEvent * pe)
|
|||
QRect titleRect(titleSpacer_->geometry());
|
||||
titleRect.setTop(1);
|
||||
|
||||
QPainter p(this);
|
||||
QPainter p(widget());
|
||||
|
||||
p.setPen(Qt::black);
|
||||
p.setBrush(colorGroup().background());
|
||||
p.setBrush(options()->colorGroup(ColorFrame, isActive()).background());
|
||||
|
||||
p.setClipRegion(pe->region() - titleRect);
|
||||
|
||||
p.drawRect(rect());
|
||||
p.drawRect(widget()->rect());
|
||||
|
||||
p.setClipRegion(pe->region());
|
||||
|
||||
p.fillRect(titleRect, options->color(Options::TitleBar, isActive()));
|
||||
p.fillRect(titleRect, options()->color(ColorTitleBar, isActive()));
|
||||
|
||||
if (shape_)
|
||||
{
|
||||
|
@ -164,9 +199,9 @@ WebClient::paintEvent(QPaintEvent * pe)
|
|||
p.drawPoint(r - 5, b - 2);
|
||||
}
|
||||
|
||||
p.setFont(options->font(isActive(), tool_));
|
||||
p.setFont(options()->font(isActive(), isTool()));
|
||||
|
||||
p.setPen(options->color(Options::Font, isActive()));
|
||||
p.setPen(options()->color(ColorFont, isActive()));
|
||||
|
||||
p.drawText(titleSpacer_->geometry(), AlignCenter, caption());
|
||||
}
|
||||
|
@ -217,14 +252,14 @@ WebClient::doShape()
|
|||
WebClient::showEvent(QShowEvent *)
|
||||
{
|
||||
doShape();
|
||||
repaint();
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::windowWrapperShowEvent(QShowEvent *)
|
||||
{
|
||||
doShape();
|
||||
repaint();
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -232,30 +267,29 @@ WebClient::mouseDoubleClickEvent(QMouseEvent * e)
|
|||
{
|
||||
if (titleSpacer_->geometry().contains(e->pos()))
|
||||
{
|
||||
workspace()
|
||||
->performWindowOperation(this, options->operationTitlebarDblClick());
|
||||
titlebarDblClickOperation();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::stickyChange(bool b)
|
||||
WebClient::desktopChange()
|
||||
{
|
||||
emit(stkyChange(b));
|
||||
emit(oadChange(isOnAllDesktops()));
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::maximizeChange(bool b)
|
||||
WebClient::maximizeChange()
|
||||
{
|
||||
emit(maxChange(b));
|
||||
emit(maxChange(maximizeMode()==MaximizeFull));
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::activeChange(bool)
|
||||
WebClient::activeChange()
|
||||
{
|
||||
repaint();
|
||||
widget()->repaint();
|
||||
}
|
||||
|
||||
Client::MousePosition
|
||||
WebClient::MousePosition
|
||||
WebClient::mousePosition(const QPoint & p) const
|
||||
{
|
||||
int x = p.x();
|
||||
|
@ -274,37 +308,30 @@ WebClient::mousePosition(const QPoint & p) const
|
|||
return Client::Top;
|
||||
else
|
||||
#endif
|
||||
return Client::Center;
|
||||
return KDecoration::Center;
|
||||
}
|
||||
else if (y < height() - 4)
|
||||
else if (y < height() - borderSize_)
|
||||
{
|
||||
if (x < 4)
|
||||
return Client::Left;
|
||||
if (x < borderSize_)
|
||||
return KDecoration::Left;
|
||||
else
|
||||
if (x > width() - 4)
|
||||
return Client::Right;
|
||||
if (x > width() - borderSize_)
|
||||
return KDecoration::Right;
|
||||
else
|
||||
return Client::Center;
|
||||
return KDecoration::Center;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < 20)
|
||||
return Client::BottomLeft;
|
||||
return KDecoration::BottomLeft2;
|
||||
else
|
||||
if (x > width() - 20)
|
||||
return Client::BottomRight;
|
||||
return KDecoration::BottomRight2;
|
||||
else
|
||||
return Client::Bottom;
|
||||
return KDecoration::Bottom;
|
||||
}
|
||||
|
||||
return Client::mousePosition(p);
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::slotReset()
|
||||
{
|
||||
_resetLayout();
|
||||
repaint();
|
||||
return KDecoration::mousePosition(p);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -313,16 +340,16 @@ WebClient::slotMaximize(int button)
|
|||
switch (button)
|
||||
{
|
||||
case MidButton:
|
||||
maximize(MaximizeVertical);
|
||||
maximize(maximizeMode() ^ MaximizeVertical);
|
||||
break;
|
||||
|
||||
case RightButton:
|
||||
maximize(MaximizeHorizontal);
|
||||
maximize(maximizeMode() ^ MaximizeHorizontal);
|
||||
break;
|
||||
|
||||
case LeftButton:
|
||||
default:
|
||||
maximize(MaximizeFull);
|
||||
maximize(maximizeMode() == MaximizeFull ? MaximizeRestore : MaximizeFull);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,25 +361,25 @@ WebClient::_createButton(const QString & s, QWidget * parent)
|
|||
if (("Help" == s) && providesContextHelp())
|
||||
{
|
||||
b = new WebButtonHelp(parent);
|
||||
connect(b, SIGNAL(help()), this, SLOT(contextHelp()));
|
||||
connect(b, SIGNAL(help()), this, SLOT(showContextHelp()));
|
||||
}
|
||||
|
||||
else if ("Sticky" == s)
|
||||
else if ("OnAllDesktops" == s)
|
||||
{
|
||||
b = new WebButtonSticky(isSticky(), parent);
|
||||
connect(b, SIGNAL(toggleSticky()), this, SLOT(toggleSticky()));
|
||||
connect(this, SIGNAL(stkyChange(bool)), b, SLOT(slotStickyChange(bool)));
|
||||
b = new WebButtonSticky(isOnAllDesktops(), parent);
|
||||
connect(b, SIGNAL(toggleSticky()), this, SLOT(toggleOnAllDesktops()));
|
||||
connect(this, SIGNAL(oadChange(bool)), b, SLOT(slotOnAllDesktopsChange(bool)));
|
||||
}
|
||||
|
||||
else if ("Iconify" == s && isMinimizable())
|
||||
else if ("Minimize" == s && isMinimizable())
|
||||
{
|
||||
b = new WebButtonIconify(parent);
|
||||
connect(b, SIGNAL(iconify()), this, SLOT(iconify()));
|
||||
connect(b, SIGNAL(minimize()), this, SLOT(minimize()));
|
||||
}
|
||||
|
||||
else if ("Maximize" == s && isMaximizable())
|
||||
{
|
||||
b = new WebButtonMaximize(isMaximized(), parent);
|
||||
b = new WebButtonMaximize((maximizeMode()==MaximizeFull), parent);
|
||||
connect(b, SIGNAL(maximize(int)), this, SLOT(slotMaximize(int)));
|
||||
connect(this, SIGNAL(maxChange(bool)), b, SLOT(slotMaximizeChange(bool)));
|
||||
}
|
||||
|
@ -383,31 +410,31 @@ WebClient::_createButtons()
|
|||
leftButtonList_ .clear();
|
||||
rightButtonList_ .clear();
|
||||
|
||||
QString buttons = options->titleButtonsLeft() + "|" + options->titleButtonsRight();
|
||||
QString buttons = options()->titleButtonsLeft() + "|" + options()->titleButtonsRight();
|
||||
QPtrList<WebButton> *buttonList = &leftButtonList_;
|
||||
for (unsigned int i = 0; i < buttons.length(); ++i)
|
||||
{
|
||||
WebButton * tb = 0;
|
||||
switch (buttons[i].latin1())
|
||||
{
|
||||
case 'S': // Sticky
|
||||
tb = _createButton("Sticky", this);
|
||||
case 'S': // OnAllDesktops
|
||||
tb = _createButton("OnAllDesktops", widget());
|
||||
break;
|
||||
|
||||
case 'H': // Help
|
||||
tb = _createButton("Help", this);
|
||||
tb = _createButton("Help", widget());
|
||||
break;
|
||||
|
||||
case 'I': // Minimize
|
||||
tb = _createButton("Iconify", this);
|
||||
tb = _createButton("Minimize", widget());
|
||||
break;
|
||||
|
||||
case 'A': // Maximize
|
||||
tb = _createButton("Maximize", this);
|
||||
tb = _createButton("Maximize", widget());
|
||||
break;
|
||||
|
||||
case 'X': // Close
|
||||
tb = _createButton("Close", this);
|
||||
tb = _createButton("Close", widget());
|
||||
break;
|
||||
|
||||
case '|':
|
||||
|
@ -428,7 +455,7 @@ WebClient::_createButtons()
|
|||
void
|
||||
WebClient::_resetLayout()
|
||||
{
|
||||
KConfig c(locate("config", "kwinwebrc"));
|
||||
KConfig c("kwinwebrc");
|
||||
c.setGroup("General");
|
||||
shape_ = c.readBoolEntry("Shape", true);
|
||||
|
||||
|
@ -438,29 +465,24 @@ WebClient::_resetLayout()
|
|||
// |__|______________________________|__|
|
||||
// | | | |
|
||||
// | | | |
|
||||
// | | windowWrapper | |
|
||||
// | | fake window | |
|
||||
// | | | | <--- midLayout
|
||||
// | | | |
|
||||
// | | | |
|
||||
// | |________________________________| |
|
||||
// |____________________________________|
|
||||
|
||||
const uint sideMargin = 4;
|
||||
const uint bottomMargin = 4;
|
||||
const uint textVMargin = 2;
|
||||
const uint sideMargin = borderSize_;
|
||||
const uint bottomMargin = borderSize_;
|
||||
|
||||
QFontMetrics fm(options->font(isActive(), tool_));
|
||||
|
||||
uint titleHeight = QMAX(14, fm.height() + textVMargin * 2);
|
||||
|
||||
if (0 != titleHeight % 2)
|
||||
titleHeight += 1;
|
||||
if (0 != titleHeight_ % 2)
|
||||
titleHeight_ += 1;
|
||||
|
||||
delete mainLayout_;
|
||||
|
||||
mainLayout_ = new QVBoxLayout(this, 0, 0);
|
||||
mainLayout_ = new QVBoxLayout(widget(), 0, 0);
|
||||
|
||||
titleSpacer_ = new QSpacerItem ( 0, titleHeight, QSizePolicy::Expanding,
|
||||
titleSpacer_ = new QSpacerItem ( 0, titleHeight_, QSizePolicy::Expanding,
|
||||
QSizePolicy::Fixed);
|
||||
|
||||
QBoxLayout * topLayout = new QBoxLayout(mainLayout_, QBoxLayout::LeftToRight, 0, 0);
|
||||
|
@ -473,7 +495,7 @@ WebClient::_resetLayout()
|
|||
{
|
||||
topLayout->addWidget(it.current(), Qt::AlignVCenter);
|
||||
topLayout->setStretchFactor(it.current(), 0);
|
||||
it.current()->setFixedSize(titleHeight, titleHeight);
|
||||
it.current()->setFixedSize(titleHeight_, titleHeight_);
|
||||
}
|
||||
|
||||
topLayout->addItem(titleSpacer_);
|
||||
|
@ -483,7 +505,7 @@ WebClient::_resetLayout()
|
|||
for (QPtrListIterator<WebButton> it(rightButtonList_); it.current(); ++it)
|
||||
{
|
||||
topLayout->addWidget(it.current(), Qt::AlignVCenter);
|
||||
it.current()->setFixedSize(titleHeight, titleHeight);
|
||||
it.current()->setFixedSize(titleHeight_, titleHeight_);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -491,7 +513,7 @@ WebClient::_resetLayout()
|
|||
QHBoxLayout * midLayout = new QHBoxLayout(mainLayout_, 0, 0);
|
||||
|
||||
midLayout->addSpacing(sideMargin);
|
||||
midLayout->addWidget(windowWrapper());
|
||||
midLayout->addWidget(new QLabel( i18n( "<center><b>Web</b></center>" ), widget())); // fake window
|
||||
midLayout->addSpacing(sideMargin);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -505,10 +527,75 @@ WebClient::_resetLayout()
|
|||
mainLayout_->setStretchFactor(midLayout, 1);
|
||||
}
|
||||
|
||||
void
|
||||
WebClient::animateIconifyOrDeiconify(bool /* iconify */)
|
||||
void WebClient::borders(int& left, int& right, int& top, int& bottom) const
|
||||
{
|
||||
// Nice and simple ;)
|
||||
left = borderSize_;
|
||||
right = borderSize_;
|
||||
top = titleHeight_;
|
||||
bottom = borderSize_;
|
||||
}
|
||||
|
||||
void WebClient::resize( const QSize& s )
|
||||
{
|
||||
widget()->resize( s );
|
||||
}
|
||||
|
||||
QSize WebClient::minimumSize() const
|
||||
{
|
||||
return QSize( 200, 50 );
|
||||
}
|
||||
|
||||
bool WebClient::isTool()
|
||||
{
|
||||
NET::WindowType type = windowType(NET::NormalMask|NET::ToolbarMask|NET::UtilityMask|NET::MenuMask);
|
||||
return ((type==NET::Toolbar)||(type==NET::NET::Utility)||(type==NET::Menu));
|
||||
}
|
||||
|
||||
bool WebClient::eventFilter( QObject* o, QEvent* e )
|
||||
{
|
||||
if( o != widget())
|
||||
return false;
|
||||
switch( e->type())
|
||||
{
|
||||
case QEvent::Resize:
|
||||
resizeEvent(static_cast< QResizeEvent* >( e ) );
|
||||
return true;
|
||||
case QEvent::Paint:
|
||||
paintEvent(static_cast< QPaintEvent* >( e ) );
|
||||
return true;
|
||||
case QEvent::MouseButtonDblClick:
|
||||
mouseDoubleClickEvent(static_cast< QMouseEvent* >( e ) );
|
||||
return true;
|
||||
case QEvent::MouseButtonPress:
|
||||
processMousePressEvent(static_cast< QMouseEvent* >( e ) );
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
KDecoration* WebFactory::createDecoration( KDecorationBridge* b )
|
||||
{
|
||||
return(new WebClient(b, this));
|
||||
}
|
||||
|
||||
bool WebFactory::reset(unsigned long changed)
|
||||
{
|
||||
// Do we need to "hit the wooden hammer" ?
|
||||
bool needHardReset = true;
|
||||
if (changed & SettingColors || changed & SettingFont)
|
||||
{
|
||||
needHardReset = false;
|
||||
}
|
||||
|
||||
if (needHardReset) {
|
||||
return true;
|
||||
} else {
|
||||
resetDecorations(changed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
#include <qptrlist.h>
|
||||
|
||||
#include <kwin/client.h>
|
||||
#include "../../lib/kdecoration.h"
|
||||
#include "../../lib/kdecorationfactory.h"
|
||||
|
||||
class QLabel;
|
||||
class QSpacerItem;
|
||||
|
@ -32,28 +33,24 @@ class QBoxLayout;
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButton;
|
||||
|
||||
class WebClient : public Client
|
||||
class WebClient : public KDecoration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
WebClient
|
||||
(
|
||||
Workspace *,
|
||||
WId,
|
||||
bool tool,
|
||||
QWidget * parent = 0,
|
||||
const char * name = 0
|
||||
);
|
||||
|
||||
WebClient(KDecorationBridge* bridge, KDecorationFactory* factory);
|
||||
~WebClient();
|
||||
|
||||
virtual void init();
|
||||
virtual void resize(const QSize&);
|
||||
virtual bool eventFilter( QObject* o, QEvent* e );
|
||||
|
||||
protected:
|
||||
virtual void reset( unsigned long changed );
|
||||
|
||||
virtual void resizeEvent(QResizeEvent *);
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
@ -61,30 +58,33 @@ namespace Web
|
|||
virtual void mouseDoubleClickEvent(QMouseEvent *);
|
||||
|
||||
virtual void windowWrapperShowEvent(QShowEvent *);
|
||||
virtual void captionChange(const QString &);
|
||||
virtual void stickyChange(bool on);
|
||||
virtual void maximizeChange(bool);
|
||||
virtual void captionChange();
|
||||
virtual void desktopChange();
|
||||
virtual void maximizeChange();
|
||||
virtual void shadeChange() {};
|
||||
virtual void activeChange();
|
||||
virtual void iconChange();
|
||||
virtual void doShape();
|
||||
virtual void activeChange(bool);
|
||||
virtual MousePosition mousePosition(const QPoint &) const;
|
||||
virtual void animateIconifyOrDeiconify(bool);
|
||||
virtual void borders(int&, int&, int&, int&) const;
|
||||
virtual QSize minimumSize() const;
|
||||
|
||||
protected slots:
|
||||
|
||||
void slotReset();
|
||||
void slotMaximize(int button);
|
||||
|
||||
signals:
|
||||
|
||||
void stkyChange(bool);
|
||||
void oadChange(bool);
|
||||
void maxChange(bool);
|
||||
|
||||
private:
|
||||
bool isTool();
|
||||
|
||||
enum ButtonType
|
||||
{
|
||||
ButtonHelp,
|
||||
ButtonSticky,
|
||||
ButtonOnAllDesktops,
|
||||
ButtonMenu,
|
||||
ButtonSeparator,
|
||||
ButtonIconify,
|
||||
|
@ -93,8 +93,9 @@ namespace Web
|
|||
ButtonLower
|
||||
};
|
||||
|
||||
int titleHeight_, borderSize_;
|
||||
|
||||
bool shape_;
|
||||
bool tool_;
|
||||
|
||||
WebButton * _createButton(const QString &, QWidget * parent);
|
||||
void _createButtons();
|
||||
|
@ -108,6 +109,18 @@ namespace Web
|
|||
QPtrList<WebButton> leftButtonList_;
|
||||
QPtrList<WebButton> rightButtonList_;
|
||||
};
|
||||
|
||||
class WebFactory : public QObject, public KDecorationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
WebFactory() {};
|
||||
virtual ~WebFactory() {};
|
||||
virtual KDecoration* createDecoration( KDecorationBridge* );
|
||||
virtual bool reset( unsigned long changed );
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,21 +19,24 @@
|
|||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <qcursor.h>
|
||||
#include <qpainter.h>
|
||||
#include <qtooltip.h>
|
||||
#include "../../lib/kdecoration.h"
|
||||
|
||||
#include "WebButton.h"
|
||||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
WebButton::WebButton(QWidget * parent, const QString& tip)
|
||||
: KWinWidgetButton (parent, 0, 0, tip),
|
||||
: QButton (parent, 0, 0),
|
||||
mouseOver_ (false),
|
||||
mouseDown_ (false),
|
||||
position_ (Mid),
|
||||
shape_ (false)
|
||||
{
|
||||
setTipText(tip);
|
||||
setCursor(ArrowCursor);
|
||||
setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
|
||||
setBackgroundMode(NoBackground);
|
||||
}
|
||||
|
@ -55,7 +58,7 @@ WebButton::mousePressEvent(QMouseEvent * e)
|
|||
{
|
||||
mouseDown_ = true;
|
||||
repaint();
|
||||
KWinWidgetButton::mousePressEvent(e);
|
||||
QButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,7 +71,7 @@ WebButton::mouseReleaseEvent(QMouseEvent * e)
|
|||
{
|
||||
clickEvent(e->button());
|
||||
}
|
||||
KWinWidgetButton::mouseReleaseEvent(e);
|
||||
QButton::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -76,7 +79,7 @@ WebButton::enterEvent(QEvent * e)
|
|||
{
|
||||
mouseOver_ = true;
|
||||
repaint();
|
||||
KWinWidgetButton::enterEvent(e);
|
||||
QButton::enterEvent(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -84,7 +87,7 @@ WebButton::leaveEvent(QEvent * e)
|
|||
{
|
||||
mouseOver_ = false;
|
||||
repaint();
|
||||
KWinWidgetButton::leaveEvent(e);
|
||||
QButton::leaveEvent(e);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -252,6 +255,14 @@ WebButton::resizeEvent(QResizeEvent *)
|
|||
repaint();
|
||||
}
|
||||
|
||||
void
|
||||
WebButton::setTipText(const QString &tip) {
|
||||
if(KDecoration::options()->showTooltips()) {
|
||||
QToolTip::remove(this );
|
||||
QToolTip::add(this, tip );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "WebButton.moc"
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
|
||||
#include <qwidget.h>
|
||||
#include <qbitmap.h>
|
||||
#include <qbutton.h>
|
||||
#include <klocale.h>
|
||||
#include "../../kwinbutton.h"
|
||||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButton : public KWinWidgetButton
|
||||
class WebButton : public QButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -53,6 +52,8 @@ namespace Web
|
|||
|
||||
void setShape(bool);
|
||||
|
||||
void setTipText(const QString &tip);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void clickEvent(int button) = 0;
|
||||
|
@ -68,7 +69,6 @@ namespace Web
|
|||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
|
||||
QBitmap bitmap_;
|
||||
|
||||
bool mouseOver_;
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char close_bits[] =
|
||||
{
|
||||
0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
|
||||
class WebButtonClose : public WebButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char help_bits[] =
|
||||
{
|
||||
0x18, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x3c
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButtonHelp : public WebButton
|
||||
{
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char iconify_bits[] =
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x7e, 0x7e, 0x3c, 0x18, 0x00
|
||||
|
@ -41,7 +39,7 @@ WebButtonIconify::WebButtonIconify(QWidget * parent)
|
|||
void
|
||||
WebButtonIconify::clickEvent(int /* button */)
|
||||
{
|
||||
emit(iconify());
|
||||
emit(minimize());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButtonIconify : public WebButton
|
||||
{
|
||||
|
@ -42,7 +41,7 @@ namespace Web
|
|||
|
||||
signals:
|
||||
|
||||
void iconify();
|
||||
void minimize();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char lower_bits[] =
|
||||
{
|
||||
0x1f, 0x1f, 0x1f, 0xff, 0x8f, 0x88, 0x88, 0xf8
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButtonLower : public WebButton
|
||||
{
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char maximize_bits[] =
|
||||
{
|
||||
0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButtonMaximize : public WebButton
|
||||
{
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "WebButtonSticky.h"
|
||||
|
||||
namespace Web {
|
||||
|
||||
using namespace KWinInternal;
|
||||
|
||||
static unsigned char sticky_bits[] =
|
||||
{
|
||||
|
@ -36,7 +34,7 @@ static unsigned char unsticky_bits[] =
|
|||
};
|
||||
|
||||
WebButtonSticky::WebButtonSticky(bool sticky, QWidget * parent)
|
||||
: WebButton(parent, i18n("Sticky"))
|
||||
: WebButton(parent, i18n("On All Desktops"))
|
||||
{
|
||||
QBitmap b(8, 8, sticky ? unsticky_bits : sticky_bits, true /* isXBitmap */);
|
||||
b.setMask(b);
|
||||
|
@ -44,12 +42,12 @@ WebButtonSticky::WebButtonSticky(bool sticky, QWidget * parent)
|
|||
}
|
||||
|
||||
void
|
||||
WebButtonSticky::slotStickyChange(bool sticky)
|
||||
WebButtonSticky::slotOnAllDesktopsChange(bool sticky)
|
||||
{
|
||||
QBitmap b(8, 8, sticky ? unsticky_bits : sticky_bits, true /* isXBitmap */);
|
||||
b.setMask(b);
|
||||
setBitmap(b);
|
||||
setTipText(sticky ? i18n("Un-Sticky") : i18n("Sticky"));
|
||||
setTipText(sticky ? i18n("Not On All Desktops") : i18n("On All Desktops"));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
namespace Web
|
||||
{
|
||||
using namespace KWinInternal;
|
||||
|
||||
class WebButtonSticky : public WebButton
|
||||
{
|
||||
|
@ -42,7 +41,7 @@ namespace Web
|
|||
|
||||
protected slots:
|
||||
|
||||
void slotStickyChange(bool);
|
||||
void slotOnAllDesktopsChange(bool);
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -2,20 +2,27 @@
|
|||
Encoding=UTF-8
|
||||
Name=Web
|
||||
Name[az]=Veb
|
||||
Name[cy]=Gwe
|
||||
Name[da]=Net
|
||||
Name[eo]=TTT
|
||||
Name[et]=Veeb
|
||||
Name[fa]=وب
|
||||
Name[is]=Vefur
|
||||
Name[ko]=웹
|
||||
Name[lo]=ແບບເວ໊ບ
|
||||
Name[mn]=Веб
|
||||
Name[nb]=Nett
|
||||
Name[nn]=Vev
|
||||
Name[pl]=Sieć
|
||||
Name[pt_BR]=Árvore Web
|
||||
Name[sl]=Splet
|
||||
Name[sr]=Веб
|
||||
Name[sv]=Webb
|
||||
Name[ta]=ŨÄ
|
||||
Name[th]=แบบเว็บ
|
||||
Name[uk]=Тенета
|
||||
Name[ven]=Webu
|
||||
Name[wa]=Waibe
|
||||
Name[xx]=xxWebxx
|
||||
Name[zu]=I-Web
|
||||
X-KDE-Library=kwin_web
|
||||
X-KDE-Library=kwin3_web
|
||||
|
|
Loading…
Reference in New Issue