|
Lines 288-294
Link Here
|
| 288 |
res = cdata->shades[shadenr]; |
288 |
res = cdata->shades[shadenr]; |
| 289 |
} |
289 |
} |
| 290 |
|
290 |
|
| 291 |
void MandrivaStyle::updateHoverControl(const TQPoint &pos) |
291 |
void MandrivaStyle::updateHoverControl(const TQPoint &pos, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags) |
| 292 |
{ |
292 |
{ |
| 293 |
TQRegion repaint; |
293 |
TQRegion repaint; |
| 294 |
enum Hover oldControl = hoverControl; |
294 |
enum Hover oldControl = hoverControl; |
|
Lines 299-310
Link Here
|
| 299 |
|
299 |
|
| 300 |
if (hoverWidget->inherits("TQScrollBar")) |
300 |
if (hoverWidget->inherits("TQScrollBar")) |
| 301 |
{ |
301 |
{ |
| 302 |
TQRect subline(querySubControlMetrics(CC_ScrollBar, hoverWidget, |
302 |
TQRect subline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, |
| 303 |
SC_ScrollBarSubLine)), |
303 |
SC_ScrollBarSubLine, hoverWidget)), |
| 304 |
addline(querySubControlMetrics(CC_ScrollBar, hoverWidget, |
304 |
addline(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, |
| 305 |
SC_ScrollBarAddLine)), |
305 |
SC_ScrollBarAddLine, hoverWidget)), |
| 306 |
slider(querySubControlMetrics(CC_ScrollBar, hoverWidget, |
306 |
slider(querySubControlMetrics(CC_ScrollBar, ceData, elementFlags, |
| 307 |
SC_ScrollBarSlider)); |
307 |
SC_ScrollBarSlider, hoverWidget)); |
| 308 |
if (subline.contains(pos)) |
308 |
if (subline.contains(pos)) |
| 309 |
hoverControl = HoverScrollBarSubLine; |
309 |
hoverControl = HoverScrollBarSubLine; |
| 310 |
else if (addline.contains(pos)) |
310 |
else if (addline.contains(pos)) |
|
Lines 329-338
Link Here
|
| 329 |
if (!cb->editable()) |
329 |
if (!cb->editable()) |
| 330 |
return; |
330 |
return; |
| 331 |
|
331 |
|
| 332 |
TQRect comboArrow(querySubControlMetrics(CC_ComboBox, hoverWidget, |
332 |
TQRect comboArrow(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, |
| 333 |
SC_ComboBoxArrow)), |
333 |
SC_ComboBoxArrow, hoverWidget)), |
| 334 |
comboEditField(querySubControlMetrics(CC_ComboBox, hoverWidget, |
334 |
comboEditField(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, |
| 335 |
SC_ComboBoxEditField)); |
335 |
SC_ComboBoxEditField, hoverWidget)); |
| 336 |
|
336 |
|
| 337 |
if (comboArrow.contains(pos)) |
337 |
if (comboArrow.contains(pos)) |
| 338 |
hoverControl = HoverComboBoxArrow; |
338 |
hoverControl = HoverComboBoxArrow; |
|
Lines 351-461
Link Here
|
| 351 |
hoverWidget->repaint(repaint, false); |
351 |
hoverWidget->repaint(repaint, false); |
| 352 |
} |
352 |
} |
| 353 |
|
353 |
|
| 354 |
void MandrivaStyle::polish(TQApplication* app) |
354 |
void MandrivaStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr) |
| 355 |
{ |
355 |
{ |
| 356 |
if (!qstrcmp(app->argv()[0], "kicker")) |
356 |
if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) { |
| 357 |
kickerMode = true; |
357 |
TQApplication *app = reinterpret_cast<TQApplication*>(ptr); |
| 358 |
} |
358 |
if (!qstrcmp(app->argv()[0], "kicker")) { |
| 359 |
|
359 |
kickerMode = true; |
| 360 |
void MandrivaStyle::polish(TQWidget* widget) |
360 |
} |
| 361 |
{ |
361 |
} |
| 362 |
// Put in order of highest occurance to maximize hit rate |
362 |
} |
| 363 |
if ( widget->inherits( "TQComboBox" ) |
363 |
|
| 364 |
|| widget->inherits("TQScrollBar") |
364 |
void MandrivaStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) |
| 365 |
|| widget->inherits("TQHeader") |
365 |
{ |
| 366 |
|| widget->inherits( "TQSlider" ) |
366 |
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { |
| 367 |
|| widget->inherits( "TQCheckBox" ) |
367 |
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); |
| 368 |
|| widget->inherits("TQSplitterHandle")) |
368 |
|
| 369 |
{ |
369 |
// Put in order of highest occurance to maximize hit rate |
| 370 |
widget->installEventFilter(this); |
370 |
if ( widget->inherits( "TQComboBox" ) |
| 371 |
if (widget->inherits( "TQScrollBar" ) || widget->inherits( "TQComboBox" )) |
371 |
|| widget->inherits( "TQScrollBar" ) |
| 372 |
widget->setMouseTracking( true ); |
372 |
|| widget->inherits( "TQHeader" ) |
| 373 |
} |
373 |
|| widget->inherits( "TQSlider" ) |
| 374 |
else if (widget->inherits("TQMenuBar") |
374 |
|| widget->inherits( "TQCheckBox" ) |
| 375 |
|| widget->inherits("TQPopupMenu") ) |
375 |
|| widget->inherits("TQSplitterHandle") ) |
| 376 |
{ |
376 |
{ |
| 377 |
widget->setBackgroundMode(TQWidget::NoBackground); |
377 |
widget->installEventFilter(this); |
| 378 |
} |
378 |
if (widget->inherits( "TQScrollBar" ) || widget->inherits( "TQComboBox" )) |
| 379 |
else if (widget->inherits("TQPushButton") ) |
379 |
widget->setMouseTracking( true ); |
| 380 |
{ |
380 |
} |
| 381 |
widget->installEventFilter(this); |
381 |
else if (widget->inherits("TQMenuBar") |
| 382 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
382 |
|| widget->inherits("TQPopupMenu") ) |
| 383 |
} |
383 |
{ |
| 384 |
else if ( widget->inherits( "TDEToolBarSeparator" ) || widget->inherits( "TQToolBarSeparator" ) ) |
384 |
widget->setBackgroundMode(TQWidget::NoBackground); |
| 385 |
{ |
385 |
} |
| 386 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
386 |
else if (widget->inherits("TQPushButton") ) |
| 387 |
} |
387 |
{ |
| 388 |
else if (widget->inherits("TQToolBarExtensionWidget")) |
388 |
widget->installEventFilter(this); |
| 389 |
{ |
389 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
| 390 |
widget->installEventFilter(this); |
390 |
} |
| 391 |
} |
391 |
else if ( widget->inherits( "TDEToolBarSeparator" ) || widget->inherits( "TQToolBarSeparator" ) ) |
| 392 |
else if ( widget->parentWidget() && |
392 |
{ |
| 393 |
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) |
393 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
| 394 |
|| widget->inherits( "TDECompletionBox" ) ) ) |
394 |
} |
| 395 |
{ |
395 |
else if (widget->inherits("TQToolBarExtensionWidget")) |
| 396 |
TQListBox* listbox = (TQListBox*) widget; |
396 |
{ |
| 397 |
listbox->setLineWidth( 1 ); |
397 |
widget->installEventFilter(this); |
| 398 |
listbox->setBackgroundMode( NoBackground ); |
398 |
} |
| 399 |
widget->installEventFilter( this ); |
399 |
else if ( widget->parentWidget() && |
| 400 |
} |
400 |
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) |
| 401 |
else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) |
401 |
|| widget->inherits( "TDECompletionBox" ) ) ) |
| 402 |
{ |
402 |
{ |
| 403 |
widget->setBackgroundMode( NoBackground ); // We paint the whole background. |
403 |
TQListBox* listbox = (TQListBox*) widget; |
| 404 |
widget->installEventFilter(this); |
404 |
listbox->setLineWidth( 1 ); |
| 405 |
} |
405 |
listbox->setBackgroundMode( NoBackground ); |
| 406 |
TDEStyle::polish( widget ); |
406 |
widget->installEventFilter( this ); |
| 407 |
} |
407 |
} |
| 408 |
|
408 |
else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) |
| 409 |
|
409 |
{ |
| 410 |
void MandrivaStyle::unPolish(TQWidget* widget) |
410 |
widget->setBackgroundMode( NoBackground ); // We paint the whole background. |
| 411 |
{ |
411 |
widget->installEventFilter(this); |
| 412 |
TQFont f = TQApplication::font(); |
412 |
} |
| 413 |
TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes |
413 |
} |
| 414 |
|
414 |
|
| 415 |
if ( widget->inherits( "TQComboBox" ) |
415 |
TDEStyle::polish( ceData, elementFlags, ptr ); |
| 416 |
|| widget->inherits("TQScrollBar") |
416 |
} |
| 417 |
|| widget->inherits("TQHeader") |
417 |
|
| 418 |
|| widget->inherits( "TQSlider" ) |
418 |
|
| 419 |
|| widget->inherits( "TQCheckBox" ) |
419 |
void MandrivaStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr) |
| 420 |
|| widget->inherits("TQSplitterHandle")) |
420 |
{ |
| 421 |
{ |
421 |
if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { |
| 422 |
widget->removeEventFilter(this); |
422 |
TQWidget *widget = reinterpret_cast<TQWidget*>(ptr); |
| 423 |
} |
423 |
|
| 424 |
else if ( widget->inherits("TQMenuBar") |
424 |
TQFont f = TQApplication::font(); |
| 425 |
|| widget->inherits("TQPopupMenu")) |
425 |
TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes |
| 426 |
{ |
426 |
|
| 427 |
widget->setBackgroundMode(TQWidget::PaletteBackground); |
427 |
if ( widget->inherits( "TQComboBox" ) |
| 428 |
} |
428 |
|| widget->inherits("TQScrollBar") |
| 429 |
else if ( widget->inherits("TQPushButton") ) |
429 |
|| widget->inherits("TQHeader") |
| 430 |
{ |
430 |
|| widget->inherits( "TQSlider" ) |
| 431 |
widget->removeEventFilter(this); |
431 |
|| widget->inherits( "TQCheckBox" ) |
| 432 |
} |
432 |
|| widget->inherits("TQSplitterHandle")) |
| 433 |
else if (widget->inherits("TQToolBarExtensionWidget")) |
433 |
{ |
| 434 |
{ |
434 |
widget->removeEventFilter(this); |
| 435 |
widget->removeEventFilter(this); |
435 |
} |
| 436 |
} |
436 |
else if ( widget->inherits("TQMenuBar") |
| 437 |
else if ( widget->parentWidget() && |
437 |
|| widget->inherits("TQPopupMenu")) |
| 438 |
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) |
438 |
{ |
| 439 |
|| widget->inherits( "TDECompletionBox" ) ) ) |
439 |
widget->setBackgroundMode(TQWidget::PaletteBackground); |
| 440 |
{ |
440 |
} |
| 441 |
TQListBox* listbox = (TQListBox*) widget; |
441 |
else if ( widget->inherits("TQPushButton") ) |
| 442 |
listbox->setLineWidth( 1 ); |
442 |
{ |
| 443 |
listbox->setBackgroundMode( PaletteBackground ); |
443 |
widget->removeEventFilter(this); |
| 444 |
widget->removeEventFilter( this ); |
444 |
} |
| 445 |
widget->clearMask(); |
445 |
else if (widget->inherits("TQToolBarExtensionWidget")) |
| 446 |
} |
446 |
{ |
| 447 |
//For toolbar internal separators, return to button, too (can't use tqt_cast here since don't have access to the class) |
447 |
widget->removeEventFilter(this); |
| 448 |
else if ( widget->inherits( "TDEToolBarSeparator" ) || widget->inherits( "TQToolBarSeparator" ) ) |
448 |
} |
| 449 |
{ |
449 |
else if ( widget->parentWidget() && |
| 450 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
450 |
( ( widget->inherits( "TQListBox" ) && widget->parentWidget()->inherits( "TQComboBox" ) ) |
| 451 |
} |
451 |
|| widget->inherits( "TDECompletionBox" ) ) ) |
| 452 |
else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) |
452 |
{ |
| 453 |
{ |
453 |
TQListBox* listbox = (TQListBox*) widget; |
| 454 |
widget->setBackgroundMode( PaletteBackground ); |
454 |
listbox->setLineWidth( 1 ); |
| 455 |
widget->removeEventFilter(this); |
455 |
listbox->setBackgroundMode( PaletteBackground ); |
| 456 |
} |
456 |
widget->removeEventFilter( this ); |
|
|
457 |
widget->clearMask(); |
| 458 |
} |
| 459 |
//For toolbar internal separators, return to button, too (can't use tqt_cast here since don't have access to the class) |
| 460 |
else if ( widget->inherits( "TDEToolBarSeparator" ) || widget->inherits( "TQToolBarSeparator" ) ) |
| 461 |
{ |
| 462 |
widget->setBackgroundMode( TQWidget::PaletteBackground ); |
| 463 |
} |
| 464 |
else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) |
| 465 |
{ |
| 466 |
widget->setBackgroundMode( PaletteBackground ); |
| 467 |
widget->removeEventFilter(this); |
| 468 |
} |
| 469 |
} |
| 457 |
|
470 |
|
| 458 |
TDEStyle::unPolish( widget ); |
471 |
TDEStyle::unPolish( ceData, elementFlags, ptr ); |
| 459 |
} |
472 |
} |
| 460 |
|
473 |
|
| 461 |
/* reimp. */ |
474 |
/* reimp. */ |
|
Lines 629-644
Link Here
|
| 629 |
// This function draws primitive elements as well as their masks. |
642 |
// This function draws primitive elements as well as their masks. |
| 630 |
void MandrivaStyle::drawPrimitive( PrimitiveElement pe, |
643 |
void MandrivaStyle::drawPrimitive( PrimitiveElement pe, |
| 631 |
TQPainter *p, |
644 |
TQPainter *p, |
|
|
645 |
const TQStyleControlElementData &ceData, |
| 646 |
ControlElementFlags elementFlags, |
| 632 |
const TQRect &r, |
647 |
const TQRect &r, |
| 633 |
const TQColorGroup &cg, |
648 |
const TQColorGroup &cg, |
| 634 |
SFlags flags, |
649 |
SFlags flags, |
| 635 |
const TQStyleOption& opt ) const |
650 |
const TQStyleOption& opt ) const |
| 636 |
{ |
651 |
{ |
| 637 |
int x, y, xw, yh; |
652 |
int x, y, xw; |
| 638 |
x= r.x(); |
653 |
x= r.x(); |
| 639 |
y= r.y(); |
654 |
y= r.y(); |
| 640 |
xw = r.x()+r.width()-1; |
655 |
xw = r.x()+r.width()-1; |
| 641 |
yh = r.y()+r.height()-1; |
|
|
| 642 |
bool down = flags & Style_Down; |
656 |
bool down = flags & Style_Down; |
| 643 |
bool on = flags & Style_On; |
657 |
bool on = flags & Style_On; |
| 644 |
const MandrivaColorData *cdata = lookupData(cg); |
658 |
const MandrivaColorData *cdata = lookupData(cg); |
|
Lines 685-691
Link Here
|
| 685 |
int y = r.y(); |
699 |
int y = r.y(); |
| 686 |
int x2 = r.x() + r.width() - 1; |
700 |
int x2 = r.x() + r.width() - 1; |
| 687 |
int y2 = r.y() + r.height() - 1; |
701 |
int y2 = r.y() + r.height() - 1; |
| 688 |
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) |
702 |
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) |
| 689 |
: opt.lineWidth(); |
703 |
: opt.lineWidth(); |
| 690 |
|
704 |
|
| 691 |
//FIXME |
705 |
//FIXME |
|
Lines 765-771
Link Here
|
| 765 |
case PE_PanelPopup: |
779 |
case PE_PanelPopup: |
| 766 |
case PE_WindowFrame: |
780 |
case PE_WindowFrame: |
| 767 |
{ |
781 |
{ |
| 768 |
int lw = /*opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) |
782 |
int lw = /*opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) |
| 769 |
: opt.lineWidth()*/1; |
783 |
: opt.lineWidth()*/1; |
| 770 |
if (lw == 1 || lw == 2) |
784 |
if (lw == 1 || lw == 2) |
| 771 |
{ |
785 |
{ |
|
Lines 798-804
Link Here
|
| 798 |
p->setPen(oldPen); |
812 |
p->setPen(oldPen); |
| 799 |
} |
813 |
} |
| 800 |
else |
814 |
else |
| 801 |
TDEStyle::drawPrimitive(pe, p, r, cg, flags, opt); |
815 |
TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt); |
| 802 |
break; |
816 |
break; |
| 803 |
} |
817 |
} |
| 804 |
case PE_GroupBoxFrame: |
818 |
case PE_GroupBoxFrame: |
|
Lines 810-816
Link Here
|
| 810 |
} |
824 |
} |
| 811 |
#if 0 |
825 |
#if 0 |
| 812 |
case PE_PanelGroupBox: |
826 |
case PE_PanelGroupBox: |
| 813 |
drawPrimitive( PE_GroupBoxFrame, p, r, cg, flags, opt ); |
827 |
drawPrimitive( PE_GroupBoxFrame, p, ceData, elementFlags, r, cg, flags, opt ); |
| 814 |
break; |
828 |
break; |
| 815 |
#endif |
829 |
#endif |
| 816 |
case PE_Separator: |
830 |
case PE_Separator: |
|
Lines 821-829
Link Here
|
| 821 |
case PE_HeaderArrow: |
835 |
case PE_HeaderArrow: |
| 822 |
{ |
836 |
{ |
| 823 |
if ( flags & Style_Up ) |
837 |
if ( flags & Style_Up ) |
| 824 |
drawPrimitive( PE_ArrowUp, p, r, cg, Style_Enabled ); |
838 |
drawPrimitive( PE_ArrowUp, p, ceData, elementFlags, r, cg, Style_Enabled ); |
| 825 |
else |
839 |
else |
| 826 |
drawPrimitive( PE_ArrowDown, p, r, cg, Style_Enabled ); |
840 |
drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled ); |
| 827 |
break; |
841 |
break; |
| 828 |
} |
842 |
} |
| 829 |
case PE_HeaderSection: |
843 |
case PE_HeaderSection: |
|
Lines 903-909
Link Here
|
| 903 |
if(!item) |
917 |
if(!item) |
| 904 |
return; |
918 |
return; |
| 905 |
int x = r.x(), y = r.y(), w = r.width(), h = r.width(); |
919 |
int x = r.x(), y = r.y(), w = r.width(), h = r.width(); |
| 906 |
drawPrimitive(PE_Indicator, p, TQRect(x-2, y-2 , w+3, h+3 ) , cg, flags ); |
920 |
drawPrimitive(PE_Indicator, p, ceData, elementFlags, TQRect(x-2, y-2 , w+3, h+3 ) , cg, flags ); |
| 907 |
break; |
921 |
break; |
| 908 |
} |
922 |
} |
| 909 |
//case PE_IndicatorMask: |
923 |
//case PE_IndicatorMask: |
|
Lines 1283-1289
Link Here
|
| 1283 |
} |
1297 |
} |
| 1284 |
|
1298 |
|
| 1285 |
// draw the arrow |
1299 |
// draw the arrow |
| 1286 |
drawPrimitive( arrow, p, r, cg, flags ); |
1300 |
drawPrimitive( arrow, p, ceData, elementFlags, r, cg, flags ); |
| 1287 |
break; |
1301 |
break; |
| 1288 |
} |
1302 |
} |
| 1289 |
|
1303 |
|
|
Lines 1371-1377
Link Here
|
| 1371 |
drawMandrivaArrow( a, p, r, cg, flags, opt ); |
1385 |
drawMandrivaArrow( a, p, r, cg, flags, opt ); |
| 1372 |
} |
1386 |
} |
| 1373 |
else |
1387 |
else |
| 1374 |
TDEStyle::drawPrimitive( pe, p, r, cg, flags, opt ); |
1388 |
TDEStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); |
| 1375 |
} |
1389 |
} |
| 1376 |
} //switch |
1390 |
} //switch |
| 1377 |
} |
1391 |
} |
|
Lines 1389-1401
Link Here
|
| 1389 |
p->setPen( oldPen ); // restore pen |
1403 |
p->setPen( oldPen ); // restore pen |
| 1390 |
} |
1404 |
} |
| 1391 |
|
1405 |
|
| 1392 |
void MandrivaStyle::drawKStylePrimitive( TDEStylePrimitive pe, |
1406 |
void MandrivaStyle::drawTDEStylePrimitive( TDEStylePrimitive pe, |
| 1393 |
TQPainter* p, |
1407 |
TQPainter* p, |
| 1394 |
const TQWidget* widget, |
1408 |
const TQStyleControlElementData &ceData, |
|
|
1409 |
ControlElementFlags elementFlags, |
| 1395 |
const TQRect &r, |
1410 |
const TQRect &r, |
| 1396 |
const TQColorGroup &cg, |
1411 |
const TQColorGroup &cg, |
| 1397 |
SFlags flags, |
1412 |
SFlags flags, |
| 1398 |
const TQStyleOption &opt ) const |
1413 |
const TQStyleOption &opt, |
|
|
1414 |
const TQWidget* widget) const |
| 1399 |
{ |
1415 |
{ |
| 1400 |
const MandrivaColorData *cdata = lookupData(cg); |
1416 |
const MandrivaColorData *cdata = lookupData(cg); |
| 1401 |
switch(pe) |
1417 |
switch(pe) |
|
Lines 1589-1619
Link Here
|
| 1589 |
break; |
1605 |
break; |
| 1590 |
} |
1606 |
} |
| 1591 |
default: |
1607 |
default: |
| 1592 |
TDEStyle::drawKStylePrimitive( pe, p, widget, r, cg, flags, opt); |
1608 |
TDEStyle::drawTDEStylePrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt, widget); |
| 1593 |
} |
1609 |
} |
| 1594 |
} |
1610 |
} |
| 1595 |
|
1611 |
|
| 1596 |
void MandrivaStyle::drawControl( ControlElement element, |
1612 |
void MandrivaStyle::drawControl( ControlElement element, |
| 1597 |
TQPainter *p, |
1613 |
TQPainter *p, |
| 1598 |
const TQWidget *widget, |
1614 |
const TQStyleControlElementData &ceData, |
|
|
1615 |
ControlElementFlags elementFlags, |
| 1599 |
const TQRect &r, |
1616 |
const TQRect &r, |
| 1600 |
const TQColorGroup &cg, |
1617 |
const TQColorGroup &cg, |
| 1601 |
SFlags flags, |
1618 |
SFlags flags, |
| 1602 |
const TQStyleOption& opt ) const |
1619 |
const TQStyleOption& opt, |
|
|
1620 |
const TQWidget *widget ) const |
| 1603 |
{ |
1621 |
{ |
| 1604 |
const MandrivaColorData *cdata = lookupData(cg); |
1622 |
const MandrivaColorData *cdata = lookupData(cg); |
| 1605 |
switch (element) |
1623 |
switch (element) |
| 1606 |
{ |
1624 |
{ |
| 1607 |
case CE_CheckBox: |
1625 |
case CE_CheckBox: |
| 1608 |
{ |
1626 |
{ |
| 1609 |
drawPrimitive (PE_Indicator, p, r, cg, flags); |
1627 |
drawPrimitive (PE_Indicator, p, ceData, elementFlags, r, cg, flags); |
| 1610 |
break; |
1628 |
break; |
| 1611 |
} |
1629 |
} |
| 1612 |
//progressbar |
1630 |
//progressbar |
| 1613 |
case CE_ProgressBarContents: |
1631 |
case CE_ProgressBarContents: |
| 1614 |
{ |
1632 |
{ |
| 1615 |
const TQProgressBar* pb = (const TQProgressBar*)widget; |
1633 |
const TQProgressBar* pb = (const TQProgressBar*)widget; |
| 1616 |
TQRect backend = subRect(SR_ProgressBarContents, widget); |
1634 |
TQRect backend = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); |
| 1617 |
double progress = pb->progress(); |
1635 |
double progress = pb->progress(); |
| 1618 |
bool reverse = TQApplication::reverseLayout(); |
1636 |
bool reverse = TQApplication::reverseLayout(); |
| 1619 |
int steps = pb->totalSteps(); |
1637 |
int steps = pb->totalSteps(); |
|
Lines 1625-1631
Link Here
|
| 1625 |
p->fillRect(backend , cg.background() ); |
1643 |
p->fillRect(backend , cg.background() ); |
| 1626 |
|
1644 |
|
| 1627 |
//draw border |
1645 |
//draw border |
| 1628 |
drawPrimitive( PE_PanelLineEdit, p, r, cg ); |
1646 |
drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, r, cg ); |
| 1629 |
|
1647 |
|
| 1630 |
TQRect cr(backend); |
1648 |
TQRect cr(backend); |
| 1631 |
cr.addCoords( 1, 1, -2, -2 ); |
1649 |
cr.addCoords( 1, 1, -2, -2 ); |
|
Lines 1749-1755
Link Here
|
| 1749 |
case CE_ProgressBarLabel: |
1767 |
case CE_ProgressBarLabel: |
| 1750 |
{ |
1768 |
{ |
| 1751 |
const TQProgressBar * pb = (const TQProgressBar *) widget; |
1769 |
const TQProgressBar * pb = (const TQProgressBar *) widget; |
| 1752 |
const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, pb ); |
1770 |
const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, ceData, elementFlags, pb ); |
| 1753 |
int u = r.width() / unit_width; |
1771 |
int u = r.width() / unit_width; |
| 1754 |
int p_v = pb->progress(); |
1772 |
int p_v = pb->progress(); |
| 1755 |
int t_s = pb->totalSteps(); |
1773 |
int t_s = pb->totalSteps(); |
|
Lines 1795-1801
Link Here
|
| 1795 |
} |
1813 |
} |
| 1796 |
case CE_ToolButtonLabel: |
1814 |
case CE_ToolButtonLabel: |
| 1797 |
{ |
1815 |
{ |
| 1798 |
TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); |
1816 |
TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); |
| 1799 |
break; |
1817 |
break; |
| 1800 |
} |
1818 |
} |
| 1801 |
|
1819 |
|
|
Lines 1908-1916
Link Here
|
| 1908 |
//CHECK |
1926 |
//CHECK |
| 1909 |
case CE_MenuBarItem: |
1927 |
case CE_MenuBarItem: |
| 1910 |
{ |
1928 |
{ |
| 1911 |
TQMenuBar *mb = (TQMenuBar*)widget; |
|
|
| 1912 |
TQMenuItem *mi = opt.menuItem(); |
1929 |
TQMenuItem *mi = opt.menuItem(); |
| 1913 |
TQRect pr = mb->rect(); |
|
|
| 1914 |
|
1930 |
|
| 1915 |
bool active = flags & Style_Active; |
1931 |
bool active = flags & Style_Active; |
| 1916 |
bool focused = flags & Style_HasFocus; |
1932 |
bool focused = flags & Style_HasFocus; |
|
Lines 1969-1975
Link Here
|
| 1969 |
bool enabled = mi->isEnabled(); |
1985 |
bool enabled = mi->isEnabled(); |
| 1970 |
bool checkable = popupmenu->isCheckable(); |
1986 |
bool checkable = popupmenu->isCheckable(); |
| 1971 |
bool active = flags & Style_Active; |
1987 |
bool active = flags & Style_Active; |
| 1972 |
bool etchtext = styleHint( SH_EtchDisabledText ); |
1988 |
bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags ); |
| 1973 |
bool reverse = TQApplication::reverseLayout(); |
1989 |
bool reverse = TQApplication::reverseLayout(); |
| 1974 |
int x, y, w, h; |
1990 |
int x, y, w, h; |
| 1975 |
r.rect( &x, &y, &w, &h ); |
1991 |
r.rect( &x, &y, &w, &h ); |
|
Lines 2044-2050
Link Here
|
| 2044 |
// Draw the checkmark |
2060 |
// Draw the checkmark |
| 2045 |
SFlags cflags = Style_Default; |
2061 |
SFlags cflags = Style_Default; |
| 2046 |
cflags |= active ? Style_Enabled : Style_On; |
2062 |
cflags |= active ? Style_Enabled : Style_On; |
| 2047 |
drawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, |
2063 |
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, |
| 2048 |
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); |
2064 |
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); |
| 2049 |
} |
2065 |
} |
| 2050 |
else |
2066 |
else |
|
Lines 2070-2076
Link Here
|
| 2070 |
// Draw the checkmark |
2086 |
// Draw the checkmark |
| 2071 |
SFlags cflags = Style_Default; |
2087 |
SFlags cflags = Style_Default; |
| 2072 |
cflags |= active ? Style_Enabled : Style_On; |
2088 |
cflags |= active ? Style_Enabled : Style_On; |
| 2073 |
drawPrimitive( PE_CheckMark, p, TQRect( cx + itemFrame, y + itemFrame, |
2089 |
drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, |
| 2074 |
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); |
2090 |
checkcol - itemFrame*2, h - itemFrame*2), cg, cflags ); |
| 2075 |
} |
2091 |
} |
| 2076 |
|
2092 |
|
|
Lines 2186-2192
Link Here
|
| 2186 |
if ( mi->popup() ) |
2202 |
if ( mi->popup() ) |
| 2187 |
{ |
2203 |
{ |
| 2188 |
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; |
2204 |
PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight; |
| 2189 |
int dim = pixelMetric(PM_MenuButtonIndicator)- itemFrame; |
2205 |
int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags)- itemFrame; |
| 2190 |
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim, |
2206 |
TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim, |
| 2191 |
y + h / 2 - dim / 2, dim, dim), r ); |
2207 |
y + h / 2 - dim / 2, dim, dim), r ); |
| 2192 |
|
2208 |
|
|
Lines 2199-2208
Link Here
|
| 2199 |
TQColorGroup g2( cg.highlightedText ()/*white*/, cg.highlight(), /*white*/cg.highlightedText (), /*white*/cg.highlightedText (), |
2215 |
TQColorGroup g2( cg.highlightedText ()/*white*/, cg.highlight(), /*white*/cg.highlightedText (), /*white*/cg.highlightedText (), |
| 2200 |
enabled ? cg.highlightedText () : discol, /*discol*/cg.highlightedText (), cg.highlightedText () ); |
2216 |
enabled ? cg.highlightedText () : discol, /*discol*/cg.highlightedText (), cg.highlightedText () ); |
| 2201 |
|
2217 |
|
| 2202 |
drawPrimitive( arrow, p, vr, g2, Style_Enabled ); |
2218 |
drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled ); |
| 2203 |
} |
2219 |
} |
| 2204 |
else |
2220 |
else |
| 2205 |
drawPrimitive( arrow, p, vr, cg, |
2221 |
drawPrimitive( arrow, p, ceData, elementFlags, vr, cg, |
| 2206 |
enabled ? Style_Enabled : Style_Default ); |
2222 |
enabled ? Style_Enabled : Style_Default ); |
| 2207 |
} |
2223 |
} |
| 2208 |
break; |
2224 |
break; |
|
Lines 2217-2232
Link Here
|
| 2217 |
// Shift button contents if pushed. |
2233 |
// Shift button contents if pushed. |
| 2218 |
if ( active ) |
2234 |
if ( active ) |
| 2219 |
{ |
2235 |
{ |
| 2220 |
x += pixelMetric(PM_ButtonShiftHorizontal, widget); |
2236 |
x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget); |
| 2221 |
y += pixelMetric(PM_ButtonShiftVertical, widget); |
2237 |
y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget); |
| 2222 |
flags |= Style_Sunken; |
2238 |
flags |= Style_Sunken; |
| 2223 |
} |
2239 |
} |
| 2224 |
|
2240 |
|
| 2225 |
// Does the button have a popup menu? |
2241 |
// Does the button have a popup menu? |
| 2226 |
if ( button->isMenuButton() ) |
2242 |
if ( button->isMenuButton() ) |
| 2227 |
{ |
2243 |
{ |
| 2228 |
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); |
2244 |
int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget ); |
| 2229 |
drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), |
2245 |
drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 2, y + 2, dx, h - 4), |
| 2230 |
cg, flags, opt ); |
2246 |
cg, flags, opt ); |
| 2231 |
w -= dx; |
2247 |
w -= dx; |
| 2232 |
} |
2248 |
} |
|
Lines 2290-2297
Link Here
|
| 2290 |
} |
2306 |
} |
| 2291 |
// Draw a focus rect if the button has focus |
2307 |
// Draw a focus rect if the button has focus |
| 2292 |
if ( flags & Style_HasFocus ) |
2308 |
if ( flags & Style_HasFocus ) |
| 2293 |
drawPrimitive( PE_FocusRect, p, |
2309 |
drawPrimitive( PE_FocusRect, p, ceData, elementFlags, |
| 2294 |
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, widget), widget), |
2310 |
TQStyle::visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), widget), |
| 2295 |
cg, flags ); |
2311 |
cg, flags ); |
| 2296 |
break; |
2312 |
break; |
| 2297 |
} |
2313 |
} |
|
Lines 2303-2321
Link Here
|
| 2303 |
if (isFormWidget(btn)) |
2319 |
if (isFormWidget(btn)) |
| 2304 |
formMode = true; |
2320 |
formMode = true; |
| 2305 |
|
2321 |
|
| 2306 |
drawPrimitive( btn->isDefault( ) ? PE_ButtonDefault : PE_ButtonCommand, p, r, cg, flags ); |
2322 |
drawPrimitive( btn->isDefault( ) ? PE_ButtonDefault : PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags ); |
| 2307 |
} |
2323 |
} |
| 2308 |
break; |
2324 |
break; |
| 2309 |
default: |
2325 |
default: |
| 2310 |
TDEStyle::drawControl(element, p, widget, r, cg, flags, opt); |
2326 |
TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); |
| 2311 |
} |
2327 |
} |
| 2312 |
} |
2328 |
} |
| 2313 |
|
2329 |
|
| 2314 |
void MandrivaStyle::drawControlMask( ControlElement element, |
2330 |
void MandrivaStyle::drawControlMask( ControlElement element, |
| 2315 |
TQPainter *p, |
2331 |
TQPainter *p, |
| 2316 |
const TQWidget *widget, |
2332 |
const TQStyleControlElementData &ceData, |
|
|
2333 |
ControlElementFlags elementFlags, |
| 2317 |
const TQRect &r, |
2334 |
const TQRect &r, |
| 2318 |
const TQStyleOption& opt ) const |
2335 |
const TQStyleOption& opt, |
|
|
2336 |
const TQWidget *widget ) const |
| 2319 |
{ |
2337 |
{ |
| 2320 |
switch (element) |
2338 |
switch (element) |
| 2321 |
{ |
2339 |
{ |
|
Lines 2326-2341
Link Here
|
| 2326 |
break; |
2344 |
break; |
| 2327 |
} |
2345 |
} |
| 2328 |
default: |
2346 |
default: |
| 2329 |
TDEStyle::drawControlMask(element, p, widget, r, opt); |
2347 |
TDEStyle::drawControlMask(element, p, ceData, elementFlags, r, opt, widget); |
| 2330 |
} |
2348 |
} |
| 2331 |
} |
2349 |
} |
| 2332 |
|
2350 |
|
| 2333 |
void MandrivaStyle::drawComboboxArrow( TQPainter *p, |
2351 |
void MandrivaStyle::drawComboboxArrow( TQPainter *p, |
| 2334 |
const TQWidget *widget, |
2352 |
const TQStyleControlElementData &ceData, |
|
|
2353 |
ControlElementFlags elementFlags, |
| 2335 |
const TQRect &ar, |
2354 |
const TQRect &ar, |
| 2336 |
const TQColorGroup &cg, |
2355 |
const TQColorGroup &cg, |
| 2337 |
SFlags flags, |
2356 |
SFlags flags, |
| 2338 |
SCFlags active)const |
2357 |
SCFlags active, |
|
|
2358 |
const TQWidget *widget)const |
| 2339 |
{ |
2359 |
{ |
| 2340 |
const TQComboBox * cb = (const TQComboBox *) widget; |
2360 |
const TQComboBox * cb = (const TQComboBox *) widget; |
| 2341 |
bool editableCombo = cb->editable(); |
2361 |
bool editableCombo = cb->editable(); |
|
Lines 2357-2364
Link Here
|
| 2357 |
a.setPoints(TQCOORDARRLEN(c_arrow), c_arrow); |
2377 |
a.setPoints(TQCOORDARRLEN(c_arrow), c_arrow); |
| 2358 |
|
2378 |
|
| 2359 |
if ( flags & Style_Down ) |
2379 |
if ( flags & Style_Down ) |
| 2360 |
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), |
2380 |
p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ), |
| 2361 |
pixelMetric( PM_ButtonShiftVertical ) ); |
2381 |
pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) ); |
| 2362 |
|
2382 |
|
| 2363 |
if ( flags & Style_Enabled ) |
2383 |
if ( flags & Style_Enabled ) |
| 2364 |
{ |
2384 |
{ |
|
Lines 2397-2409
Link Here
|
| 2397 |
|
2417 |
|
| 2398 |
void MandrivaStyle::drawComplexControl( ComplexControl control, |
2418 |
void MandrivaStyle::drawComplexControl( ComplexControl control, |
| 2399 |
TQPainter *p, |
2419 |
TQPainter *p, |
| 2400 |
const TQWidget *widget, |
2420 |
const TQStyleControlElementData &ceData, |
|
|
2421 |
ControlElementFlags elementFlags, |
| 2401 |
const TQRect &r, |
2422 |
const TQRect &r, |
| 2402 |
const TQColorGroup &cg, |
2423 |
const TQColorGroup &cg, |
| 2403 |
SFlags flags, |
2424 |
SFlags flags, |
| 2404 |
SCFlags controls, |
2425 |
SCFlags controls, |
| 2405 |
SCFlags active, |
2426 |
SCFlags active, |
| 2406 |
const TQStyleOption& opt ) const |
2427 |
const TQStyleOption& opt, |
|
|
2428 |
const TQWidget *widget ) const |
| 2407 |
{ |
2429 |
{ |
| 2408 |
const MandrivaColorData *cdata = lookupData(cg); |
2430 |
const MandrivaColorData *cdata = lookupData(cg); |
| 2409 |
switch(control) |
2431 |
switch(control) |
|
Lines 2411-2417
Link Here
|
| 2411 |
case CC_SpinWidget: |
2433 |
case CC_SpinWidget: |
| 2412 |
{ |
2434 |
{ |
| 2413 |
const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget ); |
2435 |
const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget ); |
| 2414 |
TQRect br = visualRect( querySubControlMetrics( CC_SpinWidget, widget, SC_SpinWidgetButtonField ), widget ); |
2436 |
TQRect br = visualRect( querySubControlMetrics( CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetButtonField, opt, widget ), widget ); |
| 2415 |
//FIXME |
2437 |
//FIXME |
| 2416 |
p->fillRect( r, widget->isEnabled() ? cg.base() : cg.background() ); |
2438 |
p->fillRect( r, widget->isEnabled() ? cg.base() : cg.background() ); |
| 2417 |
|
2439 |
|
|
Lines 2420-2436
Link Here
|
| 2420 |
if ( controls & SC_SpinWidgetUp) |
2442 |
if ( controls & SC_SpinWidgetUp) |
| 2421 |
{ |
2443 |
{ |
| 2422 |
TQColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled(); |
2444 |
TQColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled(); |
| 2423 |
drawPrimitive( PE_SpinWidgetUp,p, TQRect(br.x()+1 , br.y()+1 , br.width()-2 , br.height() / 2 ), ucg, flags, opt); |
2445 |
drawPrimitive( PE_SpinWidgetUp,p, ceData, elementFlags, TQRect(br.x()+1, br.y()+1 , br.width()-2 , br.height() / 2 ), ucg, flags, opt); |
| 2424 |
} |
2446 |
} |
| 2425 |
if ( controls & SC_SpinWidgetDown) |
2447 |
if ( controls & SC_SpinWidgetDown) |
| 2426 |
{ |
2448 |
{ |
| 2427 |
TQColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled(); |
2449 |
TQColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled(); |
| 2428 |
|
2450 |
|
| 2429 |
drawPrimitive( PE_SpinWidgetDown,p, TQRect( br.x()+1 , br.y() + br.height() / 2 , br.width()-2, br.height()/ 2 -1 ), dcg, flags, opt); |
2451 |
drawPrimitive( PE_SpinWidgetDown,p, ceData, elementFlags, TQRect( br.x()+1 , br.y() + br.height() / 2 , br.width()-2, br.height()/ 2 -1 ), dcg, flags, opt); |
| 2430 |
} |
2452 |
} |
| 2431 |
} |
2453 |
} |
| 2432 |
if ( controls & SC_SpinWidgetFrame ) |
2454 |
if ( controls & SC_SpinWidgetFrame ) |
| 2433 |
drawPrimitive( PE_PanelLineEdit, p, r, cg ); |
2455 |
drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, r, cg ); |
| 2434 |
|
2456 |
|
| 2435 |
break; |
2457 |
break; |
| 2436 |
} |
2458 |
} |
|
Lines 2439-2446
Link Here
|
| 2439 |
const TQToolButton *tb = (const TQToolButton *) widget; |
2461 |
const TQToolButton *tb = (const TQToolButton *) widget; |
| 2440 |
|
2462 |
|
| 2441 |
TQRect button, menuarea; |
2463 |
TQRect button, menuarea; |
| 2442 |
button = querySubControlMetrics(control, widget, SC_ToolButton, opt); |
2464 |
button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget); |
| 2443 |
menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt); |
2465 |
menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget); |
| 2444 |
|
2466 |
|
| 2445 |
SFlags bflags = flags, |
2467 |
SFlags bflags = flags, |
| 2446 |
mflags = flags; |
2468 |
mflags = flags; |
|
Lines 2460-2466
Link Here
|
| 2460 |
// If we're pressed, on, or raised... |
2482 |
// If we're pressed, on, or raised... |
| 2461 |
if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) |
2483 |
if (bflags & (Style_Down | Style_On | Style_Raised) || widget==hoverWidget ) |
| 2462 |
{ |
2484 |
{ |
| 2463 |
drawPrimitive(PE_ButtonTool, p, button, cg, bflags, opt); |
2485 |
drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt); |
| 2464 |
} |
2486 |
} |
| 2465 |
else if (tb->parentWidget() && |
2487 |
else if (tb->parentWidget() && |
| 2466 |
tb->parentWidget()->backgroundPixmap() && |
2488 |
tb->parentWidget()->backgroundPixmap() && |
|
Lines 2475-2490
Link Here
|
| 2475 |
if (controls & SC_ToolButtonMenu) |
2497 |
if (controls & SC_ToolButtonMenu) |
| 2476 |
{ |
2498 |
{ |
| 2477 |
if (mflags & (Style_Down | Style_On | Style_Raised)) |
2499 |
if (mflags & (Style_Down | Style_On | Style_Raised)) |
| 2478 |
drawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, opt); |
2500 |
drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); |
| 2479 |
|
2501 |
|
| 2480 |
drawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt); |
2502 |
drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt); |
| 2481 |
} |
2503 |
} |
| 2482 |
|
2504 |
|
| 2483 |
if (tb->hasFocus() && !tb->focusProxy()) |
2505 |
if (tb->hasFocus() && !tb->focusProxy()) |
| 2484 |
{ |
2506 |
{ |
| 2485 |
TQRect fr = tb->rect(); |
2507 |
TQRect fr = tb->rect(); |
| 2486 |
fr.addCoords(2, 2, -2, -2); |
2508 |
fr.addCoords(2, 2, -2, -2); |
| 2487 |
drawPrimitive(PE_FocusRect, p, fr, cg); |
2509 |
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg); |
| 2488 |
} |
2510 |
} |
| 2489 |
|
2511 |
|
| 2490 |
// Set the color for the ToolButton menu indicator |
2512 |
// Set the color for the ToolButton menu indicator |
|
Lines 2500-2513
Link Here
|
| 2500 |
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); |
2522 |
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); |
| 2501 |
scrollmin = ( scrollbar->minValue() == scrollbar->value() ); |
2523 |
scrollmin = ( scrollbar->minValue() == scrollbar->value() ); |
| 2502 |
scrollmax = (( scrollbar->maxValue() == scrollbar->value() )|| maxedOut); |
2524 |
scrollmax = (( scrollbar->maxValue() == scrollbar->value() )|| maxedOut); |
| 2503 |
subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt); |
2525 |
subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); |
| 2504 |
addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, opt); |
2526 |
addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); |
| 2505 |
subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, opt); |
2527 |
subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); |
| 2506 |
addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, opt); |
2528 |
addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); |
| 2507 |
slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, opt); |
2529 |
slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); |
| 2508 |
|
2530 |
|
| 2509 |
first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, opt); |
2531 |
first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); |
| 2510 |
last = querySubControlMetrics(control, widget, SC_ScrollBarLast, opt); |
2532 |
last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); |
| 2511 |
|
2533 |
|
| 2512 |
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) |
2534 |
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) |
| 2513 |
{ |
2535 |
{ |
|
Lines 2518-2524
Link Here
|
| 2518 |
flags |= Style_Horizontal; |
2540 |
flags |= Style_Horizontal; |
| 2519 |
if (hoverWidget == widget && hoverControl == HoverScrollBarSubLine) |
2541 |
if (hoverWidget == widget && hoverControl == HoverScrollBarSubLine) |
| 2520 |
flags |= Style_MouseOver; |
2542 |
flags |= Style_MouseOver; |
| 2521 |
drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, flags); |
2543 |
drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, flags); |
| 2522 |
} |
2544 |
} |
| 2523 |
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) |
2545 |
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) |
| 2524 |
{ |
2546 |
{ |
|
Lines 2529-2557
Link Here
|
| 2529 |
flags |= Style_Horizontal; |
2551 |
flags |= Style_Horizontal; |
| 2530 |
if (hoverWidget == widget && hoverControl == HoverScrollBarAddLine) |
2552 |
if (hoverWidget == widget && hoverControl == HoverScrollBarAddLine) |
| 2531 |
flags |= Style_MouseOver; |
2553 |
flags |= Style_MouseOver; |
| 2532 |
drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, flags); |
2554 |
drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags); |
| 2533 |
} |
2555 |
} |
| 2534 |
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) |
2556 |
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) |
| 2535 |
drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, |
2557 |
drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, |
| 2536 |
Style_Enabled | ((active == SC_ScrollBarSubPage) ? |
2558 |
Style_Enabled | ((active == SC_ScrollBarSubPage) ? |
| 2537 |
Style_Down : Style_Default) | |
2559 |
Style_Down : Style_Default) | |
| 2538 |
((scrollbar->orientation() == TQt::Horizontal) ? |
2560 |
((scrollbar->orientation() == TQt::Horizontal) ? |
| 2539 |
Style_Horizontal : 0)); |
2561 |
Style_Horizontal : 0)); |
| 2540 |
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) |
2562 |
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) |
| 2541 |
drawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, |
2563 |
drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, |
| 2542 |
((maxedOut) ? Style_Default : Style_Enabled) | |
2564 |
((maxedOut) ? Style_Default : Style_Enabled) | |
| 2543 |
((active == SC_ScrollBarAddPage) ? |
2565 |
((active == SC_ScrollBarAddPage) ? |
| 2544 |
Style_Down : Style_Default) | |
2566 |
Style_Down : Style_Default) | |
| 2545 |
((scrollbar->orientation() == TQt::Horizontal) ? |
2567 |
((scrollbar->orientation() == TQt::Horizontal) ? |
| 2546 |
Style_Horizontal : 0)); |
2568 |
Style_Horizontal : 0)); |
| 2547 |
if ((controls & SC_ScrollBarFirst) && first.isValid()) |
2569 |
if ((controls & SC_ScrollBarFirst) && first.isValid()) |
| 2548 |
drawPrimitive(PE_ScrollBarFirst, p, first, cg, |
2570 |
drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, |
| 2549 |
Style_Enabled | ((active == SC_ScrollBarFirst) ? |
2571 |
Style_Enabled | ((active == SC_ScrollBarFirst) ? |
| 2550 |
Style_Down : Style_Default) | |
2572 |
Style_Down : Style_Default) | |
| 2551 |
((scrollbar->orientation() == TQt::Horizontal) ? |
2573 |
((scrollbar->orientation() == TQt::Horizontal) ? |
| 2552 |
Style_Horizontal : 0)); |
2574 |
Style_Horizontal : 0)); |
| 2553 |
if ((controls & SC_ScrollBarLast) && last.isValid()) |
2575 |
if ((controls & SC_ScrollBarLast) && last.isValid()) |
| 2554 |
drawPrimitive(PE_ScrollBarLast, p, last, cg, |
2576 |
drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, |
| 2555 |
Style_Enabled | ((active == SC_ScrollBarLast) ? |
2577 |
Style_Enabled | ((active == SC_ScrollBarLast) ? |
| 2556 |
Style_Down : Style_Default) | |
2578 |
Style_Down : Style_Default) | |
| 2557 |
((scrollbar->orientation() == TQt::Horizontal) ? |
2579 |
((scrollbar->orientation() == TQt::Horizontal) ? |
|
Lines 2565-2578
Link Here
|
| 2565 |
flags |= Style_Horizontal; |
2587 |
flags |= Style_Horizontal; |
| 2566 |
if (hoverWidget == widget && hoverControl == HoverScrollBarSlider) |
2588 |
if (hoverWidget == widget && hoverControl == HoverScrollBarSlider) |
| 2567 |
flags |= Style_MouseOver; |
2589 |
flags |= Style_MouseOver; |
| 2568 |
drawPrimitive(PE_ScrollBarSlider, p, slider, cg, flags); |
2590 |
drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, flags); |
| 2569 |
|
2591 |
|
| 2570 |
// ### perhaps this should not be able to accept focus if maxedOut? |
2592 |
// ### perhaps this should not be able to accept focus if maxedOut? |
| 2571 |
if (scrollbar->hasFocus()) |
2593 |
if (scrollbar->hasFocus()) |
| 2572 |
{ |
2594 |
{ |
| 2573 |
TQRect fr(slider.x() + 2, slider.y() + 2, |
2595 |
TQRect fr(slider.x() + 2, slider.y() + 2, |
| 2574 |
slider.width() - 5, slider.height() - 5); |
2596 |
slider.width() - 5, slider.height() - 5); |
| 2575 |
drawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); |
2597 |
drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); |
| 2576 |
} |
2598 |
} |
| 2577 |
} |
2599 |
} |
| 2578 |
break; |
2600 |
break; |
|
Lines 2601-2609
Link Here
|
| 2601 |
|
2623 |
|
| 2602 |
if( (controls & SC_ComboBoxEditField )) |
2624 |
if( (controls & SC_ComboBoxEditField )) |
| 2603 |
{ |
2625 |
{ |
| 2604 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxEditField), widget ); |
2626 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, opt, widget), widget ); |
| 2605 |
|
2627 |
|
| 2606 |
drawPrimitive( PE_PanelLineEdit, p, ar, cg ); |
2628 |
drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, ar, cg ); |
| 2607 |
} |
2629 |
} |
| 2608 |
//if ( controls & SC_ComboBoxListBoxPopup ) |
2630 |
//if ( controls & SC_ComboBoxListBoxPopup ) |
| 2609 |
//{ |
2631 |
//{ |
|
Lines 2611-2617
Link Here
|
| 2611 |
//} |
2633 |
//} |
| 2612 |
if( (controls & SC_ComboBoxArrow )) |
2634 |
if( (controls & SC_ComboBoxArrow )) |
| 2613 |
{ |
2635 |
{ |
| 2614 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow), widget ); |
2636 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, opt, widget), widget ); |
| 2615 |
bool mouseOver = (flags & Style_MouseOver) && (hoverControl == HoverComboBoxArrow); |
2637 |
bool mouseOver = (flags & Style_MouseOver) && (hoverControl == HoverComboBoxArrow); |
| 2616 |
if ( sunken ) |
2638 |
if ( sunken ) |
| 2617 |
renderGradient(p, TQRect(ar.x()+1, ar.y()+1, ar.width()-1, ar.height()-2), cdata->shades[2], cdata->shades[0], false); |
2639 |
renderGradient(p, TQRect(ar.x()+1, ar.y()+1, ar.width()-1, ar.height()-2), cdata->shades[2], cdata->shades[0], false); |
|
Lines 2649-2655
Link Here
|
| 2649 |
else |
2671 |
else |
| 2650 |
p->drawLine( ar.x(), ar.y()+1, ar.x(), ar.height()-2 ); |
2672 |
p->drawLine( ar.x(), ar.y()+1, ar.x(), ar.height()-2 ); |
| 2651 |
|
2673 |
|
| 2652 |
drawComboboxArrow( p,widget,ar,cg,flags,active); |
2674 |
drawComboboxArrow( p,ceData,elementFlags,ar,cg,flags,active,widget); |
| 2653 |
} |
2675 |
} |
| 2654 |
} |
2676 |
} |
| 2655 |
else |
2677 |
else |
|
Lines 2657-2663
Link Here
|
| 2657 |
TQPen oldPen = p->pen(); |
2679 |
TQPen oldPen = p->pen(); |
| 2658 |
|
2680 |
|
| 2659 |
// Get the button bounding box |
2681 |
// Get the button bounding box |
| 2660 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxArrow), widget ); |
2682 |
TQRect ar = TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, opt, widget), widget ); |
| 2661 |
drawButton( cdata,r,p,cg,flags | (sunken ? Style_Down : Style_Default)); |
2683 |
drawButton( cdata,r,p,cg,flags | (sunken ? Style_Down : Style_Default)); |
| 2662 |
|
2684 |
|
| 2663 |
//test reverse ! |
2685 |
//test reverse ! |
|
Lines 2676-2697
Link Here
|
| 2676 |
p->drawLine( ar.x()-2,ar.y()+5,ar.x()-2,ar.height()-6); |
2698 |
p->drawLine( ar.x()-2,ar.y()+5,ar.x()-2,ar.height()-6); |
| 2677 |
} |
2699 |
} |
| 2678 |
|
2700 |
|
| 2679 |
drawComboboxArrow( p,widget,ar,cg,flags,active); |
2701 |
drawComboboxArrow( p,ceData,elementFlags,ar,cg,flags,active,widget); |
| 2680 |
p->setPen( oldPen );// restore pen |
2702 |
p->setPen( oldPen );// restore pen |
| 2681 |
|
2703 |
|
| 2682 |
} |
2704 |
} |
| 2683 |
break; |
2705 |
break; |
| 2684 |
} |
2706 |
} |
| 2685 |
default: |
2707 |
default: |
| 2686 |
TDEStyle::drawComplexControl(control, p, widget, |
2708 |
TDEStyle::drawComplexControl(control, p, ceData, elementFlags, |
| 2687 |
r, cg, flags, controls, active, opt); |
2709 |
r, cg, flags, controls, active, opt, widget); |
| 2688 |
} |
2710 |
} |
| 2689 |
} |
2711 |
} |
| 2690 |
|
2712 |
|
| 2691 |
TQRect MandrivaStyle::querySubControlMetrics( ComplexControl control, |
2713 |
TQRect MandrivaStyle::querySubControlMetrics( ComplexControl control, |
| 2692 |
const TQWidget* widget, |
2714 |
const TQStyleControlElementData &ceData, |
|
|
2715 |
ControlElementFlags elementFlags, |
| 2693 |
SubControl subcontrol, |
2716 |
SubControl subcontrol, |
| 2694 |
const TQStyleOption& opt ) const |
2717 |
const TQStyleOption& opt, |
|
|
2718 |
const TQWidget* widget ) const |
| 2695 |
{ |
2719 |
{ |
| 2696 |
switch (control) |
2720 |
switch (control) |
| 2697 |
{ |
2721 |
{ |
|
Lines 2702-2708
Link Here
|
| 2702 |
case SC_SpinWidgetButtonField: |
2726 |
case SC_SpinWidgetButtonField: |
| 2703 |
return TQRect( widget->width() -14 , 0, 14, widget->height() ); |
2727 |
return TQRect( widget->width() -14 , 0, 14, widget->height() ); |
| 2704 |
default: |
2728 |
default: |
| 2705 |
return TDEStyle::querySubControlMetrics( control, widget, subcontrol, opt ); |
2729 |
return TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ); |
| 2706 |
} |
2730 |
} |
| 2707 |
} |
2731 |
} |
| 2708 |
//TODO verify it. |
2732 |
//TODO verify it. |
|
Lines 2729-2735
Link Here
|
| 2729 |
return TQRect( 5, 1, widget->width() - arrow-12, widget->height() - 2); |
2753 |
return TQRect( 5, 1, widget->width() - arrow-12, widget->height() - 2); |
| 2730 |
} |
2754 |
} |
| 2731 |
default: |
2755 |
default: |
| 2732 |
return TDEStyle::querySubControlMetrics( control, widget, subcontrol, opt ); |
2756 |
return TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ); |
| 2733 |
} |
2757 |
} |
| 2734 |
break; |
2758 |
break; |
| 2735 |
} |
2759 |
} |
|
Lines 2739-2746
Link Here
|
| 2739 |
bool horizontal = sl->orientation() == Horizontal; |
2763 |
bool horizontal = sl->orientation() == Horizontal; |
| 2740 |
TQSlider::TickSetting ticks = sl->tickmarks(); |
2764 |
TQSlider::TickSetting ticks = sl->tickmarks(); |
| 2741 |
int pos = sl->sliderStart(); |
2765 |
int pos = sl->sliderStart(); |
| 2742 |
int handleSize = pixelMetric( PM_SliderThickness, widget ); |
2766 |
int handleSize = pixelMetric( PM_SliderThickness, ceData, elementFlags, widget ); |
| 2743 |
int len = pixelMetric( PM_SliderLength, widget ); |
2767 |
int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ); |
| 2744 |
switch ( subcontrol ) |
2768 |
switch ( subcontrol ) |
| 2745 |
{ |
2769 |
{ |
| 2746 |
case SC_SliderHandle: |
2770 |
case SC_SliderHandle: |
|
Lines 2768-2781
Link Here
|
| 2768 |
default: |
2792 |
default: |
| 2769 |
break; |
2793 |
break; |
| 2770 |
} |
2794 |
} |
| 2771 |
return TDEStyle::querySubControlMetrics( control, widget, subcontrol, opt ); |
2795 |
return TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget ); |
| 2772 |
} |
2796 |
} |
| 2773 |
|
2797 |
|
| 2774 |
void MandrivaStyle::drawComplexControlMask( ComplexControl control, |
2798 |
void MandrivaStyle::drawComplexControlMask( ComplexControl control, |
| 2775 |
TQPainter *p, |
2799 |
TQPainter *p, |
| 2776 |
const TQWidget *widget, |
2800 |
const TQStyleControlElementData &ceData, |
|
|
2801 |
ControlElementFlags elementFlags, |
| 2777 |
const TQRect &r, |
2802 |
const TQRect &r, |
| 2778 |
const TQStyleOption& opt ) const |
2803 |
const TQStyleOption& opt, |
|
|
2804 |
const TQWidget *widget ) const |
| 2779 |
{ |
2805 |
{ |
| 2780 |
//TODO verify |
2806 |
//TODO verify |
| 2781 |
//#if 0 |
2807 |
//#if 0 |
|
Lines 2796-2809
Link Here
|
| 2796 |
} |
2822 |
} |
| 2797 |
|
2823 |
|
| 2798 |
default: |
2824 |
default: |
| 2799 |
TDEStyle::drawComplexControlMask(control, p, widget, r, opt); |
2825 |
TDEStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget); |
| 2800 |
} |
2826 |
} |
| 2801 |
//#endif |
2827 |
//#endif |
| 2802 |
//TDEStyle::drawComplexControlMask(control, p, widget, r, opt); |
2828 |
//TDEStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget); |
| 2803 |
} |
2829 |
} |
| 2804 |
|
2830 |
|
| 2805 |
|
2831 |
|
| 2806 |
int MandrivaStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const |
2832 |
int MandrivaStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const |
| 2807 |
{ |
2833 |
{ |
| 2808 |
switch(m) |
2834 |
switch(m) |
| 2809 |
{ |
2835 |
{ |
|
Lines 2841-2855
Link Here
|
| 2841 |
case PM_TabBarTabShiftVertical: |
2867 |
case PM_TabBarTabShiftVertical: |
| 2842 |
return 0; |
2868 |
return 0; |
| 2843 |
default: |
2869 |
default: |
| 2844 |
return TDEStyle::pixelMetric(m, widget); |
2870 |
return TDEStyle::pixelMetric(m, ceData, elementFlags, widget); |
| 2845 |
} |
2871 |
} |
| 2846 |
} |
2872 |
} |
| 2847 |
|
2873 |
|
| 2848 |
|
2874 |
|
| 2849 |
TQSize MandrivaStyle::sizeFromContents( ContentsType contents, |
2875 |
TQSize MandrivaStyle::sizeFromContents( ContentsType contents, |
| 2850 |
const TQWidget* widget, |
2876 |
const TQStyleControlElementData &ceData, |
|
|
2877 |
ControlElementFlags elementFlags, |
| 2851 |
const TQSize &contentSize, |
2878 |
const TQSize &contentSize, |
| 2852 |
const TQStyleOption& opt ) const |
2879 |
const TQStyleOption& opt, |
|
|
2880 |
const TQWidget* widget ) const |
| 2853 |
{ |
2881 |
{ |
| 2854 |
switch (contents) |
2882 |
switch (contents) |
| 2855 |
{ |
2883 |
{ |
|
Lines 2876-2882
Link Here
|
| 2876 |
} |
2904 |
} |
| 2877 |
else |
2905 |
else |
| 2878 |
{ |
2906 |
{ |
| 2879 |
return TDEStyle::sizeFromContents( contents, widget, contentSize, opt ); |
2907 |
return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); |
| 2880 |
} |
2908 |
} |
| 2881 |
} |
2909 |
} |
| 2882 |
case CT_ComboBox: |
2910 |
case CT_ComboBox: |
|
Lines 2898-2905
Link Here
|
| 2898 |
const TQPushButton* button = (const TQPushButton*) widget; |
2926 |
const TQPushButton* button = (const TQPushButton*) widget; |
| 2899 |
int w = contentSize.width(); |
2927 |
int w = contentSize.width(); |
| 2900 |
int h = contentSize.height(); |
2928 |
int h = contentSize.height(); |
| 2901 |
int bm = pixelMetric( PM_ButtonMargin, widget ); |
2929 |
int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ); |
| 2902 |
int fw = pixelMetric( PM_DefaultFrameWidth, widget ) * 2; |
2930 |
int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2; |
| 2903 |
|
2931 |
|
| 2904 |
w += bm + fw + 6; // ### Add 6 to make way for bold font. |
2932 |
w += bm + fw + 6; // ### Add 6 to make way for bold font. |
| 2905 |
h += bm + fw; |
2933 |
h += bm + fw; |
|
Lines 2981-3102
Link Here
|
| 2981 |
} |
3009 |
} |
| 2982 |
|
3010 |
|
| 2983 |
default: |
3011 |
default: |
| 2984 |
return TDEStyle::sizeFromContents( contents, widget, contentSize, opt ); |
3012 |
return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget ); |
| 2985 |
} |
3013 |
} |
| 2986 |
} |
3014 |
} |
| 2987 |
|
3015 |
|
| 2988 |
//Why ? why create virtual function ? |
3016 |
//Why ? why create virtual function ? |
| 2989 |
// Fix TQt's wacky image alignment |
3017 |
// Fix TQt's wacky image alignment |
| 2990 |
TQPixmap MandrivaStyle::stylePixmap(StylePixmap stylepixmap, |
3018 |
TQPixmap MandrivaStyle::stylePixmap(StylePixmap stylepixmap, |
| 2991 |
const TQWidget* widget, |
3019 |
const TQStyleControlElementData &ceData, |
| 2992 |
const TQStyleOption& opt) const |
3020 |
ControlElementFlags elementFlags, |
| 2993 |
{ |
3021 |
const TQStyleOption& opt, |
| 2994 |
return TDEStyle::stylePixmap(stylepixmap, widget, opt); |
3022 |
const TQWidget* widget) const |
| 2995 |
} |
3023 |
{ |
| 2996 |
|
3024 |
return TDEStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); |
| 2997 |
bool MandrivaStyle::eventFilter( TQObject *object, TQEvent *event ) |
3025 |
} |
| 2998 |
{ |
3026 |
|
| 2999 |
if (TDEStyle::eventFilter( object, event )) |
3027 |
bool MandrivaStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *ev ) |
| 3000 |
return true; |
3028 |
{ |
| 3001 |
TQToolBar* toolbar; |
3029 |
if (TDEStyle::objectEventHandler(ceData, elementFlags, source, ev)) { |
| 3002 |
//Hover highlight on buttons and combos |
3030 |
return true; |
| 3003 |
if ( object->inherits("TQPushButton") |
3031 |
} |
| 3004 |
|| object->inherits("TQComboBox") |
3032 |
|
| 3005 |
|| object->inherits("TQScrollBar") |
3033 |
if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { |
| 3006 |
|| object->inherits("TQHeader") |
3034 |
TQObject* obj = reinterpret_cast<TQObject*>(source); |
| 3007 |
|| object->inherits("TQSlider") |
3035 |
|
| 3008 |
|| object->inherits("TQCheckBox") |
3036 |
TQToolBar* toolbar; |
| 3009 |
|| object->inherits("TQSplitterHandle")) |
3037 |
//Hover highlight on buttons and combos |
| 3010 |
{ |
3038 |
if ( obj->inherits("TQPushButton") |
| 3011 |
if ( (event->type() == TQEvent::Enter) && static_cast<TQWidget*>(object)->isEnabled()) |
3039 |
|| obj->inherits("TQComboBox") |
| 3012 |
{ |
3040 |
|| obj->inherits("TQScrollBar") |
| 3013 |
TQWidget* button = static_cast<TQWidget*>(object); |
3041 |
|| obj->inherits("TQHeader") |
| 3014 |
hoverWidget = button; |
3042 |
|| obj->inherits("TQSlider") |
| 3015 |
button->repaint( false ); |
3043 |
|| obj->inherits("TQCheckBox") |
| 3016 |
} |
3044 |
|| obj->inherits("TQSplitterHandle")) |
| 3017 |
else if ( (event->type() == TQEvent::Leave) && (object == hoverWidget) ) |
3045 |
{ |
| 3018 |
{ |
3046 |
if ( (ev->type() == TQEvent::Enter) && static_cast<TQWidget*>(obj)->isEnabled()) |
| 3019 |
TQWidget* button = static_cast<TQWidget*>(object); |
3047 |
{ |
| 3020 |
hoverWidget = 0; |
3048 |
TQWidget* button = static_cast<TQWidget*>(obj); |
| 3021 |
hoverControl = HoverNone; |
3049 |
hoverWidget = button; |
| 3022 |
button->repaint( false ); |
3050 |
button->repaint( false ); |
| 3023 |
} |
3051 |
} |
| 3024 |
if ((object->inherits("TQScrollBar") || object->inherits("TQComboBox")) |
3052 |
else if ( (ev->type() == TQEvent::Leave) && (obj == hoverWidget) ) |
| 3025 |
&& event->type() == TQEvent::MouseMove) |
3053 |
{ |
| 3026 |
{ |
3054 |
TQWidget* button = static_cast<TQWidget*>(obj); |
| 3027 |
TQWidget *button = static_cast<TQWidget*>(object); |
3055 |
hoverWidget = 0; |
| 3028 |
TQMouseEvent *e = static_cast<TQMouseEvent*>(event); |
3056 |
hoverControl = HoverNone; |
| 3029 |
// updateHoverControl will trigger a repainting if necessary |
3057 |
button->repaint( false ); |
| 3030 |
updateHoverControl(e->pos()); |
3058 |
} |
| 3031 |
} |
3059 |
if ((obj->inherits("TQScrollBar") || obj->inherits("TQComboBox")) |
| 3032 |
|
3060 |
&& ev->type() == TQEvent::MouseMove) |
| 3033 |
} |
3061 |
{ |
| 3034 |
else if (object->inherits("TQListBox")) |
3062 |
TQMouseEvent *e = static_cast<TQMouseEvent*>(ev); |
| 3035 |
{ |
3063 |
// updateHoverControl will trigger a repainting if necessary |
| 3036 |
if ( event->type() == TQEvent::Show || event->type() == TQEvent::Hide) |
3064 |
updateHoverControl(e->pos(), ceData, elementFlags); |
| 3037 |
{ |
3065 |
} |
| 3038 |
TQWidget *w = static_cast<TQWidget*>(object); |
3066 |
|
| 3039 |
if (w->parentWidget() && w->parentWidget()->inherits("TQComboBox")) |
3067 |
} |
| 3040 |
w->parentWidget()->repaint(false); |
3068 |
else if (obj->inherits("TQListBox")) |
| 3041 |
} |
3069 |
{ |
| 3042 |
} |
3070 |
if ( ev->type() == TQEvent::Show || ev->type() == TQEvent::Hide) |
| 3043 |
else if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) ) |
3071 |
{ |
| 3044 |
{ |
3072 |
TQWidget *w = static_cast<TQWidget*>(obj); |
| 3045 |
// Draw a gradient background for custom widgets in the toolbar |
3073 |
if (w->parentWidget() && w->parentWidget()->inherits("TQComboBox")) |
| 3046 |
// that have specified a "tde toolbar widget" name. |
3074 |
w->parentWidget()->repaint(false); |
| 3047 |
|
3075 |
} |
| 3048 |
if (event->type() == TQEvent::Paint ) |
3076 |
} |
| 3049 |
{ |
3077 |
else if ( obj->parent() && !qstrcmp( obj->name(), kdeToolbarWidget ) ) |
| 3050 |
// Find the top-level toolbar of this widget, since it may be nested in other |
3078 |
{ |
| 3051 |
// widgets that are on the toolbar. |
3079 |
// Draw a gradient background for custom widgets in the toolbar |
| 3052 |
TQWidget *widget = static_cast<TQWidget*>(object); |
3080 |
// that have specified a "tde toolbar widget" name. |
| 3053 |
TQWidget *parent = static_cast<TQWidget*>(object->parent()); |
3081 |
|
| 3054 |
int x_offset = widget->x(), y_offset = widget->y(); |
3082 |
if (ev->type() == TQEvent::Paint ) |
| 3055 |
while (parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) ) |
3083 |
{ |
| 3056 |
{ |
3084 |
// Find the top-level toolbar of this widget, since it may be nested in other |
| 3057 |
x_offset += parent->x(); |
3085 |
// widgets that are on the toolbar. |
| 3058 |
y_offset += parent->y(); |
3086 |
TQWidget *widget = static_cast<TQWidget*>(obj); |
| 3059 |
parent = static_cast<TQWidget*>(parent->parent()); |
3087 |
TQWidget *parent = static_cast<TQWidget*>(obj->parent()); |
| 3060 |
} |
3088 |
int x_offset = widget->x(), y_offset = widget->y(); |
| 3061 |
|
3089 |
while (parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) ) |
| 3062 |
TQRect r = widget->rect(); |
3090 |
{ |
| 3063 |
TQRect pr = parent->rect(); |
3091 |
x_offset += parent->x(); |
| 3064 |
bool horiz_grad = pr.width() < pr.height(); |
3092 |
y_offset += parent->y(); |
| 3065 |
|
3093 |
parent = static_cast<TQWidget*>(parent->parent()); |
| 3066 |
// Check if the parent is a TQToolbar, and use its orientation, else guess. |
3094 |
} |
| 3067 |
TQToolBar* tb = dynamic_cast<TQToolBar*>(parent); |
3095 |
|
| 3068 |
if (tb) horiz_grad = tb->orientation() == TQt::Vertical; |
3096 |
TQRect r = widget->rect(); |
| 3069 |
|
3097 |
TQRect pr = parent->rect(); |
| 3070 |
TQPainter p( widget ); |
3098 |
bool horiz_grad = pr.width() < pr.height(); |
| 3071 |
renderGradient(&p, r, parent->colorGroup().background(),parent->colorGroup().background(), horiz_grad);/*, |
3099 |
|
| 3072 |
x_offset, y_offset, pr.width(), pr.height());*/ |
3100 |
// Check if the parent is a TQToolbar, and use its orientation, else guess. |
| 3073 |
//FIXME: check this code later |
3101 |
TQToolBar* tb = dynamic_cast<TQToolBar*>(parent); |
| 3074 |
return false; // Now draw the contents |
3102 |
if (tb) horiz_grad = tb->orientation() == TQt::Vertical; |
| 3075 |
} |
3103 |
|
| 3076 |
} |
3104 |
TQPainter p( widget ); |
| 3077 |
else if ( object->parent() && |
3105 |
renderGradient(&p, r, parent->colorGroup().background(),parent->colorGroup().background(), horiz_grad);/*, |
| 3078 |
(toolbar = dynamic_cast<TQToolBar*>(object->parent())) ) |
3106 |
x_offset, y_offset, pr.width(), pr.height());*/ |
| 3079 |
{ |
3107 |
//FIXME: check this code later |
| 3080 |
|
3108 |
return false; // Now draw the contents |
| 3081 |
// We need to override the paint event to draw a |
3109 |
} |
| 3082 |
// gradient on a TQToolBarExtensionWidget. |
3110 |
} |
| 3083 |
if ( event->type() == TQEvent::Paint ) |
3111 |
else if ( obj->parent() && |
| 3084 |
{ |
3112 |
(toolbar = dynamic_cast<TQToolBar*>(obj->parent())) ) |
| 3085 |
TQWidget *widget = static_cast<TQWidget*>(object); |
3113 |
{ |
| 3086 |
TQRect wr = widget->rect(), tr = toolbar->rect(); |
3114 |
|
| 3087 |
TQPainter p( widget ); |
3115 |
// We need to override the paint event to draw a |
| 3088 |
renderGradient(&p, wr, toolbar->colorGroup().background(),toolbar->colorGroup().background(), |
3116 |
// gradient on a TQToolBarExtensionWidget. |
| 3089 |
toolbar->orientation() == TQt::Vertical);/*, |
3117 |
if ( ev->type() == TQEvent::Paint ) |
| 3090 |
wr.x(), wr.y(), tr.width() - 2, tr.height() - 2);*/ |
3118 |
{ |
| 3091 |
//FIXME: check this code later |
3119 |
TQWidget *widget = static_cast<TQWidget*>(obj); |
| 3092 |
p.setPen( toolbar->colorGroup().dark() ); |
3120 |
TQRect wr = widget->rect(); |
| 3093 |
if ( toolbar->orientation() == TQt::Horizontal ) |
3121 |
TQPainter p( widget ); |
| 3094 |
p.drawLine( wr.width()-1, 0, wr.width()-1, wr.height()-1 ); |
3122 |
renderGradient(&p, wr, toolbar->colorGroup().background(),toolbar->colorGroup().background(), |
| 3095 |
else |
3123 |
toolbar->orientation() == TQt::Vertical);/*, |
| 3096 |
p.drawLine( 0, wr.height()-1, wr.width()-1, wr.height()-1 ); |
3124 |
wr.x(), wr.y(), tr.width() - 2, tr.height() - 2);*/ |
| 3097 |
return true; |
3125 |
//FIXME: check this code later |
| 3098 |
} |
3126 |
p.setPen( toolbar->colorGroup().dark() ); |
| 3099 |
} |
3127 |
if ( toolbar->orientation() == TQt::Horizontal ) |
|
|
3128 |
p.drawLine( wr.width()-1, 0, wr.width()-1, wr.height()-1 ); |
| 3129 |
else |
| 3130 |
p.drawLine( 0, wr.height()-1, wr.width()-1, wr.height()-1 ); |
| 3131 |
return true; |
| 3132 |
} |
| 3133 |
} |
| 3134 |
} |
| 3100 |
return false; |
3135 |
return false; |
| 3101 |
} |
3136 |
} |
| 3102 |
|
3137 |
|
|
Lines 3331-3337
Link Here
|
| 3331 |
|
3366 |
|
| 3332 |
} |
3367 |
} |
| 3333 |
|
3368 |
|
| 3334 |
TQRect MandrivaStyle::subRect(SubRect r, const TQWidget *widget) const |
3369 |
TQRect MandrivaStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const |
| 3335 |
{ |
3370 |
{ |
| 3336 |
switch ( r ) |
3371 |
switch ( r ) |
| 3337 |
{ |
3372 |
{ |
|
Lines 3353-3362
Link Here
|
| 3353 |
} |
3388 |
} |
| 3354 |
case SR_ComboBoxFocusRect: |
3389 |
case SR_ComboBoxFocusRect: |
| 3355 |
{ |
3390 |
{ |
| 3356 |
return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); |
3391 |
return querySubControlMetrics( CC_ComboBox, ceData, elementFlags , SC_ComboBoxEditField, TQStyleOption::Default, widget ); |
| 3357 |
} |
3392 |
} |
| 3358 |
default: |
3393 |
default: |
| 3359 |
return TDEStyle::subRect( r, widget ); |
3394 |
return TDEStyle::subRect( r, ceData, elementFlags, widget ); |
| 3360 |
} |
3395 |
} |
| 3361 |
} |
3396 |
} |
| 3362 |
|
3397 |
|