|
|
@ -32,6 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
#include <tqtimer.h>
|
|
|
|
#include <tqtimer.h>
|
|
|
|
#include <tqtooltip.h>
|
|
|
|
#include <tqtooltip.h>
|
|
|
|
#include <tqvbox.h>
|
|
|
|
#include <tqvbox.h>
|
|
|
|
|
|
|
|
#include <tqimage.h>
|
|
|
|
|
|
|
|
#include <tqstyle.h>
|
|
|
|
#include <qxembed.h>
|
|
|
|
#include <qxembed.h>
|
|
|
|
#include <tqcolor.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_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_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,
|
|
|
|
ExtensionContainer::ExtensionContainer(const AppletInfo& info,
|
|
|
|
const TQString& extensionId,
|
|
|
|
const TQString& extensionId,
|
|
|
|
TQWidget *parent)
|
|
|
|
TQWidget *parent)
|
|
|
@ -109,6 +120,7 @@ ExtensionContainer::ExtensionContainer(KPanelExtension* extension,
|
|
|
|
_info(info),
|
|
|
|
_info(info),
|
|
|
|
_ltHB(0),
|
|
|
|
_ltHB(0),
|
|
|
|
_rbHB(0),
|
|
|
|
_rbHB(0),
|
|
|
|
|
|
|
|
_resizeHandle(0),
|
|
|
|
m_extension(extension),
|
|
|
|
m_extension(extension),
|
|
|
|
m_maintainFocus(0),
|
|
|
|
m_maintainFocus(0),
|
|
|
|
m_panelOrder(ExtensionManager::the()->nextPanelOrder())
|
|
|
|
m_panelOrder(ExtensionManager::the()->nextPanelOrder())
|
|
|
@ -223,6 +235,11 @@ TQSize ExtensionContainer::tqsizeHint(KPanelExtension::Position p, const TQSize
|
|
|
|
height += 1; // border
|
|
|
|
height += 1; // border
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
height += (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); // resize handle area
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings.showLeftHideButton())
|
|
|
|
if (m_settings.showLeftHideButton())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
width += m_settings.hideButtonSize();
|
|
|
|
width += m_settings.hideButtonSize();
|
|
|
@ -243,6 +260,11 @@ TQSize ExtensionContainer::tqsizeHint(KPanelExtension::Position p, const TQSize
|
|
|
|
width += 1; // border
|
|
|
|
width += 1; // border
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
width += (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE); // resize handle area
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings.showLeftHideButton())
|
|
|
|
if (m_settings.showLeftHideButton())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
height += m_settings.hideButtonSize();
|
|
|
|
height += m_settings.hideButtonSize();
|
|
|
@ -1186,6 +1208,11 @@ int ExtensionContainer::arrangeHideButtons()
|
|
|
|
--maxWidth;
|
|
|
|
--maxWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
maxWidth = maxWidth - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_ltHB)
|
|
|
|
if (_ltHB)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_ltHB->setMaximumWidth(maxWidth);
|
|
|
|
_ltHB->setMaximumWidth(maxWidth);
|
|
|
@ -1211,6 +1238,11 @@ int ExtensionContainer::arrangeHideButtons()
|
|
|
|
--maxHeight;
|
|
|
|
--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 vertAlignment = (position() == KPanelExtension::Top) ? Qt::AlignTop : 0;
|
|
|
|
int leftAlignment = Qt::AlignRight;
|
|
|
|
int leftAlignment = Qt::AlignRight;
|
|
|
|
|
|
|
|
|
|
|
@ -1261,11 +1293,15 @@ int ExtensionContainer::setupBorderSpace()
|
|
|
|
_layout->setColSpacing(0, 0);
|
|
|
|
_layout->setColSpacing(0, 0);
|
|
|
|
_layout->setColSpacing(2, 0);
|
|
|
|
_layout->setColSpacing(2, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (!needsBorder())
|
|
|
|
if (!needsBorder() && !KickerSettings::useResizeHandle())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int borderWidth = 1;
|
|
|
|
|
|
|
|
if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
borderWidth = PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE;
|
|
|
|
|
|
|
|
|
|
|
|
int layoutOffset = 0;
|
|
|
|
int layoutOffset = 0;
|
|
|
|
TQRect r = TQApplication::desktop()->screenGeometry(xineramaScreen());
|
|
|
|
TQRect r = TQApplication::desktop()->screenGeometry(xineramaScreen());
|
|
|
|
TQRect h = geometry();
|
|
|
|
TQRect h = geometry();
|
|
|
@ -1274,14 +1310,14 @@ int ExtensionContainer::setupBorderSpace()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (h.top() > 0)
|
|
|
|
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);
|
|
|
|
_layout->setRowSpacing(0, topHeight);
|
|
|
|
++layoutOffset;
|
|
|
|
++layoutOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (h.bottom() < r.bottom())
|
|
|
|
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);
|
|
|
|
_layout->setRowSpacing(1, bottomHeight);
|
|
|
|
++layoutOffset;
|
|
|
|
++layoutOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1290,14 +1326,14 @@ int ExtensionContainer::setupBorderSpace()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (h.left() > 0)
|
|
|
|
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);
|
|
|
|
_layout->setColSpacing(0, leftWidth);
|
|
|
|
++layoutOffset;
|
|
|
|
++layoutOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (h.right() < r.right())
|
|
|
|
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);
|
|
|
|
_layout->setColSpacing(1, rightWidth);
|
|
|
|
++layoutOffset;
|
|
|
|
++layoutOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1306,20 +1342,20 @@ int ExtensionContainer::setupBorderSpace()
|
|
|
|
switch (position())
|
|
|
|
switch (position())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case KPanelExtension::Left:
|
|
|
|
case KPanelExtension::Left:
|
|
|
|
_layout->setColSpacing(2, 1);
|
|
|
|
_layout->setColSpacing(2, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KPanelExtension::Right:
|
|
|
|
case KPanelExtension::Right:
|
|
|
|
_layout->setColSpacing(0, 1);
|
|
|
|
_layout->setColSpacing(0, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KPanelExtension::Top:
|
|
|
|
case KPanelExtension::Top:
|
|
|
|
_layout->setRowSpacing(2, 1);
|
|
|
|
_layout->setRowSpacing(2, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case KPanelExtension::Bottom:
|
|
|
|
case KPanelExtension::Bottom:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
_layout->setRowSpacing(0, 1);
|
|
|
|
_layout->setRowSpacing(0, PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1361,6 +1397,39 @@ void ExtensionContainer::paintEvent(TQPaintEvent *e)
|
|
|
|
p.setPen(palette().color(TQPalette::Active, TQColorGroup::Mid));
|
|
|
|
p.setPen(palette().color(TQPalette::Active, TQColorGroup::Mid));
|
|
|
|
p.drawRect(0, 0, width(), height());
|
|
|
|
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*)
|
|
|
|
void ExtensionContainer::leaveEvent(TQEvent*)
|
|
|
@ -1469,7 +1538,7 @@ void ExtensionContainer::arrange(KPanelExtension::Position p,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_settings.setPosition(p);
|
|
|
|
m_settings.setPosition(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!needsBorder())
|
|
|
|
else if (!needsBorder() && !KickerSettings::useResizeHandle())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// this ensures that the layout gets rejigged
|
|
|
|
// this ensures that the layout gets rejigged
|
|
|
|
// even if position doesn't change
|
|
|
|
// even if position doesn't change
|
|
|
@ -1653,6 +1722,10 @@ void ExtensionContainer::resetLayout()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_extension->setFixedHeight(height() - 1);
|
|
|
|
m_extension->setFixedHeight(height() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_extension->setFixedHeight(height() - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE));
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_extension->setFixedHeight(height());
|
|
|
|
m_extension->setFixedHeight(height());
|
|
|
@ -1679,6 +1752,10 @@ void ExtensionContainer::resetLayout()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_extension->setFixedWidth(width() - 1);
|
|
|
|
m_extension->setFixedWidth(width() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (KickerSettings::useResizeHandle())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_extension->setFixedWidth(width() - (PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE));
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_extension->setFixedWidth(width());
|
|
|
|
m_extension->setFixedWidth(width());
|
|
|
@ -1690,7 +1767,7 @@ void ExtensionContainer::resetLayout()
|
|
|
|
|
|
|
|
|
|
|
|
bool ExtensionContainer::needsBorder() const
|
|
|
|
bool ExtensionContainer::needsBorder() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return !KickerSettings::transparent();
|
|
|
|
return !KickerSettings::transparent() && !KickerSettings::useResizeHandle();
|
|
|
|
//&& !KickerSettings::useBackgroundTheme();
|
|
|
|
//&& !KickerSettings::useBackgroundTheme();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|