diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-27 16:24:21 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-31 09:09:13 +0000 |
commit | 5c977a9ddff3c221c098a57855ede7c0ef4fe31f (patch) | |
tree | 4f2904d4b9bce00344ddce0d17ed7d6dc63e6fcf /vcl/unx | |
parent | 526ed1f7dbd9150734edcb03727d49e1b1306f56 (diff) |
Convert ControlType to scoped enum
Change-Id: Iaa13c3e7030296a97bab144103745867d43b4b19
Reviewed-on: https://gerrit.libreoffice.org/25554
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/salnativewidgets-gtk.cxx | 185 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 145 | ||||
-rw-r--r-- | vcl/unx/kde/salnativewidgets-kde.cxx | 94 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 116 |
4 files changed, 271 insertions, 269 deletions
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx index d6ecd335060e..62ab80da5de0 100644 --- a/vcl/unx/gtk/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx @@ -346,13 +346,13 @@ GdkDrawable* GdkX11Pixmap::GetGdkDrawable() const class NWPixmapCacheData { public: - ControlType m_nType; - ControlState m_nState; + ControlType m_nType; + ControlState m_nState; Rectangle m_pixmapRect; GdkX11Pixmap* m_pixmap; GdkX11Pixmap* m_mask; - NWPixmapCacheData() : m_nType(0), m_nState(ControlState::NONE), m_pixmap(nullptr), m_mask(nullptr) {} + NWPixmapCacheData() : m_nType(ControlType::Generic), m_nState(ControlState::NONE), m_pixmap(nullptr), m_mask(nullptr) {} ~NWPixmapCacheData() { SetPixmap( nullptr, nullptr ); }; void SetPixmap( GdkX11Pixmap* pPixmap, GdkX11Pixmap* pMask ); @@ -656,57 +656,57 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP { switch(nType) { - case CTRL_PUSHBUTTON: - case CTRL_RADIOBUTTON: - case CTRL_CHECKBOX: - case CTRL_TOOLTIP: - case CTRL_PROGRESS: - case CTRL_LISTNODE: - case CTRL_LISTNET: + case ControlType::Pushbutton: + case ControlType::Radiobutton: + case ControlType::Checkbox: + case ControlType::Tooltip: + case ControlType::Progress: + case ControlType::ListNode: + case ControlType::ListNet: if(nPart==PART_ENTIRE_CONTROL) return true; break; - case CTRL_SCROLLBAR: + case ControlType::Scrollbar: if(nPart==PART_DRAW_BACKGROUND_HORZ || nPart==PART_DRAW_BACKGROUND_VERT || nPart==PART_ENTIRE_CONTROL || nPart==HAS_THREE_BUTTONS) return true; break; - case CTRL_EDITBOX: - case CTRL_MULTILINE_EDITBOX: - case CTRL_COMBOBOX: + case ControlType::Editbox: + case ControlType::MultilineEditbox: + case ControlType::Combobox: if(nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE) return true; break; - case CTRL_SPINBOX: + case ControlType::Spinbox: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS || nPart==HAS_BACKGROUND_TEXTURE) return true; break; - case CTRL_SPINBUTTONS: + case ControlType::SpinButtons: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS) return true; break; - case CTRL_FRAME: - case CTRL_WINDOW_BACKGROUND: + case ControlType::Frame: + case ControlType::WindowBackground: return true; - case CTRL_TAB_ITEM: - case CTRL_TAB_PANE: - case CTRL_TAB_BODY: + case ControlType::TabItem: + case ControlType::TabPane: + case ControlType::TabBody: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL) return true; break; - case CTRL_LISTBOX: + case ControlType::Listbox: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE) return true; break; - case CTRL_TOOLBAR: + case ControlType::Toolbar: if( nPart==PART_ENTIRE_CONTROL || nPart==PART_DRAW_BACKGROUND_HORZ || nPart==PART_DRAW_BACKGROUND_VERT @@ -719,12 +719,12 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP return true; break; - case CTRL_MENUBAR: + case ControlType::Menubar: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM) return true; break; - case CTRL_MENU_POPUP: + case ControlType::MenuPopup: if (nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM || nPart==PART_MENU_ITEM_CHECK_MARK @@ -735,20 +735,21 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP return true; break; - case CTRL_SLIDER: + case ControlType::Slider: if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA) return true; break; - case CTRL_FIXEDLINE: + case ControlType::Fixedline: if(nPart == PART_SEPARATOR_VERT || nPart == PART_SEPARATOR_HORZ) return true; break; - case CTRL_LISTHEADER: + case ControlType::ListHeader: if(nPart == PART_BUTTON || nPart == PART_ARROW) return true; break; + default: break; } return false; @@ -769,7 +770,7 @@ bool GtkSalGraphics::hitTestNativeControl( ControlType nType, const Point& aPos, bool& rIsInside ) { - if ( ( nType == CTRL_SCROLLBAR ) && + if ( ( nType == ControlType::Scrollbar ) && ( ( nPart == PART_BUTTON_UP ) || ( nPart == PART_BUTTON_DOWN ) || ( nPart == PART_BUTTON_LEFT ) || @@ -917,12 +918,12 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, std::unique_ptr<GdkX11Pixmap> xMask; if ((bNeedPixmapPaint || (nState & ControlState::DOUBLEBUFFERING)) - && nType != CTRL_SCROLLBAR - && nType != CTRL_SPINBOX - && nType != CTRL_TAB_ITEM - && nType != CTRL_TAB_PANE - && nType != CTRL_PROGRESS - && ! (nType == CTRL_TOOLBAR && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) + && nType != ControlType::Scrollbar + && nType != ControlType::Spinbox + && nType != ControlType::TabItem + && nType != ControlType::TabPane + && nType != ControlType::Progress + && ! (nType == ControlType::Toolbar && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) ) { if( bNeedTwoPasses ) @@ -997,65 +998,65 @@ bool GtkSalGraphics::DoDrawNativeControl( const OUString& rCaption, ControlCacheKey& rControlCacheKey) { - if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) + if ( (nType==ControlType::Pushbutton) && (nPart==PART_ENTIRE_CONTROL) ) { return NWPaintGTKButton( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( (nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) + else if ( (nType==ControlType::Radiobutton) && (nPart==PART_ENTIRE_CONTROL) ) { return NWPaintGTKRadio( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) ) + else if ( (nType==ControlType::Checkbox) && (nPart==PART_ENTIRE_CONTROL) ) { return NWPaintGTKCheck( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) ) + else if ( (nType==ControlType::Scrollbar) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) ) { return NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( ((nType==CTRL_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) - || ((nType==CTRL_SPINBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) - || ((nType==CTRL_COMBOBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) - || ((nType==CTRL_LISTBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) ) + else if ( ((nType==ControlType::Editbox) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) + || ((nType==ControlType::Spinbox) && (nPart==HAS_BACKGROUND_TEXTURE)) + || ((nType==ControlType::Combobox) && (nPart==HAS_BACKGROUND_TEXTURE)) + || ((nType==ControlType::Listbox) && (nPart==HAS_BACKGROUND_TEXTURE)) ) { return NWPaintGTKEditBox( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( ((nType==CTRL_MULTILINE_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) ) + else if ( ((nType==ControlType::MultilineEditbox) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) ) { return NWPaintGTKEditBox( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS)) + else if ( ((nType==ControlType::Spinbox) || (nType==ControlType::SpinButtons)) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) ) { return NWPaintGTKSpinBox(nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption, rControlCacheKey); } - else if ( (nType == CTRL_COMBOBOX) && + else if ( (nType == ControlType::Combobox) && ( (nPart==PART_ENTIRE_CONTROL) ||(nPart==PART_BUTTON_DOWN) ) ) { return NWPaintGTKComboBox( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) ) + else if ( (nType==ControlType::TabItem) || (nType==ControlType::TabPane) || (nType==ControlType::TabBody) ) { - if ( nType == CTRL_TAB_BODY ) + if ( nType == ControlType::TabBody ) return true; else return NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption); } - else if ( (nType==CTRL_LISTBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) ) + else if ( (nType==ControlType::Listbox) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) ) { return NWPaintGTKListBox( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( nType== CTRL_TOOLBAR ) + else if ( nType== ControlType::Toolbar ) { return NWPaintGTKToolbar( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if ( nType== CTRL_MENUBAR ) + else if ( nType== ControlType::Menubar ) { return NWPaintGTKMenubar( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( (nType == CTRL_MENU_POPUP) + else if( (nType == ControlType::MenuPopup) && ( (nPart == PART_ENTIRE_CONTROL) || (nPart == PART_MENU_ITEM) || (nPart == PART_MENU_ITEM_CHECK_MARK) @@ -1067,40 +1068,40 @@ bool GtkSalGraphics::DoDrawNativeControl( { return NWPaintGTKPopupMenu( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) ) + else if( (nType == ControlType::Tooltip) && (nPart == PART_ENTIRE_CONTROL) ) { return NWPaintGTKTooltip( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) ) + else if( (nType == ControlType::Progress) && (nPart == PART_ENTIRE_CONTROL) ) { return NWPaintGTKProgress( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) ) + else if( (nType == ControlType::ListNode) && (nPart == PART_ENTIRE_CONTROL) ) { return NWPaintGTKListNode( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) ) + else if( (nType == ControlType::ListNet) && (nPart == PART_ENTIRE_CONTROL) ) { // don't actually draw anything; gtk treeviews do not draw lines return TRUE; } - else if( nType == CTRL_SLIDER ) + else if( nType == ControlType::Slider ) { return NWPaintGTKSlider( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( nType == CTRL_WINDOW_BACKGROUND ) + else if( nType == ControlType::WindowBackground ) { return NWPaintGTKWindowBackground( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if( nType == CTRL_FIXEDLINE ) + else if( nType == ControlType::Fixedline ) { return NWPaintGTKFixedLine( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } - else if(nType==CTRL_FRAME) + else if(nType==ControlType::Frame) { return NWPaintGTKFrame( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption); } - else if(nType==CTRL_LISTHEADER) + else if(nType==ControlType::ListHeader) { if(nPart == PART_BUTTON) return NWPaintGTKListHeader( pDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); @@ -1135,7 +1136,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, { bool returnVal = false; - if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) + if ( (nType==ControlType::Pushbutton) && (nPart==PART_ENTIRE_CONTROL) && (rControlRegion.GetWidth() > 16) && (rControlRegion.GetHeight() > 16) ) { @@ -1145,13 +1146,13 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = true; } - if (nType == CTRL_TAB_ITEM && nPart == PART_ENTIRE_CONTROL) + if (nType == ControlType::TabItem && nPart == PART_ENTIRE_CONTROL) { rNativeBoundingRegion = NWGetTabItemRect(m_nXScreen, rControlRegion); rNativeContentRegion = rNativeBoundingRegion; returnVal = true; } - if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) + if ( (nType==ControlType::Combobox) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nXScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); @@ -1159,7 +1160,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = true; } - if ( (nType==CTRL_SPINBOX) && ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) + if ( (nType==ControlType::Spinbox) && ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetSpinButtonRect( m_nXScreen, nType, nPart, rControlRegion, nState, @@ -1168,7 +1169,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = true; } - if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) + if ( (nType==ControlType::Listbox) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetListBoxButtonRect( m_nXScreen, nType, nPart, rControlRegion, nState, aValue, rCaption ); @@ -1176,7 +1177,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = true; } - if ( (nType==CTRL_TOOLBAR) && + if ( (nType==ControlType::Toolbar) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT) || (nPart==PART_THUMB_HORZ) || @@ -1188,7 +1189,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = rNativeBoundingRegion; returnVal = true; } - if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || + if ( (nType==ControlType::Scrollbar) && ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ) ) { rNativeBoundingRegion = NWGetScrollButtonRect( m_nXScreen, nPart, rControlRegion ); @@ -1201,7 +1202,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion.Bottom() = rNativeContentRegion.Top() + 1; returnVal = true; } - if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) ) + if( (nType == ControlType::Menubar) && (nPart == PART_ENTIRE_CONTROL) ) { NWEnsureGTKMenubar( m_nXScreen ); GtkRequisition aReq; @@ -1213,7 +1214,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = rNativeBoundingRegion; returnVal = true; } - if( nType == CTRL_MENU_POPUP ) + if( nType == ControlType::MenuPopup ) { if( (nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == PART_MENU_ITEM_RADIO_MARK) ) @@ -1278,11 +1279,11 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, returnVal = true; } } - if( (nType == CTRL_RADIOBUTTON || nType == CTRL_CHECKBOX) ) + if( (nType == ControlType::Radiobutton || nType == ControlType::Checkbox) ) { NWEnsureGTKRadio( m_nXScreen ); NWEnsureGTKCheck( m_nXScreen ); - GtkWidget* widget = (nType == CTRL_RADIOBUTTON) ? gWidgetData[m_nXScreen].gRadioWidget : gWidgetData[m_nXScreen].gCheckWidget; + GtkWidget* widget = (nType == ControlType::Radiobutton) ? gWidgetData[m_nXScreen].gRadioWidget : gWidgetData[m_nXScreen].gCheckWidget; gint indicator_size, indicator_spacing, focusPad, focusWidth; gtk_widget_style_get( widget, "indicator_size", &indicator_size, @@ -1298,7 +1299,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = aIndicatorRect; returnVal = true; } - if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX || nType == CTRL_COMBOBOX) && nPart == PART_ENTIRE_CONTROL ) + if( (nType == ControlType::Editbox || nType == ControlType::Spinbox || nType == ControlType::Combobox) && nPart == PART_ENTIRE_CONTROL ) { NWEnsureGTKEditBox( m_nXScreen ); GtkWidget* widget = gWidgetData[m_nXScreen].gEditBoxWidget; @@ -1312,7 +1313,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = rNativeBoundingRegion; returnVal = true; } - if( (nType == CTRL_SLIDER) && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) + if( (nType == ControlType::Slider) && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) { NWEnsureGTKSlider( m_nXScreen ); GtkWidget* widget = (nPart == PART_THUMB_HORZ) ? gWidgetData[m_nXScreen].gHScale : gWidgetData[m_nXScreen].gVScale; @@ -1336,7 +1337,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeBoundingRegion = rNativeContentRegion = aRect; returnVal = true; } - if( nType == CTRL_FRAME && nPart == PART_BORDER ) + if( nType == ControlType::Frame && nPart == PART_BORDER ) { int frameWidth = getFrameWidth(gWidgetData[m_nXScreen].gFrame); rNativeBoundingRegion = rControlRegion; @@ -1953,7 +1954,7 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, const ImplControlValue& aValue, const OUString& ) { - assert(aValue.getType() == CTRL_SCROLLBAR); + assert(aValue.getType() == ControlType::Scrollbar); const ScrollbarValue& rScrollbarVal = static_cast<const ScrollbarValue&>(aValue); GdkX11Pixmap* pixmap = nullptr; Rectangle pixmapRect, scrollbarRect; @@ -2435,14 +2436,14 @@ static void NWPaintOneEditBox( SalX11Screen nScreen, switch ( nType ) { - case CTRL_SPINBOX: + case ControlType::Spinbox: widget = gWidgetData[nScreen].gSpinButtonWidget; break; - case CTRL_MULTILINE_EDITBOX: + case ControlType::MultilineEditbox: widget = gWidgetData[nScreen].gScrolledWindowWidget; break; - case CTRL_COMBOBOX: + case ControlType::Combobox: widget = GTK_COMBO(gWidgetData[nScreen].gComboWidget)->entry; break; @@ -2491,7 +2492,7 @@ bool GtkSalGraphics::NWPaintGTKSpinBox(ControlType nType, ControlPart nPart, Rectangle pixmapRect; GtkStateType stateType; GtkShadowType shadowType; - const SpinbuttonValue * pSpinVal = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&aValue) : nullptr; + const SpinbuttonValue * pSpinVal = (aValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue *>(&aValue) : nullptr; Rectangle upBtnRect; ControlPart upBtnPart = PART_BUTTON_UP; ControlState upBtnState = ControlState::ENABLED; @@ -2528,7 +2529,7 @@ bool GtkSalGraphics::NWPaintGTKSpinBox(ControlType nType, ControlPart nPart, upBtnRect = NWGetSpinButtonRect( m_nXScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); downBtnRect = NWGetSpinButtonRect( m_nXScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); - if ( (nType==CTRL_SPINBOX) && (nPart!=PART_ALL_BUTTONS) ) + if ( (nType==ControlType::Spinbox) && (nPart!=PART_ALL_BUTTONS) ) { // Draw an edit field for SpinBoxes and ComboBoxes Rectangle aEditBoxRect( pixmapRect ); @@ -2794,7 +2795,7 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const ImplControlValue& aValue, const OUString& ) { - OSL_ASSERT( nType != CTRL_TAB_ITEM || aValue.getType() == CTRL_TAB_ITEM ); + OSL_ASSERT( nType != ControlType::TabItem || aValue.getType() == ControlType::TabItem ); GdkX11Pixmap * pixmap; GdkX11Pixmap * mask; Rectangle pixmapRect; @@ -2814,7 +2815,7 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, if( !aCachePage.GetSize() ) aCachePage.SetSize( 1 ); - if ( (nType == CTRL_TAB_ITEM) && (aValue.getType() != CTRL_TAB_ITEM) ) + if ( (nType == ControlType::TabItem) && (aValue.getType() != ControlType::TabItem) ) { return false; } @@ -2826,7 +2827,7 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, // Find the overall bounding rect of the buttons's drawing area, // plus its actual draw rect excluding adornment pixmapRect = rControlRectangle; - if ( nType == CTRL_TAB_ITEM ) + if ( nType == ControlType::TabItem ) { const TabitemValue * pTabitemValue = static_cast<const TabitemValue *>(&aValue); if ( !pTabitemValue->isFirst() ) @@ -2857,7 +2858,7 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, return false; } - if( nType == CTRL_TAB_ITEM ) + if( nType == ControlType::TabItem ) { if( aCacheItems.Find( nType, nState, pixmapRect, &pixmap, &mask ) ) return NWRenderPixmapToScreen( pixmap, mask, pixmapRect ); @@ -2886,15 +2887,15 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, switch( nType ) { - case CTRL_TAB_BODY: + case ControlType::TabBody: break; - case CTRL_TAB_PANE: + case ControlType::TabPane: gtk_paint_box_gap( gWidgetData[m_nXScreen].gNotebookWidget->style, gdkPixmap, GTK_STATE_NORMAL, GTK_SHADOW_OUT, nullptr, gWidgetData[m_nXScreen].gNotebookWidget, "notebook", 0, 0, pixmapRect.GetWidth(), pixmapRect.GetHeight(), GTK_POS_TOP, 0, 0 ); break; - case CTRL_TAB_ITEM: + case ControlType::TabItem: { stateType = ( nState & ControlState::SELECTED ) ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE; @@ -2931,7 +2932,7 @@ bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, END_CACHE_PIXMAP_RENDER( pixmapRect, pixmap, mask ) // cache data - if( nType == CTRL_TAB_ITEM ) + if( nType == ControlType::TabItem ) aCacheItems.Fill( nType, nState, pixmapRect, pixmap, mask ); else aCachePage.Fill( nType, nState, pixmapRect, pixmap, mask ); @@ -3066,7 +3067,7 @@ bool GtkSalGraphics::NWPaintGTKToolbar( gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(gWidgetData[m_nXScreen].gHandleBoxWidget), shadowType ); // evaluate grip rect - if( aValue.getType() == CTRL_TOOLBAR ) + if( aValue.getType() == ControlType::Toolbar ) { const ToolbarValue* pVal = static_cast<const ToolbarValue*>(&aValue); g_x = pVal->maGripRect.Left(); @@ -3091,7 +3092,7 @@ bool GtkSalGraphics::NWPaintGTKToolbar( NWSetWidgetState( pButtonWidget, nState, stateType ); gtk_widget_ensure_style( pButtonWidget ); if(bPaintButton) - NWPaintGTKButtonReal(pButtonWidget, gdkDrawable, 0, 0, rControlRectangle, rClipList, nState, aValue, string); + NWPaintGTKButtonReal(pButtonWidget, gdkDrawable, ControlType::Generic, 0, rControlRectangle, rClipList, nState, aValue, string); } if( nPart != PART_BUTTON ) @@ -3608,7 +3609,7 @@ bool GtkSalGraphics::NWPaintGTKSlider( ControlState nState, const ImplControlValue& rValue, const OUString& ) { - OSL_ASSERT( rValue.getType() == CTRL_SLIDER ); + OSL_ASSERT( rValue.getType() == ControlType::Slider ); NWEnsureGTKSlider( m_nXScreen ); gint w, h; diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index b5fb915c1e30..8f8ee83fdd26 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -298,7 +298,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context, const ImplControlValue& rValue ) { (void)nType; - OSL_ASSERT( rValue.getType() == CTRL_SCROLLBAR ); + OSL_ASSERT( rValue.getType() == ControlType::Scrollbar ); const ScrollbarValue& rScrollbarVal = static_cast<const ScrollbarValue&>(rValue); Rectangle scrollbarRect; GtkStateFlags stateFlags; @@ -642,7 +642,7 @@ void GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, ControlPart nPart, const ImplControlValue& rValue ) { - const SpinbuttonValue *pSpinVal = (rValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&rValue) : nullptr; + const SpinbuttonValue *pSpinVal = (rValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue *>(&rValue) : nullptr; ControlPart upBtnPart = PART_BUTTON_UP; ControlState upBtnState = ControlState::NONE; ControlPart downBtnPart = PART_BUTTON_DOWN; @@ -745,7 +745,7 @@ void GtkSalGraphics::PaintCombobox( GtkStateFlags flags, cairo_t *cr, buttonRect.Top() + (gint)((buttonRect.GetHeight() - arrowRect.GetHeight()) / 2) ) ); - if ( nType == CTRL_COMBOBOX ) + if ( nType == ControlType::Combobox ) { gtk_style_context_save(mpComboboxButtonStyle); gtk_style_context_set_state(mpComboboxButtonStyle, flags); @@ -792,7 +792,7 @@ void GtkSalGraphics::PaintCombobox( GtkStateFlags flags, cairo_t *cr, gtk_style_context_restore(mpComboboxButtonStyle); } - else if (nType == CTRL_LISTBOX) + else if (nType == ControlType::Listbox) { if( nPart == PART_WINDOW ) { @@ -1208,26 +1208,26 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co switch(nType) { - case CTRL_SPINBOX: - case CTRL_SPINBUTTONS: + case ControlType::Spinbox: + case ControlType::SpinButtons: context = mpEntryStyle; renderType = RENDER_SPINBUTTON; break; - case CTRL_EDITBOX: + case ControlType::Editbox: context = mpEntryStyle; break; - case CTRL_MULTILINE_EDITBOX: + case ControlType::MultilineEditbox: context = mpTextViewStyle; break; - case CTRL_COMBOBOX: + case ControlType::Combobox: context = mpComboboxStyle; renderType = RENDER_COMBOBOX; break; - case CTRL_LISTBOX: + case ControlType::Listbox: context = mpListboxStyle; renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_COMBOBOX; break; - case CTRL_MENU_POPUP: + case ControlType::MenuPopup: bInMenu = true; // map selected menu entries in vcl parlance to gtk prelight @@ -1248,7 +1248,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co styleClass = GTK_STYLE_CLASS_CHECK; #endif renderType = RENDER_CHECK; - nType = CTRL_CHECKBOX; + nType = ControlType::Checkbox; if (nState & ControlState::PRESSED) { flags = (GtkStateFlags)(flags | CHECKED); @@ -1262,7 +1262,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co styleClass = GTK_STYLE_CLASS_RADIO; #endif renderType = RENDER_RADIO; - nType = CTRL_RADIOBUTTON; + nType = ControlType::Radiobutton; if (nState & ControlState::PRESSED) { flags = (GtkStateFlags)(flags | CHECKED); @@ -1288,7 +1288,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co break; } break; - case CTRL_TOOLBAR: + case ControlType::Toolbar: switch(nPart) { case PART_DRAW_BACKGROUND_HORZ: @@ -1309,13 +1309,13 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co return false; } break; - case CTRL_RADIOBUTTON: + case ControlType::Radiobutton: flags = (GtkStateFlags)(flags | ( (rValue.getTristateVal() == BUTTONVALUE_ON) ? CHECKED : GTK_STATE_FLAG_NORMAL)); context = mpRadioButtonStyle; renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_RADIO; break; - case CTRL_CHECKBOX: + case ControlType::Checkbox: flags = (GtkStateFlags)(flags | ( (rValue.getTristateVal() == BUTTONVALUE_ON) ? CHECKED : (rValue.getTristateVal() == BUTTONVALUE_MIXED) ? GTK_STATE_FLAG_INCONSISTENT : @@ -1323,10 +1323,10 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co context = mpCheckButtonStyle; renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_CHECK; break; - case CTRL_PUSHBUTTON: + case ControlType::Pushbutton: context = mpButtonStyle; break; - case CTRL_SCROLLBAR: + case ControlType::Scrollbar: switch(nPart) { case PART_DRAW_BACKGROUND_VERT: @@ -1337,27 +1337,27 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co break; } break; - case CTRL_LISTNET: + case ControlType::ListNet: return true; break; - case CTRL_TAB_PANE: + case ControlType::TabPane: context = mpNotebookStyle; break; - case CTRL_TAB_BODY: + case ControlType::TabBody: context = mpNotebookStackStyle; break; - case CTRL_TAB_HEADER: + case ControlType::TabHeader: context = mpNotebookHeaderStyle; break; - case CTRL_TAB_ITEM: + case ControlType::TabItem: context = mpNotebookHeaderTabsTabStyle; if (nState & ControlState::SELECTED) flags = (GtkStateFlags) (flags | ACTIVE_TAB); break; - case CTRL_WINDOW_BACKGROUND: + case ControlType::WindowBackground: context = gtk_widget_get_style_context(mpWindow); break; - case CTRL_FRAME: + case ControlType::Frame: { DrawFrameStyle nStyle = static_cast<DrawFrameStyle>(rValue.getNumericVal() & 0x0f); if (nStyle == DrawFrameStyle::In) @@ -1366,7 +1366,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co context = mpFrameInStyle; break; } - case CTRL_MENUBAR: + case ControlType::Menubar: if (nPart == PART_MENU_ITEM) { context = mpMenuBarItemStyle; @@ -1381,11 +1381,11 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co context = gtk_widget_get_style_context(mpWindow); } break; - case CTRL_FIXEDLINE: + case ControlType::Fixedline: context = nPart == PART_SEPARATOR_HORZ ? mpFixedHoriLineStyle : mpFixedVertLineStyle; renderType = RENDER_SEPERATOR; break; - case CTRL_LISTNODE: + case ControlType::ListNode: { context = mpTreeHeaderButtonStyle; ButtonValue aButtonValue = rValue.getTristateVal(); @@ -1394,7 +1394,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co renderType = RENDER_EXPANDER; break; } - case CTRL_LISTHEADER: + case ControlType::ListHeader: context = mpTreeHeaderButtonStyle; if (nPart == PART_ARROW) { @@ -1407,7 +1407,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co renderType = RENDER_ICON; } break; - case CTRL_PROGRESS: + case ControlType::Progress: context = mpProgressBarProgressStyle; renderType = RENDER_PROGRESS; break; @@ -1428,7 +1428,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co gtk_style_context_set_state(context, flags); parent_styles_context_set_state(context, flags); - if (nType == CTRL_TAB_ITEM) + if (nType == ControlType::TabItem) { GtkBorder margin; #if GTK_CHECK_VERSION(3,19,2) @@ -1511,7 +1511,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co break; case RENDER_FOCUS: { - if (nType != CTRL_CHECKBOX) + if (nType != ControlType::Checkbox) { GtkBorder border; @@ -1601,12 +1601,12 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar Rectangle aEditRect = rControlRegion; gint indicator_size, indicator_spacing, point; - if(((nType == CTRL_CHECKBOX) || (nType == CTRL_RADIOBUTTON)) && + if(((nType == ControlType::Checkbox) || (nType == ControlType::Radiobutton)) && nPart == PART_ENTIRE_CONTROL) { rNativeBoundingRegion = rControlRegion; - GtkStyleContext *pButtonStyle = (nType == CTRL_CHECKBOX) ? mpCheckButtonStyle : mpRadioButtonStyle; + GtkStyleContext *pButtonStyle = (nType == ControlType::Checkbox) ? mpCheckButtonStyle : mpRadioButtonStyle; gtk_style_context_get_style( pButtonStyle, @@ -1629,7 +1629,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar return true; } - else if( nType == CTRL_MENU_POPUP) + else if( nType == ControlType::MenuPopup) { if (((nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == PART_MENU_ITEM_RADIO_MARK) )) @@ -1666,7 +1666,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar Size( arrow_size, arrow_size ) ); } } - else if ( (nType==CTRL_SCROLLBAR) && + else if ( (nType==ControlType::Scrollbar) && ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) || (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ) ) { @@ -1680,44 +1680,44 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar return true; } - if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) ) + if( (nType == ControlType::Menubar) && (nPart == PART_ENTIRE_CONTROL) ) { aEditRect = GetWidgetSize(rControlRegion, gMenuBarWidget); } - else if ( (nType==CTRL_SPINBOX) && + else if ( (nType==ControlType::Spinbox) && ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { Rectangle aControlRegion(GetWidgetSize(rControlRegion, gSpinBox)); aEditRect = NWGetSpinButtonRect(nPart, aControlRegion); } - else if ( (nType==CTRL_COMBOBOX) && + else if ( (nType==ControlType::Combobox) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion ); } - else if ( (nType==CTRL_LISTBOX) && + else if ( (nType==ControlType::Listbox) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion ); } - else if (nType == CTRL_EDITBOX && nPart == PART_ENTIRE_CONTROL) + else if (nType == ControlType::Editbox && nPart == PART_ENTIRE_CONTROL) { aEditRect = GetWidgetSize(rControlRegion, gEntryBox); } - else if (nType == CTRL_LISTBOX && nPart == PART_ENTIRE_CONTROL) + else if (nType == ControlType::Listbox && nPart == PART_ENTIRE_CONTROL) { aEditRect = GetWidgetSize(rControlRegion, gListBox); } - else if (nType == CTRL_COMBOBOX && nPart == PART_ENTIRE_CONTROL) + else if (nType == ControlType::Combobox && nPart == PART_ENTIRE_CONTROL) { aEditRect = GetWidgetSize(rControlRegion, gComboBox); } - else if (nType == CTRL_SPINBOX && nPart == PART_ENTIRE_CONTROL) + else if (nType == ControlType::Spinbox && nPart == PART_ENTIRE_CONTROL) { aEditRect = GetWidgetSize(rControlRegion, gSpinBox); } - else if (nType == CTRL_TAB_ITEM && nPart == PART_ENTIRE_CONTROL) + else if (nType == ControlType::TabItem && nPart == PART_ENTIRE_CONTROL) { const TabitemValue& rTabitemValue = static_cast<const TabitemValue&>(rValue); const Rectangle& rTabitemRect = rTabitemValue.getContentRect(); @@ -1725,7 +1725,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar aEditRect = AdjustRectForTextBordersPadding(mpNotebookHeaderTabsTabStyle, rTabitemRect.GetWidth(), rTabitemRect.GetHeight(), rControlRegion); } - else if (nType == CTRL_FRAME && nPart == PART_BORDER) + else if (nType == ControlType::Frame && nPart == PART_BORDER) { aEditRect = rControlRegion; DrawFrameFlags nStyle = static_cast<DrawFrameFlags>(rValue.getNumericVal() & 0xfff0); @@ -2170,61 +2170,61 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP { switch(nType) { - case CTRL_PUSHBUTTON: - case CTRL_RADIOBUTTON: - case CTRL_CHECKBOX: - case CTRL_PROGRESS: - case CTRL_LISTNODE: - case CTRL_LISTNET: + case ControlType::Pushbutton: + case ControlType::Radiobutton: + case ControlType::Checkbox: + case ControlType::Progress: + case ControlType::ListNode: + case ControlType::ListNet: if (nPart==PART_ENTIRE_CONTROL || nPart == PART_FOCUS) return true; break; - case CTRL_SCROLLBAR: + case ControlType::Scrollbar: if(nPart==PART_DRAW_BACKGROUND_HORZ || nPart==PART_DRAW_BACKGROUND_VERT || nPart==PART_ENTIRE_CONTROL || nPart==HAS_THREE_BUTTONS) return true; break; - case CTRL_EDITBOX: - case CTRL_MULTILINE_EDITBOX: + case ControlType::Editbox: + case ControlType::MultilineEditbox: if (nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE) return true; break; - case CTRL_COMBOBOX: + case ControlType::Combobox: if (nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_ALL_BUTTONS) return true; break; - case CTRL_SPINBOX: + case ControlType::Spinbox: if (nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_ALL_BUTTONS || nPart == PART_BUTTON_UP || nPart == PART_BUTTON_DOWN) return true; break; - case CTRL_SPINBUTTONS: + case ControlType::SpinButtons: if (nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS) return true; break; - case CTRL_FRAME: - case CTRL_WINDOW_BACKGROUND: + case ControlType::Frame: + case ControlType::WindowBackground: return true; - case CTRL_TAB_ITEM: - case CTRL_TAB_HEADER: - case CTRL_TAB_PANE: - case CTRL_TAB_BODY: + case ControlType::TabItem: + case ControlType::TabHeader: + case ControlType::TabPane: + case ControlType::TabBody: if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL) return true; break; - case CTRL_LISTBOX: + case ControlType::Listbox: if (nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_FOCUS) return true; break; - case CTRL_TOOLBAR: + case ControlType::Toolbar: if( nPart==PART_ENTIRE_CONTROL // || nPart==PART_DRAW_BACKGROUND_HORZ // || nPart==PART_DRAW_BACKGROUND_VERT @@ -2237,12 +2237,12 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP return true; break; - case CTRL_MENUBAR: + case ControlType::Menubar: if (nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM) return true; break; - case CTRL_MENU_POPUP: + case ControlType::MenuPopup: if (nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM || nPart==PART_MENU_ITEM_CHECK_MARK @@ -2253,23 +2253,24 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP return true; break; -// case CTRL_SLIDER: +// case ControlType::Slider: // if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA) // return true; // break; - case CTRL_FIXEDLINE: + case ControlType::Fixedline: if (nPart == PART_SEPARATOR_VERT || nPart == PART_SEPARATOR_HORZ) return true; break; - case CTRL_LISTHEADER: + case ControlType::ListHeader: if (nPart == PART_BUTTON || nPart == PART_ARROW) return true; break; + default: break; } - SAL_INFO("vcl.gtk", "Unhandled is native supported for Type:" << nType << ", Part" << nPart); + SAL_INFO("vcl.gtk", "Unhandled is native supported for Type:" << (int)nType << ", Part" << nPart); return false; } diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 0f1b8bdcff0c..512a5d1fda60 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -617,7 +617,7 @@ bool WidgetPainter::drawStyledWidget( QWidget *pWidget, } else if ( strcmp( QSpinWidget_String, pClassName ) == 0 ) { - const SpinbuttonValue* pValue = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue*>(&aValue) : NULL; + const SpinbuttonValue* pValue = (aValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue*>(&aValue) : NULL; // Is any of the buttons pressed? QStyle::SCFlags eActive = QStyle::SC_None; @@ -706,7 +706,7 @@ bool WidgetPainter::drawStyledWidget( QWidget *pWidget, } else if ( strcmp( QScrollBar_String, pClassName ) == 0 ) { - const ScrollbarValue* pValue = (aValue.getType() == CTRL_SCROLLBAR) ? static_cast<const ScrollbarValue*>(&aValue) : NULL; + const ScrollbarValue* pValue = (aValue.getType() == ControlType::Scrollbar) ? static_cast<const ScrollbarValue*>(&aValue) : NULL; QStyle::SCFlags eActive = QStyle::SC_None; if ( pValue ) @@ -1109,7 +1109,7 @@ QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion, m_pScrollBar->resize( qRect.size() ); m_pScrollBar->setOrientation( bHorizontal? Qt::Horizontal: Qt::Vertical ); - const ScrollbarValue* pValue = (aValue.getType() == CTRL_SCROLLBAR) ? static_cast<const ScrollbarValue*>(&aValue) : NULL; + const ScrollbarValue* pValue = (aValue.getType() == ControlType::Scrollbar) ? static_cast<const ScrollbarValue*>(&aValue) : NULL; if ( pValue ) { m_pScrollBar->setMinValue( pValue->mnMin ); @@ -1268,28 +1268,28 @@ class KDESalGraphics : public X11SalGraphics bool KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { return - ( (nType == CTRL_PUSHBUTTON) && (nPart == PART_ENTIRE_CONTROL) ) || - ( (nType == CTRL_RADIOBUTTON) && (nPart == PART_ENTIRE_CONTROL) ) || - ( (nType == CTRL_CHECKBOX) && (nPart == PART_ENTIRE_CONTROL) ) || - ( (nType == CTRL_COMBOBOX) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || - ( (nType == CTRL_EDITBOX) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || - ( (nType == CTRL_LISTBOX) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_WINDOW || nPart == HAS_BACKGROUND_TEXTURE ) ) || - ( (nType == CTRL_SPINBOX) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || - // no CTRL_SPINBUTTONS for KDE - ( (nType == CTRL_TAB_ITEM) && (nPart == PART_ENTIRE_CONTROL) ) || - ( (nType == CTRL_TAB_PANE) && (nPart == PART_ENTIRE_CONTROL) ) || - // no CTRL_TAB_BODY for KDE - ( (nType == CTRL_SCROLLBAR) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT) ) || - ( (nType == CTRL_SCROLLBAR) && (nPart == HAS_THREE_BUTTONS) ) || // TODO small optimization is possible here: return this only if the style really has 3 buttons - // CTRL_GROUPBOX not supported - // CTRL_FIXEDLINE not supported - ( (nType == CTRL_TOOLBAR) && (nPart == PART_ENTIRE_CONTROL || + ( (nType == ControlType::Pushbutton) && (nPart == PART_ENTIRE_CONTROL) ) || + ( (nType == ControlType::Radiobutton) && (nPart == PART_ENTIRE_CONTROL) ) || + ( (nType == ControlType::Checkbox) && (nPart == PART_ENTIRE_CONTROL) ) || + ( (nType == ControlType::Combobox) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || + ( (nType == ControlType::Editbox) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || + ( (nType == ControlType::Listbox) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_WINDOW || nPart == HAS_BACKGROUND_TEXTURE ) ) || + ( (nType == ControlType::Spinbox) && (nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE) ) || + // no ControlType::SpinButtons for KDE + ( (nType == ControlType::TabItem) && (nPart == PART_ENTIRE_CONTROL) ) || + ( (nType == ControlType::TabPane) && (nPart == PART_ENTIRE_CONTROL) ) || + // no ControlType::TabBody for KDE + ( (nType == ControlType::Scrollbar) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT) ) || + ( (nType == ControlType::Scrollbar) && (nPart == HAS_THREE_BUTTONS) ) || // TODO small optimization is possible here: return this only if the style really has 3 buttons + // ControlType::Groupbox not supported + // ControlType::Fixedline not supported + ( (nType == ControlType::Toolbar) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT || nPart == PART_BUTTON) ) || - ( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) || - ( (nType == CTRL_MENU_POPUP) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) || - ( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) ) + ( (nType == ControlType::Menubar) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) || + ( (nType == ControlType::MenuPopup) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) || + ( (nType == ControlType::Progress) && (nPart == PART_ENTIRE_CONTROL) ) ; } @@ -1303,7 +1303,7 @@ bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& rPos, bool& rIsInside ) { - if ( nType == CTRL_SCROLLBAR ) + if ( nType == ControlType::Scrollbar ) { // make position relative to rControlRegion Point aPos = rPos - rControlRegion.TopLeft(); @@ -1412,97 +1412,97 @@ bool KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, { bool bReturn = false; - if ( (nType == CTRL_PUSHBUTTON) && (nPart == PART_ENTIRE_CONTROL) ) + if ( (nType == ControlType::Pushbutton) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->pushButton( rControlRegion, bool(nState & ControlState::DEFAULT) ), nState, aValue, this ); } - else if ( (nType == CTRL_RADIOBUTTON) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Radiobutton) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->radioButton( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_CHECKBOX) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Checkbox) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->checkBox( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_COMBOBOX) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Combobox) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->comboBox( rControlRegion, true ), nState, aValue, this ); } - else if ( (nType == CTRL_EDITBOX) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Editbox) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->lineEdit( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_LISTBOX) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Listbox) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->comboBox( rControlRegion, false ), nState, aValue, this ); } - else if ( (nType == CTRL_LISTBOX) && (nPart == PART_WINDOW) ) + else if ( (nType == ControlType::Listbox) && (nPart == PART_WINDOW) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->listView( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_SPINBOX) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Spinbox) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->spinWidget( rControlRegion ), nState, aValue, this ); } - else if ( (nType==CTRL_TAB_ITEM) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType==ControlType::TabItem) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->tabBar( rControlRegion ), nState, aValue, this ); } - else if ( (nType==CTRL_TAB_PANE) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType==ControlType::TabPane) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->tabWidget( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_SCROLLBAR) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT) ) + else if ( (nType == ControlType::Scrollbar) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->scrollBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ, aValue ), nState, aValue, this ); } - else if ( (nType == CTRL_TOOLBAR) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) + else if ( (nType == ControlType::Toolbar) && (nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->toolBar( rControlRegion, nPart == PART_DRAW_BACKGROUND_HORZ || nPart == PART_THUMB_VERT ), nState, aValue, this, nPart ); } - else if ( (nType == CTRL_TOOLBAR) && (nPart == PART_BUTTON) ) + else if ( (nType == ControlType::Toolbar) && (nPart == PART_BUTTON) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->toolButton( rControlRegion ), nState, aValue, this, nPart ); } - else if ( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) + else if ( (nType == ControlType::Menubar) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->menuBar( rControlRegion ), nState, aValue, this, nPart ); } - else if ( (nType == CTRL_MENU_POPUP) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) + else if ( (nType == ControlType::MenuPopup) && (nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->popupMenu( rControlRegion ), nState, aValue, this ); } - else if ( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) ) + else if ( (nType == ControlType::Progress) && (nPart == PART_ENTIRE_CONTROL) ) { bReturn = pWidgetPainter->drawStyledWidget( pWidgetPainter->progressBar( rControlRegion ), @@ -1543,7 +1543,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar switch ( nType ) { // Metrics of the push button - case CTRL_PUSHBUTTON: + case ControlType::Pushbutton: pWidget = pWidgetPainter->pushButton( rControlRegion, bool( nState & ControlState::DEFAULT ) ); switch ( nPart ) @@ -1564,7 +1564,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar break; // Metrics of the radio button - case CTRL_RADIOBUTTON: + case ControlType::Radiobutton: pWidget = pWidgetPainter->radioButton( rControlRegion ); if ( nPart == PART_ENTIRE_CONTROL ) @@ -1577,7 +1577,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar break; // Metrics of the check box - case CTRL_CHECKBOX: + case ControlType::Checkbox: pWidget = pWidgetPainter->checkBox( rControlRegion ); if ( nPart == PART_ENTIRE_CONTROL ) @@ -1590,9 +1590,9 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar break; // Metrics of the combo box - case CTRL_COMBOBOX: - case CTRL_LISTBOX: - pWidget = pWidgetPainter->comboBox( rControlRegion, ( nType == CTRL_COMBOBOX ) ); + case ControlType::Combobox: + case ControlType::Listbox: + pWidget = pWidgetPainter->comboBox( rControlRegion, ( nType == ControlType::Combobox ) ); switch ( nPart ) { case PART_BUTTON_DOWN: @@ -1615,7 +1615,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar break; // Metrics of the spin box - case CTRL_SPINBOX: + case ControlType::Spinbox: pWidget = pWidgetPainter->spinWidget( rControlRegion ); switch ( nPart ) { @@ -1643,7 +1643,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar break; // Metrics of the scroll bar - case CTRL_SCROLLBAR: + case ControlType::Scrollbar: pWidget = pWidgetPainter->scrollBar( rControlRegion, ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT ), ImplControlValue() ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 70fafa58b51e..434b259fa7e3 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -77,33 +77,33 @@ bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par { switch (type) { - case CTRL_PUSHBUTTON: - case CTRL_RADIOBUTTON: - case CTRL_CHECKBOX: - case CTRL_TOOLTIP: - case CTRL_PROGRESS: - case CTRL_LISTNODE: + case ControlType::Pushbutton: + case ControlType::Radiobutton: + case ControlType::Checkbox: + case ControlType::Tooltip: + case ControlType::Progress: + case ControlType::ListNode: return (part == PART_ENTIRE_CONTROL); - case CTRL_MENUBAR: - case CTRL_MENU_POPUP: - case CTRL_EDITBOX: - case CTRL_COMBOBOX: - case CTRL_TOOLBAR: - case CTRL_FRAME: - case CTRL_SCROLLBAR: - case CTRL_WINDOW_BACKGROUND: - case CTRL_GROUPBOX: - case CTRL_FIXEDLINE: + case ControlType::Menubar: + case ControlType::MenuPopup: + case ControlType::Editbox: + case ControlType::Combobox: + case ControlType::Toolbar: + case ControlType::Frame: + case ControlType::Scrollbar: + case ControlType::WindowBackground: + case ControlType::Groupbox: + case ControlType::Fixedline: return true; - case CTRL_LISTBOX: + case ControlType::Listbox: return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE); - case CTRL_SPINBOX: + case ControlType::Spinbox: return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE); - case CTRL_SLIDER: + case ControlType::Slider: return (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA); default: @@ -210,7 +210,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, return false; } - if( lastPopupRect.isValid() && ( type != CTRL_MENU_POPUP || part != PART_MENU_ITEM )) + if( lastPopupRect.isValid() && ( type != ControlType::MenuPopup || part != PART_MENU_ITEM )) lastPopupRect = QRect(); bool returnVal = true; @@ -226,14 +226,14 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, QRegion* clipRegion = nullptr; - if (type == CTRL_PUSHBUTTON) + if (type == ControlType::Pushbutton) { m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_PushButton, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_MENUBAR) + else if (type == ControlType::Menubar) { if (part == PART_MENU_ITEM) { @@ -259,7 +259,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, returnVal = false; } } - else if (type == CTRL_MENU_POPUP) + else if (type == ControlType::MenuPopup) { OSL_ASSERT( part == PART_MENU_ITEM ? lastPopupRect.isValid() : !lastPopupRect.isValid()); if( part == PART_MENU_ITEM ) @@ -306,7 +306,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, // paints the whole menu item, so translate position (and it'll be clipped); // it is also necessary to fill the background transparently first, as this // is painted after menuitem highlight, otherwise there would be a grey area - assert( value.getType() == CTRL_MENU_POPUP ); + assert( value.getType() == ControlType::MenuPopup ); const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value); QRect menuItemRect( region2QRect( menuVal->maItemRect )); QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(), @@ -328,7 +328,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, else returnVal = false; } - else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) ) + else if ( (type == ControlType::Toolbar) && (part == PART_BUTTON) ) { m_image->fill( Qt::transparent ); QStyleOptionToolButton option; @@ -342,7 +342,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CC_ToolButton, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) ) + else if ( (type == ControlType::Toolbar) && (part == PART_ENTIRE_CONTROL) ) { QStyleOptionToolBar option; @@ -352,7 +352,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CE_ToolBar, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) ) + else if ( (type == ControlType::Toolbar) && (part == PART_THUMB_VERT) ) { // reduce paint area only to the handle area const int width = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); QRect rect( 0, 0, width, widgetRect.height()); @@ -364,7 +364,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value), rect ); } - else if (type == CTRL_EDITBOX) + else if (type == ControlType::Editbox) { QStyleOptionFrameV2 option; draw( QStyle::PE_PanelLineEdit, &option, m_image.get(), @@ -373,7 +373,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::PE_FrameLineEdit, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value)); } - else if (type == CTRL_COMBOBOX) + else if (type == ControlType::Combobox) { QStyleOptionComboBox option; option.editable = true; @@ -381,7 +381,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CC_ComboBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_LISTBOX) + else if (type == ControlType::Listbox) { QStyleOptionComboBox option; switch (part) { @@ -405,7 +405,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, break; } } - else if (type == CTRL_LISTNODE) + else if (type == ControlType::ListNode) { m_image->fill( Qt::transparent ); QStyleOption option; @@ -417,19 +417,19 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::PE_IndicatorBranch, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_CHECKBOX) + else if (type == ControlType::Checkbox) { m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_CheckBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_SCROLLBAR) + else if (type == ControlType::Scrollbar) { if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ)) { QStyleOptionSlider option; - OSL_ASSERT( value.getType() == CTRL_SCROLLBAR ); + OSL_ASSERT( value.getType() == ControlType::Scrollbar ); const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&value); //if the scroll bar is active (aka not degenrate...allow for hover events @@ -463,12 +463,12 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, returnVal = false; } } - else if (type == CTRL_SPINBOX) + else if (type == ControlType::Spinbox) { QStyleOptionSpinBox option; // determine active control - if( value.getType() == CTRL_SPINBUTTONS ) + if( value.getType() == ControlType::SpinButtons ) { const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue *>(&value); if( (pSpinVal->mnUpperState & ControlState::PRESSED) ) @@ -480,26 +480,26 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CC_SpinBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_GROUPBOX) + else if (type == ControlType::Groupbox) { QStyleOptionGroupBox option; draw( QStyle::CC_GroupBox, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_RADIOBUTTON) + else if (type == ControlType::Radiobutton) { m_image->fill( Qt::transparent ); QStyleOptionButton option; draw( QStyle::CE_RadioButton, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_TOOLTIP) + else if (type == ControlType::Tooltip) { QStyleOption option; draw( QStyle::PE_PanelTipLabel, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_FRAME) + else if (type == ControlType::Frame) { lcl_drawFrame( QStyle::PE_Frame, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); @@ -508,11 +508,11 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, int fw = static_cast< KDESalInstance* >(GetSalData()->m_pInstance)->getFrameWidth(); clipRegion = new QRegion( QRegion( widgetRect ).subtracted( widgetRect.adjusted( fw, fw, -fw, -fw ))); } - else if (type == CTRL_WINDOW_BACKGROUND) + else if (type == ControlType::WindowBackground) { m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); } - else if (type == CTRL_FIXEDLINE) + else if (type == ControlType::Fixedline) { QStyleOptionMenuItem option; option.menuItemType = QStyleOptionMenuItem::Separator; @@ -521,9 +521,9 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CE_MenuItem, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA)) + else if (type == ControlType::Slider && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA)) { - OSL_ASSERT( value.getType() == CTRL_SLIDER ); + OSL_ASSERT( value.getType() == ControlType::Slider ); const SliderValue* slVal = static_cast<const SliderValue *>(&value); QStyleOptionSlider option; @@ -539,7 +539,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, draw( QStyle::CC_Slider, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) ); } - else if( type == CTRL_PROGRESS && part == PART_ENTIRE_CONTROL ) + else if( type == ControlType::Progress && part == PART_ENTIRE_CONTROL ) { QStyleOptionProgressBarV2 option; option.minimum = 0; @@ -634,7 +634,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, switch ( type ) { // Metrics of the push button - case CTRL_PUSHBUTTON: + case ControlType::Pushbutton: if (part == PART_ENTIRE_CONTROL) { styleOption.state = vclStateValue2StateFlag(controlState, val); @@ -650,7 +650,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } } break; - case CTRL_EDITBOX: + case ControlType::Editbox: { int nFontHeight = QApplication::fontMetrics().height(); //int nFrameSize = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth); @@ -671,7 +671,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; } - case CTRL_CHECKBOX: + case ControlType::Checkbox: if (part == PART_ENTIRE_CONTROL) { styleOption.state = vclStateValue2StateFlag(controlState, val); @@ -695,8 +695,8 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; } SAL_FALLTHROUGH; - case CTRL_COMBOBOX: - case CTRL_LISTBOX: + case ControlType::Combobox: + case ControlType::Listbox: { QStyleOptionComboBox cbo; @@ -719,7 +719,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, // FIXME: why this difference between comboboxes and listboxes ? // because a combobox has a sub edit and that is positioned // inside the outer bordered control ? - if( type == CTRL_COMBOBOX ) { + if( type == ControlType::Combobox ) { int size = QApplication::style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2; contentRect.adjust(-size,-size,size,size); } @@ -764,7 +764,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } break; } - case CTRL_SPINBOX: + case ControlType::Spinbox: { QStyleOptionSpinBox sbo; @@ -800,7 +800,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } break; } - case CTRL_MENU_POPUP: + case ControlType::MenuPopup: { int h, w; switch ( part ) { @@ -821,7 +821,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } break; } - case CTRL_FRAME: + case ControlType::Frame: { if( part == PART_BORDER ) { @@ -839,7 +839,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } break; } - case CTRL_RADIOBUTTON: + case ControlType::Radiobutton: { const int h = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight); const int w = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth); @@ -856,7 +856,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, retVal = true; break; } - case CTRL_SLIDER: + case ControlType::Slider: { const int w = QApplication::style()->pixelMetric(QStyle::PM_SliderLength); if( part == PART_THUMB_HORZ ) @@ -873,7 +873,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, } break; } - case CTRL_SCROLLBAR: + case ControlType::Scrollbar: { // core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(), // for the rest also provide the track area (i.e. area not taken by buttons) @@ -934,7 +934,7 @@ bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& rPos, bool& rIsInside ) { - if ( nType == CTRL_SCROLLBAR ) + if ( nType == ControlType::Scrollbar ) { if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT ) |