diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-18 20:16:11 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-20 07:16:46 +0000 |
commit | 67c9d054517fc3b5cbc203c330eedef4b50f0e57 (patch) | |
tree | 1fad773f770e4ee4265bb05ba77d7f3084aedd3b /vcl | |
parent | 8091cf383a122f2348d6e25df90fc26579fe6ef7 (diff) |
fdo#84938: replace TIB_ constants with enum
Change-Id: I435ce2331fb49e7ce9fe97bdfddfaef706759a84
Reviewed-on: https://gerrit.libreoffice.org/12023
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/builder.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 43 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 20 |
4 files changed, 35 insertions, 36 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 4f7202f0e5d1..e534e414a778 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1618,9 +1618,9 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c OUString aCommand(OStringToOUString(extractActionName(rMap), RTL_TEXTENCODING_UTF8)); sal_uInt16 nItemId = 0; - ToolBoxItemBits nBits = 0; + ToolBoxItemBits nBits = ToolBoxItemBits::NONE; if (name == "GtkMenuToolButton") - nBits |= TIB_DROPDOWN; + nBits |= ToolBoxItemBits::DROPDOWN; if (!aCommand.isEmpty() && m_xFrame.is()) { diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 1f0bcee25caa..63011d297395 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -144,7 +144,7 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : aCloseBtn.SetPaintTransparent(true); aCloseBtn.SetParentClipMode(PARENTCLIPMODE_NOCLIP); - aCloseBtn.InsertItem(IID_DOCUMENTCLOSE, aCloseBtn.maImage, 0); + aCloseBtn.InsertItem(IID_DOCUMENTCLOSE, aCloseBtn.maImage, ToolBoxItemBits::NONE); aCloseBtn.SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl)); aCloseBtn.AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl)); aCloseBtn.SetQuickHelpText(IID_DOCUMENTCLOSE, ResId(SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr).toString()); @@ -1086,7 +1086,7 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i AddButtonEntry& rNewEntry = m_aAddButtons[nId]; rNewEntry.m_nId = nId; rNewEntry.m_aSelectLink = i_rLink; - aCloseBtn.InsertItem(nId, i_rImage, 0, 0); + aCloseBtn.InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0); aCloseBtn.calcMinSize(); ShowButtons(aCloseBtn.IsItemVisible(IID_DOCUMENTCLOSE), aFloatBtn.IsVisible(), aHideBtn.IsVisible()); LayoutChanged(); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 816fac94d9e6..c701e33befa0 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -167,13 +167,12 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis ) ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ) { ButtonType tmpButtonType = defaultType; - ToolBoxItemBits nBits( pItem->mnBits & 0x300 ); - if ( nBits & TIB_TEXTICON ) // item has custom setting + if ( pItem->mnBits & (ToolBoxItemBits::TEXT_ONLY | ToolBoxItemBits::ICON_ONLY) ) // item has custom setting { tmpButtonType = BUTTON_SYMBOLTEXT; - if ( nBits == TIB_TEXT_ONLY ) + if ( pItem->mnBits & ToolBoxItemBits::TEXT_ONLY ) tmpButtonType = BUTTON_TEXT; - else if ( nBits == TIB_ICON_ONLY ) + else if ( pItem->mnBits & ToolBoxItemBits::ICON_ONLY ) tmpButtonType = BUTTON_SYMBOL; } return tmpButtonType; @@ -1820,7 +1819,7 @@ bool ToolBox::ImplCalcItem() } // add in drop down arrow - if( it->mnBits & TIB_DROPDOWN ) + if( it->mnBits & ToolBoxItemBits::DROPDOWN ) { it->maItemSize.Width() += nDropDownArrowWidth; it->mnDropDownArrowWidth = nDropDownArrowWidth; @@ -2620,7 +2619,7 @@ void ToolBox::ImplFormat( bool bResize ) IMPL_LINK_NOARG(ToolBox, ImplDropdownLongClickHdl) { if( mnCurPos != TOOLBOX_ITEM_NOTFOUND && - (mpData->m_aItems[ mnCurPos ].mnBits & TIB_DROPDOWN) + (mpData->m_aItems[ mnCurPos ].mnBits & ToolBoxItemBits::DROPDOWN) ) { mpData->mbDropDownByKeyboard = false; @@ -2963,8 +2962,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate ) { // separate button not for dropdown only where the whole button is painted - if ( pItem->mnBits & TIB_DROPDOWN && - ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) ) + if ( pItem->mnBits & ToolBoxItemBits::DROPDOWN && + ((pItem->mnBits & ToolBoxItemBits::DROPDOWNONLY) != ToolBoxItemBits::DROPDOWNONLY) ) { Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz ); if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side @@ -3126,7 +3125,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, // draw the image nImageOffX = nOffX; nImageOffY = nOffY; - if ( (pItem->mnBits & (TIB_LEFT|TIB_DROPDOWN)) || bText ) + if ( (pItem->mnBits & (ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN)) || bText ) { // left align also to leave space for drop down arrow // and when drawing text+image @@ -3220,7 +3219,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, return; // paint optional drop down arrow - if ( pItem->mnBits & TIB_DROPDOWN ) + if ( pItem->mnBits & ToolBoxItemBits::DROPDOWN ) { Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz ) ); bool bSetColor = true; @@ -3231,7 +3230,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, } // dropdown only will be painted without inner border - if( (pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY ) + if( (pItem->mnBits & ToolBoxItemBits::DROPDOWNONLY) != ToolBoxItemBits::DROPDOWNONLY ) { ImplErase( this, aDropDownRect, nHighlight != 0, bHasOpenPopup ); @@ -3374,7 +3373,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat ) Highlight(); } - if ( (pItem->mnBits & TIB_REPEAT) && bRepeat ) + if ( (pItem->mnBits & ToolBoxItemBits::REPEAT) && bRepeat ) Select(); } else @@ -3422,7 +3421,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) // stop eventual running dropdown timer if( mnCurPos < mpData->m_aItems.size() && - (mpData->m_aItems[mnCurPos].mnBits & TIB_DROPDOWN ) ) + (mpData->m_aItems[mnCurPos].mnBits & ToolBoxItemBits::DROPDOWN ) ) { mpData->maDropdownTimer.Stop(); } @@ -3458,9 +3457,9 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) if ( !bCancel ) { // execute AutoCheck if required - if ( pItem->mnBits & TIB_AUTOCHECK ) + if ( pItem->mnBits & ToolBoxItemBits::AUTOCHECK ) { - if ( pItem->mnBits & TIB_RADIOCHECK ) + if ( pItem->mnBits & ToolBoxItemBits::RADIOCHECK ) { if ( pItem->meState != TRISTATE_TRUE ) SetItemState( pItem->mnId, TRISTATE_TRUE ); @@ -3476,7 +3475,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel ) // do not call Select when Repeat is active, as in this // case that was triggered already in MouseButtonDown - if ( !(pItem->mnBits & TIB_REPEAT) ) + if ( !(pItem->mnBits & ToolBoxItemBits::REPEAT) ) { // prevent from being destroyed in the select handler ImplDelData aDelData; @@ -3829,7 +3828,7 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) mnDownItemId = mnCurItemId; mnMouseClicks = rMEvt.GetClicks(); mnMouseModifier = rMEvt.GetModifier(); - if ( it->mnBits & TIB_REPEAT ) + if ( it->mnBits & ToolBoxItemBits::REPEAT ) nTrackFlags |= STARTTRACK_BUTTONREPEAT; if ( mbSelection ) @@ -3855,9 +3854,9 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) } // was dropdown arrow pressed - if( (it->mnBits & TIB_DROPDOWN) ) + if( (it->mnBits & ToolBoxItemBits::DROPDOWN) ) { - if( ( (it->mnBits & TIB_DROPDOWNONLY) == TIB_DROPDOWNONLY) || it->GetDropDownRect( mbHorz ).IsInside( aMousePos )) + if( ( (it->mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) || it->GetDropDownRect( mbHorz ).IsInside( aMousePos )) { // dropdownonly always triggers the dropdown handler, over the whole button area @@ -4923,9 +4922,9 @@ bool ToolBox::ImplActivateItem( vcl::KeyCode aKeyCode ) { mnDownItemId = mnCurItemId = mnHighItemId; ImplToolItem* pItem = ImplGetItem( mnHighItemId ); - if ( pItem->mnBits & TIB_AUTOCHECK ) + if ( pItem->mnBits & ToolBoxItemBits::AUTOCHECK ) { - if ( pItem->mnBits & TIB_RADIOCHECK ) + if ( pItem->mnBits & ToolBoxItemBits::RADIOCHECK ) { if ( pItem->meState != TRISTATE_TRUE ) SetItemState( pItem->mnId, TRISTATE_TRUE ); @@ -5000,7 +4999,7 @@ bool ToolBox::ImplOpenItem( vcl::KeyCode aKeyCode ) mpData->mnEventId = Application::PostUserEvent( LINK( this, ToolBox, ImplCallExecuteCustomMenu ) ); } else if( mnHighItemId && ImplGetItem( mnHighItemId ) && - (ImplGetItem( mnHighItemId )->mnBits & TIB_DROPDOWN) ) + (ImplGetItem( mnHighItemId )->mnBits & ToolBoxItemBits::DROPDOWN) ) { if( ImplCloseLastPopup( GetParent() ) ) return bRet; diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 2f8e1fdf663c..9517f07a56ad 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -109,7 +109,7 @@ void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits, ImplToolItem::ImplToolItem() { - init(0, 0, true); + init(0, ToolBoxItemBits::NONE, true); } ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, @@ -318,7 +318,7 @@ void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbIma Rectangle ImplToolItem::GetDropDownRect( bool bHorz ) const { Rectangle aRect; - if( (mnBits & TIB_DROPDOWN) && !maRect.IsEmpty() ) + if( (mnBits & ToolBoxItemBits::DROPDOWN) && !maRect.IsEmpty() ) { aRect = maRect; if( mbVisibleText && !bHorz ) @@ -1069,10 +1069,10 @@ void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits ) { ToolBoxItemBits nOldBits = mpData->m_aItems[nPos].mnBits; mpData->m_aItems[nPos].mnBits = nBits; - nBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; - nOldBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN; + nBits &= ToolBoxItemBits::LEFT | ToolBoxItemBits::AUTOSIZE | ToolBoxItemBits::DROPDOWN; + nOldBits &= ToolBoxItemBits::LEFT | ToolBoxItemBits::AUTOSIZE | ToolBoxItemBits::DROPDOWN; // trigger reformat when the item width has changed (dropdown arrow) - bool bFormat = (nBits & TIB_DROPDOWN) != (nOldBits & TIB_DROPDOWN); + bool bFormat = (nBits & ToolBoxItemBits::DROPDOWN) != (nOldBits & ToolBoxItemBits::DROPDOWN); if ( nBits != nOldBits ) ImplInvalidate( true, bFormat ); } @@ -1085,7 +1085,7 @@ ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const if ( pItem ) return pItem->mnBits; else - return 0; + return ToolBoxItemBits::NONE; } void ToolBox::SetItemExpand( sal_uInt16 nItemId, bool bExpand ) @@ -1419,8 +1419,8 @@ void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) if ( pItem->meState != eState ) { // if RadioCheck, un-check the previous - if ( (eState == TRISTATE_TRUE) && (pItem->mnBits & TIB_AUTOCHECK) && - (pItem->mnBits & TIB_RADIOCHECK) ) + if ( (eState == TRISTATE_TRUE) && (pItem->mnBits & ToolBoxItemBits::AUTOCHECK) && + (pItem->mnBits & ToolBoxItemBits::RADIOCHECK) ) { ImplToolItem* pGroupItem; sal_uInt16 nGroupPos; @@ -1430,7 +1430,7 @@ void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) while ( nGroupPos ) { pGroupItem = &mpData->m_aItems[nGroupPos-1]; - if ( pGroupItem->mnBits & TIB_RADIOCHECK ) + if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK ) { if ( pGroupItem->meState != TRISTATE_FALSE ) SetItemState( pGroupItem->mnId, TRISTATE_FALSE ); @@ -1444,7 +1444,7 @@ void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState ) while ( nGroupPos < nItemCount ) { pGroupItem = &mpData->m_aItems[nGroupPos]; - if ( pGroupItem->mnBits & TIB_RADIOCHECK ) + if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK ) { if ( pGroupItem->meState != TRISTATE_FALSE ) SetItemState( pGroupItem->mnId, TRISTATE_FALSE ); |