summaryrefslogtreecommitdiffstats
path: root/kicker/libkicker
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-04 08:18:22 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-04 08:18:22 +0000
commit80035308b1907d75e7e09be7c8f6e14098edd533 (patch)
treed089bef7060df95dd21096b3e3f699036e617f02 /kicker/libkicker
parente98e745f1a8b79a0444e6a4d60b0cb5c1b1f1ce0 (diff)
downloadtdebase-80035308b1907d75e7e09be7c8f6e14098edd533.tar.gz
tdebase-80035308b1907d75e7e09be7c8f6e14098edd533.zip
Add initial support for Kicker "Deep Buttons", a more highly textured style than the normal "flat" Kicker GUI
Add preliminary GUI and configuration structures needed for hot-resizing panels git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1244835 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/libkicker')
-rw-r--r--kicker/libkicker/kickerSettings.kcfg11
-rw-r--r--kicker/libkicker/panelbutton.cpp80
-rw-r--r--kicker/libkicker/panelbutton.h7
3 files changed, 83 insertions, 15 deletions
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.