From 0836d4649ca26cc4e6e867ca5a4a3eafd995f807 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 30 Oct 2012 22:42:44 -0500 Subject: Automated update from Qt3 --- src/kernel/ntqapplication.h | 1 + src/kernel/ntqstyle.h | 7 ++++ src/kernel/qapplication.cpp | 31 ++++++++++++++ src/styles/ntqcompactstyle.h | 9 +++++ src/styles/qcommonstyle.cpp | 3 ++ src/styles/qcompactstyle.cpp | 74 +++++++++++++++++++++++++--------- src/styles/qmotifplusstyle.cpp | 41 ++++++++++++++----- src/styles/qmotifstyle.cpp | 46 ++++++++++++++------- src/styles/qsgistyle.cpp | 36 +++++++++++------ src/styles/qwindowsstyle.cpp | 91 ++++++++++++++++++++++++++++-------------- 10 files changed, 254 insertions(+), 85 deletions(-) diff --git a/src/kernel/ntqapplication.h b/src/kernel/ntqapplication.h index 98a0ef0e0..cdb7fdfc8 100644 --- a/src/kernel/ntqapplication.h +++ b/src/kernel/ntqapplication.h @@ -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 diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h index 165050a70..a65f62246 100644 --- a/src/kernel/ntqstyle.h +++ b/src/kernel/ntqstyle.h @@ -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,8 @@ public: PM_MenuBarItemSpacing, PM_ToolBarItemSpacing, + PM_ArrowSize, + // do not add any values below/greater than this PM_CustomBase = 0xf0000000 }; diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 71b87ffe0..a552c236c 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -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 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 diff --git a/src/styles/ntqcompactstyle.h b/src/styles/ntqcompactstyle.h index a9d343726..8511992da 100644 --- a/src/styles/ntqcompactstyle.h +++ b/src/styles/ntqcompactstyle.h @@ -60,6 +60,15 @@ 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 ); diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 0caac2c64..213f04781 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -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; diff --git a/src/styles/qcompactstyle.cpp b/src/styles/qcompactstyle.cpp index 30f219ed0..54b120851 100644 --- a/src/styles/qcompactstyle.cpp +++ b/src/styles/qcompactstyle.cpp @@ -189,13 +189,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, TQRect(x, y, checkcol, h), itemg, flags, opt ); } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( TQColorGroup::Button )); @@ -214,7 +208,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, TQRect(x, y, checkcol, h), itemg, flags, opt ); } TQRect cr( x, y, checkcol, h ); TQRect pmr( 0, 0, pixw, pixh ); @@ -226,18 +220,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, TQRect(x, y, checkcol, h), itemg, flags, opt ); } } @@ -319,4 +303,56 @@ 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: + { + if ( act && !dis ) { + qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + } else { + qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); + } + } + break; + case PE_MenuItemIndicatorIconFrame: + { + qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + } + break; + case PE_MenuItemIndicatorCheck: + { + int mw = w + 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; + } +} + #endif diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 65fa0df91..d0b7fe980 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -282,6 +282,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 +641,28 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe, break; } + case PE_PanelScrollBar: + { + drawMotifPlusShade(p, r, cg, TRUE, FALSE, &cg.brush(TQColorGroup::Mid)); + break; + } + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + TQRect vrect = visualRect( TQRect( x+2, y+2, w, 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; @@ -828,13 +853,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, TQRect(x, y, checkcol, h), cg, flags); } } @@ -1147,8 +1166,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, diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index b404dc917..ea4da2073 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -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,30 @@ 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_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, w, h-2*motifItemFrame ), r ); + int xvis = vrect.x(); + int mw = w; + 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); + } + default: TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); break; @@ -1076,18 +1103,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, TQRect(x, y, checkcol, h), cg, flags); } } @@ -1339,9 +1356,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; diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index 930a34d09..8110f66de 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -567,6 +567,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 +881,25 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe, } 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 ); + 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 ); + } + break; + default: TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); break; @@ -1018,20 +1040,8 @@ 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_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, w, h), cg, flags); } } } diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp index dae52362f..b96a04b85 100644 --- a/src/styles/qwindowsstyle.cpp +++ b/src/styles/qwindowsstyle.cpp @@ -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,60 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, } break; + case PE_MenuItemIndicatorFrame: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + TQRect vrect = visualRect( TQRect( x, y, w, h ), r ); + int xvis = vrect.x(); + + if ( act && !dis ) { + qDrawShadePanel( p, xvis, y, w, 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, w, 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 ); + + TQRect vrect = visualRect( TQRect( x, y, w, 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 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, w - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); + } + break; + default: if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) { TQPointArray a; @@ -809,21 +866,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, TQRect(x, y, checkcol, h), cg, flags); } else if (! act) p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button )); @@ -839,8 +882,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, TQRect(x, y, checkcol, h), cg, flags); TQRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( vrect.center() ); p->setPen( cg.text() ); @@ -851,20 +893,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, TQRect(x, y, checkcol, h), cg, flags); } } -- cgit v1.2.1 From 2fce73142f9e5c46c909934b03bca5a30512a3d0 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 31 Oct 2012 12:39:49 -0500 Subject: Automated update from Qt3 --- src/kernel/ntqstyle.h | 8 +++++ src/styles/ntqcompactstyle.h | 2 ++ src/styles/ntqsgistyle.h | 2 ++ src/styles/qcompactstyle.cpp | 51 +++++++++++++++++++++++++++----- src/styles/qmotifplusstyle.cpp | 44 +++++++++++++++++++++++++--- src/styles/qmotifstyle.cpp | 60 +++++++++++++++++++++++++++++++------- src/styles/qsgistyle.cpp | 66 +++++++++++++++++++++++++++++++++++++++--- src/styles/qwindowsstyle.cpp | 43 ++++++++++++++++++++++----- 8 files changed, 243 insertions(+), 33 deletions(-) diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h index a65f62246..994eff811 100644 --- a/src/kernel/ntqstyle.h +++ b/src/kernel/ntqstyle.h @@ -835,6 +835,11 @@ public: PM_MenuBarItemSpacing, PM_ToolBarItemSpacing, + PM_MenuIndicatorFrameHBorder, + PM_MenuIndicatorFrameVBorder, + PM_MenuIconIndicatorFrameHBorder, + PM_MenuIconIndicatorFrameVBorder, + PM_ArrowSize, // do not add any values below/greater than this @@ -1036,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 }; diff --git a/src/styles/ntqcompactstyle.h b/src/styles/ntqcompactstyle.h index 8511992da..cc8c7e947 100644 --- a/src/styles/ntqcompactstyle.h +++ b/src/styles/ntqcompactstyle.h @@ -72,6 +72,8 @@ public: 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 & ); diff --git a/src/styles/ntqsgistyle.h b/src/styles/ntqsgistyle.h index 73be2ae84..bca63f282 100644 --- a/src/styles/ntqsgistyle.h +++ b/src/styles/ntqsgistyle.h @@ -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: diff --git a/src/styles/qcompactstyle.cpp b/src/styles/qcompactstyle.cpp index 54b120851..f2038a38c 100644 --- a/src/styles/qcompactstyle.cpp +++ b/src/styles/qcompactstyle.cpp @@ -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,7 +195,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC return; if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt ); } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( TQColorGroup::Button )); @@ -208,7 +214,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC int pixh = pixmap.height(); if ( act && !dis ) { if ( !mi->isChecked() ) - drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt ); } TQRect cr( x, y, checkcol, h ); TQRect pmr( 0, 0, pixw, pixh ); @@ -221,7 +227,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleC p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt ); } } @@ -322,21 +328,27 @@ void TQCompactStyle::drawPrimitive( PrimitiveElement pe, switch (pe) { case PE_MenuItemIndicatorFrame: { + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + if ( act && !dis ) { - qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); } else { - qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Midlight ) ); } } break; case PE_MenuItemIndicatorIconFrame: { - qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, &cg.brush( TQColorGroup::Button ) ); + 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 mw = w + motifItemFrame; + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; SFlags cflags = Style_Default; @@ -355,4 +367,29 @@ void TQCompactStyle::drawPrimitive( PrimitiveElement pe, } } +/*! \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 diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index d0b7fe980..6b56a3462 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -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; @@ -647,11 +654,30 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe, 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); - TQRect vrect = visualRect( TQRect( x+2, y+2, w, h-2 ), r ); + 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) @@ -820,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, @@ -853,7 +878,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element, } else if (checkable) { if (mi->isChecked()) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1582,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; diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index ea4da2073..3225e0e29 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -770,22 +770,44 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe, &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 ); - TQRect vrect = visualRect( TQRect( x+motifItemFrame, y+motifItemFrame, w, h-2*motifItemFrame ), r ); + 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 = w; + int mw = checkcol; int mh = h - 2*motifItemFrame; SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; + 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_CheckMark, p, ceData, elementFlags, TQRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + break; } default: @@ -1077,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, @@ -1104,7 +1125,7 @@ void TQMotifStyle::drawControl( ControlElement element, } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1556,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; @@ -2364,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; diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index 8110f66de..aa00c57f0 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -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; } @@ -881,7 +889,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe, } break; - case PE_MenuItemIndicatorCheck: + case PE_MenuItemIndicatorFrame: { int x, y, w, h; r.rect(&x, &y, &w, &h); @@ -895,6 +903,32 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe, 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 ); } @@ -1012,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 ) @@ -1041,7 +1074,8 @@ void TQSGIStyle::drawControl( ControlElement element, } else { if ( checkable ) { if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, w, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } } @@ -1477,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 diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp index b96a04b85..1c049b0d8 100644 --- a/src/styles/qwindowsstyle.cpp +++ b/src/styles/qwindowsstyle.cpp @@ -575,12 +575,13 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, { 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, w, h ), r ); + TQRect vrect = visualRect( TQRect( x, y, checkcol, h ), r ); int xvis = vrect.x(); if ( act && !dis ) { - qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( TQColorGroup::Button ) ); } else { TQBrush fill( cg.light(), Dense4Pattern ); @@ -589,7 +590,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, // a consistent look TQPoint origin = p->brushOrigin(); p->setBrushOrigin( xvis, y ); - qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &fill ); + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill ); // restore the previous brush origin p->setBrushOrigin( origin ); } @@ -600,8 +601,9 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, { 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, w, h ), r ); + 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 ) ); @@ -612,6 +614,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, { 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; @@ -621,7 +624,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, if (act) cflags |= Style_On; - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, w - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( TQRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); } break; @@ -866,7 +869,7 @@ void TQWindowsStyle::drawControl( ControlElement element, TQRect vrect = visualRect( TQRect( xpos, y, checkcol, h ), r ); int xvis = vrect.x(); if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); } else if (! act) p->fillRect(xvis, y, checkcol , h, cg.brush( TQColorGroup::Button )); @@ -882,7 +885,7 @@ void TQWindowsStyle::drawControl( ControlElement element, int pixw = pixmap.width(); int pixh = pixmap.height(); if ( act && !dis && !mi->isChecked() ) - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); TQRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( vrect.center() ); p->setPen( cg.text() ); @@ -895,7 +898,7 @@ void TQWindowsStyle::drawControl( ControlElement element, p->fillRect( visualRect( TQRect( xp, y, w - checkcol - 1, h ), r ), fill); } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1073,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; @@ -1996,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; -- cgit v1.2.1 From b0bd2889fa1058eec74c303b10cf8724a4c5efe2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 31 Oct 2012 15:34:18 -0500 Subject: Automated update from Qt3 --- src/widgets/ntqmenudata.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/widgets/ntqmenudata.h b/src/widgets/ntqmenudata.h index 0048c5ba5..c7afc95ee 100644 --- a/src/widgets/ntqmenudata.h +++ b/src/widgets/ntqmenudata.h @@ -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 -- cgit v1.2.1