|
|
|
@ -136,7 +136,7 @@ PhaseStyle::~PhaseStyle()
|
|
|
|
|
// --------
|
|
|
|
|
// Initialize application specific
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags, void *ptr)
|
|
|
|
|
void PhaseStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr)
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
|
|
|
|
@ -149,7 +149,7 @@ void PhaseStyle::applicationPolish(TQStyleControlElementData ceData, ControlElem
|
|
|
|
|
// --------
|
|
|
|
|
// Initialize the appearance of a widget
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
|
void PhaseStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
@ -211,7 +211,7 @@ void PhaseStyle::polish(TQPalette &pal)
|
|
|
|
|
// ----------
|
|
|
|
|
// Undo the initialization of a widget's appearance
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
|
void PhaseStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
|
|
|
|
@ -412,7 +412,7 @@ void PhaseStyle::drawPhasePanel(TQPainter *painter,
|
|
|
|
|
void PhaseStyle::drawPhaseTab(TQPainter *painter,
|
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
|
const TQColorGroup &group,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags /*elementFlags*/,
|
|
|
|
|
const TQStyleOption &option,
|
|
|
|
|
SFlags flags) const
|
|
|
|
@ -578,7 +578,7 @@ void PhaseStyle::drawPhaseTab(TQPainter *painter,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQColorGroup &group,
|
|
|
|
@ -1036,7 +1036,7 @@ void PhaseStyle::drawPrimitive(TQ_PrimitiveElement element,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawKStylePrimitive(KStylePrimitive element,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQColorGroup &group,
|
|
|
|
@ -1155,7 +1155,7 @@ void PhaseStyle::drawKStylePrimitive(KStylePrimitive element,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawControl(TQ_ControlElement element,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQColorGroup &group,
|
|
|
|
@ -1599,7 +1599,7 @@ void PhaseStyle::drawControl(TQ_ControlElement element,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawControlMask(TQ_ControlElement element,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQStyleOption &option,
|
|
|
|
@ -1623,7 +1623,7 @@ void PhaseStyle::drawControlMask(TQ_ControlElement element,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQColorGroup &group,
|
|
|
|
@ -1643,13 +1643,6 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
|
|
|
|
|
switch (control) {
|
|
|
|
|
case CC_ComboBox: {
|
|
|
|
|
const TQComboBox * combo = ::tqqt_cast<const TQComboBox*>(widget);
|
|
|
|
|
if (!combo) {
|
|
|
|
|
KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
|
|
|
|
|
flags, controls, active, option, widget);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sunken = (active == SC_ComboBoxArrow);
|
|
|
|
|
drawPhaseButton(painter, x, y, w, h, group,
|
|
|
|
|
(flags & Style_MouseOver)
|
|
|
|
@ -1669,7 +1662,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (controls & SC_ComboBoxEditField) { // draw edit box
|
|
|
|
|
if (combo->editable()) { // editable box
|
|
|
|
|
if (elementFlags & CEF_IsEditable) { // editable box
|
|
|
|
|
subrect = visualRect(querySubControlMetrics(CC_ComboBox,
|
|
|
|
|
ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags);
|
|
|
|
|
x2 = subrect.right(); y2 = subrect.bottom();
|
|
|
|
@ -1679,9 +1672,9 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
painter->drawLine(x2+2, y, x2+2, y2-1);
|
|
|
|
|
painter->setPen(group.button());
|
|
|
|
|
painter->drawPoint(x2+2, y2);
|
|
|
|
|
} else if (combo->hasFocus()) { // non editable box
|
|
|
|
|
} else if (elementFlags & CEF_HasFocus) { // non editable box
|
|
|
|
|
subrect = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags,
|
|
|
|
|
combo), ceData, elementFlags);
|
|
|
|
|
widget), ceData, elementFlags);
|
|
|
|
|
drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, subrect, group,
|
|
|
|
|
Style_FocusAtBorder,
|
|
|
|
|
TQStyleOption(group.highlight()));
|
|
|
|
@ -1694,18 +1687,11 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
|
|
|
|
|
case CC_ScrollBar: {
|
|
|
|
|
// always a three button scrollbar
|
|
|
|
|
const TQScrollBar *sb = ::tqqt_cast<const TQScrollBar*>(widget);
|
|
|
|
|
if (!sb) {
|
|
|
|
|
KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
|
|
|
|
|
flags, controls, active, option, widget);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQRect srect;
|
|
|
|
|
bool horizontal = (sb->orientation() == Qt::Horizontal);
|
|
|
|
|
bool horizontal = (ceData.orientation == TQt::Horizontal);
|
|
|
|
|
SFlags scrollflags = (horizontal ? Style_Horizontal : Style_Default);
|
|
|
|
|
|
|
|
|
|
if (sb->minValue() == sb->maxValue()) scrollflags |= Style_Default;
|
|
|
|
|
if (ceData.minSteps == ceData.maxSteps) scrollflags |= Style_Default;
|
|
|
|
|
else scrollflags |= Style_Enabled;
|
|
|
|
|
|
|
|
|
|
// addline
|
|
|
|
@ -1765,7 +1751,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
|
|
|
|
|
// slider
|
|
|
|
|
if (controls & SC_ScrollBarSlider) {
|
|
|
|
|
if (sb->minValue() == sb->maxValue()) {
|
|
|
|
|
if (ceData.minSteps == ceData.maxSteps) {
|
|
|
|
|
// maxed out
|
|
|
|
|
srect = querySubControlMetrics(control, ceData, elementFlags,
|
|
|
|
|
SC_ScrollBarGroove, option, widget);
|
|
|
|
@ -1780,7 +1766,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
scrollflags | ((active == SC_ScrollBarSlider)
|
|
|
|
|
? Style_Down : Style_Default));
|
|
|
|
|
// focus
|
|
|
|
|
if (sb->hasFocus()) {
|
|
|
|
|
if (elementFlags & CEF_HasFocus) {
|
|
|
|
|
srect.addCoords(2, 2, -2, -2);
|
|
|
|
|
drawPrimitive(PE_FocusRect, painter, ceData, elementFlags, srect, group,
|
|
|
|
|
Style_Default);
|
|
|
|
@ -1852,11 +1838,6 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
|
|
|
|
|
case CC_ToolButton: {
|
|
|
|
|
const TQToolButton *btn = ::tqqt_cast<const TQToolButton*>(widget);
|
|
|
|
|
if (!btn) {
|
|
|
|
|
KStyle::drawComplexControl(control, painter, ceData, elementFlags, rect, group,
|
|
|
|
|
flags, controls, active, option, widget);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQToolBar *toolbar;
|
|
|
|
|
bool horiz = true;
|
|
|
|
@ -1866,32 +1847,29 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
y2 = rect.bottom();
|
|
|
|
|
|
|
|
|
|
// check for TQToolBar parent
|
|
|
|
|
if (btn->parent() && btn->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
|
|
|
|
|
toolbar = ::tqqt_cast<TQToolBar*>(btn->parent());
|
|
|
|
|
if (toolbar) {
|
|
|
|
|
horiz = (toolbar->orientation() == Qt::Horizontal);
|
|
|
|
|
if (normal) { // draw background
|
|
|
|
|
if (flatToolbar(ceData, elementFlags, toolbar)) {
|
|
|
|
|
// toolbar not floating or in a TQMainWindow
|
|
|
|
|
painter->fillRect(rect, group.background());
|
|
|
|
|
if (ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING)) {
|
|
|
|
|
toolbar = (btn)?::tqqt_cast<TQToolBar*>(btn->parent()):NULL;
|
|
|
|
|
horiz = (ceData.toolBarData.orientation == TQt::Horizontal);
|
|
|
|
|
if (normal) { // draw background
|
|
|
|
|
if (toolbar && flatToolbar(ceData, elementFlags, toolbar)) {
|
|
|
|
|
// toolbar not floating or in a TQMainWindow
|
|
|
|
|
painter->fillRect(rect, group.background());
|
|
|
|
|
} else {
|
|
|
|
|
drawPhaseGradient(painter, rect, group.background(),
|
|
|
|
|
!horiz, 0, 0,
|
|
|
|
|
ceData.parentWidgetData.rect.width()-3,
|
|
|
|
|
ceData.parentWidgetData.rect.height()-3, true);
|
|
|
|
|
painter->setPen(group.mid());
|
|
|
|
|
if (horiz) {
|
|
|
|
|
painter->drawLine(x, y2, x2, y2);
|
|
|
|
|
} else {
|
|
|
|
|
drawPhaseGradient(painter, rect, group.background(),
|
|
|
|
|
!horiz, 0, 0,
|
|
|
|
|
toolbar->width()-3,
|
|
|
|
|
toolbar->height()-3, true);
|
|
|
|
|
painter->setPen(group.mid());
|
|
|
|
|
if (horiz) {
|
|
|
|
|
painter->drawLine(x, y2, x2, y2);
|
|
|
|
|
} else {
|
|
|
|
|
painter->drawLine(x2, y, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
painter->drawLine(x2, y, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// check for TQToolBarExtensionWidget parent
|
|
|
|
|
else if (btn->parent() &&
|
|
|
|
|
btn->parent()->inherits(TQTOOLBAREXTENSION)) {
|
|
|
|
|
else if (btn && ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAREXTENSION)) {
|
|
|
|
|
TQWidget *extension;
|
|
|
|
|
if ((extension = ::tqqt_cast<TQWidget*>(btn->parent()))) {
|
|
|
|
|
toolbar = ::tqqt_cast<TQToolBar*>(extension->parent());
|
|
|
|
@ -1906,11 +1884,10 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// check for background pixmap
|
|
|
|
|
else if (normal && btn->parentWidget() &&
|
|
|
|
|
btn->parentWidget()->backgroundPixmap() &&
|
|
|
|
|
!btn->parentWidget()->backgroundPixmap()->isNull()) {
|
|
|
|
|
TQPixmap pixmap = *(btn->parentWidget()->backgroundPixmap());
|
|
|
|
|
painter->drawTiledPixmap(rect, pixmap, btn->pos());
|
|
|
|
|
else if (normal &&
|
|
|
|
|
!ceData.parentWidgetData.bgPixmap.isNull()) {
|
|
|
|
|
TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
|
|
|
|
|
painter->drawTiledPixmap(rect, pixmap, ceData.pos);
|
|
|
|
|
}
|
|
|
|
|
// everything else
|
|
|
|
|
else if (normal) {
|
|
|
|
@ -1944,7 +1921,7 @@ void PhaseStyle::drawComplexControl(TQ_ComplexControl control,
|
|
|
|
|
|
|
|
|
|
void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control,
|
|
|
|
|
TQPainter *painter,
|
|
|
|
|
const TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
const ControlElementFlags elementFlags,
|
|
|
|
|
const TQRect &rect,
|
|
|
|
|
const TQStyleOption &option,
|
|
|
|
@ -1968,7 +1945,7 @@ void PhaseStyle::drawComplexControlMask(TQ_ComplexControl control,
|
|
|
|
|
// -------------
|
|
|
|
|
// Get the pixel metric for metric
|
|
|
|
|
|
|
|
|
|
int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
|
int PhaseStyle::pixelMetric(PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
|
{
|
|
|
|
|
// not using widget's font, so that all metrics are uniform
|
|
|
|
|
int em = TQMAX(TQApplication::fontMetrics().strikeOutPos() * 3, 17);
|
|
|
|
@ -2033,7 +2010,7 @@ int PhaseStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData
|
|
|
|
|
// ---------
|
|
|
|
|
// Return subrect for the widget in logical coordinates
|
|
|
|
|
|
|
|
|
|
TQRect PhaseStyle::subRect(SubRect rect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
|
TQRect PhaseStyle::subRect(SubRect rect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
|
|
|
|
|
{
|
|
|
|
|
switch (rect) {
|
|
|
|
|
case SR_ComboBoxFocusRect: {
|
|
|
|
@ -2054,7 +2031,7 @@ TQRect PhaseStyle::subRect(SubRect rect, const TQStyleControlElementData ceData,
|
|
|
|
|
// Get metrics for subcontrols of complex controls
|
|
|
|
|
|
|
|
|
|
TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
SubControl subcontrol,
|
|
|
|
|
const TQStyleOption &option,
|
|
|
|
@ -2152,7 +2129,7 @@ TQRect PhaseStyle::querySubControlMetrics(TQ_ComplexControl control,
|
|
|
|
|
// Returns the size of widget based on the contentsize
|
|
|
|
|
|
|
|
|
|
TQSize PhaseStyle::sizeFromContents(ContentsType contents,
|
|
|
|
|
TQStyleControlElementData ceData,
|
|
|
|
|
const TQStyleControlElementData &ceData,
|
|
|
|
|
ControlElementFlags elementFlags,
|
|
|
|
|
const TQSize &contentsize,
|
|
|
|
|
const TQStyleOption &option,
|
|
|
|
@ -2243,7 +2220,7 @@ TQSize PhaseStyle::sizeFromContents(ContentsType contents,
|
|
|
|
|
// -------------
|
|
|
|
|
// Is the toolbar "flat"
|
|
|
|
|
|
|
|
|
|
bool PhaseStyle::flatToolbar(const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQToolBar *toolbar) const
|
|
|
|
|
bool PhaseStyle::flatToolbar(const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQToolBar *toolbar) const
|
|
|
|
|
{
|
|
|
|
|
if (!toolbar) return true; // not on a toolbar
|
|
|
|
|
if (!toolbar->isMovingEnabled()) return true; // immobile toolbars are flat
|
|
|
|
@ -2253,7 +2230,7 @@ bool PhaseStyle::flatToolbar(const TQStyleControlElementData ceData, const Contr
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int PhaseStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
|
|
|
|
|
int PhaseStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
@ -2282,7 +2259,7 @@ int PhaseStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, Contro
|
|
|
|
|
// Grab events we are interested in. Most of this routine is to handle the
|
|
|
|
|
// exceptions to the normal styling rules.
|
|
|
|
|
|
|
|
|
|
bool PhaseStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
|
bool PhaseStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
|
|
|
|
|
{
|
|
|
|
|
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
|
|
|
|
|
TQObject* object = reinterpret_cast<TQObject*>(source);
|
|
|
|
|