summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2012-10-31 18:47:11 -0500
committerDarrell Anderson <[email protected]>2012-10-31 18:47:11 -0500
commit308537cb0eb307820f385f38c55dc1ccc47b343b (patch)
tree4df558ba58f2b0bdee64d7a6dc97fe69cd80d927 /src
parent68fd119104cf123043eb7ee573de638cc159f743 (diff)
parentb0bd2889fa1058eec74c303b10cf8724a4c5efe2 (diff)
downloadtqt3-308537cb0eb307820f385f38c55dc1ccc47b343b.tar.gz
tqt3-308537cb0eb307820f385f38c55dc1ccc47b343b.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tqt3
Diffstat (limited to 'src')
-rw-r--r--src/kernel/ntqapplication.h1
-rw-r--r--src/kernel/ntqstyle.h15
-rw-r--r--src/kernel/qapplication.cpp31
-rw-r--r--src/styles/ntqcompactstyle.h11
-rw-r--r--src/styles/ntqsgistyle.h2
-rw-r--r--src/styles/qcommonstyle.cpp3
-rw-r--r--src/styles/qcompactstyle.cpp111
-rw-r--r--src/styles/qmotifplusstyle.cpp81
-rw-r--r--src/styles/qmotifstyle.cpp90
-rw-r--r--src/styles/qsgistyle.cpp98
-rw-r--r--src/styles/qwindowsstyle.cpp118
-rw-r--r--src/widgets/ntqmenudata.h14
12 files changed, 484 insertions, 91 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..994eff811 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,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
};
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<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
diff --git a/src/styles/ntqcompactstyle.h b/src/styles/ntqcompactstyle.h
index a9d343726..cc8c7e947 100644
--- a/src/styles/ntqcompactstyle.h
+++ b/src/styles/ntqcompactstyle.h
@@ -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 & );
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/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..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,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
diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp
index 65fa0df91..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;
@@ -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;
diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp
index b404dc917..3225e0e29 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,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;
diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp
index 930a34d09..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;
}
@@ -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
diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp
index dae52362f..1c049b0d8 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,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;
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