26 #include <qdebug.h> |
26 #include <qdebug.h> |
27 |
27 |
28 //Qt widgets |
28 //Qt widgets |
29 #include <QtGui/qgroupbox.h> |
29 #include <QtGui/qgroupbox.h> |
30 #include <QtGui/qheaderview.h> |
30 #include <QtGui/qheaderview.h> |
31 #include <QtGui/qlistwidget.h> |
|
32 #include <QtGui/qlistview.h> |
31 #include <QtGui/qlistview.h> |
33 #include <QtGui/qpushbutton.h> |
32 #include <QtGui/qpushbutton.h> |
34 #include <QtGui/qscrollbar.h> |
33 #include <QtGui/qscrollbar.h> |
35 #include <QtGui/qtabbar.h> |
34 #include <QtGui/qtabbar.h> |
36 #include <QtGui/qtableview.h> |
35 #include <QtGui/qtableview.h> |
37 #include <QtGui/qtablewidget.h> |
|
38 #include <QtGui/qtreeview.h> |
36 #include <QtGui/qtreeview.h> |
39 #include <QtGui/qtreewidget.h> |
|
40 #include <QtGui/qtextedit.h> |
37 #include <QtGui/qtextedit.h> |
41 #include <QtGui/qtoolbar.h> |
38 #include <QtGui/qtoolbar.h> |
42 #include <QtGui/qtoolbutton.h> |
39 #include <QtGui/qtoolbutton.h> |
43 #include <QtGui/qradiobutton.h> |
40 #include <QtGui/qradiobutton.h> |
44 #include <QtGui/qcheckbox.h> |
41 #include <QtGui/qcheckbox.h> |
371 } |
364 } |
372 } |
365 } |
373 break; |
366 break; |
374 } |
367 } |
375 case CE_ItemViewItem: { |
368 case CE_ItemViewItem: { |
|
369 //@todo: headerviews and listviews should show selection tick at the beginning of the row (in place of checkbox rect) |
|
370 //@todo: headerview should select also parent when child is selected |
|
371 //@todo: headerview should draw highlight rect |
376 if (const QStyleOptionViewItemV4 *itemOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { |
372 if (const QStyleOptionViewItemV4 *itemOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { |
377 const QRect checkRect = subElementRect(SE_ItemViewItemCheckIndicator, itemOption, widget); |
373 const QRect checkRect = subElementRect(SE_ItemViewItemCheckIndicator, itemOption, widget); |
378 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, itemOption, widget); |
374 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, itemOption, widget); |
379 QRect textRect = subElementRect(SE_ItemViewItemText, itemOption, widget); |
375 QRect textRect = subElementRect(SE_ItemViewItemText, itemOption, widget); |
380 |
376 |
381 //background for list items (other itemviews use PE_PanelItemViewRow drawing) |
377 //background for list items (other itemviews use PE_PanelItemViewRow drawing) |
382 if (qobject_cast<const QListWidget *>(widget)) |
378 if (qobject_cast<const QListView *>(widget)) |
383 proxy()->drawPrimitive(PE_PanelItemViewItem, itemOption, painter, widget); |
379 proxy()->drawPrimitive(PE_PanelItemViewItem, itemOption, painter, widget); |
384 |
380 |
385 //checkbox |
381 //checkbox |
386 if (itemOption->features & QStyleOptionViewItemV2::HasCheckIndicator && checkRect.isValid()) { |
382 if (itemOption->features & QStyleOptionViewItemV2::HasCheckIndicator && checkRect.isValid()) { |
387 QStyleOptionViewItemV4 checkOption; |
383 QStyleOptionViewItemV4 checkOption; |
879 switch (control) { |
875 switch (control) { |
880 #ifndef QT_NO_COMBOBOX |
876 #ifndef QT_NO_COMBOBOX |
881 case CC_ComboBox: { |
877 case CC_ComboBox: { |
882 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { |
878 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { |
883 const QRect cmbxFrame = cmb->rect; |
879 const QRect cmbxFrame = cmb->rect; |
884 ItemStates state = SS_Active; |
880 |
|
881 const bool isDisabled = !(cmb->state & State_Enabled); |
|
882 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active; |
|
883 |
|
884 if (cmb->state & State_Active && |
|
885 cmb->state & State_Enabled && |
|
886 !cmb->state & State_HasFocus && |
|
887 !cmb->state & State_MouseOver && |
|
888 !cmb->state & State_Selected) { |
|
889 state |= SS_Active; |
|
890 } |
|
891 if (cmb->state & State_Active && |
|
892 cmb->state & State_Enabled && |
|
893 cmb->state & State_On && |
|
894 !cmb->state & State_HasFocus && |
|
895 !cmb->state & State_MouseOver && |
|
896 !cmb->state & State_Selected) { |
|
897 state |= SS_Active; |
|
898 } |
|
899 else if (cmb->state & State_Active && |
|
900 cmb->state & State_Enabled && |
|
901 cmb->state & State_HasFocus && |
|
902 cmb->state & State_MouseOver && |
|
903 cmb->state & State_Selected) { |
|
904 state |= SS_Pressed; |
|
905 } |
|
906 else if (cmb->state & State_Active && |
|
907 cmb->state & State_Enabled && |
|
908 cmb->state & State_HasFocus && |
|
909 cmb->state & State_MouseOver) { |
|
910 state |= SS_Pressed; |
|
911 } |
|
912 /* else if (cmb->state & State_Active && |
|
913 cmb->state & State_Enabled && |
|
914 cmb->state & State_Sunken) { |
|
915 state |= SS_Pressed; |
|
916 }*/ |
885 |
917 |
886 // Button frame |
918 // Button frame |
887 QStyleOptionFrame buttonOption; |
919 QStyleOptionFrame buttonOption; |
888 buttonOption.QStyleOption::operator=(*cmb); |
920 buttonOption.QStyleOption::operator=(*cmb); |
889 const int buttonMaxHeight = cmbxFrame.height(); |
921 const int buttonMaxHeight = cmbxFrame.height(); |
890 const int buttonMaxWidth = buttonMaxHeight; //button is rect |
922 const int buttonMaxWidth = buttonMaxHeight; //button is rect |
891 const int topLeftPoint = (cmb->direction == Qt::LeftToRight) ? (cmbxFrame.width() - buttonMaxWidth) : 0; |
923 const int topLeftPoint = (cmb->direction == Qt::LeftToRight) ? (cmbxFrame.width() - buttonMaxWidth) : 0; |
892 |
924 |
893 const QRect buttonRect(topLeftPoint, cmbxFrame.top(), buttonMaxHeight, buttonMaxWidth); |
925 const QRect buttonRect(topLeftPoint, cmbxFrame.top(), buttonMaxHeight, buttonMaxWidth); |
894 buttonOption.rect = buttonRect; |
926 if (cmb->direction == Qt::RightToLeft){ |
895 buttonOption.state = cmb->state; |
927 |
896 ItemStates buttonState = (buttonOption.state & State_Sunken) ? ItemStates(SS_Pressed | SS_Active) : ItemStates(SS_Active); |
928 state |= SS_Mirrored; |
897 if (cmb->direction == Qt::RightToLeft) |
929 } |
898 buttonState |= SS_Mirrored; |
|
899 if (buttonOption.state & State_HasFocus) { |
|
900 buttonState |= SS_Selected; |
|
901 state |= SS_Selected; //set frame status to follow button status for highlight |
|
902 } |
|
903 |
|
904 m_private->drawItem(SP_BoxButton, painter, buttonRect.adjusted(0, 1, 0, -1), buttonState); //@todo: remove magic |
|
905 |
930 |
906 if (cmb->subControls & SC_ComboBoxFrame) { |
931 if (cmb->subControls & SC_ComboBoxFrame) { |
907 const bool isDisabled = !(cmb->state & State_Enabled); |
932 |
908 const bool isPressed = (cmb->state & State_Sunken); |
|
909 const bool isEditable = cmb->editable; |
|
910 |
|
911 if (isDisabled) |
|
912 state = SS_Disabled; |
|
913 else if (isPressed) |
|
914 state |= SS_Pressed; |
|
915 if (isEditable) |
|
916 state |= SS_Edited; |
|
917 QRect frameRect = QRect(cmb->rect); |
933 QRect frameRect = QRect(cmb->rect); |
918 int frameWidth = pixelMetric(PM_DefaultFrameWidth); |
934 int frameWidth = pixelMetric(PM_DefaultFrameWidth); |
919 int maxRight = cmb->rect.height() - 2 * frameWidth; |
935 int maxRight = cmb->rect.height() - 2 * frameWidth; |
920 frameRect.adjust(0, 0, -maxRight, 0); |
936 frameRect.adjust(0, 0, -maxRight, 0); |
921 int adjustX = 0; |
937 |
922 if (option->direction == Qt::RightToLeft) { |
|
923 adjustX = buttonOption.rect.topRight().x(); |
|
924 state |= SS_Mirrored; |
|
925 } |
|
926 const QRect frame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget); |
938 const QRect frame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget); |
927 // @todo: if SC_ComboBoxFrame needs adjusting, move that code to subControlRect |
939 //Draw the frame |
928 m_private->drawMultiPartItem(SM_BoxFrame, painter, frame.adjusted(adjustX, 1, -4 + adjustX, -1), state); |
940 m_private->drawMultiPartItem(SM_BoxFrame, painter, frame, state); |
929 } |
941 } |
|
942 //Draw the dropdown button |
|
943 m_private->drawItem(SP_BoxButton, painter, buttonRect, state); //@todo: remove magic |
930 } |
944 } |
931 break; |
945 break; |
932 } |
946 } |
933 #endif //QT_NO_COMBOBOX |
947 #endif //QT_NO_COMBOBOX |
934 #ifndef QT_NO_SLIDER |
948 #ifndef QT_NO_SLIDER |
1006 if (nextInterval < v) |
1020 if (nextInterval < v) |
1007 break; |
1021 break; |
1008 v = nextInterval; |
1022 v = nextInterval; |
1009 } |
1023 } |
1010 } |
1024 } |
1011 QRect filledRect; |
1025 |
1012 if ( horizontal ){ |
1026 QRect filledRect; |
1013 const int sliderPosition = sliderHandle.center().x(); |
1027 QRect filledRectMask; |
1014 const int sliderWidth = sliderHandle.width()/2; |
1028 if ( horizontal ){ |
1015 if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){ |
1029 if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){ |
1016 filledRect = QRect(sliderGroove.x(), sliderGroove.y(), sliderPosition+sliderWidth, sliderGroove.height()); |
1030 filledRect = QRect( sliderGroove.x(), |
1017 } else { |
1031 sliderGroove.y(), |
1018 filledRect = QRect(sliderGroove.x()+sliderPosition-sliderWidth, sliderGroove.y(), sliderGroove.width()-sliderPosition+sliderWidth, sliderGroove.height()); |
1032 qMax(sliderGroove.width()-sliderHandle.right(), sliderHandle.right()), |
1019 } |
1033 sliderGroove.height()); |
1020 } else { |
1034 |
1021 const int sliderPosition = sliderHandle.center().y(); |
1035 int x = qMin(sliderHandle.left(), sliderGroove.x() + sliderGroove.width()-sliderHandle.right()); |
1022 const int sliderHeight = sliderHandle.height()/2; |
1036 filledRectMask = QRect(x, |
1023 if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){ |
1037 sliderGroove.y(), |
1024 filledRect = QRect(sliderGroove.x(), sliderGroove.y()+sliderPosition-sliderHeight, sliderGroove.width(), sliderGroove.height()-sliderPosition+sliderHeight); |
1038 sliderGroove.width()-x, |
1025 } else { |
1039 sliderGroove.height()); |
1026 filledRect = QRect(sliderGroove.x(), sliderGroove.y(), sliderGroove.width(), sliderPosition+sliderHeight); |
1040 } else { |
1027 } |
1041 filledRect = QRect( qMin(sliderGroove.width()-sliderHandle.left(),sliderHandle.left()), |
1028 } |
1042 sliderGroove.y(), |
1029 |
1043 qMax(sliderGroove.width()-sliderHandle.left(), sliderHandle.left()), |
1030 //Groove |
1044 sliderGroove.height()); |
1031 m_private->drawMultiPartItem(SM_SliderGroove, painter, sliderGroove, grooveState); |
1045 |
1032 |
1046 filledRectMask = QRect( sliderGroove.x(), |
1033 //Progress |
1047 sliderGroove.y(), |
1034 m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled); |
1048 qMax(sliderGroove.width()-sliderHandle.right(), sliderHandle.right()), |
1035 |
1049 sliderGroove.height()); |
1036 //handle |
1050 |
|
1051 } |
|
1052 } else { |
|
1053 if (slider && (slider->layoutDirection() == Qt::LeftToRight) ^ slider->invertedAppearance()){ |
|
1054 filledRect = QRect(sliderGroove.x(), |
|
1055 qMin(sliderGroove.height()-sliderHandle.top(), sliderHandle.top()), |
|
1056 sliderGroove.width(), |
|
1057 qMax(sliderGroove.height()-sliderHandle.top(), sliderHandle.top())); |
|
1058 |
|
1059 filledRectMask = QRect(sliderGroove.x(), |
|
1060 sliderGroove.y(), |
|
1061 sliderGroove.width(), |
|
1062 qMax(sliderGroove.height()-sliderHandle.bottom(), sliderHandle.bottom())); |
|
1063 } else { |
|
1064 filledRect = QRect(sliderGroove.x(), |
|
1065 sliderGroove.y(), |
|
1066 sliderGroove.width(), |
|
1067 qMax(sliderGroove.height()-sliderHandle.bottom(),sliderHandle.bottom())); |
|
1068 |
|
1069 int y = qMin(sliderHandle.top(), sliderGroove.y() + sliderGroove.height()-sliderHandle.bottom()); |
|
1070 filledRectMask = QRect( sliderGroove.x(), |
|
1071 y, |
|
1072 sliderGroove.width(), |
|
1073 sliderGroove.height()-y ); |
|
1074 } |
|
1075 } |
|
1076 |
|
1077 if (filledRect.width() < filledRectMask.width() || filledRect.height() < filledRectMask.height()){ |
|
1078 // Progress + groove |
|
1079 m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRect, grooveState ); |
|
1080 m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled); |
|
1081 |
|
1082 // Groove |
|
1083 m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRectMask, grooveState); |
|
1084 } else { |
|
1085 // Groove |
|
1086 m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRectMask, grooveState); |
|
1087 |
|
1088 // Progess + groove |
|
1089 m_private->drawMultiPartItem(SM_SliderGroove, painter, filledRect, grooveState ); |
|
1090 m_private->drawMultiPartItem(SM_SliderProgress, painter, filledRect, grooveState | SS_Filled); |
|
1091 } |
|
1092 |
|
1093 //handle |
1037 m_private->drawItem(SP_SliderHandle, painter, sliderHandle, handleState); |
1094 m_private->drawItem(SP_SliderHandle, painter, sliderHandle, handleState); |
1038 } |
1095 } |
1039 break; |
1096 break; |
1040 } |
1097 } |
1041 #endif //QT_NO_SLIDER |
1098 #endif //QT_NO_SLIDER |
1192 const QRect spinboxFrame = subControlRect(control, optionSpinbox, SC_SpinBoxFrame, widget); |
1249 const QRect spinboxFrame = subControlRect(control, optionSpinbox, SC_SpinBoxFrame, widget); |
1193 const QRect spinboxButtonUpRect = subControlRect(control, optionSpinbox, SC_SpinBoxUp, widget); |
1250 const QRect spinboxButtonUpRect = subControlRect(control, optionSpinbox, SC_SpinBoxUp, widget); |
1194 const QRect spinboxButtonDownRect = subControlRect(control, optionSpinbox, SC_SpinBoxDown, widget); |
1251 const QRect spinboxButtonDownRect = subControlRect(control, optionSpinbox, SC_SpinBoxDown, widget); |
1195 const QRect spinboxEditorRect = subControlRect(control, optionSpinbox, SC_SpinBoxEditField, widget); |
1252 const QRect spinboxEditorRect = subControlRect(control, optionSpinbox, SC_SpinBoxEditField, widget); |
1196 |
1253 |
1197 QStyleOptionSpinBox copy = *optionSpinbox; |
|
1198 |
|
1199 //Frame & background |
1254 //Frame & background |
1200 const bool isDisabled = !(optionSpinbox->state & State_Enabled); |
1255 const bool isDisabled = !(optionSpinbox->state & State_Enabled); |
1201 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active; |
1256 ItemStates state = (isDisabled) ? SS_Disabled : SS_Active; |
1202 if (optionSpinbox->state & State_HasFocus) |
1257 if (optionSpinbox->state & State_HasFocus) |
1203 state |= SS_Selected; |
1258 state |= SS_Selected; |
1204 m_private->drawMultiPartItem(SM_BoxFrame, painter, spinboxEditorRect, state); |
1259 //Draw the rounded border of edit field frame under button, half spin button width |
1205 |
1260 //Label drawn to spinboxEditorRect |
|
1261 m_private->drawMultiPartItem(SM_BoxFrame, painter, spinboxEditorRect.adjusted((-0.5*spinboxButtonDownRect.width()),0,0,0), state); |
|
1262 |
|
1263 |
|
1264 QStyle::State buttonState; |
1206 //Buttons |
1265 //Buttons |
1207 if (optionSpinbox->subControls & SC_SpinBoxUp) { |
1266 if (optionSpinbox->subControls & SC_SpinBoxUp) { |
1208 copy.subControls = SC_SpinBoxUp; |
|
1209 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) |
1267 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) |
1210 copy.state &= ~State_Enabled; |
1268 buttonState &= ~State_Enabled; |
1211 if (optionSpinbox->activeSubControls == SC_SpinBoxUp && (optionSpinbox->state & State_Sunken)) { |
1269 if (optionSpinbox->activeSubControls == SC_SpinBoxUp && (optionSpinbox->state & State_Sunken)) { |
1212 copy.state |= State_On; |
1270 buttonState |= State_On; |
1213 copy.state |= State_Sunken; |
1271 buttonState |= State_Sunken; |
1214 } else { |
1272 } else { |
1215 copy.state |= State_Raised; |
1273 buttonState |= State_Raised; |
1216 copy.state &= ~State_Sunken; |
1274 buttonState &= ~State_Sunken; |
1217 } |
1275 } |
1218 const bool isPressed = (copy.state & State_Sunken); |
1276 const bool isPressed = (buttonState & State_Sunken); |
1219 ItemStates upButtonState = (isPressed) ? ItemStates(SS_Pressed | SS_Active) : ItemStates(SS_Active); |
1277 ItemStates upButtonState = (isPressed) ? ItemStates(SS_Pressed | SS_Active) : ItemStates(SS_Active); |
1220 if (optionSpinbox->direction == Qt::RightToLeft) |
1278 if (optionSpinbox->direction == Qt::RightToLeft) |
1221 upButtonState = upButtonState | SS_Flipped; |
1279 upButtonState = upButtonState | SS_Flipped; |
1222 else |
1280 else |
1223 upButtonState = upButtonState | SS_Flipped | SS_Mirrored; |
1281 upButtonState = upButtonState | SS_Flipped | SS_Mirrored; |
1224 if (optionSpinbox->state & State_HasFocus) |
1282 if (optionSpinbox->state & State_HasFocus) |
1225 upButtonState |= SS_Selected; |
1283 upButtonState |= SS_Selected; |
1226 if (!(copy.state & State_Enabled)) |
1284 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) |
1227 upButtonState |= SS_Disabled; |
1285 upButtonState |= SS_Disabled; |
1228 m_private->drawItem(SP_BoxButton, painter, spinboxButtonUpRect, upButtonState); |
1286 m_private->drawItem(SP_BoxButton, painter, spinboxButtonUpRect, upButtonState); |
1229 } |
1287 } |
1230 |
1288 |
1231 if (optionSpinbox->subControls & SC_SpinBoxDown) { |
1289 if (optionSpinbox->subControls & SC_SpinBoxDown) { |
1232 copy.subControls = SC_SpinBoxDown; |
|
1233 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) |
1290 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) |
1234 copy.state &= ~State_Enabled; |
1291 buttonState &= ~State_Enabled; |
1235 if (optionSpinbox->activeSubControls == SC_SpinBoxDown && (optionSpinbox->state & State_Sunken)) { |
1292 if (optionSpinbox->activeSubControls == SC_SpinBoxDown && (optionSpinbox->state & State_Sunken)) { |
1236 copy.state |= State_On; |
1293 buttonState |= State_On; |
1237 copy.state |= State_Sunken; |
1294 buttonState |= State_Sunken; |
1238 } else { |
1295 } else { |
1239 copy.state |= State_Raised; |
1296 buttonState |= State_Raised; |
1240 copy.state &= ~State_Sunken; |
1297 buttonState &= ~State_Sunken; |
1241 } |
1298 } |
1242 const bool isPressed = (copy.state & State_Sunken); |
1299 const bool isPressed = (buttonState & State_Sunken); |
1243 ItemStates downButtonState = (isPressed) ? ItemStates(SS_Pressed | SS_Active) : ItemStates(SS_Active); |
1300 ItemStates downButtonState = (isPressed) ? ItemStates(SS_Pressed | SS_Active) : ItemStates(SS_Active); |
1244 if (optionSpinbox->direction == Qt::RightToLeft) |
1301 if (optionSpinbox->direction == Qt::RightToLeft) |
1245 downButtonState = downButtonState; |
1302 downButtonState = downButtonState; |
1246 else |
1303 else |
1247 downButtonState = downButtonState | SS_Mirrored; |
1304 downButtonState = downButtonState | SS_Mirrored; |
1248 if (optionSpinbox->state & State_HasFocus) |
1305 if (optionSpinbox->state & State_HasFocus) |
1249 downButtonState |= SS_Selected; |
1306 downButtonState |= SS_Selected; |
1250 if (!(copy.state & State_Enabled)) |
1307 if (!(optionSpinbox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) |
1251 downButtonState |= SS_Disabled; |
1308 downButtonState |= SS_Disabled; |
1252 m_private->drawItem(SP_BoxButton, painter, spinboxButtonDownRect, downButtonState); |
1309 m_private->drawItem(SP_BoxButton, painter, spinboxButtonDownRect, downButtonState); |
1253 } |
1310 } |
1254 } |
1311 } |
1255 break; |
1312 break; |
1299 QRect QHbStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const |
1356 QRect QHbStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const |
1300 { |
1357 { |
1301 const QRect baseSize = QCommonStyle::subElementRect(element, option, widget); |
1358 const QRect baseSize = QCommonStyle::subElementRect(element, option, widget); |
1302 QRect elementSize = baseSize; |
1359 QRect elementSize = baseSize; |
1303 switch (element) { |
1360 switch (element) { |
|
1361 case SE_LineEditContents: { |
|
1362 qreal metric = 0; |
|
1363 m_private->styleManager()->parameter(QLatin1String("hb-param-margin-gene-middle-horizontal"), metric); |
|
1364 const int metricValue = metric + 0.5; |
|
1365 elementSize = visualRect( |
|
1366 option->direction, option->rect, option->rect.adjusted(metricValue, 0, 0, 0)); |
|
1367 } |
|
1368 break; |
1304 case SE_ItemViewItemText: { |
1369 case SE_ItemViewItemText: { |
1305 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
1370 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
1306 elementSize = menuItem->rect; |
1371 elementSize = menuItem->rect; |
1307 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget); |
1372 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget); |
1308 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget); |
1373 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget); |
1314 totalXMod += indicatorSpacing; |
1379 totalXMod += indicatorSpacing; |
1315 elementSize.translate(totalXMod, 0); |
1380 elementSize.translate(totalXMod, 0); |
1316 elementSize.setWidth(menuItem->rect.width() - widthMod); |
1381 elementSize.setWidth(menuItem->rect.width() - widthMod); |
1317 } else if (const QStyleOptionViewItemV4 *itemView = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { |
1382 } else if (const QStyleOptionViewItemV4 *itemView = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { |
1318 elementSize = itemView->rect; |
1383 elementSize = itemView->rect; |
1319 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget); |
1384 if (itemView->decorationPosition == QStyleOptionViewItem::Left || |
1320 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget); |
1385 itemView->decorationPosition == QStyleOptionViewItem::Right) { |
1321 const int indicatorSpacing = proxy()->pixelMetric(PM_LayoutHorizontalSpacing, option, widget); |
1386 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget); |
1322 int totalXMod = qMax(0, qMax((checkBoxRect.isValid() ? checkBoxRect.topRight().x() : 0), |
1387 const QRect checkBoxRect = subElementRect(SE_ViewItemCheckIndicator, option, widget); |
1323 (iconRect.isValid() ? iconRect.topRight().x() : 0))); |
1388 const int indicatorSpacing = proxy()->pixelMetric(PM_LayoutHorizontalSpacing, option, widget); |
1324 const int widthMod = checkBoxRect.width() + iconRect.width() + indicatorSpacing; |
1389 int totalXMod = qMax(0, qMax((checkBoxRect.isValid() ? checkBoxRect.topRight().x() : 0), |
1325 totalXMod = (itemView->direction == Qt::LeftToRight) ? qMax(0, totalXMod - elementSize.topLeft().x()): 0; |
1390 (iconRect.isValid() ? iconRect.topRight().x() : 0))); |
1326 totalXMod += indicatorSpacing; |
1391 const int widthMod = checkBoxRect.width() + iconRect.width() + indicatorSpacing; |
1327 elementSize.translate(totalXMod, 0); |
1392 totalXMod = (itemView->direction == Qt::LeftToRight) ? qMax(0, totalXMod - elementSize.topLeft().x()): 0; |
1328 elementSize.setWidth(itemView->rect.width() - widthMod); |
1393 totalXMod += indicatorSpacing; |
1329 elementSize = visualRect(itemView->direction, itemView->rect, elementSize); |
1394 elementSize.translate(totalXMod, 0); |
|
1395 elementSize.setWidth(itemView->rect.width() - widthMod); |
|
1396 elementSize = visualRect(itemView->direction, itemView->rect, elementSize); |
|
1397 } else { |
|
1398 const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, option, widget); |
|
1399 const bool decoratorOnTop = (itemView->decorationPosition == QStyleOptionViewItem::Top); |
|
1400 if (decoratorOnTop) |
|
1401 elementSize.translate(0, iconRect.height()); |
|
1402 else |
|
1403 elementSize.translate(0, -iconRect.height()); |
|
1404 } |
1330 } |
1405 } |
1331 break; |
1406 break; |
1332 } |
1407 } |
1333 case SE_ViewItemCheckIndicator: { |
1408 case SE_ViewItemCheckIndicator: { |
1334 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
1409 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |
1421 } |
1496 } |
1422 case SC_ComboBoxFrame: { |
1497 case SC_ComboBoxFrame: { |
1423 QRect frameRect = QRect(cmb->rect); |
1498 QRect frameRect = QRect(cmb->rect); |
1424 int frameWidth = pixelMetric(PM_DefaultFrameWidth, cmb, widget); |
1499 int frameWidth = pixelMetric(PM_DefaultFrameWidth, cmb, widget); |
1425 int maxRight = cmb->rect.height() - 2 * frameWidth; |
1500 int maxRight = cmb->rect.height() - 2 * frameWidth; |
1426 frameRect.adjust(0, 0, -maxRight, 0); |
1501 if(cmb->direction == Qt::RightToLeft) { |
|
1502 frameRect.adjust(+ 0.25 * buttonWidth, 0, -0.25 * buttonWidth, 0); |
|
1503 }else{ |
|
1504 frameRect.adjust(0, 0, -maxRight-4, 0); |
|
1505 } |
1427 elementSize = frameRect; |
1506 elementSize = frameRect; |
1428 break; |
1507 break; |
1429 } |
1508 } |
1430 case SC_ComboBoxEditField: { |
1509 case SC_ComboBoxEditField: { |
1431 const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width(); |
1510 int withFrameX = 0; |
|
1511 int offSet = 0; |
|
1512 if(cmb->direction == Qt::RightToLeft) { |
|
1513 withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness; |
|
1514 offSet = buttonWidth; |
|
1515 } |
|
1516 else{ |
|
1517 withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width(); |
|
1518 } |
1432 elementSize = QRect( |
1519 elementSize = QRect( |
1433 frameThickness, |
1520 frameThickness + offSet, |
1434 frameThickness - 2, |
1521 frameThickness - 2, |
1435 withFrameX - frameThickness, |
1522 withFrameX - frameThickness - offSet, |
1436 cmb->rect.height() - 2 * frameThickness ); |
1523 cmb->rect.height() - 2 * frameThickness ); |
1437 break; |
1524 break; |
1438 } |
1525 } |
1439 case SC_ComboBoxListBoxPopup: { |
1526 case SC_ComboBoxListBoxPopup: { |
1440 QRect mover = cmb->rect; |
1527 QRect mover = cmb->rect; |
1646 #endif //QT_NO_SLIDER |
1733 #endif //QT_NO_SLIDER |
1647 #ifndef QT_NO_SPINBOX |
1734 #ifndef QT_NO_SPINBOX |
1648 case CC_SpinBox: { |
1735 case CC_SpinBox: { |
1649 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { |
1736 if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { |
1650 const int buttonIconSize = pixelMetric(PM_ButtonIconSize); |
1737 const int buttonIconSize = pixelMetric(PM_ButtonIconSize); |
1651 const int buttonWidth = qMax(spinbox->rect.height(), buttonIconSize); |
1738 // Spinbox buttons should be no larger than one fourth of total width. |
|
1739 const int maxSize = qMax(spinbox->rect.width() / 4, buttonIconSize + 4); //@magic |
|
1740 QSize buttonSize; |
|
1741 buttonSize.setHeight(qMin(maxSize, qMax(8, spinbox->rect.height()))); |
|
1742 buttonSize.setWidth(buttonSize.height()); //make buttons square |
|
1743 |
1652 switch (sc) { |
1744 switch (sc) { |
1653 case SC_SpinBoxFrame: |
1745 case SC_SpinBoxFrame: |
1654 elementSize = option->rect.adjusted(0, 0, -buttonWidth + 5, 0); |
1746 elementSize = option->rect.adjusted(0, 0, -buttonSize.width() + 5, 0); //@magic |
1655 break; |
1747 break; |
1656 case SC_SpinBoxDown: { |
1748 case SC_SpinBoxDown: { |
1657 if (option->direction == Qt::RightToLeft) |
1749 if (option->direction == Qt::RightToLeft) |
1658 elementSize = QRect(option->rect.right() - buttonWidth, option->rect.y(),buttonWidth, option->rect.height()); |
1750 elementSize = QRect(option->rect.right() - buttonSize.width(), option->rect.y(), buttonSize.width(), option->rect.height()); |
1659 else |
1751 else |
1660 elementSize = QRect( option->rect.x(), option->rect.y(), buttonWidth,option->rect.height()); |
1752 elementSize = QRect(option->rect.x(), option->rect.y(), buttonSize.width(), option->rect.height()); |
1661 } |
1753 } |
1662 break; |
1754 break; |
1663 case SC_SpinBoxUp: { |
1755 case SC_SpinBoxUp: { |
1664 if (option->direction == Qt::RightToLeft) |
1756 if (option->direction == Qt::RightToLeft) |
1665 elementSize = QRect( option->rect.x(), option->rect.y(), buttonWidth,option->rect.height()); |
1757 elementSize = QRect(option->rect.x(), option->rect.y(), buttonSize.width(), option->rect.height()); |
1666 else |
1758 else |
1667 elementSize = QRect(option->rect.right() - buttonWidth,option->rect.y(),buttonWidth,option->rect.height()); |
1759 elementSize = QRect(option->rect.right() - buttonSize.width(), option->rect.y(), buttonSize.width(), option->rect.height()); |
1668 } |
1760 } |
1669 break; |
1761 break; |
1670 case SC_SpinBoxEditField: |
1762 case SC_SpinBoxEditField: |
1671 elementSize = option->rect.adjusted(buttonWidth, 0, -buttonWidth, 0); |
1763 elementSize = option->rect.adjusted(buttonSize.width(), 0, -buttonSize.width(), 0); |
1672 break; |
1764 break; |
1673 default: |
1765 default: |
1674 break; |
1766 break; |
1675 } |
1767 } |
1676 } |
1768 } |
2226 } |
2319 } |
2227 |
2320 |
2228 void QHbStyle::polish(QPalette &palette) |
2321 void QHbStyle::polish(QPalette &palette) |
2229 { |
2322 { |
2230 QCommonStyle::polish(palette); |
2323 QCommonStyle::polish(palette); |
2231 |
|
2232 palette.setBrush(QPalette::Disabled, QPalette::WindowText, QColor(QRgb(0xff808080))); |
|
2233 palette.setBrush(QPalette::Disabled, QPalette::Button, QColor(QRgb(0xffdddfe4))); |
|
2234 palette.setBrush(QPalette::Disabled, QPalette::Light, QColor(QRgb(0xffffffff))); |
|
2235 palette.setBrush(QPalette::Disabled, QPalette::Midlight, QColor(QRgb(0xffffffff))); |
|
2236 palette.setBrush(QPalette::Disabled, QPalette::Dark, QColor(QRgb(0xff555555))); |
|
2237 palette.setBrush(QPalette::Disabled, QPalette::Mid, QColor(QRgb(0xffc7c7c7))); |
|
2238 palette.setBrush(QPalette::Disabled, QPalette::Text, QColor(QRgb(0xffc7c7c7))); |
|
2239 palette.setBrush(QPalette::Disabled, QPalette::BrightText, QColor(QRgb(0xffffffff))); |
|
2240 palette.setBrush(QPalette::Disabled, QPalette::ButtonText, QColor(QRgb(0xff808080))); |
|
2241 palette.setBrush(QPalette::Disabled, QPalette::Base, QColor(QRgb(0xffefefef))); |
|
2242 palette.setBrush(QPalette::Disabled, QPalette::AlternateBase, palette.color(QPalette::Disabled, QPalette::Base).darker(110)); |
|
2243 palette.setBrush(QPalette::Disabled, QPalette::Window, QColor(QRgb(0xffefefef))); |
|
2244 palette.setBrush(QPalette::Disabled, QPalette::Shadow, QColor(QRgb(0xff000000))); |
|
2245 palette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(QRgb(0xff567594))); |
|
2246 palette.setBrush(QPalette::Disabled, QPalette::HighlightedText, QColor(QRgb(0xffffffff))); |
|
2247 palette.setBrush(QPalette::Disabled, QPalette::Link, QColor(QRgb(0xff0000ee))); |
|
2248 palette.setBrush(QPalette::Disabled, QPalette::LinkVisited, QColor(QRgb(0xff52188b))); |
|
2249 palette.setBrush(QPalette::Disabled, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee))); |
|
2250 palette.setBrush(QPalette::Disabled, QPalette::ToolTipText, QColor(QRgb(0xff52188b))); |
|
2251 |
|
2252 palette.setBrush(QPalette::Active, QPalette::WindowText, QColor(QRgb(0xff000000))); |
|
2253 palette.setBrush(QPalette::Active, QPalette::Button, QColor(QRgb(0xffdddfe4))); |
|
2254 palette.setBrush(QPalette::Active, QPalette::Light, QColor(QRgb(0xffffffff))); |
|
2255 palette.setBrush(QPalette::Active, QPalette::Midlight, QColor(QRgb(0xffffffff))); |
|
2256 palette.setBrush(QPalette::Active, QPalette::Dark, QColor(QRgb(0xff555555))); |
|
2257 palette.setBrush(QPalette::Active, QPalette::Mid, QColor(QRgb(0xffc7c7c7))); |
|
2258 palette.setBrush(QPalette::Active, QPalette::Text, QColor(QRgb(0xff000000))); |
|
2259 palette.setBrush(QPalette::Active, QPalette::BrightText, QColor(QRgb(0xffffffff))); |
|
2260 palette.setBrush(QPalette::Active, QPalette::ButtonText, QColor(QRgb(0xff000000))); |
|
2261 palette.setBrush(QPalette::Active, QPalette::Base, QColor(QRgb(0xE4E4E4))); |
|
2262 palette.setBrush(QPalette::Active, QPalette::AlternateBase, palette.color(QPalette::Active, QPalette::Base).darker(110)); |
|
2263 palette.setBrush(QPalette::Active, QPalette::Window, QColor(QRgb(0xffefefef))); |
|
2264 palette.setBrush(QPalette::Active, QPalette::Shadow, QColor(QRgb(0xff000000))); |
|
2265 palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(QRgb(0xffE4E4E4))); |
|
2266 palette.setBrush(QPalette::Active, QPalette::HighlightedText, QColor(QRgb(0xff000000))); |
|
2267 palette.setBrush(QPalette::Active, QPalette::Link, QColor(QRgb(0xff0000ee))); |
|
2268 palette.setBrush(QPalette::Active, QPalette::LinkVisited, QColor(QRgb(0xff52188b))); |
|
2269 palette.setBrush(QPalette::Active, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee))); |
|
2270 palette.setBrush(QPalette::Active, QPalette::ToolTipText, QColor(QRgb(0xff52188b))); |
|
2271 |
|
2272 palette.setBrush(QPalette::Inactive, QPalette::WindowText, QColor(QRgb(0xff000000))); |
|
2273 palette.setBrush(QPalette::Inactive, QPalette::Button, QColor(QRgb(0xffdddfe4))); |
|
2274 palette.setBrush(QPalette::Inactive, QPalette::Light, QColor(QRgb(0xffffffff))); |
|
2275 palette.setBrush(QPalette::Inactive, QPalette::Midlight, QColor(QRgb(0xffffffff))); |
|
2276 palette.setBrush(QPalette::Inactive, QPalette::Dark, QColor(QRgb(0xff555555))); |
|
2277 palette.setBrush(QPalette::Inactive, QPalette::Mid, QColor(QRgb(0xffc7c7c7))); |
|
2278 palette.setBrush(QPalette::Inactive, QPalette::Text, QColor(QRgb(0xff000000))); |
|
2279 palette.setBrush(QPalette::Inactive, QPalette::BrightText, QColor(QRgb(0xffffffff))); |
|
2280 palette.setBrush(QPalette::Inactive, QPalette::ButtonText, QColor(QRgb(0xff000000))); |
|
2281 palette.setBrush(QPalette::Inactive, QPalette::Base, QColor(QRgb(0xffffffff))); |
|
2282 palette.setBrush(QPalette::Inactive, QPalette::AlternateBase, palette.color(QPalette::Inactive, QPalette::Base).darker(110)); |
|
2283 palette.setBrush(QPalette::Inactive, QPalette::Window, QColor(QRgb(0xffefefef))); |
|
2284 palette.setBrush(QPalette::Inactive, QPalette::Shadow, QColor(QRgb(0xff000000))); |
|
2285 palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(QRgb(0xff678db2))); |
|
2286 palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, QColor(QRgb(0xffffffff))); |
|
2287 palette.setBrush(QPalette::Inactive, QPalette::Link, QColor(QRgb(0xff0000ee))); |
|
2288 palette.setBrush(QPalette::Inactive, QPalette::LinkVisited, QColor(QRgb(0xff52188b))); |
|
2289 palette.setBrush(QPalette::Inactive, QPalette::ToolTipBase, QColor(QRgb(0xff0000ee))); |
|
2290 palette.setBrush(QPalette::Inactive, QPalette::ToolTipText, QColor(QRgb(0xff52188b))); |
|
2291 } |
2324 } |
2292 |
2325 |
2293 void QHbStyle::unpolish(QWidget *widget) |
2326 void QHbStyle::unpolish(QWidget *widget) |
2294 { |
2327 { |
2295 if (!widget) |
2328 if (!widget) |
2856 case SM_GroupBoxTitle: { |
2892 case SM_GroupBoxTitle: { |
2857 frameName = QLatin1String("qtg_fr_groupbox"); |
2893 frameName = QLatin1String("qtg_fr_groupbox"); |
2858 frameType = HbFrameDrawer::NinePieces; |
2894 frameType = HbFrameDrawer::NinePieces; |
2859 break; |
2895 break; |
2860 } |
2896 } |
2861 case SM_ItemViewHighlight: { |
|
2862 frameName = QLatin1String("qtg_fr_list_highlight"); |
|
2863 frameType = HbFrameDrawer::NinePieces; |
|
2864 break; |
|
2865 } |
|
2866 case SM_ItemViewItem: { |
2897 case SM_ItemViewItem: { |
2867 if (state & SS_Pressed) |
2898 if (state & SS_Pressed) |
2868 frameName = QLatin1String("qtg_fr_list_pressed"); |
2899 frameName = QLatin1String("qtg_fr_list_pressed"); |
2869 else if (state & SS_Focused) |
2900 else if (state & SS_Focused) |
2870 frameName = QLatin1String("qtg_fr_list_highlight"); |
2901 frameName = QLatin1String("qtg_fr_list_highlight"); |
2871 else |
|
2872 frameName = QLatin1String("qtg_fr_list_normal"); |
|
2873 frameType = HbFrameDrawer::NinePieces; |
2902 frameType = HbFrameDrawer::NinePieces; |
2874 styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border); |
2903 styleManager()->parameter(QLatin1String("hb-param-background-list-main"), border); |
2875 break; |
2904 break; |
2876 } |
2905 } |
|
2906 case SM_TextEdit: //@todo: fallthrough for now, since no specific graphic for editors in releases |
2877 case SM_LineEdit: { |
2907 case SM_LineEdit: { |
2878 styleManager()->parameter(QLatin1String("hb-param-background-editor"), border); |
2908 styleManager()->parameter(QLatin1String("hb-param-background-editor"), border); |
2879 if (state & SS_Selected) |
2909 if (state & SS_Selected) |
2880 frameName = QLatin1String("qtg_fr_editor_highlight"); |
2910 frameName = QLatin1String("qtg_fr_lineedit_highlight"); |
2881 else |
2911 else |
2882 frameName = QLatin1String("qtg_fr_editor_normal"); |
2912 frameName = QLatin1String("qtg_fr_lineedit_normal"); |
2883 frameType = HbFrameDrawer::NinePieces; |
2913 frameType = HbFrameDrawer::NinePieces; |
2884 break; |
2914 break; |
2885 } |
2915 } |
2886 case SM_ListParent: { |
2916 case SM_ListParent: { |
2887 if (state & SS_Pressed) |
2917 if (state & SS_Pressed) |
3275 ) { |
3324 ) { |
3276 fontRole = HbFontSpec::Secondary; |
3325 fontRole = HbFontSpec::Secondary; |
3277 valueFound = styleManager()->parameter(QLatin1String("hb-param-text-height-tiny"), fontSize); |
3326 valueFound = styleManager()->parameter(QLatin1String("hb-param-text-height-tiny"), fontSize); |
3278 } |
3327 } |
3279 |
3328 |
3280 HbFontSpec *fontSpec = q_check_ptr(new HbFontSpec(fontRole)); |
3329 HbFontSpec *fontSpec = new HbFontSpec(fontRole); |
3281 if (valueFound) { |
3330 if (valueFound) { |
3282 fontSpec->setTextHeight(fontSize); |
3331 fontSpec->setTextHeight(fontSize); |
3283 QFont widgetFont = fontSpec->font(); |
3332 QFont widgetFont = fontSpec->font(); |
3284 widgetFont.setPixelSize(fontSpec->font().pixelSize()); |
3333 widgetFont.setPixelSize(fontSpec->font().pixelSize()); |
3285 widget->setFont(widgetFont); |
3334 widget->setFont(widgetFont); |
3286 } |
3335 } |
3287 delete fontSpec; |
3336 delete fontSpec; |
3288 } |
3337 } |
3289 |
3338 |
|
3339 void QHbStylePrivate::polishPalette(QWidget *widget) |
|
3340 { |
|
3341 QPalette widgetPalette = widget->palette(); |
|
3342 if (false |
|
3343 #ifndef QT_NO_TEXTEDIT |
|
3344 || qobject_cast<QTextEdit *>(widget) |
|
3345 #endif |
|
3346 ) { |
|
3347 widgetPalette.setColor(QPalette::Active, QPalette::Highlight, HbColorScheme::color("qtc_lineedit_marker_normal")); |
|
3348 widgetPalette.setColor(QPalette::Active, QPalette::HighlightedText, HbColorScheme::color("qtc_lineedit_selected")); |
|
3349 widgetPalette.setColor(QPalette::Active, QPalette::Text, HbColorScheme::color("qtc_lineedit_normal")); |
|
3350 //QTextEdits have specific graphic in QHbStyle for background |
|
3351 widgetPalette.setColor(QPalette::Active, QPalette::Base, Qt::transparent); |
|
3352 } else if (false |
|
3353 #ifndef QT_NO_LINEEDIT |
|
3354 || qobject_cast<QLineEdit *>(widget) |
|
3355 #endif |
|
3356 ) { |
|
3357 widgetPalette.setColor(QPalette::Active, QPalette::Highlight, HbColorScheme::color("qtc_lineedit_marker_normal")); |
|
3358 widgetPalette.setColor(QPalette::Active, QPalette::HighlightedText, HbColorScheme::color("qtc_lineedit_selected")); |
|
3359 widgetPalette.setColor(QPalette::Active, QPalette::Text, HbColorScheme::color("qtc_lineedit_normal")); |
|
3360 } |
|
3361 widget->setPalette(widgetPalette); |
|
3362 } |
|
3363 |
3290 QT_END_NAMESPACE |
3364 QT_END_NAMESPACE |