diff options
Diffstat (limited to 'kicker')
-rw-r--r-- | kicker/applets/systemtray/CMakeLists.txt | 2 | ||||
-rw-r--r-- | kicker/applets/systemtray/systemtrayapplet.cpp | 48 | ||||
-rw-r--r-- | kicker/applets/systemtray/systemtrayapplet.h | 3 | ||||
-rw-r--r-- | kicker/kicker/buttons/kbutton.cpp | 10 | ||||
-rw-r--r-- | kicker/kicker/buttons/kbutton.h | 1 | ||||
-rw-r--r-- | kicker/kicker/core/container_extension.cpp | 99 | ||||
-rw-r--r-- | kicker/kicker/core/container_extension.h | 3 | ||||
-rw-r--r-- | kicker/kicker/core/containerarea.cpp | 18 | ||||
-rw-r--r-- | kicker/libkicker/kickerSettings.kcfg | 11 | ||||
-rw-r--r-- | kicker/libkicker/panelbutton.cpp | 80 | ||||
-rw-r--r-- | kicker/libkicker/panelbutton.h | 7 | ||||
-rw-r--r-- | kicker/taskbar/taskbar.cpp | 2 | ||||
-rw-r--r-- | kicker/taskbar/taskcontainer.cpp | 11 |
13 files changed, 256 insertions, 39 deletions
diff --git a/kicker/applets/systemtray/CMakeLists.txt b/kicker/applets/systemtray/CMakeLists.txt index 9dc4f41ae..cd3fd6348 100644 --- a/kicker/applets/systemtray/CMakeLists.txt +++ b/kicker/applets/systemtray/CMakeLists.txt @@ -11,6 +11,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/kicker/libkicker ${CMAKE_SOURCE_DIR}/kicker/libkicker ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} @@ -38,4 +39,5 @@ tde_add_kpart( ${target} AUTOMOC SOURCES ${${target}_SRCS} LINK kickermain-shared DESTINATION ${PLUGIN_INSTALL_DIR} + DEPENDENCIES kicker_core-static kicker-static kicker-shared ) diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp index c347108cc..ceeebc381 100644 --- a/kicker/applets/systemtray/systemtrayapplet.cpp +++ b/kicker/applets/systemtray/systemtrayapplet.cpp @@ -27,7 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include <tqcursor.h> -#include <tqlayout.h> #include <tqpopupmenu.h> #include <tqtimer.h> #include <tqpixmap.h> @@ -48,6 +47,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kiconloader.h> #include <kwin.h> +#include "kickerSettings.h" + #include "simplebutton.h" #include "systemtrayapplet.h" @@ -55,7 +56,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/Xlib.h> +//#define ICON_MARGIN KickerSettings::showDeepButtons()?2:1 #define ICON_MARGIN 1 +#define ICON_END_MARGIN KickerSettings::showDeepButtons()?4:0 extern "C" { @@ -70,9 +73,11 @@ extern "C" SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name), - m_showFrame(false), + m_showFrame(KickerSettings::showDeepButtons()?true:false), m_showHidden(false), m_expandButton(0), + m_leftSpacer(0), + m_rightSpacer(0), m_settingsDialog(0), m_iconSelector(0), m_autoRetractTimer(0), @@ -83,6 +88,11 @@ SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int ac DCOPObject::setObjId("SystemTrayApplet"); loadSettings(); + m_leftSpacer = new TQWidget(this); + m_leftSpacer->setFixedSize(ICON_END_MARGIN,1); + m_rightSpacer = new TQWidget(this); + m_rightSpacer->setFixedSize(ICON_END_MARGIN,1); + setBackgroundOrigin(AncestorOrigin); kwin_module = new KWinModule(TQT_TQOBJECT(this)); @@ -445,13 +455,13 @@ void SystemTrayApplet::loadSettings() { // set our defaults setFrameStyle(NoFrame); - m_showFrame = false; + m_showFrame = KickerSettings::showDeepButtons()?true:false; KConfig *conf = config(); conf->reparseConfiguration(); conf->setGroup("General"); - if (conf->readBoolEntry("ShowPanelFrame", false)) + if (conf->readBoolEntry("ShowPanelFrame", false) || m_showFrame) // Does ShowPanelFrame even exist? { setFrameStyle(Panel | Sunken); } @@ -918,13 +928,19 @@ void SystemTrayApplet::layoutTray() heightWidth = heightWidth < iconWidth ? iconWidth : heightWidth; nbrOfLines = heightWidth / iconWidth; + m_layout->addMultiCellWidget(m_leftSpacer, + 0, 0, + 0, nbrOfLines - 1, + Qt::AlignHCenter | Qt::AlignVCenter); + col = 1; + if (showExpandButton) { m_layout->addMultiCellWidget(m_expandButton, - 0, 0, + 1, 1, 0, nbrOfLines - 1, Qt::AlignHCenter | Qt::AlignVCenter); - col = 1; + col = 2; } if (m_showHidden) @@ -963,6 +979,11 @@ void SystemTrayApplet::layoutTray() ++i; } + + m_layout->addMultiCellWidget(m_rightSpacer, + col, col, + 0, nbrOfLines - 1, + Qt::AlignHCenter | Qt::AlignVCenter); } else // horizontal { @@ -971,13 +992,19 @@ void SystemTrayApplet::layoutTray() heightWidth = heightWidth < iconHeight ? iconHeight : heightWidth; // to avoid nbrOfLines=0 nbrOfLines = heightWidth / iconHeight; + m_layout->addMultiCellWidget(m_leftSpacer, + 0, nbrOfLines - 1, + 0, 0, + Qt::AlignHCenter | Qt::AlignVCenter); + col = 1; + if (showExpandButton) { m_layout->addMultiCellWidget(m_expandButton, 0, nbrOfLines - 1, - 0, 0, + 1, 1, Qt::AlignHCenter | Qt::AlignVCenter); - col = 1; + col = 2; } if (m_showHidden) @@ -1015,6 +1042,11 @@ void SystemTrayApplet::layoutTray() ++i; } + + m_layout->addMultiCellWidget(m_rightSpacer, + 0, nbrOfLines - 1, + col, col, + Qt::AlignHCenter | Qt::AlignVCenter); } tqsetUpdatesEnabled(true); diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h index f66e0caa5..c656cfe3d 100644 --- a/kicker/applets/systemtray/systemtrayapplet.h +++ b/kicker/applets/systemtray/systemtrayapplet.h @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tqvaluevector.h> #include <tqstringlist.h> #include <tqevent.h> +#include <tqlayout.h> #include <qxembed.h> #include <dcopobject.h> @@ -105,6 +106,8 @@ private: bool m_showFrame; bool m_showHidden; SimpleArrowButton *m_expandButton; + TQWidget *m_leftSpacer; + TQWidget *m_rightSpacer; KDialogBase* m_settingsDialog; KActionSelector* m_iconSelector; TQTimer* m_autoRetractTimer; diff --git a/kicker/kicker/buttons/kbutton.cpp b/kicker/kicker/buttons/kbutton.cpp index d39346edb..79f2f0bb2 100644 --- a/kicker/kicker/buttons/kbutton.cpp +++ b/kicker/kicker/buttons/kbutton.cpp @@ -22,6 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include <tqtooltip.h> +#include <tqstyle.h> #include <klocale.h> #include <kapplication.h> @@ -39,7 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kbutton.moc" KButton::KButton( TQWidget* parent ) - : PanelPopupButton( parent, "KButton" ) + : PanelPopupButton( parent, "KButton", KickerSettings::showDeepButtons() ) { TQToolTip::add(this, i18n("Applications, tasks and desktop sessions")); setTitle(i18n("K Menu")); @@ -79,3 +80,10 @@ void KButton::initPopup() MenuManager::the()->kmenu()->initialize(); } +void KButton::drawButton(TQPainter *p) +{ + if (KickerSettings::showDeepButtons()) + PanelPopupButton::drawDeepButton(p); + else + PanelPopupButton::drawButton(p); +}
\ No newline at end of file diff --git a/kicker/kicker/buttons/kbutton.h b/kicker/kicker/buttons/kbutton.h index bf98e74f8..523d9ed49 100644 --- a/kicker/kicker/buttons/kbutton.h +++ b/kicker/kicker/buttons/kbutton.h @@ -45,6 +45,7 @@ protected: virtual TQString tileName() { return "KMenu"; } virtual void initPopup(); virtual TQString defaultIcon() const { return "go"; } + virtual void drawButton(TQPainter *); }; #endif diff --git a/kicker/kicker/core/container_extension.cpp b/kicker/kicker/core/container_extension.cpp index c659c1002..0deb57a35 100644 --- a/kicker/kicker/core/container_extension.cpp +++ b/kicker/kicker/core/container_extension.cpp @@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tqtimer.h> #include <tqtooltip.h> #include <tqvbox.h> +#include <tqimage.h> +#include <tqstyle.h> #include <qxembed.h> #include <tqcolor.h> @@ -67,6 +69,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define PANEL_SPEED_MULTIPLIER 10.0 #define PANEL_SPEED(x, c) (int)(((1.0-2.0*fabs((x)-(c)/2.0)/c)*m_settings.hideAnimationSpeed()+1.0)*PANEL_SPEED_MULTIPLIER) +// #define PANEL_RESIZE_HANDLE_WIDTH 3 +// #define PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE 2 + +// #define PANEL_RESIZE_HANDLE_WIDTH 4 +// #define PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE 2 + +#define PANEL_RESIZE_HANDLE_WIDTH 6 +#define PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE 0 + ExtensionContainer::ExtensionContainer(const AppletInfo& info, const TQString& extensionId, TQWidget *parent) @@ -109,6 +120,7 @@ ExtensionContainer::ExtensionContainer(KPanelExtension* extension, _info(info), _ltHB(0), _rbHB(0), + _resizeHandle(0), m_extension(extension), m_maintainFocus(0), m_panelOrder(ExtensionManager::the()->nextPanelOrder()) @@ -223,6 +235,11 @@ TQSize ExtensionContainer::tqsizeHint(KPanelExtension::Position p, const TQSize height += 1; // border } + if (KickerSettings::useResizeHandle()) + { + height += (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); // resize handle area + } + if (m_settings.showLeftHideButton()) { width += m_settings.hideButtonSize(); @@ -243,6 +260,11 @@ TQSize ExtensionContainer::tqsizeHint(KPanelExtension::Position p, const TQSize width += 1; // border } + if (KickerSettings::useResizeHandle()) + { + width += (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); // resize handle area + } + if (m_settings.showLeftHideButton()) { height += m_settings.hideButtonSize(); @@ -1186,6 +1208,11 @@ int ExtensionContainer::arrangeHideButtons() --maxWidth; } + if (KickerSettings::useResizeHandle()) + { + maxWidth = maxWidth - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); + } + if (_ltHB) { _ltHB->setMaximumWidth(maxWidth); @@ -1211,6 +1238,11 @@ int ExtensionContainer::arrangeHideButtons() --maxHeight; } + if (KickerSettings::useResizeHandle()) + { + maxHeight = maxHeight - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); + } + int vertAlignment = (position() == KPanelExtension::Top) ? Qt::AlignTop : 0; int leftAlignment = Qt::AlignRight; @@ -1261,11 +1293,15 @@ int ExtensionContainer::setupBorderSpace() _layout->setColSpacing(0, 0); _layout->setColSpacing(2, 0); - if (!needsBorder()) + if (!needsBorder() && !KickerSettings::useResizeHandle()) { return 0; } + int borderWidth = 1; + if (KickerSettings::useResizeHandle()) + borderWidth = PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE; + int layoutOffset = 0; TQRect r = TQApplication::desktop()->screenGeometry(xineramaScreen()); TQRect h = geometry(); @@ -1274,14 +1310,14 @@ int ExtensionContainer::setupBorderSpace() { if (h.top() > 0) { - int topHeight = (_ltHB && _ltHB->isVisibleTo(this)) ? _ltHB->height() + 1 : 1; + int topHeight = (_ltHB && _ltHB->isVisibleTo(this)) ? _ltHB->height() + borderWidth : borderWidth; _layout->setRowSpacing(0, topHeight); ++layoutOffset; } if (h.bottom() < r.bottom()) { - int bottomHeight = (_rbHB && _rbHB->isVisibleTo(this)) ? _rbHB->height() + 1 : 1; + int bottomHeight = (_rbHB && _rbHB->isVisibleTo(this)) ? _rbHB->height() + borderWidth : borderWidth; _layout->setRowSpacing(1, bottomHeight); ++layoutOffset; } @@ -1290,14 +1326,14 @@ int ExtensionContainer::setupBorderSpace() { if (h.left() > 0) { - int leftWidth = (_ltHB && _ltHB->isVisibleTo(this)) ? _ltHB->width() + 1 : 1; + int leftWidth = (_ltHB && _ltHB->isVisibleTo(this)) ? _ltHB->width() + borderWidth : borderWidth; _layout->setColSpacing(0, leftWidth); ++layoutOffset; } if (h.right() < r.right()) { - int rightWidth = (_rbHB && _rbHB->isVisibleTo(this)) ? _rbHB->width() + 1 : 1; + int rightWidth = (_rbHB && _rbHB->isVisibleTo(this)) ? _rbHB->width() + borderWidth : borderWidth; _layout->setColSpacing(1, rightWidth); ++layoutOffset; } @@ -1306,20 +1342,20 @@ int ExtensionContainer::setupBorderSpace() switch (position()) { case KPanelExtension::Left: - _layout->setColSpacing(2, 1); + _layout->setColSpacing(2, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); break; case KPanelExtension::Right: - _layout->setColSpacing(0, 1); + _layout->setColSpacing(0, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); break; case KPanelExtension::Top: - _layout->setRowSpacing(2, 1); + _layout->setRowSpacing(2, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); break; case KPanelExtension::Bottom: default: - _layout->setRowSpacing(0, 1); + _layout->setRowSpacing(0, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); break; } @@ -1361,6 +1397,39 @@ void ExtensionContainer::paintEvent(TQPaintEvent *e) p.setPen(palette().color(TQPalette::Active, TQColorGroup::Mid)); p.drawRect(0, 0, width(), height()); } + + if (KickerSettings::useResizeHandle()) + { + // draw resize handle [RAJA] + TQRect rect; + TQPainter p( this ); + + // FIXME + // KPanelExtension::Left/Right don't seem to draw the separators at all! + if (position() == KPanelExtension::Left) { + rect = TQRect(width()-2,0,PANEL_RESIZE_HANDLE_WIDTH,height()); + tqstyle().tqdrawPrimitive( TQStyle::PE_Separator, &p, rect, tqcolorGroup(), TQStyle::Style_Horizontal ); + } + else if (position() == KPanelExtension::Right) { + rect = TQRect(0,0,PANEL_RESIZE_HANDLE_WIDTH,height()); + tqstyle().tqdrawPrimitive( TQStyle::PE_Separator, &p, rect, tqcolorGroup(), TQStyle::Style_Horizontal ); + } + else if (position() == KPanelExtension::Top) { + // Nastiness to both vertically flip the PE_Separator + // and make sure it pops out of, not sinks into, the screen + TQPixmap inv_pm(width(),PANEL_RESIZE_HANDLE_WIDTH); + TQPainter myp(TQT_TQPAINTDEVICE(&inv_pm)); + rect = TQRect(0,0,width(),PANEL_RESIZE_HANDLE_WIDTH); + TQColorGroup darkcg = tqcolorGroup(); + darkcg.setColor(TQColorGroup::Light, tqcolorGroup().dark()); + tqstyle().tqdrawPrimitive( TQStyle::PE_Separator, &myp, rect, darkcg, TQStyle::Style_Default ); + p.drawPixmap(0,height()-2,inv_pm); + } + else { + rect = TQRect(0,0,width(),PANEL_RESIZE_HANDLE_WIDTH); + tqstyle().tqdrawPrimitive( TQStyle::PE_Separator, &p, rect, tqcolorGroup(), TQStyle::Style_Default ); + } + } } void ExtensionContainer::leaveEvent(TQEvent*) @@ -1469,7 +1538,7 @@ void ExtensionContainer::arrange(KPanelExtension::Position p, { m_settings.setPosition(p); } - else if (!needsBorder()) + else if (!needsBorder() && !KickerSettings::useResizeHandle()) { // this ensures that the layout gets rejigged // even if position doesn't change @@ -1653,6 +1722,10 @@ void ExtensionContainer::resetLayout() { m_extension->setFixedHeight(height() - 1); } + else if (KickerSettings::useResizeHandle()) + { + m_extension->setFixedHeight(height() - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE)); + } else { m_extension->setFixedHeight(height()); @@ -1679,6 +1752,10 @@ void ExtensionContainer::resetLayout() { m_extension->setFixedWidth(width() - 1); } + else if (KickerSettings::useResizeHandle()) + { + m_extension->setFixedWidth(width() - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE)); + } else { m_extension->setFixedWidth(width()); @@ -1690,7 +1767,7 @@ void ExtensionContainer::resetLayout() bool ExtensionContainer::needsBorder() const { - return !KickerSettings::transparent(); + return !KickerSettings::transparent() && !KickerSettings::useResizeHandle(); //&& !KickerSettings::useBackgroundTheme(); } diff --git a/kicker/kicker/core/container_extension.h b/kicker/kicker/core/container_extension.h index 735aa2c85..3c7894db6 100644 --- a/kicker/kicker/core/container_extension.h +++ b/kicker/kicker/core/container_extension.h @@ -190,7 +190,8 @@ private: // Widgets HideButton *_ltHB; // Left Hide Button HideButton *_rbHB; // Right Hide Button - TQGridLayout *_layout; + TQGridLayout *_layout; + TQWidget *_resizeHandle; KPanelExtension *m_extension; int m_maintainFocus; diff --git a/kicker/kicker/core/containerarea.cpp b/kicker/kicker/core/containerarea.cpp index 412eeec1e..7b2b98b7b 100644 --- a/kicker/kicker/core/containerarea.cpp +++ b/kicker/kicker/core/containerarea.cpp @@ -1513,6 +1513,24 @@ void ContainerArea::setBackground() TQTimer::singleShot(0, this, TQT_SLOT(updateContainersBackground())); } } +// else { // RAJA +// TQRect rect; +// TQImage bgImage; +// TQPixmap bgPixmap(size().width(), size().height()); +// bgPixmap.fill(tqcolorGroup().background()); +// TQPainter p( TQT_TQPAINTDEVICE(&bgPixmap) ); +// +// // FIXME This should change the rectangle based on the container's location on the screen (top, bottom, etc.) +// rect = TQRect(0,0,size().width(),2); +// tqstyle().tqdrawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect, tqcolorGroup(), TQStyle::Style_Default ); +// +// printf("[RAJA DEBUG 100.0] Hi there!\n\r"); fflush(stdout); +// p.fillRect(0,0,100,100,TQColor(0,0,0)); +// +// bgImage = bgPixmap; +// setPaletteBackgroundPixmap(TQPixmap(bgImage)); +// TQTimer::singleShot(0, this, TQT_SLOT(updateContainersBackground())); +// } _bgSet = true; } diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg index 75de298a3..ec6575a21 100644 --- a/kicker/libkicker/kickerSettings.kcfg +++ b/kicker/libkicker/kickerSettings.kcfg @@ -26,6 +26,17 @@ <default>false</default> </entry> +<entry name="UseResizeHandle" type="Bool" > + <label>Enable resize handles</label> + <whatsthis>When this option is enabled, the panel will provide a resize handle on order to change its width via click-and-drag</whatsthis> + <default>false</default> + </entry> + +<entry name="ShowDeepButtons" type="Bool" > + <label>Make the task buttons push further into the screen when activated</label> + <default>false</default> + </entry> + <entry name="MenubarPanelTransparent" type="Bool" > <label>Enable transparency for menubar panel</label> <whatsthis>When this option is enabled, the panel containing the menubar will become pseudo-transparent as well</whatsthis> diff --git a/kicker/libkicker/panelbutton.cpp b/kicker/libkicker/panelbutton.cpp index 06e9a0b41..1e4edaf7b 100644 --- a/kicker/libkicker/panelbutton.cpp +++ b/kicker/libkicker/panelbutton.cpp @@ -56,23 +56,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "panelbutton.h" #include "panelbutton.moc" +// For now link these two +#define m_disableHighlighting m_forceStandardCursor + // init static variable KShadowEngine* PanelButton::s_textShadowEngine = 0L; -PanelButton::PanelButton( TQWidget* parent, const char* name ) +PanelButton::PanelButton( TQWidget* parent, const char* name, bool forceStandardCursor ) : TQButton(parent, name), m_valid(true), m_isLeftMouseButtonDown(false), m_drawArrow(false), m_highlight(false), - m_changeCursorOverItem(true), + m_changeCursorOverItem(forceStandardCursor?false:true), m_hasAcceptedDrag(false), m_arrowDirection(KPanelExtension::Bottom), m_popupDirection(KPanelApplet::Up), m_iconAlignment(AlignCenter), m_orientation(Qt::Horizontal), m_size((KIcon::StdSizes)-1), - m_fontPercent(0.40) + m_fontPercent(0.40), + m_forceStandardCursor(forceStandardCursor) { setBackgroundOrigin(AncestorOrigin); setWFlags(TQt::WNoAutoErase); @@ -220,7 +224,10 @@ void PanelButton::updateSettings(int category) return; } - m_changeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); + if (m_forceStandardCursor == FALSE) + m_changeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); + else + m_changeCursorOverItem = FALSE; if (m_changeCursorOverItem) { @@ -319,7 +326,10 @@ int PanelButton::heightForWidth(int width) const const TQPixmap& PanelButton::labelIcon() const { - return m_highlight ? m_iconh : m_icon; + if (m_disableHighlighting) + return m_icon; + else + return m_highlight ? m_iconh : m_icon; } const TQPixmap& PanelButton::zoomIcon() const @@ -425,7 +435,7 @@ void PanelButton::startDrag() void PanelButton::enterEvent(TQEvent* e) { - if (!m_highlight) + if (!m_highlight && m_disableHighlighting == FALSE) { m_highlight = true; tqrepaint(false); @@ -564,8 +574,52 @@ void PanelButton::drawButton(TQPainter *p) } } +void PanelButton::drawDeepButton(TQPainter *p) +{ + const TQPixmap& tile = (isDown() || isOn()) ? m_down : m_up; + + if (m_tileColor.isValid()) + { + p->fillRect(rect(), m_tileColor); + tqstyle().tqdrawPrimitive(TQStyle::PE_Panel, p, rect(), tqcolorGroup()); + } + else if (paletteBackgroundPixmap()) + { + // Draw the background. This is always needed, even when using tiles, + // because they don't have to cover the entire button. + TQPoint offset = backgroundOffset(); + int ox = offset.x(); + int oy = offset.y(); + p->drawTiledPixmap( 0, 0, width(), height(),*paletteBackgroundPixmap(), ox, oy); + } + + TQRect btn_rect = TQRect(rect().x(), rect().y()+1, rect().width(), rect().height()-2); + if (isDown() || isOn()) { + tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p, btn_rect, tqcolorGroup(), TQStyle::Style_Down); + } + else { + tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p, btn_rect, tqcolorGroup(), TQStyle::Style_Raised); + } + + drawButtonLabel(p,0,FALSE); + + if (hasFocus() || m_hasAcceptedDrag) + { + int x1, y1, x2, y2; + TQT_TQRECT_OBJECT(rect()).coords(&x1, &y1, &x2, &y2); + TQRect r(x1+2, y1+2, x2-x1-3, y2-y1-3); + tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, p, r, tqcolorGroup(), + TQStyle::Style_Default, tqcolorGroup().button()); + } +} + void PanelButton::drawButtonLabel(TQPainter *p) { + drawButtonLabel(p,0,TRUE); +} + +void PanelButton::drawButtonLabel(TQPainter *p, int voffset, bool drawArrow) +{ TQPixmap icon = labelIcon(); bool active = isDown() || isOn(); @@ -604,7 +658,7 @@ void PanelButton::drawButtonLabel(TQPainter *p) if (!reverse && !icon.isNull()) { /* Draw icon */ - p->drawPixmap(3, y, icon); + p->drawPixmap(3, y+voffset, icon); } int tX = reverse ? 3 : icon.width() + KMIN(25, KMAX(5, fm.width('m') / 2)); @@ -641,12 +695,12 @@ void PanelButton::drawButtonLabel(TQPainter *p) p->drawImage(0, 0, img); p->save(); p->setPen(m_textColor); - p->drawText(tX, tY, m_buttonText, -1, rtl); + p->drawText(tX, tY+voffset, m_buttonText, -1, rtl); p->restore(); if (reverse && !icon.isNull()) { - p->drawPixmap(w - icon.width() - 3, y, icon); + p->drawPixmap(w - icon.width() - 3, y+voffset, icon); } p->restore(); @@ -658,10 +712,10 @@ void PanelButton::drawButtonLabel(TQPainter *p) x = (width() - icon.width()) / 2; else if (m_iconAlignment & AlignRight) x = (width() - icon.width()); - p->drawPixmap(x, y, icon); + p->drawPixmap(x, y+voffset, icon); } - if (m_drawArrow && (m_highlight || active)) + if (m_drawArrow && (m_highlight || active) && drawArrow) { TQStyle::PrimitiveElement e = TQStyle::PE_ArrowUp; int arrowSize = tqstyle().tqpixelMetric(TQStyle::PM_MenuButtonIndicator); @@ -887,8 +941,8 @@ void PanelButton::updateKickerTip(KickerTip::Data& data) // PanelPopupButton class // -PanelPopupButton::PanelPopupButton(TQWidget *parent, const char *name) - : PanelButton(parent, name), +PanelPopupButton::PanelPopupButton(TQWidget *parent, const char *name, bool forceStandardCursor) + : PanelButton(parent, name, forceStandardCursor), m_popup(0), m_pressedDuringPopup(false), m_initialized(false) diff --git a/kicker/libkicker/panelbutton.h b/kicker/libkicker/panelbutton.h index ff0f5f2a8..7fd2cca6d 100644 --- a/kicker/libkicker/panelbutton.h +++ b/kicker/libkicker/panelbutton.h @@ -53,7 +53,7 @@ public: * @param parent the parent widget * @param name the widget's name */ - PanelButton( TQWidget* parent, const char* name ); + PanelButton( TQWidget* parent, const char* name, bool forceStandardCursor = FALSE ); /** * Configures this button according to the user's preferences for @@ -294,7 +294,9 @@ protected: virtual void mouseReleaseEvent(TQMouseEvent *); virtual void resizeEvent(TQResizeEvent*); virtual void drawButton(TQPainter *); + virtual void drawDeepButton(TQPainter *); virtual void drawButtonLabel(TQPainter *); + virtual void drawButtonLabel(TQPainter *, int voffset, bool drawArrow); /** * @return the preferred icon size. @@ -397,6 +399,7 @@ private: Orientation m_orientation; int m_size; double m_fontPercent; + bool m_forceStandardCursor; static KShadowEngine* s_textShadowEngine; class PanelPopupPrivate; @@ -416,7 +419,7 @@ public: * @param parent the parent widget * @param name the widget's name */ - PanelPopupButton(TQWidget *parent=0, const char *name=0); + PanelPopupButton(TQWidget *parent=0, const char *name=0, bool forceStandardCursor = FALSE); /** * Sets the button's popup menu. diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp index d78ad5cf1..33109c576 100644 --- a/kicker/taskbar/taskbar.cpp +++ b/kicker/taskbar/taskbar.cpp @@ -690,7 +690,7 @@ void TaskBar::reLayout() } // needed because Panner doesn't know how big it's contents are so it's - // up to use to initialize it. =( + // up to us to initialize it. =( resizeContents(contentsRect().width(), contentsRect().height()); // number of rows simply depends on our height which is either the diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp index 4cd893e1b..ee457bc32 100644 --- a/kicker/taskbar/taskcontainer.cpp +++ b/kicker/taskbar/taskcontainer.cpp @@ -586,9 +586,16 @@ void TaskContainer::drawButton(TQPainter *p) // draw button background if (drawButton) { - tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonTool, p, + if (KickerSettings::showDeepButtons()) { + tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p, + TQRect(1, 1, width()-3, height()-2), + colors, sunken ? TQStyle::Style_On : TQStyle::Style_Raised); + } + else { + tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonTool, p, TQRect(1, 1, width()-2, height()-2), colors, sunken ? TQStyle::Style_Down : TQStyle::Style_Raised); + } } // shift button label on sunken buttons @@ -688,7 +695,7 @@ void TaskContainer::drawButton(TQPainter *p) } } - int availableWidth = width() - (br.x() * 2) - textPos - 2; + int availableWidth = width() - (br.x() * 2) - textPos - 2 - KickerSettings::showDeepButtons()?2:0; if (m_filteredTasks.count() > 1) { availableWidth -= 8; |