|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* TQtCKStyle
|
|
|
|
|
* TQtCTDEStyle
|
|
|
|
|
* Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech,
|
|
|
|
@ -56,7 +56,7 @@
|
|
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
|
|
struct TQtCKStylePrivate
|
|
|
|
|
struct TQtCTDEStylePrivate
|
|
|
|
|
{
|
|
|
|
|
bool highcolor : 1;
|
|
|
|
|
bool useFilledFrameWorkaround : 1;
|
|
|
|
@ -68,8 +68,8 @@ struct TQtCKStylePrivate
|
|
|
|
|
int popupMenuDelay;
|
|
|
|
|
float menuOpacity;
|
|
|
|
|
|
|
|
|
|
TQtCKStyle::KStyleScrollBarType scrollbarType;
|
|
|
|
|
TQtCKStyle::KStyleFlags flags;
|
|
|
|
|
TQtCTDEStyle::TDEStyleScrollBarType scrollbarType;
|
|
|
|
|
TQtCTDEStyle::TDEStyleFlags flags;
|
|
|
|
|
|
|
|
|
|
//For KPE_ListViewBranch
|
|
|
|
|
TQBitmap *verticalLine;
|
|
|
|
@ -79,8 +79,8 @@ struct TQtCKStylePrivate
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQtCKStyle::TQtCKStyle( KStyleFlags flags, KStyleScrollBarType sbtype )
|
|
|
|
|
: TQCommonStyle(), d(new TQtCKStylePrivate)
|
|
|
|
|
TQtCTDEStyle::TQtCTDEStyle( TDEStyleFlags flags, TDEStyleScrollBarType sbtype )
|
|
|
|
|
: TQCommonStyle(), d(new TQtCTDEStylePrivate)
|
|
|
|
|
{
|
|
|
|
|
d->flags = flags;
|
|
|
|
|
d->useFilledFrameWorkaround = (flags & FilledFrameWorkaround);
|
|
|
|
@ -89,19 +89,19 @@ TQtCKStyle::TQtCKStyle( KStyleFlags flags, KStyleScrollBarType sbtype )
|
|
|
|
|
|
|
|
|
|
// Read style settings
|
|
|
|
|
TQSettings settings;
|
|
|
|
|
d->popupMenuDelay = settings.readNumEntry ("/TQtCKStyle/Settings/PopupMenuDelay", 256);
|
|
|
|
|
d->sloppySubMenus = settings.readBoolEntry("/TQtCKStyle/Settings/SloppySubMenus", false);
|
|
|
|
|
d->etchDisabledText = settings.readBoolEntry("/TQtCKStyle/Settings/EtchDisabledText", true);
|
|
|
|
|
d->menuAltKeyNavigation = settings.readBoolEntry("/TQtCKStyle/Settings/MenuAltKeyNavigation", true);
|
|
|
|
|
d->scrollablePopupmenus = settings.readBoolEntry("/TQtCKStyle/Settings/ScrollablePopupMenus", false);
|
|
|
|
|
d->menuDropShadow = settings.readBoolEntry("/TQtCKStyle/Settings/MenuDropShadow", false);
|
|
|
|
|
d->popupMenuDelay = settings.readNumEntry ("/TQtCTDEStyle/Settings/PopupMenuDelay", 256);
|
|
|
|
|
d->sloppySubMenus = settings.readBoolEntry("/TQtCTDEStyle/Settings/SloppySubMenus", false);
|
|
|
|
|
d->etchDisabledText = settings.readBoolEntry("/TQtCTDEStyle/Settings/EtchDisabledText", true);
|
|
|
|
|
d->menuAltKeyNavigation = settings.readBoolEntry("/TQtCTDEStyle/Settings/MenuAltKeyNavigation", true);
|
|
|
|
|
d->scrollablePopupmenus = settings.readBoolEntry("/TQtCTDEStyle/Settings/ScrollablePopupMenus", false);
|
|
|
|
|
d->menuDropShadow = settings.readBoolEntry("/TQtCTDEStyle/Settings/MenuDropShadow", false);
|
|
|
|
|
|
|
|
|
|
d->verticalLine = 0;
|
|
|
|
|
d->horizontalLine = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQtCKStyle::~TQtCKStyle()
|
|
|
|
|
TQtCTDEStyle::~TQtCTDEStyle()
|
|
|
|
|
{
|
|
|
|
|
delete d->verticalLine;
|
|
|
|
|
delete d->horizontalLine;
|
|
|
|
@ -110,7 +110,7 @@ TQtCKStyle::~TQtCKStyle()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString TQtCKStyle::defaultStyle()
|
|
|
|
|
TQString TQtCTDEStyle::defaultStyle()
|
|
|
|
|
{
|
|
|
|
|
if (TQPixmap::defaultDepth() > 8)
|
|
|
|
|
return TQString("plastik");
|
|
|
|
@ -119,7 +119,7 @@ TQString TQtCKStyle::defaultStyle()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
void TQtCTDEStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
@ -136,7 +136,7 @@ void TQtCKStyle::polish( TQStyleControlElementData ceData, ControlElementFlags e
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
void TQtCTDEStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
@ -154,7 +154,7 @@ void TQtCKStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Style changes (should) always re-polish popups.
|
|
|
|
|
void TQtCKStyle::polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
void TQtCTDEStyle::polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
|
|
|
|
|
{
|
|
|
|
|
if ( !(ceData.windowState & WState_Polished ) ) {
|
|
|
|
|
widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable);
|
|
|
|
@ -163,20 +163,20 @@ void TQtCKStyle::polishPopupMenu( TQStyleControlElementData ceData, ControlEleme
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
// TQtCKStyle extensions
|
|
|
|
|
// TQtCTDEStyle extensions
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::setScrollBarType(KStyleScrollBarType sbtype)
|
|
|
|
|
void TQtCTDEStyle::setScrollBarType(TDEStyleScrollBarType sbtype)
|
|
|
|
|
{
|
|
|
|
|
d->scrollbarType = sbtype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQtCKStyle::KStyleFlags TQtCKStyle::styleFlags() const
|
|
|
|
|
TQtCTDEStyle::TDEStyleFlags TQtCTDEStyle::styleFlags() const
|
|
|
|
|
{
|
|
|
|
|
return d->flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
|
void TQtCTDEStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe,
|
|
|
|
|
TQPainter* p,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
@ -364,7 +364,7 @@ void TQtCKStyle::drawKStylePrimitive( KStylePrimitive kpe,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int TQtCKStyle::kPixelMetric( KStylePixelMetric kpm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* /* widget */) const
|
|
|
|
|
int TQtCTDEStyle::kPixelMetric( TDEStylePixelMetric kpm, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* /* widget */) const
|
|
|
|
|
{
|
|
|
|
|
int value;
|
|
|
|
|
switch(kpm)
|
|
|
|
@ -391,7 +391,7 @@ int TQtCKStyle::kPixelMetric( KStylePixelMetric kpm, TQStyleControlElementData c
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
void TQtCTDEStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
TQPainter* p,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
@ -419,16 +419,16 @@ void TQtCKStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
(parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock
|
|
|
|
|
|
|
|
|
|
// Draw a toolbar handle
|
|
|
|
|
drawKStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
drawTDEStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
|
|
|
|
|
else if ( widget->inherits(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING) )
|
|
|
|
|
|
|
|
|
|
// Draw a dock window handle
|
|
|
|
|
drawKStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
drawTDEStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
// General handle, probably a kicker applet handle.
|
|
|
|
|
drawKStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
drawTDEStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget );
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
|
|
|
|
@ -436,7 +436,7 @@ void TQtCKStyle::drawPrimitive( PrimitiveElement pe,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::drawControl( ControlElement element,
|
|
|
|
|
void TQtCTDEStyle::drawControl( ControlElement element,
|
|
|
|
|
TQPainter* p,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
@ -741,7 +741,7 @@ void TQtCKStyle::drawControl( ControlElement element,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect TQtCKStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
|
|
|
|
|
TQRect TQtCTDEStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
|
|
|
|
|
{
|
|
|
|
|
switch(r)
|
|
|
|
|
{
|
|
|
|
@ -763,7 +763,7 @@ TQRect TQtCKStyle::subRect(SubRect r, const TQStyleControlElementData ceData, co
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int TQtCKStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget) const
|
|
|
|
|
int TQtCTDEStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget* widget) const
|
|
|
|
|
{
|
|
|
|
|
switch(m)
|
|
|
|
|
{
|
|
|
|
@ -888,7 +888,7 @@ static TQListViewItem* nextVisibleSibling(TQListViewItem* item)
|
|
|
|
|
return sibling;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
void TQtCTDEStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
TQPainter* p,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
@ -1004,7 +1004,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
|
|
|
|
|
// Draw slider groove
|
|
|
|
|
if ((controls & SC_SliderGroove) && groove.isValid()) {
|
|
|
|
|
drawKStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget );
|
|
|
|
|
drawTDEStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget );
|
|
|
|
|
|
|
|
|
|
// Draw the focus rect around the groove
|
|
|
|
|
if (slider->hasFocus())
|
|
|
|
@ -1020,7 +1020,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
if ((controls & SC_SliderHandle) && handle.isValid()) {
|
|
|
|
|
if (active == SC_SliderHandle)
|
|
|
|
|
flags |= Style_Active;
|
|
|
|
|
drawKStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget );
|
|
|
|
|
drawTDEStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p2.end();
|
|
|
|
@ -1100,8 +1100,8 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
boxrect = TQRect( bx-4, linebot-4, 9, 9 );
|
|
|
|
|
boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On;
|
|
|
|
|
|
|
|
|
|
// TQtCKStyle extension: Draw the box and expand/collapse indicator
|
|
|
|
|
drawKStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL );
|
|
|
|
|
// TQtCTDEStyle extension: Draw the box and expand/collapse indicator
|
|
|
|
|
drawTDEStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL );
|
|
|
|
|
|
|
|
|
|
// dotlinery
|
|
|
|
|
p->setPen( cg.mid() );
|
|
|
|
@ -1154,8 +1154,8 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
branchrect = TQRect( point, other-(thickness/2), end-point, thickness );
|
|
|
|
|
branchflags = TQStyle::Style_Horizontal;
|
|
|
|
|
|
|
|
|
|
// TQtCKStyle extension: Draw the horizontal branch
|
|
|
|
|
drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
|
|
|
|
|
// TQtCTDEStyle extension: Draw the horizontal branch
|
|
|
|
|
drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// Vertical branch
|
|
|
|
@ -1170,8 +1170,8 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
else
|
|
|
|
|
branchflags = TQStyle::Style_Default;
|
|
|
|
|
|
|
|
|
|
// TQtCKStyle extension: Draw the vertical branch
|
|
|
|
|
drawKStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
|
|
|
|
|
// TQtCTDEStyle extension: Draw the vertical branch
|
|
|
|
|
drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1186,7 +1186,7 @@ void TQtCKStyle::drawComplexControl( ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQStyle::SubControl TQtCKStyle::querySubControl( ComplexControl control,
|
|
|
|
|
TQStyle::SubControl TQtCTDEStyle::querySubControl( ComplexControl control,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQPoint &pos,
|
|
|
|
@ -1204,7 +1204,7 @@ TQStyle::SubControl TQtCKStyle::querySubControl( ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect TQtCKStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
TQRect TQtCTDEStyle::querySubControlMetrics( ComplexControl control,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
SubControl sc,
|
|
|
|
@ -1591,7 +1591,7 @@ static const char* const critical_xpm[]={
|
|
|
|
|
"...........aaaaaaaaaaa..........",
|
|
|
|
|
".............aaaaaaa............"};
|
|
|
|
|
|
|
|
|
|
TQPixmap TQtCKStyle::stylePixmap( StylePixmap stylepixmap,
|
|
|
|
|
TQPixmap TQtCTDEStyle::stylePixmap( StylePixmap stylepixmap,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQStyleOption& opt,
|
|
|
|
@ -1625,7 +1625,7 @@ TQPixmap TQtCKStyle::stylePixmap( StylePixmap stylepixmap,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int TQtCKStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
|
|
|
|
|
int TQtCTDEStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
|
|
|
|
|
const TQStyleOption &opt, TQStyleHintReturn* shr, const TQWidget* w) const
|
|
|
|
|
{
|
|
|
|
|
switch (sh)
|
|
|
|
@ -1680,7 +1680,7 @@ int TQtCKStyle::styleHint( StyleHint sh, TQStyleControlElementData ceData, Contr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TQtCKStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
|
bool TQtCTDEStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQObject* object = reinterpret_cast<TQObject*>(source);
|
|
|
|
@ -1734,7 +1734,7 @@ bool TQtCKStyle::objectEventHandler( TQStyleControlElementData ceData, ControlEl
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TQtCKStyle::virtual_hook( int, void* )
|
|
|
|
|
void TQtCTDEStyle::virtual_hook( int, void* )
|
|
|
|
|
{ /*BASE::virtual_hook( id, data );*/ }
|
|
|
|
|
|
|
|
|
|
// vim: set noet ts=4 sw=4:
|
|
|
|
|