From 4377e247e135967eb7b4c89906415abecb283bd3 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 21 May 2010 14:32:05 +0200 Subject: Fixing incorrect addition of public API symbols. This commit is related to 49a6f4a7d87def3816cebf0115ddadf43e9c4d01 and contains all the files that were modified. The previous commit contained only the newly added file. Reviewed-by: jbache --- src/gui/kernel/qt_cocoa_helpers_mac_p.h | 5 + src/gui/styles/qmacstyle_mac.h | 11 -- src/gui/styles/qmacstyle_mac.mm | 181 ++++++-------------------------- src/gui/styles/qmacstyle_mac_p.h | 22 +--- src/gui/styles/qmacstylepixmaps_mac_p.h | 5 + src/gui/styles/styles.pri | 3 +- src/gui/widgets/qpushbutton.cpp | 9 +- 7 files changed, 55 insertions(+), 181 deletions(-) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 5db121a..44fb4f0 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -73,6 +73,9 @@ ** ****************************************************************************/ +#ifndef QT_COCOA_HELPERS_MAC_P_H +#define QT_COCOA_HELPERS_MAC_P_H + // // W A R N I N G // ------------- @@ -216,3 +219,5 @@ bool qt_cocoaPostMessage(id target, SEL selector); void qt_mac_post_retranslateAppMenu(); QT_END_NAMESPACE + +#endif // QT_COCOA_HELPERS_MAC_P_H diff --git a/src/gui/styles/qmacstyle_mac.h b/src/gui/styles/qmacstyle_mac.h index e594793..bcebb1d 100644 --- a/src/gui/styles/qmacstyle_mac.h +++ b/src/gui/styles/qmacstyle_mac.h @@ -120,17 +120,6 @@ public: bool event(QEvent *e); - // Ideally these wouldn't exist, but since they already exist we need some accessors. - static const int PushButtonLeftOffset; - static const int PushButtonTopOffset; - static const int PushButtonRightOffset; - static const int PushButtonBottomOffset; - static const int MiniButtonH; - static const int SmallButtonH; - static const int BevelButtonW; - static const int BevelButtonH; - static const int PushButtonContentPadding; - protected Q_SLOTS: QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, const QWidget *widget = 0) const; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e82e638..9cffc1e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -101,22 +101,21 @@ #include #include #include +#include "qmacstyle_mac_p.h" QT_BEGIN_NAMESPACE -extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp - // The following constants are used for adjusting the size // of push buttons so that they are drawn inside their bounds. -const int QMacStyle::PushButtonLeftOffset = 6; -const int QMacStyle::PushButtonTopOffset = 4; -const int QMacStyle::PushButtonRightOffset = 12; -const int QMacStyle::PushButtonBottomOffset = 12; -const int QMacStyle::MiniButtonH = 26; -const int QMacStyle::SmallButtonH = 30; -const int QMacStyle::BevelButtonW = 50; -const int QMacStyle::BevelButtonH = 22; -const int QMacStyle::PushButtonContentPadding = 6; +const int QMacStylePrivate::PushButtonLeftOffset = 6; +const int QMacStylePrivate::PushButtonTopOffset = 4; +const int QMacStylePrivate::PushButtonRightOffset = 12; +const int QMacStylePrivate::PushButtonBottomOffset = 12; +const int QMacStylePrivate::MiniButtonH = 26; +const int QMacStylePrivate::SmallButtonH = 30; +const int QMacStylePrivate::BevelButtonW = 50; +const int QMacStylePrivate::BevelButtonH = 22; +const int QMacStylePrivate::PushButtonContentPadding = 6; // These colors specify the titlebar gradient colors on // Leopard. Ideally we should get them from the system. @@ -134,25 +133,14 @@ static const QColor mainWindowGradientEnd(200, 200, 200); static const int DisclosureOffset = 4; -#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5) -enum { - kThemePushButtonTextured = 31, - kThemePushButtonTexturedSmall = 32, - kThemePushButtonTexturedMini = 33 -}; - -/* Search fields */ -enum { - kHIThemeFrameTextFieldRound = 1000, - kHIThemeFrameTextFieldRoundSmall = 1001, - kHIThemeFrameTextFieldRoundMini = 1002 -}; -#endif - // Resolve these at run-time, since the functions was moved in Leopard. typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; +static int closeButtonSize = 12; + +extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp + static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast || shape == QTabBar::TriangularEast @@ -160,8 +148,6 @@ static bool isVerticalTabs(const QTabBar::Shape shape) { || shape == QTabBar::TriangularWest); } -static int closeButtonSize = 12; - void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) { // draw background circle @@ -380,32 +366,6 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBaseV2 *tbb, const QWidget p->drawLine(tabRect.x(), height - 1, width, height - 1); } -/* - AHIG: - Apple Human Interface Guidelines - http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/ - - Builder: - Apple Interface Builder v. 3.1.1 -*/ - -// this works as long as we have at most 16 different control types -#define CT1(c) CT2(c, c) -#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2)) - -enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2, - QAquaSizeUnknown = -1 }; - -#define SIZE(large, small, mini) \ - (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini)) - -// same as return SIZE(...) but optimized -#define return_SIZE(large, small, mini) \ - do { \ - static const int sizes[] = { (large), (small), (mini) }; \ - return sizes[controlSize]; \ - } while (0) - static int getControlSize(const QStyleOption *option, const QWidget *widget) { if (option) { @@ -483,80 +443,9 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) return ttd; } -class QMacStylePrivate : public QObject -{ - Q_OBJECT - -public: - QMacStylePrivate(QMacStyle *style); - - // Stuff from QAquaAnimate: - bool addWidget(QWidget *); - void removeWidget(QWidget *); - - enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }; - bool animatable(Animates, const QWidget *) const; - void stopAnimate(Animates, QWidget *); - void startAnimate(Animates, QWidget *); - static ThemeDrawState getDrawState(QStyle::State flags); - QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, - QStyle::ContentsType ct = QStyle::CT_CustomBase, - QSize szHint=QSize(-1, -1), QSize *insz = 0) const; - void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider, - HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe); - bool doAnimate(Animates); - inline int animateSpeed(Animates) const { return 33; } - - // Utility functions - void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi, - QPainter *p, const QStyleOption *opt) const; - - QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const; - - HIRect pushButtonContentBounds(const QStyleOptionButton *btn, - const HIThemeButtonDrawInfo *bdi) const; - - void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi, - const QWidget *widget, const ThemeDrawState &tds); - - static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind); - - static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi); - - static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p); - static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder, - const HIThemeButtonDrawInfo &bdi, QPainter *p); - bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, - ThemeButtonKind buttonKindToCheck) const; - void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget, - const ThemeDrawState tds, - HIThemeButtonDrawInfo *bdi) const; - QPixmap generateBackgroundPattern() const; -protected: - bool eventFilter(QObject *, QEvent *); - void timerEvent(QTimerEvent *); - -private slots: - void startAnimationTimer(); - -public: - QPointer defaultButton; //default push buttons - int timerID; - QList > progressBars; //existing progress bars that need animation - - struct ButtonState { - int frame; - enum { ButtonDark, ButtonLight } dir; - } buttonState; - UInt8 progressFrame; - QPointer focusWidget; - CFAbsoluteTime defaultButtonStart; - QMacStyle *q; - bool mouseDown; -}; - QT_BEGIN_INCLUDE_NAMESPACE -#include "qmacstyle_mac.moc" +#include "moc_qmacstyle_mac.cpp" +#include "moc_qmacstyle_mac_p.cpp" QT_END_INCLUDE_NAMESPACE /***************************************************************************** @@ -1057,10 +946,10 @@ HIRect QMacStylePrivate::pushButtonContentBounds(const QStyleOptionButton *btn, // Adjust the bounds to correct for // carbon not calculating the content bounds fully correct if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){ - outerBounds.origin.y += QMacStyle::PushButtonTopOffset; - outerBounds.size.height -= QMacStyle::PushButtonBottomOffset; + outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; + outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset; } else if (bdi->kind == kThemePushButtonMini) { - outerBounds.origin.y += QMacStyle::PushButtonTopOffset; + outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; } HIRect contentBounds; @@ -1076,7 +965,7 @@ QSize QMacStylePrivate::pushButtonSizeFromContents(const QStyleOptionButton *btn { QSize csz(0, 0); QSize iconSize = btn->icon.isNull() ? QSize(0, 0) - : (btn->iconSize + QSize(QMacStyle::PushButtonContentPadding, 0)); + : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0)); QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1) : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text); csz.setWidth(iconSize.width() + textRect.width() @@ -1151,12 +1040,12 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, // Choose the button kind that closest match the button rect, but at the // same time displays the button contents without clipping. bdi->kind = kThemeBevelButton; - if (btn->rect.width() >= QMacStyle::BevelButtonW && btn->rect.height() >= QMacStyle::BevelButtonH){ + if (btn->rect.width() >= QMacStylePrivate::BevelButtonW && btn->rect.height() >= QMacStylePrivate::BevelButtonH){ if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) { - if (btn->rect.height() <= QMacStyle::MiniButtonH){ + if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){ if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini)) bdi->kind = kThemePushButtonMini; - } else if (btn->rect.height() <= QMacStyle::SmallButtonH){ + } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){ if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall)) bdi->kind = kThemePushButtonSmall; } else if (contentFitsInPushButton(btn, bdi, kThemePushButton)) { @@ -3497,21 +3386,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // the focus 'shadow' will be inside. HIRect newRect = qt_hirectForQRect(btn->rect); if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) { - newRect.origin.x += PushButtonLeftOffset; - newRect.origin.y += PushButtonTopOffset; - newRect.size.width -= PushButtonRightOffset; - newRect.size.height -= PushButtonBottomOffset; + newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset; + newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; + newRect.size.width -= QMacStylePrivate::PushButtonRightOffset; + newRect.size.height -= QMacStylePrivate::PushButtonBottomOffset; } else if (bdi.kind == kThemePushButtonMini) { - newRect.origin.x += PushButtonLeftOffset - 2; - newRect.origin.y += PushButtonTopOffset; - newRect.size.width -= PushButtonRightOffset - 4; + newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset - 2; + newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; + newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4; } HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); if (btn->features & QStyleOptionButton::HasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; - HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset, + HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, ir.height() / 2 - 4, mbi, ir.height() / 2); bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; if (drawColorless && tds == kThemeStateInactive) @@ -3605,14 +3494,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (btn->state & State_On) state = QIcon::On; QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); - contentW += pixmap.width() + PushButtonContentPadding; + contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding; int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2; int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2; QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height()); QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect); proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); int newOffset = iconDestRect.x() + iconDestRect.width() - + PushButtonContentPadding - textRect.x(); + + QMacStylePrivate::PushButtonContentPadding - textRect.x(); textRect.adjust(newOffset, 0, newOffset, 0); } // Draw the text: @@ -5708,8 +5597,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // By default, we fit the contents inside a normal rounded push button. // Do this by add enough space around the contents so that rounded // borders (including highlighting when active) will show. - sz.rwidth() += PushButtonLeftOffset + PushButtonRightOffset + 12; - sz.rheight() += PushButtonTopOffset + PushButtonBottomOffset; + sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; + sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset; break; case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast(opt)) { diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h index 7f8994e..5a0ba4c 100644 --- a/src/gui/styles/qmacstyle_mac_p.h +++ b/src/gui/styles/qmacstyle_mac_p.h @@ -107,19 +107,7 @@ // We mean it. // -// These colors specify the titlebar gradient colors on -// Leopard. Ideally we should get them from the system. -static const QColor titlebarGradientActiveBegin(220, 220, 220); -static const QColor titlebarGradientActiveEnd(151, 151, 151); -static const QColor titlebarSeparatorLineActive(111, 111, 111); -static const QColor titlebarGradientInactiveBegin(241, 241, 241); -static const QColor titlebarGradientInactiveEnd(207, 207, 207); -static const QColor titlebarSeparatorLineInactive(131, 131, 131); - -// Gradient colors used for the dock widget title bar and -// non-unifed tool bar bacground. -static const QColor mainWindowGradientBegin(240, 240, 240); -static const QColor mainWindowGradientEnd(200, 200, 200); +QT_BEGIN_NAMESPACE #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5) enum { @@ -136,12 +124,6 @@ enum { }; #endif -// Resolve these at run-time, since the functions was moved in Leopard. -typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); -static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; - -static int closeButtonSize = 12; - /* AHIG: Apple Human Interface Guidelines @@ -252,4 +234,6 @@ public: bool mouseDown; }; +QT_END_NAMESPACE + #endif // QMACSTYLE_MAC_P_H diff --git a/src/gui/styles/qmacstylepixmaps_mac_p.h b/src/gui/styles/qmacstylepixmaps_mac_p.h index 6a5e0e6..58038c3 100644 --- a/src/gui/styles/qmacstylepixmaps_mac_p.h +++ b/src/gui/styles/qmacstylepixmaps_mac_p.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef QMACSTYLEPIXMAPS_MAC_P_H +#define QMACSTYLEPIXMAPS_MAC_P_H + // // W A R N I N G // ------------- @@ -65,3 +68,5 @@ static const char * const qt_mac_toolbar_ext[]={ "aab###bb###baa", "ab###bb###baaa", ".###..###.aaaa"}; + +#endif // QMACSTYLEPIXMAPS_MAC_P_H diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index f920032..0a96272 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -46,7 +46,8 @@ x11{ contains( styles, mac ) { HEADERS += \ styles/qmacstyle_mac.h \ - styles/qmacstylepixmaps_mac_p.h + styles/qmacstylepixmaps_mac_p.h \ + styles/qmacstyle_mac_p.h OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm !contains( styles, windows ) { diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 7b8c0db..d73cf6f 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -68,6 +68,7 @@ #include "private/qmenu_p.h" #include "private/qpushbutton_p.h" +#include "private/qmacstyle_mac_p.h" QT_BEGIN_NAMESPACE @@ -705,10 +706,10 @@ bool QPushButton::hitButton(const QPoint &pos) const bool QPushButtonPrivate::hitButton(const QPoint &pos) { Q_Q(QPushButton); - QRect roundedRect(q->rect().left() + QMacStyle::PushButtonLeftOffset, - q->rect().top() + QMacStyle::PushButtonContentPadding, - q->rect().width() - QMacStyle::PushButtonRightOffset, - q->rect().height() - QMacStyle::PushButtonBottomOffset); + QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, + q->rect().top() + QMacStylePrivate::PushButtonContentPadding, + q->rect().width() - QMacStylePrivate::PushButtonRightOffset, + q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); return roundedRect.contains(pos); } #endif // Q_WS_MAC -- cgit v0.12