Diffstat (limited to 'library/qpedecoration_qws.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | library/qpedecoration_qws.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 7842ebd..8b02de6 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp | |||
@@ -443,193 +443,193 @@ void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowD | |||
443 | p->drawImage(x+1, y+1, *img); | 443 | p->drawImage(x+1, y+1, *img); |
444 | } | 444 | } |
445 | } | 445 | } |
446 | 446 | ||
447 | QRegion WindowDecorationInterface::mask( const WindowData *wd ) const | 447 | QRegion WindowDecorationInterface::mask( const WindowData *wd ) const |
448 | { | 448 | { |
449 | int th = metric(TitleHeight,wd); | 449 | int th = metric(TitleHeight,wd); |
450 | QRect rect( wd->rect ); | 450 | QRect rect( wd->rect ); |
451 | QRect r(rect.left() - metric(LeftBorder,wd), | 451 | QRect r(rect.left() - metric(LeftBorder,wd), |
452 | rect.top() - th - metric(TopBorder,wd), | 452 | rect.top() - th - metric(TopBorder,wd), |
453 | rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), | 453 | rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), |
454 | rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); | 454 | rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); |
455 | return QRegion(r) - rect; | 455 | return QRegion(r) - rect; |
456 | } | 456 | } |
457 | 457 | ||
458 | class DefaultWindowDecoration : public WindowDecorationInterface | 458 | class DefaultWindowDecoration : public WindowDecorationInterface |
459 | { | 459 | { |
460 | public: | 460 | public: |
461 | DefaultWindowDecoration(){} | 461 | DefaultWindowDecoration(){} |
462 | QString name() const { | 462 | QString name() const { |
463 | return qApp->translate("WindowDecoration", "Default", | 463 | return qApp->translate("WindowDecoration", "Default", |
464 | "List box text for default window decoration"); | 464 | "List box text for default window decoration"); |
465 | } | 465 | } |
466 | QPixmap icon() const { | 466 | QPixmap icon() const { |
467 | return QPixmap(); | 467 | return QPixmap(); |
468 | } | 468 | } |
469 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 469 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { |
470 | *iface = 0; | 470 | *iface = 0; |
471 | if ( uuid == IID_QUnknown ) | 471 | if ( uuid == IID_QUnknown ) |
472 | *iface = this; | 472 | *iface = this; |
473 | else if ( uuid == IID_WindowDecoration ) | 473 | else if ( uuid == IID_WindowDecoration ) |
474 | *iface = this; | 474 | *iface = this; |
475 | else | 475 | else |
476 | return QS_FALSE; | 476 | return QS_FALSE; |
477 | 477 | ||
478 | if ( *iface ) | 478 | if ( *iface ) |
479 | (*iface)->addRef(); | 479 | (*iface)->addRef(); |
480 | return QS_OK; | 480 | return QS_OK; |
481 | } | 481 | } |
482 | Q_REFCOUNT | 482 | Q_REFCOUNT |
483 | 483 | ||
484 | }; | 484 | }; |
485 | 485 | ||
486 | static WindowDecorationInterface *wdiface = 0; | 486 | static WindowDecorationInterface *wdiface = 0; |
487 | static QLibrary* wdlib = 0; | 487 | static QLibrary* wdlib = 0; |
488 | static QString libname; | 488 | static QString libname; |
489 | 489 | ||
490 | //=========================================================================== | 490 | //=========================================================================== |
491 | bool QPEDecoration::helpExists() const | 491 | bool QPEDecoration::helpExists() const |
492 | { | 492 | { |
493 | if ( helpFile.isNull() ) { | 493 | if ( helpFile.isNull() ) { |
494 | QStringList helpPath = Global::helpPath(); | 494 | QStringList helpPath = Global::helpPath(); |
495 | QString hf = QString(qApp->argv()[0]) + ".html"; | 495 | QString hf = QString(qApp->argv()[0]) + ".html"; |
496 | bool he = FALSE; | 496 | bool he = FALSE; |
497 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !he; ++it) | 497 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !he; ++it) |
498 | he = QFile::exists( *it + "/" + hf ); | 498 | he = QFile::exists( *it + "/" + hf ); |
499 | ((QPEDecoration*)this)->helpFile = hf; | 499 | ((QPEDecoration*)this)->helpFile = hf; |
500 | ((QPEDecoration*)this)->helpexists = he; | 500 | ((QPEDecoration*)this)->helpexists = he; |
501 | return he; | 501 | return he; |
502 | } | 502 | } |
503 | return helpexists; | 503 | return helpexists; |
504 | } | 504 | } |
505 | 505 | ||
506 | QPEDecoration::QPEDecoration() | 506 | QPEDecoration::QPEDecoration() |
507 | : QWSDefaultDecoration() | 507 | : QWSDefaultDecoration() |
508 | { | 508 | { |
509 | if ( wdlib ) { | 509 | if ( wdlib ) { |
510 | delete wdlib; | 510 | delete wdlib; |
511 | wdlib = 0; | 511 | wdlib = 0; |
512 | } else { | 512 | } else { |
513 | delete wdiface; | 513 | delete wdiface; |
514 | } | 514 | } |
515 | wdiface = new DefaultWindowDecoration; | 515 | wdiface = new DefaultWindowDecoration; |
516 | 516 | ||
517 | helpexists = FALSE; // We don't know (flagged by helpFile being null) | 517 | helpexists = FALSE; // We don't know (flagged by helpFile being null) |
518 | qpeManager = new QPEManager( this ); | 518 | qpeManager = new QPEManager( this ); |
519 | imageOk = Resource::loadImage( "OKButton" ); | 519 | imageOk = Resource::loadImage( "OKButton" ); |
520 | imageClose = Resource::loadImage( "CloseButton" ); | 520 | imageClose = Resource::loadImage( "CloseButton" ); |
521 | imageHelp = Resource::loadImage( "HelpButton" ); | 521 | imageHelp = Resource::loadImage( "HelpButton" ); |
522 | } | 522 | } |
523 | 523 | ||
524 | QPEDecoration::QPEDecoration( const QString &plugin ) | 524 | QPEDecoration::QPEDecoration( const QString &plugin ) |
525 | : QWSDefaultDecoration() | 525 | : QWSDefaultDecoration() |
526 | { | 526 | { |
527 | libname = plugin; | 527 | libname = plugin; |
528 | 528 | ||
529 | if ( wdlib ) { | 529 | if ( wdlib ) { |
530 | wdiface->release(); | 530 | wdiface->release(); |
531 | wdlib->unload(); | 531 | wdlib->unload(); |
532 | delete wdlib; | 532 | delete wdlib; |
533 | wdlib = 0; | 533 | wdlib = 0; |
534 | } else { | 534 | } else { |
535 | delete wdiface; | 535 | delete wdiface; |
536 | } | 536 | } |
537 | 537 | ||
538 | WindowDecorationInterface *iface = 0; | 538 | WindowDecorationInterface *iface = 0; |
539 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; | 539 | QString path = QPEApplication::qpeDir() + "plugins/decorations/"; |
540 | 540 | ||
541 | #ifdef Q_OS_MACX | 541 | #ifdef Q_OS_MACX |
542 | if ( plugin.find( ".dylib" ) > 0 ) { | 542 | if ( plugin.find( ".dylib" ) > 0 ) { |
543 | #else | 543 | #else |
544 | if ( plugin.find( ".so" ) > 0 ) { | 544 | if ( plugin.find( ".so" ) > 0 ) { |
545 | #endif | 545 | #endif |
546 | // full library name supplied | 546 | // full library name supplied |
547 | path += plugin; | 547 | path += plugin; |
548 | } else { | 548 | } else { |
549 | #ifdef Q_OS_MACX | 549 | #ifdef Q_OS_MACX |
550 | path += "lib" + plugin.lower() + ".dylib"; // compatibility | 550 | path += "lib" + plugin.lower() + ".dylib"; // compatibility |
551 | #else | 551 | #else |
552 | path += "lib" + plugin.lower() + ".so"; // compatibility | 552 | path += "lib" + plugin.lower() + ".so"; // compatibility |
553 | #endif | 553 | #endif |
554 | } | 554 | } |
555 | 555 | ||
556 | QLibrary *lib = new QLibrary( path ); | 556 | QLibrary *lib = new QLibrary( path ); |
557 | if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 557 | if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
558 | wdiface = iface; | 558 | wdiface = iface; |
559 | wdlib = lib; | 559 | wdlib = lib; |
560 | } else { | 560 | } else { |
561 | delete lib; | 561 | delete lib; |
562 | wdiface = new DefaultWindowDecoration; | 562 | wdiface = new DefaultWindowDecoration; |
563 | } | 563 | } |
564 | 564 | ||
565 | 565 | ||
566 | 566 | ||
567 | helpexists = FALSE; // We don't know (flagged by helpFile being null) | 567 | helpexists = FALSE; // We don't know (flagged by helpFile being null) |
568 | qpeManager = new QPEManager( this ); | 568 | qpeManager = new QPEManager( this ); |
569 | } | 569 | } |
570 | 570 | ||
571 | QPEDecoration::~QPEDecoration() | 571 | QPEDecoration::~QPEDecoration() |
572 | { | 572 | { |
573 | delete qpeManager; | 573 | delete qpeManager; |
574 | } | 574 | } |
575 | 575 | ||
576 | const char **QPEDecoration::menuPixmap() | 576 | const char **QPEDecoration::menuPixmap() |
577 | { | 577 | { |
578 | return (const char **)0; | 578 | return (const char **)0; |
579 | } | 579 | } |
580 | 580 | ||
581 | const char **QPEDecoration::closePixmap() | 581 | const char **QPEDecoration::closePixmap() |
582 | { | 582 | { |
583 | return (const char **)qpe_close_xpm; | 583 | return (const char **)qpe_close_xpm; |
584 | } | 584 | } |
585 | 585 | ||
586 | const char **QPEDecoration::minimizePixmap() | 586 | const char **QPEDecoration::minimizePixmap() |
587 | { | 587 | { |
588 | return (const char **)qpe_accept_xpm; | 588 | return (const char **)qpe_accept_xpm; |
589 | } | 589 | } |
590 | 590 | ||
591 | const char **QPEDecoration::maximizePixmap() | 591 | const char **QPEDecoration::maximizePixmap() |
592 | { | 592 | { |
593 | return (const char **)0; | 593 | return (const char **)0; |
594 | } | 594 | } |
595 | 595 | ||
596 | const char **QPEDecoration::normalizePixmap() | 596 | const char **QPEDecoration::normalizePixmap() |
597 | { | 597 | { |
598 | return (const char **)0; | 598 | return (const char **)0; |
599 | } | 599 | } |
600 | 600 | ||
601 | int QPEDecoration::getTitleHeight( const QWidget *w ) | 601 | int QPEDecoration::getTitleHeight( const QWidget *w ) |
602 | { | 602 | { |
603 | WindowDecorationInterface::WindowData wd; | 603 | WindowDecorationInterface::WindowData wd; |
604 | windowData( w, wd ); | 604 | windowData( w, wd ); |
605 | return wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); | 605 | return wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); |
606 | } | 606 | } |
607 | 607 | ||
608 | /* | 608 | /* |
609 | If rect is empty, no frame is added. (a hack, really) | 609 | If rect is empty, no frame is added. (a hack, really) |
610 | */ | 610 | */ |
611 | QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecoration::Region type) | 611 | QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecoration::Region type) |
612 | { | 612 | { |
613 | qpeManager->updateActive(); | 613 | qpeManager->updateActive(); |
614 | 614 | ||
615 | WindowDecorationInterface::WindowData wd; | 615 | WindowDecorationInterface::WindowData wd; |
616 | windowData( widget, wd ); | 616 | windowData( widget, wd ); |
617 | wd.rect = rect; | 617 | wd.rect = rect; |
618 | 618 | ||
619 | int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); | 619 | int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); |
620 | int okWidth = wdiface->metric(WindowDecorationInterface::OKWidth,&wd); | 620 | int okWidth = wdiface->metric(WindowDecorationInterface::OKWidth,&wd); |
621 | int closeWidth = wdiface->metric(WindowDecorationInterface::CloseWidth,&wd); | 621 | int closeWidth = wdiface->metric(WindowDecorationInterface::CloseWidth,&wd); |
622 | int helpWidth = wdiface->metric(WindowDecorationInterface::HelpWidth,&wd); | 622 | int helpWidth = wdiface->metric(WindowDecorationInterface::HelpWidth,&wd); |
623 | int grab = wdiface->metric(WindowDecorationInterface::CornerGrabSize,&wd); | 623 | int grab = wdiface->metric(WindowDecorationInterface::CornerGrabSize,&wd); |
624 | 624 | ||
625 | QRegion region; | 625 | QRegion region; |
626 | 626 | ||
627 | switch ((int)type) { | 627 | switch ((int)type) { |
628 | case Menu: | 628 | case Menu: |
629 | break; | 629 | break; |
630 | case Maximize: | 630 | case Maximize: |
631 | if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { | 631 | if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { |
632 | int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); | 632 | int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); |
633 | int left = rect.right() - maximizeWidth - closeWidth; | 633 | int left = rect.right() - maximizeWidth - closeWidth; |
634 | if ( ((DecorHackWidget *)widget)->needsOk() ) | 634 | if ( ((DecorHackWidget *)widget)->needsOk() ) |
635 | left -= okWidth; | 635 | left -= okWidth; |