You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1282 lines
43 KiB
1282 lines
43 KiB
/****************************************************************************
|
|
**
|
|
** Definition of TQStyle class
|
|
**
|
|
** Created : 980616
|
|
**
|
|
** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
|
|
**
|
|
** This file is part of the kernel module of the TQt GUI Toolkit.
|
|
**
|
|
** This file may be used under the terms of the GNU General
|
|
** Public License versions 2.0 or 3.0 as published by the Free
|
|
** Software Foundation and appearing in the files LICENSE.GPL2
|
|
** and LICENSE.GPL3 included in the packaging of this file.
|
|
** Alternatively you may (at your option) use any later version
|
|
** of the GNU General Public License if such license has been
|
|
** publicly approved by Trolltech ASA (or its successors, if any)
|
|
** and the KDE Free TQt Foundation.
|
|
**
|
|
** Please review the following information to ensure GNU General
|
|
** Public Licensing requirements will be met:
|
|
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
|
|
** If you are unsure which license is appropriate for your use, please
|
|
** review the following information:
|
|
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
|
|
** or contact the sales department at sales@trolltech.com.
|
|
**
|
|
** This file may be used under the terms of the Q Public License as
|
|
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
|
|
** included in the packaging of this file. Licensees holding valid TQt
|
|
** Commercial licenses may use this file in accordance with the TQt
|
|
** Commercial License Agreement provided with the Software.
|
|
**
|
|
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
|
|
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
|
|
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
|
|
** herein.
|
|
**
|
|
**********************************************************************/
|
|
#ifndef TQSTYLE_H
|
|
#define TQSTYLE_H
|
|
|
|
#include "tqtglobaldefines.h"
|
|
|
|
#ifndef TQT_H
|
|
#include "tqobject.h"
|
|
#endif // TQT_H
|
|
|
|
#ifdef USE_QT4
|
|
|
|
#include "tqpainter.h"
|
|
#include "tqpalette.h"
|
|
#include "tqwidget.h"
|
|
|
|
#include <Qt/qstyle.h>
|
|
#include <Qt/qstyleoption.h>
|
|
|
|
#include "tqtenuminheritance.h"
|
|
|
|
#endif // USE_QT4
|
|
|
|
#ifdef USE_QT4
|
|
|
|
// HACK
|
|
#define tqdrawPrimitiveBase tqdrawPrimitive
|
|
|
|
// Remap changed values
|
|
#define CT_DockWindow CT_Q3DockWindow
|
|
#define CT_Header CT_Q3Header
|
|
#define CT_PopupMenuItem CT_MenuItem
|
|
|
|
// #define PE_SizeGrip CE_SizeGrip
|
|
// #define PE_Splitter CE_Splitter
|
|
// #define PE_RubberBand CE_RubberBand
|
|
// #define PE_HeaderSection CE_HeaderSection
|
|
#define PE_HeaderArrow PE_IndicatorHeaderArrow
|
|
#define PE_FocusRect PE_FrameFocusRect
|
|
#define PE_DockWindowResizeHandle PE_IndicatorDockWidgetResizeHandle
|
|
#define PE_PanelGroupBox PE_FrameGroupBox
|
|
#define PE_DockWindowHandle PE_IndicatorToolBarHandle
|
|
#define PE_WindowFrame PE_FrameWindow
|
|
#define PE_PanelTabWidget PE_FrameTabWidget
|
|
#define PE_Panel PE_Frame
|
|
#define PE_ButtonTool PE_PanelButtonTool
|
|
#define PE_ButtonDropDown PE_IndicatorButtonDropDown
|
|
#define PE_SpinWidgetPlus PE_IndicatorSpinPlus
|
|
#define PE_SpinWidgetMinus PE_IndicatorSpinMinus
|
|
#define PE_SpinWidgetUp PE_IndicatorSpinUp
|
|
#define PE_SpinWidgetDown PE_IndicatorSpinDown
|
|
#define PE_ButtonBevel PE_PanelButtonBevel
|
|
#define PE_PanelDockWindow PE_FrameDockWindow
|
|
#define PE_PanelPopup PE_FrameMenu
|
|
#define PE_FrameDockWindow PE_FrameDockWidget
|
|
#define PE_CheckMark PE_IndicatorMenuCheckMark
|
|
#define PE_ButtonDefault PE_FrameDefaultButton
|
|
#define PE_ArrowUp PE_IndicatorArrowUp
|
|
#define PE_ArrowDown PE_IndicatorArrowDown
|
|
#define PE_ArrowRight PE_IndicatorArrowRight
|
|
#define PE_ArrowLeft PE_IndicatorArrowLeft
|
|
// #define PE_ScrollBarSubLine CE_ScrollBarSubLine
|
|
// #define PE_ScrollBarAddLine CE_ScrollBarAddLine
|
|
// #define PE_ScrollBarSubPage CE_ScrollBarSubPage
|
|
// #define PE_ScrollBarAddPage CE_ScrollBarAddPage
|
|
// #define PE_ScrollBarFirst CE_ScrollBarFirst
|
|
// #define PE_ScrollBarLast CE_ScrollBarLast
|
|
// #define PE_ScrollBarSlider CE_ScrollBarSlider
|
|
#define PE_Separator PE_Q3Separator
|
|
#define PE_Indicator PE_IndicatorCheckBox
|
|
#define PE_TabBarBase PE_FrameTabBarBase
|
|
#define PE_StatusBarSection PE_FrameStatusBar
|
|
#define PE_ProgressBarChunk PE_IndicatorProgressChunk
|
|
#define PE_ButtonCommand PE_PanelButtonCommand
|
|
#define PE_DockWindowSeparator PE_Q3DockWindowSeparator
|
|
#define PE_CheckListController PE_Q3CheckListController
|
|
#define PE_CheckListIndicator PE_Q3CheckListIndicator
|
|
#define PE_CheckListExclusiveIndicator PE_Q3CheckListExclusiveIndicator
|
|
|
|
class TQPopupMenu;
|
|
class TQStylePrivate;
|
|
class TQMenuItem;
|
|
class TQTab;
|
|
class TQListViewItem;
|
|
class TQCheckListItem;
|
|
|
|
// !!! [WARNING] !!!
|
|
// THIS ENTIRE CLASS IS PRETTY MUCH COMPLETELY BROKEN
|
|
// IT IS NOT INTERCHANGABLE WITH QSTYLEOPTION BY ANY STRETCH OF THE IMAGINATION
|
|
// !!! [BEWARE] !!!
|
|
// !!! [FIXME] !!!
|
|
|
|
class TQStyleOption : public QStyleOption, virtual public TQt {
|
|
public:
|
|
enum StyleOptionDefault { Default };
|
|
|
|
TQStyleOption(StyleOptionDefault=Default) : QStyleOption(), def(TRUE) {}
|
|
TQStyleOption(const QStyleOption &qso);
|
|
|
|
// TQStyleOption(int in1) : QStyleOption( in1 ) {}
|
|
// TQStyleOption(int in1, int in2) : QStyleOption( in1, in2 ) {}
|
|
// TQStyleOption(int x, int y, int w, int h) : QStyleOption() { TQ_UNUSED(x); TQ_UNUSED(y); TQ_UNUSED(w); TQ_UNUSED(h);} // [FIXME] What are x, y, w, and h and what do they do? They are likely the visual bounding rectangle for the style element...origin at (x,y) with width w and height h
|
|
|
|
TQStyleOption(int in1) : QStyleOption(), def(FALSE), i1(in1) {}
|
|
TQStyleOption(int in1, int in2) : QStyleOption(), def(FALSE), i1(in1), i2(in2) {}
|
|
TQStyleOption(int in1, int in2, int in3, int in4) : QStyleOption(), def(FALSE), i1(in1), i2(in2), i3(in3), i4(in4) {}
|
|
|
|
TQStyleOption(TQMenuItem* m) : QStyleOption(), def(FALSE), mi(m) {}
|
|
TQStyleOption(TQMenuItem* m, int in1) : QStyleOption(), def(FALSE), mi(m), i1(in1) {}
|
|
TQStyleOption(TQMenuItem* m, int in1, int in2) : QStyleOption(), def(FALSE), mi(m), i1(in1), i2(in2) {}
|
|
TQStyleOption(const TQColor& c) : QStyleOption(), def(FALSE), cl(&c) {}
|
|
TQStyleOption(TQTab* t) : QStyleOption(), def(FALSE), tb(t) {}
|
|
TQStyleOption(TQListViewItem* i) : QStyleOption(), def(FALSE), li(i) {}
|
|
TQStyleOption(TQCheckListItem* i) : QStyleOption(), def(FALSE), cli(i) {}
|
|
// TQStyleOption(TQt::ArrowType a) : QStyleOption( a ) {}
|
|
// TQStyleOption(const TQRect& r) : QStyleOption( r ) {}
|
|
TQStyleOption(TQWidget *w) : QStyleOption(), def(FALSE), p1((void*)w) {}
|
|
|
|
// [FIXME] These are NOT YET PORTED to Qt4!!!
|
|
bool isDefault() const { return def; }
|
|
int day() const { return i1; }
|
|
int lineWidth() const { return i1; }
|
|
int midLineWidth() const { return i2; }
|
|
int frameShape() const { return i3; }
|
|
int frameShadow() const { return i4; }
|
|
int headerSection() const { return i1; }
|
|
TQMenuItem* menuItem() const { return mi; }
|
|
int maxIconWidth() const { return i1; }
|
|
int tabWidth() const { return i2; }
|
|
const TQColor& color() const { return *cl; }
|
|
TQTab* tab() const { return tb; }
|
|
TQCheckListItem* checkListItem() const { return cli; }
|
|
TQListViewItem* listViewItem() const { return li; }
|
|
TQt::ArrowType arrowType() const { return (TQt::ArrowType)i1; }
|
|
TQRect rect() const { return TQRect( i1, i2, i3, i4 ); }
|
|
TQWidget* widget() const { return (TQWidget*)p1; }
|
|
|
|
private:
|
|
bool def;
|
|
TQTab* tb;
|
|
TQMenuItem* mi;
|
|
const TQColor* cl;
|
|
TQListViewItem* li;
|
|
int i1, i2, i3, i4;
|
|
TQCheckListItem* cli;
|
|
void *p1, *p2, *p3, *p4; // reserved
|
|
// (padded to 64 bytes on some architectures)
|
|
};
|
|
|
|
inline TQStyleOption::TQStyleOption(const QStyleOption& qso) {
|
|
// i1 = qso.rect().x();
|
|
// i2 = qso.rect().y();
|
|
// i3 = qso.rect().width();
|
|
// i4 = qso.rect().height();
|
|
|
|
// switch (qso.type()) {
|
|
// case QStyleOption::SO_MenuItem:
|
|
//
|
|
// break;
|
|
// }
|
|
|
|
printf("[FIXME] TQt does not utilize any QStyleOption parameters during conversion to TQStyleOption\n\r");
|
|
// qFatal("[ABORTING FOR DEBUGGING]");
|
|
//*this = TQStyleOption(*static_cast<const TQStyleOption*>(&qso));
|
|
}
|
|
|
|
// #define Style_Default State_None
|
|
// #define Style_Enabled State_Enabled
|
|
// #define Style_HasFocus State_HasFocus
|
|
// #define Style_Up State_Raised
|
|
// #define Style_Down State_Sunken
|
|
// #define Style_On State_On
|
|
// #define Style_Off State_Off
|
|
// #define Style_Top State_Top
|
|
// #define Style_Bottom State_Bottom
|
|
// #define Style_NoChange State_NoChange
|
|
// #define Style_MouseOver State_MouseOver
|
|
// #define Style_Horizontal State_Horizontal
|
|
// #define Style_Vertical State_Vertical
|
|
// #define Style_Active State_Active
|
|
// #define Style_Sunken State_Sunken
|
|
// #define Style_Raised State_Raised
|
|
// #define Style_Selected State_Selected
|
|
// #define Style_AutoRaise State_AutoRaise
|
|
// #define Style_FocusAtBorder State_FocusAtBorder
|
|
// #define Style_ButtonDefault State_None /* [FIXME] Should be QStyleOptionButton::DefaultButton */
|
|
|
|
#define SP_DockWindowCloseButton SP_DockWidgetCloseButton
|
|
|
|
#define PM_DockWindowHandleExtent PM_DockWidgetHandleExtent
|
|
#define PM_MenuBarFrameWidth PM_MenuBarPanelWidth
|
|
#define PM_DockWindowFrameWidth PM_DockWidgetFrameWidth
|
|
#define PM_PopupMenuFrameVerticalExtra PM_MenuVMargin
|
|
#define PM_PopupMenuFrameHorizontalExtra PM_MenuHMargin
|
|
#define PM_PopupMenuScrollerHeight PM_MenuScrollerHeight
|
|
#define PM_DockWindowSeparatorExtent PM_DockWidgetSeparatorExtent
|
|
|
|
#define CE_PopupMenuItem CE_MenuItem
|
|
#define CE_PopupMenuVerticalExtra CE_MenuVMargin
|
|
#define CE_PopupMenuHorizontalExtra CE_MenuHMargin
|
|
#define CE_PopupMenuScroller CE_MenuScroller
|
|
#define CE_TabBarLabel CE_TabBarTabLabel
|
|
|
|
#define CC_ListView CC_Q3ListView
|
|
|
|
#define SH_ListViewExpand_SelectMouseType SH_Q3ListViewExpand_SelectMouseType
|
|
#define SH_PopupMenu_MouseTracking SH_Menu_MouseTracking
|
|
#define SH_PopupMenu_Scrollable SH_Menu_Scrollable
|
|
#define SH_PopupMenu_AllowActiveAndDisabled SH_Menu_AllowActiveAndDisabled
|
|
#define SH_PopupMenu_SubMenuPopupDelay SH_Menu_SubMenuPopupDelay
|
|
#define SH_PopupMenu_SpaceActivatesItem SH_Menu_SpaceActivatesItem
|
|
#define SH_PopupMenu_SloppySubMenus SH_Menu_SloppySubMenus
|
|
#define SH_ToolButton_Uses3D SH_ToolButtonStyle /* [FIXME] Verify that this is correct */
|
|
|
|
// Use the TQt virtual functions, not the built in Qt ones...
|
|
// This requires that the base virtual Qt functions be reimplemented so as to point to the TQt virtual functions instead as shown below.
|
|
// This way, when Trinity overrides a TQt virtual function, the calling Qt code will blithely use the overriden TQt function instead.
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_01 inline void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const { TQ_UNUSED(opt); TQ_UNUSED(w); static_cast<const TQStyle*>(this)->tqdrawPrimitive(pe, static_cast<TQPainter*>(p), TQRect(), TQColorGroup()); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_02 inline QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const { return static_cast<const TQStyle*>(this)->tqsizeFromContents( ct, static_cast<const TQWidget*>(w), contentsSize, TQT_TQSTYLEOPTION_OBJECT(*opt) ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_03 inline QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const { TQ_UNUSED(fm); return static_cast<const TQStyle*>(this)->tqitemRect(NULL, r, flags, enabled, NULL, text); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_04 inline QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const { return static_cast<const TQStyle*>(this)->tqitemRect(NULL, r, flags, true, &pixmap, NULL); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_05 inline void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const { static_cast<const TQStyle*>(this)->tqdrawControl( element, static_cast<TQPainter*>(p), static_cast<const TQWidget*>(w), opt->rect, TQColorGroup() ); /* [FIXME] an empty (black) qcolorgroup is WRONG!*/ }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_06 inline int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const { TQ_UNUSED(option); return static_cast<const TQStyle*>(this)->tqpixelMetric( metric, TQT_TQWIDGET_CONST(widget) ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_07 inline void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const { static_cast<const TQStyle*>(this)->tqdrawComplexControl( cc, static_cast<TQPainter*>(p), static_cast<const TQWidget*>(widget), opt->rect, TQColorGroup()); } /* [FIXME] an empty (black) qcolorgroup is WRONG! */
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_08 inline QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { return static_cast<const TQStyle*>(this)->stylePixmap( standardPixmap, TQT_TQWIDGET_CONST(widget), TQT_TQSTYLEOPTION_OBJECT(*opt) ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_09 inline int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn* returnData) const { return static_cast<const TQStyle*>(this)->tqstyleHint( stylehint, TQT_TQWIDGET_CONST(widget), TQT_TQSTYLEOPTION_OBJECT(*opt), returnData ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_10 inline virtual QRect subElementRect(QStyle::SubElement r, const QStyleOption*, const QWidget *widget) const { return static_cast<const TQStyle*>(this)->subRect( (SubRect)r, static_cast<const TQWidget*>(widget) ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_11 inline virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl, const QStyleOptionComplex*, const QPoint&, const QWidget*) const { /* [FIXME] */ printf("[WARNING] virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl, const QStyleOptionComplex*, const QPoint&, const QWidget*) unimplemented\n\r"); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_12 inline virtual QRect subControlRect(QStyle::ComplexControl r, const QStyleOptionComplex*, QStyle::SubControl, const QWidget* widget) const { return static_cast<const TQStyle*>(this)->subRect( (SubRect)r, static_cast<const TQWidget*>(widget) ); }
|
|
|
|
#define TQT_TQSTYLE_QT4_INTERFACE_VFUNC_13 inline virtual QPixmap generatedIconPixmap(QIcon::Mode, const QPixmap&, const QStyleOption*) const { /* [FIXME] */ printf("[WARNING] virtual QPixmap generatedIconPixmap(QIcon::Mode, const QPixmap&, const QStyleOption*) unimplemented\n\r"); }
|
|
|
|
//class TQStyleHintReturn; // not defined yet
|
|
#define TQStyleHintReturn QStyleHintReturn
|
|
|
|
class TQ_EXPORT TQStyle: public QStyle, virtual public TQt
|
|
{
|
|
Q_OBJECT
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
typedef uint SFlags;
|
|
|
|
// typedef State SFlags;
|
|
typedef StandardPixmap StylePixmap;
|
|
|
|
TQStyle() : QStyle() { TQT_TQOBJECT_REQUIRED_INITIALIZATION(parent) }
|
|
|
|
enum SH_NewTypes {
|
|
SH_GUIStyle = 0x00000100,
|
|
SH_ScrollBar_BackgroundMode,
|
|
SH_UnderlineAccelerator = SH_UnderlineShortcut
|
|
};
|
|
|
|
typedef TQTInheritEnum< SH_NewTypes, QStyle::StyleHint > TQ_StyleHint;
|
|
|
|
enum CE_NewTypes {
|
|
CE_DockWindowEmptyArea = 0xff000000
|
|
};
|
|
|
|
typedef TQTInheritEnum< CE_NewTypes, QStyle::ControlElement > TQ_ControlElement;
|
|
|
|
enum CC_NewTypes {
|
|
CC_SpinWidget = 0xff000000
|
|
};
|
|
|
|
typedef TQTInheritEnum< CC_NewTypes, QStyle::ComplexControl > TQ_ComplexControl;
|
|
|
|
enum PE_NewTypes {
|
|
PE_IndicatorMask = 0xff000000,
|
|
PE_ExclusiveIndicator = 0xff000001,
|
|
PE_ExclusiveIndicatorMask = 0xff000002,
|
|
PE_GroupBoxFrame = 0xff000003,
|
|
|
|
// NOTE: These need an interface to Qt4 such that Qt4 calls for CE_ScrollBar<xxx> are translated to the equivalent TQt PE_ScrollBar<xxx> calls
|
|
PE_ScrollBarAddLine = 0xff000004,
|
|
PE_ScrollBarSubLine = 0xff000005,
|
|
PE_ScrollBarAddPage = 0xff000006,
|
|
PE_ScrollBarSubPage = 0xff000007,
|
|
PE_ScrollBarSlider = 0xff000008,
|
|
PE_ScrollBarFirst = 0xff000009,
|
|
PE_ScrollBarLast = 0xff00000a,
|
|
|
|
// NOTE: Same as above...
|
|
PE_SizeGrip = 0xff00000b,
|
|
PE_Splitter = 0xff00000c,
|
|
PE_RubberBand = 0xff00000d,
|
|
PE_HeaderSection = 0xff00000e,
|
|
PE_HeaderSectionMenu = 0xff00000f
|
|
};
|
|
|
|
typedef TQTInheritEnum< PE_NewTypes, QStyle::PrimitiveElement > TQ_PrimitiveElement;
|
|
|
|
// Note that StyleFlags is now StateFlags
|
|
enum StyleFlags {
|
|
Style_Default = QStyle::State_None,
|
|
Style_Enabled = QStyle::State_Enabled,
|
|
Style_HasFocus = QStyle::State_HasFocus,
|
|
Style_Up = QStyle::State_Raised,
|
|
Style_Down = QStyle::State_Sunken,
|
|
Style_On = QStyle::State_On,
|
|
Style_Off = QStyle::State_Off,
|
|
Style_Top = QStyle::State_Top,
|
|
Style_Bottom = QStyle::State_Bottom,
|
|
Style_NoChange = QStyle::State_NoChange,
|
|
Style_MouseOver = QStyle::State_MouseOver,
|
|
Style_Horizontal = QStyle::State_Horizontal,
|
|
// Style_Vertical = QStyle::State_Vertical,
|
|
Style_Active = QStyle::State_Active,
|
|
Style_Sunken = QStyle::State_Sunken,
|
|
Style_Raised = QStyle::State_Raised,
|
|
Style_Selected = QStyle::State_Selected,
|
|
Style_AutoRaise = QStyle::State_AutoRaise,
|
|
Style_FocusAtBorder = QStyle::State_FocusAtBorder,
|
|
Style_ButtonDefault = QStyle::State_None /* [FIXME] Should be QStyleOptionButton::DefaultButton */
|
|
};
|
|
|
|
// Note that SubRect may not have an equivalent in Qt4--be careful!
|
|
enum SubRect {
|
|
SR_PushButtonContents,
|
|
SR_PushButtonFocusRect,
|
|
|
|
SR_CheckBoxIndicator,
|
|
SR_CheckBoxContents,
|
|
SR_CheckBoxFocusRect,
|
|
|
|
SR_RadioButtonIndicator,
|
|
SR_RadioButtonContents,
|
|
SR_RadioButtonFocusRect,
|
|
|
|
SR_ComboBoxFocusRect,
|
|
|
|
SR_SliderFocusRect,
|
|
|
|
SR_DockWindowHandleRect,
|
|
|
|
SR_ProgressBarGroove,
|
|
SR_ProgressBarContents,
|
|
SR_ProgressBarLabel,
|
|
|
|
SR_ToolButtonContents,
|
|
|
|
SR_DialogButtonAccept,
|
|
SR_DialogButtonReject,
|
|
SR_DialogButtonApply,
|
|
SR_DialogButtonHelp,
|
|
SR_DialogButtonAll,
|
|
SR_DialogButtonAbort,
|
|
SR_DialogButtonIgnore,
|
|
SR_DialogButtonRetry,
|
|
SR_DialogButtonCustom,
|
|
|
|
SR_ToolBoxTabContents,
|
|
|
|
// do not add any values below/greater than this
|
|
SR_CustomBase = 0xf0000000
|
|
};
|
|
|
|
// Note that SubControl may not have an equivalent in Qt4--be careful!
|
|
enum SubControl {
|
|
SC_None = 0x00000000,
|
|
|
|
SC_ScrollBarAddLine = 0x00000001,
|
|
SC_ScrollBarSubLine = 0x00000002,
|
|
SC_ScrollBarAddPage = 0x00000004,
|
|
SC_ScrollBarSubPage = 0x00000008,
|
|
SC_ScrollBarFirst = 0x00000010,
|
|
SC_ScrollBarLast = 0x00000020,
|
|
SC_ScrollBarSlider = 0x00000040,
|
|
SC_ScrollBarGroove = 0x00000080,
|
|
|
|
SC_SpinWidgetUp = 0x00000001,
|
|
SC_SpinWidgetDown = 0x00000002,
|
|
SC_SpinWidgetFrame = 0x00000004,
|
|
SC_SpinWidgetEditField = 0x00000008,
|
|
SC_SpinWidgetButtonField = 0x00000010,
|
|
|
|
SC_ComboBoxFrame = 0x00000001,
|
|
SC_ComboBoxEditField = 0x00000002,
|
|
SC_ComboBoxArrow = 0x00000004,
|
|
SC_ComboBoxListBoxPopup = 0x00000008,
|
|
|
|
SC_SliderGroove = 0x00000001,
|
|
SC_SliderHandle = 0x00000002,
|
|
SC_SliderTickmarks = 0x00000004,
|
|
|
|
SC_ToolButton = 0x00000001,
|
|
SC_ToolButtonMenu = 0x00000002,
|
|
|
|
SC_TitleBarLabel = 0x00000001,
|
|
SC_TitleBarSysMenu = 0x00000002,
|
|
SC_TitleBarMinButton = 0x00000004,
|
|
SC_TitleBarMaxButton = 0x00000008,
|
|
SC_TitleBarCloseButton = 0x00000010,
|
|
SC_TitleBarNormalButton = 0x00000020,
|
|
SC_TitleBarShadeButton = 0x00000040,
|
|
SC_TitleBarUnshadeButton = 0x00000080,
|
|
|
|
SC_ListView = 0x00000001,
|
|
SC_ListViewBranch = 0x00000002,
|
|
SC_ListViewExpand = 0x00000004,
|
|
|
|
SC_All = 0xffffffff
|
|
};
|
|
typedef uint SCFlags;
|
|
|
|
bool isA(const char *classname) const;
|
|
bool inherits( const char * ) const;
|
|
|
|
const char *tqname() const;
|
|
const char *name() const;
|
|
// const char *name(const char *defaultName) const;
|
|
|
|
TQMetaObject *tqmetaObject() const;
|
|
|
|
// Compatibility functions
|
|
// For example, a TQt application may call tqdrawPrimitive with a ControlElement parameter
|
|
// TQt "knows" that the application should have called tqdrawControl instead, and translates accordingly.
|
|
inline void tqdrawPrimitive( TQ_ControlElement element, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption &opt = TQStyleOption::Default ) const {
|
|
TQ_UNUSED(r);
|
|
TQ_UNUSED(cg);
|
|
TQ_UNUSED(flags);
|
|
drawControl((QStyle::ControlElement)(int)element, &opt, p, 0); // [FIXME] What should widget really be? I imagine 0 is *wrong*!!!
|
|
}
|
|
inline void tqdrawPrimitive( TQ_ComplexControl element, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption &opt = TQStyleOption::Default ) const {
|
|
TQ_UNUSED(r);
|
|
TQ_UNUSED(cg);
|
|
TQ_UNUSED(flags);
|
|
drawComplexControl((QStyle::ComplexControl)(int)element, 0, p, 0); // [FIXME] What should widget and complexcontrol really be? I imagine 0 is *wrong*!!!
|
|
}
|
|
inline void tqdrawPrimitive( TQ_ControlElement element, TQPainter *p, const TQRect &r, const TQColorGroup &cg, int flags, const TQStyleOption &opt = TQStyleOption::Default ) const { tqdrawPrimitive( element, p, r, cg, (SFlags)flags, opt); }
|
|
|
|
// inline void tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption &opt = TQStyleOption::Default ) const { tqdrawPrimitiveBase( pe, p, r, cg, flags, opt); }
|
|
// inline void tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, int flags, const TQStyleOption &opt = TQStyleOption::Default ) const { tqdrawPrimitive( pe, p, r, cg, (SFlags)flags, opt ); }
|
|
virtual void tqdrawPrimitive( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption &opt = TQStyleOption::Default ) const = 0;
|
|
|
|
inline static TQRect tqvisualRect( const TQRect &logical, const TQWidget *w ) { return visualRect(QApplication::layoutDirection(), w->rect(), logical); }
|
|
inline static TQRect tqvisualRect( const QRect &logical, const QRect &bounding ) { return visualRect(QApplication::layoutDirection(), bounding, logical); }
|
|
|
|
// virtual void tqdrawPrimitiveBase( TQ_PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, const TQStyleOption &opt = TQStyleOption::Default ) const = 0;
|
|
virtual TQSize tqsizeFromContents( ContentsType contents, const TQWidget *widget, const TQSize &contentsSize, const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual int tqstyleHint( TQ_StyleHint stylehint, const TQWidget *widget = 0, const TQStyleOption& = TQStyleOption::Default, TQStyleHintReturn* returnData = 0) const = 0;
|
|
virtual TQRect subRect( SubRect r, const TQWidget *widget ) const = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
virtual TQRect tqitemRect( QPainter *p, const QRect &r, int flags, bool enabled, const QPixmap *pixmap, const QString &text, int len = -1 ) const;
|
|
virtual void tqdrawControlMask( TQ_ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& = TQStyleOption::Default ) const = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
virtual void tqdrawControl( TQ_ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags how = Style_Default, const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual int tqpixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const = 0;
|
|
virtual TQRect querySubControlMetrics( TQ_ComplexControl control, const TQWidget *widget, SubControl sc, const TQStyleOption& = TQStyleOption::Default ) const = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
virtual void tqdrawComplexControl( TQ_ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags how = Style_Default,
|
|
#ifdef TQ_TQDOC
|
|
SCFlags sub = SC_All,
|
|
#else
|
|
SCFlags sub = (uint)SC_All,
|
|
#endif
|
|
SCFlags subActive = SC_None, const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual void tqdrawComplexControlMask( TQ_ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& = TQStyleOption::Default ) const = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
virtual TQPixmap stylePixmap( StylePixmap stylepixmap, const TQWidget *widget = 0, const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual SubControl querySubControl( TQ_ComplexControl control, const TQWidget *widget, const TQPoint &pos, const TQStyleOption& = TQStyleOption::Default ) const = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
virtual void polishPopupMenu( TQPopupMenu* ) = 0; // There doesn't seem to be a Qt4 equivalent for this virtual function; should it just be left as-is here?
|
|
|
|
// The Qt4 methods need to be here as well, otherwise they will be hidden by the method definitions above...
|
|
// virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const = 0;
|
|
// virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const = 0;
|
|
|
|
// These are implemented in the cpp file
|
|
virtual void drawItem( TQPainter *p, const TQRect &r, int flags, const TQColorGroup &g, bool enabled, const TQPixmap *pixmap, const TQString &text, int len = -1, const TQColor *penColor = 0 ) const;
|
|
|
|
// Compatibility
|
|
virtual void polish( TQWidget * );
|
|
virtual void unPolish( TQWidget * );
|
|
virtual void polish( TQApplication * );
|
|
virtual void unPolish( TQApplication * );
|
|
virtual void polish( TQPalette & );
|
|
|
|
// Feel free to look but please don't touch!
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_01
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_02
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_03
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_04
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_05
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_06
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_07
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_08
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_09
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_10
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_11
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_12
|
|
TQT_TQSTYLE_QT4_INTERFACE_VFUNC_13
|
|
|
|
// Old 2.x TQStyle API
|
|
|
|
#ifndef TQT_NO_COMPAT
|
|
int defaultFrameWidth() const {
|
|
return tqpixelMetric( PM_DefaultFrameWidth );
|
|
}
|
|
|
|
void tabbarMetrics( const TQWidget* t, int& hf, int& vf, int& ov ) const {
|
|
hf = tqpixelMetric( PM_TabBarTabHSpace, t );
|
|
vf = tqpixelMetric( PM_TabBarTabVSpace, t );
|
|
ov = tqpixelMetric( PM_TabBarBaseOverlap, t );
|
|
}
|
|
|
|
TQSize scrollBarExtent() const {
|
|
return TQSize(tqpixelMetric(PM_ScrollBarExtent), tqpixelMetric(PM_ScrollBarExtent));
|
|
}
|
|
#endif
|
|
|
|
public Q_SLOTS:
|
|
void tqt_handle_qt_destroyed(QObject* obj) { emit destroyed(TQT_TQOBJECT(obj)); }
|
|
|
|
Q_SIGNALS:
|
|
void destroyed( TQObject* obj );
|
|
|
|
private:
|
|
mutable TQString static_object_name;
|
|
};
|
|
|
|
#else // USE_QT4
|
|
|
|
#ifndef TQT_NO_STYLE
|
|
|
|
class TQPopupMenu;
|
|
class TQStylePrivate;
|
|
class TQMenuItem;
|
|
class TQTab;
|
|
class TQListViewItem;
|
|
class TQCheckListItem;
|
|
|
|
class TQStyleOption {
|
|
public:
|
|
enum StyleOptionDefault { Default };
|
|
|
|
TQStyleOption(StyleOptionDefault=Default) : def(TRUE) {}
|
|
|
|
// Note: we don't use default arguments since that is unnecessary
|
|
// initialization.
|
|
TQStyleOption(int in1) :
|
|
def(FALSE), i1(in1) {}
|
|
TQStyleOption(int in1, int in2) :
|
|
def(FALSE), i1(in1), i2(in2) {}
|
|
TQStyleOption(int in1, int in2, int in3, int in4) :
|
|
def(FALSE), i1(in1), i2(in2), i3(in3), i4(in4) {}
|
|
TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m) {}
|
|
TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), i1(in1) {}
|
|
TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), i1(in1), i2(in2) {}
|
|
TQStyleOption(const TQColor& c) : def(FALSE), cl(&c) {}
|
|
TQStyleOption(TQTab* t) : def(FALSE), tb(t) {}
|
|
TQStyleOption(TQListViewItem* i) : def(FALSE), li(i) {}
|
|
TQStyleOption(TQCheckListItem* i) : def(FALSE), cli(i) {}
|
|
TQStyleOption(TQt::ArrowType a) : def(FALSE), i1((int)a) {}
|
|
TQStyleOption(const TQRect& r) : def(FALSE), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){}
|
|
TQStyleOption(TQWidget *w) : def(FALSE), p1((void*)w) {}
|
|
|
|
bool isDefault() const { return def; }
|
|
|
|
int day() const { return i1; }
|
|
|
|
int lineWidth() const { return i1; }
|
|
int midLineWidth() const { return i2; }
|
|
int frameShape() const { return i3; }
|
|
int frameShadow() const { return i4; }
|
|
|
|
int headerSection() const { return i1; }
|
|
TQMenuItem* menuItem() const { return mi; }
|
|
int maxIconWidth() const { return i1; }
|
|
int tabWidth() const { return i2; }
|
|
|
|
const TQColor& color() const { return *cl; }
|
|
|
|
TQTab* tab() const { return tb; }
|
|
|
|
TQCheckListItem* checkListItem() const { return cli; }
|
|
TQListViewItem* listViewItem() const { return li; }
|
|
|
|
TQt::ArrowType arrowType() const { return (TQt::ArrowType)i1; }
|
|
TQRect rect() const { return TQRect( i1, i2, i3, i4 ); }
|
|
TQWidget* widget() const { return (TQWidget*)p1; }
|
|
|
|
private:
|
|
// NOTE: none of these components have constructors.
|
|
bool def;
|
|
bool b1,b2,b3; // reserved
|
|
TQMenuItem* mi;
|
|
TQTab* tb;
|
|
TQListViewItem* li;
|
|
const TQColor* cl;
|
|
int i1, i2, i3, i4;
|
|
int i5, i6; // reserved
|
|
TQCheckListItem* cli;
|
|
void *p1, *p2, *p3, *p4; // reserved
|
|
// (padded to 64 bytes on some architectures)
|
|
};
|
|
|
|
class TQStyleHintReturn; // not defined yet
|
|
|
|
class TQ_EXPORT TQStyle: public TQObject
|
|
{
|
|
TQ_OBJECT
|
|
|
|
public:
|
|
TQStyle();
|
|
virtual ~TQStyle();
|
|
|
|
// New TQStyle API - most of these should probably be pure virtual
|
|
|
|
virtual void polish( TQWidget * );
|
|
virtual void unPolish( TQWidget * );
|
|
|
|
virtual void polish( TQApplication * );
|
|
virtual void unPolish( TQApplication * );
|
|
|
|
virtual void polish( TQPalette & );
|
|
|
|
virtual void polishPopupMenu( TQPopupMenu* ) = 0;
|
|
|
|
virtual TQRect tqitemRect( TQPainter *p, const TQRect &r,
|
|
int flags, bool enabled,
|
|
const TQPixmap *pixmap,
|
|
const TQString &text, int len = -1 ) const;
|
|
|
|
virtual void drawItem( TQPainter *p, const TQRect &r,
|
|
int flags, const TQColorGroup &g, bool enabled,
|
|
const TQPixmap *pixmap, const TQString &text,
|
|
int len = -1, const TQColor *penColor = 0 ) const;
|
|
|
|
|
|
enum PrimitiveElement {
|
|
PE_ButtonCommand,
|
|
PE_ButtonDefault,
|
|
PE_ButtonBevel,
|
|
PE_ButtonTool,
|
|
PE_ButtonDropDown,
|
|
|
|
PE_FocusRect,
|
|
|
|
PE_ArrowUp,
|
|
PE_ArrowDown,
|
|
PE_ArrowRight,
|
|
PE_ArrowLeft,
|
|
|
|
PE_SpinWidgetUp,
|
|
PE_SpinWidgetDown,
|
|
PE_SpinWidgetPlus,
|
|
PE_SpinWidgetMinus,
|
|
|
|
PE_Indicator,
|
|
PE_IndicatorMask,
|
|
PE_ExclusiveIndicator,
|
|
PE_ExclusiveIndicatorMask,
|
|
|
|
PE_DockWindowHandle,
|
|
PE_DockWindowSeparator,
|
|
PE_DockWindowResizeHandle,
|
|
|
|
PE_Splitter,
|
|
|
|
PE_Panel,
|
|
PE_PanelPopup,
|
|
PE_PanelMenuBar,
|
|
PE_PanelDockWindow,
|
|
|
|
PE_TabBarBase,
|
|
|
|
PE_HeaderSection,
|
|
PE_HeaderArrow,
|
|
PE_tqStatusBarSection,
|
|
|
|
PE_GroupBoxFrame,
|
|
|
|
PE_Separator,
|
|
|
|
PE_SizeGrip,
|
|
|
|
PE_CheckMark,
|
|
|
|
PE_ScrollBarAddLine,
|
|
PE_ScrollBarSubLine,
|
|
PE_ScrollBarAddPage,
|
|
PE_ScrollBarSubPage,
|
|
PE_ScrollBarSlider,
|
|
PE_ScrollBarFirst,
|
|
PE_ScrollBarLast,
|
|
|
|
PE_ProgressBarChunk,
|
|
|
|
PE_PanelLineEdit,
|
|
PE_PanelTabWidget,
|
|
|
|
PE_WindowFrame,
|
|
|
|
PE_CheckListController,
|
|
PE_CheckListIndicator,
|
|
PE_CheckListExclusiveIndicator,
|
|
|
|
PE_PanelGroupBox,
|
|
PE_RubberBand,
|
|
|
|
PE_HeaderSectionMenu,
|
|
|
|
// do not add any values below/greater this
|
|
PE_CustomBase = 0xf000000
|
|
};
|
|
|
|
enum StyleFlags {
|
|
Style_Default = 0x00000000,
|
|
Style_Enabled = 0x00000001,
|
|
Style_Raised = 0x00000002,
|
|
Style_Sunken = 0x00000004,
|
|
Style_Off = 0x00000008,
|
|
Style_NoChange = 0x00000010,
|
|
Style_On = 0x00000020,
|
|
Style_Down = 0x00000040,
|
|
Style_Horizontal = 0x00000080,
|
|
Style_HasFocus = 0x00000100,
|
|
Style_Top = 0x00000200,
|
|
Style_Bottom = 0x00000400,
|
|
Style_FocusAtBorder = 0x00000800,
|
|
Style_AutoRaise = 0x00001000,
|
|
Style_MouseOver = 0x00002000,
|
|
Style_Up = 0x00004000,
|
|
Style_Selected = 0x00008000,
|
|
Style_Active = 0x00010000,
|
|
Style_ButtonDefault = 0x00020000
|
|
};
|
|
typedef uint SFlags;
|
|
|
|
virtual void drawPrimitive( PrimitiveElement pe,
|
|
TQPainter *p,
|
|
const TQRect &r,
|
|
const TQColorGroup &cg,
|
|
SFlags flags = Style_Default,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
|
|
enum ControlElement {
|
|
CE_PushButton,
|
|
CE_PushButtonLabel,
|
|
|
|
CE_CheckBox,
|
|
CE_CheckBoxLabel,
|
|
|
|
CE_RadioButton,
|
|
CE_RadioButtonLabel,
|
|
|
|
CE_TabBarTab,
|
|
CE_TabBarLabel,
|
|
|
|
CE_ProgressBarGroove,
|
|
CE_ProgressBarContents,
|
|
CE_ProgressBarLabel,
|
|
|
|
CE_PopupMenuItem,
|
|
CE_MenuBarItem,
|
|
|
|
CE_ToolButtonLabel,
|
|
CE_MenuBarEmptyArea,
|
|
CE_PopupMenuScroller,
|
|
CE_DockWindowEmptyArea,
|
|
CE_PopupMenuVerticalExtra,
|
|
CE_PopupMenuHorizontalExtra,
|
|
|
|
CE_ToolBoxTab,
|
|
CE_HeaderLabel,
|
|
|
|
// do not add any values below/greater than this
|
|
CE_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual void tqdrawControl( ControlElement element,
|
|
TQPainter *p,
|
|
const TQWidget *widget,
|
|
const TQRect &r,
|
|
const TQColorGroup &cg,
|
|
SFlags how = Style_Default,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual void tqdrawControlMask( ControlElement element,
|
|
TQPainter *p,
|
|
const TQWidget *widget,
|
|
const TQRect &r,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
enum SubRect {
|
|
SR_PushButtonContents,
|
|
SR_PushButtonFocusRect,
|
|
|
|
SR_CheckBoxIndicator,
|
|
SR_CheckBoxContents,
|
|
SR_CheckBoxFocusRect,
|
|
|
|
SR_RadioButtonIndicator,
|
|
SR_RadioButtonContents,
|
|
SR_RadioButtonFocusRect,
|
|
|
|
SR_ComboBoxFocusRect,
|
|
|
|
SR_SliderFocusRect,
|
|
|
|
SR_DockWindowHandleRect,
|
|
|
|
SR_ProgressBarGroove,
|
|
SR_ProgressBarContents,
|
|
SR_ProgressBarLabel,
|
|
|
|
SR_ToolButtonContents,
|
|
|
|
SR_DialogButtonAccept,
|
|
SR_DialogButtonReject,
|
|
SR_DialogButtonApply,
|
|
SR_DialogButtonHelp,
|
|
SR_DialogButtonAll,
|
|
SR_DialogButtonAbort,
|
|
SR_DialogButtonIgnore,
|
|
SR_DialogButtonRetry,
|
|
SR_DialogButtonCustom,
|
|
|
|
SR_ToolBoxTabContents,
|
|
|
|
// do not add any values below/greater than this
|
|
SR_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual TQRect subRect( SubRect r, const TQWidget *widget ) const = 0;
|
|
|
|
|
|
enum ComplexControl{
|
|
CC_SpinWidget,
|
|
CC_ComboBox,
|
|
CC_ScrollBar,
|
|
CC_Slider,
|
|
CC_ToolButton,
|
|
CC_TitleBar,
|
|
CC_ListView,
|
|
|
|
// do not add any values below/greater than this
|
|
CC_CustomBase = 0xf0000000
|
|
};
|
|
|
|
enum SubControl {
|
|
SC_None = 0x00000000,
|
|
|
|
SC_ScrollBarAddLine = 0x00000001,
|
|
SC_ScrollBarSubLine = 0x00000002,
|
|
SC_ScrollBarAddPage = 0x00000004,
|
|
SC_ScrollBarSubPage = 0x00000008,
|
|
SC_ScrollBarFirst = 0x00000010,
|
|
SC_ScrollBarLast = 0x00000020,
|
|
SC_ScrollBarSlider = 0x00000040,
|
|
SC_ScrollBarGroove = 0x00000080,
|
|
|
|
SC_SpinWidgetUp = 0x00000001,
|
|
SC_SpinWidgetDown = 0x00000002,
|
|
SC_SpinWidgetFrame = 0x00000004,
|
|
SC_SpinWidgetEditField = 0x00000008,
|
|
SC_SpinWidgetButtonField = 0x00000010,
|
|
|
|
SC_ComboBoxFrame = 0x00000001,
|
|
SC_ComboBoxEditField = 0x00000002,
|
|
SC_ComboBoxArrow = 0x00000004,
|
|
SC_ComboBoxListBoxPopup = 0x00000008,
|
|
|
|
SC_SliderGroove = 0x00000001,
|
|
SC_SliderHandle = 0x00000002,
|
|
SC_SliderTickmarks = 0x00000004,
|
|
|
|
SC_ToolButton = 0x00000001,
|
|
SC_ToolButtonMenu = 0x00000002,
|
|
|
|
SC_TitleBarLabel = 0x00000001,
|
|
SC_TitleBarSysMenu = 0x00000002,
|
|
SC_TitleBarMinButton = 0x00000004,
|
|
SC_TitleBarMaxButton = 0x00000008,
|
|
SC_TitleBarCloseButton = 0x00000010,
|
|
SC_TitleBarNormalButton = 0x00000020,
|
|
SC_TitleBarShadeButton = 0x00000040,
|
|
SC_TitleBarUnshadeButton = 0x00000080,
|
|
|
|
SC_ListView = 0x00000001,
|
|
SC_ListViewBranch = 0x00000002,
|
|
SC_ListViewExpand = 0x00000004,
|
|
|
|
SC_All = 0xffffffff
|
|
};
|
|
typedef uint SCFlags;
|
|
|
|
|
|
virtual void tqdrawComplexControl( ComplexControl control,
|
|
TQPainter *p,
|
|
const TQWidget *widget,
|
|
const TQRect &r,
|
|
const TQColorGroup &cg,
|
|
SFlags how = Style_Default,
|
|
#ifdef TQ_TQDOC
|
|
SCFlags sub = SC_All,
|
|
#else
|
|
SCFlags sub = (uint)SC_All,
|
|
#endif
|
|
SCFlags subActive = SC_None,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual void tqdrawComplexControlMask( ComplexControl control,
|
|
TQPainter *p,
|
|
const TQWidget *widget,
|
|
const TQRect &r,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
virtual TQRect querySubControlMetrics( ComplexControl control,
|
|
const TQWidget *widget,
|
|
SubControl sc,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
virtual SubControl querySubControl( ComplexControl control,
|
|
const TQWidget *widget,
|
|
const TQPoint &pos,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
|
|
enum PixelMetric {
|
|
PM_ButtonMargin,
|
|
PM_ButtonDefaultIndicator,
|
|
PM_MenuButtonIndicator,
|
|
PM_ButtonShiftHorizontal,
|
|
PM_ButtonShiftVertical,
|
|
|
|
PM_DefaultFrameWidth,
|
|
PM_SpinBoxFrameWidth,
|
|
|
|
PM_MaximumDragDistance,
|
|
|
|
PM_ScrollBarExtent,
|
|
PM_ScrollBarSliderMin,
|
|
|
|
PM_SliderThickness, // total slider thickness
|
|
PM_SliderControlThickness, // thickness of the business part
|
|
PM_SliderLength, // total length of slider
|
|
PM_SliderTickmarkOffset, //
|
|
PM_SliderSpaceAvailable, // available space for slider to move
|
|
|
|
PM_DockWindowSeparatorExtent,
|
|
PM_DockWindowHandleExtent,
|
|
PM_DockWindowFrameWidth,
|
|
|
|
PM_MenuBarFrameWidth,
|
|
|
|
PM_TabBarTabOverlap,
|
|
PM_TabBarTabHSpace,
|
|
PM_TabBarTabVSpace,
|
|
PM_TabBarBaseHeight,
|
|
PM_TabBarBaseOverlap,
|
|
|
|
PM_ProgressBarChunkWidth,
|
|
|
|
PM_SplitterWidth,
|
|
PM_TitleBarHeight,
|
|
|
|
PM_IndicatorWidth,
|
|
PM_IndicatorHeight,
|
|
PM_ExclusiveIndicatorWidth,
|
|
PM_ExclusiveIndicatorHeight,
|
|
PM_PopupMenuScrollerHeight,
|
|
PM_CheckListButtonSize,
|
|
PM_CheckListControllerSize,
|
|
PM_PopupMenuFrameHorizontalExtra,
|
|
PM_PopupMenuFrameVerticalExtra,
|
|
|
|
PM_DialogButtonsSeparator,
|
|
PM_DialogButtonsButtonWidth,
|
|
PM_DialogButtonsButtonHeight,
|
|
|
|
PM_MDIFrameWidth,
|
|
PM_MDIMinimizedWidth,
|
|
PM_HeaderMargin,
|
|
PM_HeaderMarkSize,
|
|
PM_HeaderGripMargin,
|
|
PM_TabBarTabShiftHorizontal,
|
|
PM_TabBarTabShiftVertical,
|
|
PM_TabBarScrollButtonWidth,
|
|
|
|
PM_MenuBarItemSpacing,
|
|
PM_ToolBarItemSpacing,
|
|
|
|
// do not add any values below/greater than this
|
|
PM_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual int tqpixelMetric( PixelMetric metric,
|
|
const TQWidget *widget = 0 ) const = 0;
|
|
|
|
|
|
enum ContentsType {
|
|
CT_PushButton,
|
|
CT_CheckBox,
|
|
CT_RadioButton,
|
|
CT_ToolButton,
|
|
CT_ComboBox,
|
|
CT_Splitter,
|
|
CT_DockWindow,
|
|
CT_ProgressBar,
|
|
CT_PopupMenuItem,
|
|
CT_TabBarTab,
|
|
CT_Slider,
|
|
CT_Header,
|
|
CT_LineEdit,
|
|
CT_MenuBar,
|
|
CT_SpinBox,
|
|
CT_SizeGrip,
|
|
CT_TabWidget,
|
|
CT_DialogButtons,
|
|
|
|
// do not add any values below/greater than this
|
|
CT_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual TQSize sizeFromContents( ContentsType contents,
|
|
const TQWidget *widget,
|
|
const TQSize &contentsSize,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
enum StyleHint {
|
|
// ...
|
|
// the general hints
|
|
// ...
|
|
// disabled text should be etched, ala Windows
|
|
SH_EtchDisabledText,
|
|
|
|
// the GUI style enum, argh!
|
|
SH_GUIStyle,
|
|
|
|
// ...
|
|
// widget specific hints
|
|
// ...
|
|
SH_ScrollBar_BackgroundMode,
|
|
SH_ScrollBar_MiddleClickAbsolutePosition,
|
|
SH_ScrollBar_ScrollWhenPointerLeavesControl,
|
|
|
|
// TQEvent::Type - which mouse event to select a tab
|
|
SH_TabBar_SelectMouseType,
|
|
|
|
SH_TabBar_Alignment,
|
|
|
|
SH_Header_ArrowAlignment,
|
|
|
|
// bool - sliders snap to values while moving, ala Windows
|
|
SH_Slider_SnapToValue,
|
|
|
|
// bool - key presses handled in a sloppy manner - ie. left on a vertical
|
|
// slider subtracts a line
|
|
SH_Slider_SloppyKeyEvents,
|
|
|
|
// bool - center button on progress dialogs, ala Motif, else right aligned
|
|
// perhaps this should be a TQt::Alignment value
|
|
SH_ProgressDialog_CenterCancelButton,
|
|
|
|
// TQt::AlignmentFlags - text label tqalignment in progress dialogs
|
|
// Center on windows, Auto|VCenter otherwize
|
|
SH_ProgressDialog_TextLabelAlignment,
|
|
|
|
// bool - right align buttons on print dialog, ala Windows
|
|
SH_PrintDialog_RightAlignButtons,
|
|
|
|
// bool - 1 or 2 pixel space between the menubar and the dockarea, ala Windows
|
|
// this *REALLY* needs a better name
|
|
SH_MainWindow_SpaceBelowMenuBar,
|
|
|
|
// bool - select the text in the line edit about the listbox when selecting
|
|
// an item from the listbox, or when the line edit receives focus, ala Windows
|
|
SH_FontDialog_SelectAssociatedText,
|
|
|
|
// bool - allows disabled menu items to be active
|
|
SH_PopupMenu_AllowActiveAndDisabled,
|
|
|
|
// bool - pressing space activates item, ala Motif
|
|
SH_PopupMenu_SpaceActivatesItem,
|
|
|
|
// int - number of milliseconds to wait before opening a submenu
|
|
// 256 on windows, 96 on motif
|
|
SH_PopupMenu_SubMenuPopupDelay,
|
|
|
|
// bool - should scrollviews draw their frame only around contents (ala Motif),
|
|
// or around contents, scrollbars and corner widgets (ala Windows) ?
|
|
SH_ScrollView_FrameOnlyAroundContents,
|
|
|
|
// bool - menubars items are navigatable by pressing alt, followed by using
|
|
// the arrow keys to select the desired item
|
|
SH_MenuBar_AltKeyNavigation,
|
|
|
|
// bool - mouse tracking in combobox dropdown lists
|
|
SH_ComboBox_ListMouseTracking,
|
|
|
|
// bool - mouse tracking in popupmenus
|
|
SH_PopupMenu_MouseTracking,
|
|
|
|
// bool - mouse tracking in menubars
|
|
SH_MenuBar_MouseTracking,
|
|
|
|
// bool - gray out selected items when loosing focus
|
|
SH_ItemView_ChangeHighlightOnFocus,
|
|
|
|
// bool - supports shared activation among modeless widgets
|
|
SH_Widget_ShareActivation,
|
|
|
|
// bool - workspace should just maximize the client area
|
|
SH_Workspace_FillSpaceOnMaximize,
|
|
|
|
// bool - supports popup menu comboboxes
|
|
SH_ComboBox_Popup,
|
|
|
|
// bool - titlebar has no border
|
|
SH_TitleBar_NoBorder,
|
|
|
|
// bool - stop scrollbar at mouse
|
|
SH_ScrollBar_StopMouseOverSlider,
|
|
|
|
//bool - blink cursort with selected text
|
|
SH_BlinkCursorWhenTextSelected,
|
|
|
|
//bool - richtext selections extend the full width of the docuemnt
|
|
SH_RichText_FullWidthSelection,
|
|
|
|
//bool - popupmenu supports scrolling instead of multicolumn mode
|
|
SH_PopupMenu_Scrollable,
|
|
|
|
// TQt::AlignmentFlags - text label vertical tqalignment in groupboxes
|
|
// Center on windows, Auto|VCenter otherwize
|
|
SH_GroupBox_TextLabelVerticalAlignment,
|
|
|
|
// TQt::TQRgb - text label color in groupboxes
|
|
SH_GroupBox_TextLabelColor,
|
|
|
|
// bool - popupmenu supports sloppy submenus
|
|
SH_PopupMenu_SloppySubMenus,
|
|
|
|
// TQt::TQRgb - table grid color
|
|
SH_Table_GridLineColor,
|
|
|
|
// TQChar - Unicode character for password char
|
|
SH_LineEdit_PasswordCharacter,
|
|
|
|
// TQDialogButtons::Button - default button
|
|
SH_DialogButtons_DefaultButton,
|
|
|
|
// TQToolBox - Boldness of the selected page title
|
|
SH_ToolBox_SelectedPageTitleBold,
|
|
|
|
//bool - if a tabbar prefers not to have scroller arrows
|
|
SH_TabBar_PreferNoArrows,
|
|
|
|
//bool - if left button should cause an absolute position
|
|
SH_ScrollBar_LeftClickAbsolutePosition,
|
|
|
|
// TQEvent::Type - which mouse event to select a list view expansion
|
|
SH_ListViewExpand_SelectMouseType,
|
|
|
|
//bool - if underline for accelerators
|
|
SH_UnderlineAccelerator,
|
|
|
|
// bool - TQToolButton - if tool buttons should use a 3D frame
|
|
// when the mouse is over the button
|
|
SH_ToolButton_Uses3D,
|
|
|
|
// do not add any values below/greater than this
|
|
SH_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual int tqstyleHint( StyleHint stylehint,
|
|
const TQWidget *widget = 0,
|
|
const TQStyleOption& = TQStyleOption::Default,
|
|
TQStyleHintReturn* returnData = 0
|
|
) const = 0;
|
|
|
|
|
|
enum StylePixmap {
|
|
SP_TitleBarMinButton,
|
|
SP_TitleBarMaxButton,
|
|
SP_TitleBarCloseButton,
|
|
SP_TitleBarNormalButton,
|
|
SP_TitleBarShadeButton,
|
|
SP_TitleBarUnshadeButton,
|
|
SP_DockWindowCloseButton,
|
|
SP_MessageBoxInformation,
|
|
SP_MessageBoxWarning,
|
|
SP_MessageBoxCritical,
|
|
SP_MessageBoxQuestion,
|
|
|
|
// do not add any values below/greater than this
|
|
SP_CustomBase = 0xf0000000
|
|
};
|
|
|
|
virtual TQPixmap stylePixmap( StylePixmap stylepixmap,
|
|
const TQWidget *widget = 0,
|
|
const TQStyleOption& = TQStyleOption::Default ) const = 0;
|
|
|
|
|
|
static TQRect tqvisualRect( const TQRect &logical, const TQWidget *w );
|
|
|
|
static TQRect tqvisualRect( const TQRect &logical, const TQRect &bounding );
|
|
|
|
|
|
|
|
|
|
// Old 2.x TQStyle API
|
|
|
|
#ifndef TQT_NO_COMPAT
|
|
int defaultFrameWidth() const
|
|
{
|
|
return tqpixelMetric( PM_DefaultFrameWidth );
|
|
}
|
|
void tabbarMetrics( const TQWidget* t,
|
|
int& hf, int& vf, int& ov ) const
|
|
{
|
|
hf = tqpixelMetric( PM_TabBarTabHSpace, t );
|
|
vf = tqpixelMetric( PM_TabBarTabVSpace, t );
|
|
ov = tqpixelMetric( PM_TabBarBaseOverlap, t );
|
|
}
|
|
TQSize scrollBarExtent() const
|
|
{
|
|
return TQSize(tqpixelMetric(PM_ScrollBarExtent),
|
|
tqpixelMetric(PM_ScrollBarExtent));
|
|
}
|
|
#endif
|
|
|
|
|
|
private:
|
|
TQStylePrivate * d;
|
|
|
|
#if defined(TQ_DISABLE_COPY)
|
|
TQStyle( const TQStyle & );
|
|
TQStyle& operator=( const TQStyle & );
|
|
#endif
|
|
};
|
|
|
|
#endif // TQT_NO_STYLE
|
|
#endif // TQSTYLE_H
|
|
#endif // USE_QT4
|