@ -147,6 +147,7 @@ static TQString TQButton_static_string("TQButton");
static TQString TQTabBar_static_string ( " TQTabBar " ) ;
static TQString TQTitleBar_static_string ( " TQTitleBar " ) ;
static TQString TQToolBox_static_string ( " TQToolBox " ) ;
static TQString TQToolBar_static_string ( " TQToolBar " ) ;
static TQString TQProgressBar_static_string ( " TQProgressBar " ) ;
static TQString TQPopupMenu_static_string ( " TQPopupMenu " ) ;
static TQString TQComboBox_static_string ( " TQComboBox " ) ;
@ -159,17 +160,48 @@ static TQString TQDialogButtons_static_string("TQDialogButtons");
static TQString TQSpinWidget_static_string ( " TQSpinWidget " ) ;
static TQString TQListView_static_string ( " TQListView " ) ;
static TQString TQDockWindow_static_string ( " TQDockWindow " ) ;
static TQString TQTabWidget_static_string ( " TQTabWidget " ) ;
static TQString TQFrame_static_string ( " TQFrame " ) ;
static TQString TQWidget_static_string ( " TQWidget " ) ;
static TQStyleControlElementData * TQStyleControlElementData_null = NULL ;
# include <ntqmetaobject.h>
// Keep in sync with duplicate definition in qobject.cpp
class TQStyleControlElementDataPrivate {
public :
bool isTQPushButton ;
bool isTQToolButton ;
bool isTQButton ;
bool isTQTabBar ;
bool isTQTitleBar ;
bool isTQToolBox ;
bool isTQToolBar ;
bool isTQProgressBar ;
bool isTQPopupMenu ;
bool isTQComboBox ;
bool isTQCheckBox ;
bool isTQRadioButton ;
bool isTQHeader ;
bool isTQScrollBar ;
bool isTQSlider ;
bool isTQDialogButtons ;
bool isTQSpinWidget ;
bool isTQListView ;
bool isTQDockWindow ;
bool isTQTabWidget ;
bool isTQFrame ;
bool isTQWidget ;
} ;
TQStringList getObjectTypeListForObject ( const TQObject * object ) {
TQStringList objectTypes ;
if ( object ) {
TQMetaObject * objectMetaObject = object - > metaObject ( ) ;
const char * name ;
while ( objectMetaObject ) {
name = objectMetaObject - > className ( ) ;
objectTypes . append ( TQString ( name ) ) ;
@ -180,12 +212,54 @@ TQStringList getObjectTypeListForObject(const TQObject* object) {
return objectTypes ;
}
TQStyle : : ControlElementFlags getControlElementFlagsForObject ( const TQObject * object , TQStringList objectTypeList , const TQStyleOption & opt , bool populateReliantFields ) {
void determineObjectTypes ( const TQObject * object , TQStyleControlElementData & ceData , TQStyleControlElementDataPrivate * ceDataPrivate ) {
ceData . widgetObjectTypes = getObjectTypeListForObject ( object ) ;
// Increase speed on repeated calls by checking object types here and caching them
ceDataPrivate - > isTQPushButton = ceData . widgetObjectTypes . containsYesNo ( TQPushButton_static_string ) ;
ceDataPrivate - > isTQToolButton = ceData . widgetObjectTypes . containsYesNo ( TQToolButton_static_string ) ;
ceDataPrivate - > isTQButton = ceData . widgetObjectTypes . containsYesNo ( TQButton_static_string ) ;
ceDataPrivate - > isTQTabBar = ceData . widgetObjectTypes . containsYesNo ( TQTabBar_static_string ) ;
ceDataPrivate - > isTQTitleBar = ceData . widgetObjectTypes . containsYesNo ( TQTitleBar_static_string ) ;
ceDataPrivate - > isTQToolBox = ceData . widgetObjectTypes . containsYesNo ( TQToolBox_static_string ) ;
ceDataPrivate - > isTQToolBar = ceData . widgetObjectTypes . containsYesNo ( TQToolBar_static_string ) ;
ceDataPrivate - > isTQProgressBar = ceData . widgetObjectTypes . containsYesNo ( TQProgressBar_static_string ) ;
ceDataPrivate - > isTQPopupMenu = ceData . widgetObjectTypes . containsYesNo ( TQPopupMenu_static_string ) ;
ceDataPrivate - > isTQComboBox = ceData . widgetObjectTypes . containsYesNo ( TQComboBox_static_string ) ;
ceDataPrivate - > isTQCheckBox = ceData . widgetObjectTypes . containsYesNo ( TQCheckBox_static_string ) ;
ceDataPrivate - > isTQRadioButton = ceData . widgetObjectTypes . containsYesNo ( TQRadioButton_static_string ) ;
ceDataPrivate - > isTQHeader = ceData . widgetObjectTypes . containsYesNo ( TQHeader_static_string ) ;
ceDataPrivate - > isTQScrollBar = ceData . widgetObjectTypes . containsYesNo ( TQScrollBar_static_string ) ;
ceDataPrivate - > isTQSlider = ceData . widgetObjectTypes . containsYesNo ( TQSlider_static_string ) ;
ceDataPrivate - > isTQDialogButtons = ceData . widgetObjectTypes . containsYesNo ( TQDialogButtons_static_string ) ;
ceDataPrivate - > isTQSpinWidget = ceData . widgetObjectTypes . containsYesNo ( TQSpinWidget_static_string ) ;
ceDataPrivate - > isTQListView = ceData . widgetObjectTypes . containsYesNo ( TQListView_static_string ) ;
ceDataPrivate - > isTQDockWindow = ceData . widgetObjectTypes . containsYesNo ( TQDockWindow_static_string ) ;
ceDataPrivate - > isTQTabWidget = ceData . widgetObjectTypes . containsYesNo ( TQTabWidget_static_string ) ;
ceDataPrivate - > isTQFrame = ceData . widgetObjectTypes . containsYesNo ( TQFrame_static_string ) ;
ceDataPrivate - > isTQWidget = ceData . widgetObjectTypes . containsYesNo ( TQWidget_static_string ) ;
}
void updateObjectTypeListIfNeeded ( const TQObject * object ) {
TQStyleControlElementData & ceData = * ( const_cast < TQObject * > ( object ) - > controlElementDataObject ( ) ) ;
TQStyleControlElementDataPrivate * ceDataPrivate = const_cast < TQObject * > ( object ) - > controlElementDataPrivateObject ( ) ;
// This is much faster than (ceData.widgetObjectTypes[0] != TQString(object->metaObject()->className())) due to TQString constructor/destructor overhead
// Casting to const also increases speed by preventing unneeded calls to detach()
if ( ( ceData . widgetObjectTypes . isEmpty ( ) ) | | ( strcmp ( const_cast < const TQStringList & > ( ceData . widgetObjectTypes ) [ 0 ] . ascii ( ) , object - > metaObject ( ) - > className ( ) ) ! = 0 ) ) {
determineObjectTypes ( object , ceData , ceDataPrivate ) ;
}
}
TQStyle : : ControlElementFlags getControlElementFlagsForObject ( const TQObject * object , const TQStyleOption & opt , bool populateReliantFields ) {
TQStyle : : ControlElementFlags cef = TQStyle : : CEF_None ;
if ( object ) {
if ( objectTypeList . contains ( TQPushButton_static_string ) ) {
const TQPushButton * button = dynamic_cast < const TQPushButton * > ( object ) ;
TQStyleControlElementDataPrivate * ceDataPrivate = const_cast < TQObject * > ( object ) - > controlElementDataPrivateObject ( ) ;
updateObjectTypeListIfNeeded ( object ) ;
if ( ceDataPrivate - > isTQPushButton ) {
const TQPushButton * button = static_cast < const TQPushButton * > ( object ) ;
if ( button ) {
if ( button - > isDefault ( ) ) cef = cef | TQStyle : : CEF_IsDefault ;
if ( button - > autoDefault ( ) ) cef = cef | TQStyle : : CEF_AutoDefault ;
@ -194,8 +268,8 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if ( button - > isFlat ( ) ) cef = cef | TQStyle : : CEF_IsFlat ;
}
}
if ( objectTypeList. contains ( TQToolButton_static_string ) ) {
const TQToolButton * button = dynam ic_cast< const TQToolButton * > ( object ) ;
if ( ceDataPrivate- > isTQToolButton ) {
const TQToolButton * button = stat ic_cast< const TQToolButton * > ( object ) ;
if ( button ) {
if ( button - > isToggleButton ( ) ) cef = cef | TQStyle : : CEF_BiState ;
if ( button - > usesTextLabel ( ) ) cef = cef | TQStyle : : CEF_UsesTextLabel ;
@ -203,65 +277,67 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if ( button - > popup ( ) ) cef = cef | TQStyle : : CEF_HasPopupMenu ;
}
}
if ( objectTypeList. contains ( TQButton_static_string ) ) {
const TQButton * button = dynam ic_cast< const TQButton * > ( object ) ;
if ( ceDataPrivate- > isTQButton ) {
const TQButton * button = stat ic_cast< const TQButton * > ( object ) ;
if ( button ) {
if ( button - > isDown ( ) ) cef = cef | TQStyle : : CEF_IsDown ;
if ( button - > isOn ( ) ) cef = cef | TQStyle : : CEF_IsOn ;
if ( button - > isToggleButton ( ) ) cef = cef | TQStyle : : CEF_BiState ;
}
}
if ( objectTypeList. contains ( TQTabBar_static_string ) ) {
const TQTabBar * tb = dynam ic_cast< const TQTabBar * > ( object ) ;
if ( ceDataPrivate- > isTQTabBar ) {
const TQTabBar * tb = stat ic_cast< const TQTabBar * > ( object ) ;
TQTab * t = opt . tab ( ) ;
if ( ( t ) & & ( tb ) ) {
if ( t - > identifier ( ) = = tb - > currentTab ( ) ) cef = cef | TQStyle : : CEF_IsActive ;
}
}
if ( objectTypeList. contains ( TQTitleBar_static_string ) ) {
const TQTitleBar * tb = dynam ic_cast< const TQTitleBar * > ( object ) ;
if ( ceDataPrivate- > isTQTitleBar ) {
const TQTitleBar * tb = stat ic_cast< const TQTitleBar * > ( object ) ;
if ( tb ) {
if ( tb - > isActive ( ) ) cef = cef | TQStyle : : CEF_IsActive ;
}
}
if ( objectTypeList. contains ( TQToolBox_static_string ) ) {
const TQToolBox * tb = dynam ic_cast< const TQToolBox * > ( object ) ;
if ( ceDataPrivate- > isTQToolBox ) {
const TQToolBox * tb = stat ic_cast< const TQToolBox * > ( object ) ;
if ( tb ) {
if ( ! tb - > currentItem ( ) ) cef = cef | TQStyle : : CEF_IsContainerEmpty ;
}
}
if ( objectTypeList. contains ( TQProgressBar_static_string ) ) {
const TQProgressBar * pb = dynam ic_cast< const TQProgressBar * > ( object ) ;
if ( ceDataPrivate- > isTQProgressBar ) {
const TQProgressBar * pb = stat ic_cast< const TQProgressBar * > ( object ) ;
if ( pb ) {
if ( pb - > centerIndicator ( ) ) cef = cef | TQStyle : : CEF_CenterIndicator ;
if ( pb - > indicatorFollowsStyle ( ) ) cef = cef | TQStyle : : CEF_IndicatorFollowsStyle ;
}
}
if ( objectTypeList. contains ( TQPopupMenu_static_string ) ) {
const TQPopupMenu * pm = dynam ic_cast< const TQPopupMenu * > ( object ) ;
if ( ceDataPrivate- > isTQPopupMenu ) {
const TQPopupMenu * pm = stat ic_cast< const TQPopupMenu * > ( object ) ;
if ( pm ) {
if ( pm - > isCheckable ( ) ) cef = cef | TQStyle : : CEF_IsCheckable ;
}
}
if ( objectTypeList. contains ( TQComboBox_static_string ) ) {
const TQComboBox * cb = dynam ic_cast< const TQComboBox * > ( object ) ;
if ( ceDataPrivate- > isTQComboBox ) {
const TQComboBox * cb = stat ic_cast< const TQComboBox * > ( object ) ;
if ( cb ) {
if ( cb - > editable ( ) ) cef = cef | TQStyle : : CEF_IsEditable ;
}
}
// Generic flags
const TQWidget * widget = dynamic_cast < const TQWidget * > ( object ) ;
if ( widget ) {
if ( widget - > isEnabled ( ) ) cef = cef | TQStyle : : CEF_IsEnabled ;
if ( widget - > parentWidget ( ) ) cef = cef | TQStyle : : CEF_HasParentWidget ;
if ( widget - > focusProxy ( ) ) cef = cef | TQStyle : : CEF_HasFocusProxy ;
if ( widget - > hasFocus ( ) ) cef = cef | TQStyle : : CEF_HasFocus ;
if ( widget - > hasMouse ( ) ) cef = cef | TQStyle : : CEF_HasMouse ;
if ( populateReliantFields ) {
if ( widget - > isActiveWindow ( ) ) cef = cef | TQStyle : : CEF_IsActiveWindow ;
if ( widget - > isTopLevel ( ) ) cef = cef | TQStyle : : CEF_IsTopLevel ;
if ( widget - > isVisible ( ) ) cef = cef | TQStyle : : CEF_IsVisible ;
if ( widget - > isShown ( ) ) cef = cef | TQStyle : : CEF_IsShown ;
if ( ceDataPrivate - > isTQWidget ) {
const TQWidget * widget = static_cast < const TQWidget * > ( object ) ;
if ( widget ) {
if ( widget - > isEnabled ( ) ) cef = cef | TQStyle : : CEF_IsEnabled ;
if ( widget - > parentWidget ( ) ) cef = cef | TQStyle : : CEF_HasParentWidget ;
if ( widget - > focusProxy ( ) ) cef = cef | TQStyle : : CEF_HasFocusProxy ;
if ( widget - > hasFocus ( ) ) cef = cef | TQStyle : : CEF_HasFocus ;
if ( widget - > hasMouse ( ) ) cef = cef | TQStyle : : CEF_HasMouse ;
if ( populateReliantFields ) {
if ( widget - > isActiveWindow ( ) ) cef = cef | TQStyle : : CEF_IsActiveWindow ;
if ( widget - > isTopLevel ( ) ) cef = cef | TQStyle : : CEF_IsTopLevel ;
if ( widget - > isVisible ( ) ) cef = cef | TQStyle : : CEF_IsVisible ;
if ( widget - > isShown ( ) ) cef = cef | TQStyle : : CEF_IsShown ;
}
}
}
}
@ -272,16 +348,18 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
return cef ;
}
TQStyleControlElementData populateControlElementDataFromWidget( const TQWidget * widget , const TQStyleOption & opt , bool populateReliantFields ) {
const TQStyleControlElementData & populateControlElementDataFromWidget( const TQWidget * widget , const TQStyleOption & opt , bool populateReliantFields ) {
return populateControlElementDataFromWidget ( widget , opt , populateReliantFields , false ) ;
}
TQStyleControlElementData populateControlElementDataFromWidget ( const TQWidget * widget , const TQStyleOption & opt , bool populateReliantFields , bool populateMinimumNumberOfFields ) {
TQStyleControlElementData ceData ;
const TQStyleControlElementData & populateControlElementDataFromWidget ( const TQWidget * widget , const TQStyleOption & opt , bool populateReliantFields , bool populateMinimumNumberOfFields ) {
if ( widget ) {
TQStyleControlElementData & ceData = * ( const_cast < TQWidget * > ( widget ) - > controlElementDataObject ( ) ) ;
TQStyleControlElementDataPrivate * ceDataPrivate = const_cast < TQWidget * > ( widget ) - > controlElementDataPrivateObject ( ) ;
ceData . isNull = false ;
ceData . widgetObjectTypes = getObjectTypeListForObject ( widget ) ;
updateObjectTypeListIfNeeded ( widget ) ;
ceData . allDataPopulated = populateReliantFields & populateMinimumNumberOfFields ;
if ( ! populateMinimumNumberOfFields ) {
const TQPixmap * erasePixmap = widget - > backgroundPixmap ( ) ;
@ -316,8 +394,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . name = widget - > name ( ) ;
ceData . caption = widget - > caption ( ) ;
if ( ! populateMinimumNumberOfFields ) {
if ( ceData . widgetObjectTypes . contains ( TQPushButton_static_string ) ) {
const TQPushButton * button = dynam ic_cast< const TQPushButton * > ( widget ) ;
if ( ceData Private- > isTQPushButton ) {
const TQPushButton * button = stat ic_cast< const TQPushButton * > ( widget ) ;
if ( button ) {
TQIconSet * iconSet = 0 ;
const TQPixmap * fgPixmap = 0 ;
@ -331,8 +409,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQToolButton_static_string ) ) {
const TQToolButton * button = dynam ic_cast< const TQToolButton * > ( widget ) ;
if ( ceData Private- > isTQToolButton ) {
const TQToolButton * button = stat ic_cast< const TQToolButton * > ( widget ) ;
if ( button ) {
const TQPixmap * fgPixmap = 0 ;
ceData . iconSet = button - > iconSet ( ) ;
@ -345,8 +423,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . popupDelay = button - > popupDelay ( ) ;
}
}
if ( ceData . widgetObjectTypes . contains ( TQCheckBox_static_string ) ) {
const TQCheckBox * button = dynam ic_cast< const TQCheckBox * > ( widget ) ;
if ( ceData Private- > isTQCheckBox ) {
const TQCheckBox * button = stat ic_cast< const TQCheckBox * > ( widget ) ;
if ( button ) {
const TQPixmap * fgPixmap = 0 ;
fgPixmap = button - > pixmap ( ) ;
@ -355,8 +433,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQRadioButton_static_string ) ) {
const TQRadioButton * button = dynam ic_cast< const TQRadioButton * > ( widget ) ;
if ( ceData Private- > isTQRadioButton ) {
const TQRadioButton * button = stat ic_cast< const TQRadioButton * > ( widget ) ;
if ( button ) {
const TQPixmap * fgPixmap = 0 ;
fgPixmap = button - > pixmap ( ) ;
@ -365,8 +443,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQButton_static_string ) ) {
const TQButton * button = dynam ic_cast< const TQButton * > ( widget ) ;
if ( ceData Private- > isTQButton ) {
const TQButton * button = stat ic_cast< const TQButton * > ( widget ) ;
if ( button ) {
ceData . text = button - > text ( ) ;
const TQPixmap * paletteBgPixmap = 0 ;
@ -376,8 +454,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQTabBar_static_string ) ) {
const TQTabBar * tb = dynam ic_cast< const TQTabBar * > ( widget ) ;
if ( ceData Private- > isTQTabBar ) {
const TQTabBar * tb = stat ic_cast< const TQTabBar * > ( widget ) ;
if ( tb ) {
ceData . tabBarData . tabCount = tb - > count ( ) ;
ceData . tabBarData . currentTabIndex = tb - > currentTab ( ) ;
@ -390,33 +468,38 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . tabBarData . identIndexMap [ currentTab - > identifier ( ) ] = tb - > indexOf ( currentTab - > identifier ( ) ) ;
}
}
const TQTabWidget * tw = dynamic_cast < const TQTabWidget * > ( tb - > parent ( ) ) ;
if ( tw ) {
updateObjectTypeListIfNeeded ( tb - > parent ( ) ) ;
if ( ( const_cast < TQObject * > ( tb - > parent ( ) ) - > controlElementDataPrivateObject ( ) ) - > isTQTabWidget ) {
const TQTabWidget * tw = static_cast < const TQTabWidget * > ( tb - > parent ( ) ) ;
TQWidget * cw ;
cw = tw - > cornerWidget ( TQt : : TopLeft ) ;
if ( cw ) {
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopLeft ] . widgetObjectTypes = getObjectTypeListForObject ( cw ) ;
if ( cw ) {
updateObjectTypeListIfNeeded ( cw ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopLeft ] . widgetObjectTypes = ( const_cast < TQWidget * > ( cw ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopLeft ] . geometry = cw - > geometry ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopLeft ] . rect = cw - > rect ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopLeft ] . pos = cw - > pos ( ) ;
}
cw = tw - > cornerWidget ( TQt : : TopRight ) ;
if ( cw ) {
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopRight ] . widgetObjectTypes = getObjectTypeListForObject ( cw ) ;
if ( cw ) {
updateObjectTypeListIfNeeded ( cw ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopRight ] . widgetObjectTypes = ( const_cast < TQWidget * > ( cw ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopRight ] . geometry = cw - > geometry ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopRight ] . rect = cw - > rect ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_TopRight ] . pos = cw - > pos ( ) ;
}
cw = tw - > cornerWidget ( TQt : : BottomLeft ) ;
if ( cw ) {
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomLeft ] . widgetObjectTypes = getObjectTypeListForObject ( cw ) ;
if ( cw ) {
updateObjectTypeListIfNeeded ( cw ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomLeft ] . widgetObjectTypes = ( const_cast < TQWidget * > ( cw ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomLeft ] . geometry = cw - > geometry ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomLeft ] . rect = cw - > rect ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomLeft ] . pos = cw - > pos ( ) ;
}
cw = tw - > cornerWidget ( TQt : : BottomRight ) ;
if ( cw ) {
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomRight ] . widgetObjectTypes = getObjectTypeListForObject ( cw ) ;
if ( cw ) {
updateObjectTypeListIfNeeded ( cw ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomRight ] . widgetObjectTypes = ( const_cast < TQWidget * > ( cw ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomRight ] . geometry = cw - > geometry ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomRight ] . rect = cw - > rect ( ) ;
ceData . tabBarData . cornerWidgets [ TQStyleControlElementTabBarData : : CWL_BottomRight ] . pos = cw - > pos ( ) ;
@ -424,8 +507,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQToolBox_static_string ) ) {
const TQToolBox * tb = dynam ic_cast< const TQToolBox * > ( widget ) ;
if ( ceData Private- > isTQToolBox ) {
const TQToolBox * tb = stat ic_cast< const TQToolBox * > ( widget ) ;
if ( tb ) {
const TQWidget * currentItem = tb - > currentItem ( ) ;
if ( currentItem ) {
@ -433,8 +516,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQProgressBar_static_string ) ) {
const TQProgressBar * pb = dynam ic_cast< const TQProgressBar * > ( widget ) ;
if ( ceData Private- > isTQProgressBar ) {
const TQProgressBar * pb = stat ic_cast< const TQProgressBar * > ( widget ) ;
if ( pb ) {
ceData . currentStep = pb - > progress ( ) ;
ceData . totalSteps = pb - > totalSteps ( ) ;
@ -443,8 +526,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . orientation = pb - > orientation ( ) ;
}
}
if ( ceData . widgetObjectTypes . contains ( TQHeader_static_string ) ) {
const TQHeader * header = dynam ic_cast< const TQHeader * > ( widget ) ;
if ( ceData Private- > isTQHeader ) {
const TQHeader * header = stat ic_cast< const TQHeader * > ( widget ) ;
if ( header ) {
int section = opt . headerSection ( ) ;
TQIconSet * iconSet = 0 ;
@ -456,8 +539,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
// Complex Controls
if ( ceData . widgetObjectTypes . contains ( TQScrollBar_static_string ) ) {
const TQScrollBar * sb = dynam ic_cast< const TQScrollBar * > ( widget ) ;
if ( ceData Private- > isTQScrollBar ) {
const TQScrollBar * sb = stat ic_cast< const TQScrollBar * > ( widget ) ;
if ( sb ) {
ceData . orientation = sb - > orientation ( ) ;
ceData . minSteps = sb - > minValue ( ) ;
@ -471,8 +554,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQSlider_static_string ) ) {
const TQSlider * sl = dynam ic_cast< const TQSlider * > ( widget ) ;
if ( ceData Private- > isTQSlider ) {
const TQSlider * sl = stat ic_cast< const TQSlider * > ( widget ) ;
if ( sl ) {
ceData . orientation = sl - > orientation ( ) ;
ceData . minSteps = sl - > minValue ( ) ;
@ -488,8 +571,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQDialogButtons_static_string ) ) {
const TQDialogButtons * dlgbtns = dynam ic_cast< const TQDialogButtons * > ( widget ) ;
if ( ceData Private- > isTQDialogButtons ) {
const TQDialogButtons * dlgbtns = stat ic_cast< const TQDialogButtons * > ( widget ) ;
if ( dlgbtns ) {
ceData . orientation = dlgbtns - > orientation ( ) ;
ceData . dlgVisibleButtons = dlgbtns - > visibleButtons ( ) ;
@ -499,11 +582,11 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . dlgVisibleSizeHints [ btns [ i ] ] = dlgbtns - > sizeHint ( btns [ i ] ) ;
}
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQTitleBar_static_string ) ) {
const TQTitleBar * tb = dynam ic_cast< const TQTitleBar * > ( widget ) ;
if ( ceData Private- > isTQTitleBar ) {
const TQTitleBar * tb = stat ic_cast< const TQTitleBar * > ( widget ) ;
if ( tb ) {
ceData . titleBarData . hasWindow = ! ! ( tb - > window ( ) ) ;
if ( populateReliantFields ) {
@ -515,8 +598,8 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . titleBarData . visibleText = tb - > visibleText ( ) ;
}
}
if ( ceData . widgetObjectTypes . contains ( TQSpinWidget_static_string ) ) {
const TQSpinWidget * sw = dynam ic_cast< const TQSpinWidget * > ( widget ) ;
if ( ceData Private- > isTQSpinWidget ) {
const TQSpinWidget * sw = stat ic_cast< const TQSpinWidget * > ( widget ) ;
if ( sw ) {
ceData . spinWidgetData . buttonSymbols = sw - > buttonSymbols ( ) ;
ceData . spinWidgetData . upRect = sw - > upRect ( ) ;
@ -525,14 +608,15 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . spinWidgetData . downEnabled = sw - > isDownEnabled ( ) ;
}
}
if ( ceData . widgetObjectTypes . contains ( TQListView_static_string ) ) {
const TQListView * lv = dynam ic_cast< const TQListView * > ( widget ) ;
if ( ceData Private- > isTQListView ) {
const TQListView * lv = stat ic_cast< const TQListView * > ( widget ) ;
if ( lv ) {
ceData . listViewData . rootDecorated = lv - > rootIsDecorated ( ) ;
ceData . listViewData . itemMargin = lv - > itemMargin ( ) ;
TQWidget * viewport = lv - > viewport ( ) ;
if ( viewport ) {
ceData . viewportData . widgetObjectTypes = getObjectTypeListForObject ( viewport ) ;
updateObjectTypeListIfNeeded ( viewport ) ;
ceData . viewportData . widgetObjectTypes = ( const_cast < TQWidget * > ( viewport ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . viewportData . allDataPopulated = populateReliantFields & populateMinimumNumberOfFields ;
const TQPixmap * erasePixmap = viewport - > backgroundPixmap ( ) ;
if ( erasePixmap ) {
@ -567,29 +651,31 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQComboBox_static_string ) ) {
const TQComboBox * cb = dynam ic_cast< const TQComboBox * > ( widget ) ;
if ( ceData Private- > isTQComboBox ) {
const TQComboBox * cb = stat ic_cast< const TQComboBox * > ( widget ) ;
if ( cb ) {
const TQLineEdit * lineEdit = cb - > lineEdit ( ) ;
if ( lineEdit ) {
ceData . comboBoxLineEditFlags = getControlElementFlagsForObject ( lineEdit , ceData. widgetObjectTypes , TQStyleOption: : Default ) ;
ceData . comboBoxLineEditFlags = getControlElementFlagsForObject ( lineEdit , TQStyleOption: : Default ) ;
}
const TQListBox * listBox = cb - > listBox ( ) ;
if ( listBox ) {
ceData . comboBoxListBoxFlags = getControlElementFlagsForObject ( listBox , ceData. widgetObjectTypes , TQStyleOption: : Default ) ;
ceData . comboBoxListBoxFlags = getControlElementFlagsForObject ( listBox , TQStyleOption: : Default ) ;
}
}
}
if ( ceData . widgetObjectTypes . contains ( TQFrame_static_string ) ) {
const TQFrame * frame = dynam ic_cast< const TQFrame * > ( widget ) ;
if ( ceData Private- > isTQFrame ) {
const TQFrame * frame = stat ic_cast< const TQFrame * > ( widget ) ;
if ( frame ) {
ceData . frameStyle = frame - > frameStyle ( ) ;
}
}
const TQWidget * parentWidget = widget - > parentWidget ( ) ;
if ( parentWidget ) {
ceData . parentWidgetData . widgetObjectTypes = getObjectTypeListForObject ( parentWidget ) ;
updateObjectTypeListIfNeeded ( parentWidget ) ;
ceData . parentWidgetData . widgetObjectTypes = ( const_cast < TQWidget * > ( parentWidget ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
TQStyleControlElementDataPrivate * parentWidgetCEDataPrivate = const_cast < TQWidget * > ( parentWidget ) - > controlElementDataPrivateObject ( ) ;
ceData . parentWidgetData . allDataPopulated = populateReliantFields & populateMinimumNumberOfFields ;
const TQPixmap * erasePixmap = parentWidget - > backgroundPixmap ( ) ;
if ( erasePixmap ) {
@ -621,9 +707,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . parentWidgetData . font = parentWidget - > font ( ) ;
ceData . parentWidgetData . name = parentWidget - > name ( ) ;
ceData . parentWidgetData . caption = parentWidget - > caption ( ) ;
const TQDockWindow * dw = dynamic_cast < const TQDockWindow * > ( parentWidget ) ;
if ( dw ) {
if ( parentWidgetCEDataPrivate - > isTQDockWindow ) {
const TQDockWindow * dw = static_cast < const TQDockWindow * > ( parentWidget ) ;
if ( dw - > area ( ) ) {
ceData . dwData . hasDockArea = true ;
ceData . dwData . areaOrientation = dw - > area ( ) - > orientation ( ) ;
@ -633,15 +719,17 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
ceData . dwData . closeEnabled = dw - > isCloseEnabled ( ) ;
}
const TQToolBar * toolbar = dynamic_cast < const TQToolBar * > ( parentWidget ) ;
if ( toolbar ) {
if ( parentWidgetCEDataPrivate - > isTQToolBar ) {
const TQToolBar * toolbar = static_cast < const TQToolBar * > ( parentWidget ) ;
ceData . toolBarData . orientation = toolbar - > orientation ( ) ;
}
ceData . parentWidgetFlags = getControlElementFlagsForObject ( parentWidget , ceData. parentWidgetData . widgetObjectTypes , TQStyleOption: : Default , populateReliantFields ) ;
ceData . parentWidgetFlags = getControlElementFlagsForObject ( parentWidget , TQStyleOption: : Default , populateReliantFields ) ;
}
const TQWidget * topLevelWidget = widget - > topLevelWidget ( ) ;
if ( topLevelWidget ) {
ceData . topLevelWidgetData . widgetObjectTypes = getObjectTypeListForObject ( topLevelWidget ) ;
updateObjectTypeListIfNeeded ( topLevelWidget ) ;
ceData . topLevelWidgetData . widgetObjectTypes = ( const_cast < TQWidget * > ( topLevelWidget ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
TQStyleControlElementDataPrivate * topLevelWidgetCEDataPrivate = const_cast < TQWidget * > ( topLevelWidget ) - > controlElementDataPrivateObject ( ) ;
ceData . topLevelWidgetData . allDataPopulated = populateReliantFields & populateMinimumNumberOfFields ;
const TQPixmap * erasePixmap = topLevelWidget - > backgroundPixmap ( ) ;
if ( erasePixmap ) {
@ -673,9 +761,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . topLevelWidgetData . font = topLevelWidget - > font ( ) ;
ceData . topLevelWidgetData . name = topLevelWidget - > name ( ) ;
ceData . topLevelWidgetData . caption = topLevelWidget - > caption ( ) ;
const TQDockWindow * dw = dynamic_cast < const TQDockWindow * > ( topLevelWidget ) ;
if ( dw ) {
if ( topLevelWidgetCEDataPrivate - > isTQDockWindow ) {
const TQDockWindow * dw = static_cast < const TQDockWindow * > ( topLevelWidget ) ;
if ( dw - > area ( ) ) {
ceData . dwData . hasDockArea = true ;
ceData . dwData . areaOrientation = dw - > area ( ) - > orientation ( ) ;
@ -685,13 +773,13 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
}
ceData . dwData . closeEnabled = dw - > isCloseEnabled ( ) ;
}
const TQToolBar * toolbar = dynamic_cast < const TQToolBar * > ( topLevelWidget ) ;
if ( toolbar ) {
if ( topLevelWidgetCEDataPrivate - > isTQToolBar ) {
const TQToolBar * toolbar = static_cast < const TQToolBar * > ( topLevelWidget ) ;
ceData . toolBarData . orientation = toolbar - > orientation ( ) ;
}
ceData . topLevelWidgetFlags = getControlElementFlagsForObject ( topLevelWidget , ceData. topLevelWidgetData . widgetObjectTypes , TQStyleOption: : Default , populateReliantFields ) ;
ceData . topLevelWidgetFlags = getControlElementFlagsForObject ( topLevelWidget , TQStyleOption: : Default , populateReliantFields ) ;
}
TQCheckListItem * item = opt . checkListItem ( ) ;
if ( item ) {
ceData . checkListItemData . dataValid = true ;
@ -703,16 +791,24 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData . checkListItemData . dataValid = false ;
}
}
}
return ceData ;
return ceData ;
}
else {
if ( ! TQStyleControlElementData_null ) {
TQStyleControlElementData_null = new TQStyleControlElementData ( ) ;
}
TQStyleControlElementData & ceData = * TQStyleControlElementData_null ;
return ceData ;
}
}
TQStyleControlElementData populateControlElementDataFromApplication ( const TQApplication * app , const TQStyleOption & , bool ) {
TQStyleControlElementData ceData ;
const TQStyleControlElementData & populateControlElementDataFromApplication( const TQApplication * app , const TQStyleOption & , bool ) {
TQStyleControlElementData & ceData = * ( const_cast < TQApplication * > ( app ) - > controlElementDataObject ( ) ) ;
if ( app ) {
ceData . widgetObjectTypes = getObjectTypeListForObject ( app ) ;
updateObjectTypeListIfNeeded ( app ) ;
ceData . widgetObjectTypes = ( const_cast < TQApplication * > ( app ) - > controlElementDataObject ( ) ) - > widgetObjectTypes ;
ceData . palette = app - > palette ( ) ;
ceData . font = app - > font ( ) ;
}
@ -1179,7 +1275,7 @@ void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
activePainter = 0 ;
}
void qt_style_erase_region ( TQPainter * p , const TQRegion & region , TQStyleControlElementData ceData ) {
void qt_style_erase_region ( TQPainter * p , const TQRegion & region , const TQStyleControlElementData & ceData ) {
TQRegion reg = region ;
TQPoint offset = ceData . bgOffset ;
@ -2797,7 +2893,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
if ( ceData . wflags & WStyle_Tool ) {
ret = TQMAX ( TQFontMetrics ( ceData . font ) . lineSpacing ( ) , 16 ) ;
# ifndef QT_NO_MAINWINDOW
} else if ( ceData . widgetObjectTypes . contains ( TQDockWindow_static_string ) ) {
} else if ( ceData . widgetObjectTypes . contains YesNo ( TQDockWindow_static_string ) ) {
ret = TQMAX ( TQFontMetrics ( ceData . font ) . lineSpacing ( ) , 13 ) ;
# endif
} else {
@ -2945,7 +3041,7 @@ int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c
# ifndef QT_NO_TABBAR
case PM_TabBarTabVSpace :
{
if ( ceData . widgetObjectTypes . contains ( TQTabBar_static_string ) & & ( ceData . tabBarData . shape = = TQTabBar : : RoundedAbove | |
if ( ceData . widgetObjectTypes . contains YesNo ( TQTabBar_static_string ) & & ( ceData . tabBarData . shape = = TQTabBar : : RoundedAbove | |
ceData . tabBarData . shape = = TQTabBar : : RoundedBelow ) )
ret = 10 ;
else