Update styles for new API

pull/1/head
Timothy Pearson 12 years ago
parent c8898cf01f
commit f16f8eb6bf

@ -711,7 +711,7 @@ void dotNETstyle::drawPrimitive(TQ_PrimitiveElement pe,
else else
cflags |= Style_On; cflags |= Style_On;
TQRect rr = TQRect( x + 6, y + 6, 16, h - 6 ); TQRect rr = TQRect( x + 4, y + 2, 16, h - 2 );
if (TQApplication::reverseLayout()) if (TQApplication::reverseLayout())
rr = visualRect( rr, r ); rr = visualRect( rr, r );
@ -1390,7 +1390,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
if (checkable) { if (checkable) {
if (mi->isChecked()) { 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);
} }
} }
@ -1906,6 +1906,15 @@ int dotNETstyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, Co
return 1; return 1;
} }
case PM_MenuIndicatorFrameHBorder:
return 4;
case PM_MenuIndicatorFrameVBorder:
return 2;
case PM_MenuIconIndicatorFrameHBorder:
return 4;
case PM_MenuIconIndicatorFrameVBorder:
return 2;
default: default:
return KStyle::pixelMetric(m, ceData, elementFlags, widget); return KStyle::pixelMetric(m, ceData, elementFlags, widget);
} }
@ -2108,4 +2117,22 @@ bool dotNETstyle::objectEventHandler( TQStyleControlElementData ceData, ControlE
return false; return false;
} }
int dotNETstyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
{
int ret;
switch (sh) {
case SH_MenuIndicatorColumnWidth:
{
ret = TQMAX(opt.maxIconWidth(), 26);
}
break;
default:
ret = TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
break;
}
return ret;
}
// vim: noet ts=4 sw=4 // vim: noet ts=4 sw=4

@ -118,6 +118,10 @@ public:
const TQStyleOption &o, const TQStyleOption &o,
const TQWidget *w = 0) const; const TQWidget *w = 0) const;
int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
protected: protected:
void renderButton(TQPainter *p, void renderButton(TQPainter *p,
const TQRect &r, const TQRect &r,
@ -134,6 +138,7 @@ protected:
void renderSlider(TQPainter *p, void renderSlider(TQPainter *p,
const TQRect &r, const TQRect &r,
const TQColorGroup &g) const; const TQColorGroup &g) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void updatePalette( TQComboBox * ); void updatePalette( TQComboBox * );
@ -145,7 +150,7 @@ protected slots:
void paletteChanged(); void paletteChanged();
private: private:
// Disable copy constructor and = operator // Disable copy constructor and = operator
dotNETstyle( const dotNETstyle & ); dotNETstyle( const dotNETstyle & );
dotNETstyle& operator=( const dotNETstyle & ); dotNETstyle& operator=( const dotNETstyle & );
TQStyle *winstyle; TQStyle *winstyle;

@ -1015,9 +1015,11 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element,
break; break;
} }
case PE_MenuItemIndicatorCheck: { case PE_MenuItemIndicatorCheck: {
int checkwidth = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, option, NULL, NULL);
int cx = reverse_ ? x+w - checkwidth : x;
drawPrimitive(PE_CheckMark, painter, ceData, elementFlags, drawPrimitive(PE_CheckMark, painter, ceData, elementFlags,
TQRect(x + ITEMFRAME, y + ITEMFRAME, TQRect(cx + ITEMFRAME, y + ITEMFRAME,
w - ITEMFRAME*2, h - ITEMFRAME*2), checkwidth - ITEMFRAME*2, h - ITEMFRAME*2),
group, Style_Default | group, Style_Default |
(active ? Style_Enabled : Style_On)); (active ? Style_Enabled : Style_On));
break; break;
@ -1415,8 +1417,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
// draw check // draw check
if (mi->isChecked()) { if (mi->isChecked()) {
int cx = reverse_ ? x+w - checkwidth : x; drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(x, y, checkwidth, h), group, flags, option);
drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(cx, y, checkwidth, h), group, flags);
} }
// draw text // draw text
@ -2024,6 +2025,12 @@ int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData
case PM_SliderControlThickness: case PM_SliderControlThickness:
return em; return em;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
return ITEMFRAME;
default: default:
return KStyle::pixelMetric(metric, ceData, elementFlags, widget); return KStyle::pixelMetric(metric, ceData, elementFlags, widget);
} }
@ -2257,6 +2264,29 @@ bool PhaseStyle::flatToolbar(const TQToolBar *toolbar) const
return false; return false;
} }
int PhaseStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
{
int ret;
switch (sh) {
case SH_MenuIndicatorColumnWidth:
{
int checkwidth = opt.maxIconWidth();
bool checkable = (elementFlags & CEF_IsCheckable);
if (checkable) checkwidth = TQMAX(checkwidth, 20);
ret = checkwidth;
}
break;
default:
ret = TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
break;
}
return ret;
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// eventFilter() // eventFilter()
// ------------- // -------------

@ -34,7 +34,7 @@ class KPixmap;
class GradientSet class GradientSet
{ {
public: public:
enum GradientType { enum GradientType {
Horizontal, Horizontal,
Vertical, Vertical,
@ -48,7 +48,7 @@ public:
KPixmap* gradient(bool horizontal, bool reverse); KPixmap* gradient(bool horizontal, bool reverse);
private: private:
KPixmap *set[GradientTypeCount]; KPixmap *set[GradientTypeCount];
TQColor color_; TQColor color_;
int size_; int size_;
@ -58,7 +58,7 @@ class PhaseStyle : public KStyle
{ {
Q_OBJECT Q_OBJECT
public: public:
PhaseStyle(); PhaseStyle();
virtual ~PhaseStyle(); virtual ~PhaseStyle();
@ -143,7 +143,11 @@ public:
const TQStyleOption& option = TQStyleOption::Default, const TQStyleOption& option = TQStyleOption::Default,
const TQWidget *widget = 0) const; const TQWidget *widget = 0) const;
private: int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
private:
PhaseStyle(const PhaseStyle &); PhaseStyle(const PhaseStyle &);
PhaseStyle& operator=(const PhaseStyle &); PhaseStyle& operator=(const PhaseStyle &);
@ -187,7 +191,7 @@ private:
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private: private:
TQMap<unsigned int, TQIntDict<GradientSet> > * gradients; TQMap<unsigned int, TQIntDict<GradientSet> > * gradients;
bool gradients_; bool gradients_;
bool highlights_; bool highlights_;

Loading…
Cancel
Save