Darrell Anderson 12 years ago
commit 308537cb0e

@ -113,6 +113,7 @@ public:
static void setGlobalMouseTracking( bool enable );
#ifndef QT_NO_PALETTE
static TQPalette palette( const TQWidget* = 0 );
static TQPalette palette( TQStringList );
static void setPalette( const TQPalette &, bool informWidgets=FALSE,
const char* className = 0 );
#endif

@ -458,6 +458,11 @@ public:
PE_HeaderSectionMenu,
PE_PanelScrollBar,
PE_MenuItemIndicatorFrame,
PE_MenuItemIndicatorIconFrame,
PE_MenuItemIndicatorCheck,
// do not add any values below/greater this
PE_CustomBase = 0xf000000
};
@ -830,6 +835,13 @@ public:
PM_MenuBarItemSpacing,
PM_ToolBarItemSpacing,
PM_MenuIndicatorFrameHBorder,
PM_MenuIndicatorFrameVBorder,
PM_MenuIconIndicatorFrameHBorder,
PM_MenuIconIndicatorFrameVBorder,
PM_ArrowSize,
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000
};
@ -1029,6 +1041,9 @@ public:
// bool - hide underlined accelerators uless Alt key is currently down
SH_HideUnderlineAcceleratorWhenAltUp,
// int - width of menu check column
SH_MenuIndicatorColumnWidth,
// do not add any values below/greater than this
SH_CustomBase = 0xf0000000
};

@ -1847,6 +1847,37 @@ TQPalette TQApplication::palette(const TQWidget* w)
return *app_pal;
}
TQPalette TQApplication::palette(TQStringList objectTypeList)
{
#if defined(QT_CHECK_STATE)
if ( !tqApp )
tqWarning( "TQApplication::palette: This function can only be "
"called after the TQApplication object has been created" );
#endif
if ( !app_pal ) {
if ( !tqt_std_pal )
tqt_create_std_palette();
app_pal = new TQPalette( *tqt_std_pal );
tqt_fix_tooltips();
}
if ( (objectTypeList.count() > 0) && app_palettes ) {
TQPalette* wp = app_palettes->find( objectTypeList[objectTypeList.count()-1] );
if ( wp ) {
return *wp;
}
TQAsciiDictIterator<TQPalette> it( *app_palettes );
const char* name;
while ( (name=it.currentKey()) != 0 ) {
if ( objectTypeList.contains(name) ) {
return *it.current();
}
++it;
}
}
return *app_pal;
}
/*!
Changes the default application palette to \a palette. If \a
informWidgets is TRUE, then existing widgets are informed about the

@ -60,9 +60,20 @@ public:
int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 );
void drawPrimitive( PrimitiveElement pe,
TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const;
void drawControl( ControlElement element, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r,
const TQColorGroup &cg, SFlags how = Style_Default, const TQStyleOption& = TQStyleOption::Default, const TQWidget *w = 0 );
int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const;
private: // Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY)
TQCompactStyle( const TQCompactStyle & );

@ -124,6 +124,8 @@ public:
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget *) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:

@ -2870,6 +2870,9 @@ int TQCommonStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData,
case PM_TabBarScrollButtonWidth:
ret = 16;
break;
case PM_ArrowSize:
ret = 7;
break;
default:
ret = 0;
break;

@ -67,6 +67,12 @@ int TQCompactStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData c
case PM_MaximumDragDistance:
ret = -1;
break;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
ret = 0;
break;
default:
ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget );
break;
@ -189,13 +195,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
return;
if ( mi->isChecked() ) {
if ( act && !dis ) {
qDrawShadePanel( p, x, y, checkcol, h,
g, TRUE, 1, &g.brush( TQColorGroup::Button ) );
} else {
qDrawShadePanel( p, x, y, checkcol, h,
g, TRUE, 1, &g.brush( TQColorGroup::Midlight ) );
}
drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt );
} else if ( !act ) {
p->fillRect(x, y, checkcol , h,
g.brush( TQColorGroup::Button ));
@ -214,7 +214,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
int pixh = pixmap.height();
if ( act && !dis ) {
if ( !mi->isChecked() )
qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( TQColorGroup::Button ) );
drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt );
}
TQRect cr( x, y, checkcol, h );
TQRect pmr( 0, 0, pixw, pixh );
@ -226,18 +226,8 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
g.brush( TQColorGroup::Button );
p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill);
} else if ( checkable ) { // just "checking"...
int mw = checkcol + motifItemFrame;
int mh = h - 2*motifItemFrame;
if ( mi->isChecked() ) {
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(x + motifItemFrame + 2, y + motifItemFrame,
mw, mh), itemg, cflags, opt );
drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt );
}
}
@ -319,4 +309,87 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC
}
}
/*! \reimp */
void TQCompactStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags,
const TQStyleOption& opt ) const
{
bool dis = !(flags & Style_Enabled);
bool act = flags & Style_Active;
int x, y, w, h;
r.rect( &x, &y, &w, &h );
switch (pe) {
case PE_MenuItemIndicatorFrame:
{
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
if ( act && !dis ) {
qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
} else {
qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
}
}
break;
case PE_MenuItemIndicatorIconFrame:
{
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
qDrawShadePanel( p, x, y, checkcol, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) );
}
break;
case PE_MenuItemIndicatorCheck:
{
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
int mw = checkcol + motifItemFrame;
int mh = h - 2*motifItemFrame;
SFlags cflags = Style_Default;
if (! dis) {
cflags |= Style_Enabled;
}
if (act) {
cflags |= Style_On;
}
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect(x + motifItemFrame + 2, y + motifItemFrame, mw, mh), cg, cflags, opt );
}
break;
default:
break;
}
}
/*! \reimp */
int TQCompactStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
{
int ret;
switch (sh) {
case SH_MenuIndicatorColumnWidth:
{
int maxpmw = opt.maxIconWidth();
bool checkable = (elementFlags & CEF_IsCheckable);
if ( checkable )
maxpmw = TQMAX( maxpmw, 8 ); // space for the checkmarks
ret = maxpmw;
}
break;
default:
ret = TQWindowsStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
break;
}
return ret;
}
#endif

@ -263,6 +263,13 @@ int TQMotifPlusStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData
ret = 11;
break;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
ret = 2;
break;
default:
ret = TQMotifStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
@ -282,6 +289,9 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
SFlags flags,
const TQStyleOption& opt ) const
{
bool dis = ! (flags & Style_Enabled);
bool act = flags & Style_Active;
switch (pe) {
case PE_HeaderSection:
@ -638,6 +648,47 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
break;
}
case PE_PanelScrollBar:
{
drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Mid));
break;
}
case PE_MenuItemIndicatorFrame:
{
// Draw nothing
break;
}
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect(&x, &y, &w, &h);
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r );
qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
break;
}
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect(&x, &y, &w, &h);
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r );
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags);
break;
}
default:
TQMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break;
@ -795,8 +846,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
TQRect vrect = visualRect( TQRect( x+2, y+2, checkcol, h-2 ), r );
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2,
cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else if ( !act ) {
p->fillRect(vrect,
@ -828,13 +878,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
} else if (checkable) {
if (mi->isChecked()) {
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
@ -1147,8 +1191,12 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
if (controls == (SC_ScrollBarAddLine | SC_ScrollBarSubLine |
SC_ScrollBarAddPage | SC_ScrollBarSubPage |
SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSlider))
drawMotifPlusShade(p, widget->rect(), cg, TRUE, FALSE,
&cg.brush(TQColorGroup::Mid));
drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg,
((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarLast) ?
Style_Down : Style_Default) |
((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarSubLine) && subline.isValid())
drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
@ -1559,6 +1607,17 @@ int TQMotifPlusStyle::styleHint(StyleHint hint,
case SH_PopupMenu_MouseTracking:
ret = 1;
break;
case SH_MenuIndicatorColumnWidth:
{
int maxpmw = opt.maxIconWidth();
bool checkable = (elementFlags & CEF_IsCheckable);
if (checkable)
maxpmw = TQMAX(maxpmw, 15);
ret = maxpmw;
break;
}
default:
ret = TQMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;

@ -211,6 +211,9 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
SFlags flags,
const TQStyleOption& opt ) const
{
bool dis = ! (flags & Style_Enabled);
bool act = flags & Style_Active;
switch( pe ) {
#ifndef QT_NO_LISTVIEW
case PE_CheckListExclusiveIndicator: {
@ -761,6 +764,52 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
r.height() - 4, cg.brush(TQColorGroup::Highlight));
break;
case PE_PanelScrollBar:
qDrawShadePanel(p, r, cg, TRUE,
pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags),
&cg.brush(TQColorGroup::Mid));
break;
case PE_MenuItemIndicatorFrame:
{
// Draw nothing
break;
}
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r );
int xvis = vrect.x();
qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
break;
}
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r );
int xvis = vrect.x();
int mw = checkcol;
int mh = h - 2*motifItemFrame;
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags);
break;
}
default:
TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break;
@ -1050,8 +1099,7 @@ void TQMotifStyle::drawControl( ControlElement element,
int xvis = vrect.x();
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame,
cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else if ( !act ) {
p->fillRect(xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame,
@ -1076,18 +1124,8 @@ void TQMotifStyle::drawControl( ControlElement element,
p->drawPixmap( pmr.topLeft(), pixmap );
} else if ( checkable ) { // just "checking"...
int mw = checkcol;
int mh = h - 2*motifItemFrame;
if ( mi->isChecked() ) {
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
TQRect(xvis, y+motifItemFrame, mw, mh),
cg, cflags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
@ -1339,9 +1377,10 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage |
SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast |
SC_ScrollBarSlider))
qDrawShadePanel(p, ceData.rect, cg, TRUE,
pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget),
&cg.brush(TQColorGroup::Mid));
drawPrimitive(PE_PanelScrollBar, p, ceData, elementFlags, ceData.rect, cg,
((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default));
TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub,
subActive, opt, widget);
break;
@ -1538,6 +1577,13 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceD
ret = 13;
break;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
ret = motifItemFrame;
break;
default:
ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget );
break;
@ -2346,6 +2392,18 @@ int TQMotifStyle::styleHint(StyleHint hint,
ret = 0;
break;
case SH_MenuIndicatorColumnWidth:
{
int maxpmw = opt.maxIconWidth();
bool checkable = (elementFlags & CEF_IsCheckable);
if ( checkable )
maxpmw = TQMAX( maxpmw, motifCheckMarkSpace );
ret = maxpmw;
break;
}
default:
ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;

@ -398,6 +398,14 @@ int TQSGIStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceDat
case PM_SplitterWidth:
return TQMAX( 10, TQApplication::globalStrut().width() );
case PM_MenuIndicatorFrameHBorder:
return (sgiItemFrame+2);
case PM_MenuIndicatorFrameVBorder:
return (sgiItemFrame+4);
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
return sgiItemFrame;
default:
break;
}
@ -567,6 +575,9 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled );
bool dis = ! (flags & Style_Enabled);
bool act = flags & Style_Active;
switch ( pe ) {
case PE_ButtonCommand:
{
@ -878,6 +889,51 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
}
break;
case PE_MenuItemIndicatorFrame:
{
int x, y, w, h;
r.rect(&x, &y, &w, &h);
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
er.addCoords( 1, 1, -1, -1 );
drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt );
}
break;
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect(&x, &y, &w, &h);
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) );
}
break;
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect(&x, &y, &w, &h);
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
er.addCoords( 1, 1, -1, -1 );
er.addCoords( 0, 1, 1, 1 );
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt );
}
break;
default:
TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break;
@ -990,8 +1046,7 @@ void TQSGIStyle::drawControl( ControlElement element,
if ( mi->isChecked() ) {
if ( mi->iconSet() ) {
drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame,
cg, TRUE, 1, &cg.brush( TQColorGroup::Light ) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
}
} else {
if ( !act )
@ -1018,20 +1073,9 @@ void TQSGIStyle::drawControl( ControlElement element,
p->drawPixmap( pmr.topLeft(), pixmap );
} else {
if ( checkable ) {
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
if ( mi->isChecked() ) {
TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3,
pixelMetric(PM_IndicatorWidth, ceData, elementFlags),
pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
er.addCoords( 1, 1, -1, -1 );
drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt );
er.addCoords( 0, 1, 1, 1 );
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt );
drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
}
@ -1467,4 +1511,28 @@ TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control,
return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget );
}
/*! \reimp */
int TQSGIStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
{
int ret;
switch (sh) {
case SH_MenuIndicatorColumnWidth:
{
int maxpmw = opt.maxIconWidth();
bool checkable = ( elementFlags & CEF_IsCheckable );
if ( checkable )
maxpmw = TQMAX( maxpmw, sgiCheckMarkSpace );
ret = maxpmw;
}
break;
default:
ret = TQMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
break;
}
return ret;
}
#endif // QT_NO_STYLE_SGI

@ -225,6 +225,9 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
SFlags flags,
const TQStyleOption& opt ) const
{
bool dis = !(flags & Style_Enabled);
bool act = flags & Style_Active;
TQRect rr( r );
switch (pe) {
case PE_ButtonCommand:
@ -568,6 +571,63 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
}
break;
case PE_MenuItemIndicatorFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r );
int xvis = vrect.x();
if ( act && !dis ) {
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
}
else {
TQBrush fill( cg.light(), Dense4Pattern );
// set the brush origin for the hash pattern to the x/y coordinate
// of the menu item's checkmark... this way, the check marks have
// a consistent look
TQPoint origin = p->brushOrigin();
p->setBrushOrigin( xvis, y );
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill );
// restore the previous brush origin
p->setBrushOrigin( origin );
}
}
break;
case PE_MenuItemIndicatorIconFrame:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r );
int xvis = vrect.x();
qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) );
}
break;
case PE_MenuItemIndicatorCheck:
{
int x, y, w, h;
r.rect( &x, &y, &w, &h );
int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
int xp = x + windowsItemFrame;
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags);
}
break;
default:
if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
TQPointArray a;
@ -809,21 +869,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r );
int xvis = vrect.x();
if ( mi->isChecked() ) {
if ( act && !dis )
qDrawShadePanel( p, xvis, y, checkcol, h,
cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) );
else {
TQBrush fill( cg.light(), Dense4Pattern );
// set the brush origin for the hash pattern to the x/y coordinate
// of the menu item's checkmark... this way, the check marks have
// a consistent look
TQPoint origin = p->brushOrigin();
p->setBrushOrigin( xvis, y );
qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1,
&fill );
// restore the previous brush origin
p->setBrushOrigin( origin );
}
drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
} else if (! act)
p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button ));
@ -839,8 +885,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
int pixw = pixmap.width();
int pixh = pixmap.height();
if ( act && !dis && !mi->isChecked() )
qDrawShadePanel( p, xvis, y, checkcol, h, cg, FALSE, 1,
&cg.brush( TQColorGroup::Button ) );
drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
TQRect pmr( 0, 0, pixw, pixh );
pmr.moveCenter( vrect.center() );
p->setPen( cg.text() );
@ -851,20 +896,9 @@ void TQWindowsStyle::drawControl( ControlElement element,
cg.brush( TQColorGroup::Button ));
int xp = xpos + checkcol + 1;
p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill);
} else if ( checkable ) { // just "checking"...
} else if ( checkable ) { // just "checking"...
if ( mi->isChecked() ) {
int xp = xpos + windowsItemFrame;
SFlags cflags = Style_Default;
if (! dis)
cflags |= Style_Enabled;
if (act)
cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
visualRect( TQRect(xp, y + windowsItemFrame,
checkcol - 2*windowsItemFrame,
h - 2*windowsItemFrame), r ), cg, cflags);
drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
}
}
@ -1042,6 +1076,13 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ce
ret = TQMAX( 6, TQApplication::globalStrut().width() );
break;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
ret = windowsItemFrame;
break;
default:
ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break;
@ -1965,6 +2006,23 @@ int TQWindowsStyle::styleHint( StyleHint hint,
ret = 0;
break;
case SH_MenuIndicatorColumnWidth:
{
int maxpmw = opt.maxIconWidth();
bool checkable = ( elementFlags & CEF_IsCheckable );
if ( checkable ) {
// space for the checkmarks
if (use2000style)
maxpmw = TQMAX( maxpmw, 20 );
else
maxpmw = TQMAX( maxpmw, 12 );
}
ret = maxpmw;
break;
}
default:
ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break;

@ -90,6 +90,20 @@ public:
void setVisible( bool visible ) { is_visible = visible; }
void setWhatsThis( const TQString &text ) { whatsthis_data = text; }
// Do not use these methods unless you know exactly what you are doing!
void setSeparator( bool separator ) { is_separator = separator; }
void setEnabled( bool enabled ) { is_enabled = enabled; }
void setChecked( bool checked ) { is_checked = checked; }
void setIdent( int identifier ) { ident = identifier; }
void setIconSet( TQIconSet* iconset ) { iconset_data = iconset; }
void setPixmap( TQPixmap* pixmap ) { pixmap_data = pixmap; }
void setPopup( TQPopupMenu* popup ) { popup_menu = popup; }
void setWidget( TQWidget* widget ) { widget_item = widget; }
#ifndef QT_NO_ACCEL
void setKey( TQKeySequence key ) { accel_key = key; }
#endif
void setSignal( TQSignal* signal ) { signal_data = signal; }
private:
int ident; // item identifier
TQIconSet *iconset_data; // icons

Loading…
Cancel
Save