From 0b6057404f65218182ab27a9483a21065ef61fca Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 7 Nov 2011 21:50:33 -0600 Subject: Rename kwin to twin (Part 2 of 2) --- twin/kcmtwin/twindecoration/CMakeLists.txt | 37 + twin/kcmtwin/twindecoration/Makefile.am | 18 + twin/kcmtwin/twindecoration/buttons.cpp | 883 +++++++++++++++++++++ twin/kcmtwin/twindecoration/buttons.h | 227 ++++++ twin/kcmtwin/twindecoration/pixmaps.h | 110 +++ twin/kcmtwin/twindecoration/preview.cpp | 507 ++++++++++++ twin/kcmtwin/twindecoration/preview.h | 150 ++++ twin/kcmtwin/twindecoration/twindecoration.cpp | 840 ++++++++++++++++++++ twin/kcmtwin/twindecoration/twindecoration.desktop | 231 ++++++ twin/kcmtwin/twindecoration/twindecoration.h | 148 ++++ twin/kcmtwin/twindecoration/twindecorationIface.h | 44 + 11 files changed, 3195 insertions(+) create mode 100644 twin/kcmtwin/twindecoration/CMakeLists.txt create mode 100644 twin/kcmtwin/twindecoration/Makefile.am create mode 100644 twin/kcmtwin/twindecoration/buttons.cpp create mode 100644 twin/kcmtwin/twindecoration/buttons.h create mode 100644 twin/kcmtwin/twindecoration/pixmaps.h create mode 100644 twin/kcmtwin/twindecoration/preview.cpp create mode 100644 twin/kcmtwin/twindecoration/preview.h create mode 100644 twin/kcmtwin/twindecoration/twindecoration.cpp create mode 100644 twin/kcmtwin/twindecoration/twindecoration.desktop create mode 100644 twin/kcmtwin/twindecoration/twindecoration.h create mode 100644 twin/kcmtwin/twindecoration/twindecorationIface.h (limited to 'twin/kcmtwin/twindecoration') diff --git a/twin/kcmtwin/twindecoration/CMakeLists.txt b/twin/kcmtwin/twindecoration/CMakeLists.txt new file mode 100644 index 000000000..5fbdb3653 --- /dev/null +++ b/twin/kcmtwin/twindecoration/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/twin/lib + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES twindecoration.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_twindecoration (module) ############### + +tde_add_kpart( kcm_twindecoration AUTOMOC + SOURCES + twindecoration.cpp buttons.cpp + twindecorationIface.skel preview.cpp + LINK tdecorations-shared tdeui-shared Xext + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/twin/kcmtwin/twindecoration/Makefile.am b/twin/kcmtwin/twindecoration/Makefile.am new file mode 100644 index 000000000..021c1ac3e --- /dev/null +++ b/twin/kcmtwin/twindecoration/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(srcdir)/../../lib $(all_includes) + +kde_module_LTLIBRARIES = kcm_twindecoration.la + +kcm_twindecoration_la_SOURCES = twindecoration.cpp buttons.cpp twindecorationIface.skel preview.cpp +noinst_HEADERS = twindecoration.h twindecorationIface.h buttons.h preview.h + +kcm_twindecoration_la_LDFLAGS = \ + -module -avoid-version $(all_libraries) -no-undefined + +kcm_twindecoration_la_LIBADD = $(LIB_TDEUI) ../../lib/libtdecorations.la + +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kcmtwindecoration.pot + +xdg_apps_DATA = twindecoration.desktop diff --git a/twin/kcmtwin/twindecoration/buttons.cpp b/twin/kcmtwin/twindecoration/buttons.cpp new file mode 100644 index 000000000..2c450aed1 --- /dev/null +++ b/twin/kcmtwin/twindecoration/buttons.cpp @@ -0,0 +1,883 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2004, Sandro Giessl + Copyright (c) 2001 + Karol Szwed + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include "buttons.h" +#include "pixmaps.h" + + +#define BUTTONDRAGMIMETYPE "application/x-kde_twindecoration_buttons" +ButtonDrag::ButtonDrag( Button btn, TQWidget* parent, const char* name) + : TQStoredDrag( BUTTONDRAGMIMETYPE, parent, name) +{ + TQByteArray data; + TQDataStream stream(data, IO_WriteOnly); + stream << btn.name; + stream << btn.icon; + stream << btn.type.tqunicode(); + stream << (int) btn.duplicate; + stream << (int) btn.supported; + setEncodedData( data ); +} + + +bool ButtonDrag::canDecode( TQDropEvent* e ) +{ + return e->provides( BUTTONDRAGMIMETYPE ); +} + +bool ButtonDrag::decode( TQDropEvent* e, Button& btn ) +{ + TQByteArray data = e->data( BUTTONDRAGMIMETYPE ); + if ( data.size() ) + { + e->accept(); + TQDataStream stream(data, IO_ReadOnly); + stream >> btn.name; + stream >> btn.icon; + ushort type; + stream >> type; + btn.type = TQChar(type); + int duplicate; + stream >> duplicate; + btn.duplicate = duplicate; + int supported; + stream >> supported; + btn.supported = supported; + return TRUE; + } + return FALSE; +} + + +Button::Button() +{ +} + +Button::Button(const TQString& n, const TQBitmap& i, TQChar t, bool d, bool s) + : name(n), + icon(i), + type(t), + duplicate(d), + supported(s) +{ +} + +Button::~Button() +{ +} + +// helper function to deal with the Button's bitmaps more easily... +TQPixmap bitmapPixmap(const TQBitmap& bm, const TQColor& color) +{ + TQPixmap pm(bm.size() ); + pm.setMask(bm); + TQPainter p(&pm); + p.setPen(color); + p.drawPixmap(0,0,bm); + p.end(); + return pm; +} + + +ButtonSource::ButtonSource(TQWidget *parent, const char* name) + : KListView(parent, name) +{ + tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); + + setResizeMode(TQListView::AllColumns); + setDragEnabled(true); + setAcceptDrops(true); + setDropVisualizer(false); + setSorting(-1); + header()->setClickEnabled(false); + header()->hide(); + + addColumn(i18n("Buttons") ); +} + +ButtonSource::~ButtonSource() +{ +} + +TQSize ButtonSource::tqsizeHint() const +{ + // make the tqsizeHint height a bit smaller than the one of TQListView... + + if ( cachedSizeHint().isValid() ) + return cachedSizeHint(); + + constPolish(); + + TQSize s( header()->tqsizeHint() ); + + if ( verticalScrollBar()->isVisible() ) + s.setWidth( s.width() + tqstyle().tqpixelMetric(TQStyle::PM_ScrollBarExtent) ); + s += TQSize(frameWidth()*2,frameWidth()*2); + + // size hint: 4 lines of text... + s.setHeight( s.height() + fontMetrics().lineSpacing()*3 ); + + setCachedSizeHint( s ); + + return s; +} + +void ButtonSource::hideAllButtons() +{ + TQListViewItemIterator it(this); + while (it.current() ) { + it.current()->tqsetVisible(false); + ++it; + } +} + +void ButtonSource::showAllButtons() +{ + TQListViewItemIterator it(this); + while (it.current() ) { + it.current()->tqsetVisible(true); + ++it; + } +} + +void ButtonSource::showButton( TQChar btn ) +{ + TQListViewItemIterator it(this); + while (it.current() ) { + ButtonSourceItem *item = dynamic_cast(it.current() ); + if (item && item->button().type == btn) { + it.current()->tqsetVisible(true); + return; + } + ++it; + } +} + +void ButtonSource::hideButton( TQChar btn ) +{ + TQListViewItemIterator it(this); + while (it.current() ) { + ButtonSourceItem *item = dynamic_cast(it.current() ); + if (item && item->button().type == btn && !item->button().duplicate) { + it.current()->tqsetVisible(false); + return; + } + ++it; + } +} + +bool ButtonSource::acceptDrag(TQDropEvent* e) const +{ + return acceptDrops() && ButtonDrag::canDecode(e); +} + +TQDragObject *ButtonSource::dragObject() +{ + ButtonSourceItem *i = dynamic_cast(selectedItem() ); + + if (i) { + ButtonDrag *bd = new ButtonDrag(i->button(), viewport(), "button_drag"); + bd->setPixmap(bitmapPixmap(i->button().icon, tqcolorGroup().foreground() )); + return bd; + } + + return 0; +} + +ButtonDropSiteItem::ButtonDropSiteItem(const Button& btn) + : m_button(btn) +{ +} + +ButtonDropSiteItem::~ButtonDropSiteItem() +{ +} + +Button ButtonDropSiteItem::button() +{ + return m_button; +} + +int ButtonDropSiteItem::width() +{ +// return m_button.icon.width(); + return 20; +} + +int ButtonDropSiteItem::height() +{ +// return m_button.icon.height(); + return 20; +} + +void ButtonDropSiteItem::draw(TQPainter *p, const TQColorGroup& cg, TQRect r) +{ +// p->fillRect(r, cg.base() ); + if (m_button.supported) + p->setPen(cg.foreground() ); + else + p->setPen(cg.mid() ); + TQBitmap &i = m_button.icon; + p->drawPixmap(r.left()+(r.width()-i.width())/2, r.top()+(r.height()-i.height())/2, i); +} + + +ButtonDropSite::ButtonDropSite( TQWidget* parent, const char* name ) + : TQFrame( parent, name ), + m_selected(0) +{ + setAcceptDrops( TRUE ); + setFrameShape( WinPanel ); + setFrameShadow( Raised ); + setMinimumHeight( 26 ); + setMaximumHeight( 26 ); + setMinimumWidth( 250 ); // Ensure buttons will fit +} + +ButtonDropSite::~ButtonDropSite() +{ + clearLeft(); + clearRight(); +} + +void ButtonDropSite::clearLeft() +{ + while (!buttonsLeft.isEmpty() ) { + ButtonDropSiteItem *item = buttonsLeft.first(); + if (removeButton(item) ) { + emit buttonRemoved(item->button().type); + delete item; + } + } +} + +void ButtonDropSite::clearRight() +{ + while (!buttonsRight.isEmpty() ) { + ButtonDropSiteItem *item = buttonsRight.first(); + if (removeButton(item) ) { + emit buttonRemoved(item->button().type); + delete item; + } + } +} + +void ButtonDropSite::dragMoveEvent( TQDragMoveEvent* e ) +{ + TQPoint p = e->pos(); + if (leftDropArea().contains(p) || rightDropArea().contains(p) || buttonAt(p) ) { + e->accept(); + + // 2 pixel wide drop visualizer... + TQRect r = contentsRect(); + int x = -1; + if (leftDropArea().contains(p) ) { + x = leftDropArea().left(); + } else if (rightDropArea().contains(p) ) { + x = rightDropArea().right()+1; + } else { + ButtonDropSiteItem *item = buttonAt(p); + if (item) { + if (p.x() < item->rect.left()+item->rect.width()/2 ) { + x = item->rect.left(); + } else { + x = item->rect.right()+1; + } + } + } + if (x != -1) { + TQRect tmpRect(x, r.y(), 2, r.height() ); + if (tmpRect != m_oldDropVisualizer) { + cleanDropVisualizer(); + m_oldDropVisualizer = tmpRect; + update(tmpRect); + } + } + + } else { + e->ignore(); + + cleanDropVisualizer(); + } +} + +void ButtonDropSite::cleanDropVisualizer() +{ + if (m_oldDropVisualizer.isValid()) + { + TQRect rect = m_oldDropVisualizer; + m_oldDropVisualizer = TQRect(); // rect is invalid + update(rect); + } +} + +void ButtonDropSite::dragEnterEvent( TQDragEnterEvent* e ) +{ + if ( ButtonDrag::canDecode( e ) ) + e->accept(); +} + +void ButtonDropSite::dragLeaveEvent( TQDragLeaveEvent* /* e */ ) +{ + cleanDropVisualizer(); +} + +void ButtonDropSite::dropEvent( TQDropEvent* e ) +{ + cleanDropVisualizer(); + + TQPoint p = e->pos(); + + // collect information where to insert the dropped button + ButtonList *buttonList = 0; + ButtonList::iterator buttonPosition; + + if (leftDropArea().contains(p) ) { + buttonList = &buttonsLeft; + buttonPosition = buttonsLeft.end(); + } else if (rightDropArea().contains(p) ) { + buttonList = &buttonsRight; + buttonPosition = buttonsRight.begin(); + } else { + ButtonDropSiteItem *aboveItem = buttonAt(p); + if (!aboveItem) + return; // invalid drop. hasn't occured _over_ a button (or left/right dropArea), return... + + ButtonList::iterator it; + if (!getItemIterator(aboveItem, buttonList, it) ) { + // didn't find the aboveItem. unlikely to happen since buttonAt() already seems to have found + // something valid. anyway... + return; + } + + // got the list and the aboveItem position. now determine if the item should be inserted + // before aboveItem or after aboveItem. + TQRect aboveItemRect = aboveItem->rect; + if (!aboveItemRect.isValid() ) + return; + + if (p.x() < aboveItemRect.left()+aboveItemRect.width()/2 ) { + // insert before the item + buttonPosition = it; + } else { + if (it != buttonList->end() ) + buttonPosition = ++it; + else + buttonPosition = it; // already at the end(), can't increment the iterator! + } + } + + // know where to insert the button. now see if we can use an existing item (drag within the widget = move) + // orneed to create a new one + ButtonDropSiteItem *buttonItem = 0; + if (e->source() == this && m_selected) { + ButtonList *oldList = 0; + ButtonList::iterator oldPos; + if (getItemIterator(m_selected, oldList, oldPos) ) { + if (oldPos == buttonPosition) + return; // button didn't change its position during the drag... + + oldList->remove(oldPos); + buttonItem = m_selected; + } else { + return; // m_selected not found, return... + } + } else { + // create new button from the drop object... + Button btn; + if (ButtonDrag::decode(e, btn) ) { + buttonItem = new ButtonDropSiteItem(btn); + } else { + return; // something has gone wrong while we were trying to decode the drop event + } + } + + // now the item can actually be inserted into the list! :) + (*buttonList).insert(buttonPosition, buttonItem); + emit buttonAdded(buttonItem->button().type); + emit changed(); + recalcItemGeometry(); + update(); +} + +bool ButtonDropSite::getItemIterator(ButtonDropSiteItem *item, ButtonList* &list, ButtonList::iterator &iterator) +{ + if (!item) + return false; + + ButtonList::iterator it = buttonsLeft.find(item); // try the left list first... + if (it == buttonsLeft.end() ) { + it = buttonsRight.find(item); // try the right list... + if (it == buttonsRight.end() ) { + return false; // item hasn't been found in one of the list, return... + } else { + list = &buttonsRight; + iterator = it; + } + } else { + list = &buttonsLeft; + iterator = it; + } + + return true; +} + +TQRect ButtonDropSite::leftDropArea() +{ + // return a 10 pixel drop area... + TQRect r = contentsRect(); + + int leftButtonsWidth = calcButtonListWidth(buttonsLeft); + return TQRect(r.left()+leftButtonsWidth, r.top(), 10, r.height() ); +} + +TQRect ButtonDropSite::rightDropArea() +{ + // return a 10 pixel drop area... + TQRect r = contentsRect(); + + int rightButtonsWidth = calcButtonListWidth(buttonsRight); + return TQRect(r.right()-rightButtonsWidth-10, r.top(), 10, r.height() ); +} + +void ButtonDropSite::mousePressEvent( TQMouseEvent* e ) +{ + // TODO: only start the real drag after some drag distance + m_selected = buttonAt(e->pos() ); + if (m_selected) { + ButtonDrag *bd = new ButtonDrag(m_selected->button(), this); + bd->setPixmap(bitmapPixmap(m_selected->button().icon, tqcolorGroup().foreground() ) ); + bd->dragMove(); + } +} + +void ButtonDropSite::resizeEvent(TQResizeEvent*) +{ + recalcItemGeometry(); +} + +void ButtonDropSite::recalcItemGeometry() +{ + TQRect r = contentsRect(); + + // update the geometry of the items in the left button list + int offset = r.left(); + for (ButtonList::const_iterator it = buttonsLeft.begin(); it != buttonsLeft.end(); ++it) { + int w = (*it)->width(); + (*it)->rect = TQRect(offset, r.top(), w, (*it)->height() ); + offset += w; + } + + // the right button list... + offset = r.right() - calcButtonListWidth(buttonsRight); + for (ButtonList::const_iterator it = buttonsRight.begin(); it != buttonsRight.end(); ++it) { + int w = (*it)->width(); + (*it)->rect = TQRect(offset, r.top(), w, (*it)->height() ); + offset += w; + } +} + +ButtonDropSiteItem *ButtonDropSite::buttonAt(TQPoint p) { + // try to find the item in the left button list + for (ButtonList::const_iterator it = buttonsLeft.begin(); it != buttonsLeft.end(); ++it) { + if ( (*it)->rect.contains(p) ) { + return *it; + } + } + + // try to find the item in the right button list + for (ButtonList::const_iterator it = buttonsRight.begin(); it != buttonsRight.end(); ++it) { + if ( (*it)->rect.contains(p) ) { + return *it; + } + } + + return 0; +} + +bool ButtonDropSite::removeButton(ButtonDropSiteItem *item) { + if (!item) + return false; + + // try to remove the item from the left button list + if (buttonsLeft.remove(item) >= 1) { + return true; + } + + // try to remove the item from the right button list + if (buttonsRight.remove(item) >= 1) { + return true; + } + + return false; +} + +int ButtonDropSite::calcButtonListWidth(const ButtonList& btns) +{ + int w = 0; + for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) { + w += (*it)->width(); + } + + return w; +} + +bool ButtonDropSite::removeSelectedButton() +{ + bool succ = removeButton(m_selected); + if (succ) { + emit buttonRemoved(m_selected->button().type); + emit changed(); + delete m_selected; + m_selected = 0; + recalcItemGeometry(); + update(); // tqrepaint... + } + + return succ; +} + +void ButtonDropSite::drawButtonList(TQPainter *p, const ButtonList& btns, int offset) +{ + for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) { + TQRect tqitemRect = (*it)->rect; + if (tqitemRect.isValid() ) { + (*it)->draw(p, tqcolorGroup(), tqitemRect); + } + offset += (*it)->width(); + } +} + +void ButtonDropSite::drawContents( TQPainter* p ) +{ + int leftoffset = calcButtonListWidth( buttonsLeft ); + int rightoffset = calcButtonListWidth( buttonsRight ); + int offset = 3; + + TQRect r = contentsRect(); + + // Shrink by 1 + r.moveBy(1 + leftoffset, 1); + r.setWidth( r.width() - 2 - leftoffset - rightoffset ); + r.setHeight( r.height() - 2 ); + + drawButtonList( p, buttonsLeft, offset ); + + TQColor c1( 0x0A, 0x5F, 0x89 ); // KDE 2 titlebar default colour + p->fillRect( r, c1 ); + p->setPen( Qt::white ); + p->setFont( TQFont( KGlobalSettings::generalFont().family(), 12, TQFont::Bold) ); + p->drawText( r, AlignLeft | AlignVCenter, i18n("KDE") ); + + offset = geometry().width() - 3 - rightoffset; + drawButtonList( p, buttonsRight, offset ); + + if (m_oldDropVisualizer.isValid() ) + { + p->fillRect(m_oldDropVisualizer, Dense4Pattern); + } +} + +ButtonSourceItem::ButtonSourceItem(TQListView * parent, const Button& btn) + : TQListViewItem(parent), + m_button(btn), + m_dirty(true) +{ + setButton(btn); +} + +ButtonSourceItem::~ButtonSourceItem() +{ +} + +void ButtonSourceItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) +{ + // we need the color group cg, so to the work here, not in setButton... + if (m_dirty) { + if (m_button.supported) { + setPixmap(0, bitmapPixmap(m_button.icon, cg.foreground() ) ); + } else { + setPixmap(0, bitmapPixmap(m_button.icon, cg.mid() ) ); + } + m_dirty = false; + } + + if (m_button.supported) { + TQListViewItem::paintCell(p,cg,column,width,align); + } else { + // grey out unsupported buttons + TQColorGroup cg2 = cg; + cg2.setColor(TQColorGroup::Text, cg.mid() ); + TQListViewItem::paintCell(p,cg2,column,width,align); + } +} + +void ButtonSourceItem::setButton(const Button& btn) +{ + m_button = btn; + m_dirty = true; // update the pixmap when in paintCell()... + if (btn.supported) { + setText(0, btn.name); + } else { + setText(0, i18n("%1 (unavailable)").arg(btn.name) ); + } +} + +Button ButtonSourceItem::button() const +{ + return m_button; +} + + +ButtonPositionWidget::ButtonPositionWidget(TQWidget *parent, const char* name) + : TQWidget(parent,name), + m_factory(0) +{ + TQVBoxLayout *layout = new TQVBoxLayout(this, 0, KDialog::spacingHint() ); + tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Maximum); + + TQLabel* label = new TQLabel( this ); + m_dropSite = new ButtonDropSite( this ); + label->tqsetAlignment( int( TQLabel::WordBreak ) ); + label->setText( i18n( "To add or remove titlebar buttons, simply drag items " + "between the available item list and the titlebar preview. Similarly, " + "drag items within the titlebar preview to re-position them.") ); + m_buttonSource = new ButtonSource(this, "button_source"); + + layout->addWidget(label); + layout->addWidget(m_dropSite); + layout->addWidget(m_buttonSource); + + connect( m_dropSite, TQT_SIGNAL(buttonAdded(TQChar)), m_buttonSource, TQT_SLOT(hideButton(TQChar)) ); + connect( m_dropSite, TQT_SIGNAL(buttonRemoved(TQChar)), m_buttonSource, TQT_SLOT(showButton(TQChar)) ); + connect( m_buttonSource, TQT_SIGNAL(dropped(TQDropEvent*, TQListViewItem*)), m_dropSite, TQT_SLOT(removeSelectedButton()) ); + + connect( m_dropSite, TQT_SIGNAL(changed()), TQT_SIGNAL(changed()) ); + + // insert all possible buttons into the source (backwards to keep the preferred order...) + bool dummy; + new ButtonSourceItem(m_buttonSource, getButton('R', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('L', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('B', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('F', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('X', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('A', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('I', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('H', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('S', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('M', dummy) ); + new ButtonSourceItem(m_buttonSource, getButton('_', dummy) ); +} + +ButtonPositionWidget::~ButtonPositionWidget() +{ +} + +void ButtonPositionWidget::setDecorationFactory(KDecorationFactory *factory) +{ + if (!factory) + return; + + m_factory = factory; + + // get the list of supported buttons + if (m_factory->supports(KDecorationDefines::AbilityAnnounceButtons) ) { + TQString supportedButtons; + + if (m_factory->supports(KDecorationDefines::AbilityButtonMenu) ) + supportedButtons.append('M'); + if (m_factory->supports(KDecorationDefines::AbilityButtonOnAllDesktops) ) + supportedButtons.append('S'); + if (m_factory->supports(KDecorationDefines::AbilityButtonSpacer) ) + supportedButtons.append('_'); + if (m_factory->supports(KDecorationDefines::AbilityButtonHelp) ) + supportedButtons.append('H'); + if (m_factory->supports(KDecorationDefines::AbilityButtonMinimize) ) + supportedButtons.append('I'); + if (m_factory->supports(KDecorationDefines::AbilityButtonMaximize) ) + supportedButtons.append('A'); + if (m_factory->supports(KDecorationDefines::AbilityButtonClose) ) + supportedButtons.append('X'); + if (m_factory->supports(KDecorationDefines::AbilityButtonAboveOthers) ) + supportedButtons.append('F'); + if (m_factory->supports(KDecorationDefines::AbilityButtonBelowOthers) ) + supportedButtons.append('B'); + if (m_factory->supports(KDecorationDefines::AbilityButtonShade) ) + supportedButtons.append('L'); + if (m_factory->supports(KDecorationDefines::AbilityButtonResize) ) + supportedButtons.append('R'); + + m_supportedButtons = supportedButtons; + } else { + // enable only buttons available before AbilityButton* introduction + m_supportedButtons = "MSHIAX_"; + } + + // update the button lists... + // 1. set status on the source items... + TQListViewItemIterator it(m_buttonSource); + while (it.current() ) { + ButtonSourceItem *i = dynamic_cast(it.current() ); + if (i) { + Button b = i->button(); + b.supported = m_supportedButtons.contains(b.type); + i->setButton(b); + } + ++it; + } + // 2. rebuild the drop site items... + setButtonsLeft(buttonsLeft() ); + setButtonsRight(buttonsRight() ); +} + +Button ButtonPositionWidget::getButton(TQChar type, bool& success) { + success = true; + + if (type == 'R') { + TQBitmap bmp(resize_width, resize_height, resize_bits, true); + bmp.setMask(bmp); + return Button(i18n("Resize"), bmp, 'R', false, m_supportedButtons.contains('R') ); + } else if (type == 'L') { + TQBitmap bmp(shade_width, shade_height, shade_bits, true); + bmp.setMask(bmp); + return Button(i18n("Shade"), bmp, 'L', false, m_supportedButtons.contains('L') ); + } else if (type == 'B') { + TQBitmap bmp(keepbelowothers_width, keepbelowothers_height, keepbelowothers_bits, true); + bmp.setMask(bmp); + return Button(i18n("Keep Below Others"), bmp, 'B', false, m_supportedButtons.contains('B') ); + } else if (type == 'F') { + TQBitmap bmp(keepaboveothers_width, keepaboveothers_height, keepaboveothers_bits, true); + bmp.setMask(bmp); + return Button(i18n("Keep Above Others"), bmp, 'F', false, m_supportedButtons.contains('F') ); + } else if (type == 'X') { + TQBitmap bmp(close_width, close_height, close_bits, true); + bmp.setMask(bmp); + return Button(i18n("Close"), bmp, 'X', false, m_supportedButtons.contains('X') ); + } else if (type == 'A') { + TQBitmap bmp(maximize_width, maximize_height, maximize_bits, true); + bmp.setMask(bmp); + return Button(i18n("Maximize"), bmp, 'A', false, m_supportedButtons.contains('A') ); + } else if (type == 'I') { + TQBitmap bmp(minimize_width, minimize_height, minimize_bits, true); + bmp.setMask(bmp); + return Button(i18n("Minimize"), bmp, 'I', false, m_supportedButtons.contains('I') ); + } else if (type == 'H') { + TQBitmap bmp(help_width, help_height, help_bits, true); + bmp.setMask(bmp); + return Button(i18n("Help"), bmp, 'H', false, m_supportedButtons.contains('H') ); + } else if (type == 'S') { + TQBitmap bmp(onalldesktops_width, onalldesktops_height, onalldesktops_bits, true); + bmp.setMask(bmp); + return Button(i18n("On All Desktops"), bmp, 'S', false, m_supportedButtons.contains('S') ); + } else if (type == 'M') { + TQBitmap bmp(menu_width, menu_height, menu_bits, true); + bmp.setMask(bmp); + return Button(i18n("Menu"), bmp, 'M', false, m_supportedButtons.contains('M') ); + } else if (type == '_') { + TQBitmap bmp(spacer_width, spacer_height, spacer_bits, true); + bmp.setMask(bmp); + return Button(i18n("--- spacer ---"), bmp, '_', true, m_supportedButtons.contains('_') ); + } else { + success = false; + return Button(); + } +} + +TQString ButtonPositionWidget::buttonsLeft() const +{ + ButtonList btns = m_dropSite->buttonsLeft; + TQString btnString = ""; + for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) { + btnString.append( (*it)->button().type ); + } + return btnString; +} + +TQString ButtonPositionWidget::buttonsRight() const +{ + ButtonList btns = m_dropSite->buttonsRight; + TQString btnString = ""; + for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) { + btnString.append( (*it)->button().type ); + } + return btnString; +} + +void ButtonPositionWidget::setButtonsLeft(const TQString &buttons) +{ + // to keep the button lists consistent, first remove all left buttons, then add buttons again... + m_dropSite->clearLeft(); + + for (uint i = 0; i < buttons.length(); ++i) { + bool succ = false; + Button btn = getButton(buttons[i], succ); + if (succ) { + m_dropSite->buttonsLeft.append(new ButtonDropSiteItem(btn) ); + m_buttonSource->hideButton(btn.type); + } + } + m_dropSite->recalcItemGeometry(); + m_dropSite->update(); +} + +void ButtonPositionWidget::setButtonsRight(const TQString &buttons) +{ + // to keep the button lists consistent, first remove all left buttons, then add buttons again... + m_dropSite->clearRight(); + + for (uint i = 0; i < buttons.length(); ++i) { + bool succ = false; + Button btn = getButton(buttons[i], succ); + if (succ) { + m_dropSite->buttonsRight.append(new ButtonDropSiteItem(btn) ); + m_buttonSource->hideButton(btn.type); + } + } + m_dropSite->recalcItemGeometry(); + m_dropSite->update(); +} + +#include "buttons.moc" +// vim: ts=4 +// kate: space-indent off; tab-width 4; diff --git a/twin/kcmtwin/twindecoration/buttons.h b/twin/kcmtwin/twindecoration/buttons.h new file mode 100644 index 000000000..088d3414d --- /dev/null +++ b/twin/kcmtwin/twindecoration/buttons.h @@ -0,0 +1,227 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2004, Sandro Giessl + Copyright (c) 2001 + Karol Szwed + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#ifndef __BUTTONS_H_ +#define __BUTTONS_H_ + +#include +#include +#include +#include + +#include + +class KDecorationFactory; + +/** + * This class holds the button data. + */ +class Button +{ + public: + Button(); + Button(const TQString& name, const TQBitmap& icon, TQChar type, bool duplicate, bool supported); + virtual ~Button(); + + TQString name; + TQBitmap icon; + TQChar type; + bool duplicate; + bool supported; +}; + +class ButtonDrag : public TQStoredDrag +{ + public: + ButtonDrag( Button btn, TQWidget* parent, const char* name=0 ); + ~ButtonDrag() {}; + + static bool canDecode( TQDropEvent* e ); + static bool decode( TQDropEvent* e, Button& btn ); +}; + +/** + * This is plugged into ButtonDropSite + */ +class ButtonDropSiteItem +{ + public: + ButtonDropSiteItem(const Button& btn); + ~ButtonDropSiteItem(); + + Button button(); + + TQRect rect; + int width(); + int height(); + + void draw(TQPainter *p, const TQColorGroup& cg, TQRect rect); + + private: + Button m_button; +}; + +/** + * This is plugged into ButtonSource + */ +class ButtonSourceItem : public TQListViewItem +{ + public: + ButtonSourceItem(TQListView * parent, const Button& btn); + virtual ~ButtonSourceItem(); + + void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align); + + void setButton(const Button& btn); + Button button() const; + private: + Button m_button; + bool m_dirty; +}; + +/** + * Implements the button drag source list view + */ +class ButtonSource : public KListView +{ + Q_OBJECT + + public: + ButtonSource(TQWidget *parent = 0, const char* name = 0); + virtual ~ButtonSource(); + + TQSize tqsizeHint() const; + + void hideAllButtons(); + void showAllButtons(); + + public slots: + void hideButton(TQChar btn); + void showButton(TQChar btn); + + protected: + bool acceptDrag(TQDropEvent* e) const; + virtual TQDragObject *dragObject(); +}; + +typedef TQValueList ButtonList; + +/** + * This class renders and handles the demo titlebar dropsite + */ +class ButtonDropSite: public TQFrame +{ + Q_OBJECT + + public: + ButtonDropSite( TQWidget* parent=0, const char* name=0 ); + ~ButtonDropSite(); + + // Allow external classes access our buttons - ensure buttons are + // not duplicated however. + ButtonList buttonsLeft; + ButtonList buttonsRight; + void clearLeft(); + void clearRight(); + + signals: + void buttonAdded(TQChar btn); + void buttonRemoved(TQChar btn); + void changed(); + + public slots: + bool removeSelectedButton(); ///< This slot is called after we drop on the item listbox... + void recalcItemGeometry(); ///< Call this whenever the item list changes... updates the items' rect property + + protected: + void resizeEvent(TQResizeEvent*); + void dragEnterEvent( TQDragEnterEvent* e ); + void dragMoveEvent( TQDragMoveEvent* e ); + void dragLeaveEvent( TQDragLeaveEvent* e ); + void dropEvent( TQDropEvent* e ); + void mousePressEvent( TQMouseEvent* e ); ///< Starts dragging a button... + + void drawContents( TQPainter* p ); + ButtonDropSiteItem *buttonAt(TQPoint p); + bool removeButton(ButtonDropSiteItem *item); + int calcButtonListWidth(const ButtonList& buttons); ///< Computes the total space the buttons will take in the titlebar + void drawButtonList(TQPainter *p, const ButtonList& buttons, int offset); + + TQRect leftDropArea(); + TQRect rightDropArea(); + + private: + /** + * Try to find the item. If found, set its list and iterator and return true, else return false + */ + bool getItemIterator(ButtonDropSiteItem *item, ButtonList* &list, ButtonList::iterator &iterator); + + void cleanDropVisualizer(); + TQRect m_oldDropVisualizer; + + ButtonDropSiteItem *m_selected; +}; + +class ButtonPositionWidget : public TQWidget +{ + Q_OBJECT + + public: + ButtonPositionWidget(TQWidget *parent = 0, const char* name = 0); + ~ButtonPositionWidget(); + + /** + * set the factory, so the class e.g. knows which buttons are supported by the client + */ + void setDecorationFactory(KDecorationFactory *factory); + + TQString buttonsLeft() const; + TQString buttonsRight() const; + void setButtonsLeft(const TQString &buttons); + void setButtonsRight(const TQString &buttons); + + signals: + void changed(); + + private: + void clearButtonList(const ButtonList& btns); + Button getButton(TQChar type, bool& success); + + ButtonDropSite* m_dropSite; + ButtonSource *m_buttonSource; + + KDecorationFactory *m_factory; + TQString m_supportedButtons; +}; + + +#endif +// vim: ts=4 +// kate: space-indent off; tab-width 4; diff --git a/twin/kcmtwin/twindecoration/pixmaps.h b/twin/kcmtwin/twindecoration/pixmaps.h new file mode 100644 index 000000000..710e01425 --- /dev/null +++ b/twin/kcmtwin/twindecoration/pixmaps.h @@ -0,0 +1,110 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2004, Sandro Giessl + Copyright (c) 2001 + Karol Szwed + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +// Button icon bitmap data which is hopefully generic enough to be recognized by everyone. + +// close.xbm: +#define close_width 12 +#define close_height 12 +static unsigned char close_bits[] = { + 0x00, 0x00, 0x06, 0x06, 0x0e, 0x07, 0x9c, 0x03, 0xf8, 0x01, 0xf0, 0x00, + 0xf0, 0x00, 0xf8, 0x01, 0x9c, 0x03, 0x0e, 0x07, 0x06, 0x06, 0x00, 0x00 }; + +// help.xbm: +#define help_width 12 +#define help_height 12 +static unsigned char help_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0x8c, 0x01, 0xc0, 0x01, + 0xe0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00 }; + +// keepaboveothers.xbm: +#define keepaboveothers_width 12 +#define keepaboveothers_height 12 +static unsigned char keepaboveothers_bits[] = { + 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf8, 0x01, 0x60, 0x00, 0xfe, 0x07, + 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// keepbelowothers.xbm: +#define keepbelowothers_width 12 +#define keepbelowothers_height 12 +static unsigned char keepbelowothers_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, + 0xfe, 0x07, 0x60, 0x00, 0xf8, 0x01, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00 }; + +// maximize.xbm: +#define maximize_width 12 +#define maximize_height 12 +static unsigned char maximize_bits[] = { + 0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, + 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0xfe, 0x07, 0x00, 0x00 }; + +// menu.xbm: +#define menu_width 12 +#define menu_height 12 +static unsigned char menu_bits[] = { + 0x00, 0x00, 0xfc, 0x03, 0xf4, 0x02, 0x04, 0x02, 0xf4, 0x02, 0x04, 0x02, + 0xf4, 0x02, 0x04, 0x02, 0xf4, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00 }; + +// minimize.xbm: +#define minimize_width 12 +#define minimize_height 12 +static unsigned char minimize_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x00, 0x00 }; + +// onalldesktops.xbm: +#define onalldesktops_width 12 +#define onalldesktops_height 12 +static unsigned char onalldesktops_bits[] = { + 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe, 0x07, + 0xfe, 0x07, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00 }; + +// resize.xbm: +#define resize_width 12 +#define resize_height 12 +static unsigned char resize_bits[] = { + 0x00, 0x00, 0xfe, 0x07, 0x42, 0x04, 0x42, 0x04, 0x42, 0x04, 0x42, 0x04, + 0x7e, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0xfe, 0x07, 0x00, 0x00 }; + +// shade.xbm: +#define shade_width 12 +#define shade_height 12 +static unsigned char shade_bits[] = { + 0x00, 0x00, 0xfe, 0x07, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// spacer.xbm: +#define spacer_width 12 +#define spacer_height 12 +static unsigned char spacer_bits[] = { + 0x00, 0x00, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x54, 0x03, + 0xac, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0x00, 0x00 }; + +// vim: ts=4 diff --git a/twin/kcmtwin/twindecoration/preview.cpp b/twin/kcmtwin/twindecoration/preview.cpp new file mode 100644 index 000000000..ee8c59c75 --- /dev/null +++ b/twin/kcmtwin/twindecoration/preview.cpp @@ -0,0 +1,507 @@ +/* + * + * Copyright (c) 2003 Lubos Lunak + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "preview.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +// FRAME the preview doesn't update to reflect the changes done in the kcm + +KDecorationPreview::KDecorationPreview( TQWidget* parent, const char* name ) + : TQWidget( parent, name ) + { + options = new KDecorationPreviewOptions; + + bridge[Active] = new KDecorationPreviewBridge( this, true ); + bridge[Inactive] = new KDecorationPreviewBridge( this, false ); + + deco[Active] = deco[Inactive] = NULL; + + no_preview = new TQLabel( i18n( "No preview available.\n" + "Most probably there\n" + "was a problem loading the plugin." ), this ); + + no_preview->tqsetAlignment( AlignCenter ); + + setMinimumSize( 100, 100 ); + no_preview->resize( size()); + } + +KDecorationPreview::~KDecorationPreview() + { + for ( int i = 0; i < NumWindows; i++ ) + { + delete deco[i]; + delete bridge[i]; + } + delete options; + } + +bool KDecorationPreview::recreateDecoration( KDecorationPlugins* plugins ) + { + for ( int i = 0; i < NumWindows; i++ ) + { + delete deco[i]; // deletes also window + deco[i] = plugins->createDecoration( bridge[i] ); + deco[i]->init(); + } + + if( deco[Active] == NULL || deco[Inactive] == NULL ) + { + return false; + } + + positionPreviews(); + deco[Inactive]->widget()->show(); + deco[Active]->widget()->show(); + + return true; + } + +void KDecorationPreview::enablePreview() + { + no_preview->hide(); + } + +void KDecorationPreview::disablePreview() + { + delete deco[Active]; + delete deco[Inactive]; + deco[Active] = deco[Inactive] = NULL; + no_preview->show(); + } + +void KDecorationPreview::resizeEvent( TQResizeEvent* e ) + { + TQWidget::resizeEvent( e ); + positionPreviews(); + } + +void KDecorationPreview::positionPreviews() + { + int titleBarHeight, leftBorder, rightBorder, xoffset, + dummy1, dummy2, dummy3; + TQRect geometry; + TQSize size; + + no_preview->resize( this->size() ); + + if ( !deco[Active] || !deco[Inactive] ) + return; + + // don't have more than one reference to the same dummy variable in one borders() call. + deco[Active]->borders( dummy1, dummy2, titleBarHeight, dummy3 ); + deco[Inactive]->borders( leftBorder, rightBorder, dummy1, dummy2 ); + + titleBarHeight = kMin( int( titleBarHeight * .9 ), 30 ); + xoffset = kMin( kMax( 10, TQApplication::reverseLayout() + ? leftBorder : rightBorder ), 30 ); + + // Resize the active window + size = TQSize( width() - xoffset, height() - titleBarHeight ) + .expandedTo( deco[Active]->tqminimumSize() ); + geometry = TQRect( TQPoint( 0, titleBarHeight ), size ); + deco[Active]->widget()->setGeometry( TQStyle::tqvisualRect( geometry, this ) ); + + // Resize the inactive window + size = TQSize( width() - xoffset, height() - titleBarHeight ) + .expandedTo( deco[Inactive]->tqminimumSize() ); + geometry = TQRect( TQPoint( xoffset, 0 ), size ); + deco[Inactive]->widget()->setGeometry( TQStyle::tqvisualRect( geometry, this ) ); + } + +void KDecorationPreview::setPreviewMask( const TQRegion& reg, int mode, bool active ) + { + TQWidget *widget = active ? deco[Active]->widget() : deco[Inactive]->widget(); + + // FRAME duped from client.cpp + if( mode == Unsorted ) + { + XShapeCombineRegion( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0, + reg.handle(), ShapeSet ); + } + else + { + TQMemArray< TQRect > rects = reg.tqrects(); + XRectangle* xrects = new XRectangle[ rects.count() ]; + for( unsigned int i = 0; + i < rects.count(); + ++i ) + { + xrects[ i ].x = rects[ i ].x(); + xrects[ i ].y = rects[ i ].y(); + xrects[ i ].width = rects[ i ].width(); + xrects[ i ].height = rects[ i ].height(); + } + XShapeCombineRectangles( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0, + xrects, rects.count(), ShapeSet, mode ); + delete[] xrects; + } + if( active ) + mask = reg; // keep tqshape of the active window for unobscuredRegion() + } + +TQRect KDecorationPreview::windowGeometry( bool active ) const + { + TQWidget *widget = active ? deco[Active]->widget() : deco[Inactive]->widget(); + return widget->geometry(); + } + +void KDecorationPreview::setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size) + { + options->setCustomBorderSize(size); + if (plugin->factory()->reset(KDecorationDefines::SettingBorder) ) + { + // can't handle the change, recreate decorations then + recreateDecoration(plugin); + } + else + { + // handles the update, only update position... + positionPreviews(); + } + } + +void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const TQString &left, const TQString &right) + { + options->setCustomTitleButtonsEnabled(customEnabled); + options->setCustomTitleButtons(left, right); + if (plugin->factory()->reset(KDecorationDefines::SettingButtons) ) + { + // can't handle the change, recreate decorations then + recreateDecoration(plugin); + } + else + { + // handles the update, only update position... + positionPreviews(); + } + } + +TQRegion KDecorationPreview::unobscuredRegion( bool active, const TQRegion& r ) const + { + if( active ) // this one is not obscured + return r; + else + { + // copied from KWin core's code + TQRegion ret = r; + TQRegion r2 = mask; + if( r2.isEmpty()) + r2 = TQRegion( windowGeometry( true )); + r2.translate( windowGeometry( true ).x() - windowGeometry( false ).x(), + windowGeometry( true ).y() - windowGeometry( false ).y()); + ret -= r2; + return ret; + } + } + +KDecorationPreviewBridge::KDecorationPreviewBridge( KDecorationPreview* p, bool a ) + : preview( p ), active( a ) + { + } + +TQWidget* KDecorationPreviewBridge::initialParentWidget() const + { + return preview; + } + +Qt::WFlags KDecorationPreviewBridge::initialWFlags() const + { + return 0; + } + +bool KDecorationPreviewBridge::isActive() const + { + return active; + } + +bool KDecorationPreviewBridge::isCloseable() const + { + return true; + } + +bool KDecorationPreviewBridge::isMaximizable() const + { + return true; + } + +KDecoration::MaximizeMode KDecorationPreviewBridge::maximizeMode() const + { + return KDecoration::MaximizeRestore; + } + +bool KDecorationPreviewBridge::isMinimizable() const + { + return true; + } + +bool KDecorationPreviewBridge::providesContextHelp() const + { + return true; + } + +int KDecorationPreviewBridge::desktop() const + { + return 1; + } + +bool KDecorationPreviewBridge::isModal() const + { + return false; + } + +bool KDecorationPreviewBridge::isShadeable() const + { + return true; + } + +bool KDecorationPreviewBridge::isShade() const + { + return false; + } + +bool KDecorationPreviewBridge::isSetShade() const + { + return false; + } + +bool KDecorationPreviewBridge::keepAbove() const + { + return false; + } + +bool KDecorationPreviewBridge::keepBelow() const + { + return false; + } + +bool KDecorationPreviewBridge::isMovable() const + { + return true; + } + +bool KDecorationPreviewBridge::isResizable() const + { + return true; + } + +NET::WindowType KDecorationPreviewBridge::windowType( unsigned long ) const + { + return NET::Normal; + } + +TQIconSet KDecorationPreviewBridge::icon() const + { + return TQIconSet( KGlobal::iconLoader()->loadIcon( "xapp", KIcon::NoGroup, 16 ), + KGlobal::iconLoader()->loadIcon( "xapp", KIcon::NoGroup, 32 )); + } + +TQString KDecorationPreviewBridge::caption() const + { + return active ? i18n( "Active Window" ) : i18n( "Inactive Window" ); + } + +void KDecorationPreviewBridge::processMousePressEvent( TQMouseEvent* ) + { + } + +void KDecorationPreviewBridge::showWindowMenu( const TQRect &) + { + } + +void KDecorationPreviewBridge::showWindowMenu( TQPoint ) + { + } + +void KDecorationPreviewBridge::performWindowOperation( WindowOperation ) + { + } + +void KDecorationPreviewBridge::setMask( const TQRegion& reg, int mode ) + { + preview->setPreviewMask( reg, mode, active ); + } + +bool KDecorationPreviewBridge::isPreview() const + { + return true; + } + +TQRect KDecorationPreviewBridge::geometry() const + { + return preview->windowGeometry( active ); + } + +TQRect KDecorationPreviewBridge::iconGeometry() const + { + return TQRect(); + } + +TQRegion KDecorationPreviewBridge::unobscuredRegion( const TQRegion& r ) const + { + return preview->unobscuredRegion( active, r ); + } + +TQWidget* KDecorationPreviewBridge::workspaceWidget() const + { + return preview; + } + +WId KDecorationPreviewBridge::windowId() const + { + return 0; // no decorated window + } + +void KDecorationPreviewBridge::closeWindow() + { + } + +void KDecorationPreviewBridge::maximize( MaximizeMode ) + { + } + +void KDecorationPreviewBridge::minimize() + { + } + +void KDecorationPreviewBridge::showContextHelp() + { + } + +void KDecorationPreviewBridge::setDesktop( int ) + { + } + +void KDecorationPreviewBridge::titlebarDblClickOperation() + { + } + +void KDecorationPreviewBridge::titlebarMouseWheelOperation( int ) + { + } + +void KDecorationPreviewBridge::setShade( bool ) + { + } + +void KDecorationPreviewBridge::setKeepAbove( bool ) + { + } + +void KDecorationPreviewBridge::setKeepBelow( bool ) + { + } + +int KDecorationPreviewBridge::currentDesktop() const + { + return 1; + } + +void KDecorationPreviewBridge::helperShowHide( bool ) + { + } + +void KDecorationPreviewBridge::grabXServer( bool ) + { + } + +KDecorationPreviewOptions::KDecorationPreviewOptions() + { + customBorderSize = BordersCount; // invalid + customButtonsChanged = false; // invalid + customButtons = true; + customTitleButtonsLeft = TQString::null; // invalid + customTitleButtonsRight = TQString::null; // invalid + + d = new KDecorationOptionsPrivate; + d->defaultKWinSettings(); + updateSettings(); + } + +KDecorationPreviewOptions::~KDecorationPreviewOptions() + { + delete d; + } + +unsigned long KDecorationPreviewOptions::updateSettings() + { + KConfig cfg( "twinrc", true ); + unsigned long changed = 0; + changed |= d->updateKWinSettings( &cfg ); + + // set custom border size/buttons + if (customBorderSize != BordersCount) + d->border_size = customBorderSize; + if (customButtonsChanged) + d->custom_button_positions = customButtons; + if (customButtons) { + if (!customTitleButtonsLeft.isNull() ) + d->title_buttons_left = customTitleButtonsLeft; + if (!customTitleButtonsRight.isNull() ) + d->title_buttons_right = customTitleButtonsRight; + } else { + d->title_buttons_left = "MS"; + d->title_buttons_right = "HIAX"; + } + + return changed; + } + +void KDecorationPreviewOptions::setCustomBorderSize(BorderSize size) + { + customBorderSize = size; + + updateSettings(); + } + +void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled) +{ + customButtonsChanged = true; + customButtons = enabled; + + updateSettings(); +} + +void KDecorationPreviewOptions::setCustomTitleButtons(const TQString &left, const TQString &right) + { + customTitleButtonsLeft = left; + customTitleButtonsRight = right; + + updateSettings(); + } + +bool KDecorationPreviewPlugins::provides( Requirement ) + { + return false; + } + +#include "preview.moc" diff --git a/twin/kcmtwin/twindecoration/preview.h b/twin/kcmtwin/twindecoration/preview.h new file mode 100644 index 000000000..2a753db69 --- /dev/null +++ b/twin/kcmtwin/twindecoration/preview.h @@ -0,0 +1,150 @@ +/* + * + * Copyright (c) 2003 Lubos Lunak + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef KWINDECORATION_PREVIEW_H +#define KWINDECORATION_PREVIEW_H + +#include +#include +#include + +class TQLabel; + +class KDecorationPreviewBridge; +class KDecorationPreviewOptions; + +class KDecorationPreview + : public TQWidget + { + Q_OBJECT + public: + // Note: Windows can't be added or removed without making changes to + // the code, since parts of it assume there's just an active + // and an inactive window. + enum Windows { Inactive = 0, Active, NumWindows }; + + KDecorationPreview( TQWidget* parent = NULL, const char* name = NULL ); + virtual ~KDecorationPreview(); + bool recreateDecoration( KDecorationPlugins* plugin ); + void enablePreview(); + void disablePreview(); + void setPreviewMask( const TQRegion&, int, bool ); + TQRegion unobscuredRegion( bool, const TQRegion& ) const; + TQRect windowGeometry( bool ) const; + void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size); + void setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const TQString &left, const TQString &right); + protected: + virtual void resizeEvent( TQResizeEvent* ); + private: + void positionPreviews(); + KDecorationPreviewOptions* options; + KDecorationPreviewBridge* bridge[NumWindows]; + KDecoration* deco[NumWindows]; + TQLabel* no_preview; + TQRegion mask; + }; + +class KDecorationPreviewBridge + : public KDecorationBridge + { + public: + KDecorationPreviewBridge( KDecorationPreview* preview, bool active ); + virtual bool isActive() const; + virtual bool isCloseable() const; + virtual bool isMaximizable() const; + virtual MaximizeMode maximizeMode() const; + virtual bool isMinimizable() const; + virtual bool providesContextHelp() const; + virtual int desktop() const; + virtual bool isModal() const; + virtual bool isShadeable() const; + virtual bool isShade() const; + virtual bool isSetShade() const; + virtual bool keepAbove() const; + virtual bool keepBelow() const; + virtual bool isMovable() const; + virtual bool isResizable() const; + virtual NET::WindowType windowType( unsigned long supported_types ) const; + virtual TQIconSet icon() const; + virtual TQString caption() const; + virtual void processMousePressEvent( TQMouseEvent* ); + virtual void showWindowMenu( const TQRect &); + virtual void showWindowMenu( TQPoint ); + virtual void performWindowOperation( WindowOperation ); + virtual void setMask( const TQRegion&, int ); + virtual bool isPreview() const; + virtual TQRect geometry() const; + virtual TQRect iconGeometry() const; + virtual TQRegion unobscuredRegion( const TQRegion& r ) const; + virtual TQWidget* workspaceWidget() const; + virtual WId windowId() const; + virtual void closeWindow(); + virtual void maximize( MaximizeMode mode ); + virtual void minimize(); + virtual void showContextHelp(); + virtual void setDesktop( int desktop ); + virtual void titlebarDblClickOperation(); + virtual void titlebarMouseWheelOperation( int delta ); + virtual void setShade( bool set ); + virtual void setKeepAbove( bool ); + virtual void setKeepBelow( bool ); + virtual int currentDesktop() const; + virtual TQWidget* initialParentWidget() const; + virtual Qt::WFlags initialWFlags() const; + virtual void helperShowHide( bool show ); + virtual void grabXServer( bool grab ); + private: + KDecorationPreview* preview; + bool active; + }; + +class KDecorationPreviewOptions + : public KDecorationOptions + { + public: + KDecorationPreviewOptions(); + virtual ~KDecorationPreviewOptions(); + virtual unsigned long updateSettings(); + + void setCustomBorderSize(BorderSize size); + void setCustomTitleButtonsEnabled(bool enabled); + void setCustomTitleButtons(const TQString &left, const TQString &right); + + private: + BorderSize customBorderSize; + bool customButtonsChanged; + bool customButtons; + TQString customTitleButtonsLeft; + TQString customTitleButtonsRight; + }; + +class KDecorationPreviewPlugins + : public KDecorationPlugins + { + public: + KDecorationPreviewPlugins( KConfig* cfg ); + virtual bool provides( Requirement ); + }; + +inline KDecorationPreviewPlugins::KDecorationPreviewPlugins( KConfig* cfg ) + : KDecorationPlugins( cfg ) + { + } + +#endif diff --git a/twin/kcmtwin/twindecoration/twindecoration.cpp b/twin/kcmtwin/twindecoration/twindecoration.cpp new file mode 100644 index 000000000..4ef509e5a --- /dev/null +++ b/twin/kcmtwin/twindecoration/twindecoration.cpp @@ -0,0 +1,840 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2001 + Karol Szwed + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "twindecoration.h" +#include "preview.h" +#include +#include + +// KCModule plugin interface +// ========================= +typedef KGenericFactory KWinDecoFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_twindecoration, KWinDecoFactory("kcmtwindecoration") ) + +KWinDecorationModule::KWinDecorationModule(TQWidget* parent, const char* name, const TQStringList &) + : DCOPObject("KWinClientDecoration"), + KCModule(KWinDecoFactory::instance(), parent, name), + twinConfig("twinrc"), + pluginObject(0) +{ + twinConfig.setGroup("Style"); + plugins = new KDecorationPreviewPlugins( &twinConfig ); + + TQVBoxLayout* layout = new TQVBoxLayout(this, 0, KDialog::spacingHint()); + +// Save this for later... +// cbUseMiniWindows = new TQCheckBox( i18n( "Render mini &titlebars for all windows"), checkGroup ); +// TQWhatsThis::add( cbUseMiniWindows, i18n( "Note that this option is not available on all styles yet!" ) ); + + tabWidget = new TQTabWidget( this ); + layout->addWidget( tabWidget ); + + // Page 1 (General Options) + TQWidget *pluginPage = new TQWidget( tabWidget ); + + TQVBoxLayout* pluginLayout = new TQVBoxLayout(pluginPage, KDialog::marginHint(), KDialog::spacingHint()); + + // decoration chooser + decorationList = new KComboBox( pluginPage ); + TQString whatsThis = i18n("Select the window decoration. This is the look and feel of both " + "the window borders and the window handle."); + TQWhatsThis::add(decorationList, whatsThis); + pluginLayout->addWidget(decorationList); + + TQGroupBox *pluginSettingsGrp = new TQGroupBox( i18n("Decoration Options"), pluginPage ); + pluginSettingsGrp->setColumnLayout( 0, Qt::Vertical ); + pluginSettingsGrp->setFlat( true ); + pluginSettingsGrp->layout()->setMargin( 0 ); + pluginSettingsGrp->layout()->setSpacing( KDialog::spacingHint() ); + pluginLayout->addWidget( pluginSettingsGrp ); + + pluginLayout->addStretch(); + + // Border size chooser + lBorder = new TQLabel (i18n("B&order size:"), pluginSettingsGrp); + cBorder = new TQComboBox(pluginSettingsGrp); + lBorder->setBuddy(cBorder); + TQWhatsThis::add( cBorder, i18n( "Use this combobox to change the border size of the decoration." )); + lBorder->hide(); + cBorder->hide(); + TQHBoxLayout *borderSizeLayout = new TQHBoxLayout(pluginSettingsGrp->tqlayout() ); + borderSizeLayout->addWidget(lBorder); + borderSizeLayout->addWidget(cBorder); + borderSizeLayout->addStretch(); + + pluginConfigWidget = new TQVBox(pluginSettingsGrp); + pluginSettingsGrp->tqlayout()->add( pluginConfigWidget ); + + // Page 2 (Button Selector) + TQWidget* buttonPage = new TQWidget( tabWidget ); + TQVBoxLayout* buttonLayout = new TQVBoxLayout(buttonPage, KDialog::marginHint(), KDialog::spacingHint()); + + cbShowToolTips = new TQCheckBox( + i18n("&Show window button tooltips"), buttonPage ); + TQWhatsThis::add( cbShowToolTips, + i18n( "Enabling this checkbox will show window button tooltips. " + "If this checkbox is off, no window button tooltips will be shown.")); + + cbUseCustomButtonPositions = new TQCheckBox( + i18n("Use custom titlebar button &positions"), buttonPage ); + TQWhatsThis::add( cbUseCustomButtonPositions, + i18n( "The appropriate settings can be found in the \"Buttons\" Tab; " + "please note that this option is not available on all styles yet." ) ); + + buttonLayout->addWidget( cbShowToolTips ); + buttonLayout->addWidget( cbUseCustomButtonPositions ); + + // Add nifty dnd button modification widgets + buttonPositionWidget = new ButtonPositionWidget(buttonPage, "button_position_widget"); + buttonPositionWidget->setDecorationFactory(plugins->factory() ); + TQHBoxLayout* buttonControlLayout = new TQHBoxLayout(buttonLayout); + buttonControlLayout->addSpacing(20); + buttonControlLayout->addWidget(buttonPositionWidget); +// buttonLayout->addStretch(); + + // preview + TQVBoxLayout* previewLayout = new TQVBoxLayout(layout, KDialog::spacingHint() ); + previewLayout->setMargin( KDialog::marginHint() ); + + preview = new KDecorationPreview( this ); + previewLayout->addWidget(preview); + + preview->tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); + tabWidget->tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Maximum); + + // Page 3 (Window Shadows) + TQHBox *inactiveShadowColourHBox, *shadowColourHBox; + TQHBox *inactiveShadowOpacityHBox, *shadowOpacityHBox; + TQHBox *inactiveShadowXOffsetHBox, *shadowXOffsetHBox; + TQHBox *inactiveShadowYOffsetHBox, *shadowYOffsetHBox; + TQHBox *inactiveShadowThicknessHBox, *shadowThicknessHBox; + TQLabel *inactiveShadowColourLabel, *shadowColourLabel; + TQLabel *inactiveShadowOpacityLabel, *shadowOpacityLabel; + TQLabel *inactiveShadowXOffsetLabel, *shadowXOffsetLabel; + TQLabel *inactiveShadowYOffsetLabel, *shadowYOffsetLabel; + TQLabel *inactiveShadowThicknessLabel, *shadowThicknessLabel; + + shadowPage = new TQVBox(tabWidget); + shadowPage->setSpacing(KDialog::spacingHint()); + shadowPage->setMargin(KDialog::marginHint()); + + cbWindowShadow = new TQCheckBox( + i18n("&Draw a drop shadow under windows"), shadowPage); + TQWhatsThis::add(cbWindowShadow, + i18n("Enabling this checkbox will allow you to choose a kind of " + "drop shadow to draw under each window.")); + + activeShadowSettings = new TQGroupBox(1, Qt::Horizontal, + i18n("Active Window Shadow"), shadowPage); + inactiveShadowSettings = new TQGroupBox(1, Qt::Horizontal, + i18n("Inactive Window Shadows"), shadowPage); + whichShadowSettings = new TQGroupBox(3, Qt::Horizontal, + i18n("Draw Shadow Under Normal Windows And..."), shadowPage); + + cbShadowDocks = new TQCheckBox(i18n("Docks and &panels"), + whichShadowSettings); + connect(cbShadowDocks, TQT_SIGNAL(toggled(bool)), + TQT_SLOT(slotSelectionChanged())); + cbShadowOverrides = new TQCheckBox(i18n("O&verride windows"), + whichShadowSettings); + connect(cbShadowOverrides, TQT_SIGNAL(toggled(bool)), + TQT_SLOT(slotSelectionChanged())); + cbShadowTopMenus = new TQCheckBox(i18n("&Top menu"), + whichShadowSettings); + connect(cbShadowTopMenus, TQT_SIGNAL(toggled(bool)), + TQT_SLOT(slotSelectionChanged())); + cbInactiveShadow = new TQCheckBox( + i18n("Draw shadow under &inactive windows"), inactiveShadowSettings); + connect(cbInactiveShadow, TQT_SIGNAL(toggled(bool)), + TQT_SLOT(slotSelectionChanged())); + + shadowColourHBox = new TQHBox(activeShadowSettings); + shadowColourHBox->setSpacing(KDialog::spacingHint()); + shadowColourLabel = new TQLabel(i18n("Colour:"), shadowColourHBox); + shadowColourButton = new KColorButton(shadowColourHBox); + connect(shadowColourButton, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotSelectionChanged())); + + inactiveShadowColourHBox = new TQHBox(inactiveShadowSettings); + inactiveShadowColourHBox->setSpacing(KDialog::spacingHint()); + inactiveShadowColourLabel = new TQLabel(i18n("Colour:"), inactiveShadowColourHBox); + inactiveShadowColourButton = new KColorButton(inactiveShadowColourHBox); + connect(inactiveShadowColourButton, TQT_SIGNAL(changed(const TQColor &)), TQT_SLOT(slotSelectionChanged())); + + shadowOpacityHBox = new TQHBox(activeShadowSettings); + shadowOpacityHBox->setSpacing(KDialog::spacingHint()); + shadowOpacityLabel = new TQLabel(i18n("Maximum opacity:"), shadowOpacityHBox); + shadowOpacitySlider = new TQSlider(1, 100, 10, 50, Qt::Horizontal, + shadowOpacityHBox); + shadowOpacitySlider->setTickmarks(TQSlider::Below); + shadowOpacitySlider->setTickInterval(10); + shadowOpacitySpinBox = new TQSpinBox(1, 100, 1, shadowOpacityHBox); + shadowOpacitySpinBox->setSuffix(" %"); + connect(shadowOpacitySlider, TQT_SIGNAL(valueChanged(int)), shadowOpacitySpinBox, + TQT_SLOT(setValue(int))); + connect(shadowOpacitySpinBox, TQT_SIGNAL(valueChanged(int)), shadowOpacitySlider, + TQT_SLOT(setValue(int))); + connect(shadowOpacitySlider, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + inactiveShadowOpacityHBox = new TQHBox(inactiveShadowSettings); + inactiveShadowOpacityHBox->setSpacing(KDialog::spacingHint()); + inactiveShadowOpacityLabel = new TQLabel(i18n("Maximum opacity:"), + inactiveShadowOpacityHBox); + inactiveShadowOpacitySlider = new TQSlider(1, 100, 10, 50, Qt::Horizontal, + inactiveShadowOpacityHBox); + inactiveShadowOpacitySlider->setTickmarks(TQSlider::Below); + inactiveShadowOpacitySlider->setTickInterval(10); + inactiveShadowOpacitySpinBox = new TQSpinBox(1, 100, 1, + inactiveShadowOpacityHBox); + inactiveShadowOpacitySpinBox->setSuffix(" %"); + connect(inactiveShadowOpacitySlider, TQT_SIGNAL(valueChanged(int)), + inactiveShadowOpacitySpinBox, + TQT_SLOT(setValue(int))); + connect(inactiveShadowOpacitySpinBox, TQT_SIGNAL(valueChanged(int)), + inactiveShadowOpacitySlider, + TQT_SLOT(setValue(int))); + connect(inactiveShadowOpacitySlider, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + shadowXOffsetHBox = new TQHBox(activeShadowSettings); + shadowXOffsetHBox->setSpacing(KDialog::spacingHint()); + shadowXOffsetLabel = new TQLabel( + i18n("Offset rightward (may be negative):"), + shadowXOffsetHBox); + shadowXOffsetSpinBox = new TQSpinBox(-1024, 1024, 1, shadowXOffsetHBox); + shadowXOffsetSpinBox->setSuffix(i18n(" pixels")); + connect(shadowXOffsetSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + inactiveShadowXOffsetHBox = new TQHBox(inactiveShadowSettings); + inactiveShadowXOffsetHBox->setSpacing(KDialog::spacingHint()); + inactiveShadowXOffsetLabel = new TQLabel( + i18n("Offset rightward (may be negative):"), + inactiveShadowXOffsetHBox); + inactiveShadowXOffsetSpinBox = new TQSpinBox(-1024, 1024, 1, + inactiveShadowXOffsetHBox); + inactiveShadowXOffsetSpinBox->setSuffix(i18n(" pixels")); + connect(inactiveShadowXOffsetSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + shadowYOffsetHBox = new TQHBox(activeShadowSettings); + shadowYOffsetHBox->setSpacing(KDialog::spacingHint()); + shadowYOffsetLabel = new TQLabel( + i18n("Offset downward (may be negative):"), + shadowYOffsetHBox); + shadowYOffsetSpinBox = new TQSpinBox(-1024, 1024, 1, shadowYOffsetHBox); + shadowYOffsetSpinBox->setSuffix(i18n(" pixels")); + connect(shadowYOffsetSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + inactiveShadowYOffsetHBox = new TQHBox(inactiveShadowSettings); + inactiveShadowYOffsetHBox->setSpacing(KDialog::spacingHint()); + inactiveShadowYOffsetLabel = new TQLabel( + i18n("Offset downward (may be negative):"), + inactiveShadowYOffsetHBox); + inactiveShadowYOffsetSpinBox = new TQSpinBox(-1024, 1024, 1, + inactiveShadowYOffsetHBox); + inactiveShadowYOffsetSpinBox->setSuffix(i18n(" pixels")); + connect(inactiveShadowYOffsetSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + shadowThicknessHBox = new TQHBox(activeShadowSettings); + shadowThicknessHBox->setSpacing(KDialog::spacingHint()); + shadowThicknessLabel = new TQLabel( + i18n("Thickness to either side of window:"), + shadowThicknessHBox); + shadowThicknessSpinBox = new TQSpinBox(1, 100, 1, + shadowThicknessHBox); + shadowThicknessSpinBox->setSuffix(i18n(" pixels")); + connect(shadowThicknessSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + inactiveShadowThicknessHBox = new TQHBox(inactiveShadowSettings); + inactiveShadowThicknessHBox->setSpacing(KDialog::spacingHint()); + inactiveShadowThicknessLabel = new TQLabel( + i18n("Thickness to either side of window:"), + inactiveShadowThicknessHBox); + inactiveShadowThicknessSpinBox = new TQSpinBox(1, 100, 1, + inactiveShadowThicknessHBox); + inactiveShadowThicknessSpinBox->setSuffix(i18n(" pixels")); + connect(inactiveShadowThicknessSpinBox, TQT_SIGNAL(valueChanged(int)), + TQT_SLOT(slotSelectionChanged())); + + // Load all installed decorations into memory + // Set up the decoration lists and other UI settings + findDecorations(); + createDecorationList(); + readConfig( &twinConfig ); + resetPlugin( &twinConfig ); + + tabWidget->insertTab( pluginPage, i18n("&Window Decoration") ); + tabWidget->insertTab( buttonPage, i18n("&Buttons") ); + tabWidget->insertTab( shadowPage, i18n("&Shadows") ); + + connect( buttonPositionWidget, TQT_SIGNAL(changed()), this, TQT_SLOT(slotButtonsChanged()) ); // update preview etc. + connect( buttonPositionWidget, TQT_SIGNAL(changed()), this, TQT_SLOT(slotSelectionChanged()) ); // emit changed()... + connect( decorationList, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotSelectionChanged()) ); + connect( decorationList, TQT_SIGNAL(activated(const TQString&)), + TQT_SLOT(slotChangeDecoration(const TQString&)) ); + connect( cbUseCustomButtonPositions, TQT_SIGNAL(clicked()), TQT_SLOT(slotSelectionChanged()) ); + connect(cbUseCustomButtonPositions, TQT_SIGNAL(toggled(bool)), buttonPositionWidget, TQT_SLOT(setEnabled(bool))); + connect(cbUseCustomButtonPositions, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotButtonsChanged()) ); + connect(cbWindowShadow, TQT_SIGNAL(toggled(bool)), activeShadowSettings, TQT_SLOT(setEnabled(bool))); + connect(cbWindowShadow, TQT_SIGNAL(toggled(bool)), inactiveShadowSettings, TQT_SLOT(setEnabled(bool))); + connect(cbWindowShadow, TQT_SIGNAL(toggled(bool)), whichShadowSettings, TQT_SLOT(setEnabled(bool))); + + connect( cbShowToolTips, TQT_SIGNAL(clicked()), TQT_SLOT(slotSelectionChanged()) ); + connect( cbWindowShadow, TQT_SIGNAL(clicked()), TQT_SLOT(slotSelectionChanged()) ); + connect( cBorder, TQT_SIGNAL( activated( int )), TQT_SLOT( slotBorderChanged( int ))); +// connect( cbUseMiniWindows, TQT_SIGNAL(clicked()), TQT_SLOT(slotSelectionChanged()) ); + + // Allow twin dcop signal to update our selection list + connectDCOPSignal("twin", 0, "dcopResetAllClients()", "dcopUpdateClientList()", false); + + KAboutData *about = + new KAboutData(I18N_NOOP("kcmtwindecoration"), + I18N_NOOP("Window Decoration Control Module"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 2001 Karol Szwed")); + about->addAuthor("Karol Szwed", 0, "gallium@kde.org"); + setAboutData(about); +} + + +KWinDecorationModule::~KWinDecorationModule() +{ + delete preview; // needs to be destroyed before plugins + delete plugins; +} + + +// Find all theme desktop files in all 'data' dirs owned by twin. +// And insert these into a DecorationInfo structure +void KWinDecorationModule::findDecorations() +{ + TQStringList dirList = KGlobal::dirs()->findDirs("data", "twin"); + TQStringList::ConstIterator it; + + for (it = dirList.begin(); it != dirList.end(); it++) + { + TQDir d(*it); + if (d.exists()) + for (TQFileInfoListIterator it(*d.entryInfoList()); it.current(); ++it) + { + TQString filename(it.current()->absFilePath()); + if (KDesktopFile::isDesktopFile(filename)) + { + KDesktopFile desktopFile(filename); + TQString libName = desktopFile.readEntry("X-KDE-Library"); + + if (!libName.isEmpty() && libName.startsWith( "twin3_" )) + { + DecorationInfo di; + di.name = desktopFile.readName(); + di.libraryName = libName; + decorations.append( di ); + } + } + } + } +} + + +// Fills the decorationList with a list of available twin decorations +void KWinDecorationModule::createDecorationList() +{ + TQValueList::ConstIterator it; + + // Sync with twin hardcoded KDE2 style which has no desktop item + TQStringList decorationNames; + decorationNames.append( i18n("KDE 2") ); + for (it = decorations.begin(); it != decorations.end(); ++it) + { + decorationNames.append((*it).name); + } + decorationNames.sort(); + decorationList->insertStringList(decorationNames); +} + + +// Reset the decoration plugin to what the user just selected +void KWinDecorationModule::slotChangeDecoration( const TQString & text) +{ + KConfig twinConfig("twinrc"); + twinConfig.setGroup("Style"); + + // Let the user see config options for the currently selected decoration + resetPlugin( &twinConfig, text ); +} + + +// This is the selection handler setting +void KWinDecorationModule::slotSelectionChanged() +{ + emit KCModule::changed(true); +} + +static const char* const border_names[ KDecorationDefines::BordersCount ] = + { + I18N_NOOP( "Tiny" ), + I18N_NOOP( "Normal" ), + I18N_NOOP( "Large" ), + I18N_NOOP( "Very Large" ), + I18N_NOOP( "Huge" ), + I18N_NOOP( "Very Huge" ), + I18N_NOOP( "Oversized" ) + }; + +int KWinDecorationModule::borderSizeToIndex( BorderSize size, TQValueList< BorderSize > sizes ) +{ + int pos = 0; + for( TQValueList< BorderSize >::ConstIterator it = sizes.begin(); + it != sizes.end(); + ++it, ++pos ) + if( size <= *it ) + break; + return pos; +} + +KDecorationDefines::BorderSize KWinDecorationModule::indexToBorderSize( int index, + TQValueList< BorderSize > sizes ) +{ + TQValueList< BorderSize >::ConstIterator it = sizes.begin(); + for(; + it != sizes.end(); + ++it, --index ) + if( index == 0 ) + break; + return *it; +} + +void KWinDecorationModule::slotBorderChanged( int size ) +{ + if( lBorder->isHidden()) + return; + emit KCModule::changed( true ); + TQValueList< BorderSize > sizes; + if( plugins->factory() != NULL ) + sizes = plugins->factory()->borderSizes(); + assert( sizes.count() >= 2 ); + border_size = indexToBorderSize( size, sizes ); + + // update preview + preview->setTempBorderSize(plugins, border_size); +} + +void KWinDecorationModule::slotButtonsChanged() +{ + // update preview + preview->setTempButtons(plugins, cbUseCustomButtonPositions->isChecked(), buttonPositionWidget->buttonsLeft(), buttonPositionWidget->buttonsRight() ); +} + +TQString KWinDecorationModule::decorationName( TQString& libName ) +{ + TQString decoName; + + TQValueList::Iterator it; + for( it = decorations.begin(); it != decorations.end(); ++it ) + if ( (*it).libraryName == libName ) + { + decoName = (*it).name; + break; + } + + return decoName; +} + + +TQString KWinDecorationModule::decorationLibName( const TQString& name ) +{ + TQString libName; + + // Find the corresponding library name to that of + // the current plugin name + TQValueList::Iterator it; + for( it = decorations.begin(); it != decorations.end(); ++it ) + if ( (*it).name == name ) + { + libName = (*it).libraryName; + break; + } + + if (libName.isEmpty()) + libName = "twin_default"; // KDE 2 + + return libName; +} + + +// Loads/unloads and inserts the decoration config plugin into the +// pluginConfigWidget, allowing for dynamic configuration of decorations +void KWinDecorationModule::resetPlugin( KConfig* conf, const TQString& currentDecoName ) +{ + // Config names are "twin_icewm_config" + // for "twin3_icewm" twin client + + TQString oldName = styleToConfigLib( oldLibraryName ); + + TQString currentName; + if (!currentDecoName.isEmpty()) + currentName = decorationLibName( currentDecoName ); // Use what the user selected + else + currentName = currentLibraryName; // Use what was read from readConfig() + + if( plugins->loadPlugin( currentName ) + && preview->recreateDecoration( plugins )) + preview->enablePreview(); + else + preview->disablePreview(); + plugins->destroyPreviousPlugin(); + + checkSupportedBorderSizes(); + + // inform buttonPositionWidget about the new factory... + buttonPositionWidget->setDecorationFactory(plugins->factory() ); + + currentName = styleToConfigLib( currentName ); + + // Delete old plugin widget if it exists + delete pluginObject; + pluginObject = 0; + + // Use klibloader for library manipulation + KLibLoader* loader = KLibLoader::self(); + + // Free the old library if possible + if (!oldLibraryName.isNull()) + loader->unloadLibrary( TQFile::encodeName(oldName) ); + + KLibrary* library = loader->library( TQFile::encodeName(currentName) ); + if (library != NULL) + { + void* alloc_ptr = library->symbol("allocate_config"); + + if (alloc_ptr != NULL) + { + allocatePlugin = (TQObject* (*)(KConfig* conf, TQWidget* parent))alloc_ptr; + pluginObject = (TQObject*)(allocatePlugin( conf, pluginConfigWidget )); + + // connect required signals and slots together... + connect( pluginObject, TQT_SIGNAL(changed()), this, TQT_SLOT(slotSelectionChanged()) ); + connect( this, TQT_SIGNAL(pluginLoad(KConfig*)), pluginObject, TQT_SLOT(load(KConfig*)) ); + connect( this, TQT_SIGNAL(pluginSave(KConfig*)), pluginObject, TQT_SLOT(save(KConfig*)) ); + connect( this, TQT_SIGNAL(pluginDefaults()), pluginObject, TQT_SLOT(defaults()) ); + pluginConfigWidget->show(); + return; + } + } + + pluginConfigWidget->hide(); +} + + +// Reads the twin config settings, and sets all UI controls to those settings +// Updating the config plugin if required +void KWinDecorationModule::readConfig( KConfig* conf ) +{ + // General tab + // ============ + cbShowToolTips->setChecked( conf->readBoolEntry("ShowToolTips", true )); +// cbUseMiniWindows->setChecked( conf->readBoolEntry("MiniWindowBorders", false)); + + // Find the corresponding decoration name to that of + // the current plugin library name + + oldLibraryName = currentLibraryName; + currentLibraryName = conf->readEntry("PluginLib", + ((TQPixmap::defaultDepth() > 8) ? "twin_plastik" : "twin_quartz")); + TQString decoName = decorationName( currentLibraryName ); + + // If we are using the "default" kde client, use the "default" entry. + if (decoName.isEmpty()) + decoName = i18n("KDE 2"); + + int numDecos = decorationList->count(); + for (int i = 0; i < numDecos; ++i) + { + if (decorationList->text(i) == decoName) + { + decorationList->setCurrentItem(i); + break; + } + } + + // Buttons tab + // ============ + bool customPositions = conf->readBoolEntry("CustomButtonPositions", false); + cbUseCustomButtonPositions->setChecked( customPositions ); + buttonPositionWidget->setEnabled( customPositions ); + // Menu and onAllDesktops buttons are default on LHS + buttonPositionWidget->setButtonsLeft( conf->readEntry("ButtonsOnLeft", "MS") ); + // Help, Minimize, Maximize and Close are default on RHS + buttonPositionWidget->setButtonsRight( conf->readEntry("ButtonsOnRight", "HIAX") ); + + int bsize = conf->readNumEntry( "BorderSize", BorderNormal ); + if( bsize >= BorderTiny && bsize < BordersCount ) + border_size = static_cast< BorderSize >( bsize ); + else + border_size = BorderNormal; + checkSupportedBorderSizes(); + + // Shadows tab + // =========== + bool shadowEnabled = conf->readBoolEntry("ShadowEnabled", false); + cbWindowShadow->setChecked(shadowEnabled); + activeShadowSettings->setEnabled(shadowEnabled); + inactiveShadowSettings->setEnabled(shadowEnabled); + whichShadowSettings->setEnabled(shadowEnabled); + shadowColourButton->setColor(conf->readColorEntry("ShadowColour", &TQt::black)); + shadowOpacitySlider->setValue((int)ceil(conf->readDoubleNumEntry("ShadowOpacity", 0.70) * 100)); + shadowXOffsetSpinBox->setValue(conf->readNumEntry("ShadowXOffset", 0)); + shadowYOffsetSpinBox->setValue(conf->readNumEntry("ShadowYOffset", 10)); + cbShadowDocks->setChecked(conf->readBoolEntry("ShadowDocks", false)); + cbShadowOverrides->setChecked(conf->readBoolEntry("ShadowOverrides", false)); + cbShadowTopMenus->setChecked(conf->readBoolEntry("ShadowTopMenus", false)); + shadowThicknessSpinBox->setValue(conf->readNumEntry("ShadowThickness", 10)); + cbInactiveShadow->setChecked(conf->readBoolEntry("InactiveShadowEnabled", false)); + inactiveShadowColourButton->setColor(conf->readColorEntry("InactiveShadowColour", &TQt::black)); + inactiveShadowOpacitySlider->setValue((int)ceil(conf->readDoubleNumEntry("InactiveShadowOpacity", 0.70) * 100)); + inactiveShadowXOffsetSpinBox->setValue(conf->readNumEntry("InactiveShadowXOffset", 0)); + inactiveShadowYOffsetSpinBox->setValue(conf->readNumEntry("InactiveShadowYOffset", 5)); + inactiveShadowThicknessSpinBox->setValue(conf->readNumEntry("InactiveShadowThickness", 5)); + + emit KCModule::changed(false); +} + + +// Writes the selected user configuration to the twin config file +void KWinDecorationModule::writeConfig( KConfig* conf ) +{ + TQString name = decorationList->currentText(); + TQString libName = decorationLibName( name ); + + KConfig twinConfig("twinrc"); + twinConfig.setGroup("Style"); + + // General settings + conf->writeEntry("PluginLib", libName); + conf->writeEntry("CustomButtonPositions", cbUseCustomButtonPositions->isChecked()); + conf->writeEntry("ShowToolTips", cbShowToolTips->isChecked()); +// conf->writeEntry("MiniWindowBorders", cbUseMiniWindows->isChecked()); + + // Button settings + conf->writeEntry("ButtonsOnLeft", buttonPositionWidget->buttonsLeft() ); + conf->writeEntry("ButtonsOnRight", buttonPositionWidget->buttonsRight() ); + conf->writeEntry("BorderSize", border_size ); + + // Shadow settings + conf->writeEntry("ShadowEnabled", cbWindowShadow->isChecked()); + conf->writeEntry("ShadowColour", shadowColourButton->color()); + conf->writeEntry("ShadowOpacity", shadowOpacitySlider->value() / 100.0); + conf->writeEntry("ShadowXOffset", shadowXOffsetSpinBox->value()); + conf->writeEntry("ShadowYOffset", shadowYOffsetSpinBox->value()); + conf->writeEntry("ShadowThickness", shadowThicknessSpinBox->value()); + conf->writeEntry("ShadowDocks", cbShadowDocks->isChecked()); + conf->writeEntry("ShadowOverrides", cbShadowOverrides->isChecked()); + conf->writeEntry("ShadowTopMenus", cbShadowTopMenus->isChecked()); + conf->writeEntry("InactiveShadowEnabled", cbInactiveShadow->isChecked()); + conf->writeEntry("InactiveShadowColour", inactiveShadowColourButton->color()); + conf->writeEntry("InactiveShadowOpacity", + inactiveShadowOpacitySlider->value() / 100.0); + conf->writeEntry("InactiveShadowXOffset", + inactiveShadowXOffsetSpinBox->value()); + conf->writeEntry("InactiveShadowYOffset", + inactiveShadowYOffsetSpinBox->value()); + conf->writeEntry("InactiveShadowThickness", + inactiveShadowThicknessSpinBox->value()); + + oldLibraryName = currentLibraryName; + currentLibraryName = libName; + + // We saved, so tell kcmodule that there have been no new user changes made. + emit KCModule::changed(false); +} + + +void KWinDecorationModule::dcopUpdateClientList() +{ + // Changes the current active ListBox item, and + // Loads a new plugin configuration tab if required. + KConfig twinConfig("twinrc"); + twinConfig.setGroup("Style"); + + readConfig( &twinConfig ); + resetPlugin( &twinConfig ); +} + + +// Virutal functions required by KCModule +void KWinDecorationModule::load() +{ + KConfig twinConfig("twinrc"); + twinConfig.setGroup("Style"); + + // Reset by re-reading the config + readConfig( &twinConfig ); + resetPlugin( &twinConfig ); +} + + +void KWinDecorationModule::save() +{ + KConfig twinConfig("twinrc"); + twinConfig.setGroup("Style"); + + writeConfig( &twinConfig ); + emit pluginSave( &twinConfig ); + + twinConfig.sync(); + resetKWin(); + // resetPlugin() will get called via the above DCOP function +} + + +void KWinDecorationModule::defaults() +{ + // Set the KDE defaults + cbUseCustomButtonPositions->setChecked( false ); + buttonPositionWidget->setEnabled( false ); + cbShowToolTips->setChecked( true ); + cbWindowShadow->setChecked( false ); +// cbUseMiniWindows->setChecked( false); +// Don't set default for now +// decorationList->setSelected( +// decorationList->findItem( i18n("KDE 2") ), true ); // KDE classic client + + buttonPositionWidget->setButtonsLeft("MS"); + buttonPositionWidget->setButtonsRight("HIAX"); + + border_size = BorderNormal; + checkSupportedBorderSizes(); + + shadowColourButton->setColor(Qt::black); + shadowOpacitySlider->setValue(70); + shadowXOffsetSpinBox->setValue(0); + shadowYOffsetSpinBox->setValue(10); + shadowThicknessSpinBox->setValue(10); + cbShadowDocks->setChecked(false); + cbShadowOverrides->setChecked(false); + cbShadowTopMenus->setChecked(false); + cbInactiveShadow->setChecked(false); + inactiveShadowColourButton->setColor(Qt::black); + inactiveShadowOpacitySlider->setValue(70); + inactiveShadowXOffsetSpinBox->setValue(0); + inactiveShadowYOffsetSpinBox->setValue(5); + inactiveShadowThicknessSpinBox->setValue(5); + + // Set plugin defaults + emit pluginDefaults(); +} + +void KWinDecorationModule::checkSupportedBorderSizes() +{ + TQValueList< BorderSize > sizes; + if( plugins->factory() != NULL ) + sizes = plugins->factory()->borderSizes(); + if( sizes.count() < 2 ) { + lBorder->hide(); + cBorder->hide(); + } else { + cBorder->clear(); + for (TQValueList::const_iterator it = sizes.begin(); it != sizes.end(); ++it) { + BorderSize size = *it; + cBorder->insertItem(i18n(border_names[size]), borderSizeToIndex(size,sizes) ); + } + int pos = borderSizeToIndex( border_size, sizes ); + lBorder->show(); + cBorder->show(); + cBorder->setCurrentItem(pos); + slotBorderChanged( pos ); + } +} + +TQString KWinDecorationModule::styleToConfigLib( TQString& styleLib ) +{ + if( styleLib.startsWith( "twin3_" )) + return "twin_" + styleLib.mid( 6 ) + "_config"; + else + return styleLib + "_config"; +} + +TQString KWinDecorationModule::quickHelp() const +{ + return i18n( "

Window Manager Decoration

" + "

This module allows you to choose the window border decorations, " + "as well as titlebar button positions and custom decoration options.

" + "To choose a theme for your window decoration click on its name and apply your choice by clicking the \"Apply\" button below." + " If you do not want to apply your choice you can click the \"Reset\" button to discard your changes." + "

You can configure each theme in the \"Configure [...]\" tab. There are different options specific for each theme.

" + "

In \"General Options (if available)\" you can activate the \"Buttons\" tab by checking the \"Use custom titlebar button positions\" box." + " In the \"Buttons\" tab you can change the positions of the buttons to your liking.

" ); +} + + +void KWinDecorationModule::resetKWin() +{ + bool ok = kapp->dcopClient()->send("twin*", "KWinInterface", + "reconfigure()", TQByteArray()); + if (!ok) + kdDebug() << "kcmtwindecoration: Could not reconfigure twin" << endl; +} + +#include "twindecoration.moc" +// vim: ts=4 +// kate: space-indent off; tab-width 4; + diff --git a/twin/kcmtwin/twindecoration/twindecoration.desktop b/twin/kcmtwin/twindecoration/twindecoration.desktop new file mode 100644 index 000000000..dc1e55ef6 --- /dev/null +++ b/twin/kcmtwin/twindecoration/twindecoration.desktop @@ -0,0 +1,231 @@ +[Desktop Entry] +Exec=kcmshell twindecoration +Icon=kcmkwm +Type=Application +DocPath=kcontrol/twindecoration/index.html + +X-KDE-ModuleType=Library +X-KDE-Library=twindecoration +X-KDE-FactoryName=twindecoration + +Name=Window Decorations +Name[af]=Venster Versierings +Name[ar]=زخرفة النافذة +Name[be]=Дэкарацыі вокнаў +Name[bg]=Декорация +Name[bn]=উইণ্ডো সাজসজ্জা +Name[br]=Kinkladur ar prenester +Name[bs]=Ukrasi prozora +Name[ca]=Decoració de les finestres +Name[cs]=Dekorace oken +Name[csb]=Dekòracëje òkna +Name[cy]=Addurniadau Ffenestr +Name[da]=Vinduesdekorationer +Name[de]=Fensterdekorationen +Name[el]=Διακοσμήσεις παραθύρων +Name[eo]=Fenestro-ornamaĵo +Name[es]=Decoración de ventanas +Name[et]=Akna dekoratsioonid +Name[eu]=Leihoaren dekorazioak +Name[fa]=تزئینات پنجره +Name[fi]=Ikkunoiden kehykset +Name[fr]=Décoration des fenêtres +Name[fy]=Finsterdekoraasjes +Name[gl]=Decoracións das Fiestras +Name[he]=קישוטי חלונות +Name[hi]=विंडो सजावट +Name[hr]=Ukrasi prozora +Name[hu]=Ablakkeret-stílus +Name[id]=Dekorasi Jendela +Name[is]=Gluggaskreytingar +Name[it]=Decorazioni finestra +Name[ja]=ウィンドウ装飾 +Name[ka]=ფანჯრის დეკორაცია +Name[kk]=Терезе безендіруі +Name[km]=ការ​តុបតែង​បង្អួច +Name[ko]=창 종료 도구 +Name[lo]=ການຕົກແຕ່ງຫນ້າຕ່າງ +Name[lt]=Langų išvaizda +Name[lv]=Loga Dekorācijas +Name[mk]=Декорации на прозорците +Name[mn]=Цонхны засал +Name[mt]=Dekorazzjoni tal-Windows +Name[nb]=Vinduspynt +Name[nds]=Finsterdekoratschoon +Name[ne]=सञ्झ्याल सजावट +Name[nl]=Vensterdecoraties +Name[nn]=Vindaugsdekorasjonar +Name[nso]=Dikgabiso tsa Window +Name[pa]=ਝਰੋਖਾ ਸਜਾਵਟ +Name[pl]=Dekoracje okna +Name[pt]=Decorações das Janelas +Name[pt_BR]=Decorações da Janela +Name[ro]=Decorări +Name[ru]=Декорации окон +Name[rw]=Imitako y'Idirishya +Name[se]=Lásehearvvat +Name[sk]=Dekorácie okien +Name[sl]=Okraski oken +Name[sr]=Декорација прозора +Name[sr@Latn]=Dekoracija prozora +Name[ss]=Kuhlotjiswa kweliwindi +Name[sv]=Fönsterdekoration +Name[ta]=சாளர அலங்கரிப்புகள் +Name[tg]=Декоратсияҳои тиреза +Name[th]=ตกแต่งหน้าต่าง +Name[tr]=Pencere Dekorasyonları +Name[tt]=Täräzä Bizäge +Name[uk]=Обрамлення вікон +Name[uz]=Oynaning bezaklari +Name[uz@cyrillic]=Ойнанинг безаклари +Name[ven]=U khavhisedza ha windo +Name[vi]=Trang trí Cửa sổ +Name[wa]=Gåliotaedjes des purneas +Name[xh]=Izihombiso zeWindow +Name[zh_CN]=窗口装饰 +Name[zh_TW]=視窗裝飾 +Name[zu]=Imihlobiso ye-window + +Comment=Configure the look and feel of window titles +Comment[af]=Stel die uitdrukking en gevoek van venster titels op +Comment[ar]=إعداد شكل و ملمس عنوان النافذة +Comment[be]=Настаўленні вонкавага выгляду загалоўкаў вокнаў +Comment[bg]=Настройване външния вид на прозорците +Comment[bn]=উইণ্ডো শিরোনামের চেহারা কনফিগার করুন +Comment[br]=Kefluniañ neuz ha feson titloù ar prenester +Comment[bs]=Ovdje možete podesiti izgled i ponašanje naslova prozora +Comment[ca]=Configura l'aspecte i efecte dels títols de la finestra +Comment[cs]=Nastavení vzhledu a dekorací oken +Comment[csb]=Kònfigùracëjô wëzdrzatkù ë ùchòwaniô titlowi lëstwë òknów +Comment[cy]=Ffurfweddu golwg a theimlad teitlau ffenestri +Comment[da]=Indstil udseendet af vinduestitler +Comment[de]=Das Erscheinungsbild von Fenstertiteln festlegen +Comment[el]=Ρυθμίστε την εμφάνιση και την αίσθηση των τίτλων παραθύρου +Comment[eo]=Agordu la fenestrajn titolojn +Comment[es]=Configuración del aspecto y comportamiento de los títulos de las ventanas +Comment[et]=Akna tiitliribade välimuse ja tunnetuse seadistamine +Comment[eu]=Konfiguratu leihoaren izenburuen itxura +Comment[fa]=پیکربندی ظاهر و احساس عنوان پنجره‌ها +Comment[fi]=Muokkaa ikkunoiden kehysten ulkonäköä +Comment[fr]=Configuration de l'apparence du titre des fenêtres +Comment[fy]=Hjir kinne jo it uterlik en gedrach fan finstertitels ynstelle +Comment[gl]=Configurar a apariencia dos títulos das fiestras +Comment[he]=שינוי הגדרות המראה והתחושה של כותרות חלונות +Comment[hi]=विंडो शीर्षकों के रूप आकार को कॉन्फ़िगर करें +Comment[hr]=Konfiguriranje izgleda naslova prozora +Comment[hu]=Az ablakok címsorának megjelenési beállításai +Comment[is]=Stilla viðmót gluggatitla +Comment[it]=Configura l'aspetto e il comportamento dei titoli delle finestre +Comment[ja]=ウィンドウのタイトルバーの外観を設定 +Comment[ka]=ფანჯრის სათაურის იერსახის კონფიგურაცია +Comment[kk]=Терезе айдарының безендіруін баптау +Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​រូបរាង​របស់​ចំណងជើង​បង្អួច +Comment[ko]=창 제목 표시줄의 모습과 느낌 설정 +Comment[lo]=ປັດແຕ່ງລັກສະນະແລະຄວາມຮູ້ສືກໃນການໃຊ້ງານຂອງບາວເຊີ Konqueror +Comment[lt]=Konfigūruoti langų antraščių išvaizdą ir elgseną +Comment[lv]=Konfigurē loga virsrakstu izskatu un izturēšanos +Comment[mk]=Конфигурирајте го изгледот и чувството на насловите на прозорците +Comment[mn]=Цонхны толгойн харагдалтыг тохируулах +Comment[mt]=Ikkonfigura d-dehra u l-użu tat-titli tal-windows +Comment[nb]=Her kan du sette opp hvordan nettleseren Konqueror skal virke og se ut +Comment[nds]=Dat Utsehn vun de Finstertiteln instellen +Comment[ne]=सञ्झ्याल शीर्षकहरूको हेराइ र बुझाइ कन्फिगर गर्नुहोस् +Comment[nl]=Hier kunt u het uiterlijk en gedrag van venstertitels instellen +Comment[nn]=Set opp utsjånaden på vindaugstitlar +Comment[nso]=Beakanya pogego le maikutlo a maina a window +Comment[pa]=ਝਰੋਖਾ ਸਿਰਲੇਖਾਂ ਦੇ ਰੰਗ-ਰੂਪ ਦੀ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja wyglądu i zachowania belek tytułowych okien +Comment[pt]=Configuração da aparência e comportamento dos títulos das janelas +Comment[pt_BR]=Configura a aparência dos títulos de janelas +Comment[ro]=Configurează aspectul titlului ferestrelor +Comment[ru]=Настройка внешнего вида заголовков окон +Comment[rw]=Kuboneza imboneko n'ukumva kw'imitwe y'idirishya +Comment[se]=Heivet lásenamahusaid fárdda +Comment[sk]=Nastavenie vzhľadu titulkov okien +Comment[sl]=Nastavite videz in delovanje naslovnih vrstic okna. +Comment[sr]=Подешавање изгледа и осећаја насловних линија прозора +Comment[sr@Latn]=Podešavanje izgleda i osećaja naslovnih linija prozora +Comment[sv]=Anpassa namnlisternas utseende och känsla +Comment[ta]=சாளரம் மற்றும் தலைப்பின் காட்சிவகையை மாற்று +Comment[tg]=Танзими намо ва ҳиси унвони тиреза +Comment[th]=ปรับแต่งลักษณะรูปแบบและสัมผัสสึกของแถบหัวเรื่องหน้าต่าง +Comment[tr]=Pencere başlıklarını görünümlerini yapılandır +Comment[tt]=Täräzä başlığınıñ küreneşen caylaw +Comment[uk]=Налаштування вигляду та поведінки заголовків вікон +Comment[uz]=Oyna sarlavhasining tashqi koʻrinishini moslash +Comment[uz@cyrillic]=Ойна сарлавҳасининг ташқи кўринишини мослаш +Comment[ven]=Dzudzanyani mbonalelo na zwipfi zwa buronza ya inithanete ino pfi Konqueror +Comment[vi]=Cấu hình cảm nhận cho tên cửa sổ +Comment[wa]=Apontyî li rivnance eyet l' dujhance des tites des purneas +Comment[xh]=Qwalasela inkangeleko nemvakalelo yezihloko zeWindow +Comment[zh_CN]=配置窗口标题的观感 +Comment[zh_TW]=設定視窗標題列的外觀與感覺 +Comment[zu]=Hlanganisela ukubona kanye nokuzwa kwezihloko zama-window + +Keywords=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration +Keywords[ar]=twin,نافذة,مسيير,الحافة,الشكل,سمة,مظهر,ملمس,تصميم,زر,معامل,مدبر,kwm,زخرفات +Keywords[az]=twin,pəncərə,idarəçi,kənar,tərz,örtü,görünüş,toxuma,yer,düymə,applet,kənar,kwm,dekorasiya,bəzək +Keywords[be]=Акно,Кіраўнік,Мяжа,Стыль,Тэма,Вонкавы выгляд,Кнопкі,Апрацоўшчык,Край,Дэкарацыя,twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration +Keywords[bg]=прозорец, декорация, заглавие, бутони, меню, twin, window, manager, border, style, theme, look, feel, layout, button, handle, edge, kwm, decoration +Keywords[ca]=twin,finestra,gestor,vora,estil,tema,aspecte,comportament,disposició,botó,nansa,marges,kwm,decoració +Keywords[cs]=twin,okno,správce,okraj,styl,motiv,vzhled,rozvržení,tlačítko,úchytka,hrana,kwm,dekorace +Keywords[csb]=twin,òkno,menedżer,zberk,sztél,téma,wëzdrzatk,ùchòwanié,ùstôw,knąpa,ùchwët,rańt,kwm,dekòracëjô +Keywords[cy]=twin,ffenestr,trefnydd,ymyl,arddull,thema,golwg,teimlad,haenlun,botwm,carn,kwm,addurniad +Keywords[da]=twin,vindue,håndtering,kant,stil,tema,udseende,fornemmelse,layout,knap,håndtag,kant,kwm,dekoration +Keywords[de]=KWin,Kwm,Fenster,Manager,Rahmen,Design,Stile,Themes,Optik,Erscheinungsbild,Layout,Knöpfe,Ränder,Dekorationen +Keywords[el]=twin,παράθυρο,διαχειριστής,περίγραμμα,στυλ,θέμα,εμφάνιση,αίσθηση,διάταξη,κουμπί,χειρισμός,άκρο,kwm,διακόσμηση +Keywords[eo]=twin,fenestro,administrilo,rando,stilo,etoso,aspekto,konduto,aranĝo,butono,eĝo,kwm,ornamo +Keywords[es]=twin,ventana,gestor,borde,estilo,tema,aspecto,comportamiento,disposición,botón,asa,esquina,kwm,decoración +Keywords[et]=twin,aken,haldur,piire,stiil,teema,välimus,kasutamine,nupud,serv,kwm,dekoratsioon +Keywords[eu]=twin,leihoa,kudeatzailea,ertza,estiloa,gaia,itxura,antolaketa,botoia, maneiatzailea,ertzea,kwm,dekorazioa +Keywords[fa]=twin، پنجره، مدیر، لبه، سبک، چهره، ظاهر، احساس، طرح‌بندی، دکمه، گرداندن، لبه، kwm، تزئین +Keywords[fi]=twin,ikkuna,ikkunaohjelma,ikkunoinnin hallintaohjelma,tausta,tyyli,teema,ulkonäkö,tuntuma,ulkoasu,painike,kahva,kulma,kwm,kehys +Keywords[fr]=twin,fenêtre,gestionnaire,bordure,style,thème,apparence,ergonomie,disposition,bouton,poignée,bord,kwm,décoration +Keywords[fy]=twin,window,manager,rand,stijl,theme,tema,look,uiterlijk,gedrag,feel,layout,opmaak,button,knoppen,handle,rand,kwm,decoratie,windowmanager,venster,vensterbeheer,finster,râne,kader,styltema,uterlik,gedrach,finsterbehear +Keywords[ga]=twin,fuinneog,bainisteoir,imlíne,stíl,téama,leagan amach,cnaipe,hanla,ciumhais,kwm,maisiúchán +Keywords[gl]=twin,fiestra,xestor,beira,estilo,tema,apariencia,formato,botón,xestión,esquina,kwm,decoración +Keywords[he]=מנהל חלונות,חלונות,מנהל,גבול,מסגרת,סגנון,ערכה,ערכת נושא,מראה,תחושה,פריסה,תצוגה,כפתור,ידית,קצה,קישוט, twin,window,manager,border,style,theme,look,feel,layout,button,handle, edge,kwm,decoration +Keywords[hi]=के-विन,विंडो,प्रबंधक,बार्डर,शैली,प्रसंग,रूप,अनुभव,ले-आउट,बटन,हैंडल,किनारा,केडबल्यूएम,सजावट +Keywords[hr]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,prozor,upravljanje,obrub,stil,tema,izgled,raspored,gumb,rukovanje,rub,ukras +Keywords[hu]=KWin,ablak,kezelő,szegély,stílus,téma,kinézet,megjelenés,elrendezés,nyomógomb,fogantyú,perem,kwm,ablakstílus +Keywords[is]=twin,gluggi,gluggastjóri,gluggar,kantar,rammi,skreyting,þema,stíll,útlit,takki,kwm,skraut +Keywords[it]=twin,finestra,window manager,bordo,stile,tema,aspetto,pulsante,maniglia,bordo,kwm,decorazione +Keywords[ja]=twin,ウィンドウ,マネージャ,枠,スタイル,テーマ,ルック,外観,レイアウト,ボタン,ハンドル,エッジ,kwm,装飾 +Keywords[km]=twin,បង្អួច,កម្មវិធី​គ្រប់គ្រង,ស៊ុម,រចនាប័ទ្ម,ស្បែក,មុខងារ,ប្លង់,ប៊ូតុង,ការ​ប្រើ,គែម,kwm,ការ​តុបតែង +Keywords[lt]=twin,window,manager,border,style,theme,look,feel,layout,buttons,handle,edge,kwm,decoration,langas,tvarkyklė,rėmelis,stilius,tema,žiūrėti,jausti,išdėstymas,mygtukai,kraštas,dekoracija +Keywords[lv]=twin, logs, menedžeris, rāmis, stils, tēma, skats, gars, izkārtojums, poga, rokturis, stūris, kwm, dekorācija +Keywords[mk]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,прозорец,менаџер,граница,стил,тема,изглед,чувство,распоред,копче,рачка,раб,декорација +Keywords[mn]=KWin,Kwm,Цонх,Manager,Хүрээ,Design,Хэлбэр,Загвар, Optik,Харагдалт,Layout,Товч,Өнцөг,Засал +Keywords[mt]=twin, window, manager, border, bordura, stil, tema, apparenza, style, theme, look, feel, layout, tqassim, użu, button, handle, edge, kwm, decoration +Keywords[nb]=twin,vindu,vindusstyring,styrer,ramme,stil,tema,utseende,layout,knapp,kant,kwm,pynt,dekorasjon +Keywords[nds]=twin,Finster,Finsterpleger,manager,Rahmen,Stil,Muster,look,feel,layout,Knoop,Greep,Rand,kwm,Dekoratschoon +Keywords[ne]=के विन,सञ्झ्याल, प्रबन्धक, किनारा, शैली, विषयवस्तु, हेराइ, बुझाइ, सजावट, बटन, ह्यान्डल, छेउ,kwm, सजावट +Keywords[nl]=twin,window,manager,rand,stijl,theme,thema,look,uiterlijk,gedrag,feel, layout,opmaak,button,knoppen,handle,rand,kwm,decoratie,windowmanager,venster,vensterbeheer +Keywords[nn]=twin,vindauge,kant,bord,stil,tema,utsjånad,bunad,knapp,handtak,kwm,dekorasjon +Keywords[nso]=twin,window,molaodi,mollwane,mokgwa,molaetsa,tebelego,maikutlo,peakanyo,setobetswa,moswaro,nthla,kwm,kgabiso +Keywords[pa]=twin,handle,edge,kwm,decoration,ਝਰੋਖਾ,ਮੈਨੇਜਰ,ਹਾਸ਼ੀਆ,ਸ਼ੈਲੀ,ਸਰੂਪ,ਦਿੱਖ,ਖਾਕਾ,ਬਟਨ,ਹੈਂਡਲ,ਸਜਾਵਟ +Keywords[pl]=twin,okno,menedżer,brzeg,styl,motyw,wygląd,zachowanie,układ,przycisk,uchwyt,krawędź,kwm,dekoracja +Keywords[pt]=twin,janela,gestor,contorno,estilo,tema,aparência,comportamento,visual,botão,pega,extremo,kwm,decoração +Keywords[pt_BR]=twin,janela,gerenciador,borda,estilo,tema,aparência,aparência,botão, gerenciador,borda,kwm,decoração +Keywords[ro]=twin,fereastră,manager,margine,stil,tematică,aspect,comportament,format,buton,kwm,decorare +Keywords[rw]=twin,idirishya,muyobozi,impera,imisusire,insanganyamatsiko,imboneko,kumva,imigaragarire,buto,ikirindi,impera,kwm,ugutaaka +Keywords[se]=twin,láse,gieđahalli,ravda,stiila,fáddá,fárda,dovdu,hápmi,boallu,geavja,ravda,kwm,hearva +Keywords[sk]=twin,okno,správa,okraj,štýl,téma,vzhľad,rozloženie,tlačidlo,hrana,kwm,dekorácia,oblasť +Keywords[sl]=twin,okno,upravitelj,rob,meja,slog,stil,tema,pogled,občutek,gumb,ročaj,rob,kwm,okrasek +Keywords[sr]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,прозор,менаџер,оквир,стил,тема,изглед,дугме,хватаљка,декорација +Keywords[sr@Latn]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,prozor,menadžer,okvir,stil,tema,izgled,dugme,hvataljka,dekoracija +Keywords[sv]=twin,fönster,hanterare,kant,stil,tema,utseende,känsla,layout,knapp,hantera,kant,kwm,dekoration +Keywords[ta]=twin,சாளரம்,மேலாளர்,விளிம்பு,பாணி,தலைப்பு,பார்வை,உணர்தல்,உருவரை,விசை,கையாள்,முனை,kwm,அலங்கரிப்பு +Keywords[th]=twin,หน้าต่าง,ตัวจัดการ,กรอบ,ลักษณะ,ชุดตกแต่ง,มองเห็น,รู้สึก,การจัดวาง,ปุ่ม,ที่จับ,ขอบ,kwm,การตกแต่ง +Keywords[tr]=twin,pencere,yönetici,kenar,stil,tema,görünüş,doku,yerleşim,düğme,tutamaç,kenar,kwm,dekorasyon +Keywords[uk]=twin,вікно,менеджер,границя,стиль,тема,вигляд,поведінка,розклад,кнопка,handle,край,kwm,обрамлення +Keywords[uz]=twin,kwm,bezak,oyna,boshqaruvchi,usul,tashqi koʻrinish +Keywords[uz@cyrillic]=twin,kwm,безак,ойна,бошқарувчи,усул,ташқи кўриниш +Keywords[ven]=twin,windo,mulanguli,mukanoni,tshitaela,thero,sedza,upfa,vhuvha,bathene,fara,mafhedziselo,kwn,u khavhisedza +Keywords[vi]=twin,cửa sổ,quản lý,bờ,kiểu,sắc thái,ngoại hình,cảm nhận,sắp xếp,nút,điều khiển,cạnh,kwm,trang trí +Keywords[wa]=twin,kpurnea,purnea,manaedjeu,boird,stîle,tinme,rivnance,layout;loukance,boton,apougnî,costé,kwm,gåliotaedje +Keywords[xh]=twin,window,umphathi,umda,uhlobo,umxholo wokuxoxwa,jonga,yiva,beka,iqhosha,umqheba,umda,kwm,uhombiso +Keywords[zh_CN]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,窗口,管理器,边框,样式,主题,观感,布局,按钮,处理,边缘,装饰 +Keywords[zh_TW]=twin,window,manager,border,style,theme,look,feel,layout,button,handle,edge,kwm,decoration,視窗,管理員,邊框,風格,佈景主題,外觀,感覺,佈局,按鈕,邊緣,裝飾 +Keywords[zu]=twin,i-window,imenenja,umngcele,isitayela,bona,izwa, isendlalelo,inkinobho,isibambo,unqenqema,kwm,umhlobiso +Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/twin/kcmtwin/twindecoration/twindecoration.h b/twin/kcmtwin/twindecoration/twindecoration.h new file mode 100644 index 000000000..f6b535024 --- /dev/null +++ b/twin/kcmtwin/twindecoration/twindecoration.h @@ -0,0 +1,148 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2001 + Karol Szwed + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#ifndef KWINDECORATION_H +#define KWINDECORATION_H + +#include +#include +#include +#include +#include + +#include + +#include "twindecorationIface.h" + +class KComboBox; +class TQCheckBox; +class TQLabel; +class TQTabWidget; +class TQVBox; +class TQSlider; + +class KDecorationPlugins; +class KDecorationPreview; + +// Stores themeName and its corresponding library Name +struct DecorationInfo +{ + TQString name; + TQString libraryName; +}; + + +class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface, public KDecorationDefines +{ + Q_OBJECT + + public: + KWinDecorationModule(TQWidget* parent, const char* name, const TQStringList &); + ~KWinDecorationModule(); + + virtual void load(); + virtual void save(); + virtual void defaults(); + + TQString quickHelp() const; + + virtual void dcopUpdateClientList(); + + signals: + void pluginLoad( KConfig* conf ); + void pluginSave( KConfig* conf ); + void pluginDefaults(); + + protected slots: + // Allows us to turn "save" on + void slotSelectionChanged(); + void slotChangeDecoration( const TQString & ); + void slotBorderChanged( int ); + void slotButtonsChanged(); + + private: + void readConfig( KConfig* conf ); + void writeConfig( KConfig* conf ); + void findDecorations(); + void createDecorationList(); + void updateSelection(); + TQString decorationLibName( const TQString& name ); + TQString decorationName ( TQString& libName ); + static TQString styleToConfigLib( TQString& styleLib ); + void resetPlugin( KConfig* conf, const TQString& currentDecoName = TQString::null ); + void resetKWin(); + void checkSupportedBorderSizes(); + static int borderSizeToIndex( BorderSize size, TQValueList< BorderSize > sizes ); + static BorderSize indexToBorderSize( int index, TQValueList< BorderSize > sizes ); + + TQTabWidget* tabWidget; + + // Page 1 + KComboBox* decorationList; + TQValueList decorations; + + KDecorationPreview* preview; + KDecorationPlugins* plugins; + KConfig twinConfig; + + TQCheckBox* cbUseCustomButtonPositions; + // TQCheckBox* cbUseMiniWindows; + TQCheckBox* cbShowToolTips; + TQLabel* lBorder; + TQComboBox* cBorder; + BorderSize border_size; + + TQObject* pluginObject; + TQWidget* pluginConfigWidget; + TQString currentLibraryName; + TQString oldLibraryName; + TQObject* (*allocatePlugin)( KConfig* conf, TQWidget* parent ); + + // Page 2 + ButtonPositionWidget *buttonPositionWidget; + TQVBox* buttonPage; + + // Page 3 + TQVBox *shadowPage; + KColorButton *inactiveShadowColourButton, *shadowColourButton; + TQCheckBox *cbShadowDocks, *cbShadowOverrides, *cbShadowTopMenus; + TQCheckBox *cbInactiveShadow, *cbWindowShadow; + TQGroupBox *activeShadowSettings, *inactiveShadowSettings; + TQGroupBox *whichShadowSettings; + TQSlider *inactiveShadowOpacitySlider, *shadowOpacitySlider; + TQSpinBox *inactiveShadowOpacitySpinBox, *shadowOpacitySpinBox; + TQSpinBox *inactiveShadowXOffsetSpinBox, *shadowXOffsetSpinBox; + TQSpinBox *inactiveShadowYOffsetSpinBox, *shadowYOffsetSpinBox; + TQSpinBox *inactiveShadowThicknessSpinBox, *shadowThicknessSpinBox; +}; + + +#endif +// vim: ts=4 +// kate: space-indent off; tab-width 4; diff --git a/twin/kcmtwin/twindecoration/twindecorationIface.h b/twin/kcmtwin/twindecoration/twindecorationIface.h new file mode 100644 index 000000000..f50082648 --- /dev/null +++ b/twin/kcmtwin/twindecoration/twindecorationIface.h @@ -0,0 +1,44 @@ +/* + This is the new twindecoration kcontrol module + + Copyright (c) 2001 + Karol Szwed (gallium) + http://gallium.n3.net/ + + Supports new twin configuration plugins, and titlebar button position + modification via dnd interface. + + Based on original "twintheme" (Window Borders) + Copyright (C) 2001 Rik Hemsley (rikkus) + + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +*/ + +#ifndef __KWINDECORATIONIFACE_H +#define __KWINDECORATIONIFACE_H + +#include + +class KWinDecorationIface: virtual public DCOPObject +{ + K_DCOP + public: + + k_dcop: + virtual void dcopUpdateClientList()=0; +}; + +#endif -- cgit v1.2.3