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
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())
rr = visualRect( rr, r );
@ -1390,7 +1390,7 @@ void dotNETstyle::drawControl(TQ_ControlElement element,
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);
}
}
@ -1906,6 +1906,15 @@ int dotNETstyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, Co
return 1;
}
case PM_MenuIndicatorFrameHBorder:
return 4;
case PM_MenuIndicatorFrameVBorder:
return 2;
case PM_MenuIconIndicatorFrameHBorder:
return 4;
case PM_MenuIconIndicatorFrameVBorder:
return 2;
default:
return KStyle::pixelMetric(m, ceData, elementFlags, widget);
}
@ -2108,4 +2117,22 @@ bool dotNETstyle::objectEventHandler( TQStyleControlElementData ceData, ControlE
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

@ -104,36 +104,41 @@ public:
const TQWidget *widget = 0 ) const;
void drawComplexControlMask(TQStyle::ComplexControl c,
TQPainter *p,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r,
const TQStyleOption &o=TQStyleOption::Default,
const TQWidget *w = 0) const;
TQPainter *p,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r,
const TQStyleOption &o=TQStyleOption::Default,
const TQWidget *w = 0) const;
TQSize sizeFromContents(TQStyle::ContentsType t,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s,
const TQStyleOption &o,
const TQWidget *w = 0) const;
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &s,
const TQStyleOption &o,
const TQWidget *w = 0) const;
int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
protected:
void renderButton(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
bool sunken = false,
bool corners = false) const;
const TQRect &r,
const TQColorGroup &g,
bool sunken = false,
bool corners = false) const;
void renderPanel(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
bool sunken = true,
bool thick = true) const;
const TQRect &r,
const TQColorGroup &g,
bool sunken = true,
bool thick = true) const;
void renderSlider(TQPainter *p,
const TQRect &r,
const TQColorGroup &g) const;
const TQRect &r,
const TQColorGroup &g) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
void updatePalette( TQComboBox * );
@ -145,7 +150,7 @@ protected slots:
void paletteChanged();
private:
// Disable copy constructor and = operator
// Disable copy constructor and = operator
dotNETstyle( const dotNETstyle & );
dotNETstyle& operator=( const dotNETstyle & );
TQStyle *winstyle;

@ -1015,9 +1015,11 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element,
break;
}
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,
TQRect(x + ITEMFRAME, y + ITEMFRAME,
w - ITEMFRAME*2, h - ITEMFRAME*2),
TQRect(cx + ITEMFRAME, y + ITEMFRAME,
checkwidth - ITEMFRAME*2, h - ITEMFRAME*2),
group, Style_Default |
(active ? Style_Enabled : Style_On));
break;
@ -1415,8 +1417,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
// draw check
if (mi->isChecked()) {
int cx = reverse_ ? x+w - checkwidth : x;
drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(cx, y, checkwidth, h), group, flags);
drawPrimitive(PE_MenuItemIndicatorCheck, painter, ceData, elementFlags, TQRect(x, y, checkwidth, h), group, flags, option);
}
// draw text
@ -2024,6 +2025,12 @@ int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData
case PM_SliderControlThickness:
return em;
case PM_MenuIndicatorFrameHBorder:
case PM_MenuIndicatorFrameVBorder:
case PM_MenuIconIndicatorFrameHBorder:
case PM_MenuIconIndicatorFrameVBorder:
return ITEMFRAME;
default:
return KStyle::pixelMetric(metric, ceData, elementFlags, widget);
}
@ -2257,6 +2264,29 @@ bool PhaseStyle::flatToolbar(const TQToolBar *toolbar) const
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()
// -------------

@ -34,165 +34,169 @@ class KPixmap;
class GradientSet
{
public:
enum GradientType {
Horizontal,
Vertical,
HorizontalReverse,
VerticalReverse,
GradientTypeCount
};
GradientSet(const TQColor &color, int size);
~GradientSet();
KPixmap* gradient(bool horizontal, bool reverse);
private:
KPixmap *set[GradientTypeCount];
TQColor color_;
int size_;
public:
enum GradientType {
Horizontal,
Vertical,
HorizontalReverse,
VerticalReverse,
GradientTypeCount
};
GradientSet(const TQColor &color, int size);
~GradientSet();
KPixmap* gradient(bool horizontal, bool reverse);
private:
KPixmap *set[GradientTypeCount];
TQColor color_;
int size_;
};
class PhaseStyle : public KStyle
{
Q_OBJECT
public:
PhaseStyle();
virtual ~PhaseStyle();
void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal);
void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default) const;
void drawKStylePrimitive(KStylePrimitive element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControl(TQ_ControlElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControlMask(TQ_ControlElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControl(TQ_ComplexControl control,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
SCFlags controls = SC_All,
SCFlags active = SC_None,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControlMask(TQ_ComplexControl control,
TQPainter *painter,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
int pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0) const;
TQRect subRect(SubRect rect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget = 0) const;
TQRect querySubControlMetrics(TQ_ComplexControl control,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
TQSize sizeFromContents(ContentsType contents,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsize,
const TQStyleOption& option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
private:
PhaseStyle(const PhaseStyle &);
PhaseStyle& operator=(const PhaseStyle &);
void drawPhaseBevel(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
const TQColor &fill,
bool sunken=false,
bool horizontal=true,
bool reverse=false) const;
void drawPhaseButton(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
const TQColor &fill,
bool sunken=false) const;
void drawPhasePanel(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
bool sunken=false,
const TQBrush *fill=NULL) const;
void drawPhaseTab(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option,
const SFlags flags) const;
void drawPhaseGradient(TQPainter *painter,
const TQRect &rect,
TQColor color,
bool horizontal,
int px=0, int py=0,
int pw=-1, int ph=-1,
bool reverse=false) const;
bool flatToolbar(const TQToolBar *toolbar) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:
TQMap<unsigned int, TQIntDict<GradientSet> > * gradients;
bool gradients_;
bool highlights_;
bool reverse_;
bool kicker_;
Q_OBJECT
public:
PhaseStyle();
virtual ~PhaseStyle();
void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQPalette &pal);
void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawPrimitive(TQ_PrimitiveElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default) const;
void drawKStylePrimitive(KStylePrimitive element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControl(TQ_ControlElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawControlMask(TQ_ControlElement element,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControl(TQ_ComplexControl control,
TQPainter *painter,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &rect,
const TQColorGroup &group,
SFlags flags = Style_Default,
SCFlags controls = SC_All,
SCFlags active = SC_None,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
void drawComplexControlMask(TQ_ComplexControl control,
TQPainter *painter,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &rect,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
int pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget = 0) const;
TQRect subRect(SubRect rect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget = 0) const;
TQRect querySubControlMetrics(TQ_ComplexControl control,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol,
const TQStyleOption &option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
TQSize sizeFromContents(ContentsType contents,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsize,
const TQStyleOption& option = TQStyleOption::Default,
const TQWidget *widget = 0) const;
int styleHint(TQ_StyleHint, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
private:
PhaseStyle(const PhaseStyle &);
PhaseStyle& operator=(const PhaseStyle &);
void drawPhaseBevel(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
const TQColor &fill,
bool sunken=false,
bool horizontal=true,
bool reverse=false) const;
void drawPhaseButton(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
const TQColor &fill,
bool sunken=false) const;
void drawPhasePanel(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
bool sunken=false,
const TQBrush *fill=NULL) const;
void drawPhaseTab(TQPainter *painter,
int x, int y, int w, int h,
const TQColorGroup &group,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &option,
const SFlags flags) const;
void drawPhaseGradient(TQPainter *painter,
const TQRect &rect,
TQColor color,
bool horizontal,
int px=0, int py=0,
int pw=-1, int ph=-1,
bool reverse=false) const;
bool flatToolbar(const TQToolBar *toolbar) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private:
TQMap<unsigned int, TQIntDict<GradientSet> > * gradients;
bool gradients_;
bool highlights_;
bool reverse_;
bool kicker_;
};
#endif // PHASESTYLE_H

Loading…
Cancel
Save